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 | AP_SYSCONFDIR="`$APXS_BIN -q sysconfdir 2>/dev/null`" |
---|
45 | |
---|
46 | APXS_CFLAGS="" |
---|
47 | for flag in CFLAGS EXTRA_CFLAGS EXTRA_CPPFLAGS NOTEST_CFLAGS; do |
---|
48 | APXS_CFLAGS="$APXS_CFLAGS `$APXS_BIN -q $flag 2>/dev/null`" |
---|
49 | done |
---|
50 | |
---|
51 | AP_CPPFLAGS="$APXS_CPPFLAGS $AP_INCLUDES" |
---|
52 | AP_CFLAGS="$APXS_CFLAGS $AP_INCLUDES" |
---|
53 | |
---|
54 | AP_LIBEXECDIR=`$APXS_BIN -q LIBEXECDIR 2>/dev/null` |
---|
55 | |
---|
56 | if test "x$enable_apachetest" = "xyes" ; then |
---|
57 | if test "$min_apache20_version" != "no"; then |
---|
58 | APR_CONFIG="`$APXS_BIN -q APR_BINDIR 2>/dev/null`/apr-1-config" |
---|
59 | if test ! -x $APR_CONFIG; then |
---|
60 | APR_CONFIG="`$APXS_BIN -q APR_BINDIR 2>/dev/null`/apr-config" |
---|
61 | fi |
---|
62 | APR_INCLUDES=`$APR_CONFIG --includes 2>/dev/null` |
---|
63 | APR_VERSION=`$APR_CONFIG --version 2>/dev/null` |
---|
64 | APU_CONFIG="`$APXS_BIN -q APU_BINDIR 2>/dev/null`/apu-1-config" |
---|
65 | if test ! -x $APU_CONFIG; then |
---|
66 | APU_CONFIG="`$APXS_BIN -q APU_BINDIR 2>/dev/null`/apu-config" |
---|
67 | fi |
---|
68 | APU_INCLUDES=`$APU_CONFIG --includes 2>/dev/null` |
---|
69 | APU_VERSION=`$APU_CONFIG --version 2>/dev/null` |
---|
70 | |
---|
71 | AC_MSG_CHECKING(for Apache 2.0 version >= $min_apache20_version) |
---|
72 | TEST_APACHE_VERSION(20,$min_apache20_version, |
---|
73 | AC_MSG_RESULT(yes) |
---|
74 | AC_DEFINE(WITH_APACHE20,1,[Define to 1 if we are compiling with Apache 2.0.x]) |
---|
75 | AP_VERSION="2.0" |
---|
76 | APXS_EXTENSION=.la |
---|
77 | AP_CFLAGS="$AP_CFLAGS $APU_INCLUDES $APR_INCLUDES" |
---|
78 | AP_CPPFLAGS="$AP_CPPFLAGS $APU_INCLUDES $APR_INCLUDES" |
---|
79 | AP_DEFS="-DWITH_APACHE20" |
---|
80 | ifelse([$4], , , $4), |
---|
81 | AC_MSG_RESULT(no) |
---|
82 | if test "x$min_apache13_version" = "xno"; then |
---|
83 | ifelse([$5], , , $5) |
---|
84 | fi |
---|
85 | ) |
---|
86 | fi |
---|
87 | if test "$min_apache13_version" != "no" -a "x$AP_VERSION" = "x"; then |
---|
88 | APR_INCLUDES="" |
---|
89 | APR_VERSION="" |
---|
90 | APU_INCLUDES="" |
---|
91 | APU_VERSION="" |
---|
92 | AC_MSG_CHECKING(for Apache 1.3 version >= $min_apache13_version) |
---|
93 | TEST_APACHE_VERSION(13,$min_apache13_version, |
---|
94 | AC_MSG_RESULT(yes) |
---|
95 | AC_DEFINE(WITH_APACHE13,1,[Define to 1 if we are compiling with Apache 1.3.x]) |
---|
96 | AP_VERSION="1.3" |
---|
97 | APXS_EXTENSION=.so |
---|
98 | AP_CFLAGS="-g $AP_CFLAGS" |
---|
99 | AP_DEFS="-DWITH_APACHE13" |
---|
100 | ifelse([$3], , , $3), |
---|
101 | AC_MSG_RESULT(no) |
---|
102 | ifelse([$5], , , $5) |
---|
103 | ) |
---|
104 | fi |
---|
105 | fi |
---|
106 | AC_SUBST(AP_DEFS) |
---|
107 | AC_SUBST(AP_PREFIX) |
---|
108 | AC_SUBST(AP_CFLAGS) |
---|
109 | AC_SUBST(AP_CPPFLAGS) |
---|
110 | AC_SUBST(AP_INCLUDES) |
---|
111 | AC_SUBST(AP_INCLUDEDIR) |
---|
112 | AC_SUBST(AP_LIBEXECDIR) |
---|
113 | AC_SUBST(AP_VERSION) |
---|
114 | AC_SUBST(AP_SYSCONFDIR) |
---|
115 | AC_SUBST(AP_BINDIR) |
---|
116 | AC_SUBST(AP_SBINDIR) |
---|
117 | AC_SUBST(APR_INCLUDES) |
---|
118 | AC_SUBST(APU_INCLUDES) |
---|
119 | AC_SUBST(APXS_EXTENSION) |
---|
120 | AC_SUBST(APXS_BIN) |
---|
121 | AC_SUBST(APXS_CFLAGS) |
---|
122 | fi |
---|
123 | ]) |
---|