configure.in revision 251876
1dnl
2dnl Process this file with autoconf to produce a configure script
3dnl
4
5AC_PREREQ(2.59)
6AC_INIT(export_vars.sh.in)
7
8AC_CONFIG_HEADER(include/private/apu_config.h)
9AC_CONFIG_AUX_DIR(build)
10
11sinclude(build/apu-conf.m4)
12sinclude(build/apu-iconv.m4)
13sinclude(build/apu-hints.m4)
14sinclude(build/apr_common.m4)
15sinclude(build/find_apr.m4)
16sinclude(build/crypto.m4)
17sinclude(build/dbm.m4)
18sinclude(build/dbd.m4)
19sinclude(build/dso.m4)
20
21dnl Generate ./config.nice for reproducing runs of configure
22dnl 
23APR_CONFIG_NICE(config.nice)
24
25dnl # Some initial steps for configuration.  We setup the default directory
26dnl # and which files are to be configured.
27
28dnl Absolute source/build directory
29abs_srcdir=`(cd $srcdir && pwd)`
30abs_builddir=`pwd`
31
32if test "$abs_builddir" != "$abs_srcdir"; then
33  USE_VPATH=1
34  APU_CONFIG_LOCATION=build
35else
36  APU_CONFIG_LOCATION=source
37fi
38
39AC_SUBST(APU_CONFIG_LOCATION)
40
41AC_CANONICAL_SYSTEM
42
43AC_PROG_INSTALL
44
45# Use -no-install to link the test programs on all platforms
46# but Darwin, where it would cause the programs to be linked
47# against installed versions of libapr instead of those just
48# built.
49case $host in
50*-apple-darwin*) LT_NO_INSTALL="" ;;
51*) LT_NO_INSTALL="-no-install" ;;
52esac
53AC_SUBST(LT_NO_INSTALL)
54
55dnl
56dnl compute the top directory of the build
57dnl note: this is needed for LIBTOOL and exporting the bundled Expat
58dnl
59top_builddir="$abs_builddir"
60AC_SUBST(top_builddir)
61AC_SUBST(abs_srcdir)
62AC_SUBST(abs_builddir)
63
64dnl Initialize mkdir -p functionality.
65APR_MKDIR_P_CHECK($abs_srcdir/build/mkdir.sh)
66
67dnl get our version information
68get_version="$abs_srcdir/build/get-version.sh"
69version_hdr="$abs_srcdir/include/apu_version.h"
70APRUTIL_MAJOR_VERSION="`$get_version major $version_hdr APU`"
71APRUTIL_DOTTED_VERSION="`$get_version all $version_hdr APU`"
72
73APU_LTVERSION="-version-info `$get_version libtool $version_hdr APU`"
74
75AC_SUBST(APRUTIL_DOTTED_VERSION)
76AC_SUBST(APRUTIL_MAJOR_VERSION)
77AC_SUBST(APU_LTVERSION)
78
79echo "APR-util Version: ${APRUTIL_DOTTED_VERSION}"
80
81dnl Enable the layout handling code, then reparse the prefix-style
82dnl arguments due to autoconf being a PITA.
83APR_ENABLE_LAYOUT(apr-util)
84APR_PARSE_ARGUMENTS
85
86dnl load os-specific hints for apr-util
87APU_PRELOAD
88
89dnl
90dnl set up the compilation flags and stuff
91dnl
92
93APRUTIL_INCLUDES=""
94APRUTIL_PRIV_INCLUDES="-I$top_builddir/include -I$top_builddir/include/private"
95if test -n "$USE_VPATH"; then
96    APRUTIL_PRIV_INCLUDES="$APRUTIL_PRIV_INCLUDES -I$abs_srcdir/include/private -I$abs_srcdir/include"
97fi
98
99dnl
100dnl Find the APR includes directory and (possibly) the source (base) dir.
101dnl
102APU_FIND_APR
103
104dnl
105dnl even though we use apr_rules.mk for building apr-util, we need
106dnl to grab CC and CPP ahead of time so that apr-util config tests
107dnl use the same compiler as APR; we need the same compiler options
108dnl and feature test macros as well
109dnl
110APR_SETIFNULL(CC, `$apr_config --cc`)
111APR_SETIFNULL(CPP, `$apr_config --cpp`)
112APR_ADDTO(CFLAGS, `$apr_config --cflags`)
113APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`)
114apr_shlibpath_var=`$apr_config --shlib-path-var`
115AC_SUBST(apr_shlibpath_var)
116
117dnl
118dnl  Find the APR-ICONV directory.
119dnl
120AC_ARG_WITH(apr-iconv,
121            [  --with-apr-iconv=DIR    relative path to apr-iconv source],
122  [ apu_apriconv_dir="$withval"
123    if test "$apu_apriconv_dir" != "no"; then
124      if test -d "$apu_apriconv_dir"; then
125        APR_SUBDIR_CONFIG("$apu_apriconv_dir",
126                          [$apache_apr_flags \
127                             --prefix=$prefix \
128                             --exec-prefix=$exec_prefix \
129                             --libdir=$libdir \
130                             --includedir=$includedir \
131                             --bindir=$bindir \
132                             --datadir=$datadir \
133                             --with-installbuilddir=$installbuilddir],
134                          [--enable-layout=*|\'--enable-layout=*])
135        APRUTIL_EXPORT_LIBS="$abs_srcdir/$apu_apriconv_dir/lib/libapriconv.la \
136                             $APRUTIL_EXPORT_LIBS"
137        APRUTIL_INCLUDES="-I$abs_srcdir/$apu_apriconv_dir/include \
138                          $APRUTIL_INCLUDES"
139        APR_ICONV_DIR="$apu_apriconv_dir"
140      else
141       APR_ICONV_DIR=""
142      fi
143    else
144      APR_ICONV_DIR=""
145    fi
146  ])
147AC_SUBST(APR_ICONV_DIR)
148
149dnl Find LDAP library
150dnl Determine what DBM backend type to use.
151dnl Find Expat
152dnl Find an iconv library
153APU_CHECK_CRYPTO
154APU_CHECK_CRYPTO_OPENSSL
155APU_CHECK_CRYPTO_NSS
156APU_FIND_LDAP
157APU_CHECK_DBM
158APU_CHECK_DBD
159APU_CHECK_DBD_MYSQL
160APU_CHECK_DBD_SQLITE3
161APU_CHECK_DBD_SQLITE2
162APU_CHECK_DBD_ORACLE
163APU_CHECK_DBD_FREETDS
164APU_CHECK_DBD_ODBC
165APU_FIND_EXPAT
166APU_FIND_ICONV
167
168dnl Enable DSO build; must be last:
169APU_CHECK_UTIL_DSO
170
171AC_SEARCH_LIBS(crypt, crypt ufc)
172AC_MSG_CHECKING(if system crypt() function is threadsafe)
173if test "x$apu_crypt_threadsafe" = "x1"; then
174  AC_DEFINE(APU_CRYPT_THREADSAFE, 1, [Define if the system crypt() function is threadsafe])
175  msg="yes"
176else
177  msg="no"
178fi
179AC_MSG_RESULT([$msg])
180
181AC_CHECK_FUNCS(crypt_r, [ crypt_r="1" ], [ crypt_r="0" ])
182if test "$crypt_r" = "1"; then
183  APU_CHECK_CRYPT_R_STYLE
184fi
185
186so_ext=$APR_SO_EXT
187lib_target=$APR_LIB_TARGET
188AC_SUBST(so_ext)
189AC_SUBST(lib_target)
190
191APRUTIL_LIBNAME="aprutil${libsuffix}"
192AC_SUBST(APRUTIL_LIBNAME)
193
194# Set up destination directory for DSOs.
195APU_DSO_LIBDIR="\${libdir}/apr-util-${APRUTIL_MAJOR_VERSION}"
196# Set APU_HAVE_MODULES appropriately for the Makefile
197if test -n "$APU_MODULES"; then 
198   APU_HAVE_MODULES=yes
199else
200   APU_HAVE_MODULES=no
201fi
202# Define expanded libdir for apu_config.h
203APR_EXPAND_VAR(abs_dso_libdir, $APU_DSO_LIBDIR)
204AC_DEFINE_UNQUOTED([APU_DSO_LIBDIR], ["$abs_dso_libdir"],
205                   [Define to be absolute path to DSO directory])
206AC_SUBST(APU_HAVE_MODULES)
207AC_SUBST(APU_DSO_LIBDIR)
208AC_SUBST(APU_MODULES)
209AC_SUBST(EXTRA_OBJECTS)
210
211dnl
212dnl Prep all the flags and stuff for compilation and export to other builds
213dnl
214APR_ADDTO(APRUTIL_LIBS, [$APR_LIBS])
215
216AC_SUBST(APRUTIL_EXPORT_LIBS)
217AC_SUBST(APRUTIL_PRIV_INCLUDES)
218AC_SUBST(APRUTIL_INCLUDES)
219AC_SUBST(APRUTIL_LDFLAGS)
220AC_SUBST(APRUTIL_LIBS)
221AC_SUBST(LDFLAGS)
222
223dnl copy apr's rules.mk into our build directory.
224if test ! -d ./build; then
225   $mkdir_p build
226fi
227cp $APR_BUILD_DIR/apr_rules.mk $abs_builddir/build/rules.mk
228
229dnl
230dnl BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
231dnl
232case "$host_alias" in
233*bsdi* | BSD/OS)
234    # Check whether they've installed GNU make
235    if make --version > /dev/null 2>&1; then
236        INCLUDE_RULES="include $abs_builddir/build/rules.mk"
237        INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
238    else
239        INCLUDE_RULES=".include \"$abs_builddir/build/rules.mk\""
240        INCLUDE_OUTPUTS=".include \"$abs_srcdir/build-outputs.mk\""
241    fi
242    ;;
243*)
244    INCLUDE_RULES="include $abs_builddir/build/rules.mk"
245    INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
246    ;;
247esac
248AC_SUBST(INCLUDE_RULES)
249AC_SUBST(INCLUDE_OUTPUTS)
250
251for d in include include/private; do
252    test -d $top_builddir/$d || mkdir $top_builddir/$d
253done
254
255AC_CONFIG_FILES([Makefile export_vars.sh
256                 build/pkg/pkginfo apr-util.pc
257                 apu-$APRUTIL_MAJOR_VERSION-config:apu-config.in
258                 include/private/apu_select_dbm.h
259                 include/apr_ldap.h
260                 include/apu.h include/apu_want.h])
261
262AC_CONFIG_COMMANDS([default], [
263chmod +x apu-$APRUTIL_MAJOR_VERSION-config
264],[
265APRUTIL_MAJOR_VERSION=$APRUTIL_MAJOR_VERSION
266])
267
268if test -d $srcdir/test; then
269    AC_CONFIG_FILES([test/Makefile])
270fi
271
272AC_OUTPUT
273