2 AC_DEFUN(APACHE_PASSTHRU,[
4 AC_CACHE_VAL(ac_cv_pass_$1, [ac_cv_pass_$1=$$1])
7 dnl APACHE_SUBST(VARIABLE)
8 dnl Makes VARIABLE available in generated files
9 dnl (do not use @variable@ in Makefiles, but $(variable))
10 AC_DEFUN(APACHE_SUBST,[
11 APACHE_VAR_SUBST="$APACHE_VAR_SUBST $1"
15 dnl APACHE_FAST_OUTPUT(FILENAME)
16 dnl Perform substitutions on FILENAME (Makefiles only)
17 AC_DEFUN(APACHE_FAST_OUTPUT,[
18 APACHE_FAST_OUTPUT_FILES="$APACHE_FAST_OUTPUT_FILES $1"
21 dnl APACHE_MKDIR_P_CHECK
22 dnl checks whether mkdir -p works
23 AC_DEFUN(APACHE_MKDIR_P_CHECK,[
24 AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
25 test -d conftestdir && rm -rf conftestdir
26 mkdir -p conftestdir/somedir >/dev/null 2>&1
27 if test -d conftestdir/somedir; then
36 dnl APACHE_GEN_CONFIG_VARS
37 dnl Creates config_vars.mk
38 AC_DEFUN(APACHE_GEN_CONFIG_VARS,[
39 APACHE_SUBST(abs_srcdir)
43 APACHE_SUBST(logfiledir)
44 APACHE_SUBST(exec_prefix)
46 APACHE_SUBST(localstatedir)
47 APACHE_SUBST(libexecdir)
48 APACHE_SUBST(htdocsdir)
49 APACHE_SUBST(includedir)
50 APACHE_SUBST(iconsdir)
51 APACHE_SUBST(sysconfdir)
52 APACHE_SUBST(other_targets)
53 APACHE_SUBST(progname)
58 APACHE_SUBST(CPPFLAGS)
60 APACHE_SUBST(CXXFLAGS)
63 APACHE_SUBST(SH_LDFLAGS)
64 APACHE_SUBST(HTTPD_LDFLAGS)
68 APACHE_SUBST(MODULE_DIRS)
70 APACHE_SUBST(NOTEST_CFLAGS)
71 APACHE_SUBST(NOTEST_LDFLAGS)
72 APACHE_SUBST(CORE_IMPLIB_FILE)
73 APACHE_SUBST(CORE_IMPLIB)
74 APACHE_SUBST(SH_LIBTOOL)
75 APACHE_SUBST(MK_IMPLIB)
77 abs_srcdir="`(cd $srcdir && pwd)`"
80 echo creating config_vars.mk
82 for i in $APACHE_VAR_SUBST; do
83 eval echo "$i = \$$i" >> config_vars.mk
87 dnl APACHE_GEN_MAKEFILES
89 AC_DEFUN(APACHE_GEN_MAKEFILES,[
90 $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
93 AC_DEFUN(APACHE_LIBTOOL_SILENT,[
94 LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent'
98 dnl ## APACHE_OUTPUT(file)
99 dnl ## adds "file" to the list of files generated by AC_OUTPUT
100 dnl ## This macro can be used several times.
101 AC_DEFUN(APACHE_OUTPUT, [
102 APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
106 dnl AC_ADD_LIBRARY(library)
108 dnl add a library to the link line
110 AC_DEFUN(AC_ADD_LIBRARY,[
111 APACHE_ONCE(LIBRARY, $1, [
112 EXTRA_LIBS="$EXTRA_LIBS -l$1"
117 dnl AC_CHECK_DEFINE(macro, headerfile)
119 dnl checks for the macro in the header file
121 AC_DEFUN(AC_CHECK_DEFINE,[
122 AC_CACHE_CHECK(for $1 in $2, ac_cv_define_$1,
123 AC_EGREP_CPP([YES_IS_DEFINED], [
128 ], ac_cv_define_$1=yes, ac_cv_define_$1=no))
129 if test "$ac_cv_define_$1" = "yes" ; then
131 [Define if the macro "$1" is defined on this system])
138 dnl If rlim_t is not defined, define it to int
140 AC_DEFUN(AC_TYPE_RLIM_T, [
141 AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
143 #include <sys/types.h>
144 #include <sys/time.h>
145 #include <sys/resource.h>
146 ], [rlim_t spoon;], [
147 ac_cv_type_rlim_t=yes
148 ],[ac_cv_type_rlim_t=no
151 if test "$ac_cv_type_rlim_t" = "no" ; then
152 AC_DEFINE(rlim_t, int,
153 [Define to 'int' if <sys/resource.h> doesn't define it for us])
158 dnl APACHE_ONCE(namespace, variable, code)
160 dnl execute code, if variable is not set in namespace
162 AC_DEFUN(APACHE_ONCE,[
163 unique=`echo $ac_n "$2$ac_c" | tr -cd a-zA-Z0-9`
164 cmd="echo $ac_n \"\$$1$unique$ac_c\""
165 if test -n "$unique" && test "`eval $cmd`" = "" ; then
171 dnl APACHE_MODPATH_INIT(modpath)
172 AC_DEFUN(APACHE_MODPATH_INIT,[
174 modpath_current=modules/$1
177 test -d $1 || $srcdir/build/mkdir.sh $modpath_current
178 > $modpath_current/modules.mk
181 AC_DEFUN(APACHE_MODPATH_FINISH,[
182 echo "DISTCLEAN_TARGETS = modules.mk" >> $modpath_current/modules.mk
183 echo "static = $modpath_static" >> $modpath_current/modules.mk
184 echo "shared = $modpath_shared" >> $modpath_current/modules.mk
185 if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
186 MODULE_DIRS="$MODULE_DIRS $current_dir"
188 APACHE_FAST_OUTPUT($modpath_current/Makefile)
191 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
192 AC_DEFUN(APACHE_MODPATH_ADD,[
193 if test -z "$3"; then
199 if test -z "$module_standalone"; then
200 if test -z "$2"; then
202 BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
203 modpath_static="$modpath_static $libname"
204 cat >>$modpath_current/modules.mk<<EOF
206 \$(MOD_LINK) $objects
209 apache_need_shared=yes
211 shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
212 modpath_shared="$modpath_shared $libname"
213 cat >>$modpath_current/modules.mk<<EOF
215 \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
222 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
224 dnl default is one of:
225 dnl yes -- enabled by default. user must explicitly disable.
226 dnl no -- disabled under default, most, all. user must explicitly enable.
227 dnl most -- disabled by default. enabled explicitly or with most or all.
228 dnl "" -- disabled under default, most. enabled explicitly or with all.
230 dnl basically: yes/no is a hard setting. "most" means follow the "most"
231 dnl setting. otherwise, fall under the "all" setting.
232 dnl explicit yes/no always overrides.
234 AC_DEFUN(APACHE_MODULE,[
235 AC_MSG_CHECKING(whether to enable mod_$1)
236 define([optname],[ --]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
237 AC_ARG_ENABLE(translit($1,_,-),optname() substr([ ],len(optname()))$2,,enable_$1=ifelse($5,,maybe-all,$5))
238 undefine([optname])dnl
240 if test "$enable_$1" = "most"; then
241 if test "$module_selection" = "most" -o "$module_selection" = "all"; then
242 enable_$1=$module_default
243 _apmod_extra_msg=" ($module_selection)"
247 elif test "$enable_$1" = "maybe-all"; then
248 if test "$module_selection" = "all"; then
249 enable_$1=$module_default
250 _apmod_extra_msg=" (all)"
255 AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
256 if test "$enable_$1" != "no"; then
259 enable_$1=`echo $ac_n $enable_$1$ac_c|sed 's/shared,*//'`
263 MODLIST="$MODLIST ifelse($4,,$1,$4)"
264 if test "$1" = "so"; then
270 APACHE_MODPATH_ADD($1, $shared, $3)
274 dnl APACHE_LAYOUT(configlayout, layoutname)
275 AC_DEFUN(APACHE_LAYOUT,[
276 if test ! -f $srcdir/config.layout; then
277 echo "** Error: Layout file $srcdir/config.layout not found"
278 echo "** Error: Cannot use undefined layout '$LAYOUT'"
283 sed -e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \
284 -e '/[ ]*<\/Layout>[ ]*/,$d' \
292 for var in prefix exec_prefix bindir sbindir libexecdir mandir \
293 sysconfdir datadir iconsdir htdocsdir cgidir includedir \
294 localstatedir runtimedir logfiledir proxycachedir; do
295 eval "val=\"\$$var\""
298 val=`echo $val | sed -e 's;\+$;;'`
299 eval "$var=\"\$val\""
306 val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
307 val=`echo $val | sed -e 's:$\([a-z_]*\):$(\1):g'`
308 if test "$autosuffix" = "yes"; then
309 if echo $val | grep apache >/dev/null; then
314 if test "$addtarget" = "yes"; then
323 dnl APACHE_ENABLE_LAYOUT
325 AC_DEFUN(APACHE_ENABLE_LAYOUT,[
326 AC_ARG_ENABLE(layout,
327 [ --enable-layout=LAYOUT],[
331 if test -z "$LAYOUT"; then
332 # XXX FIXME: this isn't a complete list of things that have to be set to
333 # create the Apache layout in config.layout, and it really should just
334 # use what is specified in config.layout instead of duping it.
335 htdocsdir='$(prefix)/htdocs'
336 iconsdir='$(prefix)/icons'
337 cgidir='$(prefix)/cgi-bin'
338 logfiledir='$(prefix)/logs'
339 sysconfdir='${prefix}/conf'
340 libexecdir='${prefix}/modules'
343 APACHE_LAYOUT($srcdir/config.layout, $LAYOUT)
346 AC_MSG_CHECKING(for chosen layout)
347 AC_MSG_RESULT($layout_name)
351 dnl APACHE_ENABLE_MODULES
353 AC_DEFUN(APACHE_ENABLE_MODULES,[
354 module_selection=default
357 AC_ARG_ENABLE(modules,
358 [ --enable-modules=MODULE-LIST],[
359 for i in $enableval; do
360 if test "$i" = "all" -o "$i" = "most"; then
368 AC_ARG_ENABLE(mods-shared,
369 [ --enable-mods-shared=MODULE-LIST],[
370 for i in $enableval; do
371 if test "$i" = "all" -o "$i" = "most"; then
373 module_default=shared
375 eval "enable_$i=shared"
381 AC_DEFUN(APACHE_REQUIRE_CXX,[
382 if test -z "$apache_cxx_done"; then