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)
44 dnl compute the top directory of the build
45 dnl note: this is needed for LIBTOOL and exporting the bundled Expat
47 top_builddir="$abs_builddir"
48 AC_SUBST(top_builddir)
50 AC_SUBST(abs_builddir)
52 dnl Initialize mkdir -p functionality.
53 APR_MKDIR_P_CHECK($abs_srcdir/build/mkdir.sh)
55 dnl get our version information
56 get_version="$abs_srcdir/build/get-version.sh"
57 version_hdr="$abs_srcdir/include/apu_version.h"
58 APRUTIL_MAJOR_VERSION="`$get_version major $version_hdr APU`"
59 APRUTIL_DOTTED_VERSION="`$get_version all $version_hdr APU`"
61 AC_SUBST(APRUTIL_DOTTED_VERSION)
62 AC_SUBST(APRUTIL_MAJOR_VERSION)
64 echo "APR-util Version: ${APRUTIL_DOTTED_VERSION}"
66 dnl Enable the layout handling code, then reparse the prefix-style
67 dnl arguments due to autoconf being a PITA.
68 APR_ENABLE_LAYOUT(apr-util)
71 dnl load os-specific hints for apr-util
75 dnl set up the compilation flags and stuff
79 APRUTIL_PRIV_INCLUDES="-I$top_builddir/include -I$top_builddir/include/private"
80 if test -n "$USE_VPATH"; then
81 APRUTIL_PRIV_INCLUDES="$APRUTIL_PRIV_INCLUDES -I$abs_srcdir/include/private -I$abs_srcdir/include"
85 dnl Find the APR includes directory and (possibly) the source (base) dir.
90 dnl even though we use apr_rules.mk for building apr-util, we need
91 dnl to grab CC and CPP ahead of time so that apr-util config tests
92 dnl use the same compiler as APR; we need the same compiler options
93 dnl and feature test macros as well
95 APR_SETIFNULL(CC, `$apr_config --cc`)
96 APR_SETIFNULL(CPP, `$apr_config --cpp`)
97 APR_ADDTO(CFLAGS, `$apr_config --cflags`)
98 APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`)
101 dnl Find the APR-ICONV directory.
103 AC_ARG_WITH(apr-iconv,
104 [ --with-apr-iconv=DIR relative path to apr-iconv source],
105 [ apu_apriconv_dir="$withval"
106 if test "$apu_apriconv_dir" != "no"; then
107 if test -d "$apu_apriconv_dir"; then
108 APR_SUBDIR_CONFIG("$apu_apriconv_dir",
111 --exec-prefix=$exec_prefix \
113 --includedir=$includedir \
116 --with-installbuilddir=$installbuilddir],
117 [--enable-layout=*|\'--enable-layout=*])
118 APRUTIL_EXPORT_LIBS="$abs_srcdir/$apu_apriconv_dir/lib/libapriconv.la \
119 $APRUTIL_EXPORT_LIBS"
120 APRUTIL_INCLUDES="-I$abs_srcdir/apu_apriconv_dir/include \
122 APR_ICONV_DIR="$apu_apriconv_dir"
130 AC_SUBST(APR_ICONV_DIR)
132 dnl Find LDAP library
133 dnl Determine what DBM backend type to use.
135 dnl Find an iconv library
140 APU_CHECK_DBD_SQLITE3
141 APU_CHECK_DBD_SQLITE2
146 AC_SEARCH_LIBS(crypt, crypt ufc)
147 AC_MSG_CHECKING(if system crypt() function is threadsafe)
148 if test "x$apu_crypt_threadsafe" = "x1"; then
149 AC_DEFINE(APU_CRYPT_THREADSAFE, 1, [Define if the system crypt() function is threadsafe])
154 AC_MSG_RESULT([$msg])
156 AC_CHECK_FUNCS(crypt_r, [ crypt_r="1" ], [ crypt_r="0" ])
157 if test "$crypt_r" = "1"; then
158 APU_CHECK_CRYPT_R_STYLE
162 lib_target=$APR_LIB_TARGET
166 APRUTIL_LIBNAME="aprutil${libsuffix}"
167 AC_SUBST(APRUTIL_LIBNAME)
170 dnl Prep all the flags and stuff for compilation and export to other builds
172 APR_ADDTO(APRUTIL_LIBS, [$APR_LIBS])
174 AC_SUBST(APRUTIL_EXPORT_LIBS)
175 AC_SUBST(APRUTIL_PRIV_INCLUDES)
176 AC_SUBST(APRUTIL_INCLUDES)
177 AC_SUBST(APRUTIL_LDFLAGS)
178 AC_SUBST(APRUTIL_LIBS)
181 dnl copy apr's rules.mk into our build directory.
182 if test ! -d ./build; then
185 cp $APR_BUILD_DIR/apr_rules.mk $abs_builddir/build/rules.mk
188 dnl BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
190 case "$host_alias" in
192 # Check whether they've installed GNU make
193 if make --version > /dev/null 2>&1; then
194 INCLUDE_RULES="include $abs_builddir/build/rules.mk"
195 INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
197 INCLUDE_RULES=".include \"$abs_builddir/build/rules.mk\""
198 INCLUDE_OUTPUTS=".include \"$abs_srcdir/build-outputs.mk\""
202 INCLUDE_RULES="include $abs_builddir/build/rules.mk"
203 INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
206 AC_SUBST(INCLUDE_RULES)
207 AC_SUBST(INCLUDE_OUTPUTS)
209 for d in include include/private; do
210 test -d $top_builddir/$d || mkdir $top_builddir/$d
213 AC_CONFIG_FILES([Makefile export_vars.sh
214 build/pkg/pkginfo apr-util.pc
215 apu-$APRUTIL_MAJOR_VERSION-config:apu-config.in
216 include/private/apu_select_dbm.h
218 include/apu.h include/apu_want.h])
220 AC_CONFIG_COMMANDS([default], [
221 chmod +x apu-$APRUTIL_MAJOR_VERSION-config
223 APRUTIL_MAJOR_VERSION=$APRUTIL_MAJOR_VERSION
226 if test -d $srcdir/test; then
227 AC_CONFIG_FILES([test/Makefile])