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_FAST_GENERATE
37 dnl Creates Makefiles and config_vars.mk
38 AC_DEFUN(APACHE_FAST_GENERATE,[
39 APACHE_SUBST(abs_srcdir)
43 APACHE_SUBST(exec_prefix)
44 APACHE_SUBST(libexecdir)
45 APACHE_SUBST(htdocsdir)
46 APACHE_SUBST(includedir)
47 APACHE_SUBST(iconsdir)
48 APACHE_SUBST(sysconfdir)
52 APACHE_SUBST(CPPFLAGS)
58 APACHE_SUBST(MODULE_DIRS)
60 abs_srcdir="`(cd $srcdir && pwd)`"
63 echo creating config_vars.mk
65 for i in $APACHE_VAR_SUBST; do
66 eval echo "$i = \$$i" >> config_vars.mk
68 $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $APACHE_FAST_OUTPUT_FILES
71 AC_DEFUN(APACHE_LIBTOOL_SILENT,[
72 LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent'
76 dnl ## APACHE_OUTPUT(file)
77 dnl ## adds "file" to the list of files generated by AC_OUTPUT
78 dnl ## This macro can be used several times.
79 AC_DEFUN(APACHE_OUTPUT, [
80 APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
84 dnl AC_ADD_LIBRARY(library)
86 dnl add a library to the link line
88 AC_DEFUN(AC_ADD_LIBRARY,[
89 APACHE_ONCE(LIBRARY, $1, [
90 EXTRA_LIBS="$EXTRA_LIBS -l$1"
95 dnl AC_CHECK_DEFINE(macro, headerfile)
97 dnl checks for the macro in the header file
99 AC_DEFUN(AC_CHECK_DEFINE,[
100 AC_CACHE_CHECK(for $1 in $2, ac_cv_define_$1,
101 AC_EGREP_CPP([YES_IS_DEFINED], [
106 ], ac_cv_define_$1=yes, ac_cv_define_$1=no))
107 if test "$ac_cv_define_$1" = "yes" ; then
109 [Define if the macro "$1" is defined on this system])
116 dnl If rlim_t is not defined, define it to int
118 AC_DEFUN(AC_TYPE_RLIM_T, [
119 AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
120 AC_TRY_COMPILE([#include <sys/resource.h>], [rlim_t spoon;], [
121 ac_cv_type_rlim_t=yes
122 ],[ac_cv_type_rlim_t=no
125 if test "$ac_ac_type_rlim_t" = "no" ; then
126 AC_DEFINE(rlim_t, int,
127 [Define to 'int' if <sys/resource.h> doesn't define it for us])
132 dnl APACHE_ONCE(namespace, variable, code)
134 dnl execute code, if variable is not set in namespace
136 AC_DEFUN(APACHE_ONCE,[
137 unique=`echo $ac_n "$2$ac_c" | tr -cd a-zA-Z0-9`
138 cmd="echo $ac_n \"\$$1$unique$ac_c\""
139 if test -n "$unique" && test "`eval $cmd`" = "" ; then
145 sinclude(lib/apr/threads.m4)
148 dnl APACHE_INADDR_NONE
150 dnl checks for missing INADDR_NONE macro
152 AC_DEFUN(APACHE_INADDR_NONE,[
153 AC_CACHE_CHECK(whether system defines INADDR_NONE, ac_cv_inaddr_none,[
155 #ifdef HAVE_SYS_TYPES_H
156 #include <sys/types.h>
158 #ifdef HAVE_SYS_SOCKET_H
159 #include <sys/socket.h>
161 #ifdef HAVE_NETINET_IN_H
162 #include <netinet/in.h>
164 #ifdef HAVE_ARPA_INET_H
165 #include <arpa/inet.h>
168 unsigned long foo = INADDR_NONE;
170 ac_cv_inaddr_none=yes
174 if test "$ac_cv_inaddr_none" = "no"; then
175 AC_DEFINE(INADDR_NONE, ((unsigned int) 0xffffffff), [ ])
179 AC_DEFUN(APACHE_CHECK_SHM_RW,[
180 AC_CACHE_CHECK([whether system defines SHM_R,SHM_W],ac_cv_shm_rw,[
182 #include <sys/types.h>
186 int x = SHM_R | SHM_W;
192 if test "$ac_cv_shm_rw" = "no"; then
193 AC_DEFINE(SHM_R, 0x400, [ ])
194 AC_DEFINE(SHM_W, 0x200, [ ])
199 dnl APACHE_MODPATH_INIT(modpath)
200 AC_DEFUN(APACHE_MODPATH_INIT,[
201 modpath_current=modules/$1
204 test -d $1 || $srcdir/helpers/mkdir.sh $modpath_current
205 > $modpath_current/modules.mk
206 MODULE_DIRS="$MODULE_DIRS $1"
209 AC_DEFUN(APACHE_MODPATH_FINISH,[
210 echo "static = $modpath_static" >> $modpath_current/modules.mk
211 echo "shared = $modpath_shared" >> $modpath_current/modules.mk
212 APACHE_FAST_OUTPUT($modpath_current/Makefile)
215 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
216 AC_DEFUN(APACHE_MODPATH_ADD,[
217 if test -z "$3"; then
223 if test -z "$module_standalone"; then
224 if test -z "$2"; then
225 libname="libapachemod_$1.la"
226 BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
227 modpath_static="$modpath_static $libname"
228 cat >>$modpath_current/modules.mk<<EOF
233 apache_need_shared=yes
235 shobjects=`echo $objects | sed 's/\.lo/.slo/'`
236 modpath_shared="$modpath_shared $libname"
237 cat >>$modpath_current/modules.mk<<EOF
239 \$(SHLINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
245 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
246 AC_DEFUN(APACHE_MODULE,[
247 AC_MSG_CHECKING(whether to enable mod_$1)
248 AC_ARG_ENABLE(translit($1,_,-),[ --]ifelse($5,yes,disable,enable)[-]translit($1,_,-),,enable_$1=ifelse($5,,no,$5))
249 AC_MSG_RESULT($enable_$1)
250 if test "$enable_$1" != "no"; then
253 enable_$1=`echo $ac_n $enable_$1$ac_c|sed 's/shared,*//'`
257 MODLIST="$MODLIST ifelse($4,,$1,$4)"
261 APACHE_MODPATH_ADD($1, $shared, $3)
265 dnl APACHE_LAYOUT(configlayout, layoutname)
266 AC_DEFUN(APACHE_LAYOUT,[
269 sed -e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \
270 -e '/[ ]*<\/Layout>[ ]*/,$d' \
279 for var in prefix exec_prefix bindir sbindir libexecdir mandir \
280 sysconfdir datadir iconsdir htdocsdir cgidir includedir \
281 localstatedir runtimedir logfiledir proxycachedir; do
282 eval "val=\"\$$var\""
285 val=`echo $val | sed -e 's;\+$;;'`
286 eval "$var=\"\$val\""
293 val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
294 if test "$autosuffix" = "yes"; then
295 if echo $val | grep apache >/dev/null; then
300 if test "$addtarget" = "yes"; then
308 dnl APACHE_ENABLE_LAYOUT
310 AC_DEFUN(APACHE_ENABLE_LAYOUT,[
311 AC_ARG_ENABLE(layout,
312 [ --enable-layout=LAYOUT],[
316 if test -z "$LAYOUT"; then
317 htdocsdir='$(prefix)/htdocs'
318 iconsdir='$(prefix)/icons'
319 cgidir='$(prefix)/cgi-bin'
320 logdir='$(prefix)/logs'
321 sysconfdir='$(prefix)/conf'
324 APACHE_LAYOUT($srcdir/../config.layout, $LAYOUT)
327 AC_MSG_CHECKING(for chosen layout)
328 AC_MSG_RESULT($layout_name)
331 dnl APACHE_ENABLE_SHARED
333 AC_DEFUN(APACHE_ENABLE_SHARED,[
334 AC_ARG_ENABLE(shared,
335 [ --enable-shared=MODULE-LIST],[
336 for i in $enableval; do
337 eval "enable_$i=shared"
342 dnl APACHE_ENABLE_MODULES
344 AC_DEFUN(APACHE_ENABLE_MODULES,[
345 AC_ARG_ENABLE(modules,
346 [ --enable-modules=MODULE-LIST],[
347 for i in $enableval; do