2 AC_DEFUN(APACHE_CONFIG_NICE,[
11 for arg in [$]0 "[$]@"; do
12 echo "\"[$]arg\" \\" >> $1
18 AC_DEFUN(APACHE_PASSTHRU,[
20 AC_CACHE_VAL(ac_cv_pass_$1, [ac_cv_pass_$1=$$1])
23 dnl APACHE_SUBST(VARIABLE)
24 dnl Makes VARIABLE available in generated files
25 dnl (do not use @variable@ in Makefiles, but $(variable))
26 AC_DEFUN(APACHE_SUBST,[
27 APACHE_VAR_SUBST="$APACHE_VAR_SUBST $1"
31 dnl APACHE_FAST_OUTPUT(FILENAME)
32 dnl Perform substitutions on FILENAME (Makefiles only)
33 AC_DEFUN(APACHE_FAST_OUTPUT,[
34 APACHE_FAST_OUTPUT_FILES="$APACHE_FAST_OUTPUT_FILES $1"
37 dnl APACHE_MKDIR_P_CHECK
38 dnl checks whether mkdir -p works
39 AC_DEFUN(APACHE_MKDIR_P_CHECK,[
40 AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
41 test -d conftestdir && rm -rf conftestdir
42 mkdir -p conftestdir/somedir >/dev/null 2>&1
43 if test -d conftestdir/somedir; then
52 dnl APACHE_GEN_CONFIG_VARS
53 dnl Creates config_vars.mk
54 AC_DEFUN(APACHE_GEN_CONFIG_VARS,[
55 APACHE_SUBST(abs_srcdir)
59 APACHE_SUBST(exec_prefix)
61 APACHE_SUBST(localstatedir)
62 APACHE_SUBST(libexecdir)
63 APACHE_SUBST(htdocsdir)
64 APACHE_SUBST(includedir)
65 APACHE_SUBST(iconsdir)
66 APACHE_SUBST(sysconfdir)
67 APACHE_SUBST(progname)
71 APACHE_SUBST(CPPFLAGS)
73 APACHE_SUBST(CXXFLAGS)
79 APACHE_SUBST(MODULE_DIRS)
82 abs_srcdir="`(cd $srcdir && pwd)`"
85 echo creating config_vars.mk
87 for i in $APACHE_VAR_SUBST; do
88 eval echo "$i = \$$i" >> config_vars.mk
92 dnl APACHE_GEN_MAKEFILES
94 AC_DEFUN(APACHE_GEN_MAKEFILES,[
95 $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
98 AC_DEFUN(APACHE_LIBTOOL_SILENT,[
99 LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent'
103 dnl ## APACHE_OUTPUT(file)
104 dnl ## adds "file" to the list of files generated by AC_OUTPUT
105 dnl ## This macro can be used several times.
106 AC_DEFUN(APACHE_OUTPUT, [
107 APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
111 dnl AC_ADD_LIBRARY(library)
113 dnl add a library to the link line
115 AC_DEFUN(AC_ADD_LIBRARY,[
116 APACHE_ONCE(LIBRARY, $1, [
117 EXTRA_LIBS="$EXTRA_LIBS -l$1"
122 dnl AC_CHECK_DEFINE(macro, headerfile)
124 dnl checks for the macro in the header file
126 AC_DEFUN(AC_CHECK_DEFINE,[
127 AC_CACHE_CHECK(for $1 in $2, ac_cv_define_$1,
128 AC_EGREP_CPP([YES_IS_DEFINED], [
133 ], ac_cv_define_$1=yes, ac_cv_define_$1=no))
134 if test "$ac_cv_define_$1" = "yes" ; then
136 [Define if the macro "$1" is defined on this system])
143 dnl If rlim_t is not defined, define it to int
145 AC_DEFUN(AC_TYPE_RLIM_T, [
146 AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
148 #include <sys/types.h>
149 #include <sys/time.h>
150 #include <sys/resource.h>
151 ], [rlim_t spoon;], [
152 ac_cv_type_rlim_t=yes
153 ],[ac_cv_type_rlim_t=no
156 if test "$ac_cv_type_rlim_t" = "no" ; then
157 AC_DEFINE(rlim_t, int,
158 [Define to 'int' if <sys/resource.h> doesn't define it for us])
163 dnl APACHE_ONCE(namespace, variable, code)
165 dnl execute code, if variable is not set in namespace
167 AC_DEFUN(APACHE_ONCE,[
168 unique=`echo $ac_n "$2$ac_c" | tr -cd a-zA-Z0-9`
169 cmd="echo $ac_n \"\$$1$unique$ac_c\""
170 if test -n "$unique" && test "`eval $cmd`" = "" ; then
176 sinclude(lib/apr/apr_common.m4)
177 sinclude(lib/apr/hints.m4)
180 dnl APACHE_INADDR_NONE
182 dnl checks for missing INADDR_NONE macro
184 AC_DEFUN(APACHE_INADDR_NONE,[
185 AC_CACHE_CHECK(whether system defines INADDR_NONE, ac_cv_inaddr_none,[
187 #ifdef HAVE_SYS_TYPES_H
188 #include <sys/types.h>
190 #ifdef HAVE_SYS_SOCKET_H
191 #include <sys/socket.h>
193 #ifdef HAVE_NETINET_IN_H
194 #include <netinet/in.h>
196 #ifdef HAVE_ARPA_INET_H
197 #include <arpa/inet.h>
200 unsigned long foo = INADDR_NONE;
202 ac_cv_inaddr_none=yes
206 if test "$ac_cv_inaddr_none" = "no"; then
207 AC_DEFINE(INADDR_NONE, ((unsigned int) 0xffffffff), [ ])
211 AC_DEFUN(APACHE_CHECK_SIGWAIT_ONE_ARG,[
212 AC_CACHE_CHECK(whether sigwait takes one argument,ac_cv_sigwait_one_arg,[
215 /* When using the unproven-pthreads package, we need to pull in this
216 * header to get a prototype for sigwait(). Else things will fail later
217 * on. XXX Should probably be fixed in the unproven-pthreads package.
227 ac_cv_sigwait_one_arg=yes
229 ac_cv_sigwait_one_arg=no
231 if test "$ac_cv_sigwait_one_arg" = "yes"; then
232 AC_DEFINE(SIGWAIT_TAKES_ONE_ARG,1,[ ])
236 AC_DEFUN(APACHE_EBCDIC,[
237 AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[
240 return (unsigned char)'A' != (unsigned char)0xC1;
249 if test "$ac_cv_ebcdic" = "yes"; then
250 AC_DEFINE(CHARSET_EBCDIC,, [Define if system uses EBCDIC])
254 dnl APACHE_MODPATH_INIT(modpath)
255 AC_DEFUN(APACHE_MODPATH_INIT,[
257 modpath_current=modules/$1
260 test -d $1 || $srcdir/helpers/mkdir.sh $modpath_current
261 > $modpath_current/modules.mk
264 AC_DEFUN(APACHE_MODPATH_FINISH,[
265 echo "static = $modpath_static" >> $modpath_current/modules.mk
266 echo "shared = $modpath_shared" >> $modpath_current/modules.mk
267 if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
268 MODULE_DIRS="$MODULE_DIRS $current_dir"
270 APACHE_FAST_OUTPUT($modpath_current/Makefile)
273 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
274 AC_DEFUN(APACHE_MODPATH_ADD,[
275 if test -z "$3"; then
281 if test -z "$module_standalone"; then
282 if test -z "$2"; then
283 libname="libapachemod_$1.la"
284 BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
285 modpath_static="$modpath_static $libname"
286 cat >>$modpath_current/modules.mk<<EOF
291 apache_need_shared=yes
293 shobjects=`echo $objects | sed 's/\.lo/.slo/'`
294 modpath_shared="$modpath_shared $libname"
295 cat >>$modpath_current/modules.mk<<EOF
297 \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
303 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
304 AC_DEFUN(APACHE_MODULE,[
305 AC_MSG_CHECKING(whether to enable mod_$1)
306 define([optname],[ --]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
307 AC_ARG_ENABLE(translit($1,_,-),optname() substr([ ],len(optname()))$2,,enable_$1=ifelse($5,,no,$5))
308 undefine([optname])dnl
309 AC_MSG_RESULT($enable_$1)
310 if test "$enable_$1" != "no"; then
313 enable_$1=`echo $ac_n $enable_$1$ac_c|sed 's/shared,*//'`
317 MODLIST="$MODLIST ifelse($4,,$1,$4)"
318 if test "$1" = "so"; then
324 APACHE_MODPATH_ADD($1, $shared, $3)
328 dnl APACHE_LAYOUT(configlayout, layoutname)
329 AC_DEFUN(APACHE_LAYOUT,[
330 if test ! -f $srcdir/../config.layout; then
331 echo "** Error: Layout file $srcdir/../config.layout not found"
332 echo "** Error: Cannot use undefined layout '$LAYOUT'"
337 sed -e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \
338 -e '/[ ]*<\/Layout>[ ]*/,$d' \
346 for var in prefix exec_prefix bindir sbindir libexecdir mandir \
347 sysconfdir datadir iconsdir htdocsdir cgidir includedir \
348 localstatedir runtimedir logdir proxycachedir; do
349 eval "val=\"\$$var\""
352 val=`echo $val | sed -e 's;\+$;;'`
353 eval "$var=\"\$val\""
360 val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
361 val=`echo $val | sed -e 's:$\([a-z_]*\):$(\1):g'`
362 if test "$autosuffix" = "yes"; then
363 if echo $val | grep apache >/dev/null; then
368 if test "$addtarget" = "yes"; then
377 dnl APACHE_ENABLE_LAYOUT
379 AC_DEFUN(APACHE_ENABLE_LAYOUT,[
380 AC_ARG_ENABLE(layout,
381 [ --enable-layout=LAYOUT],[
385 if test -z "$LAYOUT"; then
386 htdocsdir='$(prefix)/htdocs'
387 iconsdir='$(prefix)/icons'
388 cgidir='$(prefix)/cgi-bin'
389 logdir='$(prefix)/logs'
390 sysconfdir='${prefix}/conf'
393 APACHE_LAYOUT($srcdir/../config.layout, $LAYOUT)
396 AC_MSG_CHECKING(for chosen layout)
397 AC_MSG_RESULT($layout_name)
400 dnl APACHE_ENABLE_SHARED
402 AC_DEFUN(APACHE_ENABLE_SHARED,[
403 AC_ARG_ENABLE(mods-shared,
404 [ --enable-mods-shared=MODULE-LIST],[
405 for i in $enableval; do
406 eval "enable_$i=shared"
411 dnl APACHE_ENABLE_MODULES
413 AC_DEFUN(APACHE_ENABLE_MODULES,[
414 AC_ARG_ENABLE(modules,
415 [ --enable-modules=MODULE-LIST],[
416 for i in $enableval; do
422 AC_DEFUN(APACHE_REQUIRE_CXX,[
423 if test -z "$apache_cxx_done"; then