3 # Script to generate $C_FILE
9 #MINUS_e=X`$ECHO -n -e`
10 #if [ $MINUS_e != "X" ] ; then
16 #MINUS_E=X`$ECHO -n -E`
17 #if [ $MINUS_E != "X" ] ; then
25 C_FILE="$CUR_DIR/modules_init.c"
26 H_FILE="$CUR_DIR/modules_init.h"
27 MOD_FILE="$CUR_DIR/Make_modules"
28 SRC_FILE="$CUR_DIR/Make_sources"
29 U_FILE="$CUR_DIR/modules_upgrade.c"
31 /usr/bin/printf "Scanning extension modules for entry points.\n"
33 STATIC_FIRST_MODULES="control modules euidindex msgbase nttlist database"
34 DYNAMIC_MODULES=`grep CTDL_MODULE_INIT modules/*/*.c |$SED 's;.*(\(.*\));\1;'`
35 if test -d user_modules; then
36 USER_MODULES=`grep CTDL_MODULE_INIT user_modules/*/*.c |$SED 's;.*(\(.*\));\1;'`
40 STATIC_LAST_MODULES="netconfig"
42 ###############################################################################
44 ###############################################################################
49 * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE
59 #include <sys/types.h>
61 #include <libcitadel.h>
63 #include "modules_init.h"
64 #include "sysdep_decls.h"
65 #include "serv_extensions.h"
68 void LogPrintMessages(long err);
69 extern long DetailErrorFlags;
71 void initialise_modules (int threading)
76 syslog(LOG_DEBUG, "modules: initializing, CtdlThreads %s", (threading ? "enabled" : "not yet enabled"));
81 for i in ${STATIC_FIRST_MODULES} ${DYNAMIC_MODULES} ${USER_MODULES} ${STATIC_LAST_MODULES}; do
83 pMod = CTDL_INIT_CALL($i);
84 syslog(LOG_DEBUG, "modules: loaded %s", pMod);
90 for (filter = 1; filter != 0; filter = filter << 1)
91 if ((filter & DetailErrorFlags) != 0)
92 LogPrintMessages(filter);
101 ###############################################################################
102 # start the header file #
103 ###############################################################################
107 * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE
111 #ifndef MODULES_INIT_H
112 #define MODULES_INIT_H
113 #include "ctdl_module.h"
114 extern size_t nSizErrmsg;
115 void initialise_modules (int threading);
116 void upgrade_modules(void);
120 for i in ${STATIC_FIRST_MODULES} ${DYNAMIC_MODULES} ${USER_MODULES} ${STATIC_LAST_MODULES}; do
121 # Add this entry point to the .h file
123 CTDL_MODULE_INIT($i);
127 grep CTDL_MODULE_UPGRADE *.c modules/*/*.c |$SED 's;.*(\(.*\));\CTDL_MODULE_UPGRADE(\1)\;\n;' >> $H_FILE
132 #endif /* MODULES_INIT_H */
137 ###############################################################################
138 # u start the Makefile included file for $SERV_MODULES #
139 ###############################################################################
143 # This file is to be included by Makefile to dynamically add modules to the build process
144 # THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE
150 echo modules/*/*.c | $SED -e "s;\.c ;.o \\\\\n;g" -e "s;\.c;.o;" >> $MOD_FILE
154 ###############################################################################
155 # start of the files which inturn removes any existing file #
156 ###############################################################################
159 # start the Makefile included file for $SOURCES
163 # This file is to be included by Makefile to dynamically add modules to the build process
164 # THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE
170 echo modules/*/*.c | $SED "s;\.c ;.c \\\\\n;g" >> $SRC_FILE
175 ###############################################################################
176 # start the upgrade file #
177 ###############################################################################
181 * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE
192 #include <sys/types.h>
194 #include <libcitadel.h>
196 #include "modules_init.h"
197 #include "sysdep_decls.h"
198 #include "serv_extensions.h"
202 void upgrade_modules (void)
206 syslog(LOG_INFO, "modules: upgrading.");
210 # Add this entry point to the .c file
212 grep CTDL_MODULE_UPGRADE *.c modules/*/*.c |$SED 's;.*(\(.*\));\tpMod = CTDL_UPGRADE_CALL(\1)\;\n\tsyslog(LOG_INFO, "modules: %s\\n", pMod)\;\n;' >> $U_FILE
214 #close the upgrade file
215 /usr/bin/printf "}\n" >> $U_FILE