aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nokis Mavrogiannopoulos 2008-03-05 17:38:09 +0000
committerGravatar Nokis Mavrogiannopoulos 2008-03-05 17:38:09 +0000
commit2cb49bd5137176e1445550399b6e9592607858a3 (patch)
treee7c8933ce56ecdac588fbaa9af0c4beb03850c3e
parentfc05b4b880d4247da9353cae6be44180dee17b23 (diff)
-rw-r--r--NEWS8
-rwxr-xr-xautogen.sh17
-rw-r--r--configure.ac33
-rw-r--r--m4/apache.m4151
-rw-r--r--m4/apache_test.m496
-rw-r--r--m4/apr_memcache.m456
-rw-r--r--m4/apreq.m443
-rwxr-xr-xm4/buildconf.py83
-rw-r--r--m4/find_apr.m4166
-rw-r--r--m4/libgnutls.m4171
-rw-r--r--m4/libmemcache.m446
-rw-r--r--m4/librsvg.m429
-rw-r--r--m4/lua.m471
-rw-r--r--m4/outoforder.m436
-rw-r--r--src/gnutls_cache.c9
-rw-r--r--src/gnutls_config.c7
-rw-r--r--src/gnutls_hooks.c6
-rw-r--r--src/mod_gnutls.c3
18 files changed, 1006 insertions, 25 deletions
diff --git a/NEWS b/NEWS
index 49abeda..ae87e5e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
1** Version 0.4.3 (2008-03-05)
2
3- Added --disable-srp configure option
4
5- Better check for memcache (patch by Guillaume Rousse)
6
7- Corrected possible memory leak in DBM support for resuming sessions.
8
1** Version 0.4.2 (2007-12-10) 9** Version 0.4.2 (2007-12-10)
2 10
3- Added support for sending a certificate chain. 11- Added support for sending a certificate chain.
diff --git a/autogen.sh b/autogen.sh
index 742b2cc..541e187 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,25 +1,10 @@
1#!/bin/sh 1#!/bin/sh
2 2
3if [ -z $ACLOCAL ]; then
4 ACLOCAL=aclocal
5fi
6if [ -z $AUTOCONF ]; then
7 AUTOCONF=autoconf
8fi
9if [ -z $AUTOHEADER ]; then
10 AUTOHEADER=autoheader
11fi
12if [ -z $AUTORECONF ]; then 3if [ -z $AUTORECONF ]; then
13 AUTORECONF=autoreconf 4 AUTORECONF=autoreconf
14fi 5fi
15 6
16#rm -rf autom4te.cache 7#rm -rf autom4te.cache
17$AUTORECONF -f -i 8$AUTORECONF -f -v -i
18#touch stamp-h.in 9#touch stamp-h.in
19 10
20for x in providers/*; do
21 if [ -e $x/autogen.sh ]; then
22 echo Generating Config files in $x
23 (cd $x; ./autogen.sh $*)
24 fi
25done
diff --git a/configure.ac b/configure.ac
index 259e289..b95f362 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
1dnl 1dnl
2AC_INIT(mod_gnutls, 0.4.2.1) 2AC_INIT(mod_gnutls, 0.4.3)
3OOO_CONFIG_NICE(config.nice) 3OOO_CONFIG_NICE(config.nice)
4MOD_GNUTLS_VERSION=AC_PACKAGE_VERSION 4MOD_GNUTLS_VERSION=AC_PACKAGE_VERSION
5AC_PREREQ(2.53) 5AC_PREREQ(2.53)
@@ -28,8 +28,14 @@ CHECK_APACHE(,$AP_VERSION,
28dnl LIBTOOL="`${APR_CONFIG} --apr-libtool`" 28dnl LIBTOOL="`${APR_CONFIG} --apr-libtool`"
29dnl AC_SUBST(LIBTOOL) 29dnl AC_SUBST(LIBTOOL)
30 30
31MIN_TLS_VERSION=2.1.7 31MIN_TLS_VERSION=2.2.1
32CHECK_LIBGNUTLS($MIN_TLS_VERSION) 32AM_PATH_LIBGNUTLS($MIN_TLS_VERSION,,
33 AC_MSG_ERROR([[
34***
35*** libgnutls were not found. You may want to get it from
36*** http://www.gnutls.org/
37***
38]]))
33 39
34dnl CHECK_LUA() 40dnl CHECK_LUA()
35 41
@@ -37,7 +43,19 @@ have_apr_memcache=0
37CHECK_APR_MEMCACHE([have_apr_memcache=1], [have_apr_memcache=0]) 43CHECK_APR_MEMCACHE([have_apr_memcache=1], [have_apr_memcache=0])
38AC_SUBST(have_apr_memcache) 44AC_SUBST(have_apr_memcache)
39 45
40MODULE_CFLAGS="${LIBGNUTLS_CFLAGS} ${APR_MEMCACHE_CFLAGS} ${APXS_CFLAGS} ${AP_INCLUDES} ${APR_INCLUDES} ${APU_INCLUDES}" 46AC_ARG_ENABLE(srp,
47 AS_HELP_STRING([--disable-srp],
48 [unconditionally disable the SRP functionality]),
49 use_srp=$enableval, use_srp=yes)
50
51SRP_CFLAGS=""
52if test "$use_srp" != "no"; then
53 SRP_CFLAGS="-DENABLE_SRP=1"
54fi
55AC_MSG_CHECKING([whether to enable SRP functionality])
56AC_MSG_RESULT($use_srp)
57
58MODULE_CFLAGS="${LIBGNUTLS_CFLAGS} ${SRP_CFLAGS} ${APR_MEMCACHE_CFLAGS} ${APXS_CFLAGS} ${AP_INCLUDES} ${APR_INCLUDES} ${APU_INCLUDES}"
41MODULE_LIBS="${APR_MEMCACHE_LIBS} ${LIBGNUTLS_LIBS}" 59MODULE_LIBS="${APR_MEMCACHE_LIBS} ${LIBGNUTLS_LIBS}"
42 60
43AC_SUBST(MODULE_CFLAGS) 61AC_SUBST(MODULE_CFLAGS)
@@ -49,8 +67,9 @@ AC_OUTPUT
49echo "---" 67echo "---"
50echo "Configuration summary for mod_gnutls:" 68echo "Configuration summary for mod_gnutls:"
51echo "" 69echo ""
52echo " * mod_gnutls version: ${MOD_GNUTLS_VERSION}" 70echo " * mod_gnutls version: ${MOD_GNUTLS_VERSION}"
53echo " * Apache Modules directory: ${AP_LIBEXECDIR}" 71echo " * Apache Modules directory: ${AP_LIBEXECDIR}"
54echo " * GnuTLS Library version: ${LIBGNUTLS_VERSION}" 72echo " * GnuTLS Library version: ${LIBGNUTLS_VERSION}"
73echo " * SRP authentication: ${use_srp}"
55echo "" 74echo ""
56echo "---" 75echo "---"
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
2dnl CHECK_APACHE([MINIMUM13-VERSION [, MINIMUM20-VERSION [,
3dnl ACTION-IF-FOUND13 [, ACTION-IF-FOUND20 [, ACTION-IF-NOT-FOUND]]])
4dnl Test for Apache apxs, APR, and APU
5
6AC_DEFUN([CHECK_APACHE],
7[dnl
8AC_ARG_WITH(
9 apxs,
10 [AC_HELP_STRING([--with-apxs=PATH],[Path to apxs])],
11 apxs_prefix="$withval",
12 apxs_prefix="/usr"
13 )
14
15AC_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])
diff --git a/m4/apache_test.m4 b/m4/apache_test.m4
new file mode 100644
index 0000000..8c91adf
--- /dev/null
+++ b/m4/apache_test.m4
@@ -0,0 +1,96 @@
1dnl TEST_APACHE_VERSION(RELEASE, [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 releasetest=$1
8 min_apache_version="$2"
9 no_apache=""
10 ac_save_CFLAGS="$CFLAGS"
11 CFLAGS="$CFLAGS $AP_CFLAGS"
12 if test $releasetest -eq 20; then
13 CFLAGS="$CFLAGS $APU_INCLUDES $APR_INCLUDES"
14 fi
15 AC_TRY_RUN([
16#include <stdio.h>
17#include <stdlib.h>
18#include <string.h>
19#include "httpd.h"
20
21#ifndef AP_SERVER_BASEREVISION
22 #define AP_SERVER_BASEREVISION SERVER_BASEREVISION
23#endif
24
25char* my_strdup (char *str)
26{
27 char *new_str;
28
29 if (str) {
30 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
31 strcpy (new_str, str);
32 } else
33 new_str = NULL;
34
35 return new_str;
36}
37
38int main (int argc, char *argv[])
39{
40 int major1, minor1, micro1;
41 int major2, minor2, micro2;
42 char *tmp_version;
43
44 { FILE *fp = fopen("conf.apachetest", "a"); if ( fp ) fclose(fp); }
45
46 tmp_version = my_strdup("$min_apache_version");
47 if (sscanf(tmp_version, "%d.%d.%d", &major1, &minor1, &micro1) != 3) {
48 printf("%s, bad version string\n", "$min_apache_version");
49 exit(1);
50 }
51 tmp_version = my_strdup(AP_SERVER_BASEREVISION);
52 if (sscanf(tmp_version, "%d.%d.%d", &major2, &minor2, &micro2) != 3) {
53 printf("%s, bad version string\n", AP_SERVER_BASEREVISION);
54 exit(1);
55 }
56
57 if ( (major2 == major1) &&
58 ( (minor2 > minor1) ||
59 ((minor2 == minor1) && (micro2 >= micro1)) ) ) {
60 exit(0);
61 } else {
62 exit(1);
63 }
64}
65
66],, no_apache=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
67 CFLAGS="$ac_save_CFLAGS"
68
69 if test "x$no_apache" = x ; then
70 ifelse([$3], , :, [$3])
71 else
72 if test -f conf.apachetest ; then
73 :
74 else
75 echo "*** Could not run Apache test program, checking why..."
76 CFLAGS="$CFLAGS $AP_CFLAGS"
77 if test $releasetest -eq 20; then
78 CFLAGS="$CFLAGS $APU_INCLUDES $APR_INCLUDES"
79 fi
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([$4], , :, [$4])
94 fi
95 rm -f conf.apachetest
96])
diff --git a/m4/apr_memcache.m4 b/m4/apr_memcache.m4
new file mode 100644
index 0000000..71ab2b6
--- /dev/null
+++ b/m4/apr_memcache.m4
@@ -0,0 +1,56 @@
1dnl Check for memcache client libraries
2dnl CHECK_APR_MEMCACHE(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
3dnl Sets:
4dnl APR_MEMCACHE_LIBS
5AC_DEFUN([CHECK_APR_MEMCACHE],
6[dnl
7
8AC_ARG_WITH(
9 apr-memcache-prefix,
10 [AC_HELP_STRING([--with-apr-memcache-prefix=PATH],[Install prefix for apr_memcache])],
11 apr_memcache_prefix="$withval",
12 apr_memcache_prefix="/usr",
13 :)
14AC_ARG_WITH(
15 apr-memcache-libs,
16 [AC_HELP_STRING([--with-apr-memcache-libs=PATH],[Path to apr_memcache libs])],
17 apr_memcache_libs="$withval",
18 apr_memcache_libs="$apr_memcache_prefix/lib"
19 :)
20AC_ARG_WITH(
21 apr-memcache-includes,
22 [AC_HELP_STRING([--with-apr-memcache-includes=PATH],[Path to apr_memcache includes])],
23 apr_memcache_includes="$withval",
24 apr_memcache_includes="$apr_memcache_prefix/include/apr_memcache-0"
25 :)
26
27
28AC_LIBTOOL_SYS_DYNAMIC_LINKER
29
30dnl # Determine memcache lib directory
31save_CFLAGS=$CFLAGS
32save_LDFLAGS=$LDFLAGS
33CFLAGS="-I$apr_memcache_includes $APR_INCLUDES $CFLAGS"
34LDFLAGS="-L$apr_memcache_libs $LDFLAGS"
35AC_CHECK_LIB(
36 apr_memcache,
37 apr_memcache_create,
38 [
39 APR_MEMCACHE_LIBS="-R$apr_memcache_libs -L$apr_memcache_libs -lapr_memcache"
40 APR_MEMCACHE_CFLAGS="-I$apr_memcache_includes"
41 ]
42)
43CFLAGS=$save_CFLAGS
44LDFLAGS=$save_LDFLAGS
45
46AC_SUBST(APR_MEMCACHE_LIBS)
47AC_SUBST(APR_MEMCACHE_CFLAGS)
48
49if test -z "${APR_MEMCACHE_LIBS}"; then
50 AC_MSG_NOTICE([*** memcache library not found.])
51 ifelse([$2], , AC_MSG_ERROR([memcache library is required]), $2)
52else
53 AC_MSG_NOTICE([using '${APR_MEMCACHE_LIBS}' for memcache])
54 ifelse([$1], , , $1)
55fi
56])
diff --git a/m4/apreq.m4 b/m4/apreq.m4
new file mode 100644
index 0000000..b457e02
--- /dev/null
+++ b/m4/apreq.m4
@@ -0,0 +1,43 @@
1dnl Check for apreq2 libraries
2dnl CHECK_APREQ2(MINIMUM-VERSION, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
3AC_DEFUN([CHECK_APREQ2],
4[dnl
5
6AC_ARG_WITH(
7 apreq2,
8 [AC_HELP_STRING([--with-apreq2=PATH],[Path to your apreq2-config])],
9 ap_path="$withval",
10 ap_path="/usr"
11 )
12
13 if test -x $ap_path -a ! -d $ap_path; then
14 AP_BIN=$ap_path
15 else
16 test_paths="$ap_path:$ap_path/bin:$ap_path/sbin"
17
18 dnl Search the Apache Binary Directories too. Since we should set these in apache.m4
19 if test -d $AP_BINDIR; then
20 test_paths="${test_paths}:${AP_BINDIR}"
21 fi
22 if test -d $AP_SBINDIR; then
23 test_paths="${test_paths}:${AP_SBINDIR}"
24 fi
25
26 test_paths="${test_paths}:/usr/bin:/usr/sbin"
27 test_paths="${test_paths}:/usr/local/bin:/usr/local/sbin"
28 AC_PATH_PROG(AP_BIN, apreq2-config, no, [$test_paths])
29 fi
30
31 if test "$AP_BIN" = "no"; then
32 AC_MSG_ERROR([*** The apreq2-config binary installed by apreq2 could not be found!])
33 AC_MSG_ERROR([*** Use the --with-apreq2 option with the full path to apreq2-config])
34 ifelse([$3], , AC_MSG_ERROR([apreq2 >=$1 is not installed.]), $3)
35 else
36 dnl TODO: Do a apreq2-config Version check here...
37 APREQ_LIBS="`$AP_BIN --link-ld --ldflags --libs 2>/dev/null`"
38 APREQ_CFLAGS="`$AP_BIN --includes 2>/dev/null`"
39 AC_SUBST(APREQ_LIBS)
40 AC_SUBST(APREQ_CFLAGS)
41 ifelse([$2], , AC_MSG_RESULT([yes]), $2)
42 fi
43])
diff --git a/m4/buildconf.py b/m4/buildconf.py
new file mode 100755
index 0000000..9ba621f
--- /dev/null
+++ b/m4/buildconf.py
@@ -0,0 +1,83 @@
1#!/usr/bin/env python
2#
3# buildconf.py: Runs Autotools on a project.
4#
5# Copyright 2004 Edward Rudd and Paul Querna
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18#
19
20import os
21import sys
22import popen2
23from optparse import OptionParser
24
25cmd = {}
26
27def run_cmd(command, args=""):
28 global cmd
29 rp = popen2.Popen4("%s %s" % (cmd[command], args))
30 sout = rp.fromchild.readlines()
31 for line in sout:
32 sys.stdout.write(line)
33 rv = rp.wait()
34 if rv != 0:
35 print "Error: '%s %s' returned %d" % (cmd[command], args, rv)
36 sys.exit(-1)
37
38def select_cmd(command, list, args = "--version"):
39 global cmd
40 cmd[command] = None
41 for x in list:
42 # rv = os.spawnlp(os.P_WAIT, x, args)
43 rp = popen2.Popen4("%s %s" % (x, args))
44 rv = rp.wait()
45 if rv == 0:
46 cmd[command] = x
47 break
48 if cmd[command] == None:
49 print "Errpr: Could not find suitable version for '%s', tried running: %s" % (command, list)
50 sys.exit(-1)
51
52parser = OptionParser()
53
54parser.add_option("--libtoolize", action="store_true", dest="libtoolize", default=False)
55parser.add_option("--aclocal", action="store_true", dest="aclocal", default=False)
56parser.add_option("--automake", action="store_true", dest="automake", default=False)
57parser.add_option("--autoconf", action="store_true", dest="autoconf", default=False)
58parser.add_option("--autoheader", action="store_true", dest="autoheader", default=False)
59
60(options, args) = parser.parse_args()
61
62if options.libtoolize:
63 select_cmd("libtoolize", ['libtoolize14','glibtoolize','libtoolize'])
64if options.aclocal:
65 select_cmd("aclocal", ['aclocal-1.9','aclocal-1.8','aclocal-1.7','aclocal-1.6','aclocal'])
66if options.autoheader:
67 select_cmd("autoheader", ['autoheader259','autoheader257','autoheader'])
68if options.automake:
69 select_cmd("automake", ['automake-1.9','automake-1.8','automake-1.7','automake-1.6','automake'])
70if options.autoconf:
71 select_cmd("autoconf", ['autoconf259','autoconf257','autoconf'])
72
73if options.libtoolize:
74 run_cmd("libtoolize", "--force --copy")
75if options.aclocal:
76 run_cmd("aclocal", "-I m4")
77if options.autoheader:
78 run_cmd("autoheader")
79if options.automake:
80 run_cmd("automake", "--add-missing --copy --foreign")
81if options.autoconf:
82 run_cmd("autoconf")
83
diff --git a/m4/find_apr.m4 b/m4/find_apr.m4
new file mode 100644
index 0000000..9228c76
--- /dev/null
+++ b/m4/find_apr.m4
@@ -0,0 +1,166 @@
1dnl -------------------------------------------------------- -*- autoconf -*-
2dnl Copyright 2000-2005 The Apache Software Foundation
3dnl
4dnl Licensed under the Apache License, Version 2.0 (the "License");
5dnl you may not use this file except in compliance with the License.
6dnl You may obtain a copy of the License at
7dnl
8dnl http://www.apache.org/licenses/LICENSE-2.0
9dnl
10dnl Unless required by applicable law or agreed to in writing, software
11dnl distributed under the License is distributed on an "AS IS" BASIS,
12dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13dnl See the License for the specific language governing permissions and
14dnl limitations under the License.
15
16dnl
17dnl find_apr.m4 : locate the APR include files and libraries
18dnl
19dnl This macro file can be used by applications to find and use the APR
20dnl library. It provides a standardized mechanism for using APR. It supports
21dnl embedding APR into the application source, or locating an installed
22dnl copy of APR.
23dnl
24dnl APR_FIND_APR(srcdir, builddir, implicit-install-check, acceptable-majors)
25dnl
26dnl where srcdir is the location of the bundled APR source directory, or
27dnl empty if source is not bundled.
28dnl
29dnl where builddir is the location where the bundled APR will will be built,
30dnl or empty if the build will occur in the srcdir.
31dnl
32dnl where implicit-install-check set to 1 indicates if there is no
33dnl --with-apr option specified, we will look for installed copies.
34dnl
35dnl where acceptable-majors is a space separated list of acceptable major
36dnl version numbers. Often only a single major version will be acceptable.
37dnl If multiple versions are specified, and --with-apr=PREFIX or the
38dnl implicit installed search are used, then the first (leftmost) version
39dnl in the list that is found will be used. Currently defaults to [0 1].
40dnl
41dnl Sets the following variables on exit:
42dnl
43dnl apr_found : "yes", "no", "reconfig"
44dnl
45dnl apr_config : If the apr-config tool exists, this refers to it. If
46dnl apr_found is "reconfig", then the bundled directory
47dnl should be reconfigured *before* using apr_config.
48dnl
49dnl Note: this macro file assumes that apr-config has been installed; it
50dnl is normally considered a required part of an APR installation.
51dnl
52dnl If a bundled source directory is available and needs to be (re)configured,
53dnl then apr_found is set to "reconfig". The caller should reconfigure the
54dnl (passed-in) source directory, placing the result in the build directory,
55dnl as appropriate.
56dnl
57dnl If apr_found is "yes" or "reconfig", then the caller should use the
58dnl value of apr_config to fetch any necessary build/link information.
59dnl
60
61AC_DEFUN([APR_FIND_APR], [
62 apr_found="no"
63
64 if test "$ac_cv_emxos2" = "yes"; then
65 # Scripts don't pass test -x on OS/2
66 TEST_X="test -f"
67 else
68 TEST_X="test -x"
69 fi
70
71 ifelse([$4], [], [
72 ifdef(AC_WARNING,AC_WARNING([$0: missing argument 4 (acceptable-majors): Defaulting to APR 0.x then APR 1.x]))
73 acceptable_majors="0 1"],
74 [acceptable_majors="$4"])
75
76 apr_temp_acceptable_apr_config=""
77 for apr_temp_major in $acceptable_majors
78 do
79 case $apr_temp_major in
80 0)
81 apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-config"
82 ;;
83 *)
84 apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-$apr_temp_major-config"
85 ;;
86 esac
87 done
88
89 AC_MSG_CHECKING(for APR)
90 AC_ARG_WITH(apr,
91 [ --with-apr=PATH prefix for installed APR, path to APR build tree,
92 or the full path to apr-config],
93 [
94 if test "$withval" = "no" || test "$withval" = "yes"; then
95 AC_MSG_ERROR([--with-apr requires a directory or file to be provided])
96 fi
97
98 for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config
99 do
100 for lookdir in "$withval/bin" "$withval"
101 do
102 if $TEST_X "$lookdir/$apr_temp_apr_config_file"; then
103 apr_found="yes"
104 apr_config="$lookdir/$apr_temp_apr_config_file"
105 break 2
106 fi
107 done
108 done
109
110 if test "$apr_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then
111 apr_found="yes"
112 apr_config="$withval"
113 fi
114
115 dnl if --with-apr is used, it is a fatal error for its argument
116 dnl to be invalid
117 if test "$apr_found" != "yes"; then
118 AC_MSG_ERROR([the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.])
119 fi
120 ],[
121 dnl If we allow installed copies, check those before using bundled copy.
122 if test -n "$3" && test "$3" = "1"; then
123 for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config
124 do
125 if $apr_temp_apr_config_file --help > /dev/null 2>&1 ; then
126 apr_found="yes"
127 apr_config="$apr_temp_apr_config_file"
128 break
129 else
130 dnl look in some standard places
131 for lookdir in /usr /usr/local /usr/local/apr /opt/apr /usr/local/apache2; do
132 if $TEST_X "$lookdir/bin/$apr_temp_apr_config_file"; then
133 apr_found="yes"
134 apr_config="$lookdir/bin/$apr_temp_apr_config_file"
135 break 2
136 fi
137 done
138 fi
139 done
140 fi
141 dnl if we have not found anything yet and have bundled source, use that
142 if test "$apr_found" = "no" && test -d "$1"; then
143 apr_temp_abs_srcdir="`cd $1 && pwd`"
144 apr_found="reconfig"
145 apr_bundled_major="`sed -n '/#define.*APR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apr_version.h\"`"
146 case $apr_bundled_major in
147 "")
148 AC_MSG_ERROR([failed to find major version of bundled APR])
149 ;;
150 0)
151 apr_temp_apr_config_file="apr-config"
152 ;;
153 *)
154 apr_temp_apr_config_file="apr-$apr_bundled_major-config"
155 ;;
156 esac
157 if test -n "$2"; then
158 apr_config="$2/$apr_temp_apr_config_file"
159 else
160 apr_config="$1/$apr_temp_apr_config_file"
161 fi
162 fi
163 ])
164
165 AC_MSG_RESULT($apr_found)
166])
diff --git a/m4/libgnutls.m4 b/m4/libgnutls.m4
new file mode 100644
index 0000000..3e714fc
--- /dev/null
+++ b/m4/libgnutls.m4
@@ -0,0 +1,171 @@
1dnl Autoconf macros for libgnutls
2dnl $id$
3
4# Modified for LIBGNUTLS -- nmav
5# Configure paths for LIBGCRYPT
6# Shamelessly stolen from the one of XDELTA by Owen Taylor
7# Werner Koch 99-12-09
8
9dnl AM_PATH_LIBGNUTLS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
10dnl Test for libgnutls, and define LIBGNUTLS_CFLAGS and LIBGNUTLS_LIBS
11dnl
12AC_DEFUN([AM_PATH_LIBGNUTLS],
13[dnl
14dnl Get the cflags and libraries from the libgnutls-config script
15dnl
16AC_ARG_WITH(libgnutls-prefix,
17 [ --with-libgnutls-prefix=PFX Prefix where libgnutls is installed (optional)],
18 libgnutls_config_prefix="$withval", libgnutls_config_prefix="")
19
20 if test x$libgnutls_config_prefix != x ; then
21 if test x${LIBGNUTLS_CONFIG+set} != xset ; then
22 LIBGNUTLS_CONFIG=$libgnutls_config_prefix/bin/libgnutls-config
23 fi
24 fi
25
26 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no)
27 min_libgnutls_version=ifelse([$1], ,0.1.0,$1)
28 AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
29 no_libgnutls=""
30 if test "$LIBGNUTLS_CONFIG" = "no" ; then
31 no_libgnutls=yes
32 else
33 LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
34 LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
35 libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
36
37
38 ac_save_CFLAGS="$CFLAGS"
39 ac_save_LIBS="$LIBS"
40 CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
41 LIBS="$LIBS $LIBGNUTLS_LIBS"
42dnl
43dnl Now check if the installed libgnutls is sufficiently new. Also sanity
44dnl checks the results of libgnutls-config to some extent
45dnl
46 rm -f conf.libgnutlstest
47 AC_TRY_RUN([
48#include <stdio.h>
49#include <stdlib.h>
50#include <string.h>
51#include <gnutls/gnutls.h>
52
53int
54main ()
55{
56 system ("touch conf.libgnutlstest");
57
58 if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) )
59 {
60 printf("\n*** 'libgnutls-config --version' returned %s, but LIBGNUTLS (%s)\n",
61 "$libgnutls_config_version", gnutls_check_version(NULL) );
62 printf("*** was found! If libgnutls-config was correct, then it is best\n");
63 printf("*** to remove the old version of LIBGNUTLS. You may also be able to fix the error\n");
64 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
65 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
66 printf("*** required on your system.\n");
67 printf("*** If libgnutls-config was wrong, set the environment variable LIBGNUTLS_CONFIG\n");
68 printf("*** to point to the correct copy of libgnutls-config, and remove the file config.cache\n");
69 printf("*** before re-running configure\n");
70 }
71 else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) )
72 {
73 printf("\n*** LIBGNUTLS header file (version %s) does not match\n", LIBGNUTLS_VERSION);
74 printf("*** library (version %s)\n", gnutls_check_version(NULL) );
75 }
76 else
77 {
78 if ( gnutls_check_version( "$min_libgnutls_version" ) )
79 {
80 return 0;
81 }
82 else
83 {
84 printf("no\n*** An old version of LIBGNUTLS (%s) was found.\n",
85 gnutls_check_version(NULL) );
86 printf("*** You need a version of LIBGNUTLS newer than %s. The latest version of\n",
87 "$min_libgnutls_version" );
88 printf("*** LIBGNUTLS is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n");
89 printf("*** \n");
90 printf("*** If you have already installed a sufficiently new version, this error\n");
91 printf("*** probably means that the wrong copy of the libgnutls-config shell script is\n");
92 printf("*** being found. The easiest way to fix this is to remove the old version\n");
93 printf("*** of LIBGNUTLS, but you can also set the LIBGNUTLS_CONFIG environment to point to the\n");
94 printf("*** correct copy of libgnutls-config. (In this case, you will have to\n");
95 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
96 printf("*** so that the correct libraries are found at run-time))\n");
97 }
98 }
99 return 1;
100}
101],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
102 CFLAGS="$ac_save_CFLAGS"
103 LIBS="$ac_save_LIBS"
104 fi
105
106 if test "x$no_libgnutls" = x ; then
107 AC_MSG_RESULT(yes)
108 ifelse([$2], , :, [$2])
109 else
110 if test -f conf.libgnutlstest ; then
111 :
112 else
113 AC_MSG_RESULT(no)
114 fi
115 if test "$LIBGNUTLS_CONFIG" = "no" ; then
116 echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found"
117 echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in"
118 echo "*** your path, or set the LIBGNUTLS_CONFIG environment variable to the"
119 echo "*** full path to libgnutls-config."
120 else
121 if test -f conf.libgnutlstest ; then
122 :
123 else
124 echo "*** Could not run libgnutls test program, checking why..."
125 CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
126 LIBS="$LIBS $LIBGNUTLS_LIBS"
127 AC_TRY_LINK([
128#include <stdio.h>
129#include <stdlib.h>
130#include <string.h>
131#include <gnutls/gnutls.h>
132], [ return !!gnutls_check_version(NULL); ],
133 [ echo "*** The test program compiled, but did not run. This usually means"
134 echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong"
135 echo "*** version of LIBGNUTLS. If it is not finding LIBGNUTLS, you'll need to set your"
136 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
137 echo "*** to the installed location Also, make sure you have run ldconfig if that"
138 echo "*** is required on your system"
139 echo "***"
140 echo "*** If you have an old version installed, it is best to remove it, although"
141 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
142 echo "***" ],
143 [ echo "*** The test program failed to compile or link. See the file config.log for the"
144 echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed"
145 echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you"
146 echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG" ])
147 CFLAGS="$ac_save_CFLAGS"
148 LIBS="$ac_save_LIBS"
149 fi
150 fi
151 LIBGNUTLS_CFLAGS=""
152 LIBGNUTLS_LIBS=""
153 ifelse([$3], , :, [$3])
154 fi
155 rm -f conf.libgnutlstest
156 AC_SUBST(LIBGNUTLS_CFLAGS)
157 AC_SUBST(LIBGNUTLS_LIBS)
158
159 LIBGNUTLS_VERSION=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
160 LIBGNUTLS_PREFIX="`$LIBGNUTLS_CONFIG $libgnutls_config_args --prefix`"
161 GNUTLS_CERTTOOL="${LIBGNUTLS_PREFIX}/bin/certtool"
162
163 AC_SUBST(LIBGNUTLS_CFLAGS)
164 AC_SUBST(LIBGNUTLS_LIBS)
165 AC_SUBST(LIBGNUTLS_VERSION)
166 AC_SUBST(LIBGNUTLS_PREFIX)
167 AC_SUBST(LIBGNUTLS_CERTTOOL)
168
169])
170
171dnl *-*wedit:notab*-* Please keep this as the last line.
diff --git a/m4/libmemcache.m4 b/m4/libmemcache.m4
new file mode 100644
index 0000000..95e630b
--- /dev/null
+++ b/m4/libmemcache.m4
@@ -0,0 +1,46 @@
1dnl Check for memcache client libraries
2dnl CHECK_MEMCACHE(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
3AC_DEFUN([CHECK_MEMCACHE],
4[dnl
5
6AC_ARG_WITH(
7 memcache,
8 [AC_HELP_STRING([--with-memcache=PATH],[Path memcache libraries])],
9 mc_path="$withval",
10 :)
11
12dnl # Determine memcache lib directory
13if test -z $mc_path; then
14 test_paths="/usr/lib /usr/local/lib"
15else
16 test_paths="${mc_path}/lib"
17fi
18
19for x in $test_paths ; do
20 AC_MSG_CHECKING([for memcache library in ${x}])
21 if test -f ${x}/libmemcache.so.1.0; then
22 AC_MSG_RESULT([yes])
23 save_CFLAGS=$CFLAGS
24 save_LDFLAGS=$LDFLAGS
25 CFLAGS="$CFLAGS"
26 LDFLAGS="-L$x $LDFLAGS"
27 AC_CHECK_LIB(memcache, mc_server_add,
28 LIBMEMCACHE_LIBS="-L$x -lmemcache")
29 CFLAGS=$save_CFLAGS
30 LDFLAGS=$save_LDFLAGS
31 break
32 else
33 AC_MSG_RESULT([no])
34 fi
35done
36
37AC_SUBST(LIBMEMCACHE_LIBS)
38
39if test -z "${LIBMEMCACHE_LIBS}"; then
40 AC_MSG_NOTICE([*** memcache library not found.])
41 ifelse([$2], , AC_MSG_ERROR([memcache library is required]), $2)
42else
43 AC_MSG_NOTICE([using '${LIBMEMCACHE_LIBS}' for memcache])
44 ifelse([$1], , , $1)
45fi
46])
diff --git a/m4/librsvg.m4 b/m4/librsvg.m4
new file mode 100644
index 0000000..c8d2bf0
--- /dev/null
+++ b/m4/librsvg.m4
@@ -0,0 +1,29 @@
1dnl Check for librsvg libraries
2dnl CHECK_RSVG(MINIMUM-VERSION, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
3AC_DEFUN([CHECK_RSVG],
4[dnl
5
6pname=librsvg-2.0
7
8AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
9
10if test x$PKG_CONFIG = xno ; then
11 ifelse([$3], , AC_MSG_ERROR([pkg-config not found. pkg-config is required for librsvg]), $3)
12fi
13
14AC_MSG_CHECKING(for librsvg - version >= $1)
15
16if $PKG_CONFIG --atleast-version=$1 $pname; then
17 RSVG_LDFLAGS=`$PKG_CONFIG $pname --libs-only-L`
18 RSVG_LIBS=`$PKG_CONFIG $pname --libs-only-l --libs-only-other`
19 RSVG_CFLAGS=`$PKG_CONFIG $pname --cflags`
20 RSVG_VERSION=`$PKG_CONFIG $pname --modversion`
21 AC_SUBST(RSVG_LDFLAGS)
22 AC_SUBST(RSVG_LIBS)
23 AC_SUBST(RSVG_CFLAGS)
24 AC_SUBST(RSVG_VERSION)
25 ifelse([$2], , AC_MSG_RESULT([yes]), $2)
26else
27 ifelse([$3], , AC_MSG_ERROR([librsvg >=$1 is not installed.]), $3)
28fi
29])
diff --git a/m4/lua.m4 b/m4/lua.m4
new file mode 100644
index 0000000..beae980
--- /dev/null
+++ b/m4/lua.m4
@@ -0,0 +1,71 @@
1dnl Check for Lua 5.0 Libraries
2dnl CHECK_LUA(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
3dnl Sets:
4dnl LUA_CFLAGS
5dnl LUA_LIBS
6AC_DEFUN([CHECK_LUA],
7[dnl
8
9AC_ARG_WITH(
10 lua,
11 [AC_HELP_STRING([--with-lua=PATH],[Path to the Lua 5.0 prefix])],
12 lua_path="$withval",
13 :)
14
15dnl # Determine memcache lib directory
16if test -z $mc_path; then
17 test_paths="/usr/local /usr"
18else
19 test_paths="${lua_path}"
20fi
21
22for x in $test_paths ; do
23 AC_MSG_CHECKING([for lua.h in ${x}/include/lua50])
24 if test -f ${x}/include/lua50/lua.h; then
25 AC_MSG_RESULT([yes])
26 save_CFLAGS=$CFLAGS
27 save_LDFLAGS=$LDFLAGS
28 CFLAGS="$CFLAGS"
29 LDFLAGS="-L$x/lib $LDFLAGS"
30 AC_CHECK_LIB(lua50, lua_open,
31 [
32 LUA_LIBS="-L$x/lib -llua50 -llualib50"
33 LUA_CFLAGS="-I$x/include/lua50"
34 ])
35 CFLAGS=$save_CFLAGS
36 LDFLAGS=$save_LDFLAGS
37 break
38 else
39 AC_MSG_RESULT([no])
40 fi
41 AC_MSG_CHECKING([for lua.h in ${x}/include])
42 if test -f ${x}/include/lua.h; then
43 AC_MSG_RESULT([yes])
44 save_CFLAGS=$CFLAGS
45 save_LDFLAGS=$LDFLAGS
46 CFLAGS="$CFLAGS"
47 LDFLAGS="-L$x/lib $LDFLAGS"
48 AC_CHECK_LIB(lua, lua_open,
49 [
50 LUA_LIBS="-L$x/lib -llua -llualib"
51 LUA_CFLAGS="-I$x/include/lua50"
52 ])
53 CFLAGS=$save_CFLAGS
54 LDFLAGS=$save_LDFLAGS
55 break
56 else
57 AC_MSG_RESULT([no])
58 fi
59done
60
61AC_SUBST(LUA_LIBS)
62AC_SUBST(LUA_CFLAGS)
63
64if test -z "${LUA_LIBS}"; then
65 AC_MSG_NOTICE([*** Lua 5.0 library not found.])
66 ifelse([$2], , AC_MSG_ERROR([Lua 5.0 library is required]), $2)
67else
68 AC_MSG_NOTICE([using '${LUA_LIBS}' for Lua Library])
69 ifelse([$1], , , $1)
70fi
71])
diff --git a/m4/outoforder.m4 b/m4/outoforder.m4
new file mode 100644
index 0000000..7add221
--- /dev/null
+++ b/m4/outoforder.m4
@@ -0,0 +1,36 @@
1dnl m4 for utility macros used by all out of order projects
2
3dnl this writes a "config.nice" file which reinvokes ./configure with all
4dnl of the arguments. this is different from config.status which simply
5dnl regenerates the output files. config.nice is useful after you rebuild
6dnl ./configure (via autoconf or autogen.sh)
7AC_DEFUN([OOO_CONFIG_NICE],[
8 echo configure: creating $1
9 rm -f $1
10 cat >$1<<EOF
11#! /bin/sh
12#
13# Created by configure
14
15EOF
16
17 for arg in [$]0 "[$]@"; do
18 if test "[$]arg" != "--no-create" -a "[$]arg" != "--no-recursion"; then
19 echo "\"[$]arg\" \\" >> $1
20 fi
21 done
22 echo '"[$]@"' >> $1
23 chmod +x $1
24])
25
26dnl this macro adds a maintainer mode option to enable programmer specific
27dnl code in makefiles
28AC_DEFUN([OOO_MAINTAIN_MODE],[
29 AC_ARG_ENABLE(
30 maintainer,
31 [AC_HELP_STRING([--enable-maintainer],[Enable maintainer mode for this project])],
32 AC_MSG_RESULT([Enabling Maintainer Mode!!])
33 OOO_MAINTAIN=1,
34 OOO_MAINTAIN=0)
35 AC_SUBST(OOO_MAINTAIN)
36])
diff --git a/src/gnutls_cache.c b/src/gnutls_cache.c
index 83e7bb5..90f5a86 100644
--- a/src/gnutls_cache.c
+++ b/src/gnutls_cache.c
@@ -1,5 +1,6 @@
1/** 1/**
2 * Copyright 2004-2005 Paul Querna 2 * Copyright 2004-2005 Paul Querna
3 * Portions Copyright 2008 Nikos Mavrogiannopoulos
3 * 4 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 6 * you may not use this file except in compliance with the License.
@@ -345,6 +346,7 @@ static int dbm_cache_expire(mgs_handle_t *ctxt)
345 break; 346 break;
346 } 347 }
347 } 348 }
349 apr_dbm_freedatum( dbm, dbmval);
348 350
349 } 351 }
350 apr_dbm_nextkey(dbm, &dbmkey); 352 apr_dbm_nextkey(dbm, &dbmkey);
@@ -401,20 +403,25 @@ static gnutls_datum_t dbm_cache_fetch(void* baton, gnutls_datum_t key)
401 } 403 }
402 404
403 if (dbmval.dptr == NULL || dbmval.dsize <= sizeof(apr_time_t)) { 405 if (dbmval.dptr == NULL || dbmval.dsize <= sizeof(apr_time_t)) {
406 apr_dbm_freedatum( dbm, dbmval);
404 apr_dbm_close(dbm); 407 apr_dbm_close(dbm);
405 return data; 408 return data;
406 } 409 }
407 apr_dbm_close(dbm);
408 410
409 data.size = dbmval.dsize - sizeof(apr_time_t); 411 data.size = dbmval.dsize - sizeof(apr_time_t);
410 412
411 data.data = gnutls_malloc(data.size); 413 data.data = gnutls_malloc(data.size);
412 if (data.data == NULL) { 414 if (data.data == NULL) {
415 apr_dbm_freedatum( dbm, dbmval);
416 apr_dbm_close(dbm);
413 return data; 417 return data;
414 } 418 }
415 419
416 memcpy(data.data, dbmval.dptr+sizeof(apr_time_t), data.size); 420 memcpy(data.data, dbmval.dptr+sizeof(apr_time_t), data.size);
417 421
422 apr_dbm_freedatum( dbm, dbmval);
423 apr_dbm_close(dbm);
424
418 return data; 425 return data;
419} 426}
420 427
diff --git a/src/gnutls_config.c b/src/gnutls_config.c
index 8d6308a..4786f6d 100644
--- a/src/gnutls_config.c
+++ b/src/gnutls_config.c
@@ -202,6 +202,8 @@ const char *mgs_set_key_file(cmd_parms * parms, void *dummy,
202 return NULL; 202 return NULL;
203} 203}
204 204
205#ifdef ENABLE_SRP
206
205const char *mgs_set_srp_tpasswd_file(cmd_parms * parms, void *dummy, 207const char *mgs_set_srp_tpasswd_file(cmd_parms * parms, void *dummy,
206 const char *arg) 208 const char *arg)
207{ 209{
@@ -228,6 +230,8 @@ const char *mgs_set_srp_tpasswd_conf_file(cmd_parms * parms, void *dummy,
228 return NULL; 230 return NULL;
229} 231}
230 232
233#endif
234
231const char *mgs_set_cache(cmd_parms * parms, void *dummy, 235const char *mgs_set_cache(cmd_parms * parms, void *dummy,
232 const char *type, const char *arg) 236 const char *type, const char *arg)
233{ 237{
@@ -426,6 +430,7 @@ void *mgs_config_server_create(apr_pool_t * p, server_rec * s)
426 ": (%d) %s", ret, gnutls_strerror(ret)); 430 ": (%d) %s", ret, gnutls_strerror(ret));
427 } 431 }
428 432
433#ifdef ENABLE_SRP
429 ret = gnutls_srp_allocate_server_credentials(&sc->srp_creds); 434 ret = gnutls_srp_allocate_server_credentials(&sc->srp_creds);
430 if (ret < 0) { 435 if (ret < 0) {
431 return apr_psprintf(p, "GnuTLS: Failed to initialize" 436 return apr_psprintf(p, "GnuTLS: Failed to initialize"
@@ -434,6 +439,8 @@ void *mgs_config_server_create(apr_pool_t * p, server_rec * s)
434 439
435 sc->srp_tpasswd_conf_file = NULL; 440 sc->srp_tpasswd_conf_file = NULL;
436 sc->srp_tpasswd_file = NULL; 441 sc->srp_tpasswd_file = NULL;
442#endif
443
437 sc->privkey_x509 = NULL; 444 sc->privkey_x509 = NULL;
438 memset( sc->certs_x509, 0, sizeof(sc->certs_x509)); 445 memset( sc->certs_x509, 0, sizeof(sc->certs_x509));
439 sc->certs_x509_num = 0; 446 sc->certs_x509_num = 0;
diff --git a/src/gnutls_hooks.c b/src/gnutls_hooks.c
index 55a1120..0483602 100644
--- a/src/gnutls_hooks.c
+++ b/src/gnutls_hooks.c
@@ -115,11 +115,13 @@ static int mgs_select_virtual_server_cb(gnutls_session_t session)
115 115
116 gnutls_credentials_set(session, GNUTLS_CRD_ANON, ctxt->sc->anon_creds); 116 gnutls_credentials_set(session, GNUTLS_CRD_ANON, ctxt->sc->anon_creds);
117 117
118#ifdef ENABLE_SRP
118 if (ctxt->sc->srp_tpasswd_conf_file != NULL 119 if (ctxt->sc->srp_tpasswd_conf_file != NULL
119 && ctxt->sc->srp_tpasswd_file != NULL) { 120 && ctxt->sc->srp_tpasswd_file != NULL) {
120 gnutls_credentials_set(session, GNUTLS_CRD_SRP, 121 gnutls_credentials_set(session, GNUTLS_CRD_SRP,
121 ctxt->sc->srp_creds); 122 ctxt->sc->srp_creds);
122 } 123 }
124#endif
123 125
124 /* update the priorities - to avoid negotiating a ciphersuite that is not 126 /* update the priorities - to avoid negotiating a ciphersuite that is not
125 * enabled on this virtual server. Note that here we ignore the version 127 * enabled on this virtual server. Note that here we ignore the version
@@ -313,6 +315,7 @@ mgs_hook_post_config(apr_pool_t * p, apr_pool_t * plog,
313 gnutls_certificate_server_set_retrieve_function(sc->certs, 315 gnutls_certificate_server_set_retrieve_function(sc->certs,
314 cert_retrieve_fn); 316 cert_retrieve_fn);
315 317
318#ifdef ENABLE_SRP
316 if (sc->srp_tpasswd_conf_file != NULL 319 if (sc->srp_tpasswd_conf_file != NULL
317 && sc->srp_tpasswd_file != NULL) { 320 && sc->srp_tpasswd_file != NULL) {
318 rv = gnutls_srp_set_server_credentials_file(sc->srp_creds, 321 rv = gnutls_srp_set_server_credentials_file(sc->srp_creds,
@@ -329,6 +332,7 @@ mgs_hook_post_config(apr_pool_t * p, apr_pool_t * plog,
329 exit(-1); 332 exit(-1);
330 } 333 }
331 } 334 }
335#endif
332 336
333 if (sc->certs_x509[0] == NULL 337 if (sc->certs_x509[0] == NULL
334 && sc->enabled == GNUTLS_ENABLED_TRUE) { 338 && sc->enabled == GNUTLS_ENABLED_TRUE) {
@@ -662,8 +666,10 @@ int mgs_hook_fixups(request_rec * r)
662 gnutls_compression_get_name(gnutls_compression_get 666 gnutls_compression_get_name(gnutls_compression_get
663 (ctxt->session))); 667 (ctxt->session)));
664 668
669#ifdef ENABLE_SRP
665 apr_table_setn(env, "SSL_SRP_USER", 670 apr_table_setn(env, "SSL_SRP_USER",
666 gnutls_srp_server_get_username(ctxt->session)); 671 gnutls_srp_server_get_username(ctxt->session));
672#endif
667 673
668 if (apr_table_get(env, "SSL_CLIENT_VERIFY") == NULL) 674 if (apr_table_get(env, "SSL_CLIENT_VERIFY") == NULL)
669 apr_table_setn(env, "SSL_CLIENT_VERIFY", "NONE"); 675 apr_table_setn(env, "SSL_CLIENT_VERIFY", "NONE");
diff --git a/src/mod_gnutls.c b/src/mod_gnutls.c
index a6e5528..cc760e6 100644
--- a/src/mod_gnutls.c
+++ b/src/mod_gnutls.c
@@ -17,7 +17,6 @@
17 17
18#include "mod_gnutls.h" 18#include "mod_gnutls.h"
19 19
20
21static void gnutls_hooks(apr_pool_t * p) 20static void gnutls_hooks(apr_pool_t * p)
22{ 21{
23 ap_hook_pre_connection(mgs_hook_pre_connection, NULL, NULL, 22 ap_hook_pre_connection(mgs_hook_pre_connection, NULL, NULL,
@@ -80,6 +79,7 @@ static const command_rec mgs_config_cmds[] = {
80 NULL, 79 NULL,
81 RSRC_CONF, 80 RSRC_CONF,
82 "SSL Server SRP Password file"), 81 "SSL Server SRP Password file"),
82#ifdef ENABLE_SRP
83 AP_INIT_TAKE1("GnuTLSSRPPasswdFile", mgs_set_srp_tpasswd_file, 83 AP_INIT_TAKE1("GnuTLSSRPPasswdFile", mgs_set_srp_tpasswd_file,
84 NULL, 84 NULL,
85 RSRC_CONF, 85 RSRC_CONF,
@@ -88,6 +88,7 @@ static const command_rec mgs_config_cmds[] = {
88 NULL, 88 NULL,
89 RSRC_CONF, 89 RSRC_CONF,
90 "SSL Server SRP Parameters file"), 90 "SSL Server SRP Parameters file"),
91#endif
91 AP_INIT_TAKE1("GnuTLSCacheTimeout", mgs_set_cache_timeout, 92 AP_INIT_TAKE1("GnuTLSCacheTimeout", mgs_set_cache_timeout,
92 NULL, 93 NULL,
93 RSRC_CONF, 94 RSRC_CONF,