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)
102 APACHE_SUBST(APREQ_MAJOR_VERSION)
103 APACHE_SUBST(APREQ_LIBTOOL_VERSION)
105 abs_srcdir="`(cd $srcdir && pwd)`"
107 echo creating config_vars.mk
108 test -d build || $mkdir_p build
109 > build/config_vars.mk
110 for i in $APACHE_VAR_SUBST; do
111 eval echo "$i = \$$i" >> build/config_vars.mk
115 dnl APACHE_GEN_MAKEFILES
116 dnl Creates Makefiles
117 AC_DEFUN(APACHE_GEN_MAKEFILES,[
118 $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
121 dnl ## APACHE_OUTPUT(file)
122 dnl ## adds "file" to the list of files generated by AC_OUTPUT
123 dnl ## This macro can be used several times.
124 AC_DEFUN(APACHE_OUTPUT, [
125 APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
129 dnl APACHE_TYPE_RLIM_T
131 dnl If rlim_t is not defined, define it to int
133 AC_DEFUN(APACHE_TYPE_RLIM_T, [
134 AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
136 #include <sys/types.h>
137 #include <sys/time.h>
138 #include <sys/resource.h>
139 ], [rlim_t spoon;], [
140 ac_cv_type_rlim_t=yes
141 ],[ac_cv_type_rlim_t=no
144 if test "$ac_cv_type_rlim_t" = "no" ; then
145 AC_DEFINE(rlim_t, int,
146 [Define to 'int' if <sys/resource.h> doesn't define it for us])
150 dnl APACHE_MODPATH_INIT(modpath)
151 AC_DEFUN(APACHE_MODPATH_INIT,[
153 modpath_current=modules/$1
156 test -d $1 || $srcdir/build/mkdir.sh $modpath_current
157 > $modpath_current/modules.mk
160 AC_DEFUN(APACHE_MODPATH_FINISH,[
161 echo "DISTCLEAN_TARGETS = modules.mk" >> $modpath_current/modules.mk
162 echo "static = $modpath_static" >> $modpath_current/modules.mk
163 echo "shared = $modpath_shared" >> $modpath_current/modules.mk
164 if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
165 MODULE_DIRS="$MODULE_DIRS $current_dir"
167 MODULE_CLEANDIRS="$MODULE_CLEANDIRS $current_dir"
169 APACHE_FAST_OUTPUT($modpath_current/Makefile)
172 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
173 AC_DEFUN(APACHE_MODPATH_ADD,[
174 if test -z "$3"; then
180 if test -z "$module_standalone"; then
181 if test -z "$2"; then
182 # The filename of a convenience library must have a "lib" prefix:
183 libname="libmod_$1.la"
184 BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
185 modpath_static="$modpath_static $libname"
186 cat >>$modpath_current/modules.mk<<EOF
188 \$(MOD_LINK) $objects $5
190 if test ! -z "$5"; then
191 APR_ADDTO(AP_LIBS, [$5])
194 apache_need_shared=yes
196 shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
197 modpath_shared="$modpath_shared $libname"
198 cat >>$modpath_current/modules.mk<<EOF
200 \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
207 dnl APACHE_MPM_MODULE(name[, shared[, objects[, config[, path[, libs]]]]])
209 dnl Provide information for building the MPM. (Enablement is handled using
210 dnl --with-mpm/--enable-mpms-shared.)
212 dnl name -- name of MPM, same as MPM directory name
213 dnl shared -- "shared" to indicate shared module build, empty string otherwise
214 dnl objects -- one or more .lo files to link into the MPM module (default: mpmname.lo)
215 dnl config -- configuration logic to run if the MPM is enabled
216 dnl path -- relative path to MPM (default: server/mpm/mpmname)
217 dnl libs -- libs needed by this MPM
219 AC_DEFUN(APACHE_MPM_MODULE,[
220 if ap_mpm_is_enabled $1; then
221 if test -z "$3"; then
227 if test -z "$5"; then
228 mpmpath="server/mpm/$1"
234 test -d $mpmpath || $srcdir/build/mkdir.sh $mpmpath
236 APACHE_FAST_OUTPUT($mpmpath/Makefile)
238 if test -z "$2"; then
239 APR_ADDTO(AP_LIBS, [$6])
241 cat >$mpmpath/modules.mk<<EOF
243 \$(MOD_LINK) $objects
244 DISTCLEAN_TARGETS = modules.mk
249 apache_need_shared=yes
250 libname="mod_mpm_$1.la"
251 shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
252 cat >$mpmpath/modules.mk<<EOF
254 \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $objects $6
255 DISTCLEAN_TARGETS = modules.mk
259 # add default MPM to LoadModule list
260 if test $1 = $default_mpm; then
261 DSO_MODULES="$DSO_MODULES mpm_$1"
262 ENABLED_DSO_MODULES="${ENABLED_DSO_MODULES},mpm_$1"
270 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
272 dnl default is one of:
273 dnl yes -- enabled by default. user must explicitly disable.
274 dnl no -- disabled under default, most, all. user must explicitly enable.
275 dnl most -- disabled by default. enabled explicitly or with most or all.
276 dnl static -- enabled as static by default, must be explicitly changed.
277 dnl "" -- disabled under default, most. enabled explicitly or with all.
278 dnl XXX: The arg must really be empty here. Passing an empty shell
279 dnl XXX: variable doesn't work for some reason. This should be
282 dnl basically: yes/no is a hard setting. "most" means follow the "most"
283 dnl setting. otherwise, fall under the "all" setting.
284 dnl explicit yes/no always overrides, except if the user selects
287 AC_DEFUN(APACHE_MODULE,[
288 AC_MSG_CHECKING(whether to enable mod_$1)
289 define([optname],[--]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
290 AC_ARG_ENABLE(translit($1,_,-),APACHE_HELP_STRING(optname(),$2),force_$1=$enableval,enable_$1=ifelse($5,,maybe-all,$5))
291 undefine([optname])dnl
293 dnl When --enable-modules=most or --enable-modules=(really)all is set and the
294 dnl module was not explicitly requested, allow a module to disable itself if
295 dnl its pre-reqs fail.
298 _apmod_required="yes"
301 case "$module_selection" in
306 _apmod_required="yes"
310 if test "$enable_$1" = "static"; then
312 elif test "$enable_$1" = "yes"; then
313 enable_$1=$module_default
314 elif test "$enable_$1" = "most"; then
315 if test "$module_selection" = "most" -o "$module_selection" = "all" -o \
316 "$module_selection" = "reallyall"
318 enable_$1=$module_default
319 elif test "$module_selection" = "few" -o "$module_selection" = "none"; then
322 _apmod_extra_msg=" ($module_selection)"
323 elif test "$enable_$1" = "maybe-all"; then
324 if test "$module_selection" = "all" -o "$module_selection" = "reallyall"
326 enable_$1=$module_default
327 _apmod_extra_msg=" ($module_selection)"
331 elif test "$enable_$1" = "no" -a "$module_selection" = "reallyall" -a \
332 "$force_$1" != "no" ; then
333 enable_$1=$module_default
334 _apmod_extra_msg=" ($module_selection)"
336 if test "$enable_$1" != "no"; then
337 dnl If we plan to enable it, allow the module to run some autoconf magic
338 dnl that may disable it because of missing dependencies.
339 ifelse([$6],,:,[AC_MSG_RESULT([checking dependencies])
341 AC_MSG_CHECKING(whether to enable mod_$1)
342 if test "$enable_$1" = "no"; then
343 if test "$_apmod_required" = "no"; then
344 _apmod_extra_msg=" (disabled)"
346 AC_MSG_ERROR([mod_$1 has been requested but can not be built due to prerequisite failures])
350 AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
351 if test "$enable_$1" != "no"; then
354 MODLIST="$MODLIST ifelse($4,,$1,$4)"
355 if test "$1" = "so"; then
360 enable_$1=`echo $enable_$1|sed 's/shared,*//'`
363 DSO_MODULES="$DSO_MODULES $1"
364 if test "$5" = "yes" ; then
365 ENABLED_DSO_MODULES="${ENABLED_DSO_MODULES},$1"
369 define([modprefix], [MOD_]translit($1, [a-z-], [A-Z_]))
370 APACHE_MODPATH_ADD($1, $shared, $3,, [\$(]modprefix[_LDADD)])
371 APACHE_SUBST(modprefix[_LDADD])
372 undefine([modprefix])
377 dnl APACHE_ENABLE_MODULES
379 AC_DEFUN(APACHE_ENABLE_MODULES,[
380 module_selection=most
381 module_default=shared
383 dnl Check whether we have DSO support.
384 dnl If "yes", we build shared modules by default.
385 APR_CHECK_APR_DEFINE(APR_HAS_DSO)
387 if test $ac_cv_define_APR_HAS_DSO = "no"; then
388 AC_MSG_WARN([Missing DSO support - building static modules by default.])
389 module_default=static
393 AC_ARG_ENABLE(modules,
394 APACHE_HELP_STRING(--enable-modules=MODULE-LIST,Space-separated list of modules to enable | "all" | "most" | "few" | "none" | "reallyall"),[
395 if test "$enableval" = "none"; then
397 module_selection=none
399 for i in $enableval; do
400 if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"
404 i=`echo $i | sed 's/-/_/g'`
405 eval "enable_$i=shared"
411 AC_ARG_ENABLE(mods-shared,
412 APACHE_HELP_STRING(--enable-mods-shared=MODULE-LIST,Space-separated list of shared modules to enable | "all" | "most" | "few" | "reallyall"),[
413 for i in $enableval; do
414 if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"
417 module_default=shared
419 i=`echo $i | sed 's/-/_/g'`
420 eval "enable_$i=shared"
425 AC_ARG_ENABLE(mods-static,
426 APACHE_HELP_STRING(--enable-mods-static=MODULE-LIST,Space-separated list of static modules to enable | "all" | "most" | "few" | "reallyall"),[
427 for i in $enableval; do
428 if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"; then
430 module_default=static
432 i=`echo $i | sed 's/-/_/g'`
433 eval "enable_$i=static"
439 AC_DEFUN(APACHE_REQUIRE_CXX,[
440 if test -z "$apache_cxx_done"; then
448 dnl APACHE_CHECK_OPENSSL
450 dnl Configure for OpenSSL, giving preference to
451 dnl "--with-ssl=<path>" if it was specified.
453 AC_DEFUN(APACHE_CHECK_OPENSSL,[
454 AC_CACHE_CHECK([for OpenSSL], [ac_cv_openssl], [
455 dnl initialise the variables we use
461 dnl Determine the OpenSSL base directory, if any
462 AC_MSG_CHECKING([for user-provided OpenSSL base directory])
463 AC_ARG_WITH(ssl, APACHE_HELP_STRING(--with-ssl=DIR,OpenSSL base directory), [
464 dnl If --with-ssl specifies a directory, we use that directory
465 if test "x$withval" != "xyes" -a "x$withval" != "x"; then
466 dnl This ensures $withval is actually a directory and that it is absolute
467 ap_openssl_base="`cd $withval ; pwd`"
470 if test "x$ap_openssl_base" = "x"; then
473 AC_MSG_RESULT($ap_openssl_base)
476 dnl Run header and version checks
477 saved_CPPFLAGS="$CPPFLAGS"
479 saved_LDFLAGS="$LDFLAGS"
482 dnl Before doing anything else, load in pkg-config variables
483 if test -n "$PKGCONFIG"; then
484 saved_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
485 if test "x$ap_openssl_base" != "x" -a \
486 -f "${ap_openssl_base}/lib/pkgconfig/openssl.pc"; then
487 dnl Ensure that the given path is used by pkg-config too, otherwise
488 dnl the system openssl.pc might be picked up instead.
489 PKG_CONFIG_PATH="${ap_openssl_base}/lib/pkgconfig${PKG_CONFIG_PATH+:}${PKG_CONFIG_PATH}"
490 export PKG_CONFIG_PATH
492 ap_openssl_libs="`$PKGCONFIG --libs-only-l openssl 2>&1`"
493 if test $? -eq 0; then
494 ap_openssl_found="yes"
495 pkglookup="`$PKGCONFIG --cflags-only-I openssl`"
496 APR_ADDTO(CPPFLAGS, [$pkglookup])
497 APR_ADDTO(INCLUDES, [$pkglookup])
498 pkglookup="`$PKGCONFIG --libs-only-L --libs-only-other openssl`"
499 APR_ADDTO(LDFLAGS, [$pkglookup])
500 APR_ADDTO(SSL_LIBS, [$pkglookup])
502 PKG_CONFIG_PATH="$saved_PKG_CONFIG_PATH"
505 dnl fall back to the user-supplied directory if not found via pkg-config
506 if test "x$ap_openssl_base" != "x" -a "x$ap_openssl_found" = "x"; then
507 APR_ADDTO(CPPFLAGS, [-I$ap_openssl_base/include])
508 APR_ADDTO(INCLUDES, [-I$ap_openssl_base/include])
509 APR_ADDTO(LDFLAGS, [-L$ap_openssl_base/lib])
510 APR_ADDTO(SSL_LIBS, [-L$ap_openssl_base/lib])
511 if test "x$ap_platform_runtime_link_flag" != "x"; then
512 APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_openssl_base/lib])
513 APR_ADDTO(SSL_LIBS, [$ap_platform_runtime_link_flag$ap_openssl_base/lib])
517 AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
518 AC_TRY_COMPILE([#include <openssl/opensslv.h>],[
519 #if !defined(OPENSSL_VERSION_NUMBER)
520 #error "Missing OpenSSL version"
522 #if OPENSSL_VERSION_NUMBER < 0x0090700f
523 #error "Unsupported OpenSSL version " OPENSSL_VERSION_TEXT
527 [AC_MSG_RESULT(FAILED)])
529 if test "x$ac_cv_openssl" = "xyes"; then
530 ap_openssl_libs="-lssl -lcrypto `$apr_config --libs`"
531 APR_ADDTO(SSL_LIBS, [$ap_openssl_libs])
532 APR_ADDTO(LIBS, [$ap_openssl_libs])
533 APACHE_SUBST(SSL_LIBS)
535 dnl Run library and function checks
537 AC_CHECK_HEADERS([openssl/engine.h])
538 AC_CHECK_FUNCS([SSLeay_version SSL_CTX_new], [], [liberrors="yes"])
539 AC_CHECK_FUNCS([ENGINE_init ENGINE_load_builtin_engines])
540 if test "x$liberrors" != "x"; then
541 AC_MSG_WARN([OpenSSL libraries are unusable])
544 AC_MSG_WARN([OpenSSL version is too old])
548 CPPFLAGS="$saved_CPPFLAGS"
550 LDFLAGS="$saved_LDFLAGS"
552 if test "x$ac_cv_openssl" = "xyes"; then
553 AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL is available])
558 dnl APACHE_CHECK_SERF
560 dnl Configure for the detected libserf, giving preference to
561 dnl "--with-serf=<path>" if it was specified.
563 AC_DEFUN([APACHE_CHECK_SERF], [
564 AC_CACHE_CHECK([for libserf], [ac_cv_serf], [
568 AC_ARG_WITH(serf, APACHE_HELP_STRING([--with-serf=PREFIX],
569 [Serf client library]),
571 if test "$withval" = "yes" ; then
578 if test "$serf_prefix" != "no" ; then
579 save_cppflags="$CPPFLAGS"
580 CPPFLAGS="$CPPFLAGS $APR_INCLUDES $APU_INCLUDES -I$serf_prefix/include/serf-0"
581 AC_CHECK_HEADERS(serf.h,[
582 save_ldflags="$LDFLAGS"
583 LDFLAGS="$LDFLAGS -L$serf_prefix/lib"
584 AC_CHECK_LIB(serf-0, serf_context_create,[ac_cv_serf="yes"])
585 LDFLAGS="$save_ldflags"])
586 CPPFLAGS="$save_cppflags"
590 APACHE_SUBST(SERF_LIBS)
591 if test "$ac_cv_serf" = "yes"; then
592 AC_DEFINE(HAVE_SERF, 1, [Define if libserf is available])
593 APR_SETVAR(SERF_LIBS, [-L$serf_prefix/lib -lserf-0])
594 APR_ADDTO(INCLUDES, [-I$serf_prefix/include/serf-0])
600 dnl APACHE_EXPORT_ARGUMENTS
601 dnl Export (via APACHE_SUBST) the various path-related variables that
602 dnl apache will use while generating scripts like autoconf and apxs and
603 dnl the default config file.
605 AC_DEFUN(APACHE_SUBST_EXPANDED_ARG,[
606 APR_EXPAND_VAR(exp_$1, [$]$1)
608 APR_PATH_RELATIVE(rel_$1, [$]exp_$1, ${prefix})
612 AC_DEFUN(APACHE_EXPORT_ARGUMENTS,[
613 APACHE_SUBST_EXPANDED_ARG(exec_prefix)
614 APACHE_SUBST_EXPANDED_ARG(bindir)
615 APACHE_SUBST_EXPANDED_ARG(sbindir)
616 APACHE_SUBST_EXPANDED_ARG(libdir)
617 APACHE_SUBST_EXPANDED_ARG(libexecdir)
618 APACHE_SUBST_EXPANDED_ARG(mandir)
619 APACHE_SUBST_EXPANDED_ARG(sysconfdir)
620 APACHE_SUBST_EXPANDED_ARG(datadir)
621 APACHE_SUBST_EXPANDED_ARG(installbuilddir)
622 APACHE_SUBST_EXPANDED_ARG(errordir)
623 APACHE_SUBST_EXPANDED_ARG(iconsdir)
624 APACHE_SUBST_EXPANDED_ARG(htdocsdir)
625 APACHE_SUBST_EXPANDED_ARG(manualdir)
626 APACHE_SUBST_EXPANDED_ARG(cgidir)
627 APACHE_SUBST_EXPANDED_ARG(includedir)
628 APACHE_SUBST_EXPANDED_ARG(localstatedir)
629 APACHE_SUBST_EXPANDED_ARG(runtimedir)
630 APACHE_SUBST_EXPANDED_ARG(logfiledir)
631 APACHE_SUBST_EXPANDED_ARG(proxycachedir)
635 dnl APACHE_CHECK_APxVER({apr|apu}, major, minor,
636 dnl [actions-if-ok], [actions-if-not-ok])
638 dnl Checks for APR or APR-util of given major/minor version or later;
639 dnl if so, runs actions-if-ok; otherwise runs actions-if-not-ok if given.
640 dnl If the version is not satisfactory and actions-if-not-ok is not
641 dnl given, then an error is printed and the configure script is aborted.
643 dnl The first argument must be [apr] or [apu].
645 AC_DEFUN([APACHE_CHECK_APxVER], [
646 define(ap_ckver_major, translit($1, [apru], [APRU])[_MAJOR_VERSION])
647 define(ap_ckver_minor, translit($1, [apru], [APRU])[_MINOR_VERSION])
648 define(ap_ckver_cvar, [ap_cv_$1ver$2$3])
649 define(ap_ckver_name, ifelse([$1],[apr],[APR],[APR-util]))
651 ap_ckver_CPPFLAGS="$CPPFLAGS"
652 CPPFLAGS="$CPPFLAGS `$[$1]_config --includes`"
654 AC_CACHE_CHECK([for ap_ckver_name version $2.$3.0 or later], ap_ckver_cvar, [
655 AC_EGREP_CPP([good], [
656 #include <$1_version.h>
657 #if ]ap_ckver_major[ > $2 || (]ap_ckver_major[ == $2 && ]ap_ckver_minor[ >= $3)
660 ], [ap_ckver_cvar=yes], [ap_ckver_cvar=no])])
662 if test "$ap_ckver_cvar" = "yes"; then
663 ifelse([$4],[],[:],[$4])
665 ifelse([$5],[],[AC_MSG_ERROR([ap_ckver_name version $2.$3.0 or later is required])], [$5])
668 CPPFLAGS="$ap_ckver_CPPFLAGS"
670 undefine([ap_ckver_major])
671 undefine([ap_ckver_minor])
672 undefine([ap_ckver_cvar])
673 undefine([ap_ckver_name])
677 dnl APACHE_CHECK_VOID_PTR_LEN
679 dnl Checks if the size of a void pointer is at least as big as a "long"
682 AC_DEFUN([APACHE_CHECK_VOID_PTR_LEN], [
684 AC_CACHE_CHECK([for void pointer length], [ap_cv_void_ptr_lt_long],
688 return sizeof(void *) < sizeof(long);
689 }], [ap_cv_void_ptr_lt_long=no], [ap_cv_void_ptr_lt_long=yes],
690 [ap_cv_void_ptr_lt_long=yes])])
692 if test "$ap_cv_void_ptr_lt_long" = "yes"; then
693 AC_MSG_ERROR([Size of "void *" is less than size of "long"])
698 dnl APACHE_CHECK_APR_HAS_LDAP
700 dnl Check if APR_HAS_LDAP is 1
701 dnl Unfortunately, we can't use APR_CHECK_APR_DEFINE (because it only includes apr.h)
702 dnl or APR_CHECK_DEFINE (because it only checks for defined'ness and not for 0/1).
704 AC_DEFUN([APACHE_CHECK_APR_HAS_LDAP], [
705 AC_CACHE_CHECK([for ldap support in apr/apr-util],ac_cv_APR_HAS_LDAP,[
706 apache_old_cppflags="$CPPFLAGS"
707 CPPFLAGS="$CPPFLAGS $INCLUDES"
708 AC_EGREP_CPP(YES_IS_DEFINED, [
709 #include <apr_ldap.h>
713 ], ac_cv_APR_HAS_LDAP=yes, ac_cv_APR_HAS_LDAP=no)
714 CPPFLAGS="$apache_old_cppflags"
719 dnl APACHE_ADD_GCC_CFLAGS
721 dnl Check if compiler is gcc and supports flag. If yes, add to CFLAGS.
723 AC_DEFUN([APACHE_ADD_GCC_CFLAG], [
724 define([ap_gcc_ckvar], [ac_cv_gcc_]translit($1, [-:.=], [____]))
725 if test "$GCC" = "yes"; then
726 AC_CACHE_CHECK([whether gcc accepts $1], ap_gcc_ckvar, [
727 save_CFLAGS="$CFLAGS"
729 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo() { return 0; }])],
730 [ap_gcc_ckvar=yes], [ap_gcc_ckvar=no])
731 CFLAGS="$save_CFLAGS"
733 if test "$]ap_gcc_ckvar[" = "yes" ; then
734 APR_ADDTO(CFLAGS,[$1])
737 undefine([ap_gcc_ckvar])