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/dso.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 APU_LTVERSION="-version-info `$get_version libtool $version_hdr APU`"
74 AC_SUBST(APRUTIL_DOTTED_VERSION)
75 AC_SUBST(APRUTIL_MAJOR_VERSION)
76 AC_SUBST(APU_LTVERSION)
78 echo "APR-util Version: ${APRUTIL_DOTTED_VERSION}"
80 dnl Enable the layout handling code, then reparse the prefix-style
81 dnl arguments due to autoconf being a PITA.
82 APR_ENABLE_LAYOUT(apr-util)
85 dnl load os-specific hints for apr-util
89 dnl set up the compilation flags and stuff
93 APRUTIL_PRIV_INCLUDES="-I$top_builddir/include -I$top_builddir/include/private"
94 if test -n "$USE_VPATH"; then
95 APRUTIL_PRIV_INCLUDES="$APRUTIL_PRIV_INCLUDES -I$abs_srcdir/include/private -I$abs_srcdir/include"
99 dnl Find the APR includes directory and (possibly) the source (base) dir.
104 dnl even though we use apr_rules.mk for building apr-util, we need
105 dnl to grab CC and CPP ahead of time so that apr-util config tests
106 dnl use the same compiler as APR; we need the same compiler options
107 dnl and feature test macros as well
109 APR_SETIFNULL(CC, `$apr_config --cc`)
110 APR_SETIFNULL(CPP, `$apr_config --cpp`)
111 APR_ADDTO(CFLAGS, `$apr_config --cflags`)
112 APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`)
113 apr_shlibpath_var=`$apr_config --shlib-path-var`
114 AC_SUBST(apr_shlibpath_var)
117 dnl Find the APR-ICONV directory.
119 AC_ARG_WITH(apr-iconv,
120 [ --with-apr-iconv=DIR relative path to apr-iconv source],
121 [ apu_apriconv_dir="$withval"
122 if test "$apu_apriconv_dir" != "no"; then
123 if test -d "$apu_apriconv_dir"; then
124 APR_SUBDIR_CONFIG("$apu_apriconv_dir",
127 --exec-prefix=$exec_prefix \
129 --includedir=$includedir \
132 --with-installbuilddir=$installbuilddir],
133 [--enable-layout=*|\'--enable-layout=*])
134 APRUTIL_EXPORT_LIBS="$abs_srcdir/$apu_apriconv_dir/lib/libapriconv.la \
135 $APRUTIL_EXPORT_LIBS"
136 APRUTIL_INCLUDES="-I$abs_srcdir/apu_apriconv_dir/include \
138 APR_ICONV_DIR="$apu_apriconv_dir"
146 AC_SUBST(APR_ICONV_DIR)
148 dnl Find LDAP library
149 dnl Determine what DBM backend type to use.
151 dnl Find an iconv library
156 APU_CHECK_DBD_SQLITE3
157 APU_CHECK_DBD_SQLITE2
159 APU_CHECK_DBD_FREETDS
164 dnl Enable DSO build; must be last:
167 AC_SEARCH_LIBS(crypt, crypt ufc)
168 AC_MSG_CHECKING(if system crypt() function is threadsafe)
169 if test "x$apu_crypt_threadsafe" = "x1"; then
170 AC_DEFINE(APU_CRYPT_THREADSAFE, 1, [Define if the system crypt() function is threadsafe])
175 AC_MSG_RESULT([$msg])
177 AC_CHECK_FUNCS(crypt_r, [ crypt_r="1" ], [ crypt_r="0" ])
178 if test "$crypt_r" = "1"; then
179 APU_CHECK_CRYPT_R_STYLE
183 lib_target=$APR_LIB_TARGET
187 APRUTIL_LIBNAME="aprutil${libsuffix}"
188 AC_SUBST(APRUTIL_LIBNAME)
190 # Set up destination directory for DSOs.
191 APU_DSO_LIBDIR="\${libdir}/apr-util-${APRUTIL_MAJOR_VERSION}"
192 # Set APU_HAVE_MODULES appropriately for the Makefile
193 if test -n "$APU_MODULES"; then
198 # Define expanded libdir for apu_config.h
199 APR_EXPAND_VAR(abs_dso_libdir, $APU_DSO_LIBDIR)
200 AC_DEFINE_UNQUOTED([APU_DSO_LIBDIR], ["$abs_dso_libdir"],
201 [Define to be absolute path to DSO directory])
202 AC_SUBST(APU_HAVE_MODULES)
203 AC_SUBST(APU_DSO_LIBDIR)
204 AC_SUBST(APU_MODULES)
205 AC_SUBST(EXTRA_OBJECTS)
208 dnl Prep all the flags and stuff for compilation and export to other builds
210 APR_ADDTO(APRUTIL_LIBS, [$APR_LIBS])
212 AC_SUBST(APRUTIL_EXPORT_LIBS)
213 AC_SUBST(APRUTIL_PRIV_INCLUDES)
214 AC_SUBST(APRUTIL_INCLUDES)
215 AC_SUBST(APRUTIL_LDFLAGS)
216 AC_SUBST(APRUTIL_LIBS)
219 dnl copy apr's rules.mk into our build directory.
220 if test ! -d ./build; then
223 cp $APR_BUILD_DIR/apr_rules.mk $abs_builddir/build/rules.mk
226 dnl BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
228 case "$host_alias" in
230 # Check whether they've installed GNU make
231 if make --version > /dev/null 2>&1; then
232 INCLUDE_RULES="include $abs_builddir/build/rules.mk"
233 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\""
240 INCLUDE_RULES="include $abs_builddir/build/rules.mk"
241 INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
244 AC_SUBST(INCLUDE_RULES)
245 AC_SUBST(INCLUDE_OUTPUTS)
247 for d in include include/private; do
248 test -d $top_builddir/$d || mkdir $top_builddir/$d
251 AC_CONFIG_FILES([Makefile export_vars.sh
252 build/pkg/pkginfo apr-util.pc
253 apu-$APRUTIL_MAJOR_VERSION-config:apu-config.in
254 include/private/apu_select_dbm.h
256 include/apu.h include/apu_want.h])
258 AC_CONFIG_COMMANDS([default], [
259 chmod +x apu-$APRUTIL_MAJOR_VERSION-config
261 APRUTIL_MAJOR_VERSION=$APRUTIL_MAJOR_VERSION
264 if test -d $srcdir/test; then
265 AC_CONFIG_FILES([test/Makefile])