Imported Upstream version 2.5.11
[libapache-mod-security.git] / apache2 / build / find_apu.m4
1 dnl Check for APU Libraries
2 dnl CHECK_APU(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
3 dnl Sets:
4 dnl  APU_CFLAGS
5 dnl  APU_LDFLAGS
6 dnl  APU_LIBS
7 dnl  APU_LINK_LD
8
9 APU_CONFIG=""
10 APU_CFLAGS=""
11 APU_LDFLAGS=""
12 APU_LIBS=""
13 APU_LINK_LD=""
14
15 AC_DEFUN([CHECK_APU],
16 [dnl
17
18 AC_ARG_WITH(
19     apu,
20     [AC_HELP_STRING([--with-apu=PATH],[Path to apu prefix or config script])],
21     [test_paths="${with_apu}"],
22     [test_paths="/usr/local/libapr-util /usr/local/apr-util /usr/local/libapu /usr/local/apu /usr/local /opt/libapr-util /opt/apr-util /opt/libapu /opt/apu /opt /usr"])
23
24 AC_MSG_CHECKING([for libapu config script])
25
26 for x in ${test_paths}; do
27     dnl # Determine if the script was specified and use it directly
28     if test ! -d "$x" -a -e "$x"; then
29         APU_CONFIG=$x
30         apu_path="no"
31         break
32     fi
33
34     dnl # Try known config script names/locations
35     for APU_CONFIG in apu-1-mt-config apu-1-config apu-config-1 apu-mt-config-1 apu-mt-config apu-config; do
36         if test -e "${x}/bin/${APU_CONFIG}"; then
37             apu_path="${x}/bin"
38             break
39         elif test -e "${x}/${APU_CONFIG}"; then
40             apu_path="${x}"
41             break
42         else
43             apu_path=""
44         fi
45     done
46     if test -n "$apu_path"; then
47         break
48     fi
49 done
50
51 if test -n "${apu_path}"; then
52     if test "${apu_path}" != "no"; then
53         APU_CONFIG="${apu_path}/${APU_CONFIG}"
54     fi
55     AC_MSG_RESULT([${APU_CONFIG}])
56     APU_CFLAGS="`${APU_CONFIG} --includes`"
57     if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu CFLAGS: $APU_CFLAGS); fi
58     APU_LDFLAGS="`${APU_CONFIG} --ldflags`"
59     if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu LDFLAGS: $APU_LDFLAGS); fi
60     APU_LIBS="`${APU_CONFIG} --libs`"
61     if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu LIBS: $APU_LIBS); fi
62     APU_LINK_LD="`${APU_CONFIG} --link-ld`"
63     if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu LINK_LD: $APU_LINK_LD); fi
64     CFLAGS=$save_CFLAGS
65     LDFLAGS=$save_LDFLAGS
66 else
67     AC_MSG_RESULT([no])
68 fi
69
70 AC_SUBST(APU_LIBS)
71 AC_SUBST(APU_CFLAGS)
72 AC_SUBST(APU_LDFLAGS)
73 AC_SUBST(APU_LINK_LD)
74
75 if test -z "${APU_LIBS}"; then
76     AC_MSG_NOTICE([*** apu library not found.])
77     ifelse([$2], , AC_MSG_ERROR([apu library is required]), $2)
78 else
79     AC_MSG_NOTICE([using '${APU_LIBS}' for apu Library])
80     ifelse([$1], , , $1) 
81 fi 
82 ])