Do not move if rownum is not greater than zero.
[apr-util.git] / configure.in
blob7065959ddee10eedc772508decb905a5cd9f28c4
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)
19 dnl Generate ./config.nice for reproducing runs of configure
20 dnl 
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)`
28 abs_builddir=`pwd`
30 if test "$abs_builddir" != "$abs_srcdir"; then
31   USE_VPATH=1
32   APU_CONFIG_LOCATION=build
33 else
34   APU_CONFIG_LOCATION=source
37 AC_SUBST(APU_CONFIG_LOCATION)
39 AC_CANONICAL_SYSTEM
41 AC_PROG_INSTALL
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
46 # built.
47 case $host in
48 *-apple-darwin*) LT_NO_INSTALL="" ;;
49 *) LT_NO_INSTALL="-no-install" ;;
50 esac
51 AC_SUBST(LT_NO_INSTALL)
53 dnl
54 dnl compute the top directory of the build
55 dnl note: this is needed for LIBTOOL and exporting the bundled Expat
56 dnl
57 top_builddir="$abs_builddir"
58 AC_SUBST(top_builddir)
59 AC_SUBST(abs_srcdir)
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)
82 APR_PARSE_ARGUMENTS
84 dnl load os-specific hints for apr-util
85 APU_PRELOAD
87 dnl
88 dnl set up the compilation flags and stuff
89 dnl
91 APRUTIL_INCLUDES=""
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"
97 dnl
98 dnl Find the APR includes directory and (possibly) the source (base) dir.
99 dnl
100 APU_FIND_APR
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",
122                           [$apache_apr_flags \
123                              --prefix=$prefix \
124                              --exec-prefix=$exec_prefix \
125                              --libdir=$libdir \
126                              --includedir=$includedir \
127                              --bindir=$bindir \
128                              --datadir=$datadir \
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 \
134                           $APRUTIL_INCLUDES"
135         APR_ICONV_DIR="$apu_apriconv_dir"
136       else
137        APR_ICONV_DIR=""
138       fi
139     else
140       APR_ICONV_DIR=""
141     fi
142   ])
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])
149   msg="yes"
150 else
151   msg="no"
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.
162 dnl Find Expat
163 dnl Find an iconv library
164 APU_FIND_LDAP
165 APU_CHECK_DBM
166 APU_CHECK_DBD
167 APU_CHECK_DBD_MYSQL
168 APU_CHECK_DBD_SQLITE3
169 APU_CHECK_DBD_SQLITE2
170 APU_CHECK_DBD_ORACLE
171 APU_CHECK_DBD_FREETDS
172 dnl Enable DSO build; must be last:
173 APU_CHECK_DBD_DSO
174 APU_FIND_EXPAT
175 APU_FIND_ICONV
177 so_ext=$APR_SO_EXT
178 lib_target=$APR_LIB_TARGET
179 AC_SUBST(so_ext)
180 AC_SUBST(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 
189    APU_HAVE_MODULES=yes
190 else
191    APU_HAVE_MODULES=no
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)
212 AC_SUBST(LDFLAGS)
214 dnl copy apr's rules.mk into our build directory.
215 if test ! -d ./build; then
216    $mkdir_p build
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
224 *bsdi* | BSD/OS)
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"
229     else
230         INCLUDE_RULES=".include \"$abs_builddir/build/rules.mk\""
231         INCLUDE_OUTPUTS=".include \"$abs_srcdir/build-outputs.mk\""
232     fi
233     ;;
235     INCLUDE_RULES="include $abs_builddir/build/rules.mk"
236     INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
237     ;;
238 esac
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
244 done
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
250                  include/apr_ldap.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])
263 AC_OUTPUT