1 |
|
2 |
dnl CHECK_APACHE([MINIMUM13-VERSION [, MINIMUM20-VERSION [, |
3 |
dnl ACTION-IF-FOUND13 [, ACTION-IF-FOUND20 [, ACTION-IF-NOT-FOUND]]]) |
4 |
dnl Test for Apache apxs, APR, and APU |
5 |
|
6 |
AC_DEFUN(CHECK_APACHE, |
7 |
[dnl |
8 |
AC_ARG_WITH( |
9 |
apxs, |
10 |
[AC_HELP_STRING([--with-apxs=PATH],[Path to apxs])], |
11 |
apxs_prefix="$withval", |
12 |
apxs_prefix="/usr" |
13 |
) |
14 |
|
15 |
AC_ARG_ENABLE( |
16 |
apachetest, |
17 |
[AC_HELP_STRING([--disable-apxstest],[Do not try to compile and run apache version test program])], |
18 |
, |
19 |
enable_apachetest=yes |
20 |
) |
21 |
|
22 |
if test -x $apxs_prefix -a ! -d $apxs_prefix; then |
23 |
APXS_BIN=$apxs_prefix |
24 |
else |
25 |
test_paths="$apxs_prefix:$apxs_prefix/bin:$apxs_prefix/sbin" |
26 |
test_paths="${test_paths}:/usr/bin:/usr/sbin" |
27 |
test_paths="${test_paths}:/usr/local/bin:/usr/local/sbin:/usr/local/apache2/bin" |
28 |
AC_PATH_PROG(APXS_BIN, apxs, no, [$test_paths]) |
29 |
fi |
30 |
min_apache13_version=ifelse([$1], ,no,$1) |
31 |
min_apache20_version=ifelse([$2], ,no,$2) |
32 |
no_apxs="" |
33 |
if test "$APXS_BIN" = "no"; then |
34 |
AC_MSG_ERROR([*** The apxs binary installed by apache could not be found!]) |
35 |
AC_MSG_ERROR([*** Use the --with-apxs option with the full path to apxs]) |
36 |
else |
37 |
AP_INCLUDES="-I`$APXS_BIN -q INCLUDEDIR 2>/dev/null`" |
38 |
AP_INCLUDEDIR="`$APXS_BIN -q INCLUDEDIR 2>/dev/null`" |
39 |
|
40 |
AP_PREFIX="`$APXS_BIN -q prefix 2>/dev/null`" |
41 |
|
42 |
AP_BINDIR="`$APXS_BIN -q bindir 2>/dev/null`" |
43 |
AP_SBINDIR="`$APXS_BIN -q sbindir 2>/dev/null`" |
44 |
|
45 |
APXS_CFLAGS="" |
46 |
for flag in CFLAGS EXTRA_CFLAGS EXTRA_CPPFLAGS NOTEST_CFLAGS; do |
47 |
APXS_CFLAGS="$APXS_CFLAGS `$APXS_BIN -q $flag 2>/dev/null`" |
48 |
done |
49 |
|
50 |
AP_CPPFLAGS="$APXS_CPPFLAGS $AP_INCLUDES" |
51 |
AP_CFLAGS="$APXS_CFLAGS $AP_INCLUDES" |
52 |
|
53 |
AP_LIBEXECDIR=`$APXS_BIN -q LIBEXECDIR 2>/dev/null` |
54 |
|
55 |
if test "x$enable_apachetest" = "xyes" ; then |
56 |
if test "$min_apache20_version" != "no"; then |
57 |
APR_CONFIG="`$APXS_BIN -q APR_BINDIR 2>/dev/null`/apr-1-config" |
58 |
if test ! -x $APR_CONFIG; then |
59 |
APR_CONFIG="`$APXS_BIN -q APR_BINDIR 2>/dev/null`/apr-config" |
60 |
fi |
61 |
APR_INCLUDES=`$APR_CONFIG --includes 2>/dev/null` |
62 |
APR_VERSION=`$APR_CONFIG --version 2>/dev/null` |
63 |
APU_CONFIG="`$APXS_BIN -q APU_BINDIR 2>/dev/null`/apu-1-config" |
64 |
if test ! -x $APU_CONFIG; then |
65 |
APU_CONFIG="`$APXS_BIN -q APU_BINDIR 2>/dev/null`/apu-config" |
66 |
fi |
67 |
APU_INCLUDES=`$APU_CONFIG --includes 2>/dev/null` |
68 |
APU_VERSION=`$APU_CONFIG --version 2>/dev/null` |
69 |
|
70 |
AC_MSG_CHECKING(for Apache 2.0 version >= $min_apache20_version) |
71 |
TEST_APACHE_VERSION(20,$min_apache20_version, |
72 |
AC_MSG_RESULT(yes) |
73 |
AC_DEFINE(WITH_APACHE20,1,[Define to 1 if we are compiling with Apache 2.0.x]) |
74 |
AP_VERSION="2.0" |
75 |
APXS_EXTENSION=.la |
76 |
AP_CFLAGS="$AP_CFLAGS $APU_INCLUDES $APR_INCLUDES" |
77 |
AP_CPPFLAGS="$AP_CPPFLAGS $APU_INCLUDES $APR_INCLUDES" |
78 |
AP_DEFS="-DWITH_APACHE20" |
79 |
ifelse([$4], , , $4), |
80 |
AC_MSG_RESULT(no) |
81 |
if test "x$min_apache13_version" = "xno"; then |
82 |
ifelse([$5], , , $5) |
83 |
fi |
84 |
) |
85 |
fi |
86 |
if test "$min_apache13_version" != "no" -a "x$AP_VERSION" = "x"; then |
87 |
APR_INCLUDES="" |
88 |
APR_VERSION="" |
89 |
APU_INCLUDES="" |
90 |
APU_VERSION="" |
91 |
AC_MSG_CHECKING(for Apache 1.3 version >= $min_apache13_version) |
92 |
TEST_APACHE_VERSION(13,$min_apache13_version, |
93 |
AC_MSG_RESULT(yes) |
94 |
AC_DEFINE(WITH_APACHE13,1,[Define to 1 if we are compiling with Apache 1.3.x]) |
95 |
AP_VERSION="1.3" |
96 |
APXS_EXTENSION=.so |
97 |
AP_CFLAGS="-g $AP_CFLAGS" |
98 |
AP_DEFS="-DWITH_APACHE13" |
99 |
ifelse([$3], , , $3), |
100 |
AC_MSG_RESULT(no) |
101 |
ifelse([$5], , , $5) |
102 |
) |
103 |
fi |
104 |
fi |
105 |
AC_SUBST(AP_DEFS) |
106 |
AC_SUBST(AP_PREFIX) |
107 |
AC_SUBST(AP_CFLAGS) |
108 |
AC_SUBST(AP_CPPFLAGS) |
109 |
AC_SUBST(AP_INCLUDES) |
110 |
AC_SUBST(AP_INCLUDEDIR) |
111 |
AC_SUBST(AP_LIBEXECDIR) |
112 |
AC_SUBST(AP_VERSION) |
113 |
AC_SUBST(AP_BINDIR) |
114 |
AC_SUBST(AP_SBINDIR) |
115 |
AC_SUBST(APR_INCLUDES) |
116 |
AC_SUBST(APU_INCLUDES) |
117 |
AC_SUBST(APXS_EXTENSION) |
118 |
AC_SUBST(APXS_BIN) |
119 |
AC_SUBST(APXS_CFLAGS) |
120 |
fi |
121 |
]) |