2 dnl APACHE_SUBST(VARIABLE)
3 dnl Makes VARIABLE available in generated files
4 dnl (do not use @variable@ in Makefiles, but $(variable))
5 AC_DEFUN(APACHE_SUBST,[
6 APACHE_VAR_SUBST="$APACHE_VAR_SUBST $1"
10 dnl APACHE_FAST_OUTPUT(FILENAME)
11 dnl Perform substitutions on FILENAME (Makefiles only)
12 AC_DEFUN(APACHE_FAST_OUTPUT,[
13 APACHE_FAST_OUTPUT_FILES="$APACHE_FAST_OUTPUT_FILES $1"
16 dnl APACHE_MKDIR_P_CHECK
17 dnl checks whether mkdir -p works
18 AC_DEFUN(APACHE_MKDIR_P_CHECK,[
19 AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
20 test -d conftestdir && rm -rf conftestdir
21 mkdir -p conftestdir/somedir >/dev/null 2>&1
22 if test -d conftestdir/somedir; then
31 dnl APACHE_GEN_CONFIG_VARS
32 dnl Creates config_vars.mk
33 AC_DEFUN(APACHE_GEN_CONFIG_VARS,[
34 APACHE_SUBST(abs_srcdir)
38 APACHE_SUBST(logfiledir)
39 APACHE_SUBST(exec_prefix)
41 APACHE_SUBST(localstatedir)
42 APACHE_SUBST(libexecdir)
43 APACHE_SUBST(htdocsdir)
44 APACHE_SUBST(includedir)
45 APACHE_SUBST(iconsdir)
46 APACHE_SUBST(sysconfdir)
47 APACHE_SUBST(other_targets)
48 APACHE_SUBST(progname)
53 APACHE_SUBST(CPPFLAGS)
55 APACHE_SUBST(CXXFLAGS)
58 APACHE_SUBST(SH_LDFLAGS)
59 APACHE_SUBST(HTTPD_LDFLAGS)
62 APACHE_SUBST(INCLUDES)
63 APACHE_SUBST(NOTEST_CPPFLAGS)
64 APACHE_SUBST(NOTEST_CFLAGS)
65 APACHE_SUBST(NOTEST_CXXFLAGS)
66 APACHE_SUBST(NOTEST_LDFLAGS)
67 APACHE_SUBST(NOTEST_LIBS)
68 APACHE_SUBST(EXTRA_CPPFLAGS)
69 APACHE_SUBST(EXTRA_CFLAGS)
70 APACHE_SUBST(EXTRA_CXXFLAGS)
71 APACHE_SUBST(EXTRA_LDFLAGS)
72 APACHE_SUBST(EXTRA_LIBS)
73 APACHE_SUBST(EXTRA_INCLUDES)
76 APACHE_SUBST(MODULE_DIRS)
78 APACHE_SUBST(CORE_IMPLIB_FILE)
79 APACHE_SUBST(CORE_IMPLIB)
80 APACHE_SUBST(SH_LIBTOOL)
81 APACHE_SUBST(MK_IMPLIB)
82 APACHE_SUBST(INSTALL_PROG_FLAGS)
84 abs_srcdir="`(cd $srcdir && pwd)`"
87 echo creating config_vars.mk
89 for i in $APACHE_VAR_SUBST; do
90 eval echo "$i = \$$i" >> config_vars.mk
94 dnl APACHE_GEN_MAKEFILES
96 AC_DEFUN(APACHE_GEN_MAKEFILES,[
97 $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
100 AC_DEFUN(APACHE_LIBTOOL_SILENT,[
101 LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent'
105 dnl ## APACHE_OUTPUT(file)
106 dnl ## adds "file" to the list of files generated by AC_OUTPUT
107 dnl ## This macro can be used several times.
108 AC_DEFUN(APACHE_OUTPUT, [
109 APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
113 dnl APACHE_TYPE_RLIM_T
115 dnl If rlim_t is not defined, define it to int
117 AC_DEFUN(APACHE_TYPE_RLIM_T, [
118 AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
120 #include <sys/types.h>
121 #include <sys/time.h>
122 #include <sys/resource.h>
123 ], [rlim_t spoon;], [
124 ac_cv_type_rlim_t=yes
125 ],[ac_cv_type_rlim_t=no
128 if test "$ac_cv_type_rlim_t" = "no" ; then
129 AC_DEFINE(rlim_t, int,
130 [Define to 'int' if <sys/resource.h> doesn't define it for us])
134 dnl APACHE_MODPATH_INIT(modpath)
135 AC_DEFUN(APACHE_MODPATH_INIT,[
137 modpath_current=modules/$1
140 test -d $1 || $srcdir/build/mkdir.sh $modpath_current
141 > $modpath_current/modules.mk
144 AC_DEFUN(APACHE_MODPATH_FINISH,[
145 echo "DISTCLEAN_TARGETS = modules.mk" >> $modpath_current/modules.mk
146 echo "static = $modpath_static" >> $modpath_current/modules.mk
147 echo "shared = $modpath_shared" >> $modpath_current/modules.mk
148 if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
149 MODULE_DIRS="$MODULE_DIRS $current_dir"
151 APACHE_FAST_OUTPUT($modpath_current/Makefile)
154 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
155 AC_DEFUN(APACHE_MODPATH_ADD,[
156 if test -z "$3"; then
162 if test -z "$module_standalone"; then
163 if test -z "$2"; then
165 BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
166 modpath_static="$modpath_static $libname"
167 cat >>$modpath_current/modules.mk<<EOF
169 \$(MOD_LINK) $objects
172 apache_need_shared=yes
174 shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
175 modpath_shared="$modpath_shared $libname"
176 cat >>$modpath_current/modules.mk<<EOF
178 \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
185 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
187 dnl default is one of:
188 dnl yes -- enabled by default. user must explicitly disable.
189 dnl no -- disabled under default, most, all. user must explicitly enable.
190 dnl most -- disabled by default. enabled explicitly or with most or all.
191 dnl "" -- disabled under default, most. enabled explicitly or with all.
193 dnl basically: yes/no is a hard setting. "most" means follow the "most"
194 dnl setting. otherwise, fall under the "all" setting.
195 dnl explicit yes/no always overrides.
197 AC_DEFUN(APACHE_MODULE,[
198 AC_MSG_CHECKING(whether to enable mod_$1)
199 define([optname],[ --]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
200 AC_ARG_ENABLE(translit($1,_,-),optname() substr([ ],len(optname()))$2,,enable_$1=ifelse($5,,maybe-all,$5))
201 undefine([optname])dnl
203 if test "$enable_$1" = "most"; then
204 if test "$module_selection" = "most" -o "$module_selection" = "all"; then
205 enable_$1=$module_default
206 _apmod_extra_msg=" ($module_selection)"
210 elif test "$enable_$1" = "maybe-all"; then
211 if test "$module_selection" = "all"; then
212 enable_$1=$module_default
213 _apmod_extra_msg=" (all)"
218 AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
219 if test "$enable_$1" != "no"; then
222 enable_$1=`echo $ac_n $enable_$1$ac_c|sed 's/shared,*//'`
226 MODLIST="$MODLIST ifelse($4,,$1,$4)"
227 if test "$1" = "so"; then
233 APACHE_MODPATH_ADD($1, $shared, $3)
237 dnl APACHE_LAYOUT(configlayout, layoutname)
238 AC_DEFUN(APACHE_LAYOUT,[
239 if test ! -f $srcdir/config.layout; then
240 echo "** Error: Layout file $srcdir/config.layout not found"
241 echo "** Error: Cannot use undefined layout '$LAYOUT'"
246 sed -e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \
247 -e '/[ ]*<\/Layout>[ ]*/,$d' \
255 for var in prefix exec_prefix bindir sbindir libexecdir mandir \
256 sysconfdir datadir iconsdir htdocsdir cgidir includedir \
257 localstatedir runtimedir logfiledir proxycachedir; do
258 eval "val=\"\$$var\""
261 val=`echo $val | sed -e 's;\+$;;'`
262 eval "$var=\"\$val\""
269 val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
270 val=`echo $val | sed -e 's:$\([a-z_]*\):$(\1):g'`
271 if test "$autosuffix" = "yes"; then
272 if echo $val | grep apache >/dev/null; then
277 if test "$addtarget" = "yes"; then
286 dnl APACHE_ENABLE_LAYOUT
288 AC_DEFUN(APACHE_ENABLE_LAYOUT,[
289 AC_ARG_ENABLE(layout,
290 [ --enable-layout=LAYOUT],[
294 if test -z "$LAYOUT"; then
295 # XXX FIXME: this isn't a complete list of things that have to be set to
296 # create the Apache layout in config.layout, and it really should just
297 # use what is specified in config.layout instead of duping it.
298 htdocsdir='$(prefix)/htdocs'
299 iconsdir='$(prefix)/icons'
300 cgidir='$(prefix)/cgi-bin'
301 logfiledir='$(prefix)/logs'
302 sysconfdir='${prefix}/conf'
303 libexecdir='${prefix}/modules'
306 APACHE_LAYOUT($srcdir/config.layout, $LAYOUT)
309 AC_MSG_CHECKING(for chosen layout)
310 AC_MSG_RESULT($layout_name)
314 dnl APACHE_ENABLE_MODULES
316 AC_DEFUN(APACHE_ENABLE_MODULES,[
317 module_selection=default
320 AC_ARG_ENABLE(modules,
321 [ --enable-modules=MODULE-LIST],[
322 for i in $enableval; do
323 if test "$i" = "all" -o "$i" = "most"; then
331 AC_ARG_ENABLE(mods-shared,
332 [ --enable-mods-shared=MODULE-LIST],[
333 for i in $enableval; do
334 if test "$i" = "all" -o "$i" = "most"; then
336 module_default=shared
338 i=`echo $i | sed 's/-/_/g'`
339 eval "enable_$i=shared"
345 AC_DEFUN(APACHE_REQUIRE_CXX,[
346 if test -z "$apache_cxx_done"; then