]> granicus.if.org Git - apache/blob - acinclude.m4
mod_ssl: follow up to r1868645.
[apache] / acinclude.m4
1
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
8
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)
15 ])
16
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"
21 ])
22
23 dnl APACHE_GEN_CONFIG_VARS
24 dnl Creates config_vars.mk
25 AC_DEFUN([APACHE_GEN_CONFIG_VARS],[
26   APACHE_SUBST(HTTPD_VERSION)
27   APACHE_SUBST(HTTPD_MMN)
28   APACHE_SUBST(abs_srcdir)
29   APACHE_SUBST(bindir)
30   APACHE_SUBST(sbindir)
31   APACHE_SUBST(cgidir)
32   APACHE_SUBST(logfiledir)
33   APACHE_SUBST(exec_prefix)
34   APACHE_SUBST(datadir)
35   APACHE_SUBST(localstatedir)
36   APACHE_SUBST(mandir)
37   APACHE_SUBST(libdir)
38   APACHE_SUBST(libexecdir)
39   APACHE_SUBST(htdocsdir)
40   APACHE_SUBST(manualdir)
41   APACHE_SUBST(includedir)
42   APACHE_SUBST(errordir)
43   APACHE_SUBST(iconsdir)
44   APACHE_SUBST(sysconfdir)
45   APACHE_SUBST(installbuilddir)
46   APACHE_SUBST(runtimedir)
47   APACHE_SUBST(proxycachedir)
48   APACHE_SUBST(statedir)
49   APACHE_SUBST(other_targets)
50   APACHE_SUBST(progname)
51   APACHE_SUBST(prefix)
52   APACHE_SUBST(AWK)
53   APACHE_SUBST(CC)
54   APACHE_SUBST(CPP)
55   APACHE_SUBST(CXX)
56   APACHE_SUBST(CPPFLAGS)
57   APACHE_SUBST(CFLAGS)
58   APACHE_SUBST(CXXFLAGS)
59   APACHE_SUBST(CC_FOR_BUILD)
60   APACHE_SUBST(CFLAGS_FOR_BUILD)
61   APACHE_SUBST(LTFLAGS)
62   APACHE_SUBST(LDFLAGS)
63   APACHE_SUBST(LT_LDFLAGS)
64   APACHE_SUBST(SH_LDFLAGS)
65   APACHE_SUBST(HTTPD_LDFLAGS)
66   APACHE_SUBST(UTIL_LDFLAGS)
67   APACHE_SUBST(LIBS)
68   APACHE_SUBST(DEFS)
69   APACHE_SUBST(INCLUDES)
70   APACHE_SUBST(NOTEST_CPPFLAGS)
71   APACHE_SUBST(NOTEST_CFLAGS)
72   APACHE_SUBST(NOTEST_CXXFLAGS)
73   APACHE_SUBST(NOTEST_LDFLAGS)
74   APACHE_SUBST(NOTEST_LIBS)
75   APACHE_SUBST(EXTRA_CPPFLAGS)
76   APACHE_SUBST(EXTRA_CFLAGS)
77   APACHE_SUBST(EXTRA_CXXFLAGS)
78   APACHE_SUBST(EXTRA_LDFLAGS)
79   APACHE_SUBST(EXTRA_LIBS)
80   APACHE_SUBST(EXTRA_INCLUDES)
81   APACHE_SUBST(INTERNAL_CPPFLAGS)
82   APACHE_SUBST(LIBTOOL)
83   APACHE_SUBST(SHELL)
84   APACHE_SUBST(RSYNC)
85   APACHE_SUBST(MODULE_DIRS)
86   APACHE_SUBST(MODULE_CLEANDIRS)
87   APACHE_SUBST(PORT)
88   APACHE_SUBST(SSLPORT)
89   APACHE_SUBST(CORE_IMPLIB_FILE)
90   APACHE_SUBST(CORE_IMPLIB)
91   APACHE_SUBST(SH_LIBS)
92   APACHE_SUBST(SH_LIBTOOL)
93   APACHE_SUBST(MK_IMPLIB)
94   APACHE_SUBST(MKDEP)
95   APACHE_SUBST(INSTALL_PROG_FLAGS)
96   APACHE_SUBST(MPM_MODULES)
97   APACHE_SUBST(ENABLED_MPM_MODULE)
98   APACHE_SUBST(DSO_MODULES)
99   APACHE_SUBST(ENABLED_DSO_MODULES)
100   APACHE_SUBST(LOAD_ALL_MODULES)
101   APACHE_SUBST(APR_BINDIR)
102   APACHE_SUBST(APR_INCLUDEDIR)
103   APACHE_SUBST(APR_VERSION)
104   APACHE_SUBST(APR_CONFIG)
105   APACHE_SUBST(APU_BINDIR)
106   APACHE_SUBST(APU_INCLUDEDIR)
107   APACHE_SUBST(APU_VERSION)
108   APACHE_SUBST(APU_CONFIG)
109   APACHE_SUBST(APREQ_MAJOR_VERSION)
110   APACHE_SUBST(APREQ_LIBTOOL_VERSION)
111
112   abs_srcdir="`(cd $srcdir && pwd)`"
113
114   AC_MSG_NOTICE([creating config_vars.mk])
115   test -d build || $mkdir_p build
116   > build/config_vars.mk
117   for i in $APACHE_VAR_SUBST; do
118     eval echo "$i = \$$i" >> build/config_vars.mk
119   done
120 ])
121
122 dnl
123 dnl APACHE_TYPE_RLIM_T
124 dnl
125 dnl If rlim_t is not defined, define it to int
126 dnl
127 AC_DEFUN([APACHE_TYPE_RLIM_T], [
128   AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
129     AC_TRY_COMPILE([
130 #include <sys/types.h>
131 #include <sys/time.h>
132 #include <sys/resource.h>
133 ], [rlim_t spoon;], [
134       ac_cv_type_rlim_t=yes
135     ],[ac_cv_type_rlim_t=no
136     ])
137   ])
138   if test "$ac_cv_type_rlim_t" = "no" ; then
139       AC_DEFINE(rlim_t, int,
140           [Define to 'int' if <sys/resource.h> doesn't define it for us])
141   fi
142 ])
143
144 dnl the list of build variables which are available for customization on a
145 dnl per module subdir basis (to be inserted into modules.mk with a "MOD_"
146 dnl prefix, i.e. MOD_CFLAGS etc.). Used in APACHE_MODPATH_{INIT,FINISH}.
147 define(mod_buildvars, [CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LIBS INCLUDES])
148 dnl
149 dnl APACHE_MODPATH_INIT(modpath)
150 AC_DEFUN([APACHE_MODPATH_INIT],[
151   current_dir=$1
152   modpath_current=modules/$1
153   modpath_static=
154   modpath_shared=
155   for var in mod_buildvars; do
156     eval MOD_$var=
157   done
158   test -d $1 || $srcdir/build/mkdir.sh $modpath_current
159   > $modpath_current/modules.mk
160 ])dnl
161 dnl
162 AC_DEFUN([APACHE_MODPATH_FINISH],[
163   echo "DISTCLEAN_TARGETS = modules.mk" >> $modpath_current/modules.mk
164   echo "static = $modpath_static" >> $modpath_current/modules.mk
165   echo "shared = $modpath_shared" >> $modpath_current/modules.mk
166   for var in mod_buildvars; do
167     if eval val=\"\$MOD_$var\"; test -n "$val"; then
168       echo "MOD_$var = $val" >> $modpath_current/modules.mk
169     fi
170   done
171   if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
172     MODULE_DIRS="$MODULE_DIRS $current_dir"
173   else
174     MODULE_CLEANDIRS="$MODULE_CLEANDIRS $current_dir"
175   fi
176   APACHE_FAST_OUTPUT($modpath_current/Makefile)
177 ])dnl
178 dnl
179 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
180 AC_DEFUN([APACHE_MODPATH_ADD],[
181   if test -z "$3"; then
182     objects="mod_$1.lo"
183   else
184     objects="$3"
185   fi
186
187   if test -z "$module_standalone"; then
188     if test -z "$2"; then
189       # The filename of a convenience library must have a "lib" prefix:
190       libname="libmod_$1.la"
191       BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
192       modpath_static="$modpath_static $libname"
193       cat >>$modpath_current/modules.mk<<EOF
194 $libname: $objects
195         \$(MOD_LINK) $objects $5
196 EOF
197       if test ! -z "$5"; then
198         APR_ADDTO(AP_LIBS, [$5])
199       fi
200     else
201       apache_need_shared=yes
202       libname="mod_$1.la"
203       shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
204       modpath_shared="$modpath_shared $libname"
205       cat >>$modpath_current/modules.mk<<EOF
206 $libname: $shobjects
207         \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
208 EOF
209     fi
210   fi
211 ])dnl
212 dnl Same as APACHE_MODPATH_INIT/FINISH but for MPMs
213 dnl APACHE_MPMPATH_INIT(mpmpath)
214 AC_DEFUN([APACHE_MPMPATH_INIT],[
215   current_dir=$1
216   modpath_current=server/mpm/$1
217   modpath_static=
218   modpath_shared=
219   for var in mod_buildvars; do
220     eval MOD_$var=
221   done
222   test -d $1 || $srcdir/build/mkdir.sh $modpath_current
223   > $modpath_current/modules.mk
224 ])dnl
225 dnl
226 AC_DEFUN([APACHE_MPMPATH_FINISH],[
227   for var in mod_buildvars; do
228     if eval val=\"\$MOD_$var\"; test -n "$val"; then
229       echo "MOD_$var = $val" >> $modpath_current/modules.mk
230     fi
231   done
232 ])dnl
233
234 dnl
235 dnl APACHE_MPM_MODULE(name[, shared[, objects[, config[, path[, libs]]]]])
236 dnl
237 dnl Provide information for building the MPM.  (Enablement is handled using
238 dnl --with-mpm/--enable-mpms-shared.)
239 dnl
240 dnl name     -- name of MPM, same as MPM directory name
241 dnl shared   -- "shared" to indicate shared module build, empty string otherwise
242 dnl objects  -- one or more .lo files to link into the MPM module (default: mpmname.lo)
243 dnl config   -- configuration logic to run if the MPM is enabled
244 dnl path     -- relative path to MPM (default: server/mpm/mpmname)
245 dnl libs     -- libs needed by this MPM
246 dnl
247 AC_DEFUN([APACHE_MPM_MODULE],[
248     if ap_mpm_is_enabled $1; then
249         if test -z "$3"; then
250             objects="$1.lo"
251         else
252             objects="$3"
253         fi
254
255         if test -z "$5"; then
256             mpmpath="server/mpm/$1"
257         else
258             mpmpath=$5
259         fi
260
261         dnl VPATH support
262         test -d $mpmpath || $srcdir/build/mkdir.sh $mpmpath
263
264         APACHE_FAST_OUTPUT($mpmpath/Makefile)
265
266         if test -z "$2"; then
267             APR_ADDTO(AP_LIBS, [$6])
268             libname="lib$1.la"
269             cat >>$mpmpath/modules.mk<<EOF
270 $libname: $objects
271         \$(MOD_LINK) $objects
272 DISTCLEAN_TARGETS = modules.mk
273 static = $libname
274 shared =
275 EOF
276         else
277             apache_need_shared=yes
278             libname="mod_mpm_$1.la"
279             shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
280             cat >>$mpmpath/modules.mk<<EOF
281 $libname: $shobjects
282         \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $objects $6
283 DISTCLEAN_TARGETS = modules.mk
284 static =
285 shared = $libname
286 EOF
287             MPM_MODULES="$MPM_MODULES mpm_$1"
288             # add default MPM to LoadModule list
289             if test $1 = $default_mpm; then
290                 ENABLED_MPM_MODULE="mpm_$1"
291             fi
292         fi
293         $4
294     fi
295 ])dnl
296
297 dnl
298 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config[, prereq_module]]]]])
299 dnl
300 dnl default is one of:
301 dnl   yes    -- enabled by default. user must explicitly disable.
302 dnl   no     -- disabled under default, most, all. user must explicitly enable.
303 dnl   most   -- disabled by default. enabled explicitly or with most or all.
304 dnl   static -- enabled as static by default, must be explicitly changed.
305 dnl   ""     -- disabled under default, most. enabled explicitly or with all.
306 dnl             XXX: The arg must really be empty here. Passing an empty shell
307 dnl             XXX: variable doesn't work for some reason. This should be
308 dnl             XXX: fixed.
309 dnl
310 dnl basically: yes/no is a hard setting. "most" means follow the "most"
311 dnl            setting. otherwise, fall under the "all" setting.
312 dnl            explicit yes/no always overrides, except if the user selects
313 dnl            "reallyall".
314 dnl
315 dnl prereq_module is a module (without the "mod_" prefix) that must be enabled
316 dnl   if the current module is enabled.  If the current module is built
317 dnl   statically, prereq_module must be built statically, too.  If these
318 dnl   conditions are not fulfilled, configure will abort if the current module
319 dnl   has been enabled explicitly. Otherwise, configure will disable the
320 dnl   current module.
321 dnl   prereq_module's APACHE_MODULE() statement must have been processed
322 dnl   before the current APACHE_MODULE() statement.
323 dnl
324 AC_DEFUN([APACHE_MODULE],[
325   AC_MSG_CHECKING(whether to enable mod_$1)
326   define([optname],[--]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
327   AC_ARG_ENABLE(translit($1,_,-),APACHE_HELP_STRING(optname(),$2),force_$1=$enableval,enable_$1=ifelse($5,,maybe-all,$5))
328   undefine([optname])dnl
329   _apmod_extra_msg=""
330   dnl If the module was not explicitly requested, allow it to disable itself if
331   dnl its pre-reqs fail.
332   case "$enable_$1" in
333     yes|static|shared)
334       _apmod_required="yes"
335       ;;
336     *)
337       _apmod_required="no"
338       ;;
339   esac
340   if test "$enable_$1" = "static" -o "$enable_$1" = "shared"; then
341     :
342   elif test "$enable_$1" = "yes"; then
343     enable_$1=$module_default
344   elif test "$enable_$1" = "few"; then
345     if test "$module_selection" = "few" -o "$module_selection" = "most" -o \
346             "$module_selection" = "all" -o "$module_selection" = "reallyall"
347     then
348       enable_$1=$module_default
349     else
350       enable_$1=no
351     fi
352     _apmod_extra_msg=" ($module_selection)"
353   elif test "$enable_$1" = "most"; then
354     if test "$module_selection" = "most" -o "$module_selection" = "all" -o \
355             "$module_selection" = "reallyall"
356     then
357       enable_$1=$module_default
358     else
359       enable_$1=no
360     fi
361     _apmod_extra_msg=" ($module_selection)"
362   elif test "$enable_$1" = "all" -o "$enable_$1" = "maybe-all"; then
363     if test "$module_selection" = "all" -o "$module_selection" = "reallyall"
364     then
365       enable_$1=$module_default
366       _apmod_extra_msg=" ($module_selection)"
367     else
368       enable_$1=no
369     fi
370   elif test "$enable_$1" = "reallyall" -o "$enable_$1" = "no" ; then
371     if test "$module_selection" = "reallyall" -a "$force_$1" != "no" ; then
372       enable_$1=$module_default
373       _apmod_extra_msg=" ($module_selection)"
374     else
375       enable_$1=no
376     fi
377   else
378     enable_$1=no
379   fi
380   if test "$enable_$1" != "no"; then
381     dnl If we plan to enable it, allow the module to run some autoconf magic
382     dnl that may disable it because of missing dependencies.
383     ifelse([$6$7],,:,
384            [AC_MSG_RESULT([checking dependencies])
385             ifelse([$7],,:,[m4_foreach([prereq],[$7],
386                            [if test "$enable_[]prereq" = "no" ; then
387                               enable_$1=no
388                               AC_MSG_WARN("mod_[]prereq is disabled but required for mod_$1")
389                             elif test "$enable_$1" = "static" && test "$enable_[]prereq" != "static" ; then
390                               enable_$1=$enable_[]prereq
391                               AC_MSG_WARN("building mod_$1 shared because mod_[]prereq is built shared")
392                             el])se])
393             ifelse([$6],,:,[  $6])
394             ifelse([$7],,:,[fi])
395             AC_MSG_CHECKING(whether to enable mod_$1)
396             if test "$enable_$1" = "no"; then
397               if test "$_apmod_required" = "no"; then
398                 _apmod_extra_msg=" (disabled)"
399               else
400                 AC_MSG_ERROR([mod_$1 has been requested but can not be built due to prerequisite failures])
401               fi
402             fi])
403   fi
404   AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
405   if test "$enable_$1" != "no"; then
406     case "$enable_$1" in
407     static*)
408       MODLIST="$MODLIST ifelse($4,,$1,$4)"
409       if test "$1" = "so"; then
410           sharedobjs=yes
411       fi
412       shared="";;
413     *)
414       sharedobjs=yes
415       shared=yes
416       DSO_MODULES="$DSO_MODULES $1"
417       if test "$5" = "yes" ; then
418         ENABLED_DSO_MODULES="${ENABLED_DSO_MODULES},$1"
419       fi
420       ;;
421     esac
422     define([modprefix], [MOD_]translit($1, [a-z-], [A-Z_]))
423     APACHE_MODPATH_ADD($1, $shared, $3,, [\$(]modprefix[_LDADD)])
424     APACHE_SUBST(modprefix[_LDADD])
425     undefine([modprefix])
426   fi
427 ])dnl
428
429 dnl
430 dnl APACHE_ENABLE_MODULES
431 dnl
432 AC_DEFUN([APACHE_ENABLE_MODULES],[
433   module_selection=most
434   module_default=shared
435
436   dnl Check whether we have DSO support.
437   dnl If "yes", we build shared modules by default.
438   APR_CHECK_APR_DEFINE(APR_HAS_DSO)
439
440   if test $ac_cv_define_APR_HAS_DSO = "no"; then
441     AC_MSG_WARN([Missing DSO support - building static modules by default.])
442     module_default=static
443   fi
444
445
446   AC_ARG_ENABLE(modules,
447   APACHE_HELP_STRING(--enable-modules=MODULE-LIST,Space-separated list of modules to enable | "all" | "most" | "few" | "none" | "reallyall"),[
448     if test "$enableval" = "none"; then
449        module_default=no
450        module_selection=none
451     else
452       for i in $enableval; do
453         if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"
454         then
455           module_selection=$i
456         else
457           i=`echo $i | sed 's/-/_/g'`
458           eval "enable_$i=shared"
459         fi
460       done
461     fi
462   ])
463   
464   AC_ARG_ENABLE(mods-shared,
465   APACHE_HELP_STRING(--enable-mods-shared=MODULE-LIST,Space-separated list of shared modules to enable | "all" | "most" | "few" | "reallyall"),[
466     for i in $enableval; do
467       if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"
468       then
469         module_selection=$i
470         module_default=shared
471       else
472         i=`echo $i | sed 's/-/_/g'`
473         eval "enable_$i=shared"
474       fi
475     done
476   ])
477   
478   AC_ARG_ENABLE(mods-static,
479   APACHE_HELP_STRING(--enable-mods-static=MODULE-LIST,Space-separated list of static modules to enable | "all" | "most" | "few" | "reallyall"),[
480     for i in $enableval; do
481       if test "$i" = "all" -o "$i" = "most" -o "$i" = "few" -o "$i" = "reallyall"; then
482         module_selection=$i
483         module_default=static
484       else
485         i=`echo $i | sed 's/-/_/g'`
486         eval "enable_$i=static"
487       fi
488     done
489   ])
490 ])
491
492 AC_DEFUN([APACHE_REQUIRE_CXX],[
493   if test -z "$apache_cxx_done"; then
494     AC_PROG_CXX
495     AC_PROG_CXXCPP
496     apache_cxx_done=yes
497   fi
498 ])
499
500 dnl
501 dnl APACHE_CHECK_OPENSSL
502 dnl
503 dnl Configure for OpenSSL, giving preference to
504 dnl "--with-ssl=<path>" if it was specified.
505 dnl
506 AC_DEFUN([APACHE_CHECK_OPENSSL],[
507   AC_CACHE_CHECK([for OpenSSL], [ac_cv_openssl], [
508     dnl initialise the variables we use
509     ac_cv_openssl=no
510     ap_openssl_found=""
511     ap_openssl_base=""
512     ap_openssl_libs=""
513     ap_openssl_mod_cflags=""
514     ap_openssl_mod_ldflags=""
515
516     dnl Determine the OpenSSL base directory, if any
517     AC_MSG_CHECKING([for user-provided OpenSSL base directory])
518     AC_ARG_WITH(ssl, APACHE_HELP_STRING(--with-ssl=PATH,OpenSSL installation directory), [
519       dnl If --with-ssl specifies a directory, we use that directory
520       if test "x$withval" != "xyes" -a "x$withval" != "x"; then
521         dnl This ensures $withval is actually a directory and that it is absolute
522         ap_openssl_base="`cd $withval ; pwd`"
523       fi
524     ])
525     if test "x$ap_openssl_base" = "x"; then
526       AC_MSG_RESULT(none)
527     else
528       AC_MSG_RESULT($ap_openssl_base)
529     fi
530
531     dnl Run header and version checks
532     saved_CPPFLAGS="$CPPFLAGS"
533     saved_LIBS="$LIBS"
534     saved_LDFLAGS="$LDFLAGS"
535
536     dnl Before doing anything else, load in pkg-config variables
537     if test -n "$PKGCONFIG"; then
538       saved_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
539       if test "x$ap_openssl_base" != "x"; then
540         if test -f "${ap_openssl_base}/lib/pkgconfig/openssl.pc"; then
541           dnl Ensure that the given path is used by pkg-config too, otherwise
542           dnl the system openssl.pc might be picked up instead.
543           PKG_CONFIG_PATH="${ap_openssl_base}/lib/pkgconfig${PKG_CONFIG_PATH+:}${PKG_CONFIG_PATH}"
544           export PKG_CONFIG_PATH
545         elif test -f "${ap_openssl_base}/lib64/pkgconfig/openssl.pc"; then
546           dnl Ensure that the given path is used by pkg-config too, otherwise
547           dnl the system openssl.pc might be picked up instead.
548           PKG_CONFIG_PATH="${ap_openssl_base}/lib64/pkgconfig${PKG_CONFIG_PATH+:}${PKG_CONFIG_PATH}"
549           export PKG_CONFIG_PATH
550         fi
551       fi
552       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.]), [
553         if test "$enableval" = "yes"; then
554           PKGCONFIG_LIBOPTS="--static"
555         fi
556       ])
557       ap_openssl_libs="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-l --silence-errors openssl`"
558       if test $? -eq 0; then
559         ap_openssl_found="yes"
560         pkglookup="`$PKGCONFIG --cflags-only-I openssl`"
561         APR_ADDTO(CPPFLAGS, [$pkglookup])
562         APR_ADDTO(MOD_CFLAGS, [$pkglookup])
563         APR_ADDTO(ab_CFLAGS, [$pkglookup])
564         pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-L openssl`"
565         APR_ADDTO(LDFLAGS, [$pkglookup])
566         APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
567         pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-other openssl`"
568         APR_ADDTO(LDFLAGS, [$pkglookup])
569         APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
570       fi
571       PKG_CONFIG_PATH="$saved_PKG_CONFIG_PATH"
572     fi
573
574     dnl fall back to the user-supplied directory if not found via pkg-config
575     if test "x$ap_openssl_base" != "x" -a "x$ap_openssl_found" = "x"; then
576       APR_ADDTO(CPPFLAGS, [-I$ap_openssl_base/include])
577       APR_ADDTO(MOD_CFLAGS, [-I$ap_openssl_base/include])
578       APR_ADDTO(ab_CFLAGS, [-I$ap_openssl_base/include])
579       APR_ADDTO(LDFLAGS, [-L$ap_openssl_base/lib])
580       APR_ADDTO(MOD_LDFLAGS, [-L$ap_openssl_base/lib])
581       if test "x$ap_platform_runtime_link_flag" != "x"; then
582         APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_openssl_base/lib])
583         APR_ADDTO(MOD_LDFLAGS, [$ap_platform_runtime_link_flag$ap_openssl_base/lib])
584       fi
585     fi
586
587     AC_MSG_CHECKING([for OpenSSL version >= 0.9.8a])
588     AC_TRY_COMPILE([#include <openssl/opensslv.h>],[
589 #if !defined(OPENSSL_VERSION_NUMBER)
590 #error "Missing OpenSSL version"
591 #endif
592 #if OPENSSL_VERSION_NUMBER < 0x0090801f
593 #error "Unsupported OpenSSL version " OPENSSL_VERSION_TEXT
594 #endif],
595       [AC_MSG_RESULT(OK)
596        ac_cv_openssl=yes],
597       [AC_MSG_RESULT(FAILED)])
598
599     if test "x$ac_cv_openssl" = "xyes"; then
600       ap_openssl_libs="${ap_openssl_libs:--lssl -lcrypto} `$apr_config --libs`"
601       APR_ADDTO(MOD_LDFLAGS, [$ap_openssl_libs])
602       APR_ADDTO(LIBS, [$ap_openssl_libs])
603       APR_SETVAR(ab_LIBS, [$MOD_LDFLAGS])
604       APACHE_SUBST(ab_CFLAGS)
605       APACHE_SUBST(ab_LIBS)
606
607       dnl Run library and function checks
608       liberrors=""
609       AC_CHECK_HEADERS([openssl/engine.h])
610       AC_CHECK_FUNCS([SSL_CTX_new], [], [liberrors="yes"])
611       AC_CHECK_FUNCS([OPENSSL_init_ssl])
612       AC_CHECK_FUNCS([ENGINE_init ENGINE_load_builtin_engines RAND_egd \
613                       CRYPTO_set_id_callback])
614       if test "x$liberrors" != "x"; then
615         AC_MSG_WARN([OpenSSL libraries are unusable])
616       fi
617     else
618       AC_MSG_WARN([OpenSSL version is too old])
619     fi
620
621     dnl restore
622     CPPFLAGS="$saved_CPPFLAGS"
623     LIBS="$saved_LIBS"
624     LDFLAGS="$saved_LDFLAGS"
625
626     dnl cache MOD_LDFLAGS, MOD_CFLAGS
627     ap_openssl_mod_cflags=$MOD_CFLAGS
628     ap_openssl_mod_ldflags=$MOD_LDFLAGS
629   ])
630   if test "x$ac_cv_openssl" = "xyes"; then
631     AC_DEFINE(HAVE_OPENSSL, 1, [Define if OpenSSL is available])
632     APR_ADDTO(MOD_LDFLAGS, [$ap_openssl_mod_ldflags])
633     APR_ADDTO(MOD_CFLAGS, [$ap_openssl_mod_cflags])
634   fi
635
636   dnl On most platforms, the default multithreading logic in OpenSSL 1.0.x uses
637   dnl a threadid that is based on the address of errno. We need to double-check
638   dnl that &errno is, in fact, different for each thread before using that
639   dnl default.
640   AC_CACHE_CHECK([if OpenSSL can use &errno as a THREADID],
641                  [ac_cv_openssl_use_errno_threadid], [
642     ac_cv_openssl_use_errno_threadid=no
643
644     save_CFLAGS=$CFLAGS
645     save_LIBS=$LIBS
646
647     CFLAGS=`$apr_config --cflags --cppflags --includes`
648     LIBS=`$apr_config --link-ld`
649
650     AC_RUN_IFELSE([
651       AC_LANG_PROGRAM([[
652           #include <stdlib.h>
653
654           #include "apr_pools.h"
655           #include "apr_thread_cond.h"
656           #include "apr_thread_proc.h"
657
658           #define NUM_THREADS 10
659
660           struct thread_data {
661               apr_thread_mutex_t *mutex;
662               apr_thread_cond_t  *cv;
663               int                *init_count;
664               void               *errno_addr;
665           };
666
667           /**
668            * Thread entry point. Waits for all the threads to be started, then
669            * records the address of errno into the thread_data.
670            */
671           void * APR_THREAD_FUNC tmain(apr_thread_t *thread, void *data)
672           {
673               struct thread_data *tdata = data;
674
675               /* The only point of this barrier is to make sure that all threads
676                * are started before we record &errno, hopefully preventing any
677                * false negatives in case a platform "recycles" threads. */
678               apr_thread_mutex_lock(tdata->mutex);
679               ++(*tdata->init_count);
680
681               if (*tdata->init_count == NUM_THREADS) {
682                   apr_thread_cond_broadcast(tdata->cv);
683               } else {
684                   while (*tdata->init_count != NUM_THREADS) {
685                       apr_thread_cond_wait(tdata->cv, tdata->mutex);
686                   }
687               }
688               apr_thread_mutex_unlock(tdata->mutex);
689
690               tdata->errno_addr = &errno;
691               return NULL;
692           }
693       ]], [[
694           int ret = 0;
695           apr_status_t status;
696           int i;
697           int j;
698
699           apr_pool_t         *pool;
700           apr_thread_mutex_t *mutex;
701           apr_thread_cond_t  *cv;
702           int                init_count = 0;
703
704           struct thread_data tdata[NUM_THREADS] = { 0 };
705           apr_thread_t *threads[NUM_THREADS] = { 0 };
706
707           if (apr_initialize() != APR_SUCCESS) {
708               exit(1);
709           }
710
711           /* Set up the shared APR primitives. */
712           if ((apr_pool_create(&pool, NULL) != APR_SUCCESS)
713               || (apr_thread_mutex_create(&mutex, 0, pool) != APR_SUCCESS)
714               || (apr_thread_cond_create(&cv, pool) != APR_SUCCESS)) {
715               ret = 2;
716               goto out;
717           }
718
719           /* Start every thread. */
720           for (i = 0; i < NUM_THREADS; ++i) {
721               tdata[i].mutex = mutex;
722               tdata[i].cv = cv;
723               tdata[i].init_count = &init_count;
724
725               status = apr_thread_create(&threads[i], NULL, tmain, &tdata[i],
726                                          pool);
727               if (status != APR_SUCCESS) {
728                   ret = 3;
729                   goto out;
730               }
731           }
732
733           /* Wait for them to finish (they'll record and exit after every one
734            * has been started). */
735           for (i = 0; i < NUM_THREADS; ++i) {
736               apr_thread_join(&status, threads[i]);
737               if (status != APR_SUCCESS) {
738                   ret = 4;
739                   goto out;
740               }
741           }
742
743           /* Check that no addresses were duplicated. */
744           for (i = 0; i < NUM_THREADS - 1; ++i) {
745               for (j = i + 1; j < NUM_THREADS; ++j) {
746                   if (tdata[i].errno_addr == tdata[j].errno_addr) {
747                       ret = 5;
748                       goto out;
749                   }
750               }
751           }
752
753       out:
754           apr_terminate();
755           exit(ret);
756       ]])
757     ], [
758       ac_cv_openssl_use_errno_threadid=yes
759     ], [
760       ac_cv_openssl_use_errno_threadid=no
761     ], [
762       dnl Assume the worst when cross-compiling; users can override via either
763       dnl cachevars or the config header if necessary.
764       ac_cv_openssl_use_errno_threadid=no
765     ])
766
767     CFLAGS=$save_CFLAGS
768     LIBS=$save_LIBS
769   ])
770   if test "x$ac_cv_openssl_use_errno_threadid" = "xyes"; then
771     AC_DEFINE(AP_OPENSSL_USE_ERRNO_THREADID, 1,
772               [Define if OpenSSL can use an errno-based threadid callback on this platform])
773   fi
774 ])
775
776 dnl
777 dnl APACHE_CHECK_SERF
778 dnl
779 dnl Configure for the detected libserf, giving preference to
780 dnl "--with-serf=<path>" if it was specified.
781 dnl
782 AC_DEFUN([APACHE_CHECK_SERF], [
783   AC_CACHE_CHECK([for libserf], [ac_cv_serf], [
784     ac_cv_serf=no
785     serf_prefix=/usr
786     SERF_LIBS=""
787     AC_ARG_WITH(serf, APACHE_HELP_STRING([--with-serf=PATH],
788                                     [Serf client library]),
789     [
790         if test "$withval" = "yes" ; then
791           serf_prefix=/usr
792         else
793           serf_prefix=$withval
794         fi
795     ])
796
797     if test "$serf_prefix" != "no" ; then
798       save_cppflags="$CPPFLAGS"
799       CPPFLAGS="$CPPFLAGS $APR_INCLUDES $APU_INCLUDES -I$serf_prefix/include/serf-0"
800       AC_CHECK_HEADERS(serf.h,[
801         save_ldflags="$LDFLAGS"
802         LDFLAGS="$LDFLAGS -L$serf_prefix/lib"
803         AC_CHECK_LIB(serf-0, serf_context_create,[ac_cv_serf="yes"])
804         LDFLAGS="$save_ldflags"])
805       CPPFLAGS="$save_cppflags"
806     fi
807   ])
808
809   APACHE_SUBST(SERF_LIBS)
810   if test "$ac_cv_serf" = "yes"; then
811     AC_DEFINE(HAVE_SERF, 1, [Define if libserf is available])
812     APR_SETVAR(SERF_LIBS, [-L$serf_prefix/lib -lserf-0])
813     APR_ADDTO(MOD_INCLUDES, [-I$serf_prefix/include/serf-0])
814   fi
815 ])
816
817 AC_DEFUN([APACHE_CHECK_SYSTEMD], [
818 dnl Check for systemd support for listen.c's socket activation.
819 case $host in
820 *-linux-*)
821    if test -n "$PKGCONFIG" && $PKGCONFIG --exists libsystemd; then
822       SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
823    elif test -n "$PKGCONFIG" && $PKGCONFIG --exists libsystemd-daemon; then
824       SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd-daemon`
825    else
826       AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon")
827    fi
828    if test -n "$SYSTEMD_LIBS"; then
829       AC_CHECK_HEADERS(systemd/sd-daemon.h)
830       if test "${ac_cv_header_systemd_sd_daemon_h}" = "no" || test -z "${SYSTEMD_LIBS}"; then
831         AC_MSG_WARN([Your system does not support systemd.])
832       else
833         APR_ADDTO(HTTPD_LIBS, [$SYSTEMD_LIBS])
834         AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is supported])
835       fi
836    fi
837    ;;
838 esac
839 ])
840
841 dnl
842 dnl APACHE_EXPORT_ARGUMENTS
843 dnl Export (via APACHE_SUBST) the various path-related variables that
844 dnl apache will use while generating scripts like autoconf and apxs and
845 dnl the default config file.
846
847 AC_DEFUN([APACHE_SUBST_EXPANDED_ARG],[
848   APR_EXPAND_VAR(exp_$1, [$]$1)
849   APACHE_SUBST(exp_$1)
850   APR_PATH_RELATIVE(rel_$1, [$]exp_$1, ${prefix})
851   APACHE_SUBST(rel_$1)
852 ])
853
854 AC_DEFUN([APACHE_EXPORT_ARGUMENTS],[
855   APACHE_SUBST_EXPANDED_ARG(exec_prefix)
856   APACHE_SUBST_EXPANDED_ARG(bindir)
857   APACHE_SUBST_EXPANDED_ARG(sbindir)
858   APACHE_SUBST_EXPANDED_ARG(libdir)
859   APACHE_SUBST_EXPANDED_ARG(libexecdir)
860   APACHE_SUBST_EXPANDED_ARG(mandir)
861   APACHE_SUBST_EXPANDED_ARG(sysconfdir)
862   APACHE_SUBST_EXPANDED_ARG(datadir)
863   APACHE_SUBST_EXPANDED_ARG(installbuilddir)
864   APACHE_SUBST_EXPANDED_ARG(errordir)
865   APACHE_SUBST_EXPANDED_ARG(iconsdir)
866   APACHE_SUBST_EXPANDED_ARG(htdocsdir)
867   APACHE_SUBST_EXPANDED_ARG(manualdir)
868   APACHE_SUBST_EXPANDED_ARG(cgidir)
869   APACHE_SUBST_EXPANDED_ARG(includedir)
870   APACHE_SUBST_EXPANDED_ARG(localstatedir)
871   APACHE_SUBST_EXPANDED_ARG(runtimedir)
872   APACHE_SUBST_EXPANDED_ARG(logfiledir)
873   APACHE_SUBST_EXPANDED_ARG(proxycachedir)
874   APACHE_SUBST_EXPANDED_ARG(statedir)
875 ])
876
877 dnl 
878 dnl APACHE_CHECK_APxVER({apr|apu}, major, minor, 
879 dnl                     [actions-if-ok], [actions-if-not-ok])
880 dnl
881 dnl Checks for APR or APR-util of given major/minor version or later; 
882 dnl if so, runs actions-if-ok; otherwise runs actions-if-not-ok if given.
883 dnl If the version is not satisfactory and actions-if-not-ok is not
884 dnl given, then an error is printed and the configure script is aborted.
885 dnl
886 dnl The first argument must be [apr] or [apu].
887 dnl
888 AC_DEFUN([APACHE_CHECK_APxVER], [
889 define(ap_ckver_major, translit($1, [apru], [APRU])[_MAJOR_VERSION])
890 define(ap_ckver_minor, translit($1, [apru], [APRU])[_MINOR_VERSION])
891 define(ap_ckver_cvar, [ap_cv_$1ver$2$3])
892 define(ap_ckver_name, ifelse([$1],[apr],[APR],[APR-util]))
893
894 ap_ckver_CPPFLAGS="$CPPFLAGS"
895 CPPFLAGS="$CPPFLAGS `$[$1]_config --includes`"
896
897 AC_CACHE_CHECK([for ap_ckver_name version $2.$3.0 or later], ap_ckver_cvar, [
898 AC_EGREP_CPP([good], [
899 #include <$1_version.h>
900 #if ]ap_ckver_major[ > $2 || (]ap_ckver_major[ == $2 && ]ap_ckver_minor[ >= $3)
901 good
902 #endif
903 ], [ap_ckver_cvar=yes], [ap_ckver_cvar=no])])
904
905 if test "$ap_ckver_cvar" = "yes"; then
906   ifelse([$4],[],[:],[$4])
907 else
908   ifelse([$5],[],[AC_MSG_ERROR([ap_ckver_name version $2.$3.0 or later is required])], [$5])
909 fi
910
911 CPPFLAGS="$ap_ckver_CPPFLAGS"
912
913 undefine([ap_ckver_major])
914 undefine([ap_ckver_minor])
915 undefine([ap_ckver_cvar])
916 undefine([ap_ckver_name])
917 ])
918
919 dnl
920 dnl APACHE_CHECK_VOID_PTR_LEN
921 dnl
922 dnl Checks if the size of a void pointer is at least as big as a "long" 
923 dnl integer type.
924 dnl
925 AC_DEFUN([APACHE_CHECK_VOID_PTR_LEN], [
926
927 AC_CACHE_CHECK([for void pointer length], [ap_cv_void_ptr_lt_long],
928 [AC_TRY_RUN([
929 int main(void)
930 {
931     return sizeof(void *) < sizeof(long); 
932 }], [ap_cv_void_ptr_lt_long=no], [ap_cv_void_ptr_lt_long=yes], 
933     [ap_cv_void_ptr_lt_long="cross compile - not checked"])])
934
935 if test "$ap_cv_void_ptr_lt_long" = "yes"; then
936     AC_MSG_ERROR([Size of "void *" is less than size of "long"])
937 fi
938 ])
939
940 dnl
941 dnl APACHE_CHECK_APR_HAS_LDAP
942 dnl
943 dnl Check if APR_HAS_LDAP is 1
944 dnl Unfortunately, we can't use APR_CHECK_APR_DEFINE (because it only includes apr.h)
945 dnl or APR_CHECK_DEFINE (because it only checks for defined'ness and not for 0/1).
946 dnl
947 AC_DEFUN([APACHE_CHECK_APR_HAS_LDAP], [
948   AC_CACHE_CHECK([for ldap support in apr/apr-util],ac_cv_APR_HAS_LDAP,[
949     apache_old_cppflags="$CPPFLAGS"
950     CPPFLAGS="$CPPFLAGS $INCLUDES"
951     AC_EGREP_CPP(YES_IS_DEFINED, [
952 #include <apr_ldap.h>
953 #if APR_HAS_LDAP
954 YES_IS_DEFINED
955 #endif
956     ], ac_cv_APR_HAS_LDAP=yes, ac_cv_APR_HAS_LDAP=no)
957     CPPFLAGS="$apache_old_cppflags"
958   ])
959 ])
960
961 dnl
962 dnl APACHE_ADD_GCC_CFLAG
963 dnl
964 dnl Check if compiler is gcc and supports flag. If yes, add to NOTEST_CFLAGS.
965 dnl NOTEST_CFLAGS is merged lately, thus it won't accumulate in CFLAGS here.
966 dnl Also, AC_LANG_PROGRAM() itself is known to trigger [-Wstrict-prototypes]
967 dnl with some autoconf versions, so we force -Wno-strict-prototypes for the
968 dnl check to avoid spurious failures when adding flags like -Werror.
969 dnl
970 AC_DEFUN([APACHE_ADD_GCC_CFLAG], [
971   define([ap_gcc_ckvar], [ac_cv_gcc_]translit($1, [-:.=], [____]))
972   if test "$GCC" = "yes"; then
973     AC_CACHE_CHECK([whether gcc accepts $1], ap_gcc_ckvar, [
974       save_CFLAGS="$CFLAGS"
975       CFLAGS="$CFLAGS $1 -Wno-strict-prototypes"
976       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
977         [ap_gcc_ckvar=yes], [ap_gcc_ckvar=no])
978       CFLAGS="$save_CFLAGS"
979     ])
980     if test "$]ap_gcc_ckvar[" = "yes" ; then
981        APR_ADDTO(NOTEST_CFLAGS,[$1])
982     fi
983   fi
984   undefine([ap_gcc_ckvar])
985 ])
986
987
988 dnl
989 dnl APACHE_CHECK_JANSSON
990 dnl
991 dnl Configure for libjansson, giving preference to
992 dnl "--with-jansson=<path>" if it was specified.
993 dnl
994 AC_DEFUN([APACHE_CHECK_JANSSON],[
995   AC_CACHE_CHECK([for jansson], [ac_cv_jansson], [
996     dnl initialise the variables we use
997     ac_cv_jansson=no
998     ap_jansson_found=""
999     ap_jansson_base=""
1000     ap_jansson_libs=""
1001
1002     dnl Determine the jansson base directory, if any
1003     AC_MSG_CHECKING([for user-provided jansson base directory])
1004     AC_ARG_WITH(jansson, APACHE_HELP_STRING(--with-jansson=PATH, jansson installation directory), [
1005       dnl If --with-jansson specifies a directory, we use that directory
1006       if test "x$withval" != "xyes" -a "x$withval" != "x"; then
1007         dnl This ensures $withval is actually a directory and that it is absolute
1008         ap_jansson_base="`cd $withval ; pwd`"
1009       fi
1010     ])
1011     if test "x$ap_jansson_base" = "x"; then
1012       AC_MSG_RESULT(none)
1013     else
1014       AC_MSG_RESULT($ap_jansson_base)
1015     fi
1016
1017     dnl Run header and version checks
1018     saved_CPPFLAGS="$CPPFLAGS"
1019     saved_LIBS="$LIBS"
1020     saved_LDFLAGS="$LDFLAGS"
1021
1022     dnl Before doing anything else, load in pkg-config variables
1023     if test -n "$PKGCONFIG"; then
1024       saved_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
1025       AC_MSG_CHECKING([for pkg-config along $PKG_CONFIG_PATH])
1026       if test "x$ap_jansson_base" != "x" ; then
1027         if test -f "${ap_jansson_base}/lib/pkgconfig/libjansson.pc"; then
1028           dnl Ensure that the given path is used by pkg-config too, otherwise
1029           dnl the system libjansson.pc might be picked up instead.
1030           PKG_CONFIG_PATH="${ap_jansson_base}/lib/pkgconfig${PKG_CONFIG_PATH+:}${PKG_CONFIG_PATH}"
1031           export PKG_CONFIG_PATH
1032         elif test -f "${ap_jansson_base}/lib64/pkgconfig/libjansson.pc"; then
1033           dnl Ensure that the given path is used by pkg-config too, otherwise
1034           dnl the system libjansson.pc might be picked up instead.
1035           PKG_CONFIG_PATH="${ap_jansson_base}/lib64/pkgconfig${PKG_CONFIG_PATH+:}${PKG_CONFIG_PATH}"
1036           export PKG_CONFIG_PATH
1037         fi
1038       fi
1039       AC_ARG_ENABLE(jansson-staticlib-deps,APACHE_HELP_STRING(--enable-jansson-staticlib-deps,[link mod_md with dependencies of libjansson's static libraries (as indicated by "pkg-config --static"). Must be specified in addition to --enable-md.]), [
1040         if test "$enableval" = "yes"; then
1041           PKGCONFIG_LIBOPTS="--static"
1042         fi
1043       ])
1044       ap_jansson_libs="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-l --silence-errors libjansson`"
1045       if test $? -eq 0; then
1046         ap_jansson_found="yes"
1047         pkglookup="`$PKGCONFIG --cflags-only-I libjansson`"
1048         APR_ADDTO(CPPFLAGS, [$pkglookup])
1049         APR_ADDTO(MOD_CFLAGS, [$pkglookup])
1050         pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-L libjansson`"
1051         APR_ADDTO(LDFLAGS, [$pkglookup])
1052         APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
1053         pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-other libjansson`"
1054         APR_ADDTO(LDFLAGS, [$pkglookup])
1055         APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
1056       fi
1057       PKG_CONFIG_PATH="$saved_PKG_CONFIG_PATH"
1058     fi
1059
1060     dnl fall back to the user-supplied directory if not found via pkg-config
1061     if test "x$ap_jansson_base" != "x" -a "x$ap_jansson_found" = "x"; then
1062       APR_ADDTO(CPPFLAGS, [-I$ap_jansson_base/include])
1063       APR_ADDTO(MOD_CFLAGS, [-I$ap_jansson_base/include])
1064       APR_ADDTO(LDFLAGS, [-L$ap_jansson_base/lib])
1065       APR_ADDTO(MOD_LDFLAGS, [-L$ap_jansson_base/lib])
1066       if test "x$ap_platform_runtime_link_flag" != "x"; then
1067         APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_jansson_base/lib])
1068         APR_ADDTO(MOD_LDFLAGS, [$ap_platform_runtime_link_flag$ap_jansson_base/lib])
1069       fi
1070     fi
1071
1072     # attempts to include jansson.h fail me. So lets make sure we can at least
1073     # include its other header file
1074     AC_TRY_COMPILE([#include <jansson_config.h>],[],
1075       [AC_MSG_RESULT(OK) 
1076        ac_cv_jansson=yes], 
1077        [AC_MSG_RESULT(FAILED)])
1078
1079     if test "x$ac_cv_jansson" = "xyes"; then
1080       ap_jansson_libs="${ap_jansson_libs:--ljansson} `$apr_config --libs`"
1081       APR_ADDTO(MOD_LDFLAGS, [$ap_jansson_libs])
1082       APR_ADDTO(LIBS, [$ap_jansson_libs])
1083     fi
1084
1085     dnl restore
1086     CPPFLAGS="$saved_CPPFLAGS"
1087     LIBS="$saved_LIBS"
1088     LDFLAGS="$saved_LDFLAGS"
1089   ])
1090   if test "x$ac_cv_jansson" = "xyes"; then
1091     AC_DEFINE(HAVE_JANSSON, 1, [Define if jansson is available])
1092   fi
1093 ])