Don't expect variable argument list to end with NULL
[apr-util.git] / configure.in
blob6a6ec006b0ff52d51da0b5fa96766da6f7748bde
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 dnl
44 dnl compute the top directory of the build
45 dnl note: this is needed for LIBTOOL and exporting the bundled Expat
46 dnl
47 top_builddir="$abs_builddir"
48 AC_SUBST(top_builddir)
49 AC_SUBST(abs_srcdir)
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)
69 APR_PARSE_ARGUMENTS
71 dnl load os-specific hints for apr-util
72 APU_PRELOAD
74 dnl
75 dnl set up the compilation flags and stuff
76 dnl
78 APRUTIL_INCLUDES=""
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"
84 dnl
85 dnl Find the APR includes directory and (possibly) the source (base) dir.
86 dnl
87 APU_FIND_APR
89 dnl
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
94 dnl
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",
109                           [$apache_apr_flags \
110                              --prefix=$prefix \
111                              --exec-prefix=$exec_prefix \
112                              --libdir=$libdir \
113                              --includedir=$includedir \
114                              --bindir=$bindir \
115                              --datadir=$datadir \
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 \
121                           $APRUTIL_INCLUDES"
122         APR_ICONV_DIR="$apu_apriconv_dir"
123       else
124        APR_ICONV_DIR=""
125       fi
126     else
127       APR_ICONV_DIR=""
128     fi
129   ])
130 AC_SUBST(APR_ICONV_DIR)
132 dnl Find LDAP library
133 dnl Determine what DBM backend type to use.
134 dnl Find Expat
135 dnl Find an iconv library
136 APU_FIND_LDAP
137 APU_CHECK_DBM
138 APU_CHECK_DBD
139 APU_CHECK_DBD_MYSQL
140 APU_CHECK_DBD_SQLITE3
141 APU_CHECK_DBD_SQLITE2
142 APU_CHECK_DBD_ORACLE
143 APU_FIND_EXPAT
144 APU_FIND_ICONV
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])
150   msg="yes"
151 else
152   msg="no"
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
161 so_ext=$APR_SO_EXT
162 lib_target=$APR_LIB_TARGET
163 AC_SUBST(so_ext)
164 AC_SUBST(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)
179 AC_SUBST(LDFLAGS)
181 dnl copy apr's rules.mk into our build directory.
182 if test ! -d ./build; then
183    $mkdir_p build
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
191 *bsdi* | BSD/OS)
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"
196     else
197         INCLUDE_RULES=".include \"$abs_builddir/build/rules.mk\""
198         INCLUDE_OUTPUTS=".include \"$abs_srcdir/build-outputs.mk\""
199     fi
200     ;;
202     INCLUDE_RULES="include $abs_builddir/build/rules.mk"
203     INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
204     ;;
205 esac
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
211 done
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
217                  include/apr_ldap.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])
230 AC_OUTPUT