summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/apache.m4128
-rw-r--r--m4/mysql.m464
2 files changed, 192 insertions, 0 deletions
diff --git a/m4/apache.m4 b/m4/apache.m4
new file mode 100644
index 0000000..b74f335
--- /dev/null
+++ b/m4/apache.m4
@@ -0,0 +1,128 @@
1dnl CHECK_PATH_APACHE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
2dnl Test for Apache apxs
3dnl
4AC_DEFUN(CHECK_PATH_APACHE,
5[dnl
6AC_ARG_WITH(
7 apache,
8 [ --with-apache[=DIR] Apache install root],
9 apache_prefix="$withval",
10 apache_prefix="/usr"
11 )
12AC_ARG_ENABLE(apachetest, [ --disable-apachetest Do not try to compile and run apache version test program],
13 , enable_apachetest=yes)
14
15
16 AC_REQUIRE([AC_CANONICAL_TARGET])
17 PATH="$apache_prefix:$apache_prefix/bin:$apache_prefix/sbin:$PATH"
18 AC_PATH_PROG(APXS_BIN, apxs, no, [$PATH])
19 min_apache_version=ifelse([$1], ,1.3.1,$1)
20 AC_MSG_CHECKING(for Apache - version >= $min_apache_version)
21 no_apxs=""
22 if test "$APXS_BIN" == "no"; then
23 no_apxs=yes
24 else
25 APACHE_INCDIR=`$APXS_BIN -q INCLUDEDIR`
26 APACHE_CFLAGS=-I$APACHE_INCDIR
27 APACHE_MODDIR=`$APXS_BIN -q LIBEXECDIR`
28
29 if test "x$enable_apachetest" = "xyes" ; then
30 ac_save_CFLAGS="$CFLAGS"
31 CFLAGS="$CFLAGS $APACHE_CFLAGS"
32 AC_TRY_RUN([
33#include <stdio.h>
34#include <stdlib.h>
35#include <string.h>
36#include "httpd.h"
37
38#ifndef AP_SERVER_BASEREVISION
39 #define AP_SERVER_BASEREVISION SERVER_BASEREVISION
40#endif
41
42char* my_strdup (char *str)
43{
44 char *new_str;
45
46 if (str) {
47 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
48 strcpy (new_str, str);
49 } else
50 new_str = NULL;
51
52 return new_str;
53}
54
55int main (int argc, char *argv[])
56{
57 int major1, minor1, micro1;
58 int major2, minor2, micro2;
59 char *tmp_version;
60
61 { FILE *fp = fopen("conf.apachetest", "a"); if ( fp ) fclose(fp); }
62
63 tmp_version = my_strdup("$min_apache_version");
64 if (sscanf(tmp_version, "%d.%d.%d", &major1, &minor1, &micro1) != 3) {
65 printf("%s, bad version string\n", "$min_apache_version");
66 exit(1);
67 }
68 tmp_version = my_strdup(AP_SERVER_BASEREVISION);
69 if (sscanf(tmp_version, "%d.%d.%d", &major2, &minor2, &micro2) != 3) {
70 printf("%s, bad version string\n", AP_SERVER_BASEREVISION);
71 exit(1);
72 }
73 if ((major2 > major1) ||
74 ((major2 == major1) && (minor2 > minor1)) ||
75 ((major2 == major1) && (minor2 == minor1) && (micro2 >= micro1)))
76 {
77 return 0;
78 } else {
79 printf("\n*** This module requires apache version %d.%d.%d or greater\n",
80 major1, minor1, micro1);
81 printf("*** I found version %d.%d.%d. Please verify the installation directory\n",
82 major2, minor2, micro2);
83 printf("*** of apache with the --with-apache configure option.\n");
84 return 1;
85 }
86}
87
88],, no_apxs=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
89 CFLAGS="$ac_save_CFLAGS"
90 fi
91 fi
92 if test "x$no_apxs" = x ; then
93 AC_MSG_RESULT(yes)
94 ifelse([$2], , :, [$2])
95 else
96 AC_MSG_RESULT(no)
97 if test "APXS_BIN" = "no" ; then
98 echo "*** The apxs binary installed by apache could not be found"
99 echo "*** If apache is installed in PREFIX, make sure PREFIX/bin is in"
100 echo "*** your path, or use the --with-apache configure option"
101 else
102 if test -f conf.apachetest ; then
103 :
104 else
105 echo "*** Could not run Apache test program, checking why..."
106 CFLAGS="$CFLAGS APACHE_CFLAGS"
107 AC_TRY_LINK([
108#include <stdio.h>
109#include "httpd.h"
110
111int main(int argc, char *argv[])
112{ return 0; }
113#undef main
114#define main K_and_R_C_main
115], [ return 0; ],
116 [ echo "*** The test program compiled, but failed to run. Check config.log" ],
117 [ echo "*** The test program failed to compile or link. Check config.log" ])
118 CFLAGS="$ac_save_CFLAGS"
119 fi
120 fi
121 APACHE_CFLAGS=""
122 ifelse([$3], , :, [$3])
123 fi
124 AC_SUBST(APACHE_CFLAGS)
125 AC_SUBST(APACHE_INCDIR)
126 AC_SUBST(APACHE_MODDIR)
127 rm -f conf.apachetest
128])
diff --git a/m4/mysql.m4 b/m4/mysql.m4
new file mode 100644
index 0000000..c4c4a3b
--- /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,,[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])