fixed incorrect bucket buffer copy
[httpd-crcsyncproxy.git] / acinclude.m4
blob7acca909959f7bd27889269e35e5157d2b7c32e8
2 dnl APACHE_HELP_STRING(LHS, RHS)
3 dnl Autoconf 2.50 can not handle substr correctly.  It does have 
4 dnl AC_HELP_STRING, so let's try to call it if we can.
5 dnl Note: this define must be on one line so that it can be properly returned
6 dnl as the help string.
7 AC_DEFUN(APACHE_HELP_STRING,[ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING($1,$2),[  ]$1 substr([                       ],len($1))$2)])dnl
9 dnl APACHE_SUBST(VARIABLE)
10 dnl Makes VARIABLE available in generated files
11 dnl (do not use @variable@ in Makefiles, but $(variable))
12 AC_DEFUN(APACHE_SUBST,[
13   APACHE_VAR_SUBST="$APACHE_VAR_SUBST $1"
14   AC_SUBST($1)
17 dnl APACHE_FAST_OUTPUT(FILENAME)
18 dnl Perform substitutions on FILENAME (Makefiles only)
19 AC_DEFUN(APACHE_FAST_OUTPUT,[
20   APACHE_FAST_OUTPUT_FILES="$APACHE_FAST_OUTPUT_FILES $1"
23 dnl APACHE_GEN_CONFIG_VARS
24 dnl Creates config_vars.mk
25 AC_DEFUN(APACHE_GEN_CONFIG_VARS,[
26   APACHE_SUBST(abs_srcdir)
27   APACHE_SUBST(bindir)
28   APACHE_SUBST(sbindir)
29   APACHE_SUBST(cgidir)
30   APACHE_SUBST(logfiledir)
31   APACHE_SUBST(exec_prefix)
32   APACHE_SUBST(datadir)
33   APACHE_SUBST(localstatedir)
34   APACHE_SUBST(mandir)
35   APACHE_SUBST(libdir)
36   APACHE_SUBST(libexecdir)
37   APACHE_SUBST(htdocsdir)
38   APACHE_SUBST(manualdir)
39   APACHE_SUBST(includedir)
40   APACHE_SUBST(errordir)
41   APACHE_SUBST(iconsdir)
42   APACHE_SUBST(sysconfdir)
43   APACHE_SUBST(installbuilddir)
44   APACHE_SUBST(runtimedir)
45   APACHE_SUBST(proxycachedir)
46   APACHE_SUBST(other_targets)
47   APACHE_SUBST(progname)
48   APACHE_SUBST(prefix)
49   APACHE_SUBST(AWK)
50   APACHE_SUBST(CC)
51   APACHE_SUBST(CPP)
52   APACHE_SUBST(CXX)
53   APACHE_SUBST(CPPFLAGS)
54   APACHE_SUBST(CFLAGS)
55   APACHE_SUBST(CXXFLAGS)
56   APACHE_SUBST(LTFLAGS)
57   APACHE_SUBST(LDFLAGS)
58   APACHE_SUBST(LT_LDFLAGS)
59   APACHE_SUBST(SH_LDFLAGS)
60   APACHE_SUBST(HTTPD_LDFLAGS)
61   APACHE_SUBST(UTIL_LDFLAGS)
62   APACHE_SUBST(LIBS)
63   APACHE_SUBST(DEFS)
64   APACHE_SUBST(INCLUDES)
65   APACHE_SUBST(NOTEST_CPPFLAGS)
66   APACHE_SUBST(NOTEST_CFLAGS)
67   APACHE_SUBST(NOTEST_CXXFLAGS)
68   APACHE_SUBST(NOTEST_LDFLAGS)
69   APACHE_SUBST(NOTEST_LIBS)
70   APACHE_SUBST(EXTRA_CPPFLAGS)
71   APACHE_SUBST(EXTRA_CFLAGS)
72   APACHE_SUBST(EXTRA_CXXFLAGS)
73   APACHE_SUBST(EXTRA_LDFLAGS)
74   APACHE_SUBST(EXTRA_LIBS)
75   APACHE_SUBST(EXTRA_INCLUDES)
76   APACHE_SUBST(LIBTOOL)
77   APACHE_SUBST(SHELL)
78   APACHE_SUBST(RSYNC)
79   APACHE_SUBST(MODULE_DIRS)
80   APACHE_SUBST(MODULE_CLEANDIRS)
81   APACHE_SUBST(PORT)
82   APACHE_SUBST(SSLPORT)
83   APACHE_SUBST(nonssl_listen_stmt_1)
84   APACHE_SUBST(nonssl_listen_stmt_2)
85   APACHE_SUBST(CORE_IMPLIB_FILE)
86   APACHE_SUBST(CORE_IMPLIB)
87   APACHE_SUBST(SH_LIBS)
88   APACHE_SUBST(SH_LIBTOOL)
89   APACHE_SUBST(MK_IMPLIB)
90   APACHE_SUBST(MKDEP)
91   APACHE_SUBST(INSTALL_PROG_FLAGS)
92   APACHE_SUBST(DSO_MODULES)
93   APACHE_SUBST(APR_BINDIR)
94   APACHE_SUBST(APR_INCLUDEDIR)
95   APACHE_SUBST(APR_VERSION)
96   APACHE_SUBST(APR_CONFIG)
97   APACHE_SUBST(APU_BINDIR)
98   APACHE_SUBST(APU_INCLUDEDIR)
99   APACHE_SUBST(APU_VERSION)
100   APACHE_SUBST(APU_CONFIG)
102   abs_srcdir="`(cd $srcdir && pwd)`"
104   echo creating config_vars.mk
105   test -d build || $mkdir_p build
106   > build/config_vars.mk
107   for i in $APACHE_VAR_SUBST; do
108     eval echo "$i = \$$i" >> build/config_vars.mk
109   done
112 dnl APACHE_GEN_MAKEFILES
113 dnl Creates Makefiles
114 AC_DEFUN(APACHE_GEN_MAKEFILES,[
115   $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
118 dnl ## APACHE_OUTPUT(file)
119 dnl ## adds "file" to the list of files generated by AC_OUTPUT
120 dnl ## This macro can be used several times.
121 AC_DEFUN(APACHE_OUTPUT, [
122   APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
126 dnl APACHE_TYPE_RLIM_T
128 dnl If rlim_t is not defined, define it to int
130 AC_DEFUN(APACHE_TYPE_RLIM_T, [
131   AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
132     AC_TRY_COMPILE([
133 #include <sys/types.h>
134 #include <sys/time.h>
135 #include <sys/resource.h>
136 ], [rlim_t spoon;], [
137       ac_cv_type_rlim_t=yes
138     ],[ac_cv_type_rlim_t=no
139     ])
140   ])
141   if test "$ac_cv_type_rlim_t" = "no" ; then
142       AC_DEFINE(rlim_t, int,
143           [Define to 'int' if <sys/resource.h> doesn't define it for us])
144   fi
147 dnl APACHE_MODPATH_INIT(modpath)
148 AC_DEFUN(APACHE_MODPATH_INIT,[
149   current_dir=$1
150   modpath_current=modules/$1
151   modpath_static=
152   modpath_shared=
153   test -d $1 || $srcdir/build/mkdir.sh $modpath_current
154   > $modpath_current/modules.mk
155 ])dnl
157 AC_DEFUN(APACHE_MODPATH_FINISH,[
158   echo "DISTCLEAN_TARGETS = modules.mk" >> $modpath_current/modules.mk
159   echo "static = $modpath_static" >> $modpath_current/modules.mk
160   echo "shared = $modpath_shared" >> $modpath_current/modules.mk
161   if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
162     MODULE_DIRS="$MODULE_DIRS $current_dir"
163   else
164     MODULE_CLEANDIRS="$MODULE_CLEANDIRS $current_dir"
165   fi
166   APACHE_FAST_OUTPUT($modpath_current/Makefile)
167 ])dnl
169 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
170 AC_DEFUN(APACHE_MODPATH_ADD,[
171   if test -z "$3"; then
172     objects="mod_$1.lo"
173   else
174     objects="$3"
175   fi
177   if test -z "$module_standalone"; then
178     if test -z "$2"; then
179       # The filename of a convenience library must have a "lib" prefix:
180       libname="libmod_$1.la"
181       BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
182       modpath_static="$modpath_static $libname"
183       cat >>$modpath_current/modules.mk<<EOF
184 $libname: $objects
185         \$(MOD_LINK) $objects $5
187       if test ! -z "$5"; then
188         APR_ADDTO(AP_LIBS, [$5])
189       fi
190     else
191       apache_need_shared=yes
192       libname="mod_$1.la"
193       shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
194       modpath_shared="$modpath_shared $libname"
195       cat >>$modpath_current/modules.mk<<EOF
196 $libname: $shobjects
197         \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
199     fi
200   fi
201 ])dnl
204 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
206 dnl default is one of:
207 dnl   yes    -- enabled by default. user must explicitly disable.
208 dnl   no     -- disabled under default, most, all. user must explicitly enable.
209 dnl   most   -- disabled by default. enabled explicitly or with most or all.
210 dnl   static -- enabled as static by default, must be explicitly changed.
211 dnl   ""     -- disabled under default, most. enabled explicitly or with all.
213 dnl basically: yes/no is a hard setting. "most" means follow the "most"
214 dnl            setting. otherwise, fall under the "all" setting.
215 dnl            explicit yes/no always overrides.
217 AC_DEFUN(APACHE_MODULE,[
218   AC_MSG_CHECKING(whether to enable mod_$1)
219   define([optname],[--]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
220   AC_ARG_ENABLE(translit($1,_,-),APACHE_HELP_STRING(optname(),$2),,enable_$1=ifelse($5,,maybe-all,$5))
221   undefine([optname])dnl
222   _apmod_extra_msg=""
223   dnl When --enable-modules=most is set and the module was not explicitly
224   dnl requested, allow a module to disable itself if its pre-reqs fail.
225   if test "$module_selection" = "most" -a "$enable_$1" = "most"; then
226     _apmod_error_fatal="no"
227   else
228     _apmod_error_fatal="yes"
229   fi
230   if test "$enable_$1" = "static"; then
231     enable_$1=yes
232   elif test "$enable_$1" = "yes"; then
233     enable_$1=$module_default
234     _apmod_extra_msg=" ($module_selection)"
235   elif test "$enable_$1" = "most"; then
236     if test "$module_selection" = "most" -o "$module_selection" = "all"; then
237       enable_$1=$module_default
238       _apmod_extra_msg=" ($module_selection)"
239     elif test "$enable_$1" != "yes"; then
240       enable_$1=no
241     fi
242   elif test "$enable_$1" = "maybe-all"; then
243     if test "$module_selection" = "all"; then
244       enable_$1=$module_default
245       _apmod_extra_msg=" (all)"
246     else
247       enable_$1=no
248     fi
249   fi
250   if test "$enable_$1" != "no"; then
251     dnl If we plan to enable it, allow the module to run some autoconf magic
252     dnl that may disable it because of missing dependencies.
253     ifelse([$6],,:,[AC_MSG_RESULT([checking dependencies])
254                     $6
255                     AC_MSG_CHECKING(whether to enable mod_$1)
256                     if test "$enable_$1" = "no"; then
257                       if test "$_apmod_error_fatal" = "no"; then
258                         _apmod_extra_msg=" (disabled)"
259                       else
260                         AC_MSG_ERROR([mod_$1 has been requested but can not be built due to prerequisite failures])
261                       fi
262                     fi])
263   fi
264   AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
265   if test "$enable_$1" != "no"; then
266     case "$enable_$1" in
267     shared*)
268       enable_$1=`echo $enable_$1|sed 's/shared,*//'`
269       sharedobjs=yes
270       shared=yes
271       DSO_MODULES="$DSO_MODULES $1"
272       ;;
273     *)
274       MODLIST="$MODLIST ifelse($4,,$1,$4)"
275       if test "$1" = "so"; then
276           sharedobjs=yes
277       fi
278       shared="";;
279     esac
280     define([modprefix], [MOD_]translit($1, [a-z-], [A-Z_]))
281     APACHE_MODPATH_ADD($1, $shared, $3,, [\$(]modprefix[_LDADD)])
282     APACHE_SUBST(modprefix[_LDADD])
283     undefine([modprefix])
284   fi
285 ])dnl
288 dnl APACHE_ENABLE_MODULES
290 AC_DEFUN(APACHE_ENABLE_MODULES,[
291   module_selection=default
292   module_default=yes
294   AC_ARG_ENABLE(modules,
295   APACHE_HELP_STRING(--enable-modules=MODULE-LIST,Space-separated list of modules to enable | "all" | "most" | "none"),[
296     if test "$enableval" = "none"; then
297        module_default=no
298        module_selection=none
299     else
300       for i in $enableval; do
301         if test "$i" = "all" -o "$i" = "most"; then
302           module_selection=$i
303         else
304           i=`echo $i | sed 's/-/_/g'`
305           eval "enable_$i=yes"
306         fi
307       done
308     fi
309   ])
310   
311   AC_ARG_ENABLE(mods-shared,
312   APACHE_HELP_STRING(--enable-mods-shared=MODULE-LIST,Space-separated list of shared modules to enable | "all" | "most"),[
313     for i in $enableval; do
314       if test "$i" = "all" -o "$i" = "most"; then
315         module_selection=$i
316         module_default=shared
317       else
318         i=`echo $i | sed 's/-/_/g'`
319         eval "enable_$i=shared"
320       fi
321     done
322   ])
325 AC_DEFUN(APACHE_REQUIRE_CXX,[
326   if test -z "$apache_cxx_done"; then
327     AC_PROG_CXX
328     AC_PROG_CXXCPP
329     apache_cxx_done=yes
330   fi
334 dnl APACHE_CHECK_SSL_TOOLKIT
336 dnl Configure for the detected openssl/ssl-c toolkit installation, giving
337 dnl preference to "--with-ssl=<path>" if it was specified.
339 AC_DEFUN(APACHE_CHECK_SSL_TOOLKIT,[
340 if test "x$ap_ssltk_configured" = "x"; then
341   dnl initialise the variables we use
342   ap_ssltk_found=""
343   ap_ssltk_base=""
344   ap_ssltk_libs=""
345   ap_ssltk_type=""
347   dnl Determine the SSL/TLS toolkit's base directory, if any
348   AC_MSG_CHECKING([for user-provided SSL/TLS toolkit base])
349   AC_ARG_WITH(sslc, APACHE_HELP_STRING(--with-sslc=DIR,RSA SSL-C SSL/TLS toolkit), [
350     dnl If --with-sslc specifies a directory, we use that directory or fail
351     if test "x$withval" != "xyes" -a "x$withval" != "x"; then
352       dnl This ensures $withval is actually a directory and that it is absolute
353       ap_ssltk_base="`cd $withval ; pwd`"
354     fi
355     ap_ssltk_type="sslc"
356   ])
357   AC_ARG_WITH(ssl, APACHE_HELP_STRING(--with-ssl=DIR,OpenSSL SSL/TLS toolkit), [
358     dnl If --with-ssl specifies a directory, we use that directory or fail
359     if test "x$withval" != "xyes" -a "x$withval" != "x"; then
360       dnl This ensures $withval is actually a directory and that it is absolute
361       ap_ssltk_base="`cd $withval ; pwd`"
362     fi
363   ])
364   if test "x$ap_ssltk_base" = "x"; then
365     AC_MSG_RESULT(none)
366   else
367     AC_MSG_RESULT($ap_ssltk_base)
368   fi
370   dnl Run header and version checks
371   saved_CPPFLAGS="$CPPFLAGS"
372   saved_LIBS="$LIBS"
373   saved_LDFLAGS="$LDFLAGS"
374   SSL_LIBS=""
376   dnl Before doing anything else, load in pkg-config variables (if not sslc).
377   if test "x$ap_ssltk_type" = "x" -a -n "$PKGCONFIG"; then
378     saved_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
379     if test "x$ap_ssltk_base" != "x" -a \
380             -f "${ap_ssltk_base}/lib/pkgconfig/openssl.pc"; then
381       dnl Ensure that the given path is used by pkg-config too, otherwise
382       dnl the system openssl.pc might be picked up instead.
383       PKG_CONFIG_PATH="${ap_ssltk_base}/lib/pkgconfig${PKG_CONFIG_PATH+:}${PKG_CONFIG_PATH}"
384       export PKG_CONFIG_PATH
385     fi
386     ap_ssltk_libs="`$PKGCONFIG --libs-only-l openssl 2>&1`"
387     if test $? -eq 0; then
388       ap_ssltk_found="yes"
389       pkglookup="`$PKGCONFIG --cflags-only-I openssl`"
390       APR_ADDTO(CPPFLAGS, [$pkglookup])
391       APR_ADDTO(INCLUDES, [$pkglookup])
392       pkglookup="`$PKGCONFIG --libs-only-L --libs-only-other openssl`"
393       APR_ADDTO(LDFLAGS, [$pkglookup])
394       APR_ADDTO(SSL_LIBS, [$pkglookup])
395     fi
396     PKG_CONFIG_PATH="$saved_PKG_CONFIG_PATH"
397   fi
398   if test "x$ap_ssltk_base" != "x" -a "x$ap_ssltk_found" = "x"; then
399     APR_ADDTO(CPPFLAGS, [-I$ap_ssltk_base/include])
400     APR_ADDTO(INCLUDES, [-I$ap_ssltk_base/include])
401     APR_ADDTO(LDFLAGS, [-L$ap_ssltk_base/lib])
402     APR_ADDTO(SSL_LIBS, [-L$ap_ssltk_base/lib])
403     if test "x$ap_platform_runtime_link_flag" != "x"; then
404       APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_ssltk_base/lib])
405       APR_ADDTO(SSL_LIBS, [$ap_platform_runtime_link_flag$ap_ssltk_base/lib])
406     fi
407   fi
408   if test "x$ap_ssltk_type" = "x"; then
409     dnl First check for manditory headers
410     AC_CHECK_HEADERS([openssl/opensslv.h openssl/ssl.h], [ap_ssltk_type="openssl"], [])
411     if test "$ap_ssltk_type" = "openssl"; then
412       dnl so it's OpenSSL - test for a good version
413       AC_MSG_CHECKING([for OpenSSL version])
414       AC_TRY_COMPILE([#include <openssl/opensslv.h>],[
415 #if !defined(OPENSSL_VERSION_NUMBER)
416 #error "Missing openssl version"
417 #endif
418 #if  (OPENSSL_VERSION_NUMBER < 0x009060af) \
419  || ((OPENSSL_VERSION_NUMBER > 0x00907000) && (OPENSSL_VERSION_NUMBER < 0x0090702f))
420 #error "Insecure openssl version " OPENSSL_VERSION_TEXT
421 #endif],
422       [AC_MSG_RESULT(OK)],
423       [dnl Replace this with OPENSSL_VERSION_TEXT from opensslv.h?
424        AC_MSG_RESULT([not encouraging])
425        AC_MSG_WARN([OpenSSL version may contain security vulnerabilities!]
426                    [ Ensure the latest security patches have been applied!])
427       ])
428     else
429       AC_MSG_RESULT([no OpenSSL headers found])
430     fi
431   fi
432   if test "$ap_ssltk_type" != "openssl"; then
433     dnl Might be SSL-C - report, then test anything relevant
434     AC_CHECK_HEADERS([sslc.h], [ap_ssltk_type="sslc"], [ap_ssltk_type=""])
435     if test "$ap_ssltk_type" = "sslc"; then
436       ap_ssltk_libs="-lsslc"
437       AC_MSG_CHECKING([for SSL-C version])
438       AC_TRY_COMPILE([#include <sslc.h>],[
439 #if !defined(SSLC_VERSION_NUMBER)
440 #error "Missing SSL-C version"
441 #endif
442 #if SSLC_VERSION_NUMBER < 0x2310
443 #define stringize_ver(x) #x
444 #error "Insecure SSL-C version " stringize_ver(SSLC_VERSION_NUMBER)
445 #endif],
446       [AC_MSG_RESULT(OK)],
447       [dnl Replace this with SSLC_VERSION_NUMBER?
448        AC_MSG_RESULT([not encouraging])
449        echo "WARNING: SSL-C version may contain security vulnerabilities!"
450        echo "         Ensure the latest security patches have been applied!"
451       ])
452     else
453       AC_MSG_RESULT([no SSL-C headers found])
454     fi
455   fi
456   if test "x$ap_ssltk_type" = "x"; then
457     AC_MSG_ERROR([...No recognized SSL/TLS toolkit detected])
458   fi
460   if test "$ap_ssltk_type" = "openssl" -a "x$ap_ssltk_found" = "x"; then
461     ap_ssltk_found="yes"
462     ap_ssltk_libs="-lssl -lcrypto `$apr_config --libs`"
463   fi
464   APR_ADDTO(SSL_LIBS, [$ap_ssltk_libs])
465   APR_ADDTO(LIBS, [$ap_ssltk_libs])
466   APACHE_SUBST(SSL_LIBS)
468   dnl Run library and function checks
469   liberrors=""
470   if test "$ap_ssltk_type" = "openssl"; then
471     AC_CHECK_HEADERS([openssl/engine.h])
472     AC_CHECK_FUNCS([SSLeay_version SSL_CTX_new], [], [liberrors="yes"])
473     AC_CHECK_FUNCS([ENGINE_init ENGINE_load_builtin_engines])
474   else
475     AC_CHECK_FUNCS([SSLC_library_version SSL_CTX_new], [], [liberrors="yes"])
476     AC_CHECK_FUNCS(SSL_set_state)
477   fi
478   AC_CHECK_FUNCS(SSL_set_cert_store)
479   dnl restore
480   CPPFLAGS="$saved_CPPFLAGS"
481   LIBS="$saved_LIBS"
482   LDFLAGS="$saved_LDFLAGS"
483   if test "x$liberrors" != "x"; then
484     AC_MSG_ERROR([... Error, SSL/TLS libraries were missing or unusable])
485   fi
487   dnl Adjust apache's configuration based on what we found above.
488   dnl (a) define preprocessor symbols
489   if test "$ap_ssltk_type" = "openssl"; then
490     AC_DEFINE(HAVE_OPENSSL, 1, [Define if SSL is supported using OpenSSL])
491   else
492     AC_DEFINE(HAVE_SSLC, 1, [Define if SSL is supported using SSL-C])
493   fi
498 dnl APACHE_EXPORT_ARGUMENTS
499 dnl Export (via APACHE_SUBST) the various path-related variables that
500 dnl apache will use while generating scripts like autoconf and apxs and
501 dnl the default config file.
503 AC_DEFUN(APACHE_SUBST_EXPANDED_ARG,[
504   APR_EXPAND_VAR(exp_$1, [$]$1)
505   APACHE_SUBST(exp_$1)
506   APR_PATH_RELATIVE(rel_$1, [$]exp_$1, ${prefix})
507   APACHE_SUBST(rel_$1)
510 AC_DEFUN(APACHE_EXPORT_ARGUMENTS,[
511   APACHE_SUBST_EXPANDED_ARG(exec_prefix)
512   APACHE_SUBST_EXPANDED_ARG(bindir)
513   APACHE_SUBST_EXPANDED_ARG(sbindir)
514   APACHE_SUBST_EXPANDED_ARG(libdir)
515   APACHE_SUBST_EXPANDED_ARG(libexecdir)
516   APACHE_SUBST_EXPANDED_ARG(mandir)
517   APACHE_SUBST_EXPANDED_ARG(sysconfdir)
518   APACHE_SUBST_EXPANDED_ARG(datadir)
519   APACHE_SUBST_EXPANDED_ARG(installbuilddir)
520   APACHE_SUBST_EXPANDED_ARG(errordir)
521   APACHE_SUBST_EXPANDED_ARG(iconsdir)
522   APACHE_SUBST_EXPANDED_ARG(htdocsdir)
523   APACHE_SUBST_EXPANDED_ARG(manualdir)
524   APACHE_SUBST_EXPANDED_ARG(cgidir)
525   APACHE_SUBST_EXPANDED_ARG(includedir)
526   APACHE_SUBST_EXPANDED_ARG(localstatedir)
527   APACHE_SUBST_EXPANDED_ARG(runtimedir)
528   APACHE_SUBST_EXPANDED_ARG(logfiledir)
529   APACHE_SUBST_EXPANDED_ARG(proxycachedir)
532 dnl 
533 dnl APACHE_CHECK_APxVER({apr|apu}, major, minor, 
534 dnl                     [actions-if-ok], [actions-if-not-ok])
536 dnl Checks for APR or APR-util of given major/minor version or later; 
537 dnl if so, runs actions-if-ok; otherwise runs actions-if-not-ok if given.
538 dnl If the version is not satisfactory and actions-if-not-ok is not
539 dnl given, then an error is printed and the configure script is aborted.
541 dnl The first argument must be [apr] or [apu].
543 AC_DEFUN([APACHE_CHECK_APxVER], [
544 define(ap_ckver_major, translit($1, [apru], [APRU])[_MAJOR_VERSION])
545 define(ap_ckver_minor, translit($1, [apru], [APRU])[_MINOR_VERSION])
546 define(ap_ckver_cvar, [ap_cv_$1ver$2$3])
547 define(ap_ckver_name, ifelse([$1],[apr],[APR],[APR-util]))
549 ap_ckver_CPPFLAGS="$CPPFLAGS"
550 CPPFLAGS="$CPPFLAGS `$[$1]_config --includes`"
552 AC_CACHE_CHECK([for ap_ckver_name version $2.$3.0 or later], ap_ckver_cvar, [
553 AC_EGREP_CPP([good], [
554 #include <$1_version.h>
555 #if ]ap_ckver_major[ > $2 || (]ap_ckver_major[ == $2 && ]ap_ckver_minor[ >= $3)
556 good
557 #endif
558 ], [ap_ckver_cvar=yes], [ap_ckver_cvar=no])])
560 if test "$ap_ckver_cvar" = "yes"; then
561   ifelse([$4],[],[:],[$4])
562 else
563   ifelse([$5],[],[AC_MSG_ERROR([ap_ckver_name version $2.$3.0 or later is required])], [$5])
566 CPPFLAGS="$ap_ckver_CPPFLAGS"
568 undefine([ap_ckver_major])
569 undefine([ap_ckver_minor])
570 undefine([ap_ckver_cvar])
571 undefine([ap_ckver_name])
575 dnl APACHE_CHECK_VOID_PTR_LEN
577 dnl Checks if the size of a void pointer is at least as big as a "long" 
578 dnl integer type.
580 AC_DEFUN([APACHE_CHECK_VOID_PTR_LEN], [
582 AC_CACHE_CHECK([for void pointer length], [ap_cv_void_ptr_lt_long],
583 [AC_TRY_RUN([
584 int main(void)
586     return sizeof(void *) < sizeof(long); 
587 }], [ap_cv_void_ptr_lt_long=no], [ap_cv_void_ptr_lt_long=yes], 
588     [ap_cv_void_ptr_lt_long=yes])])
590 if test "$ap_cv_void_ptr_lt_long" = "yes"; then
591     AC_MSG_ERROR([Size of "void *" is less than size of "long"])