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"
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)
30 APACHE_SUBST(logfiledir)
31 APACHE_SUBST(exec_prefix)
33 APACHE_SUBST(localstatedir)
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)
53 APACHE_SUBST(CPPFLAGS)
55 APACHE_SUBST(CXXFLAGS)
58 APACHE_SUBST(LT_LDFLAGS)
59 APACHE_SUBST(SH_LDFLAGS)
60 APACHE_SUBST(HTTPD_LDFLAGS)
61 APACHE_SUBST(UTIL_LDFLAGS)
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(INTERNAL_CPPFLAGS)
80 APACHE_SUBST(MODULE_DIRS)
81 APACHE_SUBST(MODULE_CLEANDIRS)
84 APACHE_SUBST(CORE_IMPLIB_FILE)
85 APACHE_SUBST(CORE_IMPLIB)
87 APACHE_SUBST(SH_LIBTOOL)
88 APACHE_SUBST(MK_IMPLIB)
90 APACHE_SUBST(INSTALL_PROG_FLAGS)
91 APACHE_SUBST(DSO_MODULES)
92 APACHE_SUBST(ENABLED_DSO_MODULES)
93 APACHE_SUBST(LOAD_ALL_MODULES)
94 APACHE_SUBST(APR_BINDIR)
95 APACHE_SUBST(APR_INCLUDEDIR)
96 APACHE_SUBST(APR_VERSION)
97 APACHE_SUBST(APR_CONFIG)
98 APACHE_SUBST(APU_BINDIR)
99 APACHE_SUBST(APU_INCLUDEDIR)
100 APACHE_SUBST(APU_VERSION)
101 APACHE_SUBST(APU_CONFIG)
103 abs_srcdir="`(cd $srcdir && pwd)`"
105 AC_MSG_NOTICE([creating config_vars.mk])
106 test -d build || $mkdir_p build
107 > build/config_vars.mk
108 for i in $APACHE_VAR_SUBST; do
109 eval echo "$i = \$$i" >> build/config_vars.mk
113 dnl APACHE_GEN_MAKEFILES
114 dnl Creates Makefiles
115 AC_DEFUN(APACHE_GEN_MAKEFILES,[
116 $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
119 dnl ## APACHE_OUTPUT(file)
120 dnl ## adds "file" to the list of files generated by AC_OUTPUT
121 dnl ## This macro can be used several times.
122 AC_DEFUN(APACHE_OUTPUT, [
123 APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
127 dnl APACHE_TYPE_RLIM_T
129 dnl If rlim_t is not defined, define it to int
131 AC_DEFUN(APACHE_TYPE_RLIM_T, [
132 AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
134 #include <sys/types.h>
135 #include <sys/time.h>
136 #include <sys/resource.h>
137 ], [rlim_t spoon;], [
138 ac_cv_type_rlim_t=yes
139 ],[ac_cv_type_rlim_t=no
142 if test "$ac_cv_type_rlim_t" = "no" ; then
143 AC_DEFINE(rlim_t, int,
144 [Define to 'int' if <sys/resource.h> doesn't define it for us])
148 dnl the list of build variables which are available for customization on a
149 dnl per module subdir basis (to be inserted into modules.mk with a "MOD_"
150 dnl prefix, i.e. MOD_CFLAGS etc.). Used in APACHE_MODPATH_{INIT,FINISH}.
151 define(mod_buildvars, [CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LIBS INCLUDES])
153 dnl APACHE_MODPATH_INIT(modpath)
154 AC_DEFUN(APACHE_MODPATH_INIT,[
156 modpath_current=modules/$1
159 for var in mod_buildvars; do
162 test -d $1 || $srcdir/build/mkdir.sh $modpath_current
163 > $modpath_current/modules.mk
166 AC_DEFUN(APACHE_MODPATH_FINISH,[
167 echo "DISTCLEAN_TARGETS = modules.mk" >> $modpath_current/modules.mk
168 echo "static = $modpath_static" >> $modpath_current/modules.mk
169 echo "shared = $modpath_shared" >> $modpath_current/modules.mk
170 for var in mod_buildvars; do
171 if eval val=\"\$MOD_$var\"; test -n "$val"; then
172 echo "MOD_$var = $val" >> $modpath_current/modules.mk
175 if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
176 MODULE_DIRS="$MODULE_DIRS $current_dir"
178 MODULE_CLEANDIRS="$MODULE_CLEANDIRS $current_dir"
180 APACHE_FAST_OUTPUT($modpath_current/Makefile)
183 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
184 AC_DEFUN(APACHE_MODPATH_ADD,[
185 if test -z "$3"; then
191 if test -z "$module_standalone"; then
192 if test -z "$2"; then
193 # The filename of a convenience library must have a "lib" prefix:
194 libname="libmod_$1.la"
195 BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
196 modpath_static="$modpath_static $libname"
197 cat >>$modpath_current/modules.mk<<EOF
199 \$(MOD_LINK) $objects $5
201 if test ! -z "$5"; then
202 APR_ADDTO(AP_LIBS, [$5])
205 apache_need_shared=yes
207 shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
208 modpath_shared="$modpath_shared $libname"
209 cat >>$modpath_current/modules.mk<<EOF
211 \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
218 dnl APACHE_MPM_MODULE(name[, shared[, objects[, config[, path[, libs]]]]])
220 dnl Provide information for building the MPM. (Enablement is handled using
221 dnl --with-mpm/--enable-mpms-shared.)
223 dnl name -- name of MPM, same as MPM directory name
224 dnl shared -- "shared" to indicate shared module build, empty string otherwise
225 dnl objects -- one or more .lo files to link into the MPM module (default: mpmname.lo)
226 dnl config -- configuration logic to run if the MPM is enabled
227 dnl path -- relative path to MPM (default: server/mpm/mpmname)
228 dnl libs -- libs needed by this MPM
230 AC_DEFUN(APACHE_MPM_MODULE,[
231 if ap_mpm_is_enabled $1; then
232 if test -z "$3"; then
238 if test -z "$5"; then
239 mpmpath="server/mpm/$1"
245 test -d $mpmpath || $srcdir/build/mkdir.sh $mpmpath
247 APACHE_FAST_OUTPUT($mpmpath/Makefile)
249 if test -z "$2"; then
250 APR_ADDTO(AP_LIBS, [$6])
252 cat >$mpmpath/modules.mk<<EOF
254 \$(MOD_LINK) $objects
255 DISTCLEAN_TARGETS = modules.mk
260 apache_need_shared=yes
261 libname="mod_mpm_$1.la"
262 shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
263 cat >$mpmpath/modules.mk<<EOF
265 \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $objects $6
266 DISTCLEAN_TARGETS = modules.mk
270 # add default MPM to LoadModule list
271 if test $1 = $default_mpm; then
272 DSO_MODULES="$DSO_MODULES mpm_$1"
273 ENABLED_DSO_MODULES="${ENABLED_DSO_MODULES},mpm_$1"
281 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config[, prereq_module]]]]])
283 dnl default is one of:
284 dnl yes -- enabled by default. user must explicitly disable.
285 dnl no -- disabled under default, most, all. user must explicitly enable.
286 dnl most -- disabled by default. enabled explicitly or with most or all.
287 dnl static -- enabled as static by default, must be explicitly changed.
288 dnl "" -- disabled under default, most. enabled explicitly or with all.
289 dnl XXX: The arg must really be empty here. Passing an empty shell
290 dnl XXX: variable doesn't work for some reason. This should be
293 dnl basically: yes/no is a hard setting. "most" means follow the "most"
294 dnl setting. otherwise, fall under the "all" setting.
295 dnl explicit yes/no always overrides, except if the user selects
298 dnl prereq_module is a module (without the "mod_" prefix) that must be enabled
299 dnl if the current module is enabled. If the current module is built
300 dnl statically, prereq_module must be built statically, too. If these
301 dnl conditions are not fulfilled, configure will abort if the current module
302 dnl has been enabled explicitly. Otherwise, configure will disable the
304 dnl prereq_module's APACHE_MODULE() statement must have been processed
305 dnl before the current APACHE_MODULE() statement.
307 AC_DEFUN(APACHE_MODULE,[
308 AC_MSG_CHECKING(whether to enable mod_$1)
309 define([optname],[--]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
310 AC_ARG_ENABLE(translit($1,_,-),APACHE_HELP_STRING(optname(),$2),force_$1=$enableval,enable_$1=ifelse($5,,maybe-all,$5))
311 undefine([optname])dnl
313 dnl When --enable-modules=most or --enable-modules=(really)all is set and the
314 dnl module was not explicitly requested, allow a module to disable itself if
315 dnl its pre-reqs fail.
318 _apmod_required="yes"
321 case "$module_selection" in
326 _apmod_required="yes"
330 if test "$enable_$1" = "static"; then
332 elif test "$enable_$1" = "yes"; then
333 enable_$1=$module_default
334 elif test "$enable_$1" = "most"; then
335 if test "$module_selection" = "most" -o "$module_selection" = "all" -o \
336 "$module_selection" = "reallyall"
338 enable_$1=$module_default
339 elif test "$module_selection" = "few" -o "$module_selection" = "none"; then
342 _apmod_extra_msg=" ($module_selection)"
343 elif test "$enable_$1" = "maybe-all"; then
344 if test "$module_selection" = "all" -o "$module_selection" = "reallyall"
346 enable_$1=$module_default
347 _apmod_extra_msg=" ($module_selection)"
351 elif test "$enable_$1" = "no" -a "$module_selection" = "reallyall" -a \
352 "$force_$1" != "no" ; then
353 enable_$1=$module_default
354 _apmod_extra_msg=" ($module_selection)"
356 if test "$enable_$1" != "no"; then
357 dnl If we plan to enable it, allow the module to run some autoconf magic
358 dnl that may disable it because of missing dependencies.
360 [AC_MSG_RESULT([checking dependencies])
361 ifelse([$7],,:,[if test "$enable_$7" = "no" ; then
363 AC_MSG_WARN("mod_$7 is disabled but required for mod_$1")
364 elif test "$enable_$1" = "static" && test "$enable_$7" != "static" ; then
366 AC_MSG_WARN("cannot build mod_$1 statically if mod_$7 is built shared")
368 ifelse([$6],,:,[ $6])
370 AC_MSG_CHECKING(whether to enable mod_$1)
371 if test "$enable_$1" = "no"; then
372 if test "$_apmod_required" = "no"; then
373 _apmod_extra_msg=" (disabled)"
375 AC_MSG_ERROR([mod_$1 has been requested but can not be built due to prerequisite failures])
379 AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
380 if test "$enable_$1" != "no"; then
383 MODLIST="$MODLIST ifelse($4,,$1,$4)"
384 if test "$1" = "so"; then
389 enable_$1=`echo $enable_$1|sed 's/shared,*//'`
392 DSO_MODULES="$DSO_MODULES $1"
393 if test "$5" = "yes" ; then
394 ENABLED_DSO_MODULES="${ENABLED_DSO_MODULES},$1"
398 define([modprefix], [MOD_]translit($1, [a-z-], [A-Z_]))
399 APACHE_MODPATH_ADD($1, $shared, $3,, [\$(]modprefix[_LDADD)])
400 APACHE_SUBST(modprefix[_LDADD])
401 undefine([modprefix])
406 dnl APACHE_ENABLE_MODULES
408 AC_DEFUN(APACHE_ENABLE_MODULES,[
409 module_selection=most
410 module_default=shared
412 dnl Check whether we have DSO support.
413 dnl If "yes", we build shared modules by default.
414 APR_CHECK_APR_DEFINE(APR_HAS_DSO)
416 if test $ac_cv_define_APR_HAS_DSO = "no"; then
417 AC_MSG_WARN([Missing DSO support - building static modules by default.])
418 module_default=static
422 AC_ARG_ENABLE(modules,
423 APACHE_HELP_STRING(--enable-modules=MODULE-LIST,Space-separated list of modules to enable | "all" | "most" | "few" | "none" | "reallyall"),[
424 if test "$enableval" = "none"; then
426 module_selection=none
428 for i in $enableval; do
429 if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"
433 i=`echo $i | sed 's/-/_/g'`
434 eval "enable_$i=shared"
440 AC_ARG_ENABLE(mods-shared,
441 APACHE_HELP_STRING(--enable-mods-shared=MODULE-LIST,Space-separated list of shared modules to enable | "all" | "most" | "few" | "reallyall"),[
442 for i in $enableval; do
443 if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"
446 module_default=shared
448 i=`echo $i | sed 's/-/_/g'`
449 eval "enable_$i=shared"
454 AC_ARG_ENABLE(mods-static,
455 APACHE_HELP_STRING(--enable-mods-static=MODULE-LIST,Space-separated list of static modules to enable | "all" | "most" | "few" | "reallyall"),[
456 for i in $enableval; do
457 if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"; then
459 module_default=static
461 i=`echo $i | sed 's/-/_/g'`
462 eval "enable_$i=static"
468 AC_DEFUN(APACHE_REQUIRE_CXX,[
469 if test -z "$apache_cxx_done"; then
477 dnl APACHE_CHECK_OPENSSL
479 dnl Configure for OpenSSL, giving preference to
480 dnl "--with-ssl=<path>" if it was specified.
482 AC_DEFUN(APACHE_CHECK_OPENSSL,[
483 AC_CACHE_CHECK([for OpenSSL], [ac_cv_openssl], [
484 dnl initialise the variables we use
490 dnl Determine the OpenSSL base directory, if any
491 AC_MSG_CHECKING([for user-provided OpenSSL base directory])
492 AC_ARG_WITH(ssl, APACHE_HELP_STRING(--with-ssl=PATH,OpenSSL installation directory), [
493 dnl If --with-ssl specifies a directory, we use that directory
494 if test "x$withval" != "xyes" -a "x$withval" != "x"; then
495 dnl This ensures $withval is actually a directory and that it is absolute
496 ap_openssl_base="`cd $withval ; pwd`"
499 if test "x$ap_openssl_base" = "x"; then
502 AC_MSG_RESULT($ap_openssl_base)
505 dnl Run header and version checks
506 saved_CPPFLAGS="$CPPFLAGS"
508 saved_LDFLAGS="$LDFLAGS"
510 dnl Before doing anything else, load in pkg-config variables
511 if test -n "$PKGCONFIG"; then
512 saved_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
513 if test "x$ap_openssl_base" != "x" -a \
514 -f "${ap_openssl_base}/lib/pkgconfig/openssl.pc"; then
515 dnl Ensure that the given path is used by pkg-config too, otherwise
516 dnl the system openssl.pc might be picked up instead.
517 PKG_CONFIG_PATH="${ap_openssl_base}/lib/pkgconfig${PKG_CONFIG_PATH+:}${PKG_CONFIG_PATH}"
518 export PKG_CONFIG_PATH
520 AC_ARG_ENABLE(ssl-staticlib-deps,APACHE_HELP_STRING(--enable-ssl-staticlib-deps,[link mod_ssl with dependencies of OpenSSL's static libraries (as indicated by "pkg-config --static"). Must be specified in addition to --enable-ssl.]), [
521 if test "$enableval" = "yes"; then
522 PKGCONFIG_LIBOPTS="--static"
525 ap_openssl_libs="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-l --silence-errors openssl`"
526 if test $? -eq 0; then
527 ap_openssl_found="yes"
528 pkglookup="`$PKGCONFIG --cflags-only-I openssl`"
529 APR_ADDTO(CPPFLAGS, [$pkglookup])
530 APR_ADDTO(MOD_CFLAGS, [$pkglookup])
531 APR_ADDTO(ab_CFLAGS, [$pkglookup])
532 pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-L openssl`"
533 APR_ADDTO(LDFLAGS, [$pkglookup])
534 APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
535 pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-other openssl`"
536 APR_ADDTO(LDFLAGS, [$pkglookup])
537 APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
539 PKG_CONFIG_PATH="$saved_PKG_CONFIG_PATH"
542 dnl fall back to the user-supplied directory if not found via pkg-config
543 if test "x$ap_openssl_base" != "x" -a "x$ap_openssl_found" = "x"; then
544 APR_ADDTO(CPPFLAGS, [-I$ap_openssl_base/include])
545 APR_ADDTO(MOD_CFLAGS, [-I$ap_openssl_base/include])
546 APR_ADDTO(ab_CFLAGS, [-I$ap_openssl_base/include])
547 APR_ADDTO(LDFLAGS, [-L$ap_openssl_base/lib])
548 APR_ADDTO(MOD_LDFLAGS, [-L$ap_openssl_base/lib])
549 if test "x$ap_platform_runtime_link_flag" != "x"; then
550 APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_openssl_base/lib])
551 APR_ADDTO(MOD_LDFLAGS, [$ap_platform_runtime_link_flag$ap_openssl_base/lib])
555 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
556 AC_TRY_COMPILE([#include <openssl/opensslv.h>],[
557 #if !defined(OPENSSL_VERSION_NUMBER)
558 #error "Missing OpenSSL version"
560 #if OPENSSL_VERSION_NUMBER < 0x0090700f
561 #error "Unsupported OpenSSL version " OPENSSL_VERSION_TEXT
565 [AC_MSG_RESULT(FAILED)])
567 if test "x$ac_cv_openssl" = "xyes"; then
568 ap_openssl_libs="${ap_openssl_libs:--lssl -lcrypto} `$apr_config --libs`"
569 APR_ADDTO(MOD_LDFLAGS, [$ap_openssl_libs])
570 APR_ADDTO(LIBS, [$ap_openssl_libs])
571 APR_SETVAR(ab_LDFLAGS, [$MOD_LDFLAGS])
572 APACHE_SUBST(ab_CFLAGS)
573 APACHE_SUBST(ab_LDFLAGS)
575 dnl Run library and function checks
577 AC_CHECK_HEADERS([openssl/engine.h])
578 AC_CHECK_FUNCS([SSLeay_version SSL_CTX_new], [], [liberrors="yes"])
579 AC_CHECK_FUNCS([ENGINE_init ENGINE_load_builtin_engines])
580 if test "x$liberrors" != "x"; then
581 AC_MSG_WARN([OpenSSL libraries are unusable])
584 AC_MSG_WARN([OpenSSL version is too old])
588 CPPFLAGS="$saved_CPPFLAGS"
590 LDFLAGS="$saved_LDFLAGS"
592 if test "x$ac_cv_openssl" = "xyes"; then
593 AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL is available])
598 dnl APACHE_EXPORT_ARGUMENTS
599 dnl Export (via APACHE_SUBST) the various path-related variables that
600 dnl apache will use while generating scripts like autoconf and apxs and
601 dnl the default config file.
603 AC_DEFUN(APACHE_SUBST_EXPANDED_ARG,[
604 APR_EXPAND_VAR(exp_$1, [$]$1)
606 APR_PATH_RELATIVE(rel_$1, [$]exp_$1, ${prefix})
610 AC_DEFUN(APACHE_EXPORT_ARGUMENTS,[
611 APACHE_SUBST_EXPANDED_ARG(exec_prefix)
612 APACHE_SUBST_EXPANDED_ARG(bindir)
613 APACHE_SUBST_EXPANDED_ARG(sbindir)
614 APACHE_SUBST_EXPANDED_ARG(libdir)
615 APACHE_SUBST_EXPANDED_ARG(libexecdir)
616 APACHE_SUBST_EXPANDED_ARG(mandir)
617 APACHE_SUBST_EXPANDED_ARG(sysconfdir)
618 APACHE_SUBST_EXPANDED_ARG(datadir)
619 APACHE_SUBST_EXPANDED_ARG(installbuilddir)
620 APACHE_SUBST_EXPANDED_ARG(errordir)
621 APACHE_SUBST_EXPANDED_ARG(iconsdir)
622 APACHE_SUBST_EXPANDED_ARG(htdocsdir)
623 APACHE_SUBST_EXPANDED_ARG(manualdir)
624 APACHE_SUBST_EXPANDED_ARG(cgidir)
625 APACHE_SUBST_EXPANDED_ARG(includedir)
626 APACHE_SUBST_EXPANDED_ARG(localstatedir)
627 APACHE_SUBST_EXPANDED_ARG(runtimedir)
628 APACHE_SUBST_EXPANDED_ARG(logfiledir)
629 APACHE_SUBST_EXPANDED_ARG(proxycachedir)
633 dnl APACHE_CHECK_APxVER({apr|apu}, major, minor,
634 dnl [actions-if-ok], [actions-if-not-ok])
636 dnl Checks for APR or APR-util of given major/minor version or later;
637 dnl if so, runs actions-if-ok; otherwise runs actions-if-not-ok if given.
638 dnl If the version is not satisfactory and actions-if-not-ok is not
639 dnl given, then an error is printed and the configure script is aborted.
641 dnl The first argument must be [apr] or [apu].
643 AC_DEFUN([APACHE_CHECK_APxVER], [
644 define(ap_ckver_major, translit($1, [apru], [APRU])[_MAJOR_VERSION])
645 define(ap_ckver_minor, translit($1, [apru], [APRU])[_MINOR_VERSION])
646 define(ap_ckver_cvar, [ap_cv_$1ver$2$3])
647 define(ap_ckver_name, ifelse([$1],[apr],[APR],[APR-util]))
649 ap_ckver_CPPFLAGS="$CPPFLAGS"
650 CPPFLAGS="$CPPFLAGS `$[$1]_config --includes`"
652 AC_CACHE_CHECK([for ap_ckver_name version $2.$3.0 or later], ap_ckver_cvar, [
653 AC_EGREP_CPP([good], [
654 #include <$1_version.h>
655 #if ]ap_ckver_major[ > $2 || (]ap_ckver_major[ == $2 && ]ap_ckver_minor[ >= $3)
658 ], [ap_ckver_cvar=yes], [ap_ckver_cvar=no])])
660 if test "$ap_ckver_cvar" = "yes"; then
661 ifelse([$4],[],[:],[$4])
663 ifelse([$5],[],[AC_MSG_ERROR([ap_ckver_name version $2.$3.0 or later is required])], [$5])
666 CPPFLAGS="$ap_ckver_CPPFLAGS"
668 undefine([ap_ckver_major])
669 undefine([ap_ckver_minor])
670 undefine([ap_ckver_cvar])
671 undefine([ap_ckver_name])
675 dnl APACHE_CHECK_VOID_PTR_LEN
677 dnl Checks if the size of a void pointer is at least as big as a "long"
680 AC_DEFUN([APACHE_CHECK_VOID_PTR_LEN], [
682 AC_CACHE_CHECK([for void pointer length], [ap_cv_void_ptr_lt_long],
686 return sizeof(void *) < sizeof(long);
687 }], [ap_cv_void_ptr_lt_long=no], [ap_cv_void_ptr_lt_long=yes],
688 [ap_cv_void_ptr_lt_long=yes])])
690 if test "$ap_cv_void_ptr_lt_long" = "yes"; then
691 AC_MSG_ERROR([Size of "void *" is less than size of "long"])
696 dnl APACHE_CHECK_APR_HAS_LDAP
698 dnl Check if APR_HAS_LDAP is 1
699 dnl Unfortunately, we can't use APR_CHECK_APR_DEFINE (because it only includes apr.h)
700 dnl or APR_CHECK_DEFINE (because it only checks for defined'ness and not for 0/1).
702 AC_DEFUN([APACHE_CHECK_APR_HAS_LDAP], [
703 AC_CACHE_CHECK([for ldap support in apr/apr-util],ac_cv_APR_HAS_LDAP,[
704 apache_old_cppflags="$CPPFLAGS"
705 CPPFLAGS="$CPPFLAGS $INCLUDES"
706 AC_EGREP_CPP(YES_IS_DEFINED, [
707 #include <apr_ldap.h>
711 ], ac_cv_APR_HAS_LDAP=yes, ac_cv_APR_HAS_LDAP=no)
712 CPPFLAGS="$apache_old_cppflags"
717 dnl APACHE_ADD_GCC_CFLAGS
719 dnl Check if compiler is gcc and supports flag. If yes, add to CFLAGS.
721 AC_DEFUN([APACHE_ADD_GCC_CFLAG], [
722 define([ap_gcc_ckvar], [ac_cv_gcc_]translit($1, [-:.=], [____]))
723 if test "$GCC" = "yes"; then
724 AC_CACHE_CHECK([whether gcc accepts $1], ap_gcc_ckvar, [
725 save_CFLAGS="$CFLAGS"
727 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo() { return 0; }])],
728 [ap_gcc_ckvar=yes], [ap_gcc_ckvar=no])
729 CFLAGS="$save_CFLAGS"
731 if test "$]ap_gcc_ckvar[" = "yes" ; then
732 APR_ADDTO(CFLAGS,[$1])
735 undefine([ap_gcc_ckvar])