Document changes for trunk.
[apr-util.git] / configure.in
blob4d065855bf7529e709deb9105428b0039eebf42c
1 dnl
2 dnl Process this file with autoconf to produce a configure script
3 dnl
5 AC_PREREQ(2.50)
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
21 dnl 
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)`
29 abs_builddir=`pwd`
31 if test "$abs_builddir" != "$abs_srcdir"; then
32   USE_VPATH=1
33   APU_CONFIG_LOCATION=build
34 else
35   APU_CONFIG_LOCATION=source
38 AC_SUBST(APU_CONFIG_LOCATION)
40 AC_CANONICAL_SYSTEM
42 AC_PROG_INSTALL
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
47 # built.
48 case $host in
49 *-apple-darwin*) LT_NO_INSTALL="" ;;
50 *) LT_NO_INSTALL="-no-install" ;;
51 esac
52 AC_SUBST(LT_NO_INSTALL)
54 dnl
55 dnl compute the top directory of the build
56 dnl note: this is needed for LIBTOOL and exporting the bundled Expat
57 dnl
58 top_builddir="$abs_builddir"
59 AC_SUBST(top_builddir)
60 AC_SUBST(abs_srcdir)
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)
83 APR_PARSE_ARGUMENTS
85 dnl load os-specific hints for apr-util
86 APU_PRELOAD
88 dnl
89 dnl set up the compilation flags and stuff
90 dnl
92 APRUTIL_INCLUDES=""
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"
98 dnl
99 dnl Find the APR includes directory and (possibly) the source (base) dir.
101 APU_FIND_APR
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",
125                           [$apache_apr_flags \
126                              --prefix=$prefix \
127                              --exec-prefix=$exec_prefix \
128                              --libdir=$libdir \
129                              --includedir=$includedir \
130                              --bindir=$bindir \
131                              --datadir=$datadir \
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 \
137                           $APRUTIL_INCLUDES"
138         APR_ICONV_DIR="$apu_apriconv_dir"
139       else
140        APR_ICONV_DIR=""
141       fi
142     else
143       APR_ICONV_DIR=""
144     fi
145   ])
146 AC_SUBST(APR_ICONV_DIR)
148 dnl Find LDAP library
149 dnl Determine what DBM backend type to use.
150 dnl Find Expat
151 dnl Find an iconv library
152 APU_FIND_LDAP
153 APU_CHECK_DBM
154 APU_CHECK_DBD
155 APU_CHECK_DBD_MYSQL
156 APU_CHECK_DBD_SQLITE3
157 APU_CHECK_DBD_SQLITE2
158 APU_CHECK_DBD_ORACLE
159 APU_CHECK_DBD_FREETDS
160 APU_CHECK_DBD_ODBC
161 APU_FIND_EXPAT
162 APU_FIND_ICONV
164 dnl Enable DSO build; must be last:
165 APU_CHECK_UTIL_DSO
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])
171   msg="yes"
172 else
173   msg="no"
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
182 so_ext=$APR_SO_EXT
183 lib_target=$APR_LIB_TARGET
184 AC_SUBST(so_ext)
185 AC_SUBST(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 
194    APU_HAVE_MODULES=yes
195 else
196    APU_HAVE_MODULES=no
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)
217 AC_SUBST(LDFLAGS)
219 dnl copy apr's rules.mk into our build directory.
220 if test ! -d ./build; then
221    $mkdir_p build
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
229 *bsdi* | BSD/OS)
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"
234     else
235         INCLUDE_RULES=".include \"$abs_builddir/build/rules.mk\""
236         INCLUDE_OUTPUTS=".include \"$abs_srcdir/build-outputs.mk\""
237     fi
238     ;;
240     INCLUDE_RULES="include $abs_builddir/build/rules.mk"
241     INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
242     ;;
243 esac
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
249 done
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
255                  include/apr_ldap.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])
268 AC_OUTPUT