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/crypto.m4)
17 sinclude(build/dbm.m4)
18 sinclude(build/dbd.m4)
19 sinclude(build/dso.m4)
21 dnl Generate ./config.nice for reproducing runs of configure
23 APR_CONFIG_NICE(config.nice)
25 dnl # Some initial steps for configuration. We setup the default directory
26 dnl # and which files are to be configured.
28 dnl Absolute source/build directory
29 abs_srcdir=`(cd $srcdir && pwd)`
32 if test "$abs_builddir" != "$abs_srcdir"; then
34 APU_CONFIG_LOCATION=build
36 APU_CONFIG_LOCATION=source
39 AC_SUBST(APU_CONFIG_LOCATION)
45 # Use -no-install or -no-fast-install to link the test
46 # programs on all platforms but Darwin, where it would cause
47 # the programs to be linked against installed versions of
48 # libapr instead of those just built.
54 LT_NO_INSTALL="-no-fast-install"
57 LT_NO_INSTALL="-no-install"
60 AC_SUBST(LT_NO_INSTALL)
63 dnl compute the top directory of the build
64 dnl note: this is needed for LIBTOOL and exporting the bundled Expat
66 top_builddir="$abs_builddir"
67 AC_SUBST(top_builddir)
69 AC_SUBST(abs_builddir)
71 dnl Initialize mkdir -p functionality.
72 APR_MKDIR_P_CHECK($abs_srcdir/build/mkdir.sh)
74 dnl get our version information
75 get_version="$abs_srcdir/build/get-version.sh"
76 version_hdr="$abs_srcdir/include/apu_version.h"
77 APRUTIL_MAJOR_VERSION="`$get_version major $version_hdr APU`"
78 APRUTIL_DOTTED_VERSION="`$get_version all $version_hdr APU`"
80 APU_LTVERSION="-version-info `$get_version libtool $version_hdr APU`"
82 AC_SUBST(APRUTIL_DOTTED_VERSION)
83 AC_SUBST(APRUTIL_MAJOR_VERSION)
84 AC_SUBST(APU_LTVERSION)
86 echo "APR-util Version: ${APRUTIL_DOTTED_VERSION}"
88 dnl Enable the layout handling code, then reparse the prefix-style
89 dnl arguments due to autoconf being a PITA.
90 APR_ENABLE_LAYOUT(apr-util)
93 dnl load os-specific hints for apr-util
97 dnl set up the compilation flags and stuff
101 APRUTIL_PRIV_INCLUDES="-I$top_builddir/include -I$top_builddir/include/private"
102 if test -n "$USE_VPATH"; then
103 APRUTIL_PRIV_INCLUDES="$APRUTIL_PRIV_INCLUDES -I$abs_srcdir/include/private -I$abs_srcdir/include"
107 dnl Find the APR includes directory and (possibly) the source (base) dir.
112 dnl even though we use apr_rules.mk for building apr-util, we need
113 dnl to grab CC and CPP ahead of time so that apr-util config tests
114 dnl use the same compiler as APR; we need the same compiler options
115 dnl and feature test macros as well
117 APR_SETIFNULL(CC, `$apr_config --cc`)
118 APR_SETIFNULL(CPP, `$apr_config --cpp`)
119 APR_ADDTO(CFLAGS, `$apr_config --cflags`)
120 APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`)
121 apr_shlibpath_var=`$apr_config --shlib-path-var`
122 AC_SUBST(apr_shlibpath_var)
125 dnl Find the APR-ICONV directory.
127 AC_ARG_WITH(apr-iconv,
128 [ --with-apr-iconv=DIR relative path to apr-iconv source],
129 [ apu_apriconv_dir="$withval"
130 if test "$apu_apriconv_dir" != "no"; then
131 if test -d "$apu_apriconv_dir"; then
132 APR_SUBDIR_CONFIG("$apu_apriconv_dir",
135 --exec-prefix=$exec_prefix \
137 --includedir=$includedir \
140 --with-installbuilddir=$installbuilddir],
141 [--enable-layout=*|\'--enable-layout=*])
142 APRUTIL_EXPORT_LIBS="$abs_srcdir/$apu_apriconv_dir/lib/libapriconv.la \
143 $APRUTIL_EXPORT_LIBS"
144 APRUTIL_INCLUDES="-I$abs_srcdir/$apu_apriconv_dir/include \
146 APR_ICONV_DIR="$apu_apriconv_dir"
154 AC_SUBST(APR_ICONV_DIR)
156 dnl Find LDAP library
157 dnl Determine what DBM backend type to use.
159 dnl Find an iconv library
165 APU_CHECK_DBD_SQLITE3
166 APU_CHECK_DBD_SQLITE2
168 APU_CHECK_DBD_FREETDS
173 dnl Enable DSO build; must be last:
176 AC_SEARCH_LIBS(crypt, crypt ufc)
177 AC_MSG_CHECKING(if system crypt() function is threadsafe)
178 if test "x$apu_crypt_threadsafe" = "x1"; then
179 AC_DEFINE(APU_CRYPT_THREADSAFE, 1, [Define if the system crypt() function is threadsafe])
184 AC_MSG_RESULT([$msg])
186 AC_CHECK_FUNCS(crypt_r, [ crypt_r="1" ], [ crypt_r="0" ])
187 if test "$crypt_r" = "1"; then
188 APU_CHECK_CRYPT_R_STYLE
192 lib_target=$APR_LIB_TARGET
196 APRUTIL_LIBNAME="aprutil${libsuffix}"
197 AC_SUBST(APRUTIL_LIBNAME)
199 # Set up destination directory for DSOs.
200 APU_DSO_LIBDIR="\${libdir}/apr-util-${APRUTIL_MAJOR_VERSION}"
201 # Set APU_HAVE_MODULES appropriately for the Makefile
202 if test -n "$APU_MODULES"; then
207 # Define expanded libdir for apu_config.h
208 APR_EXPAND_VAR(abs_dso_libdir, $APU_DSO_LIBDIR)
209 AC_DEFINE_UNQUOTED([APU_DSO_LIBDIR], ["$abs_dso_libdir"],
210 [Define to be absolute path to DSO directory])
211 AC_SUBST(APU_HAVE_MODULES)
212 AC_SUBST(APU_DSO_LIBDIR)
213 AC_SUBST(APU_MODULES)
214 AC_SUBST(EXTRA_OBJECTS)
217 dnl Prep all the flags and stuff for compilation and export to other builds
219 APR_ADDTO(APRUTIL_LIBS, [$APR_LIBS])
221 AC_SUBST(APRUTIL_EXPORT_LIBS)
222 AC_SUBST(APRUTIL_PRIV_INCLUDES)
223 AC_SUBST(APRUTIL_INCLUDES)
224 AC_SUBST(APRUTIL_LDFLAGS)
225 AC_SUBST(APRUTIL_LIBS)
228 dnl copy apr's rules.mk into our build directory.
229 if test ! -d ./build; then
233 dnl MinGW: If APR is shared, APR_DECLARE_EXPORT will be defined in the
234 dnl internal CPPFLAGS, but APR-Util needs APU_DECLARE_EXPORT instead.
235 dnl If APR is static, APR_DECLARE_STATIC will be defined in the
236 dnl internal CPPFLAGS, but APR-Util needs APU_DECLARE_STATIC too.
240 sed -e 's/-DAPR_DECLARE_EXPORT/-DAPU_DECLARE_EXPORT/' \
241 -e 's/-DAPR_DECLARE_STATIC/-DAPU_DECLARE_STATIC -DAPR_DECLARE_STATIC/' \
242 < $APR_BUILD_DIR/apr_rules.mk > $abs_builddir/build/rules.mk
245 cp $APR_BUILD_DIR/apr_rules.mk $abs_builddir/build/rules.mk
250 dnl BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
252 case "$host_alias" in
254 # Check whether they've installed GNU make
255 if make --version > /dev/null 2>&1; then
256 INCLUDE_RULES="include $abs_builddir/build/rules.mk"
257 INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
259 INCLUDE_RULES=".include \"$abs_builddir/build/rules.mk\""
260 INCLUDE_OUTPUTS=".include \"$abs_srcdir/build-outputs.mk\""
264 INCLUDE_RULES="include $abs_builddir/build/rules.mk"
265 INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
268 AC_SUBST(INCLUDE_RULES)
269 AC_SUBST(INCLUDE_OUTPUTS)
271 for d in include include/private; do
272 test -d $top_builddir/$d || mkdir $top_builddir/$d
275 AC_CONFIG_FILES([Makefile export_vars.sh
276 build/pkg/pkginfo apr-util.pc
277 apu-$APRUTIL_MAJOR_VERSION-config:apu-config.in
278 include/private/apu_select_dbm.h
280 include/apu.h include/apu_want.h])
282 AC_CONFIG_COMMANDS([default], [
283 chmod +x apu-$APRUTIL_MAJOR_VERSION-config
285 APRUTIL_MAJOR_VERSION=$APRUTIL_MAJOR_VERSION
288 if test -d $srcdir/test; then
289 AC_CONFIG_FILES([test/Makefile])