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, path, implicit-install-check])
11 dnl where srcdir is the location of the bundled APU source directory, or
12 dnl empty if source is not bundled.
13 dnl where path is the prefix to the location where the bundled APU will
15 dnl where implicit-install-check set to 1 indicates if there is no
16 dnl --with-apr option specified, we will look for installed copies.
18 dnl Sets the following variables on exit:
20 dnl apu_found : "yes", "no", "reconfig"
22 dnl apu_config : If the apu-config tool exists, this refers to it. If
23 dnl apu_found is "reconfig", then the bundled directory
24 dnl should be reconfigured *before* using apu_config.
26 dnl Note: At this time, we cannot find *both* a source dir and a build dir.
27 dnl If both are available, the build directory should be passed to
28 dnl the --with-apr-util switch.
30 dnl Note: the installation layout is presumed to follow the standard
31 dnl PREFIX/lib and PREFIX/include pattern. If the APU config file
32 dnl is available (and can be found), then non-standard layouts are
33 dnl possible, since it will be described in the config file.
35 dnl If a bundled source directory is available and needs to be (re)configured,
36 dnl then apu_found is set to "reconfig". The caller should reconfigure the
37 dnl (passed-in) source directory, placing the result in the build directory,
40 dnl If apu_found is "yes" or "reconfig", then the caller should use the
41 dnl value of apu_config to fetch any necessary build/link information.
44 AC_DEFUN(APR_FIND_APU, [
47 AC_MSG_CHECKING(for APR-util)
49 [ --with-apr-util=DIR prefix for installed APU, or path to APU build tree],
51 if test "$withval" = "no" || test "$withval" = "yes"; then
52 AC_MSG_ERROR([--with-apr-util requires a directory to be provided])
55 if test -x "$withval/bin/apu-config"; then
57 apu_config="$withval/bin/apu-config"
58 elif test -x "$withval/apu-config"; then
59 dnl Already configured build dir
61 apu_config="$withval/apu-config"
62 elif test -x "$withval" && $withval --help > /dev/null 2>&1 ; then
67 dnl if --with-apr-util is used, then the target prefix/directory must
69 if test "$apu_found" != "yes"; then
71 The directory given to --with-apr-util does not specify a prefix for an
72 installed APU, nor an APR-util build directory.])
75 dnl if we have a bundled source directory, use it
79 apu_config="$2/apu-config"
81 apu_config="$1/apu-config"
84 if test "$apu_found" = "no" && test -n "$3" && test "$3" = "1"; then
85 if apu-config --help > /dev/null 2>&1 ; then
87 apu_config="apu-config"
89 dnl look in the some standard places (apparently not in builtin/default)
90 for lookdir in /usr /usr/local /opt/apr /usr/local/apache2 ; do
91 if test -x "$lookdir/bin/apu-config"; then
93 apu_config="$lookdir/bin/apu-config"
101 AC_MSG_RESULT($apu_found)