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(SH_LDFLAGS)
60 APACHE_SUBST(HTTPD_LDFLAGS)
63 APACHE_SUBST(INCLUDES)
64 APACHE_SUBST(NOTEST_CPPFLAGS)
65 APACHE_SUBST(NOTEST_CFLAGS)
66 APACHE_SUBST(NOTEST_CXXFLAGS)
67 APACHE_SUBST(NOTEST_LDFLAGS)
68 APACHE_SUBST(NOTEST_LIBS)
69 APACHE_SUBST(EXTRA_CPPFLAGS)
70 APACHE_SUBST(EXTRA_CFLAGS)
71 APACHE_SUBST(EXTRA_CXXFLAGS)
72 APACHE_SUBST(EXTRA_LDFLAGS)
73 APACHE_SUBST(EXTRA_LIBS)
74 APACHE_SUBST(EXTRA_INCLUDES)
77 APACHE_SUBST(MODULE_DIRS)
79 APACHE_SUBST(CORE_IMPLIB_FILE)
80 APACHE_SUBST(CORE_IMPLIB)
81 APACHE_SUBST(SH_LIBTOOL)
82 APACHE_SUBST(MK_IMPLIB)
83 APACHE_SUBST(INSTALL_PROG_FLAGS)
85 abs_srcdir="`(cd $srcdir && pwd)`"
88 echo creating config_vars.mk
90 for i in $APACHE_VAR_SUBST; do
91 eval echo "$i = \$$i" >> config_vars.mk
95 dnl APACHE_GEN_MAKEFILES
97 AC_DEFUN(APACHE_GEN_MAKEFILES,[
98 $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
101 dnl ## APACHE_OUTPUT(file)
102 dnl ## adds "file" to the list of files generated by AC_OUTPUT
103 dnl ## This macro can be used several times.
104 AC_DEFUN(APACHE_OUTPUT, [
105 APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
109 dnl APACHE_TYPE_RLIM_T
111 dnl If rlim_t is not defined, define it to int
113 AC_DEFUN(APACHE_TYPE_RLIM_T, [
114 AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
116 #include <sys/types.h>
117 #include <sys/time.h>
118 #include <sys/resource.h>
119 ], [rlim_t spoon;], [
120 ac_cv_type_rlim_t=yes
121 ],[ac_cv_type_rlim_t=no
124 if test "$ac_cv_type_rlim_t" = "no" ; then
125 AC_DEFINE(rlim_t, int,
126 [Define to 'int' if <sys/resource.h> doesn't define it for us])
130 dnl APACHE_MODPATH_INIT(modpath)
131 AC_DEFUN(APACHE_MODPATH_INIT,[
133 modpath_current=modules/$1
136 test -d $1 || $srcdir/build/mkdir.sh $modpath_current
137 > $modpath_current/modules.mk
140 AC_DEFUN(APACHE_MODPATH_FINISH,[
141 echo "DISTCLEAN_TARGETS = modules.mk" >> $modpath_current/modules.mk
142 echo "static = $modpath_static" >> $modpath_current/modules.mk
143 echo "shared = $modpath_shared" >> $modpath_current/modules.mk
144 if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
145 MODULE_DIRS="$MODULE_DIRS $current_dir"
147 APACHE_FAST_OUTPUT($modpath_current/Makefile)
150 dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
151 AC_DEFUN(APACHE_MODPATH_ADD,[
152 if test -z "$3"; then
158 if test -z "$module_standalone"; then
159 if test -z "$2"; then
161 BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
162 modpath_static="$modpath_static $libname"
163 cat >>$modpath_current/modules.mk<<EOF
165 \$(MOD_LINK) $objects
168 apache_need_shared=yes
170 shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
171 modpath_shared="$modpath_shared $libname"
172 cat >>$modpath_current/modules.mk<<EOF
174 \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
181 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
183 dnl default is one of:
184 dnl yes -- enabled by default. user must explicitly disable.
185 dnl no -- disabled under default, most, all. user must explicitly enable.
186 dnl most -- disabled by default. enabled explicitly or with most or all.
187 dnl "" -- disabled under default, most. enabled explicitly or with all.
189 dnl basically: yes/no is a hard setting. "most" means follow the "most"
190 dnl setting. otherwise, fall under the "all" setting.
191 dnl explicit yes/no always overrides.
193 AC_DEFUN(APACHE_MODULE,[
194 AC_MSG_CHECKING(whether to enable mod_$1)
195 define([optname],[ --]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
196 AC_ARG_ENABLE(translit($1,_,-),optname() substr([ ],len(optname()))$2,,enable_$1=ifelse($5,,maybe-all,$5))
197 undefine([optname])dnl
199 if test "$enable_$1" = "most"; then
200 if test "$module_selection" = "most" -o "$module_selection" = "all"; then
201 enable_$1=$module_default
202 _apmod_extra_msg=" ($module_selection)"
206 elif test "$enable_$1" = "maybe-all"; then
207 if test "$module_selection" = "all"; then
208 enable_$1=$module_default
209 _apmod_extra_msg=" (all)"
214 AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
215 if test "$enable_$1" != "no"; then
218 enable_$1=`echo $ac_n $enable_$1$ac_c|sed 's/shared,*//'`
222 MODLIST="$MODLIST ifelse($4,,$1,$4)"
223 if test "$1" = "so"; then
229 APACHE_MODPATH_ADD($1, $shared, $3)
233 dnl APACHE_LAYOUT(configlayout, layoutname)
234 AC_DEFUN(APACHE_LAYOUT,[
235 if test ! -f $srcdir/config.layout; then
236 echo "** Error: Layout file $srcdir/config.layout not found"
237 echo "** Error: Cannot use undefined layout '$LAYOUT'"
242 sed -e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \
243 -e '/[ ]*<\/Layout>[ ]*/,$d' \
251 for var in prefix exec_prefix bindir sbindir libexecdir mandir \
252 sysconfdir datadir iconsdir htdocsdir cgidir includedir \
253 localstatedir runtimedir logfiledir proxycachedir; do
254 eval "val=\"\$$var\""
257 val=`echo $val | sed -e 's;\+$;;'`
258 eval "$var=\"\$val\""
265 val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
266 val=`echo $val | sed -e 's:$\([a-z_]*\):$(\1):g'`
267 if test "$autosuffix" = "yes"; then
268 if echo $val | grep apache >/dev/null; then
273 if test "$addtarget" = "yes"; then
282 dnl APACHE_ENABLE_LAYOUT
284 AC_DEFUN(APACHE_ENABLE_LAYOUT,[
285 AC_ARG_ENABLE(layout,
286 [ --enable-layout=LAYOUT],[
290 if test -z "$LAYOUT"; then
291 # XXX FIXME: this isn't a complete list of things that have to be set to
292 # create the Apache layout in config.layout, and it really should just
293 # use what is specified in config.layout instead of duping it.
294 htdocsdir='$(prefix)/htdocs'
295 iconsdir='$(prefix)/icons'
296 cgidir='$(prefix)/cgi-bin'
297 logfiledir='$(prefix)/logs'
298 sysconfdir='${prefix}/conf'
299 libexecdir='${prefix}/modules'
302 APACHE_LAYOUT($srcdir/config.layout, $LAYOUT)
305 AC_MSG_CHECKING(for chosen layout)
306 AC_MSG_RESULT($layout_name)
310 dnl APACHE_ENABLE_MODULES
312 AC_DEFUN(APACHE_ENABLE_MODULES,[
313 module_selection=default
316 AC_ARG_ENABLE(modules,
317 [ --enable-modules=MODULE-LIST],[
318 for i in $enableval; do
319 if test "$i" = "all" -o "$i" = "most"; then
327 AC_ARG_ENABLE(mods-shared,
328 [ --enable-mods-shared=MODULE-LIST],[
329 for i in $enableval; do
330 if test "$i" = "all" -o "$i" = "most"; then
332 module_default=shared
334 i=`echo $i | sed 's/-/_/g'`
335 eval "enable_$i=shared"
341 AC_DEFUN(APACHE_REQUIRE_CXX,[
342 if test -z "$apache_cxx_done"; then
350 dnl APACHE_CHECK_SSL_TOOLKIT
352 dnl Find the openssl toolkit installation and check it for the right
353 dnl version, then add its flags to INCLUDES and LIBS. This should
354 dnl really be using a custom AC_TRY_COMPILE function to test the includes
355 dnl and then AC_TRY_LINK to test the libraries directly for the version,
356 dnl but that will require someone who knows how to program openssl.
358 AC_DEFUN(APACHE_CHECK_SSL_TOOLKIT,[
359 if test "x$ap_ssltk_base" = "x"; then
360 AC_MSG_CHECKING(for SSL/TLS toolkit base)
362 AC_ARG_WITH(ssl, [ --with-ssl[=DIR] SSL/TLS toolkit (OpenSSL)], [
363 if test "x$withval" != "xyes" -a "x$withval" != "x"; then
364 ap_ssltk_base="$withval"
367 if test "x$ap_ssltk_base" = "x"; then
368 AC_CACHE_VAL(ap_cv_ssltk,[
370 # shotgun approach: find all occurrences of the openssl program
373 for p in /usr/local/openssl/bin /usr/local/ssl/bin $path; do
374 if test -f "$p/openssl"; then
375 ap_ssltk_try="$ap_ssltk_try $p"
378 if test "x$ap_ssltk_try" = "x"; then
379 AC_MSG_ERROR(['openssl' not found in path])
381 for p in $ap_ssltk_try; do
382 ap_ssltk_version="`$p/openssl version`"
383 case "$ap_ssltk_version" in
384 *[[!0-9a-z.]][[1-9]]* | \
385 *[[!0-9a-z.]]0.9.[[6-9]]* | \
386 *[[!0-9a-z.]]0.[[1-9]][[0-9]]* )
387 ap_cv_ssltk="`(cd $p/.. && pwd)`"
391 # skip because it is too old or a bad result
395 if test "x$ap_cv_ssltk" = "x"; then
396 AC_MSG_ERROR([requires OpenSSL 0.9.6 or higher])
399 ap_ssltk_base="$ap_cv_ssltk"
401 if test ! -d $ap_ssltk_base; then
402 AC_MSG_ERROR([invalid SSL/TLS toolkit base directory $ap_ssltk_base])
404 AC_MSG_RESULT($ap_ssltk_base)
406 AC_MSG_CHECKING(for SSL/TLS toolkit version)
407 AC_MSG_RESULT($ap_ssltk_version)
409 AC_MSG_CHECKING(for SSL/TLS toolkit includes)
411 for p in $ap_ssltk_base/include /usr/local/openssl/include \
412 /usr/local/ssl/include /usr/local/include /usr/include; do
413 if test -f "$p/openssl/ssl.h"; then
418 if test "x$ap_ssltk_incdir" = "x"; then
419 AC_MSG_ERROR([OpenSSL headers not found])
421 AC_MSG_RESULT($ap_ssltk_incdir)
423 AC_MSG_CHECKING(for SSL/TLS toolkit libraries)
425 for p in $ap_ssltk_base/lib /usr/local/openssl/lib \
426 /usr/local/ssl/lib /usr/local/lib /usr/lib /lib; do
427 if test -f "$p/libssl.a" -o -f "$p/libssl.so"; then
432 if test ".$ap_ssltk_libdir" = .; then
433 AC_MSG_ERROR([OpenSSL libraries not found])
435 AC_MSG_RESULT($ap_ssltk_libdir)
437 dnl # annotate the Apache build environment with determined information
438 if test "x$ap_ssltk_incdir" != "x/usr/include"; then
439 APR_ADDTO(INCLUDES, [-I$ap_ssltk_incdir])
441 if test "x$ap_ssltk_libdir" != "x/usr/lib"; then
442 APR_ADDTO(LIBS, [-L$ap_ssltk_libdir])
443 if test "x$ap_platform_runtime_link_flag" != "x"; then
444 APR_ADDTO(LIBS, [$ap_platform_runtime_link_flag$ap_ssltk_libdir])
447 APR_ADDTO(LIBS, [-lssl -lcrypto])
448 ap_cv_ssltk="$ap_ssltk_base"