acinclude.m4 revision ec9b5c4854a4055d00f5459dbbd879d517f1531d
165N/A
165N/Adnl APACHE_SUBST(VARIABLE)
165N/Adnl Makes VARIABLE available in generated files
165N/Adnl (do not use @variable@ in Makefiles, but $(variable))
165N/AAC_DEFUN(APACHE_SUBST,[
165N/A APACHE_VAR_SUBST="$APACHE_VAR_SUBST $1"
165N/A AC_SUBST($1)
165N/A])
165N/A
165N/Adnl APACHE_FAST_OUTPUT(FILENAME)
165N/Adnl Perform substitutions on FILENAME (Makefiles only)
165N/AAC_DEFUN(APACHE_FAST_OUTPUT,[
165N/A APACHE_FAST_OUTPUT_FILES="$APACHE_FAST_OUTPUT_FILES $1"
165N/A])
165N/A
165N/Adnl APACHE_MKDIR_P_CHECK
165N/Adnl checks whether mkdir -p works
165N/AAC_DEFUN(APACHE_MKDIR_P_CHECK,[
165N/A AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
165N/A test -d conftestdir && rm -rf conftestdir
165N/A mkdir -p conftestdir/somedir >/dev/null 2>&1
5680N/A if test -d conftestdir/somedir; then
165N/A ac_cv_mkdir_p=yes
5680N/A else
5680N/A ac_cv_mkdir_p=no
5680N/A fi
165N/A rm -rf conftestdir
165N/A ])
165N/A])
4921N/A
4921N/Adnl APACHE_GEN_CONFIG_VARS
4921N/Adnl Creates config_vars.mk
4921N/AAC_DEFUN(APACHE_GEN_CONFIG_VARS,[
4921N/A APACHE_SUBST(abs_srcdir)
165N/A APACHE_SUBST(bindir)
5680N/A APACHE_SUBST(sbindir)
5680N/A APACHE_SUBST(cgidir)
165N/A APACHE_SUBST(logfiledir)
3831N/A APACHE_SUBST(exec_prefix)
3831N/A APACHE_SUBST(datadir)
5680N/A APACHE_SUBST(localstatedir)
5680N/A APACHE_SUBST(mandir)
5680N/A APACHE_SUBST(libexecdir)
5680N/A APACHE_SUBST(htdocsdir)
2456N/A APACHE_SUBST(manualdir)
5680N/A APACHE_SUBST(includedir)
165N/A APACHE_SUBST(errordir)
3831N/A APACHE_SUBST(iconsdir)
165N/A APACHE_SUBST(sysconfdir)
165N/A APACHE_SUBST(installbuilddir)
165N/A APACHE_SUBST(other_targets)
3831N/A APACHE_SUBST(progname)
6192N/A APACHE_SUBST(prefix)
6192N/A APACHE_SUBST(AWK)
3831N/A APACHE_SUBST(CC)
3831N/A APACHE_SUBST(CPP)
165N/A APACHE_SUBST(CXX)
5680N/A APACHE_SUBST(CPPFLAGS)
5680N/A APACHE_SUBST(CFLAGS)
5680N/A APACHE_SUBST(CXXFLAGS)
165N/A APACHE_SUBST(LTFLAGS)
165N/A APACHE_SUBST(LDFLAGS)
165N/A APACHE_SUBST(LT_LDFLAGS)
165N/A APACHE_SUBST(SH_LDFLAGS)
165N/A APACHE_SUBST(HTTPD_LDFLAGS)
165N/A APACHE_SUBST(LIBS)
6192N/A APACHE_SUBST(DEFS)
165N/A APACHE_SUBST(INCLUDES)
165N/A APACHE_SUBST(NOTEST_CPPFLAGS)
6192N/A APACHE_SUBST(NOTEST_CFLAGS)
5680N/A APACHE_SUBST(NOTEST_CXXFLAGS)
4269N/A APACHE_SUBST(NOTEST_LDFLAGS)
4269N/A APACHE_SUBST(NOTEST_LIBS)
4269N/A APACHE_SUBST(EXTRA_CPPFLAGS)
4269N/A APACHE_SUBST(EXTRA_CFLAGS)
4269N/A APACHE_SUBST(EXTRA_CXXFLAGS)
165N/A APACHE_SUBST(EXTRA_LDFLAGS)
165N/A APACHE_SUBST(EXTRA_LIBS)
4269N/A APACHE_SUBST(EXTRA_INCLUDES)
5680N/A APACHE_SUBST(LIBTOOL)
4269N/A APACHE_SUBST(SHELL)
4269N/A APACHE_SUBST(MODULE_DIRS)
4269N/A APACHE_SUBST(MODULE_CLEANDIRS)
4269N/A APACHE_SUBST(PORT)
4269N/A APACHE_SUBST(CORE_IMPLIB_FILE)
165N/A APACHE_SUBST(CORE_IMPLIB)
165N/A APACHE_SUBST(SH_LIBTOOL)
165N/A APACHE_SUBST(MK_IMPLIB)
165N/A APACHE_SUBST(INSTALL_PROG_FLAGS)
165N/A
165N/A abs_srcdir="`(cd $srcdir && pwd)`"
165N/A
165N/A APACHE_MKDIR_P_CHECK
165N/A echo creating config_vars.mk
165N/A > config_vars.mk
3831N/A for i in $APACHE_VAR_SUBST; do
3831N/A eval echo "$i = \$$i" >> config_vars.mk
3831N/A done
3831N/A])
3831N/A
3831N/Adnl APACHE_GEN_MAKEFILES
3831N/Adnl Creates Makefiles
3831N/AAC_DEFUN(APACHE_GEN_MAKEFILES,[
3831N/A $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $APACHE_FAST_OUTPUT_FILES
3831N/A])
3831N/A
3831N/Adnl ## APACHE_OUTPUT(file)
3912N/Adnl ## adds "file" to the list of files generated by AC_OUTPUT
3831N/Adnl ## This macro can be used several times.
3831N/AAC_DEFUN(APACHE_OUTPUT, [
3831N/A APACHE_OUTPUT_FILES="$APACHE_OUTPUT_FILES $1"
3831N/A])
3831N/A
3831N/Adnl
3912N/Adnl APACHE_TYPE_RLIM_T
3831N/Adnl
3831N/Adnl If rlim_t is not defined, define it to int
165N/Adnl
165N/AAC_DEFUN(APACHE_TYPE_RLIM_T, [
165N/A AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [
6192N/A AC_TRY_COMPILE([
165N/A#include <sys/types.h>
3477N/A#include <sys/time.h>
3477N/A#include <sys/resource.h>
165N/A], [rlim_t spoon;], [
165N/A ac_cv_type_rlim_t=yes
3831N/A ],[ac_cv_type_rlim_t=no
165N/A ])
165N/A ])
181N/A if test "$ac_cv_type_rlim_t" = "no" ; then
165N/A AC_DEFINE(rlim_t, int,
4337N/A [Define to 'int' if <sys/resource.h> doesn't define it for us])
4337N/A fi
6248N/A])
3817N/A
3817N/Adnl APACHE_MODPATH_INIT(modpath)
3912N/AAC_DEFUN(APACHE_MODPATH_INIT,[
3817N/A current_dir=$1
3817N/A modpath_current=modules/$1
3817N/A modpath_static=
3817N/A modpath_shared=
6248N/A test -d $1 || $srcdir/build/mkdir.sh $modpath_current
5910N/A > $modpath_current/modules.mk
])dnl
dnl
AC_DEFUN(APACHE_MODPATH_FINISH,[
echo "DISTCLEAN_TARGETS = modules.mk" >> $modpath_current/modules.mk
echo "static = $modpath_static" >> $modpath_current/modules.mk
echo "shared = $modpath_shared" >> $modpath_current/modules.mk
if test ! -z "$modpath_static" -o ! -z "$modpath_shared"; then
MODULE_DIRS="$MODULE_DIRS $current_dir"
else
MODULE_CLEANDIRS="$MODULE_CLEANDIRS $current_dir"
fi
APACHE_FAST_OUTPUT($modpath_current/Makefile)
])dnl
dnl
dnl APACHE_MODPATH_ADD(name[, shared[, objects [, ldflags[, libs]]]])
AC_DEFUN(APACHE_MODPATH_ADD,[
if test -z "$3"; then
objects="mod_$1.lo"
else
objects="$3"
fi
if test -z "$module_standalone"; then
if test -z "$2"; then
libname="mod_$1.la"
BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/$libname"
modpath_static="$modpath_static $libname"
cat >>$modpath_current/modules.mk<<EOF
$libname: $objects
\$(MOD_LINK) $objects
EOF
else
apache_need_shared=yes
libname="mod_$1.la"
shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
modpath_shared="$modpath_shared $libname"
cat >>$modpath_current/modules.mk<<EOF
$libname: $shobjects
\$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $4 $objects $5
EOF
fi
fi
])dnl
dnl
dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
dnl
dnl default is one of:
dnl yes -- enabled by default. user must explicitly disable.
dnl no -- disabled under default, most, all. user must explicitly enable.
dnl most -- disabled by default. enabled explicitly or with most or all.
dnl "" -- disabled under default, most. enabled explicitly or with all.
dnl
dnl basically: yes/no is a hard setting. "most" means follow the "most"
dnl setting. otherwise, fall under the "all" setting.
dnl explicit yes/no always overrides.
dnl
AC_DEFUN(APACHE_MODULE,[
AC_MSG_CHECKING(whether to enable mod_$1)
define([optname],[ --]ifelse($5,yes,disable,enable)[-]translit($1,_,-))dnl
AC_ARG_ENABLE(translit($1,_,-),optname() substr([ ],len(optname()))$2,,enable_$1=ifelse($5,,maybe-all,$5))
undefine([optname])dnl
_apmod_extra_msg=""
dnl When --enable-modules=most is set and the module was not explicitly
dnl requested, allow a module to disable itself if its pre-reqs fail.
if test "$module_selection" = "most" -a "$enable_$1" = "most"; then
_apmod_error_fatal="no"
else
_apmod_error_fatal="yes"
fi
if test "$enable_$1" = "most"; then
if test "$module_selection" = "most" -o "$module_selection" = "all"; then
enable_$1=$module_default
_apmod_extra_msg=" ($module_selection)"
else
enable_$1=no
fi
elif test "$enable_$1" = "maybe-all"; then
if test "$module_selection" = "all"; then
enable_$1=$module_default
_apmod_extra_msg=" (all)"
else
enable_$1=no
fi
fi
if test "$enable_$1" != "no"; then
dnl If we plan to enable it, allow the module to run some autoconf magic
dnl that may disable it because of missing dependencies.
ifelse([$6],,:,[AC_MSG_RESULT([checking dependencies])
$6
AC_MSG_CHECKING(whether to enable mod_$1)
if test "$enable_$1" = "no"; then
if test "$_apmod_error_fatal" = "no"; then
_apmod_extra_msg=" (disabled)"
else
AC_MSG_ERROR([mod_$1 has been requested but can not be built due to prerequisite failures])
fi
fi])
fi
AC_MSG_RESULT($enable_$1$_apmod_extra_msg)
if test "$enable_$1" != "no"; then
case "$enable_$1" in
shared*)
enable_$1=`echo $ac_n $enable_$1$ac_c|sed 's/shared,*//'`
sharedobjs=yes
shared=yes;;
*)
MODLIST="$MODLIST ifelse($4,,$1,$4)"
if test "$1" = "so"; then
sharedobjs=yes
fi
shared="";;
esac
APACHE_MODPATH_ADD($1, $shared, $3)
fi
])dnl
dnl
dnl APACHE_LAYOUT(configlayout, layoutname)
AC_DEFUN(APACHE_LAYOUT,[
if test ! -f $srcdir/config.layout; then
echo "** Error: Layout file $srcdir/config.layout not found"
echo "** Error: Cannot use undefined layout '$LAYOUT'"
exit 1
fi
pldconf=./config.pld
changequote({,})
sed -e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \
-e '/[ ]*<\/Layout>[ ]*/,$d' \
-e "s/^[ ]*//g" \
-e "s/:[ ]*/=\'/g" \
-e "s/[ ]*$/'/g" \
$1 > $pldconf
layout_name=$2
. $pldconf
rm $pldconf
for var in prefix exec_prefix bindir sbindir libexecdir mandir \
sysconfdir datadir errordir iconsdir htdocsdir cgidir \
includedir localstatedir runtimedir logfiledir \
proxycachedir installbuilddir; do
eval "val=\"\$$var\""
case $val in
*+)
val=`echo $val | sed -e 's;\+$;;'`
eval "$var=\"\$val\""
autosuffix=yes
;;
*)
autosuffix=no
;;
esac
val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
val=`echo $val | sed -e 's:$\([a-z_]*\):$(\1):g'`
if test "$autosuffix" = "yes"; then
if echo $val | grep apache >/dev/null; then
addtarget=no
else
addtarget=yes
fi
if test "$addtarget" = "yes"; then
val="$val/apache"
fi
fi
eval "$var='$val'"
done
changequote([,])
])dnl
dnl
dnl APACHE_ENABLE_LAYOUT
dnl
AC_DEFUN(APACHE_ENABLE_LAYOUT,[
AC_ARG_ENABLE(layout,
[ --enable-layout=LAYOUT],[
LAYOUT=$enableval
])
if test -z "$LAYOUT"; then
# XXX FIXME: this isn't a complete list of things that have to be set to
# create the Apache layout in config.layout, and it really should just
# use what is specified in config.layout instead of duping it.
htdocsdir='$(prefix)/htdocs'
manualdir='$(prefix)/manual'
errordir='$(prefix)/error'
iconsdir='$(prefix)/icons'
cgidir='$(prefix)/cgi-bin'
logfiledir='$(prefix)/logs'
sysconfdir='${prefix}/conf'
libexecdir='${prefix}/modules'
mandir='${prefix}/man'
layout_name=Apache
installbuilddir='${prefix}/build'
else
APACHE_LAYOUT($srcdir/config.layout, $LAYOUT)
fi
AC_MSG_CHECKING(for chosen layout)
AC_MSG_RESULT($layout_name)
])
dnl
dnl APACHE_ENABLE_MODULES
dnl
AC_DEFUN(APACHE_ENABLE_MODULES,[
module_selection=default
module_default=yes
AC_ARG_ENABLE(modules,
[ --enable-modules=MODULE-LIST],[
for i in $enableval; do
if test "$i" = "all" -o "$i" = "most"; then
module_selection=$i
else
eval "enable_$i=yes"
fi
done
])
AC_ARG_ENABLE(mods-shared,
[ --enable-mods-shared=MODULE-LIST],[
for i in $enableval; do
if test "$i" = "all" -o "$i" = "most"; then
module_selection=$i
module_default=shared
else
i=`echo $i | sed 's/-/_/g'`
eval "enable_$i=shared"
fi
done
])
])
AC_DEFUN(APACHE_REQUIRE_CXX,[
if test -z "$apache_cxx_done"; then
AC_PROG_CXX
AC_PROG_CXXCPP
apache_cxx_done=yes
fi
])
dnl
dnl APACHE_CHECK_SSL_TOOLKIT
dnl
dnl Find the openssl toolkit installation and check it for the right
dnl version, then add its flags to INCLUDES and LIBS. This should
dnl really be using a custom AC_TRY_COMPILE function to test the includes
dnl and then AC_TRY_LINK to test the libraries directly for the version,
dnl but that will require someone who knows how to program openssl.
dnl
AC_DEFUN(APACHE_CHECK_SSL_TOOLKIT,[
if test "x$ap_ssltk_base" = "x"; then
AC_MSG_CHECKING(for SSL/TLS toolkit base)
ap_ssltk_base=""
AC_ARG_WITH(ssl, [ --with-ssl[=DIR] SSL/TLS toolkit (OpenSSL)], [
if test "x$withval" != "xyes" -a "x$withval" != "x"; then
ap_ssltk_base="$withval"
fi
])
if test "x$ap_ssltk_base" = "x"; then
AC_CACHE_VAL(ap_cv_ssltk,[
#
# shotgun approach: find all occurrences of the openssl program
#
ap_ssltk_try=""
# The IFS=... trick eliminates the colons from $PATH, without using an external program
for p in `IFS=":$IFS"; echo $PATH` /usr/local/openssl/bin /usr/local/ssl/bin; do
if test -f "$p/openssl"; then
ap_ssltk_try="$ap_ssltk_try $p"
fi
done
if test "x$ap_ssltk_try" = "x"; then
AC_MSG_ERROR(['openssl' not found in path])
fi
for p in $ap_ssltk_try; do
ap_ssltk_version="`$p/openssl version`"
case "$ap_ssltk_version" in
"OpenSSL "[[1-9]]* | \
"OpenSSL "0.9.[[6-9]]* | \
"OpenSSL "0.[[1-9]][[0-9]]* )
ap_cv_ssltk="`(cd $p/.. && pwd)`"
break
;;
*)
# skip because it is too old or a bad result
;;
esac
done
if test "x$ap_cv_ssltk" = "x"; then
AC_MSG_ERROR([requires OpenSSL 0.9.6 or higher])
fi
])
ap_ssltk_base="$ap_cv_ssltk"
fi
if test ! -d $ap_ssltk_base; then
AC_MSG_ERROR([invalid SSL/TLS toolkit base directory $ap_ssltk_base])
fi
AC_MSG_RESULT($ap_ssltk_base)
AC_MSG_CHECKING(for SSL/TLS toolkit version)
AC_MSG_RESULT($ap_ssltk_version)
AC_MSG_CHECKING(for SSL/TLS toolkit includes)
ap_ssltk_incdir=""
for p in $ap_ssltk_base/include /usr/local/openssl/include \
/usr/local/ssl/include /usr/local/include /usr/include; do
if test -f "$p/openssl/ssl.h"; then
ap_ssltk_incdir="$p"
break
fi
done
if test "x$ap_ssltk_incdir" = "x"; then
AC_MSG_ERROR([OpenSSL headers not found])
fi
AC_MSG_RESULT($ap_ssltk_incdir)
AC_MSG_CHECKING(for SSL/TLS toolkit libraries)
ap_ssltk_libdir=""
for p in $ap_ssltk_base/lib /usr/local/openssl/lib \
/usr/local/ssl/lib /usr/local/lib /usr/lib /lib; do
if test -f "$p/libssl.a" -o -f "$p/libssl.so"; then
ap_ssltk_libdir="$p"
break
fi
done
if test ".$ap_ssltk_libdir" = .; then
AC_MSG_ERROR([OpenSSL libraries not found])
fi
AC_MSG_RESULT($ap_ssltk_libdir)
dnl # annotate the Apache build environment with determined information
APR_ADDTO(INCLUDES, [-I$ap_ssltk_incdir/openssl])
if test "x$ap_ssltk_incdir" != "x/usr/include"; then
APR_ADDTO(INCLUDES, [-I$ap_ssltk_incdir])
fi
if test "x$ap_ssltk_libdir" != "x/usr/lib"; then
APR_ADDTO(LIBS, [-L$ap_ssltk_libdir])
if test "x$ap_platform_runtime_link_flag" != "x"; then
APR_ADDTO(LIBS, [$ap_platform_runtime_link_flag$ap_ssltk_libdir])
fi
fi
APR_ADDTO(LIBS, [-lssl -lcrypto])
ap_cv_ssltk="$ap_ssltk_base"
fi
])