File: ac_static_modules.m4

package info (click to toggle)
pdsh 2.36-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,436 kB
  • sloc: ansic: 12,474; sh: 3,196; makefile: 402; perl: 163
file content (138 lines) | stat: -rw-r--r-- 3,691 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
##*****************************************************************************
## $Id$
##*****************************************************************************
#  AUTHOR:
#    Al Chu <chu11@llnl.gov>
#
#  SYNOPSIS:
#    AC_STATIC_MODULE
#
#  DESCRIPTION:
#    Output #include files for static modules.
#
#  WARNINGS:
#    This macro must be placed after AC_PROG_CC or equivalent.
##*****************************************************************************

# This must be called before checks before any specific modules are done
AC_DEFUN([AC_STATIC_MODULES_INIT],
[
  rm -f static_modules.h
])

AC_DEFUN([AC_ADD_STATIC_MODULE],
[
  if test "$ac_static_modules" = "yes" ; then
     MODULES="$MODULES $1"
  fi
])

AC_DEFUN([AC_STATIC_MODULES_EXIT],
[
  # check for module conflicts 

  if test "$ac_have_libgenders" = "yes" && test "$ac_have_machines" = "yes"; then
     AC_MSG_ERROR([--with-genders conflicts with --with-machines])
  fi

  for module in $MODULES; do
     LIBMODS_OBJS="$LIBMODS_OBJS ${module}.lo"
  done
  AC_SUBST(LIBMODS_OBJS)

  # Output the static_modules.h file
  # must be in current directory, other paths may not exist yet.
  output_file="static_modules.h"

##-----------------------------------------------------------------
  cat >$output_file <<_MEOF
/* 
 *  This file is generated by autoconf and is included by mod.c.  
 *   It allows mod.c to access all statically compiled pdsh_module 
 *   structures available.
 */

#ifndef _STATIC_MODULES_H        
#define _STATic_MODULES_H       
                                
#if HAVE_CONFIG_H             
#  include "config.h"      
#endif                      
                            
#if STATIC_MODULES        
                          
 /* module information structures */ 

_MEOF 
##-----------------------------------------------------------------

  for i in $MODULES
  do
     echo "extern struct pdsh_module ${i}_module_info;" >> $output_file
     echo "extern int ${i}_module_priority;"            >> $output_file  
  done

##-----------------------------------------------------------------

  cat >>$output_file <<_MEOF

/*                                      
 * Array of all pdsh_module structures we are compiling                     
 */                                     
struct pdsh_module *static_mods[[]] = { 
_MEOF
##-----------------------------------------------------------------

  for i in $MODULES
  do
     echo "    &${i}_module_info," >> $output_file
  done

##-----------------------------------------------------------------

  cat >>$output_file <<_MEOF
    NULL                    
};                         
                          
/*                                     
 * Names of all the module structures 
 */                                  
char *static_mod_names[[]] = {    
_MEOF
##-----------------------------------------------------------------

  for i in $MODULES
  do
     echo "    \"${i}\"," >> $output_file
  done
  
##-----------------------------------------------------------------

  cat >>$output_file <<_MEOF
    NULL                            
};                                   

/*
 * Module priorities
 */
int *priority[[]] = {
_MEOF
##-----------------------------------------------------------------

  for i in $MODULES
  do
     echo "    &${i}_module_priority," >> $output_file
  done

##-----------------------------------------------------------------

  cat >>$output_file <<_MEOF
    NULL                            
};                                   

#endif /* STATIC_MODULES */            
#endif /* _STATIC_MODULES_H */          
_MEOF
##-----------------------------------------------------------------

])