source: mod_gnutls/configure.ac @ cb1d852

Last change on this file since cb1d852 was cb1d852, checked in by Fiona Klute <fiona.klute@…>, 2 months ago

Add --enable-gnutls-debug-log to ./configure

This replaces the OOO_MAINTAIN_MODE macro, which previously enabled
the debug log and nothing else. The new code and documentation should
be much clearer.

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