summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/apache.m4175
-rw-r--r--m4/mod_ssl.m450
-rw-r--r--m4/mysql.m464
3 files changed, 289 insertions, 0 deletions
diff --git a/m4/apache.m4 b/m4/apache.m4
new file mode 100644
index 0000000..3d76b72
--- /dev/null
+++ b/m4/apache.m4
@@ -0,0 +1,175 @@
1dnl TEST_APACHE_VERSION([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
2dnl Test for Apache
3dnl
4AC_DEFUN(TEST_APACHE_VERSION,
5[dnl
6 AC_REQUIRE([AC_CANONICAL_TARGET])
7
8 min_apache_version="$1"
9 no_apache=""
10 ac_save_CFLAGS="$CFLAGS"
11 CFLAGS="$CFLAGS $APACHE_CFLAGS"
12
13 AC_TRY_RUN([
14#include <stdio.h>
15#include <stdlib.h>
16#include <string.h>
17#include "httpd.h"
18
19#ifndef AP_SERVER_BASEREVISION
20 #define AP_SERVER_BASEREVISION SERVER_BASEREVISION
21#endif
22
23char* my_strdup (char *str)
24{
25 char *new_str;
26
27 if (str) {
28 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
29 strcpy (new_str, str);
30 } else
31 new_str = NULL;
32
33 return new_str;
34}
35
36int main (int argc, char *argv[])
37{
38 int major1, minor1, micro1;
39 int major2, minor2, micro2;
40 char *tmp_version;
41
42 { FILE *fp = fopen("conf.apachetest", "a"); if ( fp ) fclose(fp); }
43
44 tmp_version = my_strdup("$min_apache_version");
45 if (sscanf(tmp_version, "%d.%d.%d", &major1, &minor1, &micro1) != 3) {
46 printf("%s, bad version string\n", "$min_apache_version");
47 exit(1);
48 }
49 tmp_version = my_strdup(AP_SERVER_BASEREVISION);
50 if (sscanf(tmp_version, "%d.%d.%d", &major2, &minor2, &micro2) != 3) {
51 printf("%s, bad version string\n", AP_SERVER_BASEREVISION);
52 exit(1);
53 }
54 if ((major2 > major1) ||
55 ((major2 == major1) && (minor2 > minor1)) ||
56 ((major2 == major1) && (minor2 == minor1) && (micro2 >= micro1)))
57 {
58 exit(0);
59 } else {
60 /*printf("\n*** This module requires apache version %d.%d.%d or greater\n",
61 major1, minor1, micro1);
62 printf("*** I found version %d.%d.%d. Please verify the installation directory\n",
63 major2, minor2, micro2);
64 printf("*** of apache with the --with-apxs configure option.\n");*/
65 exit(1);
66 }
67}
68
69],, no_apache=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
70 CFLAGS="$ac_save_CFLAGS"
71
72 if test "x$no_apache" = x ; then
73 ifelse([$2], , :, [$2])
74 else
75 if test -f conf.apachetest ; then
76 :
77 else
78 echo "*** Could not run Apache test program, checking why..."
79 CFLAGS="$CFLAGS APACHE_CFLAGS"
80 AC_TRY_LINK([
81#include <stdio.h>
82#include "httpd.h"
83
84int main(int argc, char *argv[])
85{ return 0; }
86#undef main
87#define main K_and_R_C_main
88], [ return 0; ],
89 [ echo "*** The test program compiled, but failed to run. Check config.log" ],
90 [ echo "*** The test program failed to compile or link. Check config.log" ])
91 CFLAGS="$ac_save_CFLAGS"
92 fi
93 ifelse([$3], , :, [$3])
94 fi
95 rm -f conf.apachetest
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_CPPFLAGS=`$APXS_BIN -q CFLAGS`
133 APACHE_CFLAGS="-I$APACHE_INCDIR"
134 APACHE_MODDIR=`$APXS_BIN -q LIBEXECDIR`
135
136 if test "x$enable_apachetest" = "xyes" ; then
137 if test "$min_apache20_version" != "no"; then
138 AC_MSG_CHECKING(for Apache 2.0 version >= $min_apache20_version)
139 TEST_APACHE_VERSION($min_apache20_version,
140 AC_MSG_RESULT(yes)
141 AC_DEFINE(WITH_APACHE20,1,[Define to 1 if we are compiling with Apache 2.0.x])
142 APACHE_VERSION="20"
143 APXS_EXTENSION=.la
144 APACHE_DEFS="-DWITH_APACHE20"
145 ifelse([$4], , , $4),
146 AC_MSG_RESULT(no)
147 if test "x$min_apache13_version" = "xno"; then
148 ifelse([$5], , , $5)
149 fi
150 )
151 fi
152 if test "$min_apache13_version" != "no" -a "x$APACHE_VERSION" = "x"; then
153 AC_MSG_CHECKING(for Apache 1.3 version >= $min_apache13_version)
154 TEST_APACHE_VERSION($min_apache13_version,
155 AC_MSG_RESULT(yes)
156 AC_DEFINE(WITH_APACHE13,1,[Define to 1 if we are compiling with Apache 1.3.x])
157 APACHE_VERSION="13"
158 APXS_EXTENSION=.so
159 APACHE_CFLAGS="-g $APACHE_CFLAGS"
160 APACHE_DEFS="-DWITH_APACHE13"
161 ifelse([$3], , , $3),
162 AC_MSG_RESULT(no)
163 ifelse([$5], , , $5)
164 )
165 fi
166 fi
167 AC_SUBST(APACHE_DEFS)
168 AC_SUBST(APACHE_CFLAGS)
169 AC_SUBST(APACHE_CPPFLAGS)
170 AC_SUBST(APACHE_INCDIR)
171 AC_SUBST(APACHE_MODDIR)
172 AC_SUBST(APACHE_VERSION)
173 AC_SUBST(APXS_EXTENSION)
174 fi
175])
diff --git a/m4/mod_ssl.m4 b/m4/mod_ssl.m4
new file mode 100644
index 0000000..c431bce
--- /dev/null
+++ b/m4/mod_ssl.m4
@@ -0,0 +1,50 @@
1dnl CHECK_PATH_MOD_SSL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
2dnl Test for mod_ssl and openssl header directory.
3dnl
4AC_DEFUN(CHECK_PATH_MOD_SSL,
5[dnl
6AC_ARG_ENABLE(
7 ssl,
8 [AC_HELP_STRING([--enable-ssl],[Compile in SSL support])],
9 ssl_val=yes,
10 ssl_val=no
11 )
12AC_ARG_WITH(
13 ssl-inc,
14 [AC_HELP_STRING([--with-ssl-inc=DIR],[Location of SSL header files])],
15 ssl_incdir="$withval",
16 )
17AC_ARG_WITH(
18 db-inc,
19 [AC_HELP_STRING([--with-db-inc=DIR],[Location of DB header files])],
20 db_incdir="$withval",
21 db_incdir="/usr/include/db1"
22 )
23
24 if test "x$ssl_val" = "xyes"; then
25 ac_save_CFLAGS=$CFLAGS
26 ac_save_CPPFLAGS=$CPPFLAGS
27 MOD_SSL_CFLAGS="-I/usr/include/openssl"
28 if test "x$ssl_incdir" != "x"; then
29 MOD_SSL_CFLAGS="-I$ssl_incdir -I$ssl_incdir/openssl $MOD_SSL_CFLAGS"
30 fi
31 if test "x$db_incdir" != "x"; then
32 MOD_SSL_CFLAGS="-I$db_incdir $MOD_SSL_CFLAGS"
33 fi
34 CFLAGS="$APACHE_CFLAGS $APACHE_CPPFLAGS $MOD_SSL_CFLAGS $CFLAGS"
35 CPPFLAGS="$APACHE_CFLAGS $APACHE_CPPFLAGS $MOD_SSL_CFLAGS $CPPFLAGS"
36 AC_CHECK_HEADERS([mod_ssl.h],
37 mod_ssl_h=yes
38 )
39 CFLAGS=$ac_save_CFLAGS
40 CPPFLAGS=$ac_save_CPPFLAGS
41 if test "x$mod_ssl_h" = "x"; then
42 ifelse([$2], , :, [$2])
43 else
44 AC_SUBST(MOD_SSL_CFLAGS)
45 ifelse([$1], , :, [$1])
46 fi
47 else
48 ifelse([$2], , :, [$2])
49 fi
50])
diff --git a/m4/mysql.m4 b/m4/mysql.m4
new file mode 100644
index 0000000..7892f88
--- /dev/null
+++ b/m4/mysql.m4
@@ -0,0 +1,64 @@
1dnl CHECK_PATH_MYSQL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUNT]])
2dnl Check for MySQL Libs
3dnl
4AC_DEFUN(CHECK_PATH_MYSQL,
5[dnl
6AC_ARG_WITH(
7 mysql,
8 [AC_HELP_STRING([--with-mysql],[Path to MySQL client library])],
9 mysql_prefix="$withval",
10
11 )
12AC_ARG_ENABLE(
13 mysqltest,
14 [AC_HELP_STRING([--disble-mysqltest],[Do not try to compile and run mysql test program])],
15 ,
16 enable_apachetest=yes)
17
18 AC_REQUIRE([AC_CANONICAL_TARGET])
19 ac_save_CFLAGS=$CFLAGS
20 ac_save_LDFLAGS=$LDFLAGS
21 if test "x$mysql_prefix" != "x" && test "x$mysql_prefix" != "xyes"; then
22 MYSQL_LDFLAGS="-L${mysql_prefix}/lib -L${mysql_prefix}/lib/mysql -L${mysql_prefix}/mysql/lib"
23 MYSQL_CFLAGS="-I${mysql_prefix}/include -I${mysql_prefix}/include/mysql -I${mysql_prefix}/mysql/include"
24 else
25 MYSQL_LDFLAGS="-L/usr/local/mysql/lib -L/usr/lib/mysql -L/usr/mysql/lib -L/usr/local/lib/mysql -L/usr/local/mysql/lib/mysql -L/usr/mysql/lib/mysql"
26 MYSQL_CFLAGS="-I/usr/local/mysql/include -I/usr/include/mysql -I/usr/mysql/include -I/usr/local/include/mysql -I/usr/local/mysql/include/mysql -I/usr/mysql/include/mysql"
27 fi
28 CFLAGS="$CFLAGS $MYSQL_CFLAGS"
29 LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
30 AC_CHECK_LIB(m, floor)
31 AC_CHECK_LIB(z, gzclose)
32 with_mysql="yes"
33 AC_DEFINE(WITH_MYSQL,1,[Define to 1 if we are compiling with mysql])
34 AC_CHECK_LIB(mysqlclient, mysql_init, ,
35 [AC_MSG_ERROR(libmysqlclient is needed for MySQL support)])
36 MYSQL_LIBS=$LIBS
37 AC_CHECK_FUNCS(mysql_real_escape_string)
38 AC_MSG_CHECKING(whether mysql clients can run)
39 AC_TRY_RUN([
40 #include <stdio.h>
41 #include <mysql.h>
42 int main(void)
43 {
44 MYSQL *a = mysql_init(NULL);
45 return 0;
46 }
47 ], , no_mysql=yes,[echo $ac_n "cross compiling; assumed OK.... $ac_c"])
48 CFLAGS=$ac_save_CFLAGS
49 LDFLAGS=$ac_save_LDFLAGS
50 if test "x$no_mysql" = x; then
51 AC_MSG_RESULT(yes)
52 ifelse([$1], , :, [$1])
53 else
54 AC_MSG_RESULT(no)
55 echo "*** MySQL could not be found ***"
56 MYSQL_CFLAGS=""
57 MYSQL_LDFLAGS=""
58 MYSQL_LIBS=""
59 ifelse([$2], , :, [$2])
60 fi
61 AC_SUBST(MYSQL_LDFLAGS)
62 AC_SUBST(MYSQL_CFLAGS)
63 AC_SUBST(MYSQL_LIBS)
64])