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)
19 dnl Generate ./config.nice for reproducing runs of configure
21 APR_CONFIG_NICE(config.nice)
23 dnl # Some initial steps for configuration. We setup the default directory
24 dnl # and which files are to be configured.
26 dnl Absolute source/build directory
27 abs_srcdir=`(cd $srcdir && pwd)`
30 if test "$abs_builddir" != "$abs_srcdir"; then
32 APU_CONFIG_LOCATION=build
34 APU_CONFIG_LOCATION=source
37 AC_SUBST(APU_CONFIG_LOCATION)
43 # Use -no-install to link the test programs on all platforms
44 # but Darwin, where it would cause the programs to be linked
45 # against installed versions of libapr instead of those just
48 *-apple-darwin*) LT_NO_INSTALL="" ;;
49 *) LT_NO_INSTALL="-no-install" ;;
51 AC_SUBST(LT_NO_INSTALL)
54 dnl compute the top directory of the build
55 dnl note: this is needed for LIBTOOL and exporting the bundled Expat
57 top_builddir="$abs_builddir"
58 AC_SUBST(top_builddir)
60 AC_SUBST(abs_builddir)
62 dnl Initialize mkdir -p functionality.
63 APR_MKDIR_P_CHECK($abs_srcdir/build/mkdir.sh)
65 dnl get our version information
66 get_version="$abs_srcdir/build/get-version.sh"
67 version_hdr="$abs_srcdir/include/apu_version.h"
68 APRUTIL_MAJOR_VERSION="`$get_version major $version_hdr APU`"
69 APRUTIL_DOTTED_VERSION="`$get_version all $version_hdr APU`"
71 APU_LTVERSION="-version-info `$get_version libtool $version_hdr APU`"
73 AC_SUBST(APRUTIL_DOTTED_VERSION)
74 AC_SUBST(APRUTIL_MAJOR_VERSION)
75 AC_SUBST(APU_LTVERSION)
77 echo "APR-util Version: ${APRUTIL_DOTTED_VERSION}"
79 dnl Enable the layout handling code, then reparse the prefix-style
80 dnl arguments due to autoconf being a PITA.
81 APR_ENABLE_LAYOUT(apr-util)
84 dnl load os-specific hints for apr-util
88 dnl set up the compilation flags and stuff
92 APRUTIL_PRIV_INCLUDES="-I$top_builddir/include -I$top_builddir/include/private"
93 if test -n "$USE_VPATH"; then
94 APRUTIL_PRIV_INCLUDES="$APRUTIL_PRIV_INCLUDES -I$abs_srcdir/include/private -I$abs_srcdir/include"
98 dnl Find the APR includes directory and (possibly) the source (base) dir.
103 dnl even though we use apr_rules.mk for building apr-util, we need
104 dnl to grab CC and CPP ahead of time so that apr-util config tests
105 dnl use the same compiler as APR; we need the same compiler options
106 dnl and feature test macros as well
108 APR_SETIFNULL(CC, `$apr_config --cc`)
109 APR_SETIFNULL(CPP, `$apr_config --cpp`)
110 APR_ADDTO(CFLAGS, `$apr_config --cflags`)
111 APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`)
114 dnl Find the APR-ICONV directory.
116 AC_ARG_WITH(apr-iconv,
117 [ --with-apr-iconv=DIR relative path to apr-iconv source],
118 [ apu_apriconv_dir="$withval"
119 if test "$apu_apriconv_dir" != "no"; then
120 if test -d "$apu_apriconv_dir"; then
121 APR_SUBDIR_CONFIG("$apu_apriconv_dir",
124 --exec-prefix=$exec_prefix \
126 --includedir=$includedir \
129 --with-installbuilddir=$installbuilddir],
130 [--enable-layout=*|\'--enable-layout=*])
131 APRUTIL_EXPORT_LIBS="$abs_srcdir/$apu_apriconv_dir/lib/libapriconv.la \
132 $APRUTIL_EXPORT_LIBS"
133 APRUTIL_INCLUDES="-I$abs_srcdir/apu_apriconv_dir/include \
135 APR_ICONV_DIR="$apu_apriconv_dir"
143 AC_SUBST(APR_ICONV_DIR)
145 AC_SEARCH_LIBS(crypt, crypt ufc)
146 AC_MSG_CHECKING(if system crypt() function is threadsafe)
147 if test "x$apu_crypt_threadsafe" = "x1"; then
148 AC_DEFINE(APU_CRYPT_THREADSAFE, 1, [Define if the system crypt() function is threadsafe])
153 AC_MSG_RESULT([$msg])
155 AC_CHECK_FUNCS(crypt_r, [ crypt_r="1" ], [ crypt_r="0" ])
156 if test "$crypt_r" = "1"; then
157 APU_CHECK_CRYPT_R_STYLE
160 dnl Find LDAP library
161 dnl Determine what DBM backend type to use.
163 dnl Find an iconv library
168 APU_CHECK_DBD_SQLITE3
169 APU_CHECK_DBD_SQLITE2
171 APU_CHECK_DBD_FREETDS
172 dnl Enable DSO build; must be last:
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])