/config/ac_static_modules.m4

https://code.google.com/ · m4 · 162 lines · 90 code · 35 blank · 37 comment · 0 complexity · 8ba1bd77606a3eb1e3a40d77e8fe5599 MD5 · raw file

  1. ##*****************************************************************************
  2. ## $Id$
  3. ##*****************************************************************************
  4. # AUTHOR:
  5. # Al Chu <chu11@llnl.gov>
  6. #
  7. # SYNOPSIS:
  8. # AC_STATIC_MODULE
  9. #
  10. # DESCRIPTION:
  11. # Output #include files for static modules.
  12. #
  13. # WARNINGS:
  14. # This macro must be placed after AC_PROG_CC or equivalent.
  15. ##*****************************************************************************
  16. # This must be called before checks before any specific modules are done
  17. AC_DEFUN([AC_STATIC_MODULES_INIT],
  18. [
  19. rm -f static_modules.h
  20. ])
  21. AC_DEFUN([AC_ADD_STATIC_MODULE],
  22. [
  23. if test "$ac_static_modules" = "yes" ; then
  24. MODULES="$MODULES $1"
  25. fi
  26. ])
  27. AC_DEFUN([AC_STATIC_MODULES_EXIT],
  28. [
  29. # check for module conflicts
  30. if test "$ac_have_libgenders" = "yes" && test "$ac_have_nodeattr" = "yes"; then
  31. AC_MSG_ERROR([--with-genders conflicts with --with-nodeattr])
  32. fi
  33. if test "$ac_have_libgenders" = "yes" && test "$ac_have_machines" = "yes"; then
  34. AC_MSG_ERROR([--with-genders conflicts with --with-machines])
  35. fi
  36. if test "$ac_have_libgenders" = "yes" && test "$ac_have_sdr" = "yes"; then
  37. AC_MSG_ERROR([--with-genders conflicts with --with-sdr])
  38. fi
  39. if test "$ac_have_nodeattr" = "yes" && test "$ac_have_machines" = "yes"; then
  40. AC_MSG_ERROR([--with-nodeattr conflicts with --with-machines])
  41. fi
  42. if test "$ac_have_nodeattr" = "yes" && test "$ac_have_sdr" = "yes"; then
  43. AC_MSG_ERROR([--with-nodeattr conflicts with --with-sdr])
  44. fi
  45. if test "$ac_have_machines" = "yes" && test "$ac_have_sdr" = "yes"; then
  46. AC_MSG_ERROR([--with-machines conflicts with --with-sdr])
  47. fi
  48. if test "$ac_have_qshell" = "yes" && test "$ac_have_mqshell" = "yes"; then
  49. AC_MSG_ERROR([--with-qshell conflicts with --with-mqshell])
  50. fi
  51. for module in $MODULES; do
  52. LIBMODS_OBJS="$LIBMODS_OBJS ${module}.lo"
  53. done
  54. AC_SUBST(LIBMODS_OBJS)
  55. # Output the static_modules.h file
  56. # must be in current directory, other paths may not exist yet.
  57. output_file="static_modules.h"
  58. ##-----------------------------------------------------------------
  59. cat >$output_file <<_MEOF
  60. /*
  61. * This file is generated by autoconf and is included by mod.c.
  62. * It allows mod.c to access all statically compiled pdsh_module
  63. * structures available.
  64. */
  65. #ifndef _STATIC_MODULES_H
  66. #define _STATic_MODULES_H
  67. #if HAVE_CONFIG_H
  68. # include "config.h"
  69. #endif
  70. #if STATIC_MODULES
  71. /* module information structures */
  72. _MEOF
  73. ##-----------------------------------------------------------------
  74. for i in $MODULES
  75. do
  76. echo "extern struct pdsh_module ${i}_module_info;" >> $output_file
  77. echo "extern int ${i}_module_priority;" >> $output_file
  78. done
  79. ##-----------------------------------------------------------------
  80. cat >>$output_file <<_MEOF
  81. /*
  82. * Array of all pdsh_module structures we are compiling
  83. */
  84. struct pdsh_module *static_mods[[]] = {
  85. _MEOF
  86. ##-----------------------------------------------------------------
  87. for i in $MODULES
  88. do
  89. echo " &${i}_module_info," >> $output_file
  90. done
  91. ##-----------------------------------------------------------------
  92. cat >>$output_file <<_MEOF
  93. NULL
  94. };
  95. /*
  96. * Names of all the module structures
  97. */
  98. char *static_mod_names[[]] = {
  99. _MEOF
  100. ##-----------------------------------------------------------------
  101. for i in $MODULES
  102. do
  103. echo " \"${i}\"," >> $output_file
  104. done
  105. ##-----------------------------------------------------------------
  106. cat >>$output_file <<_MEOF
  107. NULL
  108. };
  109. /*
  110. * Module priorities
  111. */
  112. int *priority[[]] = {
  113. _MEOF
  114. ##-----------------------------------------------------------------
  115. for i in $MODULES
  116. do
  117. echo " &${i}_module_priority," >> $output_file
  118. done
  119. ##-----------------------------------------------------------------
  120. cat >>$output_file <<_MEOF
  121. NULL
  122. };
  123. #endif /* STATIC_MODULES */
  124. #endif /* _STATIC_MODULES_H */
  125. _MEOF
  126. ##-----------------------------------------------------------------
  127. ])