bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / httpd-2.0.64 / build / find_apu.m4
1 dnl
2 dnl find_apu.m4 : locate the APR-util (APU) include files and libraries
3 dnl
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
7 dnl copy of APU.
8 dnl
9 dnl APR_FIND_APU([srcdir, path, implicit-install-check])
10 dnl
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
14 dnl   will be built.
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.
17 dnl
18 dnl Sets the following variables on exit:
19 dnl
20 dnl   apu_found : "yes", "no", "reconfig"
21 dnl
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.
25 dnl
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.
29 dnl
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.
34 dnl
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,
38 dnl as appropriate.
39 dnl
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.
42 dnl
43
44 AC_DEFUN(APR_FIND_APU, [
45   apu_found="no"
46
47   AC_MSG_CHECKING(for APR-util)
48   AC_ARG_WITH(apr-util,
49   [  --with-apr-util=DIR     prefix for installed APU, or path to APU build tree],
50   [
51     if test "$withval" = "no" || test "$withval" = "yes"; then
52       AC_MSG_ERROR([--with-apr-util requires a directory to be provided])
53     fi
54
55     if test -x "$withval/bin/apu-config"; then
56        apu_found="yes"
57        apu_config="$withval/bin/apu-config"
58     elif test -x "$withval/apu-config"; then
59        dnl Already configured build dir
60        apu_found="yes"
61        apu_config="$withval/apu-config"
62     elif test -x "$withval" && $withval --help > /dev/null 2>&1 ; then
63        apu_found="yes"
64        apu_config="$withval"
65     fi
66
67     dnl if --with-apr-util is used, then the target prefix/directory must
68     dnl be valid
69     if test "$apu_found" != "yes"; then
70       AC_MSG_ERROR([
71 The directory given to --with-apr-util does not specify a prefix for an 
72 installed APU, nor an APR-util build directory.])
73     fi
74   ],[
75     dnl if we have a bundled source directory, use it
76     if test -d "$1"; then
77       apu_found="reconfig"
78       if test -n "$2"; then
79         apu_config="$2/apu-config"
80       else
81         apu_config="$1/apu-config"
82       fi
83     fi
84     if test "$apu_found" = "no" && test -n "$3" && test "$3" = "1"; then
85       if apu-config --help > /dev/null 2>&1 ; then
86         apu_found="yes"
87         apu_config="apu-config"
88       else
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
92             apu_found="yes"
93             apu_config="$lookdir/bin/apu-config"
94             break
95           fi
96         done
97       fi
98     fi
99   ])
100
101   AC_MSG_RESULT($apu_found)
102 ])