Moved apache code into a folder to help prepare for packaging where we dont want...
[httpd-crcsyncproxy.git] / apache / modules / config5.m4
blobb8a5868bfefba3443f5d49337cf38b3942022f8d
1 AC_MSG_CHECKING(for extra modules)
2 AC_ARG_WITH(module,
3   APACHE_HELP_STRING(--with-module=module-type:module-file,
4                      Enable module-file in the modules/<module-type> directory.),
5   [
6     as_save_IFS="$IFS"; IFS=","
7     for mod in $withval
8     do
9       modtype=`echo $mod | sed -e's/\(.*\):.*/\1/'`
10       pkg=`echo $mod | sed -e's/.*:\(.*\)/\1/'`
11       modfilec=`echo $pkg | sed -e 's;^.*/;;'`
12       modfileo=`echo $pkg | sed -e 's;^.*/;;' -e 's;\.c$;.o;'`
13       modpath_current="modules/$modtype"
14       if test "x$mod" != "x$modpath_current/$modfilec"; then
15         if test ! -d "$modpath_current"; then
16           mkdir $modpath_current
17           echo 'include $(top_srcdir)/build/special.mk' > $modpath_current/Makefile.in
18         fi
19         cp $pkg $modpath_current/$modfilec
20       fi
21       module=`echo $pkg | sed -e 's;\(.*/\)*mod_\(.*\).c;\2;'`
22       objects="mod_$module.lo"
23       # The filename of a convenience library must have a "lib" prefix:
24       libname="libmod_$module.la"
25       BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
26       if test ! -s "$modpath_current/modules.mk"; then
27         cat >>$modpath_current/modules.mk<<EOF
28 $libname: $objects
29         \$(MOD_LINK) $objects
30 DISTCLEAN_TARGETS = modules.mk
31 static = $libname
32 shared =
33 EOF
34       else
35         cat >>$modpath_current/modules.mk.tmp<<EOF
36 $libname: $objects
37         \$(MOD_LINK) $objects
38 EOF
39         cat $modpath_current/modules.mk >> $modpath_current/modules.mk.tmp
40         rm $modpath_current/modules.mk
41         mv $modpath_current/modules.mk.tmp $modpath_current/modules.mk
42         sed -e "s/\(static =.*\)/\1 $libname/" $modpath_current/modules.mk > $modpath_current/modules.mk.tmp
43         rm $modpath_current/modules.mk
44         mv $modpath_current/modules.mk.tmp $modpath_current/modules.mk
45       fi
46       MODLIST="$MODLIST $module"
47       EXTRA_MODLIST="$EXTRA_MODLIST $modtype:$modfilec"
48       MODULE_DIRS="$MODULE_DIRS $modtype"
49       APACHE_FAST_OUTPUT($modpath_current/Makefile)
50     done
51     if test ! -z "$EXTRA_MODLIST"; then
52       AC_MSG_RESULT(added:$EXTRA_MODLIST)
53     fi
54     IFS="$as_save_IFS"
55   ],
56   [ AC_MSG_RESULT(none) 
57   ])