PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 17# This must be called before checks before any specific modules are done
 18AC_DEFUN([AC_STATIC_MODULES_INIT],
 19[
 20  rm -f static_modules.h
 21])
 22
 23AC_DEFUN([AC_ADD_STATIC_MODULE],
 24[
 25  if test "$ac_static_modules" = "yes" ; then
 26     MODULES="$MODULES $1"
 27  fi
 28])
 29
 30AC_DEFUN([AC_STATIC_MODULES_EXIT],
 31[
 32  # check for module conflicts 
 33
 34  if test "$ac_have_libgenders" = "yes" && test "$ac_have_nodeattr" = "yes"; then
 35     AC_MSG_ERROR([--with-genders conflicts with --with-nodeattr])
 36  fi
 37
 38  if test "$ac_have_libgenders" = "yes" && test "$ac_have_machines" = "yes"; then
 39     AC_MSG_ERROR([--with-genders conflicts with --with-machines])
 40  fi
 41
 42  if test "$ac_have_libgenders" = "yes" && test "$ac_have_sdr" = "yes"; then
 43     AC_MSG_ERROR([--with-genders conflicts with --with-sdr])
 44  fi
 45
 46  if test "$ac_have_nodeattr" = "yes" && test "$ac_have_machines" = "yes"; then
 47     AC_MSG_ERROR([--with-nodeattr conflicts with --with-machines])
 48  fi
 49
 50  if test "$ac_have_nodeattr" = "yes" && test "$ac_have_sdr" = "yes"; then
 51     AC_MSG_ERROR([--with-nodeattr conflicts with --with-sdr])
 52  fi
 53
 54  if test "$ac_have_machines" = "yes" && test "$ac_have_sdr" = "yes"; then
 55     AC_MSG_ERROR([--with-machines conflicts with --with-sdr])
 56  fi
 57
 58  if test "$ac_have_qshell" = "yes" && test "$ac_have_mqshell" = "yes"; then
 59     AC_MSG_ERROR([--with-qshell conflicts with --with-mqshell])
 60  fi
 61
 62  for module in $MODULES; do
 63     LIBMODS_OBJS="$LIBMODS_OBJS ${module}.lo"
 64  done
 65  AC_SUBST(LIBMODS_OBJS)
 66
 67  # Output the static_modules.h file
 68  # must be in current directory, other paths may not exist yet.
 69  output_file="static_modules.h"
 70
 71##-----------------------------------------------------------------
 72  cat >$output_file <<_MEOF
 73/* 
 74 *  This file is generated by autoconf and is included by mod.c.  
 75 *   It allows mod.c to access all statically compiled pdsh_module 
 76 *   structures available.
 77 */
 78
 79#ifndef _STATIC_MODULES_H        
 80#define _STATic_MODULES_H       
 81                                
 82#if HAVE_CONFIG_H             
 83#  include "config.h"      
 84#endif                      
 85                            
 86#if STATIC_MODULES        
 87                          
 88 /* module information structures */ 
 89
 90_MEOF 
 91##-----------------------------------------------------------------
 92
 93  for i in $MODULES
 94  do
 95     echo "extern struct pdsh_module ${i}_module_info;" >> $output_file
 96     echo "extern int ${i}_module_priority;"            >> $output_file  
 97  done
 98
 99##-----------------------------------------------------------------
100
101  cat >>$output_file <<_MEOF
102
103/*                                      
104 * Array of all pdsh_module structures we are compiling                     
105 */                                     
106struct pdsh_module *static_mods[[]] = { 
107_MEOF
108##-----------------------------------------------------------------
109
110  for i in $MODULES
111  do
112     echo "    &${i}_module_info," >> $output_file
113  done
114
115##-----------------------------------------------------------------
116
117  cat >>$output_file <<_MEOF
118    NULL                    
119};                         
120                          
121/*                                     
122 * Names of all the module structures 
123 */                                  
124char *static_mod_names[[]] = {    
125_MEOF
126##-----------------------------------------------------------------
127
128  for i in $MODULES
129  do
130     echo "    \"${i}\"," >> $output_file
131  done
132  
133##-----------------------------------------------------------------
134
135  cat >>$output_file <<_MEOF
136    NULL                            
137};                                   
138
139/*
140 * Module priorities
141 */
142int *priority[[]] = {
143_MEOF
144##-----------------------------------------------------------------
145
146  for i in $MODULES
147  do
148     echo "    &${i}_module_priority," >> $output_file
149  done
150
151##-----------------------------------------------------------------
152
153  cat >>$output_file <<_MEOF
154    NULL                            
155};                                   
156
157#endif /* STATIC_MODULES */            
158#endif /* _STATIC_MODULES_H */          
159_MEOF
160##-----------------------------------------------------------------
161
162])