3 # Script to generate $C_FILE
8 #MINUS_e=X`$ECHO -n -e`
9 #if [ $MINUS_e != "X" ] ; then
15 #MINUS_E=X`$ECHO -n -E`
16 #if [ $MINUS_E != "X" ] ; then
24 C_FILE="$CUR_DIR/modules_init.c"
25 H_FILE="$CUR_DIR/modules_init.h"
26 MOD_FILE="$CUR_DIR/Make_modules"
27 SRC_FILE="$CUR_DIR/Make_sources"
30 /usr/bin/printf "Scanning extension modules for entry points.\n"
33 #start of the files which inturn removes any existing file
36 # start the Makefile included file for $SERV_MODULES
40 # This file is to be included by Makefile to dynamically add modules to the build process
41 # THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE
46 # start the Makefile included file for $SOURCES
50 # This file is to be included by Makefile to dynamically add modules to the build process
51 # THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE
60 * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE
70 #include <sys/types.h>
73 #include "modules_init.h"
74 #include "sysdep_decls.h"
77 void LogPrintMessages(long err);
78 extern long DetailErrorFlags;
82 void initialise_modules (int threading)
88 CtdlLogPrintf (CTDL_INFO, "Initialise modules, CtdlThreads enabled.\n");
90 CtdlLogPrintf (CTDL_INFO, "Initialise modules, CtdlThreads not yet enabled.\n");
94 #start the header file
98 * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE
102 #ifndef MODULES_INIT_H
103 #define MODULES_INIT_H
104 #include "ctdl_module.h"
105 extern size_t nSizErrmsg;
106 void initialise_modules (int threading);
112 RES=X`grep CTDL_MODULE_INIT $i | cut -f2 -d\( | cut -f1 -d\)`
113 if [ $RES != "X" ] ; then
114 RES_OUT=`echo $RES | cut -b2-`
115 /usr/bin/printf "Found entry point in file $i\n"
117 lprintf (CTDL_INFO, "%%s\n", CTDL_INIT_CALL($RES_OUT));
121 CTDL_MODULE_INIT($RES_OUT);
127 if [ -d "modules" ] ; then
135 if [ -f "$k" ] ; then
136 # Add this .c file to the Makefile included list of SOURCES
137 cat <<EOF >> $SRC_FILE
138 SOURCES += modules/$j/$k
141 # Generate a .o file name
142 O_FILE=`basename $k .c`
144 # Add this .o file to the Makefile included list of SERV_MODULES
145 cat <<EOF >> $MOD_FILE
146 SERV_MODULES += modules/$j/$O_FILE
149 RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
150 if [ $RES != "X" ] ; then
151 RES_OUT=`echo $RES | cut -b2-`
152 /usr/bin/printf "Found entry point in file modules/$j/$k\n"
153 # Add this entry point to the .c file
155 lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
157 # Add this entry point to the .h file
159 CTDL_MODULE_INIT($RES_OUT);
171 if [ -d "user_modules" ] ; then
179 if [ -f "$k" ] ; then
180 # Add this .c file to the Makefile included list of SOURCES
181 cat <<EOF >> $SRC_FILE
182 SOURCES=\$(SOURCES) user_modules/$j/$k
185 # Generate a .o file name
186 O_FILE=`basename $k .c`
188 # Add this .o file to the Makefile included list of SERV_MODULES
189 cat <<EOF >> $MOD_FILE
190 SERV_MODULES += user_modules/$j/$O_FILE
193 RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
194 if [ $RES != "X" ] ; then
195 RES_OUT=`echo $RES | cut -b2-`
196 /usr/bin/printf "Found entry point in file user_modules/$j/$k\n"
198 lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
201 CTDL_MODULE_INIT($RES_OUT);
213 /usr/bin/printf "\n\n" >> $C_FILE
214 /usr/bin/printf "\tfor (filter = 1; filter != 0; filter = filter << 1)\n" >> $C_FILE
215 /usr/bin/printf "\t\tif ((filter & DetailErrorFlags) != 0)\n" >> $C_FILE
216 /usr/bin/printf "\t\t\tLogPrintMessages(filter);\n" >> $C_FILE
217 /usr/bin/printf "}\n" >> $C_FILE
220 /usr/bin/printf "\n#endif /* MODULES_INIT_H */\n" >> $H_FILE