2
dnl find_apu.m4 : locate the APR-util (APU) include files and libraries
4
dnl This macro file can be used by applications to find and use the APU
5
dnl library. It provides a standardized mechanism for using APU. It supports
6
dnl embedding APU into the application source, or locating an installed
9
dnl APR_FIND_APU(srcdir, builddir, implicit-install-check, acceptable-majors)
11
dnl where srcdir is the location of the bundled APU source directory, or
12
dnl empty if source is not bundled.
14
dnl where builddir is the location where the bundled APU will be built,
15
dnl or empty if the build will occur in the srcdir.
17
dnl where implicit-install-check set to 1 indicates if there is no
18
dnl --with-apr-util option specified, we will look for installed copies.
20
dnl where acceptable-majors is a space separated list of acceptable major
21
dnl version numbers. Often only a single major version will be acceptable.
22
dnl If multiple versions are specified, and --with-apr-util=PREFIX or the
23
dnl implicit installed search are used, then the first (leftmost) version
24
dnl in the list that is found will be used. Currently defaults to [0 1].
26
dnl Sets the following variables on exit:
28
dnl apu_found : "yes", "no", "reconfig"
30
dnl apu_config : If the apu-config tool exists, this refers to it. If
31
dnl apu_found is "reconfig", then the bundled directory
32
dnl should be reconfigured *before* using apu_config.
34
dnl Note: this macro file assumes that apr-config has been installed; it
35
dnl is normally considered a required part of an APR installation.
37
dnl Note: At this time, we cannot find *both* a source dir and a build dir.
38
dnl If both are available, the build directory should be passed to
39
dnl the --with-apr-util switch.
41
dnl Note: the installation layout is presumed to follow the standard
42
dnl PREFIX/lib and PREFIX/include pattern. If the APU config file
43
dnl is available (and can be found), then non-standard layouts are
44
dnl possible, since it will be described in the config file.
46
dnl If a bundled source directory is available and needs to be (re)configured,
47
dnl then apu_found is set to "reconfig". The caller should reconfigure the
48
dnl (passed-in) source directory, placing the result in the build directory,
51
dnl If apu_found is "yes" or "reconfig", then the caller should use the
52
dnl value of apu_config to fetch any necessary build/link information.
55
AC_DEFUN([APR_FIND_APU], [
58
if test "$ac_cv_emxos2" = "yes"; then
59
# Scripts don't pass test -x on OS/2
67
ifdef(AC_WARNING,([$0: missing argument 4 (acceptable-majors): Defaulting to APU 0.x then APU 1.x]))
68
acceptable_majors="0 1"
69
], [acceptable_majors="$4"])
71
apu_temp_acceptable_apu_config=""
72
for apu_temp_major in $acceptable_majors
74
case $apu_temp_major in
76
apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-config"
79
apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-$apu_temp_major-config"
84
AC_MSG_CHECKING(for APR-util)
86
[ --with-apr-util=PATH prefix for installed APU, path to APU build tree,
87
or the full path to apu-config],
89
if test "$withval" = "no" || test "$withval" = "yes"; then
90
AC_MSG_ERROR([--with-apr-util requires a directory or file to be provided])
93
for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config
95
for lookdir in "$withval/bin" "$withval"
97
if $TEST_X "$lookdir/$apu_temp_apu_config_file"; then
99
apu_config="$lookdir/$apu_temp_apu_config_file"
105
if test "$apu_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then
107
apu_config="$withval"
110
dnl if --with-apr-util is used, it is a fatal error for its argument
112
if test "$apu_found" != "yes"; then
113
AC_MSG_ERROR([the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file.])
116
dnl if we have a bundled source directory, use it
117
if test -d "$1"; then
118
apu_temp_abs_srcdir="`cd $1 && pwd`"
120
apu_bundled_major="`sed -n '/#define.*APU_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apu_version.h\"`"
121
case $apu_bundled_major in
123
AC_MSG_ERROR([failed to find major version of bundled APU])
126
apu_temp_apu_config_file="apu-config"
129
apu_temp_apu_config_file="apu-$apu_bundled_major-config"
132
if test -n "$2"; then
133
apu_config="$2/$apu_temp_apu_config_file"
135
apu_config="$1/$apu_temp_apu_config_file"
138
if test "$apu_found" = "no" && test -n "$3" && test "$3" = "1"; then
139
for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config
141
if $apu_temp_apu_config_file --help > /dev/null 2>&1 ; then
143
apu_config="$apu_temp_apu_config_file"
146
dnl look in some standard places (apparently not in builtin/default)
147
for lookdir in /usr /usr/local /opt/apr /usr/local/apache2 ; do
148
if $TEST_X "$lookdir/bin/$apu_temp_apu_config_file"; then
150
apu_config="$lookdir/bin/$apu_temp_apu_config_file"
159
AC_MSG_RESULT($apu_found)