summaryrefslogtreecommitdiffstats
path: root/m4/apache.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/apache.m4')
-rw-r--r--m4/apache.m4166
1 files changed, 102 insertions, 64 deletions
diff --git a/m4/apache.m4 b/m4/apache.m4
index 1e29ac7..93319e3 100644
--- a/m4/apache.m4
+++ b/m4/apache.m4
@@ -1,41 +1,16 @@
1dnl CHECK_PATH_APACHE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) 1dnl TEST_APACHE_VERSION([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
2dnl Test for Apache apxs 2dnl Test for Apache
3dnl 3dnl
4AC_DEFUN(CHECK_PATH_APACHE, 4AC_DEFUN(TEST_APACHE_VERSION,
5[dnl 5[dnl
6AC_ARG_WITH(
7 apxs,
8 [AC_HELP_STRING([--with-apxs=PATH],[Location to APXS binary (default: /usr)])],
9 apxs_prefix="$withval",
10 apxs_prefix="/usr"
11 )
12AC_ARG_ENABLE(apachetest,
13 [AC_HELP_STRING([--disable-apachetest],[Do not try to compile and run apache version test program])],
14 ,
15 enable_apachetest=yes)
16
17
18 AC_REQUIRE([AC_CANONICAL_TARGET]) 6 AC_REQUIRE([AC_CANONICAL_TARGET])
19 PATH="$apxs_prefix:$apxs_prefix/bin:$apxs_prefix/sbin:$PATH"
20 if test -x $apxs_prefix && test ! -d $apxs_prefix; then
21 APXS_BIN=$apxs_prefix
22 else
23 AC_PATH_PROG(APXS_BIN, apxs, no, [$PATH])
24 fi
25 min_apache_version=ifelse([$1], ,1.3.1,$1)
26 AC_MSG_CHECKING(for Apache - version >= $min_apache_version)
27 no_apxs=""
28 if test "$APXS_BIN" == "no"; then
29 no_apxs=yes
30 else
31 APACHE_INCDIR=`$APXS_BIN -q INCLUDEDIR`
32 APACHE_CFLAGS=-I$APACHE_INCDIR
33 APACHE_MODDIR=`$APXS_BIN -q LIBEXECDIR`
34 7
35 if test "x$enable_apachetest" = "xyes" ; then 8 min_apache_version="$1"
36 ac_save_CFLAGS="$CFLAGS" 9 no_apache=""
37 CFLAGS="$CFLAGS $APACHE_CFLAGS" 10 ac_save_CFLAGS="$CFLAGS"
38 AC_TRY_RUN([ 11 CFLAGS="$CFLAGS $APACHE_CFLAGS"
12
13 AC_TRY_RUN([
39#include <stdio.h> 14#include <stdio.h>
40#include <stdlib.h> 15#include <stdlib.h>
41#include <string.h> 16#include <string.h>
@@ -80,37 +55,29 @@ int main (int argc, char *argv[])
80 ((major2 == major1) && (minor2 > minor1)) || 55 ((major2 == major1) && (minor2 > minor1)) ||
81 ((major2 == major1) && (minor2 == minor1) && (micro2 >= micro1))) 56 ((major2 == major1) && (minor2 == minor1) && (micro2 >= micro1)))
82 { 57 {
83 return 0; 58 exit(0);
84 } else { 59 } else {
85 printf("\n*** This module requires apache version %d.%d.%d or greater\n", 60 /*printf("\n*** This module requires apache version %d.%d.%d or greater\n",
86 major1, minor1, micro1); 61 major1, minor1, micro1);
87 printf("*** I found version %d.%d.%d. Please verify the installation directory\n", 62 printf("*** I found version %d.%d.%d. Please verify the installation directory\n",
88 major2, minor2, micro2); 63 major2, minor2, micro2);
89 printf("*** of apache with the --with-apxs configure option.\n"); 64 printf("*** of apache with the --with-apxs configure option.\n");*/
90 return 1; 65 exit(1);
91 } 66 }
92} 67}
93 68
94],, no_apxs=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 69],, no_apache=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
95 CFLAGS="$ac_save_CFLAGS" 70 CFLAGS="$ac_save_CFLAGS"
96 fi 71
97 fi 72 if test "x$no_apache" = x ; then
98 if test "x$no_apxs" = x ; then
99 AC_MSG_RESULT(yes)
100 ifelse([$2], , :, [$2]) 73 ifelse([$2], , :, [$2])
101 else 74 else
102 AC_MSG_RESULT(no) 75 if test -f conf.apachetest ; then
103 if test "$APXS_BIN" = "no" ; then 76 :
104 echo "*** The apxs binary installed by apache could not be found"
105 echo "*** If apache is installed in PREFIX, make sure PREFIX/bin is in"
106 echo "*** your path, or use the --with-apxs configure option"
107 else 77 else
108 if test -f conf.apachetest ; then 78 echo "*** Could not run Apache test program, checking why..."
109 : 79 CFLAGS="$CFLAGS APACHE_CFLAGS"
110 else 80 AC_TRY_LINK([
111 echo "*** Could not run Apache test program, checking why..."
112 CFLAGS="$CFLAGS APACHE_CFLAGS"
113 AC_TRY_LINK([
114#include <stdio.h> 81#include <stdio.h>
115#include "httpd.h" 82#include "httpd.h"
116 83
@@ -118,17 +85,88 @@ int main(int argc, char *argv[])
118{ return 0; } 85{ return 0; }
119#undef main 86#undef main
120#define main K_and_R_C_main 87#define main K_and_R_C_main
121], [ return 0; ], 88], [ return 0; ],
122 [ echo "*** The test program compiled, but failed to run. Check config.log" ], 89 [ echo "*** The test program compiled, but failed to run. Check config.log" ],
123 [ echo "*** The test program failed to compile or link. Check config.log" ]) 90 [ echo "*** The test program failed to compile or link. Check config.log" ])
124 CFLAGS="$ac_save_CFLAGS" 91 CFLAGS="$ac_save_CFLAGS"
125 fi
126 fi 92 fi
127 APACHE_CFLAGS=""
128 ifelse([$3], , :, [$3]) 93 ifelse([$3], , :, [$3])
129 fi 94 fi
130 AC_SUBST(APACHE_CFLAGS)
131 AC_SUBST(APACHE_INCDIR)
132 AC_SUBST(APACHE_MODDIR)
133 rm -f conf.apachetest 95 rm -f conf.apachetest
134]) 96])
97
98dnl CHECK_PATH_APACHE([MINIMUM13-VERSION [, MINIMUM20-VERSION [,
99dnl ACTION-IF-FOUND13 [, ACTION-IF-FOUND20 [, ACTION-IF-NOT-FOUND]]])
100dnl Test for Apache apxs
101dnl
102AC_DEFUN(CHECK_PATH_APACHE,
103[dnl
104AC_ARG_WITH(
105 apxs,
106 [AC_HELP_STRING([--with-apxs=PATH],[Location to APXS binary (default: /usr)])],
107 apxs_prefix="$withval",
108 apxs_prefix="/usr"
109 )
110AC_ARG_ENABLE(
111 apachetest,
112 [AC_HELP_STRING([--disable-apachetest],[Do not try to compile and run apache version test program])],
113 ,
114 enable_apachetest=yes
115 )
116
117 PATH="$apxs_prefix:$apxs_prefix/bin:$apxs_prefix/sbin:$PATH"
118 if test -x $apxs_prefix -a ! -d $apxs_prefix; then
119 APXS_BIN=$apxs_prefix
120 else
121 AC_PATH_PROG(APXS_BIN, apxs, no, [$PATH])
122 fi
123 min_apache13_version=ifelse([$1], ,no,$1)
124 min_apache20_version=ifelse([$2], ,no,$2)
125 no_apxs=""
126 if test "$APXS_BIN" = "no"; then
127 AC_MSG_ERROR([*** The apxs binary installed by apache could not be found!])
128 AC_MSG_ERROR([*** If apache is installed in PREFIX, make sure PREFIX/bin is in])
129 AC_MSG_ERROR([*** your path, or use the --with-apxs configure option])
130 else
131 APACHE_INCDIR=`$APXS_BIN -q INCLUDEDIR`
132 APACHE_CFLAGS=-I$APACHE_INCDIR
133 APACHE_MODDIR=`$APXS_BIN -q LIBEXECDIR`
134
135 if test "x$enable_apachetest" = "xyes" ; then
136 if test "$min_apache20_version" != "no"; then
137 AC_MSG_CHECKING(for Apache 2.0 version >= $min_apache20_version)
138 TEST_APACHE_VERSION($min_apache20_version,
139 AC_MSG_RESULT(yes)
140 AC_DEFINE(WITH_APACHE20,1,[Define to 1 if we are compiling with Apache 2.0.x])
141 APACHE_VERSION="20"
142 APACHE_OUTPUT_NAME=$PACKAGE_NAME.la
143 APACHE_DEFS="-DWITH_APACHE20"
144 ifelse([$4], , , $4),
145 AC_MSG_RESULT(no)
146 if test "x$min_apache13_version" = "xno"; then
147 ifelse([$5], , , $5)
148 fi
149 )
150 fi
151 if test "$min_apache13_version" != "no" -a "x$APACHE_VERSION" = "x"; then
152 AC_MSG_CHECKING(for Apache 1.3 version >= $min_apache13_version)
153 TEST_APACHE_VERSION($min_apache13_version,
154 AC_MSG_RESULT(yes)
155 AC_DEFINE(WITH_APACHE13,1,[Define to 1 if we are compiling with Apache 1.3.x])
156 APACHE_VERSION="13"
157 APACHE_OUTPUT_NAME=$PACKAGE_NAME.so
158 APACHE_DEFS="-DWITH_APACHE13"
159 ifelse([$3], , , $3),
160 AC_MSG_RESULT(no)
161 ifelse([$5], , , $5)
162 )
163 fi
164 fi
165 AC_SUBST(APACHE_DEFS)
166 AC_SUBST(APACHE_CFLAGS)
167 AC_SUBST(APACHE_INCDIR)
168 AC_SUBST(APACHE_MODDIR)
169 AC_SUBST(APACHE_VERSION)
170 AC_SUBST(APACHE_OUTPUT_NAME)
171 fi
172])