source: mod_gnutls/configure.ac @ 267a27a

debian/masterproxy-ticket
Last change on this file since 267a27a was 267a27a, checked in by Fiona Klute <fiona.klute@…>, 2 years ago

Test suite: Use separate IPC namespaces when enabled

Minimal change that should avoid conflicts between tests over shared
memory segments and mutexes.

  • Property mode set to 100644
File size: 10.8 KB
Line 
1AC_INIT(mod_gnutls, 0.8.4)
2OOO_CONFIG_NICE(config.nice)
3MOD_GNUTLS_VERSION=AC_PACKAGE_VERSION
4AC_PREREQ(2.53)
5AC_CONFIG_SRCDIR([src/mod_gnutls.c])
6AC_CONFIG_AUX_DIR(config)
7
8OOO_MAINTAIN_MODE
9AM_MAINTAINER_MODE
10AC_CANONICAL_TARGET
11# mod_gnutls test suite requires GNU make
12AM_INIT_AUTOMAKE([-Wno-portability])
13AM_CONFIG_HEADER(include/mod_gnutls_config.h:config.in)
14
15LT_INIT([disable-static])
16
17AC_SUBST(MOD_GNUTLS_VERSION)
18
19AC_PROG_CC
20AC_PROG_CC_C99
21AC_PROG_LD
22AC_PROG_INSTALL
23AC_PROG_LIBTOOL
24
25AC_CONFIG_MACRO_DIR([m4])
26
27AP_VERSION=2.4.17
28CHECK_APACHE(,$AP_VERSION,
29    :,:,
30    AC_MSG_ERROR([*** Apache version $AP_VERSION not found!])
31)
32
33dnl Maybe use the binaries for tests, too?
34AC_ARG_WITH([gnutls-dev],
35        AS_HELP_STRING([--with-gnutls-dev=DIR],
36                [Use GnuTLS libraries from a development (git) tree. Use \
37                this if you want to test mod_gnutls with the latest \
38                GnuTLS code.]),
39        [
40                AS_IF([test -d "${with_gnutls_dev}" ],
41                [
42                        LIBGNUTLS_CFLAGS="-I${with_gnutls_dev}/lib/includes"
43                        LIBGNUTLS_LIBS="-lgnutls -L${with_gnutls_dev}/lib/.libs -R${with_gnutls_dev}/lib/.libs"
44                ],
45                [AC_MSG_ERROR([--with-gnutls-dev=DIR requires a directory!])])
46        ], [])
47
48PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.3.0])
49
50LIBGNUTLS_VERSION=`pkg-config --modversion gnutls`
51
52AC_ARG_ENABLE(vpath-install,
53       AS_HELP_STRING([--enable-vpath-install],
54               [Modify the Apache module directory provided by apxs to \
55               follow --prefix, if necessary. Most users will not want this, \
56               but it is required for VPATH builds including "make \
57               distcheck".]),
58       vpath_install=$enableval, vpath_install=no)
59AM_CONDITIONAL([ENABLE_VPATH_INSTALL], [test "$vpath_install" = "yes"])
60
61AC_ARG_ENABLE(srp,
62       AS_HELP_STRING([--disable-srp],
63               [unconditionally disable the SRP functionality]),
64       use_srp=$enableval, use_srp=yes)
65
66# check if the available GnuTLS library supports SRP
67AC_SEARCH_LIBS([gnutls_srp_server_get_username], [gnutls], [], [use_srp="no"])
68
69SRP_CFLAGS=""
70if test "$use_srp" != "no"; then
71        SRP_CFLAGS="-DENABLE_SRP=1"
72fi
73
74AC_ARG_ENABLE(strict,
75       AS_HELP_STRING([--disable-strict],
76               [Avoid strict compiler warnings and errors]),
77       use_strict=$enableval, use_strict=yes)
78
79STRICT_CFLAGS=""
80if test "$use_strict" != "no"; then
81        STRICT_CFLAGS="-Wall -Werror -Wextra -Wno-error=deprecated-declarations"
82fi
83
84AC_MSG_CHECKING([whether to enable SRP functionality])
85AC_MSG_RESULT($use_srp)
86
87dnl Optionally disable flock
88AC_ARG_ENABLE(flock,
89        AS_HELP_STRING([--disable-flock], [Disable use of flock during tests \
90        (some exotic architectures don't support it)]),
91        [use_flock=$enableval], [use_flock=yes])
92# Check if flock is available and supports --timeout
93AC_PATH_PROG([FLOCK], [flock], [no])
94AS_IF([test "${FLOCK}" != "no"],
95      [
96        AC_MSG_CHECKING([whether ${FLOCK} supports --timeout])
97        lockfile="$(mktemp)"
98        AS_IF([${FLOCK} --timeout 1 ${lockfile} true >&AS_MESSAGE_LOG_FD 2>&1],
99              [flock_works="yes"], [flock_works="no"])
100        AC_MSG_RESULT([$flock_works])
101        # Old versions of flock do not support --verbose. They fail
102        # without executing the command but still return 0. Check for
103        # this behavior by testing if the rm command was executed.
104        AC_MSG_CHECKING([whether ${FLOCK} supports --verbose])
105        testfile="$(mktemp)"
106        AS_IF([${FLOCK} --verbose --timeout 1 ${lockfile} rm "${testfile}" \
107                        >&AS_MESSAGE_LOG_FD 2>&1; test ! -e "${testfile}"],
108              [flock_verbose="yes"; FLOCK="${FLOCK} --verbose"],
109              [flock_verbose="no"; rm "${testfile}"])
110        AC_MSG_RESULT([$flock_verbose])
111        rm "${lockfile}"
112      ],
113      [flock_works="no"])
114# disable flock if requested by user or it doesn't support timeout
115AM_CONDITIONAL([DISABLE_FLOCK],
116               [test "$enable_flock" = "no" || test "$flock_works" = "no"])
117
118# openssl is needed as the responder for OCSP tests
119AC_PATH_PROG([OPENSSL], [openssl], [no])
120# OCSP checks with gnutls-cli from GnuTLS versions before 3.3.23,
121# 3.4.12, or 3.5.1 (on the respective 3.x branch) fail if intermediate
122# CAs cannot be status checked, even if there are no intermediate CAs
123# like in the mod_gnutls test suite where end entity certificates are
124# directly issued by a root CA.
125AC_MSG_CHECKING([for gnutls-cli version supporting OCSP for EE under root CA])
126AC_PREPROC_IFELSE(
127        [AC_LANG_SOURCE([[#include "gnutls/gnutls.h"
128                        #if GNUTLS_VERSION_NUMBER < 0x030317
129                        #error
130                        #elif GNUTLS_VERSION_NUMBER >= 0x030400 && GNUTLS_VERSION_NUMBER < 0x03040c
131                        #error
132                        #elif GNUTLS_VERSION_NUMBER == 0x030500
133                        #error
134                        #endif
135                        ]])],
136        [gnutls_ocsp_ok="yes"],
137        [gnutls_ocsp_ok="no"],
138)
139AC_MSG_RESULT([$gnutls_ocsp_ok])
140AM_CONDITIONAL([ENABLE_OCSP_TEST], [test "${OPENSSL}" != "no" && test "${gnutls_ocsp_ok}" = "yes"])
141
142dnl Enable test namespaces? Default is "yes".
143AC_ARG_ENABLE(test-namespaces,
144        AS_HELP_STRING([--disable-test-namespaces], [Disable use of \
145        namespaces for tests (limits parallelization)]),
146        [use_netns=$enableval], [use_netns=yes])
147
148# Check if "unshare" is available and has permission to create
149# network, IPC, and user namespaces
150AC_PATH_PROG([UNSHARE], [unshare], [no])
151AS_IF([test "${UNSHARE}" != "no"],
152      [
153        AC_MSG_CHECKING([for permission to use namespaces])
154        AS_IF([${UNSHARE} --net --ipc -r /bin/sh -c \
155                "ip link set up lo && ip addr show" >&AS_MESSAGE_LOG_FD 2>&1],
156              [unshare_works="yes"], [unshare_works="no"])
157        AC_MSG_RESULT([$unshare_works])
158      ],
159      [unshare_works="no"])
160# decide whether to enable network namespaces
161AS_IF([test "$enable_test_namespaces" != "no" \
162            && test "$unshare_works" = "yes"],
163      [use_netns="yes"], [use_netns="no"])
164AM_CONDITIONAL([ENABLE_NETNS], [test "$use_netns" != "no"])
165# Adjust Apache configuration for tests accordingly: Use pthread mutex
166# and test specific PID files if using namespaces, defaults otherwise.
167AS_IF([test "$use_netns" = "yes"],
168      [MUTEX_CONF="Mutex pthread default"; PID_AFFIX="-\${TEST_NAME}"],
169      [MUTEX_CONF=""; PID_AFFIX=""])
170AC_SUBST(MUTEX_CONF)
171AC_SUBST(PID_AFFIX)
172AM_SUBST_NOTMAKE(MUTEX_CONF)
173AM_SUBST_NOTMAKE(PID_AFFIX)
174
175AC_ARG_ENABLE(msva,
176       AS_HELP_STRING([--enable-msva],
177               [enable Monkeysphere client certificate verification]),
178       use_msva=$enableval, use_msva=no)
179AM_CONDITIONAL([USE_MSVA], [test "$use_msva" != "no"])
180
181MSVA_CFLAGS=""
182if test "$use_msva" != "no"; then
183        AC_CHECK_HEADERS([msv/msv.h], [],
184                         [AC_MSG_ERROR([*** No libmsv headers found!])])
185        AC_SEARCH_LIBS([msv_query_agent], [msv], [],
186                         [AC_MSG_ERROR([*** No libmsv found with msv_query_agent!])])
187        MSVA_CFLAGS="-DENABLE_MSVA=1"
188fi
189
190AC_MSG_CHECKING([whether to enable MSVA functionality])
191AC_MSG_RESULT($use_msva)
192
193# Building documentation requires pandoc, which in turn needs pdflatex
194# to build PDF output.
195build_doc=no
196AC_PATH_PROG([PANDOC], [pandoc], [no])
197if test "$PANDOC" != "no"; then
198        AC_PATH_PROG([PDFLATEX], [pdflatex], [no])
199        if test "$PDFLATEX" != "no"; then
200                build_doc=yes
201        else
202                build_doc="html only"
203        fi
204else
205        AC_PATH_PROG([MARKDOWN], [markdown], [no])
206        if test "$MARKDOWN" != "no"; then
207                build_doc="html stub"
208        fi
209fi
210AM_CONDITIONAL([USE_PANDOC], [test "$PANDOC" != "no"])
211AM_CONDITIONAL([USE_PDFLATEX], [test "$PANDOC" != "no" && \
212                               test "$PDFLATEX" != "no"])
213AM_CONDITIONAL([USE_MARKDOWN], [test -n "$MARKDOWN" && \
214                               test "$MARKDOWN" != "no"])
215
216# Check for Apache binary
217AC_PATH_PROGS([APACHE2], [apache2 httpd], [no], [$PATH:/usr/sbin])
218if test "${APACHE2}" = "no"; then
219        AC_MSG_WARN([Neither apache2 nor httpd found in \
220                     PATH. Test suite will fail.])
221fi
222
223AC_PATH_PROGS([HTTP_CLI], [curl wget], [no])
224
225MODULE_CFLAGS="${LIBGNUTLS_CFLAGS} ${SRP_CFLAGS} ${MSVA_CFLAGS} ${APXS_CFLAGS} ${AP_INCLUDES} ${APR_INCLUDES} ${APU_INCLUDES} ${STRICT_CFLAGS}"
226MODULE_LIBS="${LIBGNUTLS_LIBS}"
227
228AC_PATH_PROGS([SOFTHSM], [softhsm2-util softhsm], [no])
229if test "${SOFTHSM}" != "no"; then
230        softhsm_version=$(${SOFTHSM} --version)
231        AS_VERSION_COMPARE([$(${SOFTHSM} --version)], [2.0.0],
232                           [AC_SUBST(SOFTHSM_MAJOR_VERSION, [1])],
233                           [AC_SUBST(SOFTHSM_MAJOR_VERSION, [2])],
234                           [AC_SUBST(SOFTHSM_MAJOR_VERSION, [2])])
235fi
236AM_CONDITIONAL([HAVE_SOFTHSM], [test "${SOFTHSM}" != "no"])
237AM_CONDITIONAL([HAVE_SOFTHSM1], [test "${SOFTHSM_MAJOR_VERSION}" = "1"])
238AM_CONDITIONAL([HAVE_SOFTHSM2], [test "${SOFTHSM_MAJOR_VERSION}" = "2"])
239
240AC_SUBST(MODULE_CFLAGS)
241AC_SUBST(MODULE_LIBS)
242
243# assign default values to TEST_HOST and TEST_IP if necessary
244: ${TEST_HOST:="localhost"}
245: ${TEST_IP:="[[::1]] 127.0.0.1"}
246AC_ARG_VAR([TEST_HOST], [Host name to use for server instances started by \
247                        "make check", must resolve to addresses in TEST_IP. \
248                        The default is "localhost".])
249AC_ARG_VAR([TEST_IP], [List of IP addresses to use for server instances \
250                      started by "make check". The default is \
251                      "[::1] 127.0.0.1". Note that IPv6 addresses must be \
252                      enclosed in square brackets.])
253
254: ${TEST_LOCK_WAIT:="30"}
255: ${TEST_QUERY_TIMEOUT:="30"}
256AC_ARG_VAR([TEST_LOCK_WAIT], [Timeout in seconds to acquire locks for \
257                             Apache instances in the test suite, or the \
258                             previous instance to remove its PID file if \
259                             flock is not used. Default is 30.])
260AC_ARG_VAR([TEST_QUERY_TIMEOUT], [Timeout in seconds for HTTPS requests \
261                                 sent using gnutls-cli in the test suite. \
262                                 Default is 30.])
263
264dnl Allow user to set SoftHSM PKCS #11 module
265AC_ARG_VAR([SOFTHSM_LIB], [Absolute path of the SoftHSM PKCS @%:@11 module to \
266                          use. By default the test suite will search common \
267                          library paths.])
268
269dnl Build list of "Listen" statements for Apache
270LISTEN_LIST="@%:@ Listen addresses for the test servers"
271for i in ${TEST_IP}; do
272        LISTEN_LIST="${LISTEN_LIST}
273Listen ${i}:\${TEST_PORT}"
274done
275# Available extra ports, tests can "Define" variables of the listed
276# names in their apache.conf to enable them.
277for j in TEST_HTTP_PORT; do
278LISTEN_LIST="${LISTEN_LIST}
279<IfDefine ${j}>"
280for i in ${TEST_IP}; do
281        LISTEN_LIST="${LISTEN_LIST}
282        Listen ${i}:\${${j}}"
283done
284LISTEN_LIST="${LISTEN_LIST}
285</IfDefine>"
286done
287AC_SUBST(LISTEN_LIST)
288AM_SUBST_NOTMAKE(LISTEN_LIST)
289
290DX_DOXYGEN_FEATURE(ON)
291DX_DOT_FEATURE(ON)
292DX_HTML_FEATURE(ON)
293DX_MAN_FEATURE(OFF)
294DX_RTF_FEATURE(OFF)
295DX_XML_FEATURE(OFF)
296DX_PDF_FEATURE(ON)
297DX_PS_FEATURE(OFF)
298DX_INIT_DOXYGEN([mod_gnutls], [doc/doxygen.conf], [doc/api])
299
300AC_CONFIG_FILES([Makefile src/Makefile test/Makefile test/tests/Makefile \
301                        doc/Makefile doc/doxygen.conf include/mod_gnutls.h \
302                        test/proxy_backend.conf test/ocsp_server.conf \
303                        test/apache-conf/listen.conf \
304                        test/apache-conf/netns.conf])
305AC_OUTPUT
306
307echo "---"
308echo "Configuration summary for mod_gnutls:"
309echo ""
310echo "   * mod_gnutls version:  ${MOD_GNUTLS_VERSION}"
311echo "   * Apache Modules directory:    ${AP_LIBEXECDIR}"
312echo "   * GnuTLS Library version:      ${LIBGNUTLS_VERSION}"
313echo "   * CFLAGS for GnuTLS:           ${LIBGNUTLS_CFLAGS}"
314echo "   * LDFLAGS for GnuTLS:  ${LIBGNUTLS_LIBS}"
315echo "   * SRP Authentication:  ${use_srp}"
316echo "   * MSVA Client Verification:    ${use_msva}"
317echo "   * Build documentation: ${build_doc}"
318echo ""
319echo "---"
Note: See TracBrowser for help on using the repository browser.