diff options
Diffstat (limited to 'm4/apache.m4')
-rw-r--r-- | m4/apache.m4 | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/m4/apache.m4 b/m4/apache.m4 new file mode 100644 index 0000000..6051821 --- /dev/null +++ b/m4/apache.m4 | |||
@@ -0,0 +1,151 @@ | |||
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_LDFLAGS=`$APR_CONFIG --link-ld 2>/dev/null` | ||
64 | APR_LIBS=`$APR_CONFIG --libs 2>/dev/null` | ||
65 | APR_LIBTOOL=`$APR_CONFIG --link-libtool 2>/dev/null` | ||
66 | APR_CPPFLAGS=`$APR_CONFIG --cppflags 2>/dev/null` | ||
67 | APR_CFLAGS=`$APR_CONFIG --cflags 2>/dev/null` | ||
68 | APR_VERSION=`$APR_CONFIG --version 2>/dev/null` | ||
69 | APU_CONFIG="`$APXS_BIN -q APU_BINDIR 2>/dev/null`/apu-1-config" | ||
70 | if test ! -x $APU_CONFIG; then | ||
71 | APU_CONFIG="`$APXS_BIN -q APU_BINDIR 2>/dev/null`/apu-config" | ||
72 | fi | ||
73 | APU_INCLUDES=`$APU_CONFIG --includes 2>/dev/null` | ||
74 | APU_LDFLAGS=`$APU_CONFIG --link-ld 2>/dev/null` | ||
75 | APU_LIBS=`$APU_CONFIG --libs 2>/dev/null` | ||
76 | APU_LIBTOOL=`$APU_CONFIG --link-libtool 2>/dev/null` | ||
77 | APU_VERSION=`$APU_CONFIG --version 2>/dev/null` | ||
78 | |||
79 | AC_MSG_CHECKING(for Apache 2.0 version >= $min_apache20_version) | ||
80 | TEST_APACHE_VERSION(20,$min_apache20_version, | ||
81 | AC_MSG_RESULT(yes) | ||
82 | AC_DEFINE(WITH_APACHE20,1,[Define to 1 if we are compiling with Apache 2.0.x]) | ||
83 | AP_VERSION="2.0" | ||
84 | APXS_EXTENSION=.la | ||
85 | if test -f `$APXS_BIN -q INCLUDEDIR`/mod_status.h; then | ||
86 | AC_DEFINE(HAVE_MOD_STATUS_H,1,[Define to 1 if mod_status.h and the mod_Status hook are available]) | ||
87 | fi | ||
88 | AP_CFLAGS="$AP_CFLAGS $APU_INCLUDES $APR_INCLUDES" | ||
89 | AP_CPPFLAGS="$AP_CPPFLAGS $APU_INCLUDES $APR_INCLUDES" | ||
90 | AP_DEFS="-DWITH_APACHE20" | ||
91 | ifelse([$4], , , $4), | ||
92 | AC_MSG_RESULT(no) | ||
93 | if test "x$min_apache13_version" = "xno"; then | ||
94 | ifelse([$5], , , $5) | ||
95 | fi | ||
96 | ) | ||
97 | fi | ||
98 | if test "$min_apache13_version" != "no" -a "x$AP_VERSION" = "x"; then | ||
99 | APR_INCLUDES="" | ||
100 | APR_VERSION="" | ||
101 | APR_LDFLAGS="" | ||
102 | APR_LIBS="" | ||
103 | APR_LIBTOOL="" | ||
104 | APR_CFLAGS="" | ||
105 | APR_CPPFLAGS="" | ||
106 | APU_INCLUDES="" | ||
107 | APU_VERSION="" | ||
108 | APU_LDFLAGS="" | ||
109 | APU_LIBS="" | ||
110 | APU_LIBTOOL="" | ||
111 | AC_MSG_CHECKING(for Apache 1.3 version >= $min_apache13_version) | ||
112 | TEST_APACHE_VERSION(13,$min_apache13_version, | ||
113 | AC_MSG_RESULT(yes) | ||
114 | AC_DEFINE(WITH_APACHE13,1,[Define to 1 if we are compiling with Apache 1.3.x]) | ||
115 | AP_VERSION="1.3" | ||
116 | APXS_EXTENSION=.so | ||
117 | AP_CFLAGS="-g $AP_CFLAGS" | ||
118 | AP_DEFS="-DWITH_APACHE13" | ||
119 | ifelse([$3], , , $3), | ||
120 | AC_MSG_RESULT(no) | ||
121 | ifelse([$5], , , $5) | ||
122 | ) | ||
123 | fi | ||
124 | fi | ||
125 | AC_CHECK_DECL([DEFAULT_EXP_LIBEXECDIR],,[AC_DEFINE_UNQUOTED([DEFAULT_EXP_LIBEXECDIR],["$AP_LIBEXECDIR"],[Default Module LibExec directory])]) | ||
126 | AC_SUBST(AP_DEFS) | ||
127 | AC_SUBST(AP_PREFIX) | ||
128 | AC_SUBST(AP_CFLAGS) | ||
129 | AC_SUBST(AP_CPPFLAGS) | ||
130 | AC_SUBST(AP_INCLUDES) | ||
131 | AC_SUBST(AP_INCLUDEDIR) | ||
132 | AC_SUBST(AP_LIBEXECDIR) | ||
133 | AC_SUBST(AP_VERSION) | ||
134 | AC_SUBST(AP_SYSCONFDIR) | ||
135 | AC_SUBST(AP_BINDIR) | ||
136 | AC_SUBST(AP_SBINDIR) | ||
137 | AC_SUBST(APR_INCLUDES) | ||
138 | AC_SUBST(APR_LDFLAGS) | ||
139 | AC_SUBST(APR_LIBS) | ||
140 | AC_SUBST(APR_LIBTOOL) | ||
141 | AC_SUBST(APR_CPPFLAGS) | ||
142 | AC_SUBST(APR_CFLAGS) | ||
143 | AC_SUBST(APU_INCLUDES) | ||
144 | AC_SUBST(APU_LDFLAGS) | ||
145 | AC_SUBST(APU_LIBS) | ||
146 | AC_SUBST(APU_LIBTOOL) | ||
147 | AC_SUBST(APXS_EXTENSION) | ||
148 | AC_SUBST(APXS_BIN) | ||
149 | AC_SUBST(APXS_CFLAGS) | ||
150 | fi | ||
151 | ]) | ||