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(davlockdb)
47 APACHE_SUBST(other_targets)
48 APACHE_SUBST(progname)
54 APACHE_SUBST(CPPFLAGS)
56 APACHE_SUBST(CXXFLAGS)
57 APACHE_SUBST(CC_FOR_BUILD)
58 APACHE_SUBST(CFLAGS_FOR_BUILD)
61 APACHE_SUBST(LT_LDFLAGS)
62 APACHE_SUBST(SH_LDFLAGS)
63 APACHE_SUBST(HTTPD_LDFLAGS)
64 APACHE_SUBST(UTIL_LDFLAGS)
67 APACHE_SUBST(INCLUDES)
68 APACHE_SUBST(NOTEST_CPPFLAGS)
69 APACHE_SUBST(NOTEST_CFLAGS)
70 APACHE_SUBST(NOTEST_CXXFLAGS)
71 APACHE_SUBST(NOTEST_LDFLAGS)
72 APACHE_SUBST(NOTEST_LIBS)
73 APACHE_SUBST(EXTRA_CPPFLAGS)
74 APACHE_SUBST(EXTRA_CFLAGS)
75 APACHE_SUBST(EXTRA_CXXFLAGS)
76 APACHE_SUBST(EXTRA_LDFLAGS)
77 APACHE_SUBST(EXTRA_LIBS)
78 APACHE_SUBST(EXTRA_INCLUDES)
79 APACHE_SUBST(INTERNAL_CPPFLAGS)
83 APACHE_SUBST(MODULE_DIRS)
84 APACHE_SUBST(MODULE_CLEANDIRS)
87 APACHE_SUBST(CORE_IMPLIB_FILE)
88 APACHE_SUBST(CORE_IMPLIB)
90 APACHE_SUBST(SH_LIBTOOL)
91 APACHE_SUBST(MK_IMPLIB)
93 APACHE_SUBST(INSTALL_PROG_FLAGS)
94 APACHE_SUBST(DSO_MODULES)
95 APACHE_SUBST(ENABLED_DSO_MODULES)
96 APACHE_SUBST(LOAD_ALL_MODULES)
97 APACHE_SUBST(APR_BINDIR)
98 APACHE_SUBST(APR_INCLUDEDIR)
99 APACHE_SUBST(APR_VERSION)
100 APACHE_SUBST(APR_CONFIG)
101 APACHE_SUBST(APU_BINDIR)
102 APACHE_SUBST(APU_INCLUDEDIR)
103 APACHE_SUBST(APU_VERSION)
104 APACHE_SUBST(APU_CONFIG)
105 APACHE_SUBST(APREQ_MAJOR_VERSION)
106 APACHE_SUBST(APREQ_LIBTOOL_VERSION)
108 abs_srcdir="`(cd $srcdir && pwd)`"
110 AC_MSG_NOTICE([creating config_vars.mk])
111 test -d build || $mkdir_p build
112 > build/config_vars.mk
113 for i in $APACHE_VAR_SUBST; do
114 eval echo "$i = \$$i" >> build/config_vars.mk
118 dnl APACHE_GEN_MAKEFILES
119 dnl Creates Makefiles
120 AC_DEFUN(APACHE_GEN_MAKEFILES,[
121 $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
124 dnl ## APACHE_OUTPUT(file)
125 dnl ## adds "file" to the list of files generated by AC_OUTPUT
126 dnl ## This macro can be used several times.
127 AC_DEFUN(APACHE_OUTPUT, [
128 APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
132 dnl APACHE_TYPE_RLIM_T
134 dnl If rlim_t is not defined, define it to int
136 AC_DEFUN(APACHE_TYPE_RLIM_T, [
137 AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
139 #include <sys/types.h>
140 #include <sys/time.h>
141 #include <sys/resource.h>
142 ], [rlim_t spoon;], [
143 ac_cv_type_rlim_t=yes
144 ],[ac_cv_type_rlim_t=no
147 if test "$ac_cv_type_rlim_t" = "no" ; then
148 AC_DEFINE(rlim_t, int,
149 [Define to 'int' if <sys/resource.h> doesn't define it for us])
153 dnl the list of build variables which are available for customization on a
154 dnl per module subdir basis (to be inserted into modules.mk with a "MOD_"
155 dnl prefix, i.e. MOD_CFLAGS etc.). Used in APACHE_MODPATH_{INIT,FINISH}.
156 define(mod_buildvars, [CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LIBS INCLUDES])
158 dnl APACHE_MODPATH_INIT(modpath)
159 AC_DEFUN(APACHE_MODPATH_INIT,[
161 modpath_current=modules/$1
164 for var in mod_buildvars; do
167 test -d $1 || $srcdir/build/mkdir.sh $modpath_current
168 > $modpath_current/modules.mk
171 AC_DEFUN(APACHE_MODPATH_FINISH,[
172 echo "DISTCLEAN_TARGETS = modules.mk" >> $modpath_current/modules.mk
173 echo "static = $modpath_static" >> $modpath_current/modules.mk
174 echo "shared = $modpath_shared" >> $modpath_current/modules.mk
175 for var in mod_buildvars; do
176 if eval val=\"\$MOD_$var\"; test -n "$val"; then
177 echo "MOD_$var = $val" >> $modpath_current/modules.mk
180 if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
181 MODULE_DIRS="$MODULE_DIRS $current_dir"
183 MODULE_CLEANDIRS="$MODULE_CLEANDIRS $current_dir"
185 APACHE_FAST_OUTPUT($modpath_current/Makefile)
188 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
189 AC_DEFUN(APACHE_MODPATH_ADD,[
190 if test -z "$3"; then
196 if test -z "$module_standalone"; then
197 if test -z "$2"; then
198 # The filename of a convenience library must have a "lib" prefix:
199 libname="libmod_$1.la"
200 BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
201 modpath_static="$modpath_static $libname"
202 cat >>$modpath_current/modules.mk<<EOF
204 \$(MOD_LINK) $objects $5
206 if test ! -z "$5"; then
207 APR_ADDTO(AP_LIBS, [$5])
210 apache_need_shared=yes
212 shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
213 modpath_shared="$modpath_shared $libname"
214 cat >>$modpath_current/modules.mk<<EOF
216 \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
221 dnl Same as APACHE_MODPATH_INIT/FINISH but for MPMs
222 dnl APACHE_MPMPATH_INIT(mpmpath)
223 AC_DEFUN(APACHE_MPMPATH_INIT,[
225 modpath_current=server/mpm/$1
228 for var in mod_buildvars; do
231 test -d $1 || $srcdir/build/mkdir.sh $modpath_current
232 > $modpath_current/modules.mk
235 AC_DEFUN(APACHE_MPMPATH_FINISH,[
236 for var in mod_buildvars; do
237 if eval val=\"\$MOD_$var\"; test -n "$val"; then
238 echo "MOD_$var = $val" >> $modpath_current/modules.mk
244 dnl APACHE_MPM_MODULE(name[, shared[, objects[, config[, path[, libs]]]]])
246 dnl Provide information for building the MPM. (Enablement is handled using
247 dnl --with-mpm/--enable-mpms-shared.)
249 dnl name -- name of MPM, same as MPM directory name
250 dnl shared -- "shared" to indicate shared module build, empty string otherwise
251 dnl objects -- one or more .lo files to link into the MPM module (default: mpmname.lo)
252 dnl config -- configuration logic to run if the MPM is enabled
253 dnl path -- relative path to MPM (default: server/mpm/mpmname)
254 dnl libs -- libs needed by this MPM
256 AC_DEFUN(APACHE_MPM_MODULE,[
257 if ap_mpm_is_enabled $1; then
258 if test -z "$3"; then
264 if test -z "$5"; then
265 mpmpath="server/mpm/$1"
271 test -d $mpmpath || $srcdir/build/mkdir.sh $mpmpath
273 APACHE_FAST_OUTPUT($mpmpath/Makefile)
275 if test -z "$2"; then
276 APR_ADDTO(AP_LIBS, [$6])
278 cat >>$mpmpath/modules.mk<<EOF
280 \$(MOD_LINK) $objects
281 DISTCLEAN_TARGETS = modules.mk
286 apache_need_shared=yes
287 libname="mod_mpm_$1.la"
288 shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
289 cat >>$mpmpath/modules.mk<<EOF
291 \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $objects $6
292 DISTCLEAN_TARGETS = modules.mk
296 DSO_MODULES="$DSO_MODULES mpm_$1"
297 # add default MPM to LoadModule list
298 if test $1 = $default_mpm; then
299 ENABLED_DSO_MODULES="${ENABLED_DSO_MODULES},mpm_$1"
307 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config[, prereq_module]]]]])
309 dnl default is one of:
310 dnl yes -- enabled by default. user must explicitly disable.
311 dnl no -- disabled under default, most, all. user must explicitly enable.
312 dnl most -- disabled by default. enabled explicitly or with most or all.
313 dnl static -- enabled as static by default, must be explicitly changed.
314 dnl "" -- disabled under default, most. enabled explicitly or with all.
315 dnl XXX: The arg must really be empty here. Passing an empty shell
316 dnl XXX: variable doesn't work for some reason. This should be
319 dnl basically: yes/no is a hard setting. "most" means follow the "most"
320 dnl setting. otherwise, fall under the "all" setting.
321 dnl explicit yes/no always overrides, except if the user selects
324 dnl prereq_module is a module (without the "mod_" prefix) that must be enabled
325 dnl if the current module is enabled. If the current module is built
326 dnl statically, prereq_module must be built statically, too. If these
327 dnl conditions are not fulfilled, configure will abort if the current module
328 dnl has been enabled explicitly. Otherwise, configure will disable the
330 dnl prereq_module's APACHE_MODULE() statement must have been processed
331 dnl before the current APACHE_MODULE() statement.
333 AC_DEFUN(APACHE_MODULE,[
334 AC_MSG_CHECKING(whether to enable mod_$1)
335 define([optname],[--]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
336 AC_ARG_ENABLE(translit($1,_,-),APACHE_HELP_STRING(optname(),$2),force_$1=$enableval,enable_$1=ifelse($5,,maybe-all,$5))
337 undefine([optname])dnl
339 dnl If the module was not explicitly requested, allow it to disable itself if
340 dnl its pre-reqs fail.
343 _apmod_required="yes"
349 if test "$enable_$1" = "static"; then
351 elif test "$enable_$1" = "yes"; then
352 enable_$1=$module_default
353 elif test "$enable_$1" = "most"; then
354 if test "$module_selection" = "most" -o "$module_selection" = "all" -o \
355 "$module_selection" = "reallyall"
357 enable_$1=$module_default
358 elif test "$module_selection" = "few" -o "$module_selection" = "none"; then
361 _apmod_extra_msg=" ($module_selection)"
362 elif test "$enable_$1" = "maybe-all"; then
363 if test "$module_selection" = "all" -o "$module_selection" = "reallyall"
365 enable_$1=$module_default
366 _apmod_extra_msg=" ($module_selection)"
370 elif test "$enable_$1" = "no" -a "$module_selection" = "reallyall" -a \
371 "$force_$1" != "no" ; then
372 enable_$1=$module_default
373 _apmod_extra_msg=" ($module_selection)"
375 if test "$enable_$1" != "no"; then
376 dnl If we plan to enable it, allow the module to run some autoconf magic
377 dnl that may disable it because of missing dependencies.
379 [AC_MSG_RESULT([checking dependencies])
380 ifelse([$7],,:,[if test "$enable_$7" = "no" ; then
382 AC_MSG_WARN("mod_$7 is disabled but required for mod_$1")
383 elif test "$enable_$1" = "static" && test "$enable_$7" != "static" ; then
385 AC_MSG_WARN("cannot build mod_$1 statically if mod_$7 is built shared")
387 ifelse([$6],,:,[ $6])
389 AC_MSG_CHECKING(whether to enable mod_$1)
390 if test "$enable_$1" = "no"; then
391 if test "$_apmod_required" = "no"; then
392 _apmod_extra_msg=" (disabled)"
394 AC_MSG_ERROR([mod_$1 has been requested but can not be built due to prerequisite failures])
398 AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
399 if test "$enable_$1" != "no"; then
402 MODLIST="$MODLIST ifelse($4,,$1,$4)"
403 if test "$1" = "so"; then
408 enable_$1=`echo $enable_$1|sed 's/shared,*//'`
411 DSO_MODULES="$DSO_MODULES $1"
412 if test "$5" = "yes" ; then
413 ENABLED_DSO_MODULES="${ENABLED_DSO_MODULES},$1"
417 define([modprefix], [MOD_]translit($1, [a-z-], [A-Z_]))
418 APACHE_MODPATH_ADD($1, $shared, $3,, [\$(]modprefix[_LDADD)])
419 APACHE_SUBST(modprefix[_LDADD])
420 undefine([modprefix])
425 dnl APACHE_ENABLE_MODULES
427 AC_DEFUN(APACHE_ENABLE_MODULES,[
428 module_selection=most
429 module_default=shared
431 dnl Check whether we have DSO support.
432 dnl If "yes", we build shared modules by default.
433 APR_CHECK_APR_DEFINE(APR_HAS_DSO)
435 if test $ac_cv_define_APR_HAS_DSO = "no"; then
436 AC_MSG_WARN([Missing DSO support - building static modules by default.])
437 module_default=static
441 AC_ARG_ENABLE(modules,
442 APACHE_HELP_STRING(--enable-modules=MODULE-LIST,Space-separated list of modules to enable | "all" | "most" | "few" | "none" | "reallyall"),[
443 if test "$enableval" = "none"; then
445 module_selection=none
447 for i in $enableval; do
448 if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"
452 i=`echo $i | sed 's/-/_/g'`
453 eval "enable_$i=shared"
459 AC_ARG_ENABLE(mods-shared,
460 APACHE_HELP_STRING(--enable-mods-shared=MODULE-LIST,Space-separated list of shared modules to enable | "all" | "most" | "few" | "reallyall"),[
461 for i in $enableval; do
462 if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"
465 module_default=shared
467 i=`echo $i | sed 's/-/_/g'`
468 eval "enable_$i=shared"
473 AC_ARG_ENABLE(mods-static,
474 APACHE_HELP_STRING(--enable-mods-static=MODULE-LIST,Space-separated list of static modules to enable | "all" | "most" | "few" | "reallyall"),[
475 for i in $enableval; do
476 if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"; then
478 module_default=static
480 i=`echo $i | sed 's/-/_/g'`
481 eval "enable_$i=static"
487 AC_DEFUN(APACHE_REQUIRE_CXX,[
488 if test -z "$apache_cxx_done"; then
496 dnl APACHE_CHECK_OPENSSL
498 dnl Configure for OpenSSL, giving preference to
499 dnl "--with-ssl=<path>" if it was specified.
501 AC_DEFUN(APACHE_CHECK_OPENSSL,[
502 AC_CACHE_CHECK([for OpenSSL], [ac_cv_openssl], [
503 dnl initialise the variables we use
509 dnl Determine the OpenSSL base directory, if any
510 AC_MSG_CHECKING([for user-provided OpenSSL base directory])
511 AC_ARG_WITH(ssl, APACHE_HELP_STRING(--with-ssl=PATH,OpenSSL installation directory), [
512 dnl If --with-ssl specifies a directory, we use that directory
513 if test "x$withval" != "xyes" -a "x$withval" != "x"; then
514 dnl This ensures $withval is actually a directory and that it is absolute
515 ap_openssl_base="`cd $withval ; pwd`"
518 if test "x$ap_openssl_base" = "x"; then
521 AC_MSG_RESULT($ap_openssl_base)
524 dnl Run header and version checks
525 saved_CPPFLAGS="$CPPFLAGS"
527 saved_LDFLAGS="$LDFLAGS"
529 dnl Before doing anything else, load in pkg-config variables
530 if test -n "$PKGCONFIG"; then
531 saved_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
532 if test "x$ap_openssl_base" != "x" -a \
533 -f "${ap_openssl_base}/lib/pkgconfig/openssl.pc"; then
534 dnl Ensure that the given path is used by pkg-config too, otherwise
535 dnl the system openssl.pc might be picked up instead.
536 PKG_CONFIG_PATH="${ap_openssl_base}/lib/pkgconfig${PKG_CONFIG_PATH+:}${PKG_CONFIG_PATH}"
537 export PKG_CONFIG_PATH
539 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.]), [
540 if test "$enableval" = "yes"; then
541 PKGCONFIG_LIBOPTS="--static"
544 ap_openssl_libs="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-l --silence-errors openssl`"
545 if test $? -eq 0; then
546 ap_openssl_found="yes"
547 pkglookup="`$PKGCONFIG --cflags-only-I openssl`"
548 APR_ADDTO(CPPFLAGS, [$pkglookup])
549 APR_ADDTO(MOD_CFLAGS, [$pkglookup])
550 APR_ADDTO(ab_CFLAGS, [$pkglookup])
551 pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-L openssl`"
552 APR_ADDTO(LDFLAGS, [$pkglookup])
553 APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
554 pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-other openssl`"
555 APR_ADDTO(LDFLAGS, [$pkglookup])
556 APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
558 PKG_CONFIG_PATH="$saved_PKG_CONFIG_PATH"
561 dnl fall back to the user-supplied directory if not found via pkg-config
562 if test "x$ap_openssl_base" != "x" -a "x$ap_openssl_found" = "x"; then
563 APR_ADDTO(CPPFLAGS, [-I$ap_openssl_base/include])
564 APR_ADDTO(MOD_CFLAGS, [-I$ap_openssl_base/include])
565 APR_ADDTO(ab_CFLAGS, [-I$ap_openssl_base/include])
566 APR_ADDTO(LDFLAGS, [-L$ap_openssl_base/lib])
567 APR_ADDTO(MOD_LDFLAGS, [-L$ap_openssl_base/lib])
568 if test "x$ap_platform_runtime_link_flag" != "x"; then
569 APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_openssl_base/lib])
570 APR_ADDTO(MOD_LDFLAGS, [$ap_platform_runtime_link_flag$ap_openssl_base/lib])
574 AC_MSG_CHECKING([for OpenSSL version >= 0.9.8a])
575 AC_TRY_COMPILE([#include <openssl/opensslv.h>],[
576 #if !defined(OPENSSL_VERSION_NUMBER)
577 #error "Missing OpenSSL version"
579 #if OPENSSL_VERSION_NUMBER < 0x0090801f
580 #error "Unsupported OpenSSL version " OPENSSL_VERSION_TEXT
584 [AC_MSG_RESULT(FAILED)])
586 if test "x$ac_cv_openssl" = "xyes"; then
587 ap_openssl_libs="${ap_openssl_libs:--lssl -lcrypto} `$apr_config --libs`"
588 APR_ADDTO(MOD_LDFLAGS, [$ap_openssl_libs])
589 APR_ADDTO(LIBS, [$ap_openssl_libs])
590 APR_SETVAR(ab_LDFLAGS, [$MOD_LDFLAGS])
591 APACHE_SUBST(ab_CFLAGS)
592 APACHE_SUBST(ab_LDFLAGS)
594 dnl Run library and function checks
596 AC_CHECK_HEADERS([openssl/engine.h])
597 AC_CHECK_FUNCS([SSLeay_version SSL_CTX_new], [], [liberrors="yes"])
598 AC_CHECK_FUNCS([ENGINE_init ENGINE_load_builtin_engines RAND_egd])
599 if test "x$liberrors" != "x"; then
600 AC_MSG_WARN([OpenSSL libraries are unusable])
603 AC_MSG_WARN([OpenSSL version is too old])
607 CPPFLAGS="$saved_CPPFLAGS"
609 LDFLAGS="$saved_LDFLAGS"
611 if test "x$ac_cv_openssl" = "xyes"; then
612 AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL is available])
617 dnl APACHE_CHECK_SERF
619 dnl Configure for the detected libserf, giving preference to
620 dnl "--with-serf=<path>" if it was specified.
622 AC_DEFUN([APACHE_CHECK_SERF], [
623 AC_CACHE_CHECK([for libserf], [ac_cv_serf], [
627 AC_ARG_WITH(serf, APACHE_HELP_STRING([--with-serf=PATH],
628 [Serf client library]),
630 if test "$withval" = "yes" ; then
637 if test "$serf_prefix" != "no" ; then
638 save_cppflags="$CPPFLAGS"
639 CPPFLAGS="$CPPFLAGS $APR_INCLUDES $APU_INCLUDES -I$serf_prefix/include/serf-0"
640 AC_CHECK_HEADERS(serf.h,[
641 save_ldflags="$LDFLAGS"
642 LDFLAGS="$LDFLAGS -L$serf_prefix/lib"
643 AC_CHECK_LIB(serf-0, serf_context_create,[ac_cv_serf="yes"])
644 LDFLAGS="$save_ldflags"])
645 CPPFLAGS="$save_cppflags"
649 APACHE_SUBST(SERF_LIBS)
650 if test "$ac_cv_serf" = "yes"; then
651 AC_DEFINE(HAVE_SERF, 1, [Define if libserf is available])
652 APR_SETVAR(SERF_LIBS, [-L$serf_prefix/lib -lserf-0])
653 APR_ADDTO(MOD_INCLUDES, [-I$serf_prefix/include/serf-0])
657 AC_DEFUN(APACHE_CHECK_SYSTEMD, [
658 dnl Check for systemd support for listen.c's socket activation.
661 if test -n "$PKGCONFIG" && $PKGCONFIG --exists libsystemd; then
662 SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
663 elif test -n "$PKGCONFIG" && $PKGCONFIG --exists libsystemd-daemon; then
664 SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd-daemon`
666 AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon")
668 if test -n "$SYSTEMD_LIBS"; then
669 AC_CHECK_HEADERS(systemd/sd-daemon.h)
670 if test "${ac_cv_header_systemd_sd_daemon_h}" = "no" || test -z "${SYSTEMD_LIBS}"; then
671 AC_MSG_WARN([Your system does not support systemd.])
673 APR_ADDTO(HTTPD_LIBS, [$SYSTEMD_LIBS])
674 AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is supported])
682 dnl APACHE_CHECK_NGHTTP2
684 dnl Configure for nghttp2, giving preference to
685 dnl "--with-nghttp2=<path>" if it was specified.
687 AC_DEFUN(APACHE_CHECK_NGHTTP2,[
688 AC_CACHE_CHECK([for nghttp2], [ac_cv_nghttp2], [
689 dnl initialise the variables we use
695 dnl Determine the nghttp2 base directory, if any
696 AC_MSG_CHECKING([for user-provided nghttp2 base directory])
697 AC_ARG_WITH(nghttp2, APACHE_HELP_STRING(--with-nghttp2=PATH, nghttp2 installation directory), [
698 dnl If --with-nghttp2 specifies a directory, we use that directory
699 if test "x$withval" != "xyes" -a "x$withval" != "x"; then
700 dnl This ensures $withval is actually a directory and that it is absolute
701 ap_nghttp2_base="`cd $withval ; pwd`"
704 if test "x$ap_nghttp2_base" = "x"; then
707 AC_MSG_RESULT($ap_nghttp2_base)
710 dnl Run header and version checks
711 saved_CPPFLAGS="$CPPFLAGS"
713 saved_LDFLAGS="$LDFLAGS"
715 dnl Before doing anything else, load in pkg-config variables
716 if test -n "$PKGCONFIG"; then
717 saved_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
718 AC_MSG_CHECKING([for pkg-config along $PKG_CONFIG_PATH])
719 if test "x$ap_nghttp2_base" != "x" -a \
720 -f "${ap_nghttp2_base}/lib/pkgconfig/libnghttp2.pc"; then
721 dnl Ensure that the given path is used by pkg-config too, otherwise
722 dnl the system libnghttp2.pc might be picked up instead.
723 PKG_CONFIG_PATH="${ap_nghttp2_base}/lib/pkgconfig${PKG_CONFIG_PATH+:}${PKG_CONFIG_PATH}"
724 export PKG_CONFIG_PATH
726 AC_ARG_ENABLE(nghttp2-staticlib-deps,APACHE_HELP_STRING(--enable-nghttp2-staticlib-deps,[link mod_h2 with dependencies of libnghttp2's static libraries (as indicated by "pkg-config --static"). Must be specified in addition to --enable-h2.]), [
727 if test "$enableval" = "yes"; then
728 PKGCONFIG_LIBOPTS="--static"
731 ap_nghttp2_libs="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-l --silence-errors libnghttp2`"
732 if test $? -eq 0; then
733 ap_nghttp2_found="yes"
734 pkglookup="`$PKGCONFIG --cflags-only-I libnghttp2`"
735 APR_ADDTO(CPPFLAGS, [$pkglookup])
736 APR_ADDTO(MOD_CFLAGS, [$pkglookup])
737 APR_ADDTO(ab_CFLAGS, [$pkglookup])
738 pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-L libnghttp2`"
739 APR_ADDTO(LDFLAGS, [$pkglookup])
740 APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
741 pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-other libnghttp2`"
742 APR_ADDTO(LDFLAGS, [$pkglookup])
743 APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
745 PKG_CONFIG_PATH="$saved_PKG_CONFIG_PATH"
748 dnl fall back to the user-supplied directory if not found via pkg-config
749 if test "x$ap_nghttp2_base" != "x" -a "x$ap_nghttp2_found" = "x"; then
750 APR_ADDTO(CPPFLAGS, [-I$ap_nghttp2_base/include])
751 APR_ADDTO(MOD_CFLAGS, [-I$ap_nghttp2_base/include])
752 APR_ADDTO(ab_CFLAGS, [-I$ap_nghttp2_base/include])
753 APR_ADDTO(LDFLAGS, [-L$ap_nghttp2_base/lib])
754 APR_ADDTO(MOD_LDFLAGS, [-L$ap_nghttp2_base/lib])
755 if test "x$ap_platform_runtime_link_flag" != "x"; then
756 APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_nghttp2_base/lib])
757 APR_ADDTO(MOD_LDFLAGS, [$ap_platform_runtime_link_flag$ap_nghttp2_base/lib])
761 AC_MSG_CHECKING([for nghttp2 version >= 1.0.0])
762 AC_TRY_COMPILE([#include <nghttp2/nghttp2ver.h>],[
763 #if !defined(NGHTTP2_VERSION_NUM)
764 #error "Missing nghttp2 version"
766 #if NGHTTP2_VERSION_NUM < 0x010000
767 #error "Unsupported nghttp2 version " NGHTTP2_VERSION_TEXT
771 [AC_MSG_RESULT(FAILED)])
773 if test "x$ac_cv_nghttp2" = "xyes"; then
774 ap_nghttp2_libs="${ap_nghttp2_libs:--lnghttp2} `$apr_config --libs`"
775 APR_ADDTO(MOD_LDFLAGS, [$ap_nghttp2_libs])
776 APR_ADDTO(LIBS, [$ap_nghttp2_libs])
777 APR_SETVAR(ab_LDFLAGS, [$MOD_LDFLAGS])
778 APACHE_SUBST(ab_CFLAGS)
779 APACHE_SUBST(ab_LDFLAGS)
781 dnl Run library and function checks
783 AC_CHECK_HEADERS([nghttp2/nghttp2.h])
784 AC_CHECK_FUNCS([nghttp2_session_server_new2], [], [liberrors="yes"])
785 if test "x$liberrors" != "x"; then
786 AC_MSG_WARN([nghttp2 library is unusable])
789 AC_MSG_WARN([nghttp2 version is too old])
793 CPPFLAGS="$saved_CPPFLAGS"
795 LDFLAGS="$saved_LDFLAGS"
797 if test "x$ac_cv_nghttp2" = "xyes"; then
798 AC_DEFINE(HAVE_NGHTTP2, 1, [Define if nghttp2 is available])
803 dnl APACHE_EXPORT_ARGUMENTS
804 dnl Export (via APACHE_SUBST) the various path-related variables that
805 dnl apache will use while generating scripts like autoconf and apxs and
806 dnl the default config file.
808 AC_DEFUN(APACHE_SUBST_EXPANDED_ARG,[
809 APR_EXPAND_VAR(exp_$1, [$]$1)
811 APR_PATH_RELATIVE(rel_$1, [$]exp_$1, ${prefix})
815 AC_DEFUN(APACHE_EXPORT_ARGUMENTS,[
816 APACHE_SUBST_EXPANDED_ARG(exec_prefix)
817 APACHE_SUBST_EXPANDED_ARG(bindir)
818 APACHE_SUBST_EXPANDED_ARG(sbindir)
819 APACHE_SUBST_EXPANDED_ARG(libdir)
820 APACHE_SUBST_EXPANDED_ARG(libexecdir)
821 APACHE_SUBST_EXPANDED_ARG(mandir)
822 APACHE_SUBST_EXPANDED_ARG(sysconfdir)
823 APACHE_SUBST_EXPANDED_ARG(datadir)
824 APACHE_SUBST_EXPANDED_ARG(installbuilddir)
825 APACHE_SUBST_EXPANDED_ARG(errordir)
826 APACHE_SUBST_EXPANDED_ARG(iconsdir)
827 APACHE_SUBST_EXPANDED_ARG(htdocsdir)
828 APACHE_SUBST_EXPANDED_ARG(manualdir)
829 APACHE_SUBST_EXPANDED_ARG(cgidir)
830 APACHE_SUBST_EXPANDED_ARG(includedir)
831 APACHE_SUBST_EXPANDED_ARG(localstatedir)
832 APACHE_SUBST_EXPANDED_ARG(runtimedir)
833 APACHE_SUBST_EXPANDED_ARG(logfiledir)
834 APACHE_SUBST_EXPANDED_ARG(proxycachedir)
835 APACHE_SUBST_EXPANDED_ARG(davlockdb)
839 dnl APACHE_CHECK_APxVER({apr|apu}, major, minor,
840 dnl [actions-if-ok], [actions-if-not-ok])
842 dnl Checks for APR or APR-util of given major/minor version or later;
843 dnl if so, runs actions-if-ok; otherwise runs actions-if-not-ok if given.
844 dnl If the version is not satisfactory and actions-if-not-ok is not
845 dnl given, then an error is printed and the configure script is aborted.
847 dnl The first argument must be [apr] or [apu].
849 AC_DEFUN([APACHE_CHECK_APxVER], [
850 define(ap_ckver_major, translit($1, [apru], [APRU])[_MAJOR_VERSION])
851 define(ap_ckver_minor, translit($1, [apru], [APRU])[_MINOR_VERSION])
852 define(ap_ckver_cvar, [ap_cv_$1ver$2$3])
853 define(ap_ckver_name, ifelse([$1],[apr],[APR],[APR-util]))
855 ap_ckver_CPPFLAGS="$CPPFLAGS"
856 CPPFLAGS="$CPPFLAGS `$[$1]_config --includes`"
858 AC_CACHE_CHECK([for ap_ckver_name version $2.$3.0 or later], ap_ckver_cvar, [
859 AC_EGREP_CPP([good], [
860 #include <$1_version.h>
861 #if ]ap_ckver_major[ > $2 || (]ap_ckver_major[ == $2 && ]ap_ckver_minor[ >= $3)
864 ], [ap_ckver_cvar=yes], [ap_ckver_cvar=no])])
866 if test "$ap_ckver_cvar" = "yes"; then
867 ifelse([$4],[],[:],[$4])
869 ifelse([$5],[],[AC_MSG_ERROR([ap_ckver_name version $2.$3.0 or later is required])], [$5])
872 CPPFLAGS="$ap_ckver_CPPFLAGS"
874 undefine([ap_ckver_major])
875 undefine([ap_ckver_minor])
876 undefine([ap_ckver_cvar])
877 undefine([ap_ckver_name])
881 dnl APACHE_CHECK_VOID_PTR_LEN
883 dnl Checks if the size of a void pointer is at least as big as a "long"
886 AC_DEFUN([APACHE_CHECK_VOID_PTR_LEN], [
888 AC_CACHE_CHECK([for void pointer length], [ap_cv_void_ptr_lt_long],
892 return sizeof(void *) < sizeof(long);
893 }], [ap_cv_void_ptr_lt_long=no], [ap_cv_void_ptr_lt_long=yes],
894 [ap_cv_void_ptr_lt_long="cross compile - not checked"])])
896 if test "$ap_cv_void_ptr_lt_long" = "yes"; then
897 AC_MSG_ERROR([Size of "void *" is less than size of "long"])
902 dnl APACHE_CHECK_APR_HAS_LDAP
904 dnl Check if APR_HAS_LDAP is 1
905 dnl Unfortunately, we can't use APR_CHECK_APR_DEFINE (because it only includes apr.h)
906 dnl or APR_CHECK_DEFINE (because it only checks for defined'ness and not for 0/1).
908 AC_DEFUN([APACHE_CHECK_APR_HAS_LDAP], [
909 AC_CACHE_CHECK([for ldap support in apr/apr-util],ac_cv_APR_HAS_LDAP,[
910 apache_old_cppflags="$CPPFLAGS"
911 CPPFLAGS="$CPPFLAGS $INCLUDES"
912 AC_EGREP_CPP(YES_IS_DEFINED, [
913 #include <apr_ldap.h>
917 ], ac_cv_APR_HAS_LDAP=yes, ac_cv_APR_HAS_LDAP=no)
918 CPPFLAGS="$apache_old_cppflags"
923 dnl APACHE_ADD_GCC_CFLAGS
925 dnl Check if compiler is gcc and supports flag. If yes, add to CFLAGS.
927 AC_DEFUN([APACHE_ADD_GCC_CFLAG], [
928 define([ap_gcc_ckvar], [ac_cv_gcc_]translit($1, [-:.=], [____]))
929 if test "$GCC" = "yes"; then
930 AC_CACHE_CHECK([whether gcc accepts $1], ap_gcc_ckvar, [
931 save_CFLAGS="$CFLAGS"
933 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo() { return 0; }])],
934 [ap_gcc_ckvar=yes], [ap_gcc_ckvar=no])
935 CFLAGS="$save_CFLAGS"
937 if test "$]ap_gcc_ckvar[" = "yes" ; then
938 APR_ADDTO(CFLAGS,[$1])
941 undefine([ap_gcc_ckvar])