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(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
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, [
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
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])
147 dnl APACHE_MODPATH_INIT(modpath)
148 AC_DEFUN(APACHE_MODPATH_INIT,[
150 modpath_current=modules/$1
153 test -d $1 || $srcdir/build/mkdir.sh $modpath_current
154 > $modpath_current/modules.mk
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"
164 MODULE_CLEANDIRS="$MODULE_CLEANDIRS $current_dir"
166 APACHE_FAST_OUTPUT($modpath_current/Makefile)
169 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
170 AC_DEFUN(APACHE_MODPATH_ADD,[
171 if test -z "$3"; then
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
185 \$(MOD_LINK) $objects $5
187 if test ! -z "$5"; then
188 APR_ADDTO(AP_LIBS, [$5])
191 apache_need_shared=yes
193 shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
194 modpath_shared="$modpath_shared $libname"
195 cat >>$modpath_current/modules.mk<<EOF
197 \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
204 dnl APACHE_MPM_MODULE(name[, shared[, objects[, config[, path[, libs]]]]])
206 dnl Provide information for building the MPM. (Enablement is handled using
207 dnl --with-mpm/--enable-mpms-shared.)
209 dnl name -- name of MPM, same as MPM directory name
210 dnl shared -- "shared" to indicate shared module build, empty string otherwise
211 dnl objects -- one or more .lo files to link into the MPM module (default: mpmname.lo)
212 dnl config -- configuration logic to run if the MPM is enabled
213 dnl path -- relative path to MPM (default: server/mpm/mpmname)
214 dnl libs -- libs needed by this MPM
216 AC_DEFUN(APACHE_MPM_MODULE,[
217 if ap_mpm_is_enabled $1; then
218 if test -z "$3"; then
224 if test -z "$5"; then
225 mpmpath="server/mpm/$1"
231 test -d $mpmpath || $srcdir/build/mkdir.sh $mpmpath
233 APACHE_FAST_OUTPUT($mpmpath/Makefile)
235 if test -z "$2"; then
236 APR_ADDTO(AP_LIBS, [$6])
238 cat >$mpmpath/modules.mk<<EOF
240 \$(MOD_LINK) $objects
241 DISTCLEAN_TARGETS = modules.mk
246 apache_need_shared=yes
247 libname="mod_mpm_$1.la"
248 shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
249 cat >$mpmpath/modules.mk<<EOF
251 \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $objects $6
252 DISTCLEAN_TARGETS = modules.mk
256 # add default MPM to LoadModule list
257 if test $1 = $default_mpm; then
258 DSO_MODULES="$DSO_MODULES mpm_$1"
259 ENABLED_DSO_MODULES="$ENABLED_DSO_MODULES mpm_$1"
267 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
269 dnl default is one of:
270 dnl yes -- enabled by default. user must explicitly disable.
271 dnl no -- disabled under default, most, all. user must explicitly enable.
272 dnl most -- disabled by default. enabled explicitly or with most or all.
273 dnl static -- enabled as static by default, must be explicitly changed.
274 dnl "" -- disabled under default, most. enabled explicitly or with all.
275 dnl XXX: The arg must really be empty here. Passing an empty shell
276 dnl XXX: variable doesn't work for some reason. This should be
279 dnl basically: yes/no is a hard setting. "most" means follow the "most"
280 dnl setting. otherwise, fall under the "all" setting.
281 dnl explicit yes/no always overrides, except if the user selects
284 AC_DEFUN(APACHE_MODULE,[
285 AC_MSG_CHECKING(whether to enable mod_$1)
286 define([optname],[--]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
287 AC_ARG_ENABLE(translit($1,_,-),APACHE_HELP_STRING(optname(),$2),force_$1=$enableval,enable_$1=ifelse($5,,maybe-all,$5))
288 undefine([optname])dnl
290 dnl When --enable-modules=most or --enable-modules=(really)all is set and the
291 dnl module was not explicitly requested, allow a module to disable itself if
292 dnl its pre-reqs fail.
295 _apmod_required="yes"
298 case "$module_selection" in
303 _apmod_required="yes"
307 if test "$enable_$1" = "static"; then
309 elif test "$enable_$1" = "yes"; then
310 enable_$1=$module_default
311 elif test "$enable_$1" = "most"; then
312 if test "$module_selection" = "most" -o "$module_selection" = "all" -o \
313 "$module_selection" = "reallyall"
315 enable_$1=$module_default
316 elif test "$module_selection" = "few" -o "$module_selection" = "none"; then
319 _apmod_extra_msg=" ($module_selection)"
320 elif test "$enable_$1" = "maybe-all"; then
321 if test "$module_selection" = "all" -o "$module_selection" = "reallyall"
323 enable_$1=$module_default
324 _apmod_extra_msg=" ($module_selection)"
328 elif test "$enable_$1" = "no" -a "$module_selection" = "reallyall" -a \
329 "$force_$1" != "no" ; then
330 enable_$1=$module_default
331 _apmod_extra_msg=" ($module_selection)"
333 if test "$enable_$1" != "no"; then
334 dnl If we plan to enable it, allow the module to run some autoconf magic
335 dnl that may disable it because of missing dependencies.
336 ifelse([$6],,:,[AC_MSG_RESULT([checking dependencies])
338 AC_MSG_CHECKING(whether to enable mod_$1)
339 if test "$enable_$1" = "no"; then
340 if test "$_apmod_required" = "no"; then
341 _apmod_extra_msg=" (disabled)"
343 AC_MSG_ERROR([mod_$1 has been requested but can not be built due to prerequisite failures])
347 AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
348 if test "$enable_$1" != "no"; then
351 MODLIST="$MODLIST ifelse($4,,$1,$4)"
352 if test "$1" = "so"; then
357 enable_$1=`echo $enable_$1|sed 's/shared,*//'`
360 DSO_MODULES="$DSO_MODULES $1"
361 if test "$_apmod_required" = "yes" ; then
362 ENABLED_DSO_MODULES="$ENABLED_DSO_MODULES $1"
366 define([modprefix], [MOD_]translit($1, [a-z-], [A-Z_]))
367 APACHE_MODPATH_ADD($1, $shared, $3,, [\$(]modprefix[_LDADD)])
368 APACHE_SUBST(modprefix[_LDADD])
369 undefine([modprefix])
374 dnl APACHE_ENABLE_MODULES
376 AC_DEFUN(APACHE_ENABLE_MODULES,[
377 module_selection=most
378 module_default=shared
380 dnl Check whether we have DSO support.
381 dnl If "yes", we build shared modules by default.
382 APR_CHECK_APR_DEFINE(APR_HAS_DSO)
384 if test $ac_cv_define_APR_HAS_DSO = "no"; then
385 AC_MSG_WARN([Missing DSO support - building static modules by default.])
386 module_default=static
390 AC_ARG_ENABLE(modules,
391 APACHE_HELP_STRING(--enable-modules=MODULE-LIST,Space-separated list of modules to enable | "all" | "most" | "few" | "none" | "reallyall"),[
392 if test "$enableval" = "none"; then
394 module_selection=none
396 for i in $enableval; do
397 if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"
401 i=`echo $i | sed 's/-/_/g'`
402 eval "enable_$i=shared"
408 AC_ARG_ENABLE(mods-shared,
409 APACHE_HELP_STRING(--enable-mods-shared=MODULE-LIST,Space-separated list of shared modules to enable | "all" | "most" | "few" | "reallyall"),[
410 for i in $enableval; do
411 if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"
414 module_default=shared
416 i=`echo $i | sed 's/-/_/g'`
417 eval "enable_$i=shared"
422 AC_ARG_ENABLE(mods-static,
423 APACHE_HELP_STRING(--enable-mods-static=MODULE-LIST,Space-separated list of static modules to enable | "all" | "most" | "few" | "reallyall"),[
424 for i in $enableval; do
425 if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"; then
427 module_default=static
429 i=`echo $i | sed 's/-/_/g'`
430 eval "enable_$i=static"
436 AC_DEFUN(APACHE_REQUIRE_CXX,[
437 if test -z "$apache_cxx_done"; then
445 dnl APACHE_CHECK_OPENSSL
447 dnl Configure for OpenSSL, giving preference to
448 dnl "--with-ssl=<path>" if it was specified.
450 AC_DEFUN(APACHE_CHECK_OPENSSL,[
451 AC_CACHE_CHECK([for OpenSSL], [ac_cv_openssl], [
452 dnl initialise the variables we use
458 dnl Determine the OpenSSL base directory, if any
459 AC_MSG_CHECKING([for user-provided OpenSSL base directory])
460 AC_ARG_WITH(ssl, APACHE_HELP_STRING(--with-ssl=DIR,OpenSSL base directory), [
461 dnl If --with-ssl specifies a directory, we use that directory
462 if test "x$withval" != "xyes" -a "x$withval" != "x"; then
463 dnl This ensures $withval is actually a directory and that it is absolute
464 ap_openssl_base="`cd $withval ; pwd`"
467 if test "x$ap_openssl_base" = "x"; then
470 AC_MSG_RESULT($ap_openssl_base)
473 dnl Run header and version checks
474 saved_CPPFLAGS="$CPPFLAGS"
476 saved_LDFLAGS="$LDFLAGS"
479 dnl Before doing anything else, load in pkg-config variables
480 if test -n "$PKGCONFIG"; then
481 saved_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
482 if test "x$ap_openssl_base" != "x" -a \
483 -f "${ap_openssl_base}/lib/pkgconfig/openssl.pc"; then
484 dnl Ensure that the given path is used by pkg-config too, otherwise
485 dnl the system openssl.pc might be picked up instead.
486 PKG_CONFIG_PATH="${ap_openssl_base}/lib/pkgconfig${PKG_CONFIG_PATH+:}${PKG_CONFIG_PATH}"
487 export PKG_CONFIG_PATH
489 ap_openssl_libs="`$PKGCONFIG --libs-only-l openssl 2>&1`"
490 if test $? -eq 0; then
491 ap_openssl_found="yes"
492 pkglookup="`$PKGCONFIG --cflags-only-I openssl`"
493 APR_ADDTO(CPPFLAGS, [$pkglookup])
494 APR_ADDTO(INCLUDES, [$pkglookup])
495 pkglookup="`$PKGCONFIG --libs-only-L --libs-only-other openssl`"
496 APR_ADDTO(LDFLAGS, [$pkglookup])
497 APR_ADDTO(SSL_LIBS, [$pkglookup])
499 PKG_CONFIG_PATH="$saved_PKG_CONFIG_PATH"
502 dnl fall back to the user-supplied directory if not found via pkg-config
503 if test "x$ap_openssl_base" != "x" -a "x$ap_openssl_found" = "x"; then
504 APR_ADDTO(CPPFLAGS, [-I$ap_openssl_base/include])
505 APR_ADDTO(INCLUDES, [-I$ap_openssl_base/include])
506 APR_ADDTO(LDFLAGS, [-L$ap_openssl_base/lib])
507 APR_ADDTO(SSL_LIBS, [-L$ap_openssl_base/lib])
508 if test "x$ap_platform_runtime_link_flag" != "x"; then
509 APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_openssl_base/lib])
510 APR_ADDTO(SSL_LIBS, [$ap_platform_runtime_link_flag$ap_openssl_base/lib])
514 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
515 AC_TRY_COMPILE([#include <openssl/opensslv.h>],[
516 #if !defined(OPENSSL_VERSION_NUMBER)
517 #error "Missing OpenSSL version"
519 #if OPENSSL_VERSION_NUMBER < 0x0090700f
520 #error "Unsupported OpenSSL version " OPENSSL_VERSION_TEXT
524 [AC_MSG_RESULT(FAILED)])
526 if test "x$ac_cv_openssl" = "xyes"; then
527 ap_openssl_libs="-lssl -lcrypto `$apr_config --libs`"
528 APR_ADDTO(SSL_LIBS, [$ap_openssl_libs])
529 APR_ADDTO(LIBS, [$ap_openssl_libs])
530 APACHE_SUBST(SSL_LIBS)
532 dnl Run library and function checks
534 AC_CHECK_HEADERS([openssl/engine.h])
535 AC_CHECK_FUNCS([SSLeay_version SSL_CTX_new], [], [liberrors="yes"])
536 AC_CHECK_FUNCS([ENGINE_init ENGINE_load_builtin_engines])
537 if test "x$liberrors" != "x"; then
538 AC_MSG_WARN([OpenSSL libraries are unusable])
541 AC_MSG_WARN([OpenSSL version is too old])
545 CPPFLAGS="$saved_CPPFLAGS"
547 LDFLAGS="$saved_LDFLAGS"
549 if test "x$ac_cv_openssl" = "xyes"; then
550 AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL is available])
555 dnl APACHE_CHECK_SERF
557 dnl Configure for the detected libserf, giving preference to
558 dnl "--with-serf=<path>" if it was specified.
560 AC_DEFUN([APACHE_CHECK_SERF], [
561 AC_CACHE_CHECK([for libserf], [ac_cv_serf], [
565 AC_ARG_WITH(serf, APACHE_HELP_STRING([--with-serf=PREFIX],
566 [Serf client library]),
568 if test "$withval" = "yes" ; then
575 if test "$serf_prefix" != "no" ; then
576 save_cppflags="$CPPFLAGS"
577 CPPFLAGS="$CPPFLAGS $APR_INCLUDES $APU_INCLUDES -I$serf_prefix/include/serf-0"
578 AC_CHECK_HEADERS(serf.h,[
579 save_ldflags="$LDFLAGS"
580 LDFLAGS="$LDFLAGS -L$serf_prefix/lib"
581 AC_CHECK_LIB(serf-0, serf_context_create,[ac_cv_serf="yes"])
582 LDFLAGS="$save_ldflags"])
583 CPPFLAGS="$save_cppflags"
587 APACHE_SUBST(SERF_LIBS)
588 if test "$ac_cv_serf" = "yes"; then
589 AC_DEFINE(HAVE_SERF, 1, [Define if libserf is available])
590 APR_SETVAR(SERF_LIBS, [-L$serf_prefix/lib -lserf-0])
591 APR_ADDTO(INCLUDES, [-I$serf_prefix/include/serf-0])
597 dnl APACHE_EXPORT_ARGUMENTS
598 dnl Export (via APACHE_SUBST) the various path-related variables that
599 dnl apache will use while generating scripts like autoconf and apxs and
600 dnl the default config file.
602 AC_DEFUN(APACHE_SUBST_EXPANDED_ARG,[
603 APR_EXPAND_VAR(exp_$1, [$]$1)
605 APR_PATH_RELATIVE(rel_$1, [$]exp_$1, ${prefix})
609 AC_DEFUN(APACHE_EXPORT_ARGUMENTS,[
610 APACHE_SUBST_EXPANDED_ARG(exec_prefix)
611 APACHE_SUBST_EXPANDED_ARG(bindir)
612 APACHE_SUBST_EXPANDED_ARG(sbindir)
613 APACHE_SUBST_EXPANDED_ARG(libdir)
614 APACHE_SUBST_EXPANDED_ARG(libexecdir)
615 APACHE_SUBST_EXPANDED_ARG(mandir)
616 APACHE_SUBST_EXPANDED_ARG(sysconfdir)
617 APACHE_SUBST_EXPANDED_ARG(datadir)
618 APACHE_SUBST_EXPANDED_ARG(installbuilddir)
619 APACHE_SUBST_EXPANDED_ARG(errordir)
620 APACHE_SUBST_EXPANDED_ARG(iconsdir)
621 APACHE_SUBST_EXPANDED_ARG(htdocsdir)
622 APACHE_SUBST_EXPANDED_ARG(manualdir)
623 APACHE_SUBST_EXPANDED_ARG(cgidir)
624 APACHE_SUBST_EXPANDED_ARG(includedir)
625 APACHE_SUBST_EXPANDED_ARG(localstatedir)
626 APACHE_SUBST_EXPANDED_ARG(runtimedir)
627 APACHE_SUBST_EXPANDED_ARG(logfiledir)
628 APACHE_SUBST_EXPANDED_ARG(proxycachedir)
632 dnl APACHE_CHECK_APxVER({apr|apu}, major, minor,
633 dnl [actions-if-ok], [actions-if-not-ok])
635 dnl Checks for APR or APR-util of given major/minor version or later;
636 dnl if so, runs actions-if-ok; otherwise runs actions-if-not-ok if given.
637 dnl If the version is not satisfactory and actions-if-not-ok is not
638 dnl given, then an error is printed and the configure script is aborted.
640 dnl The first argument must be [apr] or [apu].
642 AC_DEFUN([APACHE_CHECK_APxVER], [
643 define(ap_ckver_major, translit($1, [apru], [APRU])[_MAJOR_VERSION])
644 define(ap_ckver_minor, translit($1, [apru], [APRU])[_MINOR_VERSION])
645 define(ap_ckver_cvar, [ap_cv_$1ver$2$3])
646 define(ap_ckver_name, ifelse([$1],[apr],[APR],[APR-util]))
648 ap_ckver_CPPFLAGS="$CPPFLAGS"
649 CPPFLAGS="$CPPFLAGS `$[$1]_config --includes`"
651 AC_CACHE_CHECK([for ap_ckver_name version $2.$3.0 or later], ap_ckver_cvar, [
652 AC_EGREP_CPP([good], [
653 #include <$1_version.h>
654 #if ]ap_ckver_major[ > $2 || (]ap_ckver_major[ == $2 && ]ap_ckver_minor[ >= $3)
657 ], [ap_ckver_cvar=yes], [ap_ckver_cvar=no])])
659 if test "$ap_ckver_cvar" = "yes"; then
660 ifelse([$4],[],[:],[$4])
662 ifelse([$5],[],[AC_MSG_ERROR([ap_ckver_name version $2.$3.0 or later is required])], [$5])
665 CPPFLAGS="$ap_ckver_CPPFLAGS"
667 undefine([ap_ckver_major])
668 undefine([ap_ckver_minor])
669 undefine([ap_ckver_cvar])
670 undefine([ap_ckver_name])
674 dnl APACHE_CHECK_VOID_PTR_LEN
676 dnl Checks if the size of a void pointer is at least as big as a "long"
679 AC_DEFUN([APACHE_CHECK_VOID_PTR_LEN], [
681 AC_CACHE_CHECK([for void pointer length], [ap_cv_void_ptr_lt_long],
685 return sizeof(void *) < sizeof(long);
686 }], [ap_cv_void_ptr_lt_long=no], [ap_cv_void_ptr_lt_long=yes],
687 [ap_cv_void_ptr_lt_long=yes])])
689 if test "$ap_cv_void_ptr_lt_long" = "yes"; then
690 AC_MSG_ERROR([Size of "void *" is less than size of "long"])
695 dnl APACHE_CHECK_APR_HAS_LDAP
697 dnl Check if APR_HAS_LDAP is 1
698 dnl Unfortunately, we can't use APR_CHECK_APR_DEFINE (because it only includes apr.h)
699 dnl or APR_CHECK_DEFINE (because it only checks for defined'ness and not for 0/1).
701 AC_DEFUN([APACHE_CHECK_APR_HAS_LDAP], [
702 AC_CACHE_CHECK([for ldap support in apr/apr-util],ac_cv_APR_HAS_LDAP,[
703 apache_old_cppflags="$CPPFLAGS"
704 CPPFLAGS="$CPPFLAGS $INCLUDES"
705 AC_EGREP_CPP(YES_IS_DEFINED, [
706 #include <apr_ldap.h>
710 ], ac_cv_APR_HAS_LDAP=yes, ac_cv_APR_HAS_LDAP=no)
711 CPPFLAGS="$apache_old_cppflags"
716 dnl APACHE_ADD_GCC_CFLAGS
718 dnl Check if compiler is gcc and supports flag. If yes, add to CFLAGS.
720 AC_DEFUN([APACHE_ADD_GCC_CFLAG], [
721 define([ap_gcc_ckvar], [ac_cv_gcc_]translit($1, [-:.=], [____]))
722 if test "$GCC" = "yes"; then
723 AC_CACHE_CHECK([whether gcc accepts $1], ap_gcc_ckvar, [
724 save_CFLAGS="$CFLAGS"
726 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo() { return 0; }])],
727 [ap_gcc_ckvar=yes], [ap_gcc_ckvar=no])
728 CFLAGS="$save_CFLAGS"
730 if test "$]ap_gcc_ckvar[" = "yes" ; then
731 APR_ADDTO(CFLAGS,[$1])
734 undefine([ap_gcc_ckvar])