File: configure.in

package info (click to toggle)
apr-util 1.6.1-5
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 4,716 kB
  • sloc: ansic: 31,678; sh: 3,347; makefile: 222; perl: 154; xml: 36
file content (347 lines) | stat: -rw-r--r-- 9,730 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
dnl
dnl Process this file with autoconf to produce a configure script
dnl

AC_PREREQ(2.59)
AC_INIT(export_vars.sh.in)

AC_CONFIG_HEADER(include/private/apu_config.h)
AC_CONFIG_AUX_DIR(build)

sinclude(build/apu-conf.m4)
sinclude(build/apu-iconv.m4)
sinclude(build/apu-hints.m4)
sinclude(build/apr_common.m4)
sinclude(build/find_apr.m4)
sinclude(build/crypto.m4)
sinclude(build/dbm.m4)
sinclude(build/dbd.m4)
sinclude(build/dso.m4)

dnl Generate ./config.nice for reproducing runs of configure
dnl 
APR_CONFIG_NICE(config.nice)

dnl # Some initial steps for configuration.  We setup the default directory
dnl # and which files are to be configured.

dnl Absolute source/build directory
abs_srcdir=`(cd $srcdir && pwd)`
abs_builddir=`pwd`

if test "$abs_builddir" != "$abs_srcdir"; then
  USE_VPATH=1
  APU_CONFIG_LOCATION=build
else
  APU_CONFIG_LOCATION=source
fi

AC_SUBST(APU_CONFIG_LOCATION)

AC_CANONICAL_SYSTEM

AC_PROG_INSTALL

# Use -no-install or -no-fast-install to link the test 
# programs on all platforms but Darwin, where it would cause
# the programs to be linked against installed versions of
# libapr instead of those just built.
case $host in
    *-apple-darwin*)
        LT_NO_INSTALL=""
        ;;
    *-mingw*)
        LT_NO_INSTALL="-no-fast-install"
        ;;
    *)
        LT_NO_INSTALL="-no-install"
        ;;
esac
AC_SUBST(LT_NO_INSTALL)

dnl
dnl compute the top directory of the build
dnl note: this is needed for LIBTOOL and exporting the bundled Expat
dnl
top_builddir="$abs_builddir"
AC_SUBST(top_builddir)
AC_SUBST(abs_srcdir)
AC_SUBST(abs_builddir)

dnl Initialize mkdir -p functionality.
APR_MKDIR_P_CHECK($abs_srcdir/build/mkdir.sh)

dnl get our version information
get_version="$abs_srcdir/build/get-version.sh"
version_hdr="$abs_srcdir/include/apu_version.h"
APRUTIL_MAJOR_VERSION="`$get_version major $version_hdr APU`"
APRUTIL_DOTTED_VERSION="`$get_version all $version_hdr APU`"

APU_LTVERSION="-version-info `$get_version libtool $version_hdr APU`"

AC_SUBST(APRUTIL_DOTTED_VERSION)
AC_SUBST(APRUTIL_MAJOR_VERSION)
AC_SUBST(APU_LTVERSION)

echo "APR-util Version: ${APRUTIL_DOTTED_VERSION}"

dnl Enable the layout handling code, then reparse the prefix-style
dnl arguments due to autoconf being a PITA.
APR_ENABLE_LAYOUT(apr-util)
APR_PARSE_ARGUMENTS

dnl load os-specific hints for apr-util
APU_PRELOAD

dnl
dnl set up the compilation flags and stuff
dnl

APRUTIL_INCLUDES=""
APRUTIL_PRIV_INCLUDES="-I$top_builddir/include -I$top_builddir/include/private"
if test -n "$USE_VPATH"; then
    APRUTIL_PRIV_INCLUDES="$APRUTIL_PRIV_INCLUDES -I$abs_srcdir/include/private -I$abs_srcdir/include"
fi

dnl
dnl Find the APR includes directory and (possibly) the source (base) dir.
dnl
APU_FIND_APR

