2 dnl APACHE_SUBST(VARIABLE)
3 dnl Makes VARIABLE available in generated files
4 dnl (do not use @variable@ in Makefiles, but $(variable))
5 AC_DEFUN(APACHE_SUBST,[
6 APACHE_VAR_SUBST="$APACHE_VAR_SUBST $1"
10 dnl APACHE_FAST_OUTPUT(FILENAME)
11 dnl Perform substitutions on FILENAME (Makefiles only)
12 AC_DEFUN(APACHE_FAST_OUTPUT,[
13 APACHE_FAST_OUTPUT_FILES="$APACHE_FAST_OUTPUT_FILES $1"
16 dnl APACHE_MKDIR_P_CHECK
17 dnl checks whether mkdir -p works
18 AC_DEFUN(APACHE_MKDIR_P_CHECK,[
19 AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
20 test -d conftestdir && rm -rf conftestdir
21 mkdir -p conftestdir/somedir >/dev/null 2>&1
22 if test -d conftestdir/somedir; then
31 dnl APACHE_GEN_CONFIG_VARS
32 dnl Creates config_vars.mk
33 AC_DEFUN(APACHE_GEN_CONFIG_VARS,[
34 APACHE_SUBST(abs_srcdir)
38 APACHE_SUBST(logfiledir)
39 APACHE_SUBST(exec_prefix)
41 APACHE_SUBST(localstatedir)
42 APACHE_SUBST(libexecdir)
43 APACHE_SUBST(htdocsdir)
44 APACHE_SUBST(includedir)
45 APACHE_SUBST(iconsdir)
46 APACHE_SUBST(sysconfdir)
47 APACHE_SUBST(other_targets)
48 APACHE_SUBST(progname)
54 APACHE_SUBST(CPPFLAGS)
56 APACHE_SUBST(CXXFLAGS)
59 APACHE_SUBST(LT_LDFLAGS)
60 APACHE_SUBST(SH_LDFLAGS)
61 APACHE_SUBST(HTTPD_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)
78 APACHE_SUBST(MODULE_DIRS)
80 APACHE_SUBST(CORE_IMPLIB_FILE)
81 APACHE_SUBST(CORE_IMPLIB)
82 APACHE_SUBST(SH_LIBTOOL)
83 APACHE_SUBST(MK_IMPLIB)
84 APACHE_SUBST(INSTALL_PROG_FLAGS)
86 abs_srcdir="`(cd $srcdir && pwd)`"
89 echo creating config_vars.mk
91 for i in $APACHE_VAR_SUBST; do
92 eval echo "$i = \$$i" >> config_vars.mk
96 dnl APACHE_GEN_MAKEFILES
98 AC_DEFUN(APACHE_GEN_MAKEFILES,[
99 $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
102 dnl ## APACHE_OUTPUT(file)
103 dnl ## adds "file" to the list of files generated by AC_OUTPUT
104 dnl ## This macro can be used several times.
105 AC_DEFUN(APACHE_OUTPUT, [
106 APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
110 dnl APACHE_TYPE_RLIM_T
112 dnl If rlim_t is not defined, define it to int
114 AC_DEFUN(APACHE_TYPE_RLIM_T, [
115 AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
117 #include <sys/types.h>
118 #include <sys/time.h>
119 #include <sys/resource.h>
120 ], [rlim_t spoon;], [
121 ac_cv_type_rlim_t=yes
122 ],[ac_cv_type_rlim_t=no
125 if test "$ac_cv_type_rlim_t" = "no" ; then
126 AC_DEFINE(rlim_t, int,
127 [Define to 'int' if <sys/resource.h> doesn't define it for us])
131 dnl APACHE_MODPATH_INIT(modpath)
132 AC_DEFUN(APACHE_MODPATH_INIT,[
134 modpath_current=modules/$1
137 test -d $1 || $srcdir/build/mkdir.sh $modpath_current
138 > $modpath_current/modules.mk
141 AC_DEFUN(APACHE_MODPATH_FINISH,[
142 echo "DISTCLEAN_TARGETS = modules.mk" >> $modpath_current/modules.mk
143 echo "static = $modpath_static" >> $modpath_current/modules.mk
144 echo "shared = $modpath_shared" >> $modpath_current/modules.mk
145 if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
146 MODULE_DIRS="$MODULE_DIRS $current_dir"
148 APACHE_FAST_OUTPUT($modpath_current/Makefile)
151 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
152 AC_DEFUN(APACHE_MODPATH_ADD,[
153 if test -z "$3"; then
159 if test -z "$module_standalone"; then
160 if test -z "$2"; then
162 BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
163 modpath_static="$modpath_static $libname"
164 cat >>$modpath_current/modules.mk<<EOF
166 \$(MOD_LINK) $objects
169 apache_need_shared=yes
171 shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
172 modpath_shared="$modpath_shared $libname"
173 cat >>$modpath_current/modules.mk<<EOF
175 \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
182 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
184 dnl default is one of:
185 dnl yes -- enabled by default. user must explicitly disable.
186 dnl no -- disabled under default, most, all. user must explicitly enable.
187 dnl most -- disabled by default. enabled explicitly or with most or all.
188 dnl "" -- disabled under default, most. enabled explicitly or with all.
190 dnl basically: yes/no is a hard setting. "most" means follow the "most"
191 dnl setting. otherwise, fall under the "all" setting.
192 dnl explicit yes/no always overrides.
194 AC_DEFUN(APACHE_MODULE,[
195 AC_MSG_CHECKING(whether to enable mod_$1)
196 define([optname],[ --]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
197 AC_ARG_ENABLE(translit($1,_,-),optname() substr([ ],len(optname()))$2,,enable_$1=ifelse($5,,maybe-all,$5))
198 undefine([optname])dnl
200 if test "$enable_$1" = "most"; then
201 if test "$module_selection" = "most" -o "$module_selection" = "all"; then
202 enable_$1=$module_default
203 _apmod_extra_msg=" ($module_selection)"
207 elif test "$enable_$1" = "maybe-all"; then
208 if test "$module_selection" = "all"; then
209 enable_$1=$module_default
210 _apmod_extra_msg=" (all)"
215 AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
216 if test "$enable_$1" != "no"; then
219 enable_$1=`echo $ac_n $enable_$1$ac_c|sed 's/shared,*//'`
223 MODLIST="$MODLIST ifelse($4,,$1,$4)"
224 if test "$1" = "so"; then
230 APACHE_MODPATH_ADD($1, $shared, $3)
234 dnl APACHE_LAYOUT(configlayout, layoutname)
235 AC_DEFUN(APACHE_LAYOUT,[
236 if test ! -f $srcdir/config.layout; then
237 echo "** Error: Layout file $srcdir/config.layout not found"
238 echo "** Error: Cannot use undefined layout '$LAYOUT'"
243 sed -e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \
244 -e '/[ ]*<\/Layout>[ ]*/,$d' \
252 for var in prefix exec_prefix bindir sbindir libexecdir mandir \
253 sysconfdir datadir iconsdir htdocsdir cgidir includedir \
254 localstatedir runtimedir logfiledir proxycachedir; do
255 eval "val=\"\$$var\""
258 val=`echo $val | sed -e 's;\+$;;'`
259 eval "$var=\"\$val\""
266 val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
267 val=`echo $val | sed -e 's:$\([a-z_]*\):$(\1):g'`
268 if test "$autosuffix" = "yes"; then
269 if echo $val | grep apache >/dev/null; then
274 if test "$addtarget" = "yes"; then
283 dnl APACHE_ENABLE_LAYOUT
285 AC_DEFUN(APACHE_ENABLE_LAYOUT,[
286 AC_ARG_ENABLE(layout,
287 [ --enable-layout=LAYOUT],[
291 if test -z "$LAYOUT"; then
292 # XXX FIXME: this isn't a complete list of things that have to be set to
293 # create the Apache layout in config.layout, and it really should just
294 # use what is specified in config.layout instead of duping it.
295 htdocsdir='$(prefix)/htdocs'
296 iconsdir='$(prefix)/icons'
297 cgidir='$(prefix)/cgi-bin'
298 logfiledir='$(prefix)/logs'
299 sysconfdir='${prefix}/conf'
300 libexecdir='${prefix}/modules'
303 APACHE_LAYOUT($srcdir/config.layout, $LAYOUT)
306 AC_MSG_CHECKING(for chosen layout)
307 AC_MSG_RESULT($layout_name)
311 dnl APACHE_ENABLE_MODULES
313 AC_DEFUN(APACHE_ENABLE_MODULES,[
314 module_selection=default
317 AC_ARG_ENABLE(modules,
318 [ --enable-modules=MODULE-LIST],[
319 for i in $enableval; do
320 if test "$i" = "all" -o "$i" = "most"; then
328 AC_ARG_ENABLE(mods-shared,
329 [ --enable-mods-shared=MODULE-LIST],[
330 for i in $enableval; do
331 if test "$i" = "all" -o "$i" = "most"; then
333 module_default=shared
335 i=`echo $i | sed 's/-/_/g'`
336 eval "enable_$i=shared"
342 AC_DEFUN(APACHE_REQUIRE_CXX,[
343 if test -z "$apache_cxx_done"; then
351 dnl APACHE_CHECK_SSL_TOOLKIT
353 dnl Find the openssl toolkit installation and check it for the right
354 dnl version, then add its flags to INCLUDES and LIBS. This should
355 dnl really be using a custom AC_TRY_COMPILE function to test the includes
356 dnl and then AC_TRY_LINK to test the libraries directly for the version,
357 dnl but that will require someone who knows how to program openssl.
359 AC_DEFUN(APACHE_CHECK_SSL_TOOLKIT,[
360 if test "x$ap_ssltk_base" = "x"; then
361 AC_MSG_CHECKING(for SSL/TLS toolkit base)
363 AC_ARG_WITH(ssl, [ --with-ssl[=DIR] SSL/TLS toolkit (OpenSSL)], [
364 if test "x$withval" != "xyes" -a "x$withval" != "x"; then
365 ap_ssltk_base="$withval"
368 if test "x$ap_ssltk_base" = "x"; then
369 AC_CACHE_VAL(ap_cv_ssltk,[
371 # shotgun approach: find all occurrences of the openssl program
374 for p in /usr/local/openssl/bin /usr/local/ssl/bin $path; do
375 if test -f "$p/openssl"; then
376 ap_ssltk_try="$ap_ssltk_try $p"
379 if test "x$ap_ssltk_try" = "x"; then
380 AC_MSG_ERROR(['openssl' not found in path])
382 for p in $ap_ssltk_try; do
383 ap_ssltk_version="`$p/openssl version`"
384 case "$ap_ssltk_version" in
385 "OpenSSL "[[1-9]]* | \
386 "OpenSSL "0.9.[[6-9]]* | \
387 "OpenSSL "0.[[1-9]][[0-9]]* )
388 ap_cv_ssltk="`(cd $p/.. && pwd)`"
392 # skip because it is too old or a bad result
396 if test "x$ap_cv_ssltk" = "x"; then
397 AC_MSG_ERROR([requires OpenSSL 0.9.6 or higher])
400 ap_ssltk_base="$ap_cv_ssltk"
402 if test ! -d $ap_ssltk_base; then
403 AC_MSG_ERROR([invalid SSL/TLS toolkit base directory $ap_ssltk_base])
405 AC_MSG_RESULT($ap_ssltk_base)
407 AC_MSG_CHECKING(for SSL/TLS toolkit version)
408 AC_MSG_RESULT($ap_ssltk_version)
410 AC_MSG_CHECKING(for SSL/TLS toolkit includes)
412 for p in $ap_ssltk_base/include /usr/local/openssl/include \
413 /usr/local/ssl/include /usr/local/include /usr/include; do
414 if test -f "$p/openssl/ssl.h"; then
419 if test "x$ap_ssltk_incdir" = "x"; then
420 AC_MSG_ERROR([OpenSSL headers not found])
422 AC_MSG_RESULT($ap_ssltk_incdir)
424 AC_MSG_CHECKING(for SSL/TLS toolkit libraries)
426 for p in $ap_ssltk_base/lib /usr/local/openssl/lib \
427 /usr/local/ssl/lib /usr/local/lib /usr/lib /lib; do
428 if test -f "$p/libssl.a" -o -f "$p/libssl.so"; then
433 if test ".$ap_ssltk_libdir" = .; then
434 AC_MSG_ERROR([OpenSSL libraries not found])
436 AC_MSG_RESULT($ap_ssltk_libdir)
438 dnl # annotate the Apache build environment with determined information
439 if test "x$ap_ssltk_incdir" != "x/usr/include"; then
440 APR_ADDTO(INCLUDES, [-I$ap_ssltk_incdir])
442 if test "x$ap_ssltk_libdir" != "x/usr/lib"; then
443 APR_ADDTO(LIBS, [-L$ap_ssltk_libdir])
444 if test "x$ap_platform_runtime_link_flag" != "x"; then
445 APR_ADDTO(LIBS, [$ap_platform_runtime_link_flag$ap_ssltk_libdir])
448 APR_ADDTO(LIBS, [-lssl -lcrypto])
449 ap_cv_ssltk="$ap_ssltk_base"