2 dnl Process this file with autoconf to produce a configure script
6 AC_INIT(export_vars.sh.in)
8 AC_CONFIG_HEADER(include/private/apu_config.h)
9 AC_CONFIG_AUX_DIR(build)
11 sinclude(build/apu-conf.m4)
12 sinclude(build/apu-iconv.m4)
13 sinclude(build/apu-hints.m4)
14 sinclude(build/apr_common.m4)
15 sinclude(build/find_apr.m4)
16 sinclude(build/dbm.m4)
17 sinclude(build/dbd.m4)
18 sinclude(build/ssl.m4)
20 dnl Generate ./config.nice for reproducing runs of configure
22 APR_CONFIG_NICE(config.nice)
24 dnl # Some initial steps for configuration. We setup the default directory
25 dnl # and which files are to be configured.
27 dnl Absolute source/build directory
28 abs_srcdir=`(cd $srcdir && pwd)`
31 if test "$abs_builddir" != "$abs_srcdir"; then
33 APU_CONFIG_LOCATION=build
35 APU_CONFIG_LOCATION=source
38 AC_SUBST(APU_CONFIG_LOCATION)
44 # Use -no-install to link the test programs on all platforms
45 # but Darwin, where it would cause the programs to be linked
46 # against installed versions of libapr instead of those just
49 *-apple-darwin*) LT_NO_INSTALL="" ;;
50 *) LT_NO_INSTALL="-no-install" ;;
52 AC_SUBST(LT_NO_INSTALL)
55 dnl compute the top directory of the build
56 dnl note: this is needed for LIBTOOL and exporting the bundled Expat
58 top_builddir="$abs_builddir"
59 AC_SUBST(top_builddir)
61 AC_SUBST(abs_builddir)
63 dnl Initialize mkdir -p functionality.
64 APR_MKDIR_P_CHECK($abs_srcdir/build/mkdir.sh)
66 dnl get our version information
67 get_version="$abs_srcdir/build/get-version.sh"
68 version_hdr="$abs_srcdir/include/apu_version.h"
69 APRUTIL_MAJOR_VERSION="`$get_version major $version_hdr APU`"
70 APRUTIL_DOTTED_VERSION="`$get_version all $version_hdr APU`"
72 AC_SUBST(APRUTIL_DOTTED_VERSION)
73 AC_SUBST(APRUTIL_MAJOR_VERSION)
75 echo "APR-util Version: ${APRUTIL_DOTTED_VERSION}"
77 dnl Enable the layout handling code, then reparse the prefix-style
78 dnl arguments due to autoconf being a PITA.
79 APR_ENABLE_LAYOUT(apr-util)
82 dnl load os-specific hints for apr-util
86 dnl set up the compilation flags and stuff
90 APRUTIL_PRIV_INCLUDES="-I$top_builddir/include -I$top_builddir/include/private"
91 if test -n "$USE_VPATH"; then
92 APRUTIL_PRIV_INCLUDES="$APRUTIL_PRIV_INCLUDES -I$abs_srcdir/include/private -I$abs_srcdir/include"
96 dnl Find the APR includes directory and (possibly) the source (base) dir.
101 dnl even though we use apr_rules.mk for building apr-util, we need
102 dnl to grab CC and CPP ahead of time so that apr-util config tests
103 dnl use the same compiler as APR; we need the same compiler options
104 dnl and feature test macros as well
106 APR_SETIFNULL(CC, `$apr_config --cc`)
107 APR_SETIFNULL(CPP, `$apr_config --cpp`)
108 APR_ADDTO(CFLAGS, `$apr_config --cflags`)
109 APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`)
112 dnl Find the APR-ICONV directory.
114 AC_ARG_WITH(apr-iconv,
115 [ --with-apr-iconv=DIR relative path to apr-iconv source],
116 [ apu_apriconv_dir="$withval"
117 if test "$apu_apriconv_dir" != "no"; then
118 if test -d "$apu_apriconv_dir"; then
119 APR_SUBDIR_CONFIG("$apu_apriconv_dir",
122 --exec-prefix=$exec_prefix \
124 --includedir=$includedir \
127 --with-installbuilddir=$installbuilddir],
128 [--enable-layout=*|\'--enable-layout=*])
129 APRUTIL_EXPORT_LIBS="$abs_srcdir/$apu_apriconv_dir/lib/libapriconv.la \
130 $APRUTIL_EXPORT_LIBS"
131 APRUTIL_INCLUDES="-I$abs_srcdir/apu_apriconv_dir/include \
133 APR_ICONV_DIR="$apu_apriconv_dir"
141 AC_SUBST(APR_ICONV_DIR)
143 dnl Find LDAP library
144 dnl Determine what DBM backend type to use.
146 dnl Find an iconv library
151 APU_CHECK_DBD_SQLITE3
152 APU_CHECK_DBD_SQLITE2
154 APU_CHECK_DBD_FREETDS
155 dnl Enable DSO build; must be last:
160 AC_SEARCH_LIBS(crypt, crypt ufc)
161 AC_MSG_CHECKING(if system crypt() function is threadsafe)
162 if test "x$apu_crypt_threadsafe" = "x1"; then
163 AC_DEFINE(APU_CRYPT_THREADSAFE, 1, [Define if the system crypt() function is threadsafe])
168 AC_MSG_RESULT([$msg])
170 AC_CHECK_FUNCS(crypt_r, [ crypt_r="1" ], [ crypt_r="0" ])
171 if test "$crypt_r" = "1"; then
172 APU_CHECK_CRYPT_R_STYLE
178 lib_target=$APR_LIB_TARGET
182 APRUTIL_LIBNAME="aprutil${libsuffix}"
183 AC_SUBST(APRUTIL_LIBNAME)
185 # Set up destination directory for DSOs.
186 APU_DSO_LIBDIR="\${libdir}/apr-util-${APRUTIL_MAJOR_VERSION}"
187 # Set APU_HAVE_MODULES appropriately for the Makefile
188 if test -n "$APU_MODULES"; then
193 # Define expanded libdir for apu_config.h
194 APR_EXPAND_VAR(abs_dso_libdir, $APU_DSO_LIBDIR)
195 AC_DEFINE_UNQUOTED([APU_DSO_LIBDIR], ["$abs_dso_libdir"],
196 [Define to be absolute path to DSO directory])
197 AC_SUBST(APU_HAVE_MODULES)
198 AC_SUBST(APU_DSO_LIBDIR)
199 AC_SUBST(APU_MODULES)
200 AC_SUBST(EXTRA_OBJECTS)
203 dnl Prep all the flags and stuff for compilation and export to other builds
205 APR_ADDTO(APRUTIL_LIBS, [$APR_LIBS])
207 AC_SUBST(APRUTIL_EXPORT_LIBS)
208 AC_SUBST(APRUTIL_PRIV_INCLUDES)
209 AC_SUBST(APRUTIL_INCLUDES)
210 AC_SUBST(APRUTIL_LDFLAGS)
211 AC_SUBST(APRUTIL_LIBS)
214 dnl copy apr's rules.mk into our build directory.
215 if test ! -d ./build; then
218 cp $APR_BUILD_DIR/apr_rules.mk $abs_builddir/build/rules.mk
221 dnl BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
223 case "$host_alias" in
225 # Check whether they've installed GNU make
226 if make --version > /dev/null 2>&1; then
227 INCLUDE_RULES="include $abs_builddir/build/rules.mk"
228 INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
230 INCLUDE_RULES=".include \"$abs_builddir/build/rules.mk\""
231 INCLUDE_OUTPUTS=".include \"$abs_srcdir/build-outputs.mk\""
235 INCLUDE_RULES="include $abs_builddir/build/rules.mk"
236 INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
239 AC_SUBST(INCLUDE_RULES)
240 AC_SUBST(INCLUDE_OUTPUTS)
242 for d in include include/private; do
243 test -d $top_builddir/$d || mkdir $top_builddir/$d
246 AC_CONFIG_FILES([Makefile export_vars.sh
247 build/pkg/pkginfo apr-util.pc
248 apu-$APRUTIL_MAJOR_VERSION-config:apu-config.in
249 include/private/apu_select_dbm.h
251 include/apu.h include/apu_want.h])
253 AC_CONFIG_COMMANDS([default], [
254 chmod +x apu-$APRUTIL_MAJOR_VERSION-config
256 APRUTIL_MAJOR_VERSION=$APRUTIL_MAJOR_VERSION
259 if test -d $srcdir/test; then
260 AC_CONFIG_FILES([test/Makefile])