sinclude(srclib/apr/build/apr_common.m4)
sinclude(srclib/apr/build/apr_network.m4)
sinclude(srclib/apr/build/apr_threads.m4)
+sinclude(srclib/apr/build/find_apr.m4)
+sinclude(srclib/apr-util/build/find_apu.m4)
sinclude(acinclude.m4)
dnl XXX we can't just use AC_PREFIX_DEFAULT because that isn't subbed in
echo $ac_n "${nl}Configuring Apache Portable Runtime library ...${nl}"
-APR_SUBDIR_CONFIG(srclib/apr, "$apache_apr_flags --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir --datadir=$datadir --with-installbuilddir=$installbuilddir")
+APR_FIND_APR("$srcdir/srclib/apr", "./srclib/apr")
+
+if test "$apr_found" = "no"; then
+ AC_MSG_ERROR([APR not found. Please read the documentation.])
+fi
+
+if test "$apr_found" = "reconfig"; then
+ APR_SUBDIR_CONFIG(srclib/apr, "$apache_apr_flags --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir --datadir=$datadir --with-installbuilddir=$installbuilddir")
+ dnl We must be the first to build and the last to be cleaned
+ AP_BUILD_SRCLIB_DIRS="apr $AP_BUILD_SRCLIB_DIRS"
+ AP_CLEAN_SRCLIB_DIRS="$AP_CLEAN_SRCLIB_DIRS apr"
+fi
+
+APR_ADDTO(CFLAGS, `$apr_config --cflags`)
+APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`)
+APR_ADDTO(LDFLAGS, `$apr_config --ldflags`)
echo $ac_n "${nl}Configuring Apache Portable Runtime Utility library...${nl}"
-APR_SUBDIR_CONFIG(srclib/apr-util, "--with-apr=../apr --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir")
+APR_FIND_APU("$srcdir/srclib/apr-util", "./srclib/apr-util")
+
+if test "$apu_found" = "no"; then
+ AC_MSG_ERROR([APR-util not found. Please read the documentation.])
+fi
+
+if test "$apu_found" = "reconfig"; then
+ APR_SUBDIR_CONFIG(srclib/apr-util, "--with-apr=../apr --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir")
+ dnl We must be the last to build and the first to be cleaned
+ AP_BUILD_SRCLIB_DIRS="$AP_BUILD_SRCLIB_DIRS apr-util"
+ AP_CLEAN_SRCLIB_DIRS="apr-util $AP_CLEAN_SRCLIB_DIRS"
+fi
+
+APR_ADDTO(LDFLAGS, `$apu_config --ldflags`)
+APR_ADDTO(INCLUDES, `$apu_config --includes`)
echo $ac_n "${nl}Configuring PCRE regular expression library ...${nl}"
echo $ac_n "${nl}Configuring Apache httpd ...${nl}"
-echo $ac_n "obtaining flag settings from the sub-configures...${nl}"
-. ./srclib/apr/APRVARS
-
-dnl Now that we have APR's EXTRA_flags in our environment, move them over
-dnl to the normal variables to avoid duplications and use them for testing.
-dnl We ignore EXTRA_INCLUDES because our own includes will encompass them.
-dnl
-APR_ADDTO(CFLAGS, $EXTRA_CFLAGS)
-APR_ADDTO(CPPFLAGS, $EXTRA_CPPFLAGS)
-APR_ADDTO(LDFLAGS, $EXTRA_LDFLAGS)
-APR_ADDTO(LIBS, $EXTRA_LIBS)
-EXTRA_CFLAGS=
-EXTRA_CPPFLAGS=
-EXTRA_LDFLAGS=
-EXTRA_LIBS=
-EXTRA_INCLUDES=
-
dnl Absolute source/build directory
abs_srcdir=`(cd $srcdir && pwd)`
abs_builddir=`pwd`
AC_DEFINE_UNQUOTED(AP_SUEXEC_UMASK, 0$withval, [umask for suexec'd process] ) ] )
dnl AP_LIBS specifies the actual libraries. note we have some required libs.
-AP_LIBS="$abs_builddir/srclib/pcre/libpcre.la $abs_builddir/srclib/apr-util/libaprutil.la $AP_LIBS"
+AP_LIBS="$abs_builddir/srclib/pcre/libpcre.la $AP_LIBS"
dnl APR should go after the other libs, so the right symbols can be picked up
-AP_LIBS="$AP_LIBS $abs_builddir/srclib/apr/libapr.la"
+AP_LIBS="$AP_LIBS `$apu_config --link-libtool --libs` `$apr_config --link-libtool --libs`"
APACHE_SUBST(AP_LIBS)
+APACHE_SUBST(AP_BUILD_SRCLIB_DIRS)
+APACHE_SUBST(AP_CLEAN_SRCLIB_DIRS)
AC_DEFINE(AP_USING_AUTOCONF, 1,
[Using autoconf to configure Apache])
APACHE_FAST_OUTPUT(test/Makefile)
fi
-dnl get the exported vars from APRUTIL
-. ./srclib/apr-util/export_vars.sh
-APR_ADDTO(LIBS, $APRUTIL_EXPORT_LIBS)
-APR_ADDTO(INCLUDES, $APRUTIL_EXPORT_INCLUDES)
-APR_ADDTO(LDFLAGS, $APRUTIL_LDFLAGS)
-AP_LIBS="$AP_LIBS $LIBTOOL_LIBS"
-
dnl ## Finalize the variables
echo $ac_n "${nl}Restore user-defined environment settings...${nl}"