]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/apr-util/configure.in
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / apr-util / configure.in
1 dnl
2 dnl Process this file with autoconf to produce a configure script
3 dnl
4
5 AC_PREREQ(2.59)
6 AC_INIT(export_vars.sh.in)
7
8 AC_CONFIG_HEADER(include/private/apu_config.h)
9 AC_CONFIG_AUX_DIR(build)
10
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)
20
21 dnl Generate ./config.nice for reproducing runs of configure
22 dnl 
23 APR_CONFIG_NICE(config.nice)
24
25 dnl # Some initial steps for configuration.  We setup the default directory
26 dnl # and which files are to be configured.
27
28 dnl Absolute source/build directory
29 abs_srcdir=`(cd $srcdir && pwd)`
30 abs_builddir=`pwd`
31
32 if test "$abs_builddir" != "$abs_srcdir"; then
33   USE_VPATH=1
34   APU_CONFIG_LOCATION=build
35 else
36   APU_CONFIG_LOCATION=source
37 fi
38
39 AC_SUBST(APU_CONFIG_LOCATION)
40
41 AC_CANONICAL_SYSTEM
42
43 AC_PROG_INSTALL
44
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.
49 case $host in
50     *-apple-darwin*)
51         LT_NO_INSTALL=""
52         ;;
53     *-mingw*)
54         LT_NO_INSTALL="-no-fast-install"
55         ;;
56     *)
57         LT_NO_INSTALL="-no-install"
58         ;;
59 esac
60 AC_SUBST(LT_NO_INSTALL)
61
62 dnl
63 dnl compute the top directory of the build
64 dnl note: this is needed for LIBTOOL and exporting the bundled Expat
65 dnl
66 top_builddir="$abs_builddir"
67 AC_SUBST(top_builddir)
68 AC_SUBST(abs_srcdir)
69 AC_SUBST(abs_builddir)
70
71 dnl Initialize mkdir -p functionality.
72 APR_MKDIR_P_CHECK($abs_srcdir/build/mkdir.sh)
73
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`"
79
80 APU_LTVERSION="-version-info `$get_version libtool $version_hdr APU`"
81
82 AC_SUBST(APRUTIL_DOTTED_VERSION)
83 AC_SUBST(APRUTIL_MAJOR_VERSION)
84 AC_SUBST(APU_LTVERSION)
85
86 echo "APR-util Version: ${APRUTIL_DOTTED_VERSION}"
87
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)
91 APR_PARSE_ARGUMENTS
92
93 dnl load os-specific hints for apr-util
94 APU_PRELOAD
95
96 dnl
97 dnl set up the compilation flags and stuff
98 dnl
99
100 APRUTIL_INCLUDES=""
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"
104 fi
105
106 dnl
107 dnl Find the APR includes directory and (possibly) the source (base) dir.
108 dnl
109 APU_FIND_APR
110
111 dnl
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
116 dnl
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)
123
124 dnl
125 dnl  Find the APR-ICONV directory.
126 dnl
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",
133                           [$apache_apr_flags \
134                              --prefix=$prefix \
135                              --exec-prefix=$exec_prefix \
136                              --libdir=$libdir \
137                              --includedir=$includedir \
138                              --bindir=$bindir \
139                              --datadir=$datadir \
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 \
145                           $APRUTIL_INCLUDES"
146         APR_ICONV_DIR="$apu_apriconv_dir"
147       else
148        APR_ICONV_DIR=""
149       fi
150     else
151       APR_ICONV_DIR=""
152     fi
153   ])
154 AC_SUBST(APR_ICONV_DIR)
155
156 dnl Find LDAP library
157 dnl Determine what DBM backend type to use.
158 dnl Find Expat
159 dnl Find an iconv library
160 APU_CHECK_CRYPTO
161 APU_FIND_LDAP
162 APU_CHECK_DBM
163 APU_CHECK_DBD
164 APU_CHECK_DBD_MYSQL
165 APU_CHECK_DBD_SQLITE3
166 APU_CHECK_DBD_SQLITE2
167 APU_CHECK_DBD_ORACLE
168 APU_CHECK_DBD_FREETDS
169 APU_CHECK_DBD_ODBC
170 APU_FIND_EXPAT
171 APU_FIND_ICONV
172
173 dnl Enable DSO build; must be last:
174 APU_CHECK_UTIL_DSO
175
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])
180   msg="yes"
181 else
182   msg="no"
183 fi
184 AC_MSG_RESULT([$msg])
185
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
189 fi
190
191 so_ext=$APR_SO_EXT
192 lib_target=$APR_LIB_TARGET
193 AC_SUBST(so_ext)
194 AC_SUBST(lib_target)
195
196 APRUTIL_LIBNAME="aprutil${libsuffix}"
197 AC_SUBST(APRUTIL_LIBNAME)
198
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 
203    APU_HAVE_MODULES=yes
204 else
205    APU_HAVE_MODULES=no
206 fi
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)
215
216 dnl
217 dnl Prep all the flags and stuff for compilation and export to other builds
218 dnl
219 APR_ADDTO(APRUTIL_LIBS, [$APR_LIBS])
220
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)
226 AC_SUBST(LDFLAGS)
227
228 dnl copy apr's rules.mk into our build directory.
229 if test ! -d ./build; then
230    $mkdir_p build
231 fi
232 dnl
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.
237 dnl
238 case $host in
239     *-mingw*)
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
243         ;;
244     *)
245         cp $APR_BUILD_DIR/apr_rules.mk $abs_builddir/build/rules.mk
246         ;;
247 esac
248
249 dnl
250 dnl BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
251 dnl
252 case "$host_alias" in
253 *bsdi* | BSD/OS)
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"
258     else
259         INCLUDE_RULES=".include \"$abs_builddir/build/rules.mk\""
260         INCLUDE_OUTPUTS=".include \"$abs_srcdir/build-outputs.mk\""
261     fi
262     ;;
263 *)
264     INCLUDE_RULES="include $abs_builddir/build/rules.mk"
265     INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
266     ;;
267 esac
268 AC_SUBST(INCLUDE_RULES)
269 AC_SUBST(INCLUDE_OUTPUTS)
270
271 for d in include include/private; do
272     test -d $top_builddir/$d || mkdir $top_builddir/$d
273 done
274
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
279                  include/apr_ldap.h
280                  include/apu.h include/apu_want.h])
281
282 AC_CONFIG_COMMANDS([default], [
283 chmod +x apu-$APRUTIL_MAJOR_VERSION-config
284 ],[
285 APRUTIL_MAJOR_VERSION=$APRUTIL_MAJOR_VERSION
286 ])
287
288 if test -d $srcdir/test; then
289     AC_CONFIG_FILES([test/Makefile])
290 fi
291
292 AC_OUTPUT