source: mod_gnutls/configure.ac @ dc55c77

debian/masterdebian/stretch-backportsjessie-backportsupstream
Last change on this file since dc55c77 was b21bf4f, checked in by Thomas Klute <thomas2.klute@…>, 4 years ago

configure: Check if creating namespaces is possible

Some Linux distributions (I've observed this on Debian) restrict
unprivileged users' ability to create namespaces, so checking just
whether the "unshare" command is available is not enough: If it is but
the user building mod_gnutls does not have the necessary permissions,
test cases will fail when trying to create their namespaces. Add a
check that tries to actually create a namespace and disable namespace
isolation of tests if it fails.

  • Property mode set to 100644
File size: 6.4 KB
Line 
1dnl
2AC_INIT(mod_gnutls, 0.7.2)
3OOO_CONFIG_NICE(config.nice)
4MOD_GNUTLS_VERSION=AC_PACKAGE_VERSION
5AC_PREREQ(2.53)
6AC_CONFIG_SRCDIR([src/mod_gnutls.c])
7AC_CONFIG_AUX_DIR(config)
8
9OOO_MAINTAIN_MODE
10AM_MAINTAINER_MODE
11AC_CANONICAL_TARGET
12# mod_gnutls test suite requires GNU make
13AM_INIT_AUTOMAKE([-Wno-portability])
14AM_CONFIG_HEADER(include/mod_gnutls_config.h:config.in)
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.2.0
27CHECK_APACHE(,$AP_VERSION,
28    :,:,
29    AC_MSG_ERROR([*** Apache version $AP_VERSION not found!])
30)
31
32PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.1.4])
33
34LIBGNUTLS_VERSION=`pkg-config --modversion gnutls`
35
36AC_ARG_ENABLE(srp,
37       AS_HELP_STRING([--disable-srp],
38               [unconditionally disable the SRP functionality]),
39       use_srp=$enableval, use_srp=yes)
40
41# check if the available GnuTLS library supports SRP
42AC_SEARCH_LIBS([gnutls_srp_server_get_username], [gnutls], [], [use_srp="no"])
43
44SRP_CFLAGS=""
45if test "$use_srp" != "no"; then
46        SRP_CFLAGS="-DENABLE_SRP=1"
47fi
48
49AC_ARG_ENABLE(strict,
50       AS_HELP_STRING([--disable-strict],
51               [Avoid strict compiler warnings and errors]),
52       use_strict=$enableval, use_strict=yes)
53
54STRICT_CFLAGS=""
55if test "$use_strict" != "no"; then
56        STRICT_CFLAGS="-Wall -Werror -Wextra"
57fi
58
59AC_MSG_CHECKING([whether to enable SRP functionality])
60AC_MSG_RESULT($use_srp)
61
62dnl Optionally disable flock
63AC_ARG_ENABLE(flock,
64        AS_HELP_STRING([--disable-flock], [Disable use of flock during tests \
65        (some exotic architectures don't support it)]),
66        [use_flock=$enableval], [use_flock=yes])
67dnl If flock is not disabled, make sure it's available
68if test "$enable_flock" != "no"; then
69        AC_PATH_PROG([FLOCK], [flock], [no])
70        use_flock=${FLOCK}
71fi
72AM_CONDITIONAL([DISABLE_FLOCK], [test "$enable_flock" = "no"])
73
74dnl Enable test namespaces? Default is "yes".
75AC_ARG_ENABLE(test-namespaces,
76        AS_HELP_STRING([--disable-test-namespaces], [Disable use of network \
77        namespaces to run tests in parallel (some architectures might not \
78        support it)]),
79        [use_netns=$enableval], [use_netns=yes])
80
81# Check if "unshare" is available and has permission to create network
82# and user namespaces
83AC_PATH_PROG([UNSHARE], [unshare], [no])
84AS_IF([test "${UNSHARE}" != "no"],
85      [
86        AC_MSG_CHECKING([whether ${UNSHARE} allows network and user namespaces])
87        AS_IF([${UNSHARE} --net -r /bin/sh -c \
88                "ip link set up lo; ip addr show" >&AS_MESSAGE_LOG_FD 2>&1],
89              [unshare_works="yes"], [unshare_works="no"])
90        AC_MSG_RESULT([$unshare_works])
91      ],
92      [unshare_works="yes"])
93# decide whether to enable network namespaces
94AS_IF([test "$enable_test_namespaces" != "no" \
95            && test "$unshare_works" = "yes"],
96      [use_netns="yes"], [use_netns="no"])
97AM_CONDITIONAL([ENABLE_NETNS], [test "$use_netns" != "no"])
98# Adjust Apache configuration for tests accordingly: Use pthread mutex
99# and test specific PID files if using namespaces, defaults otherwise.
100AS_IF([test "$use_netns" = "yes"],
101      [MUTEX_TYPE="pthread"; PID_AFFIX="-\${TEST_NAME}"],
102      [MUTEX_TYPE="default"; PID_AFFIX=""])
103AC_SUBST(MUTEX_TYPE)
104AC_SUBST(PID_AFFIX)
105AM_SUBST_NOTMAKE(MUTEX_TYPE)
106AM_SUBST_NOTMAKE(PID_AFFIX)
107
108AC_ARG_ENABLE(msva,
109       AS_HELP_STRING([--enable-msva],
110               [enable Monkeysphere client certificate verification]),
111       use_msva=$enableval, use_msva=no)
112AM_CONDITIONAL([USE_MSVA], [test "$use_msva" != "no"])
113
114MSVA_CFLAGS=""
115if test "$use_msva" != "no"; then
116        AC_CHECK_HEADERS([msv/msv.h], [],
117                         [AC_MSG_ERROR([*** No libmsv headers found!])])
118        AC_SEARCH_LIBS([msv_query_agent], [msv], [],
119                         [AC_MSG_ERROR([*** No libmsv found with msv_query_agent!])])
120        MSVA_CFLAGS="-DENABLE_MSVA=1"
121fi
122
123AC_MSG_CHECKING([whether to enable MSVA functionality])
124AC_MSG_RESULT($use_msva)
125
126have_apr_memcache=0
127CHECK_APR_MEMCACHE([have_apr_memcache=1], [have_apr_memcache=0])
128AC_SUBST(have_apr_memcache)
129
130# Building documentation requires pandoc, which in turn needs pdflatex
131# to build PDF output.
132build_doc=no
133AC_PATH_PROG([PANDOC], [pandoc], [no])
134if test "$PANDOC" != "no"; then
135        AC_PATH_PROG([PDFLATEX], [pdflatex], [no])
136        if test "$PDFLATEX" != "no"; then
137                build_doc=yes
138        else
139                build_doc="html only"
140        fi
141else
142        AC_PATH_PROG([MARKDOWN], [markdown], [no])
143        if test "$MARKDOWN" != "no"; then
144                build_doc="html stub"
145        fi
146fi
147AM_CONDITIONAL([USE_PANDOC], [test "$PANDOC" != "no"])
148AM_CONDITIONAL([USE_PDFLATEX], [test "$PANDOC" != "no" && \
149                               test "$PDFLATEX" != "no"])
150AM_CONDITIONAL([USE_MARKDOWN], [test -n "$MARKDOWN" && \
151                               test "$MARKDOWN" != "no"])
152
153# Check for Apache binary
154AC_PATH_PROGS([APACHE2], [apache2 httpd], [no], [$PATH:/usr/sbin])
155if test "${APACHE2}" = "no"; then
156        AC_MSG_WARN([Neither apache2 nor httpd found in \
157                     PATH. Test suite will fail.])
158fi
159
160MODULE_CFLAGS="${LIBGNUTLS_CFLAGS} ${SRP_CFLAGS} ${MSVA_CFLAGS} ${APR_MEMCACHE_CFLAGS} ${APXS_CFLAGS} ${AP_INCLUDES} ${APR_INCLUDES} ${APU_INCLUDES} ${STRICT_CFLAGS}"
161MODULE_LIBS="${APR_MEMCACHE_LIBS} ${LIBGNUTLS_LIBS}"
162
163AC_SUBST(MODULE_CFLAGS)
164AC_SUBST(MODULE_LIBS)
165
166# assign default values to TEST_HOST and TEST_IP if necessary
167: ${TEST_HOST:="localhost"}
168: ${TEST_IP:="[[::1]] 127.0.0.1"}
169AC_ARG_VAR([TEST_HOST], [Host name to use for server instances started by \
170                        "make check", must resolve to addresses in TEST_IP. \
171                        The default is "localhost".])
172AC_ARG_VAR([TEST_IP], [List of IP addresses to use for server instances \
173                      started by "make check". The default is \
174                      "[::1] 127.0.0.1". Note that IPv6 addresses must be \
175                      enclosed in square brackets.])
176AM_SUBST_NOTMAKE(TEST_IP)
177
178dnl Build list of "Listen" statements for Apache
179LISTEN_LIST="# Listen addresses for the test servers"
180for i in ${TEST_IP}; do
181        LISTEN_LIST="${LISTEN_LIST}
182Listen ${i}:\${TEST_PORT}"
183done
184AC_SUBST(LISTEN_LIST)
185AM_SUBST_NOTMAKE(LISTEN_LIST)
186
187AC_CONFIG_FILES([Makefile src/Makefile test/Makefile test/tests/Makefile \
188                        doc/Makefile include/mod_gnutls.h \
189                        test/proxy_backend.conf \
190                        test/apache-conf/listen.conf \
191                        test/apache-conf/netns.conf])
192AC_OUTPUT
193
194echo "---"
195echo "Configuration summary for mod_gnutls:"
196echo ""
197echo "   * mod_gnutls version:  ${MOD_GNUTLS_VERSION}"
198echo "   * Apache Modules directory:    ${AP_LIBEXECDIR}"
199echo "   * GnuTLS Library version:      ${LIBGNUTLS_VERSION}"
200echo "   * SRP Authentication:  ${use_srp}"
201echo "   * MSVA Client Verification:    ${use_msva}"
202echo "   * Build documentation: ${build_doc}"
203echo ""
204echo "---"
Note: See TracBrowser for help on using the repository browser.