dnl
dnl even though we use apr_rules.mk for building apr-util, we need
dnl to grab CC and CPP ahead of time so that apr-util config tests
dnl use the same compiler as APR; we need the same compiler options
dnl and feature test macros as well
dnl
APR_SETIFNULL(CC, `$apr_config --cc`)
APR_SETIFNULL(CPP, `$apr_config --cpp`)
APR_ADDTO(CFLAGS, `$apr_config --cflags`)
APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`)
apr_shlibpath_var=`$apr_config --shlib-path-var`
AC_SUBST(apr_shlibpath_var)

dnl
dnl  Find the APR-ICONV directory.
dnl
AC_ARG_WITH(apr-iconv,
            [  --with-apr-iconv=DIR    relative path to apr-iconv source],
  [ apu_apriconv_dir="$withval"
    if test "$apu_apriconv_dir" != "no"; then
      if test -d "$apu_apriconv_dir"; then
        APR_SUBDIR_CONFIG("$apu_apriconv_dir",
                          [$apache_apr_flags \
                             --prefix=$prefix \
                             --exec-prefix=$exec_prefix \
                             --libdir=$libdir \
                             --includedir=$includedir \
                             --bindir=$bindir \
                             --datadir=$datadir \
                             --with-installbuilddir=$installbuilddir],
                          [--enable-layout=*|\'--enable-layout=*])
        APRUTIL_EXPORT_LIBS="$abs_srcdir/$apu_apriconv_dir/lib/libapriconv.la \
                             $APRUTIL_EXPORT_LIBS"
        APRUTIL_INCLUDES="-I$abs_srcdir/$apu_apriconv_dir/include \
                          $APRUTIL_INCLUDES"
        APR_ICONV_DIR="$apu_apriconv_dir"
      else
       APR_ICONV_DIR=""
      fi
    else
      APR_ICONV_DIR=""
    fi
  ])
AC_SUBST(APR_ICONV_DIR)

dnl Find LDAP library
dnl Determine what DBM backend type to use.
dnl Find Expat
dnl Find an iconv library
APU_CHECK_CRYPTO
APU_FIND_LDAP
APU_CHECK_DBM
APU_CHECK_DBD
APU_CHECK_DBD_MYSQL
APU_CHECK_DBD_SQLITE3
APU_CHECK_DBD_SQLITE2
APU_CHECK_DBD_ORACLE
APU_CHECK_DBD_ODBC
APU_FIND_EXPAT
APU_FIND_ICONV

dnl Enable DSO build; must be last:
APU_CHECK_UTIL_DSO

AC_SEARCH_LIBS(crypt, crypt ufc)
AC_MSG_CHECKING(if system crypt() function is threadsafe)
if test "x$apu_crypt_threadsafe" = "x1"; then
  AC_DEFINE(APU_CRYPT_THREADSAFE, 1, [Define if the system crypt() function is threadsafe])
  msg="yes"
else
  msg="no"
fi
AC_MSG_RESULT([$msg])

AC_CHECK_FUNCS(crypt_r, [ crypt_r="1" ], [ crypt_r="0" ])
if test "$crypt_r" = "1"; then
  APU_CHECK_CRYPT_R_STYLE
fi

AC_CACHE_CHECK([whether the compiler handles weak symbols], [apu_cv_weak_symbols],
[AC_TRY_RUN([
__attribute__ ((weak))
int weak_noop(void)
{
    return 0;
}
int main()
{
    return weak_noop();
}], [apu_cv_weak_symbols=yes], [apu_cv_weak_symbols=no], [apu_cv_weak_symbols=no])])

if test "$apu_cv_weak_symbols" = "yes"; then
    AC_DEFINE(HAVE_WEAK_SYMBOLS, 1, [Define if compiler handles weak symbols])
fi

AC_CACHE_CHECK([for memset_s support], [apu_cv_memset_s],
[AC_TRY_RUN([
#ifdef HAVE_STRING_H
#define __STDC_WANT_LIB_EXT1__ 1
#include <string.h>
#endif

int main(int argc, const char **argv)
{
    char buf[1] = {1};
    return memset_s(buf, sizeof buf, 0, sizeof buf) != 0 || *buf != '\0';
}], [apu_cv_memset_s=yes], [apu_cv_memset_s=no], [apu_cv_memset_s=no])])

if test "$apu_cv_memset_s" = "yes"; then
   AC_DEFINE([HAVE_MEMSET_S], 1, [Define if memset_s function is supported])
fi

AC_CACHE_CHECK([for explicit_bzero support], [apu_cv_explicit_bzero],
[AC_TRY_RUN([
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif

int main(int argc, const char **argv)
{
    char buf[1] = {1};
    explicit_bzero(buf, sizeof buf);
    return *buf != '\0';
}], [apu_cv_explicit_bzero=yes], [apu_cv_explicit_bzero=no], [apu_cv_explicit_bzero=no])])

if test "$apu_cv_explicit_bzero" = "yes"; then
   AC_DEFINE([HAVE_EXPLICIT_BZERO], 1, [Define if explicit_bzero function is supported])
fi

so_ext=$APR_SO_EXT
lib_target=$APR_LIB_TARGET
AC_SUBST(so_ext)
AC_SUBST(lib_target)

APRUTIL_LIBNAME="aprutil${libsuffix}"
AC_SUBST(APRUTIL_LIBNAME)

# Set up destination directory for DSOs.
APU_DSO_LIBDIR="\${libdir}/apr-util-${APRUTIL_MAJOR_VERSION}"
# Set APU_HAVE_MODULES appropriately for the Makefile
if test -n "$APU_MODULES"; then 
   APU_HAVE_MODULES=yes
else
   APU_HAVE_MODULES=no
fi
# Define expanded libdir for apu_config.h
APR_EXPAND_VAR(abs_dso_libdir, $APU_DSO_LIBDIR)
AC_DEFINE_UNQUOTED([APU_DSO_LIBDIR], ["$abs_dso_libdir"],
                   [Define to be absolute path to DSO directory])
AC_SUBST(APU_HAVE_MODULES)
AC_SUBST(APU_DSO_LIBDIR)
AC_SUBST(APU_MODULES)
AC_SUBST(EXTRA_OBJECTS)

dnl
dnl Prep all the flags and stuff for compilation and export to other builds
dnl
APR_ADDTO(APRUTIL_LIBS, [$APR_LIBS])

APR_REMOVEFROM(APRUTIL_LDFLAGS, [-L/usr/lib])
APR_REMOVEFROM(APRUTIL_INCLUDE, [-I/usr/include])

AC_SUBST(APRUTIL_EXPORT_LIBS)
AC_SUBST(APRUTIL_PRIV_INCLUDES)
AC_SUBST(APRUTIL_INCLUDES)
AC_SUBST(APRUTIL_LDFLAGS)
AC_SUBST(APRUTIL_LIBS)
AC_SUBST(LDFLAGS)

dnl copy apr's rules.mk into our build directory.
if test ! -d ./build; then
   $mkdir_p build
fi
dnl
dnl MinGW: If APR is shared, APR_DECLARE_EXPORT will be defined in the
dnl        internal CPPFLAGS, but APR-Util needs APU_DECLARE_EXPORT instead.
dnl        If APR is static, APR_DECLARE_STATIC will be defined in the
dnl        internal CPPFLAGS, but APR-Util needs APU_DECLARE_STATIC too.
dnl
case $host in
    *-mingw*)
        sed -e 's/-DAPR_DECLARE_EXPORT/-DAPU_DECLARE_EXPORT/' \
            -e 's/-DAPR_DECLARE_STATIC/-DAPU_DECLARE_STATIC -DAPR_DECLARE_STATIC/' \
            < $APR_BUILD_DIR/apr_rules.mk > $abs_builddir/build/rules.mk
        ;;
    *)
        cp $APR_BUILD_DIR/apr_rules.mk $abs_builddir/build/rules.mk
        ;;
esac

dnl
dnl BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
dnl
case "$host_alias" in
*bsdi* | BSD/OS)
    # Check whether they've installed GNU make
    if make --version > /dev/null 2>&1; then
        INCLUDE_RULES="include $abs_builddir/build/rules.mk"
        INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
    else
        INCLUDE_RULES=".include \"$abs_builddir/build/rules.mk\""
        INCLUDE_OUTPUTS=".include \"$abs_srcdir/build-outputs.mk\""
    fi
    ;;
*)
    INCLUDE_RULES="include $abs_builddir/build/rules.mk"
    INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
    ;;
esac
AC_SUBST(INCLUDE_RULES)
AC_SUBST(INCLUDE_OUTPUTS)

for d in include include/private; do
    test -d $top_builddir/$d || mkdir $top_builddir/$d
done

AC_CONFIG_FILES([Makefile export_vars.sh
                 build/pkg/pkginfo apr-util.pc
                 apu-$APRUTIL_MAJOR_VERSION-config:apu-config.in
                 include/private/apu_select_dbm.h
                 include/apr_ldap.h
                 include/apu.h include/apu_want.h])

AC_CONFIG_COMMANDS([default], [
chmod +x apu-$APRUTIL_MAJOR_VERSION-config
],[
APRUTIL_MAJOR_VERSION=$APRUTIL_MAJOR_VERSION
])

if test -d $srcdir/test; then
    AC_CONFIG_FILES([test/Makefile])
fi

AC_OUTPUT