aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac3249
1 files changed, 1294 insertions, 1955 deletions
diff --git a/configure.ac b/configure.ac
index 770ba499e..316257f97 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
1# This file is part of GNUnet. 1# This file is part of GNUnet.
2# (C) 2001--2021 GNUnet e.V. 2# (C) 2001--2023 GNUnet e.V.
3# 3#
4# GNUnet is free software: you can redistribute it and/or modify it 4# GNUnet is free software: you can redistribute it and/or modify it
5# under the terms of the GNU Affero General Public License as published 5# under the terms of the GNU Affero General Public License as published
@@ -20,332 +20,336 @@
20# 20#
21# 21#
22AC_PREREQ([2.69]) 22AC_PREREQ([2.69])
23# Checks for programs. 23AC_INIT([gnunet],[m4_esyscmd_s(sh scripts/get_version.sh)],[bug-gnunet@gnu.org])
24AC_INIT([gnunet],[0.15.4-alpha.0],[bug-gnunet@gnu.org]) 24
25gnunet_version=m4_esyscmd_s(sh scripts/get_version.sh)
26gnunet_major_version=m4_esyscmd_s(sh scripts/get_version.sh --major)
27gnunet_minor_version=m4_esyscmd_s(sh scripts/get_version.sh --minor)
28gnunet_micro_version=m4_esyscmd_s(sh scripts/get_version.sh --micro)
29
30AC_SUBST([gnunet_version])
31AC_SUBST([gnunet_major_version])
32AC_SUBST([gnunet_minor_version])
33AC_SUBST([gnunet_micro_version])
34
25AC_CONFIG_AUX_DIR([build-aux]) 35AC_CONFIG_AUX_DIR([build-aux])
36AC_CONFIG_MACRO_DIRS([m4])
26 37
27# check for legacy option that is no longer supported (#5627) and fail hard 38AC_CONFIG_HEADERS([gnunet_private_config.h])
28AC_ARG_WITH(nssdir,
29 [ --with-nssdir=DIR legacy switch, no longer supported, do not use],
30 [AC_MSG_RESULT([$with_nssdir])
31 AS_CASE([$with_nssdir],
32 [no],[],
33 [AC_MSG_ERROR([--with-nssdir is no longer supported])])
34 ])
35 39
36AC_CANONICAL_TARGET 40AC_CANONICAL_TARGET
37AC_CANONICAL_HOST 41AC_CANONICAL_HOST
38AM_INIT_AUTOMAKE 42
39m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AM_DEFAULT_VERBOSITY=1 AC_SUBST(AM_DEFAULT_VERBOSITY)]) 43AM_INIT_AUTOMAKE([tar-ustar])
40AC_CONFIG_HEADERS([gnunet_config.h]) 44AM_SILENT_RULES([yes])
41AH_TOP([#define _GNU_SOURCE 1]) 45
42AC_CONFIG_MACRO_DIR([m4]) 46# maybe use AC_USE_SYSTEM_EXTENSIONS?
47AH_TOP([#define _GNU_SOURCE 1])
48
43AC_PROG_AWK 49AC_PROG_AWK
44AC_PROG_CC 50AC_PROG_CC
45AC_PROG_OBJC 51AC_PROG_CC_C_O
46AC_PROG_INSTALL 52AC_PROG_INSTALL
47AC_PROG_LN_S 53AC_PROG_LN_S
48AC_PROG_MAKE_SET 54AC_PROG_MAKE_SET
49AM_PROG_CC_C_O 55AC_PROG_MKDIR_P
56PKG_PROG_PKG_CONFIG([0.29.2])
57
50LT_INIT([disable-static dlopen]) 58LT_INIT([disable-static dlopen])
51AC_SUBST(MKDIR_P)
52 59
53# allow for different autotools 60AS_IF([test "x$enable_shared" = "xno"],
61 [AC_MSG_ERROR([GNUnet works only with shared libraries, sorry])])
62
54AS_AUTOTOOLS_ALTERNATE 63AS_AUTOTOOLS_ALTERNATE
55 64
56# large file support
57AC_SYS_LARGEFILE 65AC_SYS_LARGEFILE
58AC_FUNC_FSEEKO 66AC_FUNC_FSEEKO
67AC_UNALIGNED_64_ACCESS
59 68
60 69# Helper to check cflags for compiler
61CFLAGS="-Wall $CFLAGS" 70# CC_CHECK_CFLAGS(FLAG, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]])
62AC_MSG_CHECKING(whether cc can use -fno-strict-aliasing) 71AC_DEFUN([CC_CHECK_CFLAGS_SILENT],
63# use '-fno-strict-aliasing', but only if the compiler can take it 72 [AC_CACHE_VAL([AS_TR_SH([cc_cv_cflags_$1])],
64AS_IF([$CC -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1], 73 [ac_save_CFLAGS="$CFLAGS"
65 [CFLAGS="-fno-strict-aliasing $CFLAGS"]) 74 CFLAGS="$CFLAGS $1 -Werror"
66 75 AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])],
67# A helper which allows us to check cflags if compiler 76 [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
68AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [ 77 [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
69 AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]), 78 CFLAGS="$ac_save_CFLAGS"])
70 [ac_save_CFLAGS="$CFLAGS" 79 AS_IF([eval test "x$]AS_TR_SH([cc_cv_cflags_$1])[" = "xyes"],
71 CFLAGS="$CFLAGS $1 -Werror" 80 [$2],
72 AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])], 81 [$3])
73 [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"], 82])dnl
74 [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"]) 83
75 CFLAGS="$ac_save_CFLAGS" 84# Check for FLAG and append it to CFLAGS if supported
76 ]) 85# CC_CHECK_CFLAG_APPEND(FLAG, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]])
77 86AC_DEFUN([CC_CHECK_CFLAG_APPEND],
78 AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], 87 [AC_CACHE_CHECK([if $CC supports $1],
79 [$2], [$3]) 88 [AS_TR_SH([cc_cv_cflags_$1])],
80]) 89 [CC_CHECK_CFLAGS_SILENT([$1])])
81 90 AS_IF([eval test "x$]AS_TR_SH([cc_cv_cflags_$1])[" = "xyes"],
82 91 [CFLAGS="$CFLAGS $1"; $2],
83# CC_CHECK_CFLAG_APPEND(FLAG, [action-if-found], [action-if-not-found]) 92 [$3])
84# Check for CFLAG and appends them to CFLAGS if supported 93])dnl
85AC_DEFUN([CC_CHECK_CFLAG_APPEND], [ 94
86 AC_CACHE_CHECK([if $CC supports -Wno-$1 flag], 95# Workaround for GCC not doing the proper thing when using a '-Wno' flag.
87 AS_TR_SH([cc_cv_cflags_-W$1]), 96# Works like CC_CHECK_CFLAG_APPEND except that the '-Wno' prefix is omitted
88 CC_CHECK_CFLAGS_SILENT([-W$1]) #gcc is stupid. It does not fail with the -W-no option for backwards compat but then shows the error "in case something goes wrong". 97# (e.g. '-Wno-foo' becomes 'foo')
89 ) 98AC_DEFUN([CC_CHECK_CFLAG_WNO_APPEND],
90 99 [AC_CACHE_CHECK([if $CC supports -Wno-$1],
91 AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_-W$1])[ = xyes], 100 [AS_TR_SH([cc_cv_cflags__W$1])],
92 [CFLAGS="$CFLAGS -Wno-$1"; $2], [$3]) 101 [CC_CHECK_CFLAGS_SILENT([-W$1])])
93]) 102 AS_IF([eval test "x$]AS_TR_SH([cc_cv_cflags__W$1])[" = "xyes"],
94 103 [CFLAGS="$CFLAGS -Wno-$1"; $2],
95 104 [$3])
96# We make heavy use of this, llvm/gcc and gcc-9 give warnings so disable. 105])dnl
97CC_CHECK_CFLAG_APPEND([address-of-packed-member]) 106
98 107# Use no-strict-aliasing only if the compiler supports it
99# We make heavy use of this, llvm/gcc and gcc-9 give warnings so disable. 108CC_CHECK_CFLAG_APPEND([-fno-strict-aliasing])
100CC_CHECK_CFLAG_APPEND([tautological-constant-out-of-range-compare]) 109
101 110# We make heavy use of these, gcc 9 gives warnings so disable them.
102# Use Linux interface name unless the OS has a different preference 111CC_CHECK_CFLAG_WNO_APPEND([address-of-packed-member])
103DEFAULT_INTERFACE="\"eth0\"" 112CC_CHECK_CFLAG_WNO_APPEND([tautological-constant-out-of-range-compare])
104
105funcstocheck="getnameinfo gethostname gethostbyname gethostbyaddr getaddrinfo getaddrinfo_a"
106
107# Srcdir in a form that native compiler understands (i.e. DOS path on W32)
108native_srcdir=$srcdir
109 113
110OLD_LDFLAGS="$LDFLAGS" 114OLD_LDFLAGS="$LDFLAGS"
111LDFLAGS="$LDFLAGS -Wl,--unresolved-symbols=report-all" 115LDFLAGS="$LDFLAGS -Wl,--unresolved-symbols=report-all"
112 116
113# Check system type
114AS_CASE(["$host_os"], 117AS_CASE(["$host_os"],
115 [*darwin* | *rhapsody* | *macosx*],[ 118 [*darwin*|*rhapsody*|*macosx*],
116 AC_DEFINE_UNQUOTED(DARWIN,1,[This is an Apple Darwin system]) 119 [AC_DEFINE([DARWIN],[1],[Define to 1 if this is an Apple Darwin system])
117 CPPFLAGS="-D_APPLE_C_SOURCE $CPPFLAGS" 120 CPPFLAGS="-D_APPLE_C_SOURCE $CPPFLAGS"
118 CFLAGS="-fno-common -D__APPLE_USE_RFC_3542 $CFLAGS" 121 CFLAGS="-fno-common -D__APPLE_USE_RFC_3542 $CFLAGS"
119 LDFLAGS="$OLD_LDFLAGS" 122 LDFLAGS="$OLD_LDFLAGS"
120 AC_MSG_WARN([WARNING: The VPN application cannot be compiled on your OS]) 123 build_target="darwin"
121 AC_CHECK_LIB(intl, gettext) 124 DEFAULT_INTERFACE="\"en0\""
122 build_target="darwin" 125 LIBPREFIX=
123 DEFAULT_INTERFACE="\"en0\"" 126 DLLDIR=lib
124 LIBPREFIX= 127 UNIXONLY="#"
125 DLLDIR=lib 128 AC_CHECK_LIB([intl], [gettext])],
126 UNIXONLY="#" 129 [linux*],
127 ], 130 [AC_DEFINE([LINUX],[1],[Define to 1 if this is a system with a Linux kernel])
128 [linux*],[ 131 build_target="linux"
129 AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel]) 132 DEFAULT_INTERFACE="\"eth0\""
130 build_target="linux" 133 LIBPREFIX=
131 LIBPREFIX= 134 DLLDIR=lib
132 DLLDIR=lib 135 UNIXONLY="#"
133 UNIXONLY="#" 136 AC_PATH_XTRA
134 AC_PATH_XTRA
135 ], 137 ],
136 [*freebsd*],[ 138 [*freebsd*],
137 CFLAGS="-D_THREAD_SAFE $CFLAGS" 139 [CFLAGS="-D_THREAD_SAFE $CFLAGS"
138 build_target="freebsd" 140 build_target="freebsd"
139 LIBPREFIX= 141 DEFAULT_INTERFACE="\"lo0\""
140 DLLDIR=lib 142 xbsd="yes"
141 UNIXONLY="#" 143 LIBPREFIX=
144 DLLDIR=lib
145 UNIXONLY="#"
142 ], 146 ],
143 [*openbsd*],[ 147 [*openbsd*],
144 # We need to explicitly link libc 148 [AC_DEFINE([OPENBSD],[1],[Define to 1 if this is an OpenBSD system])
145 LDFLAGS="$LDFLAGS -Wl,-lc" 149 # libc needs to be linked explicitly
146 # We also need to enable PIC 150 LDFLAGS="$OLD_LDFLAGS -lc"
147 CFLAGS="-fPIC $CFLAGS" 151 # and PIC has to be enabled
148 build_target="openbsd" 152 CFLAGS="-fPIC $CFLAGS"
149 LIBPREFIX= 153 build_target="openbsd"
150 DLLDIR=lib 154 DEFAULT_INTERFACE="\"lo0\""
151 UNIXONLY="#" 155 xbsd="yes"
156 LIBPREFIX=
157 DLLDIR=lib
158 UNIXONLY="#"
152 ], 159 ],
153 [*netbsd*],[ 160 [*netbsd*],
154 build_target="netbsd" 161 [build_target="netbsd"
155 LIBPREFIX= 162 DEFAULT_INTERFACE="\"lo0\""
156 DLLDIR=lib 163 xbsd="yes"
157 UNIXONLY="#" 164 LIBPREFIX=
165 DLLDIR=lib
166 UNIXONLY="#"
158 ], 167 ],
159 [*solaris*],[ 168 [*solaris*],
160 AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system]) 169 [AC_DEFINE([SOLARIS],[1],[Define to 1 if this is a Solaris system])
161 AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno does not work]) 170 AC_DEFINE([_REENTRANT],[1],[Needed with Solaris or errno does not work])
162 AC_CHECK_LIB(resolv, res_init) 171 AC_CHECK_LIB([resolv], [res_init])
163 AC_CHECK_LIB(rt, nanosleep) 172 AC_CHECK_LIB([rt], [nanosleep])
164 build_target="solaris" 173 build_target="solaris"
165 LIBPREFIX= 174 DEFAULT_INTERFACE="\"eth0\""
166 DLLDIR=lib 175 LIBPREFIX=
167 UNIXONLY="#" 176 DLLDIR=lib
177 UNIXONLY="#"
168 ], 178 ],
169 [*arm-linux*],[ 179 [*arm-linux*],
170 AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel]) 180 [AC_DEFINE([LINUX],[1],[Define to 1 if this is a system with a Linux kernel])
171 CFLAGS="-D_REENTRANT -fPIC -pipe $CFLAGS" 181 CFLAGS="-D_REENTRANT -fPIC -pipe $CFLAGS"
172 build_target="linux" 182 build_target="linux"
173 LIBPREFIX= 183 DEFAULT_INTERFACE="\"eth0\""
174 DLLDIR=lib 184 LIBPREFIX=
175 UNIXONLY="#" 185 DLLDIR=lib
186 UNIXONLY="#"
176 ], 187 ],
177 [gnu*],[ 188 [gnu*],
178 AC_DEFINE_UNQUOTED(GNU,1,[This is a GNU system]) 189 [AC_DEFINE([GNU],[1],[Define to 1 if this is a GNU system])
179 build_target="gnu" 190 build_target="gnu"
180 UNIXONLY="#" 191 DEFAULT_INTERFACE="\"eth0\""
192 UNIXONLY="#"
181 ], 193 ],
182 [ 194 [AC_DEFINE([OTHEROS],[1],[Define to 1 if this is some strange OS])
183 AC_MSG_RESULT(Unrecognised OS $host_os) 195 DEFAULT_INTERFACE="\"eth0\""
184 AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS]) 196 ])
185 UNIXONLY=""
186])
187AC_DEFINE_UNQUOTED([GNUNET_DEFAULT_INTERFACE], $DEFAULT_INTERFACE, [This should be the default choice for the name of the first network interface])
188AC_SUBST(DEFAULT_INTERFACE)
189 197
190# Disable TCP-based IPC on systems that support UNIX domain 198AC_DEFINE_UNQUOTED([GNUNET_DEFAULT_INTERFACE], [$DEFAULT_INTERFACE],
191# sockets in default configuration: 199 [The default choice for the name of the first network interface])
192AC_SUBST(UNIXONLY) 200AC_SUBST([DEFAULT_INTERFACE])
193 201
202# Disable TCP-based IPC on system supporting UNIX domain sockets
203AC_SUBST([UNIXONLY])
194 204
195AC_MSG_CHECKING([for build target]) 205AC_MSG_CHECKING([for build target])
196AM_CONDITIONAL(DARWIN, test "$build_target" = "darwin") 206AM_CONDITIONAL([DARWIN], [test "$build_target" = "darwin"])
197AM_CONDITIONAL(SOLARIS, test "$build_target" = "solaris") 207AM_CONDITIONAL([SOLARIS], [test "$build_target" = "solaris"])
198AM_CONDITIONAL(XNETBSD, test "$build_target" = "netbsd") 208AM_CONDITIONAL([XNETBSD], [test "$build_target" = "netbsd"])
199AM_CONDITIONAL(XFREEBSD, test "$build_target" = "freebsd") 209AM_CONDITIONAL([XFREEBSD], [test "$build_target" = "freebsd"])
200AM_CONDITIONAL(OPENBSD, test "$build_target" = "openbsd") 210AM_CONDITIONAL([OPENBSD], [test "$build_target" = "openbsd"])
201# FIXME: We need a define BSD for some binaries like we 211AM_CONDITIONAL([XBSD], [test "x$bsd" = "xyes"])
202# need define LINUX for some. This does not scale, how 212AM_CONDITIONAL([LINUX], [test "$build_target" = "linux"])
203# can we solve this better? 213AM_CONDITIONAL([GNU], [test "$build_target" = "gnu"])
204AM_CONDITIONAL(XBSD, test "$build_target" = "netbsd" -o "$build_target" = "freebsd" -o "$build_target" = "openbsd")
205AM_CONDITIONAL(LINUX, test "$build_target" = "linux")
206AM_CONDITIONAL(GNU, test "$build_target" = "gnu")
207
208AC_MSG_RESULT([$build_target]) 214AC_MSG_RESULT([$build_target])
209AC_SUBST(build_target)
210AM_CONDITIONAL([am__fastdepOBJC], false)
211AC_UNALIGNED_64_ACCESS
212 215
213# some other checks for standard libs 216AS_IF([test "$build_target" = "darwin"],
214AC_SEARCH_LIBS([gethostbyname], [nsl ws2_32]) 217 [AC_MSG_WARN([The VPN application cannot be compiled on your system])])
215AC_SEARCH_LIBS([memrchr], [],
216 AC_DEFINE(HAVE_MEMRCHR,1,[memrchr supported]), [])
217AC_SEARCH_LIBS([memset_s], [],
218 AC_DEFINE(HAVE_MEMSET_S,1,[memset_s supported]), [])
219AC_SEARCH_LIBS([explicit_bzero], [],
220 AC_DEFINE(HAVE_EXPLICIT_BZERO,1,[explicit_bzero supported]), [])
221AC_CHECK_LIB(socket, socket)
222AC_CHECK_LIB(m, log)
223AC_CHECK_LIB(c, getloadavg, AC_DEFINE(HAVE_GETLOADAVG,1,[getloadavg supported]))
224
225AC_CHECK_PROG(VAR_GETOPT_BINARY, getopt, true, false)
226AM_CONDITIONAL(HAVE_GETOPT_BINARY, $VAR_GETOPT_BINARY)
227
228AC_CHECK_PROGS(PKG_CONFIG, [pkgconf, pkg-config], false)
229AM_CONDITIONAL(HAVE_PKG_CONFIG, test x$PKG_CONFIG != xfalse)
230
231AC_CHECK_PROG(VAR_SSH_BINARY, ssh, true, false)
232AM_CONDITIONAL(HAVE_SSH_BINARY, $VAR_SSH_BINARY)
233AC_MSG_CHECKING(for SSH key)
234 AM_CONDITIONAL(HAVE_SSH_KEY, ssh -D 12345 -o "BatchMode yes" -o "UserKnownHostsFile /tmp/gnunet_test_cosks_ssh_garbage" -o "StrictHostKeyChecking no" 127.0.0.1 echo -n)
235 if test -f /tmp/gnunet_test_cosks_ssh_garbage; then
236 rm -f /tmp/gnunet_test_cosks_ssh_garbage
237 fi
238
239
240# autotools' m4 for python has no maximum version!
241# python3.4 - python3.8 for tests (3.8 unchecked)
242# TODO: document how to override the lowest version
243# TODO: found by this.
244m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[python3 python3.4 python3.5 python3.6 python3.7 python3.8 python])
245AM_PATH_PYTHON([3.4],, [:])
246AC_SUBST([PYTHON])
247AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
248 218
219AC_SUBST([build_target])
249 220
250# perl 221# Other checks for standard libraries
251AC_PATH_PROG( PERL, perl, , 222AC_SEARCH_LIBS([gethostbyname], [nsl ws2_32])
252 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin ) 223AC_SEARCH_LIBS([memchr],[],
224 [AC_DEFINE([HAVE_MEMCHR],[1],
225 [Define to 1 if memchr is supported])],
226 [])
227AC_SEARCH_LIBS([memset_s],[],
228 [AC_DEFINE([HAVE_MEMSET_S],[1],
229 [Define to 1 if memset_s is supported])],
230 [])
231AC_SEARCH_LIBS([explicit_bzero],[],
232 [AC_DEFINE([HAVE_EXPLICIT_BZERO],[1],
233 [Define to 1 if explicit_bzero is supported])],
234 [])
235
236AC_CHECK_LIB([socket], [socket])
237AC_CHECK_LIB([m], [log])
238AC_CHECK_FUNCS([getloadavg])
239
240AC_CHECK_PROG([GETOPT_BINARY], [getopt], [true], [false])
241AM_CONDITIONAL([HAVE_GETOPT_BINARY], [$GETOPT_BINARY])
242
243AC_CHECK_PROGS([PKG_CONFIG], [pkgconf pkg-config], [false])
244AM_CONDITIONAL([HAVE_PKG_CONFIG], [test "x$PKG_CONFIG" != "xfalse"])
245
246AC_CHECK_PROG([SSH_BINARY], [ssh], [true], [false])
247AM_CONDITIONAL([HAVE_SSH_BINARY], [$SSH_BINARY])
248
249AC_MSG_CHECKING([for SSH key])
250AS_IF([ssh -D 12345 -o "BatchMode Yes" -o "UserKnownHostsFile /tmp/gnunet_test_cosks_ssh_garbage" -o "StrictHostKeyChecking no" 127.0.0.1 echo -n 2>/dev/null],
251 [has_ssh_key=yes],
252 [has_ssh_key=no])
253AM_CONDITIONAL([HAVE_SSH_KEY], [test "x$has_ssh_key" = "xyes"])
254AC_MSG_RESULT([$has_ssh_key])
255
256AS_IF([test -f /tmp/gnunet_test_cosks_ssh_garbage],
257 [rm -f /tmp/gnunet_test_cosks_ssh_garbage])
258
259AM_PATH_PYTHON([3.4],,[:])
260AC_SUBST([PYTHON])
261AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != ':'])
262
263AC_ARG_WITH([perl],
264 [AS_HELP_STRING([--with-perl=PATH], [Look for Perl in PATH])],
265 [AS_CASE([$withval],
266 [no], [AC_MSG_ERROR([Perl is required])],
267 [yes], [AC_PATH_PROG([PERL], [perl])],
268 [AC_PATH_PROG([PERL], [perl], [], ["$withval"])])],
269 [AC_PATH_PROG([PERL], [perl])])
253AC_SUBST([PERL]) 270AC_SUBST([PERL])
254AM_CONDITIONAL([HAVE_PERL], [test -x "$PERL"]) 271AM_CONDITIONAL([HAVE_PERL], [test -x "$PERL"])
255AS_IF([test -x "$PERL"], 272AS_IF([test -x "$PERL"],
256 [AC_DEFINE_UNQUOTED([HAVE_PERL], [1], [Path to Perl])], 273 [AC_DEFINE([HAVE_PERL], [1], [Define to 1 if perl is available])],
257 [AC_DEFINE_UNQUOTED([HAVE_PERL], [0], [Path to Perl])]) 274 [AC_DEFINE([HAVE_PERL], [0], [Define to 1 if perl is available])])
258 275
259# awk 276AWK_BINARY="$AWK"
260AC_PATH_PROGS( AWK_BINARY, [awk gawk], ,$PATH:/usr/bin/:/usr/local/bin )
261AC_SUBST([AWK_BINARY]) 277AC_SUBST([AWK_BINARY])
262AM_CONDITIONAL([HAVE_AWK], [test -x "$AWK_BINARY"]) 278AM_CONDITIONAL([HAVE_AWK], [test -x "$AWK_BINARY"])
263AS_IF([test -x "$AWK_BINARY"], 279AS_IF([test -x "$AWK_BINARY"],
264 [AC_DEFINE_UNQUOTED([HAVE_AWK], [1], [Path to awk])], 280 [AC_DEFINE([HAVE_AWK], [1], [Define to 1 if awk is available])],
265 [AC_DEFINE_UNQUOTED([HAVE_AWK], [0], [Path to awk])]) 281 [AC_DEFINE([HAVE_AWK], [0], [Define to 1 if awk is available])])
282
283# check for some LaTeX packages used by gnunet-bcd
284CHECK_LATEX_PACKAGE([TikZ], [tikz])
285CHECK_LATEX_PACKAGE([QR Code], [qrcode])
286CHECK_LATEX_PACKAGE([Labels], [labels])
287AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$PDFLATEX_BINARY" != "xno"])
266 288
267# should we install gnunet-logread?
268AC_MSG_CHECKING(whether to install gnunet-logread)
269AC_ARG_WITH([gnunet-logread], 289AC_ARG_WITH([gnunet-logread],
270 [AS_HELP_STRING([--with-gnunet-logread], 290 [AS_HELP_STRING([--with-gnunet-logread], [Install gnunet-logread])],
271 [Install gnunet-logread])], 291 [logread=yes],
272 [logread=${withval}], 292 [logread=no])
273 [logread=no])
274AC_MSG_RESULT($logread)
275AS_IF([test "x$logread" = "xyes"], 293AS_IF([test "x$logread" = "xyes"],
276 [AM_CONDITIONAL([GNUNET_LOGREAD], true) 294 [AM_CONDITIONAL([GNUNET_LOGREAD], [true])
277 AC_DEFINE([GNUNET_LOGREAD], 295 AC_DEFINE([GNUNET_LOGREAD], [1],
278 [1], 296 [Define to 1 if gnunet-logread is available])],
279 [Installing gnunet-logread])], 297 [AM_CONDITIONAL([GNUNET_LOGREAD], [false])
280 [AM_CONDITIONAL([GNUNET_LOGREAD], 298 AC_DEFINE([GNUNET_LOGREAD], [0],
281 false) 299 [Define to 1 if gnunet-logread is available])])
282 AC_DEFINE([GNUNET_LOGREAD],
283 [0],
284 [Not installing gnunet-logread])])
285 300
286# iptables is a soft requirement to run tests 301# iptables is a soft requirement to run tests
287AC_PATH_TARGET_TOOL(VAR_IPTABLES_BINARY, iptables, false) 302AC_PATH_TARGET_TOOL([IPTABLES_BINARY], [iptables], [false])
288 303AS_IF([test "x$IPTABLES_BINARY" = "xfalse"],
289AS_IF([test x"$VAR_IPTABLES_BINARY" = x"false"], 304 [AS_IF([test -x "/sbin/iptables"],
290 [AS_IF([test -x "/sbin/iptables"], 305 [IPTABLES_BINARY="/sbin/iptables"],
291 [VAR_IPTABLES_BINARY="/sbin/iptables"], 306 [AS_IF([test -x "/usr/sbin/iptables"],
292 [AS_IF([test -x "/usr/sbin/iptables"], 307 [IPTABLES_BINARY="/usr/sbin/iptables"])])])
293 [VAR_IPTABLES_BINARY="/usr/sbin/iptables"])])]) 308
294 309AS_IF([test "x$IPTABLES_BINARY" != "xfalse"],
295AS_IF([test x"$VAR_IPTABLES_BINARY" != x"false"], 310 [AC_DEFINE_UNQUOTED([IPTABLES], ["$IPTABLES_BINARY"], [Path to iptables])],
296 [AC_DEFINE_UNQUOTED([IPTABLES], "$VAR_IPTABLES_BINARY", [Path to iptables])], 311 [AC_MSG_WARN([iptables not found])])
297 [AC_MSG_WARN([warning: 'iptables' not found.])]) 312
298 313# also check for ip6tables
299# ip6tables is a soft requirement for some features 314AC_PATH_TARGET_TOOL([IP6TABLES_BINARY], [ip6tables], [false])
300AC_PATH_TARGET_TOOL(VAR_IP6TABLES_BINARY, ip6tables, false) 315AS_IF([test "x$IP6TABLES_BINARY" = "xfalse"],
301 316 [AS_IF([test -x "/sbin/ip6tables"],
302AS_IF([test x"$VAR_IP6TABLES_BINARY" = x"false"], 317 [IP6TABLES_BINARY="/sbin/ip6tables"],
303 [AS_IF([test -x "/sbin/ip6tables"], 318 [AS_IF([test -x "/usr/sbin/ip6tables"],
304 [VAR_IP6TABLES_BINARY="/sbin/ip6tables"], 319 [IP6TABLES_BINARY="/usr/sbin/ip6tables"])])])
305 [AS_IF([test -x "/usr/sbin/ip6tables"], 320
306 [VAR_IP6TABLES_BINARY="/usr/sbin/ip6tables"])])]) 321AS_IF([test "x$IP6TABLES_BINARY" != "xfalse"],
307 322 [AC_DEFINE_UNQUOTED([IP6TABLES], ["$IP6TABLES_BINARY"],
308 323 [Path to ip6tables])],
309AS_IF([test x"$VAR_IP6TABLES_BINARY" != x"false"], 324 [AC_MSG_WARN([ip6tables not found])])
310 [AC_DEFINE_UNQUOTED([IP6TABLES], "$VAR_IP6TABLES_BINARY", [Path to ip6tables])], 325
311 [AC_MSG_WARN([warning: 'ip6tables' not found.])]) 326# also check for ip
312 327AC_PATH_TARGET_TOOL([IP_BINARY], [ip], [false])
313# ip is a soft requirement for some features 328AS_IF([test "x$IP_BINARY" = "xfalse"],
314AC_PATH_TARGET_TOOL(VAR_IP_BINARY, ip, false) 329 [AS_IF([test -x "/sbin/ip"],
315 330 [IP_BINARY="/sbin/ip"],
316AS_IF([test x"$VAR_IP_BINARY" = x"false"], 331 [AS_IF([test -x "/usr/sbin/ip"],
317 [AS_IF([test -x "/sbin/ip"], 332 [IP_BINARY="/usr/sbin/ip"])])])
318 [VAR_IP_BINARY="/sbin/ip"], 333
319 [AS_IF([test -x "/usr/sbin/ip"], 334AS_IF([test "x$IP_BINARY" != "xfalse"],
320 [VAR_IP_BINARY="/usr/sbin/ip"])])]) 335 [AC_DEFINE_UNQUOTED([PATH_TO_IP], ["$IP_BINARY"], [Path to ip])],
321 336 [AC_MSG_WARN([ip not found])])
322AS_IF([test x"$VAR_IP_BINARY" != x"false"], 337
323 [AC_DEFINE_UNQUOTED([PATH_TO_IP], "$VAR_IP_BINARY", [Path to ip])], 338# locate ifconfig
324 [AC_MSG_WARN([warning: 'ip' not found.])]) 339AC_PATH_TARGET_TOOL([IFCONFIG_BINARY], [ifconfig], [false])
325 340AS_IF([test "x$IFCONFIG_BINARY" = "xfalse"],
326# locate 'ifconfig' 341 [AS_IF([test -x "/sbin/ifconfig"],
327AC_PATH_TARGET_TOOL(VAR_IFCONFIG_BINARY, ifconfig, false) 342 [IFCONFIG_BINARY="/sbin/ifconfig"],
328 343 [AS_IF([test -x "/usr/sbin/ifconfig"],
329AC_CHECK_PROG(VAR_IFCONFIG_BINARY, ifconfig, true, false) 344 [IFCONFIG_BINARY="/usr/sbin/ifconfig"])])])
330AS_IF([test x"$VAR_IFCONFIG_BINARY" = x"false"], 345
331 [AS_IF([test -x "/sbin/ifconfig"], 346AS_IF([test "x$IFCONFIG_BINARY" != "xfalse"],
332 [VAR_IFCONFIG_BINARY="/sbin/ifconfig"], 347 [AC_DEFINE_UNQUOTED([IFCONFIG], ["$IFCONFIG_BINARY"], [Path to ifconfig])],
333 [AS_IF([test -x "/usr/sbin/ifconfig"], 348 [AC_MSG_WARN([ifconfig not found])])
334 [VAR_IFCONFIG_BINARY="/usr/sbin/ifconfig"])])]) 349
335 350AC_PATH_PROG([MSG_USER_SETUP], [adduser], [false])
336AS_IF([test x"$VAR_IFCONFIG_BINARY" != x"false"], 351
337 [AC_DEFINE_UNQUOTED([IFCONFIG], "$VAR_IFCONFIG_BINARY", [Path to ifconfig])], 352# test if the 'gnunet' user and groups exist
338 [AC_MSG_WARN(['ifconfig' not found.])])
339
340
341# Test if 'adduser' binary exists
342MSG_USER_SETUP=true
343AC_PATH_PROG([MSG_USER_SETUP],
344 [adduser],
345 false,
346 [path=$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin])
347
348# Test if 'gnunet' user and the groups exist
349getent passwd gnunet > /dev/null 353getent passwd gnunet > /dev/null
350HAVE_GNUNET_USER=$? 354HAVE_GNUNET_USER=$?
351getent group gnunet > /dev/null 355getent group gnunet > /dev/null
@@ -355,979 +359,633 @@ getent group gnunetdns > /dev/null
355AS_IF([test x$? != x0], 359AS_IF([test x$? != x0],
356 [HAVE_GNUNET_USER=1]) 360 [HAVE_GNUNET_USER=1])
357 361
358AC_PATH_TARGET_TOOL(VAR_SYSCTL_BINARY, sysctl, false) 362AC_PATH_TARGET_TOOL([SYSCTL_BINARY], [sysctl], [false])
359 363AS_IF([test "x$SYSCTL_BINARY" = "xfalse"],
360AC_CHECK_PROG(VAR_SYSCTL_BINARY, sysctl, true, false)
361AS_IF([test x"$VAR_SYSCTL_BINARY" = x"false"],
362 [AS_IF([test -x "/sbin/sysctl"], 364 [AS_IF([test -x "/sbin/sysctl"],
363 [VAR_SYSCTL_BINARY="/sbin/sysctl"], 365 [SYSCTL_BINARY="/sbin/sysctl"],
364 [AS_IF([test -x "/usr/sbin/sysctl"], 366 [AS_IF([test -x "/usr/sbin/sysctl"],
365 [VAR_SYSCTL_BINARY="/usr/sbin/sysctl"])])]) 367 [SYSCTL_BINARY="/usr/sbin/sysctl"])])])
366AS_IF([test x"$VAR_SYSCTL_BINARY" != x"false"],
367 [AC_DEFINE_UNQUOTED([SYSCTL], "$VAR_SYSCTL_BINARY", [Path to sysctl])],
368 [AC_MSG_WARN(['sysctl' not found.])])
369 368
370# miniupnpc / upnpc binary is a soft runtime requirement 369AS_IF([test "x$SYSCTL_BINARY" != "xfalse"],
371AC_PATH_TARGET_TOOL(VAR_UPNPC_BINARY, upnpc, false) 370 [AC_DEFINE_UNQUOTED([SYSCTL], ["$SYSCTL_BINARY"], [Path to sysctl])],
371 [AC_MSG_WARN([sysctl not found])])
372 372
373AS_IF([test x"$VAR_UPNPC_BINARY" != x"false"], 373# (mini)upnpc is a soft runtime requirement
374 [AC_DEFINE_UNQUOTED([UPNPC], "$VAR_UPNPC_BINARY", [Path to upnpc binary])], 374AC_PATH_TARGET_TOOL([UPNPC_BINARY], [upnpc], [false])
375 [AC_MSG_WARN([warning: 'upnpc' binary not found.])]) 375AS_IF([test "x$UPNPC_BINARY" != "x$false"],
376 [AC_DEFINE_UNQUOTED([UPNPC], ["$UPNPC_BINARY"], [Path to upnpc binary])],
377 [AC_MSG_WARN([upnpc binary not found])])
376 378
379# the following tools might use a flag to specify their path or non-default
380# name (e.g. a versioned string instead of simply the program name)
377 381
378# checkbashisms 382# checkbashisms
379AC_CHECK_PROGS(CHECKBASHISMS_BINARY, [checkbashisms checkbashisms.pl], false) 383AC_CHECK_PROGS([CHECKBASHISMS_BINARY], [checkbashisms checkbashisms.pl], [false])
380AM_CONDITIONAL(HAVE_CHECKBASHISMS, test x$CHECKBASHISMS_BINARY != xfalse) 384AM_CONDITIONAL([HAVE_CHECKBASHISMS], [test "x$CHECKBASHISMS_BINARY" != "xfalse"])
381 385
382# uncrustify 386# uncrustify
383# TODO: maybe add flag to pass location 387AC_CHECK_PROG([UNCRUSTIFY_BINARY], [uncrustify], [true], [false])
384AC_CHECK_PROG(UNCRUSTIFY_BINARY, uncrustify, true) 388AM_CONDITIONAL([HAVE_UNCRUSTIFY_BINARY], [$UNCRUSTIFY_BINARY])
385AM_CONDITIONAL(HAVE_UNCRUSTIFY_BINARY, $UNCRUSTIFY_BINARY)
386 389
387# yapf 390# yapf
388# TODO: less repetition, add flag to pass name 391# check only the 'yapf' name for now
389AC_CHECK_PROGS(YAPF_BINARY, [yapf yapf3.0 yapf3.1 yapf3.2 yapf3.3 yapf3.4 yapf3.5 yapf3.6 yapf3.7 yapf3.8 yapf3.9 yapf4.0], false) 392AC_CHECK_PROGS([YAPF_BINARY], [yapf], [false])
390AM_CONDITIONAL(HAVE_YAPF_BINARY, test x$YAPF_BINARY != xfalse) 393AM_CONDITIONAL([HAVE_YAPF_BINARY], [test "x$YAPF_BINARY" != "xfalse"])
391
392 394
393AC_CHECK_MEMBER(struct tm.tm_gmtoff, 395AC_CHECK_MEMBER([struct tm.tm_gmtoff],
394 [AC_DEFINE(HAVE_TM_GMTOFF, 1, 396 [AC_DEFINE([HAVE_TM_GMTOFF], [1],
395 [Define if struct tm has the tm_gmtoff member.])], 397 [Define to 1 if struct tm has the tm_gmtoff member])],
396 , 398 [],
397 [#include <time.h>]) 399 [#include <time.h>])
398 400
399# 'save' libs; only those libs found so far will be 401# "save" libs; only those libs found so far will be
400# linked against _everywhere_. For the others, we 402# linked against _everywhere_. For the others, we
401# will be more selective! 403# will be more selective!
402SAVE_LIBS=$LIBS 404SAVE_LIBS=$LIBS
403 405
404have_addrinfo_a=0 406have_addrinfo_a=0
405AC_CHECK_LIB(anl, 407AC_CHECK_LIB([anl], [getaddrinfo_a],
406 getaddrinfo_a, 408 [have_addrinfo_a=1
407 [have_addrinfo_a=1 AC_DEFINE(HAVE_GETADDRINFO_A, 409 AC_DEFINE([HAVE_GETADDRINFO_A], [1],
408 1, 410 [Define to 1 if getaddrinfo_a is supported])])
409 [getaddrinfo_a supported])]) 411AM_CONDITIONAL([HAVE_GETADDRINFO_A], [test "x$have_addrinfo_a" = "x1"])
410AM_CONDITIONAL(HAVE_GETADDRINFO_A,
411 [test "$have_addrinfo_a" = 1])
412 412
413# libgcrypt 413# libgcrypt
414gcrypt=0 414gcrypt=0
415NEED_LIBGCRYPT_API=1 415gcrypt_api=1
416NEED_LIBGCRYPT_VERSION=1.6.0 416gcrypt_version=1.6.0
417 417AM_PATH_LIBGCRYPT(["$gcrypt_api:$gcrypt_version"], [gcrypt=1])
418AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION", gcrypt=1)
419AC_CHECK_DECLS([gcry_mpi_set_opaque_copy], [], [], [[#include <gcrypt.h>]]) 418AC_CHECK_DECLS([gcry_mpi_set_opaque_copy], [], [], [[#include <gcrypt.h>]])
420 419
421AS_IF([test $gcrypt = 0], 420AS_IF([test "$gcrypt" = "0"],
422 [ 421 [AC_MSG_ERROR([[You need libgcrypt to build this program.
423 AC_MSG_ERROR([[ 422At least version $gcrypt_version (API $gcrypt_api) is required.]])])
424***
425*** You need libgcrypt to build this program.
426*** This library is for example available at
427*** ftp://ftp.gnupg.org/gcrypt/libgcrypt/.
428*** At least version $NEED_LIBGCRYPT_VERSION (API $NEED_LIBGCRYPT_API)
429*** is required.
430***]])
431])
432AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], "$NEED_LIBGCRYPT_VERSION", [required libgcrypt version])
433 423
434AC_CHECK_DECLS([struct in6_ifreq], [], [], [[#include <linux/if_tun.h>]]) 424AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], ["$gcrypt_version"],
425 [Required libgcrypt version])
435 426
436AC_CHECK_HEADER([if_tun.h], 427AC_CHECK_HEADER([if_tun.h],
437 [AC_DEFINE([IF_TUN_HDR], ["if_tun.h"], [if_tun.h include path])], 428 [AC_DEFINE([IF_TUN_HDR], ["if_tun.h"],
438 [AC_CHECK_HEADER([linux/if_tun.h], 429 [How to include if_tun.h])
439 [AC_DEFINE([IF_TUN_HDR], ["linux/if_tun.h"])], 430 AC_CHECK_DECLS([struct in6_ifreq], [], [],
440 [AC_CHECK_HEADER([net/if_tun.h], 431 [[#include <if_tun.h>]])],
441 [AC_DEFINE([IF_TUN_HDR], ["net/if_tun.h"])], 432 [AC_CHECK_HEADER([linux/if_tun.h],
442 [AC_CHECK_HEADER([net/tun/if_tun.h], 433 [AC_DEFINE([IF_TUN_HDR], ["linux/if_tun.h"],
443 [AC_DEFINE([IF_TUN_HDR], ["net/tun/if_tun.h"])])])])]) 434 [How to include if_tun.h])
444 435 AC_CHECK_DECLS([struct in6_ifreq], [], [],
445 436 [[#include <linux/if_tun.h>]])],
446# should the build process be building the documentation? 437 [AC_CHECK_HEADER([net/if_tun.h],
447AC_MSG_CHECKING(whether to build documentation) 438 [AC_DEFINE([IF_TUN_HDR], ["net/if_tun.h"],
439 [How to include if_tun.h])
440 AC_CHECK_DECLS([struct in6_ifreq], [], [],
441 [[#include <net/if_tun.h>]])],
442 [AC_CHECK_HEADER([net/tun/if_tun.h],
443 [AC_DEFINE([IF_TUN_HDR], ["net/tun/if_tun.h"],
444 [How to include if_tun.h])
445 AC_CHECK_DECLS([struct in6_ifreq], [], [],
446 [[#include <net/tun/if_tun.h>]])])])])])
447
448# Should documentation be built?
448AC_ARG_ENABLE([documentation], 449AC_ARG_ENABLE([documentation],
449 [AS_HELP_STRING([--disable-documentation], 450 [AS_HELP_STRING([--disable-documentation],
450 [do not build the documentation])], 451 [do not build the documentation])],
451 [documentation=${enableval}], 452 [documentation=${enableval}],
452 [documentation=yes]) 453 [documentation=yes])
453AC_MSG_RESULT($documentation) 454
454AS_IF([test "x$documentation" = "xyes"], 455AC_CHECK_PROG([DOXY_BINARY], [doxygen], [true], [false])
455 [AM_CONDITIONAL([DOCUMENTATION], 456AM_CONDITIONAL([HAVE_DOXY_BINARY], [$DOXY_BINARY])
456 true) 457
457 AC_DEFINE([DOCUMENTATION], 458AM_CONDITIONAL([DOCUMENTATION], [test "x$documentation" = "xyes"])
458 [1], 459
459 [Building the documentation])], 460AC_CHECK_PROGS([MANDOC_BINARY], [mandoc], [false])
460 [AM_CONDITIONAL([DOCUMENTATION], 461AM_CONDITIONAL([HAVE_MANDOC], [test "x$MANDOC_BINARY" != "xfalse"])
461 false) 462
462 AC_DEFINE([DOCUMENTATION], 463# check if only the documentation should be build
463 [0],
464 [Not building the documentation])])
465
466# COMMENT: Check whether to transpile texinfo to mdoc.
467# COMMENT: This is TRUE when --enable-texi2mdoc-generation
468# COMMENT: but ERRORS when texi2mdoc binary is missing in your $PATH
469# COMMENT: and makes the configure fail if it is missing.
470# COMMENT: Consequential the DEFINE and CONDITIONAL are set to true.
471# COMMENT: This is FALSE when --disable-texi2mdoc-generation was set
472# COMMENT: or nothing was set (this is the default).
473# COMMENT: There are 2 nested AS_IFs because we need to catch the
474# COMMENT: potential non-existence of the texi2mdoc binary.
475# COMMENT: Default return value / setting: no
476AC_MSG_CHECKING(whether to include generated texi2mdoc output in installation)
477AC_ARG_ENABLE([texi2mdoc-generation],
478 [AS_HELP_STRING([--enable-texi2mdoc-generation],
479 [include generated texi2mdoc output in installation])],
480 [texi2mdoc_generation=${enableval}],
481 [texi2mdoc_generation=no])
482AC_MSG_RESULT($texi2mdoc_generation)
483AS_IF([test "x$texi2mdoc_generation" = "xyes"],
484 [AS_IF([test "$texi2mdoc" = 0],
485 [AC_MSG_WARN([ERROR: transpiled mdoc output requires texi2mdoc.])
486 AC_MSG_WARN([ERROR: texi2mdoc can be obtained via your])
487 AC_MSG_WARN([ERROR: Operating System package manager or from])
488 AC_MSG_WARN([ERROR: https://mandoc.bsd.lv/texi2mdoc/])],
489 [AM_CONDITIONAL([TEXI2MDOC_GENERATION],true)
490 AC_DEFINE([TEXI2MDOC_GENERATION],
491 [1],
492 [Building section 7 mdoc output])])],
493 [AM_CONDITIONAL([TEXI2MDOC_GENERATION],
494 false)
495 AC_DEFINE([TEXI2MDOC_GENERATION],
496 [0],
497 [Not building section 7 mdoc output])])
498
499# test for texi2mdoc (the binary, not the script distributed
500# with autogen)
501# TODO: refactor this and the check above.
502AC_MSG_CHECKING(for texi2mdoc binary)
503AC_CHECK_PROGS(TEXI2MDOC_BINARY, [texi2mdoc], false)
504AM_CONDITIONAL(HAVE_TEXI2MDOC, test x$TEXI2MDOC_BINARY != xfalse)
505
506# texi2man is a tool which needs to be investigated and
507# is probably incompatible to texi2mdoc in invocation.
508# Detection at this point only serves as a reminder that
509# I will work this into the build-system.
510AC_MSG_CHECKING(for texi2man perl script)
511AC_CHECK_PROGS(TEXI2MAN_SCRIPT, [texi2man], false)
512AM_CONDITIONAL(HAVE_TEXI2MAN, test x$TEXI2MAN_SCRIPT != xfalse)
513
514
515# test for mandoc
516AC_MSG_CHECKING(for mandoc binary)
517AC_CHECK_PROGS(MANDOC_BINARY, [mandoc], false)
518AM_CONDITIONAL(HAVE_MANDOC, test x$MANDOC_BINARY != xfalse)
519
520# should the build process be building only the documentation?
521AC_MSG_CHECKING(whether to build only documentation)
522AC_ARG_ENABLE([documentation-only], 464AC_ARG_ENABLE([documentation-only],
523 [AS_HELP_STRING([--enable-documentation-only], 465 [AS_HELP_STRING([--enable-documentation-only],
524 [build only the documentation])], 466 [build only the documentation])],
525 [documentation_only=${enableval}], 467 [AS_IF([test "x${enableval}" = "xno"],
526 [documentation_only=no]) 468 [documentation_only="0"],
527AC_MSG_RESULT($documentation_only) 469 [documentation_only="1"])],
528AS_IF([test "x$documentation_only" = "xyes"], 470 [documentation_only="0"])
529 [ 471AC_DEFINE_UNQUOTED([DOCUMENTATION_ONLY], [$documentation_only],
530 AM_CONDITIONAL([DOCUMENTATION_ONLY],true) 472 [Define to 1 if only documentation is being built])
531 AC_DEFINE([DOCUMENTATION_ONLY],[1],[Building only the documentation]) 473AM_CONDITIONAL([DOCUMENTATION_ONLY], [test "x$documentation_only" = "x1"])
532 ],[ 474
533 AM_CONDITIONAL([DOCUMENTATION_ONLY],false) 475# check if man pages should be included
534 AC_DEFINE([DOCUMENTATION_ONLY],[0],[Doing a normal build, more than only documentation])
535 ])
536
537# should the build process be including the manpages? (default: yes)
538AC_MSG_CHECKING(whether to include man pages)
539AC_ARG_ENABLE([include-manpages], 476AC_ARG_ENABLE([include-manpages],
540 [AS_HELP_STRING([--disable-include-manpages], 477 [AS_HELP_STRING([--disable-include-manpages],
541 [Do not include the man pages in build and installation])], 478 [do not include man pages during installation])],
542 [include_manpages=${enableval}], 479 [AS_IF([test "x${enableval}" = "xno"],
543 [include_manpages=yes]) 480 [include_man="0"],
544AC_MSG_RESULT($include_manpages) 481 [include_man="1"])],
545AS_IF([test "x$include_manpages" = "xyes"], 482 [include_man="1"])
546 [ 483AC_DEFINE_UNQUOTED([INCLUDE_MANPAGES], [$include_man],
547 AM_CONDITIONAL([INCLUDE_MANPAGES],true) 484 [Define to 1 if man pages are included])
548 AC_DEFINE([INCLUDE_MANPAGES],[1],[Including the man pages in the build and installation]) 485AM_CONDITIONAL([INCLUDE_MANPAGES], [test "x$include_man" = "x1"])
549 ],[ 486
550 AM_CONDITIONAL([INCLUDE_MANPAGES],false) 487# Hardening options
551 AC_DEFINE([INCLUDE_MANPAGES],[0],[Not including the man pages in the build and installation])
552 ])
553
554# Do we have texinfo4? If yes, it is used to set texinfo4 specific switches
555# (not syntax!) to the commandline tools which generate the html. If not,
556# texinfo5 switches are used. This comes with no version checks, is
557# enabled only at distributors action (ie defaults to "no").
558# Mantis #3914 for more details (https://bugs.gnunet.org/view.php?id=3914)
559# While GNU makeinfo 6.5 supports --css-ref=URL,
560# makeinfo 4.8 (in NetBSD 8.0, macOS, and maybe other
561# base) does only support --css-include=FILE.
562# The only difference is a shorter html output and
563# in 6.5 the ability to use refs instead of include.
564# We prefer not to break builds in this case, so
565# we use the include version which is backwards compatible
566# and upwards compatible, while the ref variant is neither.
567# In the 5.x version they added `--split=chapters|sections` in
568# addition to `--split=nodes`.
569# Hold on to your hats: In version 6.5 this is already removed, ffs.
570# GNU Texinfo, please be more consistent than 1 version in switches.
571AC_MSG_CHECKING(whether to enable texinfo4 switches)
572AC_ARG_ENABLE([texinfo4],
573 [AS_HELP_STRING([--enable-texinfo4], [Use texinfo version 4 specific switches])],
574 [activate_texinfo4=${enableval}],
575 [activate_texinfo4=no])
576AC_MSG_RESULT($activate_texinfo4)
577AS_IF([test "x$activate_texinfo4" = "xyes"],
578 [
579 AM_CONDITIONAL([ACTIVATE_TEXINFO4],true)
580 AC_DEFINE([ACTIVATE_TEXINFO4],[1],[Using texinfo version 4 specific switches])
581 TEXINFO_HTMLFLAGS="--no-split --css-include=style.css --css-include=manual.css"
582 ],[
583 AM_CONDITIONAL([ACTIVATE_TEXINFO4],false)
584 AC_DEFINE([ACTIVATE_TEXINFO04],[0],[Using texinfo version 5 or later switches])
585 TEXINFO_HTMLFLAGS="--no-split --css-ref='../style.css' --css-ref='../manual.css'"
586
587 ])
588
589AC_SUBST([TEXINFO_HTMLFLAGS])
590
591# Adam shostack suggests the following for Windows:
592# -D_FORTIFY_SOURCE=2 -fstack-protector-all
593AC_ARG_ENABLE([gcc-hardening], 488AC_ARG_ENABLE([gcc-hardening],
594 AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks), 489 [AS_HELP_STRING([--enable-gcc-hardening], [enable compiler security checks])],
595[AS_IF([test x$enableval = xyes],[ 490 [AS_IF([test "x$enableval" = "xyes"],
596 CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all" 491 [CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all"
597 CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector" 492 CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector"
598 CFLAGS="$CFLAGS --param ssp-buffer-size=1" 493 CFLAGS="$CFLAGS --param ssp-buffer-size=1"
599 LDFLAGS="$LDFLAGS -pie" 494 LDFLAGS="$LDFLAGS -pie"])])
600 ])])
601
602# Linker hardening options
603# Currently these options are ELF specific - you can't use this with MacOSX
604AC_ARG_ENABLE([linker-hardening],
605 AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups),
606[AS_IF([test x$enableval = xyes],
607 [LDFLAGS="$LDFLAGS -z relro -z now"])])
608 495
496AC_ARG_ENABLE([linker-hardening],
497 [AS_HELP_STRING([--enable-linker-hardening], [enable linker security options])],
498 [AS_IF([test "x$enableval" = "xyes"],
499 [LDFLAGS="$LDFLAGS -z relro -z now"])])
609 500
610AC_ARG_ENABLE([sanitizer], 501AC_ARG_ENABLE([sanitizer],
611 AS_HELP_STRING(--enable-sanitizer, enable Address Sanitizer and Undefined Behavior Sanitizer), 502 [AS_HELP_STRING([--enable-sanitizer],
612[AS_IF([test x$enableval = xyes],[ 503 [enable address and undefined behaviour sanitizers])],
613 LDFLAGS="$CFLAGS -fsanitize=address,undefined -fno-omit-frame-pointer" 504 [AS_IF([test "x$enableval" = "xyes"],
614 ])]) 505 [CFLAGS="$CFLAGS -fsanitize=address,undefined -fno-omit-frame-pointer"])])
615
616 506
507# Logging
617extra_logging=GNUNET_NO 508extra_logging=GNUNET_NO
618AC_ARG_ENABLE([logging], 509AC_ARG_ENABLE([logging],
619 AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose,veryverbose ('yes' is the default)]), 510 [AS_HELP_STRING([--enable-logging@<:@=value@:>@],
620 [AS_IF([test "x$enableval" = "xyes"], [], 511 [enable logging calls; possible values: yes,no,verbose,veryverbose (default yes)])],
621 [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])], 512 [AS_CASE([$enableval],
622 [test "x$enableval" = "xverbose"], [extra_logging=GNUNET_YES] 513 [yes],
623 [test "x$enableval" = "xveryverbose"], [extra_logging=\(GNUNET_YES+1\)]) 514 [extra_logging=GNUNET_NO],
624 ], []) 515 [no],
625AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise]) 516 [extra_logging=GNUNET_NO
626 517 AC_DEFINE([GNUNET_CULL_LOGGING], [1],
627# should memory poisoning be enabled? 518 [Define to 1 to cull all logging calls])],
628AC_MSG_CHECKING(whether to poison freed memory) 519 [verbose],
629AC_ARG_ENABLE([poisoning], 520 [extra_logging=GNUNET_YES],
630 [AS_HELP_STRING([--enable-poisoning], [enable poisoning of freed memory (good for debugging)])], 521 [veryverbose], [extra_logging=\(GNUNET_YES+1\)],
631 [enable_poisoning=${enableval}], 522 [extra_logging=GNUNET_NO])])
632 [ 523AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING], [$extra_logging],
633 AS_IF([test "x$extra_logging" != "xGNUNET_NO"], 524 [Define to 1 if extra logging is enabled, 2 for very verbose logging])
634 [enable_poisoning="defaults to yes (extra logging is enabled)"],
635 [enable_poisoning=no])
636 ])
637AC_MSG_RESULT($enable_poisoning)
638AS_IF([test ! "x$enable_poisoning" = "xno"],
639 [enable_poisoning=1],
640 [enable_poisoning=0])
641AC_DEFINE_UNQUOTED([ENABLE_POISONING],[$enable_poisoning],[1 if freed memory should be poisoned, 0 otherwise])
642
643AS_IF([test $build = $target],
644[
645AC_MSG_CHECKING([for working HMAC])
646AC_LANG_PUSH(C)
647LIBS="$LIBS $LIBGCRYPT_LIBS"
648CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
649AC_RUN_IFELSE(
650 [AC_LANG_PROGRAM([#include <gcrypt.h>
651 #include <stdio.h>], [[
652 gcry_md_hd_t mac;
653
654 unsigned char data[] = { 0xbf, 0x16, 0x6e, 0x46, 0x3a, 0x6c, 0xf3, 0x93, 0xa7, 0x72,
655 0x11, 0xa1, 0xdc, 0x0b, 0x07, 0xdb, 0x1a, 0x5e, 0xd9, 0xb9, 0x81, 0xbe,
656 0xea, 0xe4, 0x31, 0x5f, 0x24, 0xff, 0xfe, 0x50, 0x8a, 0xde };
657 unsigned char key[] = { 0xfc, 0x62, 0x76, 0x35 };
658 unsigned char result[] = {0xa2, 0xb, 0x1, 0xd9, 0xc0, 0x8b, 0x5a, 0x12, 0x80,
659 0xd5, 0x50, 0x12, 0x8e, 0xd0, 0x5b, 0xb6, 0x5c, 0x87, 0x24, 0xe2, 0xd0,
660 0xd2, 0xaf, 0x63, 0xae, 0xd1, 0xd6, 0x64, 0x14, 0xe3, 0x6e, 0x61, 0x5b,
661 0xd, 0xba, 0x17, 0x7d, 0xd3, 0x10, 0xb1, 0x37, 0x41, 0x91, 0x7d, 0xeb,
662 0x1, 0x4d, 0x71, 0xe8, 0x59, 0x71, 0x42, 0x8e, 0xd6, 0xf3, 0x29, 0x3b,
663 0x90, 0xf2, 0xd1, 0xaf, 0x65, 0x1e, 0xb3};
664
665 if (!gcry_check_version (GCRYPT_VERSION))
666 {
667 fprintf (stderr, "Version mismatch %s <-> %s \n", gcry_check_version (NULL), GCRYPT_VERSION);
668 return 1;
669 }
670
671 gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
672 gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
673
674 if (gcry_md_open(&mac, GCRY_MD_SHA512, GCRY_MD_FLAG_HMAC) != GPG_ERR_NO_ERROR)
675 {
676 fprintf (stderr, "gcry_md_open error\n");
677 return 2;
678 }
679
680 gcry_md_setkey (mac, key, sizeof (key));
681 gcry_md_write (mac, data, sizeof (data));
682
683 if (memcmp(gcry_md_read (mac, 0), result, gcry_md_get_algo_dlen (gcry_md_get_algo (mac))) != 0)
684 {
685 fprintf (stderr, "memcmp error\n");
686 return 3;
687 }
688
689 gcry_md_close (mac);
690
691 return 0;
692 ]])],
693 [AC_MSG_RESULT([yes])],
694 [
695 RESULT=$?
696 if test $RESULT = 3
697 then
698 AC_MSG_FAILURE([HMAC test vector does not match. This is a known problem with libgcrypt 1.2.2 on Windows and fixed in 1.4.6.])
699 fi
700 if test $RESULT = 2
701 then
702 AC_MSG_FAILURE([HMAC test failed])
703 fi
704 if test $RESULT = 1
705 then
706 AC_MSG_FAILURE([libgcrypt header version does not match library version])
707 fi
708 ],
709 [AC_MSG_RESULT([cross compiling, test skipped])])
710AC_LANG_POP(C)
711]) # $build = $target
712
713AC_COMPILE_IFELSE([AC_LANG_SOURCE(
714 [[int main() {
715 _Static_assert(sizeof(int) >= 4, "not big enough");
716 return 0;
717 };]])],
718 [AC_DEFINE([HAVE_STATIC_ASSERT],[1],[Static assertions supported])],
719 [AC_DEFINE([HAVE_STATIC_ASSERT],[0],[Static assertions not supported])])
720
721# check for bluetooth library
722bluetooth=0
723AC_MSG_CHECKING(for libbluetooth)
724AC_ARG_WITH(libbluetooth,
725 [ --with-libbluetooth=PREFIX (base of libbluetooth installation)],
726 [AC_MSG_RESULT([$with_libbluetooth])
727 AS_CASE([$with_libbluetooth],
728 [no],[],
729 [yes],[
730 CHECK_LIBHEADER(BLUETOOTH,
731 bluetooth,
732 ba2str,
733 bluetooth/bluetooth.h,
734 bluetooth=1,)
735 ],[
736 LDFLAGS="-L$with_libbluetooth/lib $LDFLAGS"
737 CPPFLAGS="-I$with_libbluetooth/include $CPPFLAGS"
738 AC_CHECK_HEADERS(bluetooth/bluetooth.h,
739 AC_CHECK_LIB([bluetooth],
740 [ba2str],
741 EXT_LIB_PATH="-L$with_libbluetooth/lib $EXT_LIB_PATH"
742 bluetooth=1))
743 ])
744 ],
745 [AC_MSG_RESULT([--with-libbluetooth not specified])
746 CHECK_LIBHEADER(BLUETOOTH,
747 bluetooth,
748 ba2str,
749 bluetooth/bluetooth.h,
750 bluetooth=1,)])
751AM_CONDITIONAL(HAVE_LIBBLUETOOTH, [test "$bluetooth" = 1])
752AS_IF([test "$bluetooth" = 1],
753 [AC_DEFINE([HAVE_LIBBLUETOOTH],[1],[Have bluetooth library])],
754 [AC_DEFINE([HAVE_LIBBLUETOOTH],[0],[Lacking bluetooth library])])
755
756# check for zbar library
757# NOTE: Do not add checks for: -lSM, -lICE, -lX11, -lXv and -ljpeg
758# NOTE: they must be provided by the build environment, not the
759# NOTE: build-system of gnunet, as they are 2nd or 3rd level dependencies.
760zbar=0
761AC_MSG_CHECKING(for libzbar)
762AC_ARG_WITH(zbar,
763 [ --with-zbar=PREFIX (base of libzbar installation)],
764 [AC_MSG_RESULT([$with_zbar])
765 AS_CASE([$with_zbar],
766 [no],[],
767 [yes],[CHECK_LIBHEADER(ZBAR, zbar, zbar_processor_create, zbar.h,zbar=1,,)],
768 [
769 LDFLAGS="-L$with_zbar/lib $LDFLAGS"
770 CPPFLAGS="-I$with_zbar/include $CPPFLAGS"
771 AC_CHECK_HEADERS(zbar.h,
772 AC_CHECK_LIB([zbar], [zbar_processor_create],
773 EXT_LIB_PATH="-L$with_zbar/lib $EXT_LIB_PATH"
774 zbar=1))
775 ])
776 ],
777 [AC_MSG_RESULT([--with-zbar not specified])
778 CHECK_LIBHEADER(ZBAR, zbar, zbar_processor_create, zbar.h,zbar=1,,)])
779AM_CONDITIONAL(HAVE_ZBAR, [test "$zbar" = 1])
780AS_IF([test "x$zbar" = x1],
781 [AC_DEFINE([HAVE_ZBAR],[1],[Have zbar library])],
782 [AC_DEFINE([HAVE_ZBAR],[0],[Lacking zbar library])])
783
784# check for libpabc library
785pabc=0
786AC_MSG_CHECKING(for libpabc)
787AC_ARG_WITH(pabc,
788 [ --with-pabc=PREFIX (base of libpabc installation)],
789 [AC_MSG_RESULT([$with_pabc])
790 AS_CASE([$with_pabc],
791 [no],[],
792 [yes],[
793 CHECK_LIBHEADER(PABC, pabc, pabc_new_ctx, pabc/pabc.h,pabc=1,)
794 ],[
795 LDFLAGS="-L$with_pabc/lib $LDFLAGS"
796 CPPFLAGS="-I$with_pabc/include $CPPFLAGS"
797 AC_CHECK_HEADERS(pabc/pabc.h,
798 AC_CHECK_LIB([pabc], [pabc_new_ctx],
799 EXT_LIB_PATH="-L$with_pabc/lib $EXT_LIB_PATH"
800 pabc=1))
801 ])
802 ],
803 [AC_MSG_RESULT([--with-pabc not specified])
804 CHECK_LIBHEADER(PABC, pabc, pabc_new_ctx, pabc/pabc.h,pabc=1,)])
805AM_CONDITIONAL(HAVE_PABC, [test x$pabc = x1])
806
807
808# check for jansson library
809jansson=0
810AC_MSG_CHECKING(for libjansson)
811AC_ARG_WITH(jansson,
812 [ --with-jansson=PREFIX (base of libjansson installation)],
813 [AC_MSG_RESULT([$with_jansson])
814 AS_CASE([$with_jansson],
815 [no],[],
816 [yes],[
817 CHECK_LIBHEADER(JANSSON, jansson, json_loads, jansson.h,jansson=1,)
818 ],[
819 LDFLAGS="-L$with_jansson/lib $LDFLAGS"
820 CPPFLAGS="-I$with_jansson/include $CPPFLAGS"
821 AC_CHECK_HEADERS(jansson.h,
822 AC_CHECK_LIB([jansson], [json_loads],
823 EXT_LIB_PATH="-L$with_jansson/lib $EXT_LIB_PATH"
824 jansson=1))
825 ])
826 ],
827 [AC_MSG_RESULT([--with-jansson not specified])
828 CHECK_LIBHEADER(JANSSON, jansson, json_loads, jansson.h,jansson=1,)])
829
830AS_IF([test "x$jansson" != x1],
831 [AC_MSG_ERROR([GNUnet requires libjansson])])
832
833# check for libpulse(audio) library
834pulse=0
835libpulse_msg="no"
836AC_MSG_CHECKING(for libpulse)
837# TODO: --with-libpulse or --with-pulseaudio? What is more established
838# TODO: in this context?
839AC_ARG_WITH(libpulse,
840 [ --with-libpulse=PREFIX (base of libpulse installation)],
841 [AC_MSG_RESULT([$with_libpulse])
842 AS_CASE([$with_libpulse],
843 [no],[],
844 [yes],[
845 CHECK_LIBHEADER(LIBPULSE,
846 pulse,
847 pa_stream_peek,
848 pulse/simple.h,
849 pulse=1,)
850 ],[
851 LDFLAGS="-L$with_libpulse/lib $LDFLAGS"
852 CPPFLAGS="-I$with_libpulse/include $CPPFLAGS"
853 AC_CHECK_HEADERS(pulse/simple.h,
854 AC_CHECK_LIB([pulse],
855 [pa_stream_peek],
856 EXT_LIB_PATH="-L$with_libpulse/lib $EXT_LIB_PATH"
857 pulse=1))
858 ])
859 ],
860 [AC_MSG_RESULT([--with-libpulse not specified])
861 CHECK_LIBHEADER(LIBPULSE,
862 pulse,
863 pa_stream_peek,
864 pulse/simple.h,
865 pulse=1,)])
866AM_CONDITIONAL(HAVE_PULSE, [test "$pulse" = 1])
867AS_IF([test x"$pulse" = x1],
868 [AC_DEFINE([HAVE_PULSE],[1],[Have libpulse(audio) library])
869 libpulse_msg="yes"],
870 [AC_DEFINE([HAVE_PULSE],[0],[Lacking libpulse(audio) library])
871 libpulse_msg="no"])
872
873# check for libopus(audio) library
874opus=0
875libopus_msg="no"
876AC_MSG_CHECKING(for libopus)
877AC_ARG_WITH(libopus,
878 [ --with-libopus=PREFIX (base of libopus installation)],
879 [AC_MSG_RESULT([$with_libopus])
880 AS_CASE([$with_libopus],
881 [no],[],
882 [yes],[
883 CHECK_LIBHEADER(LIBOPUS,
884 opus,
885 opus_decode_float,
886 opus/opus.h,
887 AC_CHECK_DECL([OPUS_SET_GAIN],
888 [opus=1],
889 [],
890 [[
891 #include <opus/opus.h>
892 ]]))
893 ],[
894 LDFLAGS="-L$with_libopus/lib $LDFLAGS"
895 CPPFLAGS="-I$with_libopus/include $CPPFLAGS"
896 AC_CHECK_HEADERS(opus/opus.h,
897 AC_CHECK_LIB([opus],
898 [OPUS_SET_GAIN],
899 EXT_LIB_PATH="-L$with_libopus/lib $EXT_LIB_PATH"
900 opus=1))
901 ])
902 ],
903 [AC_MSG_RESULT([--with-libopus not specified])
904 CHECK_LIBHEADER(LIBOPUS,
905 opus,
906 opus_decode_float,
907 opus/opus.h,
908 AC_CHECK_DECL([OPUS_SET_GAIN],
909 [opus=1],
910 [],
911 [[
912 #include <opus/opus.h>
913 ]]))])
914AM_CONDITIONAL(HAVE_OPUS, [test "$opus" = 1])
915AS_IF([test "x$opus" = x1],
916 [AC_DEFINE([HAVE_OPUS],[1],[Have libopus library])
917 libopus_msg="yes"],
918 [AC_DEFINE([HAVE_OPUS],[0],[Lacking libopus library])
919 libopus_msg="no (required for conversation)"])
920
921# libogg
922AC_MSG_CHECKING(for libogg)
923AC_ARG_WITH(libogg,
924 [ --with-libogg=PREFIX (base of libogg installation)],
925 [AC_MSG_RESULT([$with_libogg])
926 AS_CASE([$with_libogg],
927 [no],[],
928 [yes],[
929 CHECK_LIBHEADER(LIBOGG,
930 ogg,
931 ogg_stream_flush_fill,
932 ogg/ogg.h,
933 ogg=1,)
934 ],[
935 LDFLAGS="-L$with_libogg/lib $LDFLAGS"
936 CPPFLAGS="-I$with_libogg/include $CPPFLAGS"
937 AC_CHECK_HEADERS(ogg/ogg.h,
938 AC_CHECK_LIB([ogg],
939 [ogg_stream_flush_fill],
940 EXT_LIB_PATH="-L$with_libogg/lib $EXT_LIB_PATH"
941 ogg=1))
942 ])
943 ],
944 [AC_MSG_RESULT([--with-libogg not specified])
945 CHECK_LIBHEADER(LIBOGG,
946 ogg,
947 ogg_stream_flush_fill,
948 ogg/ogg.h,
949 ogg=1,)])
950AM_CONDITIONAL(HAVE_OGG, [test "$ogg" = 1])
951AS_IF([test x"$ogg" = x1],
952 [AC_DEFINE([HAVE_OGG],[1],[Have ogg])],
953 [AC_DEFINE([HAVE_OGG],[0],[Lacking ogg])])
954
955
956PKG_CHECK_MODULES([GLIB],
957 [glib-2.0],
958 [# check for pbc library
959 pbc=0
960 AC_CHECK_HEADER([pbc/pbc.h],pbc=1)
961 AC_CHECK_HEADER([gabe.h],abe=1)
962 AM_CONDITIONAL(HAVE_PBC, [test "x$pbc" = x1])
963 AM_CONDITIONAL(HAVE_ABE, [test "x$abe" = x1])
964 AS_IF([test "x$pbc" = x1],
965 [AC_DEFINE([HAVE_PBC],[1],[Have pbc library])],
966 [AC_DEFINE([HAVE_PBC],[0],[Lacking pbc library])])
967 AS_IF([test "x$abe" = x1],
968 [AC_DEFINE([HAVE_ABE],[1],[Have ABE library])],
969 [AC_DEFINE([HAVE_ABE],[0],[Lacking ABE library])])],
970 [# glib-2 not found
971 AM_CONDITIONAL(HAVE_PBC, [false])
972 AM_CONDITIONAL(HAVE_ABE, [false])
973 AC_DEFINE([HAVE_PBC],[0],[Lacking glib library])])
974
975
976gst=0
977gstreamer_msg="no"
978AC_MSG_CHECKING(for gstreamer)
979PKG_CHECK_MODULES(
980 [GST],
981 [glib-2.0 gobject-2.0 gstreamer-1.0 gstreamer-app-1.0 gstreamer-audio-1.0],
982 [gst=1
983 gstreamer_msg="yes"],
984 [gst=0])
985 525
986# conversation 526AC_ARG_ENABLE([poisoning],
987AC_MSG_CHECKING(conversation feature set to build) 527 [AS_HELP_STRING([--enable-poisoning],
988AS_IF([test "x$pulse" != "x1" -o "x$opus" != "x1" -o "x$ogg" != "x1"],[ 528 [enable poisoning of freed memory (good for debugging)])],
989 AS_IF([test "x$gst" != "x1"],[ 529 [enable_poisoning=${enableval}],
990 conversation_backend=none 530 [enable_poisoning=missing])
991 AM_CONDITIONAL(BUILD_PULSE_HELPERS, false) 531
992 AM_CONDITIONAL(BUILD_GST_HELPERS, false) 532AS_IF([test "x$enable_poisoning" = "xmissing"],
993 AM_CONDITIONAL(BUILD_EXPERIMENTAL_HELPERS, false) 533 [AS_IF([test "x$extra_logging" != "xGNUNET_NO"],
994 ],[ 534 [enable_poisoning=yes],
995 conversation_backend=gst 535 [enable_poisoning=no])])
996 AM_CONDITIONAL(BUILD_PULSE_HELPERS, false) 536
997 AM_CONDITIONAL(BUILD_GST_HELPERS, true) 537AS_IF([test "x$enable_poisoning" = "xyes"],
998 AM_CONDITIONAL(BUILD_EXPERIMENTAL_HELPERS, false) 538 [AC_DEFINE([ENABLED_POISONING], [1],
999 ]) 539 [Define to 1 if freed memory is poisoned])],
1000],[ 540 [AC_DEFINE([ENABLED_POISONING], [0],
1001 conversation_backend=pulse 541 [Define to 1 if freed memory is poisoned])])
1002 AM_CONDITIONAL(BUILD_PULSE_HELPERS, true) 542
1003 AM_CONDITIONAL(BUILD_GST_HELPERS, false) 543AS_IF([test "$build" = "$target"],
1004 AM_CONDITIONAL(BUILD_EXPERIMENTAL_HELPERS, false) 544 [AC_MSG_CHECKING([for a working HMAC])
1005]) 545 AC_LANG_PUSH([C])
546 LIBS="$LIBS $LIBGCRYPT_LIBS"
547 CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
548 AC_RUN_IFELSE(
549 [AC_LANG_PROGRAM([#include <gcrypt.h>],
550 [[gcry_md_hd_t mac;
551unsigned char data[] = {
552 0xbf, 0x16, 0x6e, 0x46, 0x3a, 0x6c, 0xf3, 0x93, 0xa7, 0x72,
553 0x11, 0xa1, 0xdc, 0x0b, 0x07, 0xdb, 0x1a, 0x5e, 0xd9, 0xb9, 0x81, 0xbe,
554 0xea, 0xe4, 0x31, 0x5f, 0x24, 0xff, 0xfe, 0x50, 0x8a, 0xde
555};
556
557unsigned char key[] = { 0xfc, 0x62, 0x76, 0x35 };
558
559unsigned char result[] = {
560 0xa2, 0xb, 0x1, 0xd9, 0xc0, 0x8b, 0x5a, 0x12, 0x80,
561 0xd5, 0x50, 0x12, 0x8e, 0xd0, 0x5b, 0xb6, 0x5c, 0x87, 0x24, 0xe2, 0xd0,
562 0xd2, 0xaf, 0x63, 0xae, 0xd1, 0xd6, 0x64, 0x14, 0xe3, 0x6e, 0x61, 0x5b,
563 0xd, 0xba, 0x17, 0x7d, 0xd3, 0x10, 0xb1, 0x37, 0x41, 0x91, 0x7d, 0xeb,
564 0x1, 0x4d, 0x71, 0xe8, 0x59, 0x71, 0x42, 0x8e, 0xd6, 0xf3, 0x29, 0x3b,
565 0x90, 0xf2, 0xd1, 0xaf, 0x65, 0x1e, 0xb3
566};
567
568if (!gcry_check_version (GCRYPT_VERSION))
569{
570 return 1;
571}
572
573gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
574gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
575
576if (gcry_md_open(&mac, GCRY_MD_SHA512, GCRY_MD_FLAG_HMAC) != GPG_ERR_NO_ERROR)
577{
578 return 2;
579}
580
581gcry_md_setkey (mac, key, sizeof (key));
582gcry_md_write (mac, data, sizeof (data));
583
584if (memcmp(gcry_md_read (mac, 0),
585 result,
586 gcry_md_get_algo_dlen (gcry_md_get_algo (mac))) != 0)
587{
588 return 3;
589}
590
591gcry_md_close (mac);]])],
592 [AC_MSG_RESULT([yes])],
593 [AC_MSG_RESULT([no])
594 RESULT=$?
595 AS_CASE([$RESULT],
596 [1],
597 [AC_MSG_FAILURE([libgcrypt header version does not match library])],
598 [2],
599 [AC_MSG_FAILURE([HMAC test failed])],
600 [3],
601 [AC_MSG_FAILURE([HMAC test vector does not match. This is a known problem with libgcrypt 1.2.2 on Windows and it's fixed in 1.4.6])],
602 [])],
603 [AC_MSG_RESULT([cross compiling, test skipped])])
604 AC_LANG_POP([C])])
605
606dnl Helper function to shorten the amount of repeated code
607dnl It will create a --with-<lib> option for configure.
608dnl
609dnl CHECK_WITH_LIB(LIBNAME, FUNC, HEADER, DEFINE-SYM)
610dnl LIBNAME is the name of a library without the 'lib' prefix, e.g. 'bluetooth'
611dnl for 'libbluetooth'.
612dnl DEFINE-SYM is a symbol to define using AC_DEFINE; it will be set to 1 if the
613dnl library is available, 0 otherwise.
614dnl
615dnl The variable LIBNAME (that is, the identifier passed as the first argument)
616dnl is kept with the result: 0 if not available, 1 if available.
617dnl For example: CHECK_WITH_LIB(foo, ...) will generate $foo.
618AC_DEFUN([CHECK_WITH_LIB],
619[AC_ARG_WITH([$1],
620 [AS_HELP_STRING([--with-][$1][=PFX], [base of lib][$1][ installation])],
621 [AS_CASE([$withval],
622 [no],
623 [eval "AS_TR_SH([$1])=0"],
624 [yes],
625 [CHECK_LIBHEADER([m4_translit([$1], [a-z], [A-Z])],
626 [$1], [$2], [$3],
627 [eval "AS_TR_SH([$1])=1"],
628 [eval "AS_TR_SH([$1])=0"])],
629 [CHECK_LIBHEADER([m4_translit([$1], [a-z], [A-Z])],
630 [$1], [$2], [$3],
631 [eval "AS_TR_SH([$1])=1"],
632 [eval "AS_TR_SH([$1])=0"],
633 [-L${withval}/lib],
634 [-I${withval}/include])
635 AS_IF([test "x$][AS_TR_SH([$1])][" = "x1"],
636 [EXT_LIB_PATH="-L${withval}/lib $EXT_LIB_PATH"])])],
637 [CHECK_LIBHEADER([m4_translit([$1], [a-z], [A-Z])],
638 [$1], [$2], [$3],
639 [eval "AS_TR_SH([$1])=1"],
640 [eval "AS_TR_SH([$1])=0"])])
641
642 AM_CONDITIONAL([$4], [test "x$][AS_TR_SH([$1])][" = "x1"])
643 AC_DEFINE_UNQUOTED([$4], [$][AS_TR_SH([$1])], [Define to 1 if available])
644])dnl
645
646# check for libbluetooth
647CHECK_WITH_LIB([bluetooth],
648 [ba2str],
649 [bluetooth/bluetooth.h],
650 [HAVE_LIBBLUETOOTH])
651
652# check for libzbar
653CHECK_WITH_LIB([zbar], [zbar_processor_create], [zbar.h], [HAVE_ZBAR])
654
655# check for libpng library
656# this check is for an optional feature of gnunet-qr.
657# the PNG format was chosen mostly arbitrarilyy: while it's true that more
658# modern formats exists that can be used in stead of PNG, it's also true that
659# it's more common for systems to ship with libpng than other codecs; also, a
660# black-or-white picture of squares is one of the cases where PNG shines the
661# most, so the advantages of other formats becomes less important.
662AS_IF([test "x$zbar" = "x1"],
663 [CHECK_WITH_LIB([png], [png_create_read_struct], [png.h], [HAVE_PNG])],
664 [AM_CONDITIONAL([HAVE_PNG], [false])
665 AC_DEFINE([HAVE_PNG], [0], [Define to 1 if libpng is available])])
1006 666
1007AS_IF([test "x$conversation_backend" = "xnone"], 667# check for libpabc
1008 AM_CONDITIONAL(BUILD_CONVERSATION, false), 668CHECK_WITH_LIB([pabc], [pabc_new_ctx], [pabc/pabc.h], [HAVE_PABC])
1009 AM_CONDITIONAL(BUILD_CONVERSATION, true))
1010
1011# libgnurl
1012LIBGNURL_CHECK_CONFIG(,7.34.0,gnurl=1,gnurl=0)
1013
1014SAVE_CPPFLAGS=$CPPFLAGS
1015CPPFLAGS="$LIBGNURL_CPPFLAGS $LIBCURL_CPPFLAGS $CPPFLAGS"
1016LIBS="$LIBGNURL $LIBCURL $LIBS"
1017
1018# libcurl-gnutls
1019LIBCURL_CHECK_CONFIG(,7.34.0,[curl=true],[curl=false])
1020AS_IF([test "x$curl" = xtrue],[
1021 AC_CHECK_HEADER([curl/curl.h],
1022 AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=true],[curl=false],[[#include <curl/curl.h>]]),
1023 [curl=false])
1024 # need libcurl-gnutls.so for proxy, warn later if not found.
1025 AC_CHECK_LIB([curl-gnutls],[curl_easy_getinfo],[curl_gnutls=true],[curl_gnutls=false])
1026 # cURL must support CURLINFO_TLS_SESSION, version >= 7.34
1027])
1028 669
1029# libcurl and libgnurl should be mutually exclusive 670# check for jansson
1030AS_IF([test "$gnurl" = 1], 671CHECK_WITH_LIB([jansson], [json_loads], [jansson.h], [HAVE_JANSSON])
1031 [AM_CONDITIONAL(HAVE_LIBGNURL, true) 672AS_IF([test "x$jansson" = "x0"],
1032 AC_DEFINE([HAVE_LIBGNURL],[1],[Have libgnurl]) 673 [AC_MSG_ERROR([GNUnet requires jansson])])
1033 AM_CONDITIONAL(HAVE_LIBCURL, false)
1034 AC_DEFINE([HAVE_LIBCURL],[0],[Lacking libcurl])],
1035 [AS_IF([test "$curl" = true],
1036 [AM_CONDITIONAL(HAVE_LIBGNURL, false)
1037 AC_DEFINE([HAVE_LIBGNURL],[0],[Lacking libgnurl])
1038 AM_CONDITIONAL(HAVE_LIBCURL, true)
1039 AC_DEFINE([HAVE_LIBCURL],[1],[Have libcurl])],
1040 [AC_MSG_ERROR([GNUnet requires libcurl or gnurl >= 7.34])
1041 AM_CONDITIONAL(HAVE_LIBGNURL, false)
1042 AC_DEFINE([HAVE_LIBGNURL],[0],[Lacking libgnurl])
1043 AM_CONDITIONAL(HAVE_LIBCURL, false)
1044 AC_DEFINE([HAVE_LIBCURL],[0],[Lacking libcurl])])])
1045
1046AC_SEARCH_LIBS(__atomic_load_8, atomic, [have_libatomic=1 AC_DEFINE(HAVE_LIBATOMIC,1,[external libatomic])])
1047AM_CONDITIONAL(HAVE_LIBATOMIC, [test "$have_libatomic" = 1])
1048
1049# restore LIBS & CPPFLAGS
1050LIBS=$SAVE_LIBS
1051CPPFLAGS=$SAVE_CPPFLAGS
1052
1053
1054AC_CHECK_HEADERS([nss.h],[nss=true],[nss=false])
1055AS_IF([test x$nss = xfalse],
1056 [
1057 AM_CONDITIONAL(HAVE_GLIBCNSS, false)
1058 AC_MSG_WARN([No GNU libc nss header, will not build NSS plugin])
1059 ],[
1060 NSS_INCLUDES="
1061 #include <nss.h>
1062 "
1063 AC_CHECK_DECL([NSS_STATUS_UNAVAIL],
1064 [AM_CONDITIONAL(HAVE_GLIBCNSS, true)],
1065 [AM_CONDITIONAL(HAVE_GLIBCNSS, false)
1066 AC_MSG_WARN([No nss header fails to define NSS_STATUS_UNAVAIl, will not build NSS plugin])],
1067 [$NSS_INCLUDES])
1068])
1069 674
675# check for jose
676CHECK_WITH_LIB([jose], [jose_jwk_gen], [jose/jose.h], [HAVE_JOSE])
677AS_IF([test "x$jose" = "x0"],
678 [AC_MSG_WARN([reclaimID OpenID Connect plugin requires jose])])
1070 679
680# check for libpulse (pulseaudio)
681CHECK_WITH_LIB([pulse], [pa_stream_peek], [pulse/simple.h], [HAVE_PULSE])
1071 682
1072# test for kvm and kstat (for CPU stats under BSD/Solaris) 683# check for libopus
1073AC_CHECK_LIB([kvm],[kvm_open]) 684# Note: this might need to be expanded if a more detailed check is needed.
1074AC_CHECK_LIB([kstat],[kstat_open]) 685# For example, before CHECK_WITH_LIB was created, it used to look for
1075 686# "OPUS_SET_GAIN" in libopus
1076libsodium=0 687CHECK_WITH_LIB([opus], [opus_decode_float], [opus/opus.h], [HAVE_OPUS])
1077# test for libsodium >=1.018 (introduction of
1078# crypto_scalarmult_ed25519_base_noclamp API)
1079AC_CHECK_HEADER([sodium.h],
1080 [AC_CHECK_LIB([sodium], [crypto_core_ed25519_scalar_mul],
1081 [libsodium=1])])
1082
1083AS_IF([test x$libsodium = x0],
1084 [AC_MSG_ERROR([GNUnet requires libsodium >= 1.0.18.])])
1085
1086# test for libextractor
1087extractor=0
1088AC_MSG_CHECKING(for libextractor)
1089AC_ARG_WITH(extractor,
1090 [ --with-extractor=PREFIX (base of libextractor installation)],
1091 [AC_MSG_RESULT([$with_extractor])
1092 AS_CASE([$with_extractor],
1093 [no],[],
1094 [yes],[
1095 AC_CHECK_HEADERS([extractor.h],
1096 AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
1097 extractor=1))
1098 ],[
1099 LDFLAGS="-L$with_extractor/lib $LDFLAGS"
1100 CPPFLAGS="-I$with_extractor/include $CPPFLAGS"
1101 AC_CHECK_HEADERS([extractor.h],
1102 AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
1103 EXT_LIB_PATH="-L$with_extractor/lib $EXT_LIB_PATH"
1104 extractor=1))
1105 ])
1106 ],
1107 [AC_MSG_RESULT([--with-extractor not specified])
1108 AC_CHECK_HEADERS([extractor.h],
1109 AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
1110 extractor=1))])
1111# restore LIBS
1112LIBS=$SAVE_LIBS
1113 688
1114AS_IF([test "$extractor" != 1], 689# check for libogg
1115 [ 690CHECK_WITH_LIB([ogg], [ogg_stream_flush_fill], [ogg/ogg.h], [HAVE_OGG])
1116 AM_CONDITIONAL(HAVE_LIBEXTRACTOR, false)
1117 AC_DEFINE([HAVE_LIBEXTRACTOR],[0],[Lacking libextractor])
1118 ],[
1119 AM_CONDITIONAL(HAVE_LIBEXTRACTOR, true)
1120 AC_DEFINE([HAVE_LIBEXTRACTOR],[1],[Have libextractor])
1121 ])
1122
1123
1124# Check for libltdl header (#2999)
1125ltdl=0
1126AC_MSG_CHECKING(for libltdl)
1127AC_ARG_WITH(ltdl,
1128 [AS_HELP_STRING([--with-ltdl=PREFIX],[base of libltdl installation])],
1129 [AC_MSG_RESULT([$with_ltdl])
1130 AS_CASE([$with_ltdl],
1131 [no],[],
1132 [yes],[
1133 AC_CHECK_HEADERS(ltdl.h,
1134 AC_CHECK_LIB([ltdl], [lt_dlopenext],
1135 ltdl=1))
1136 ],[
1137 LDFLAGS="-L$with_ltdl/lib $LDFLAGS"
1138 CPPFLAGS="-I$with_ltdl/include $CPPFLAGS"
1139 AC_CHECK_HEADERS(ltdl.h,
1140 AC_CHECK_LIB([ltdl], [lt_dlopenext],
1141 EXT_LIB_PATH="-L$with_ltdl/lib $EXT_LIB_PATH"
1142 ltdl=1))
1143 ])
1144 ],
1145 [AC_MSG_RESULT([--with-ltdl not specified])
1146 AC_CHECK_HEADERS(ltdl.h,
1147 AC_CHECK_LIB([ltdl], [lt_dlopenext],
1148 ltdl=1))])
1149AS_IF([test x$ltdl = x1],
1150[
1151 AC_MSG_RESULT([libltdl found])
1152],[
1153 AC_MSG_ERROR([GNUnet requires libltdl (from GNU libtool).])
1154])
1155# restore LIBS
1156LIBS=$SAVE_LIBS
1157 691
1158# libidn and libidn2. The ideal goal is this: 692PKG_CHECK_MODULES([GST],
1159# check for libidn2, if it doesn't exist check for libidn 693 [glib-2.0 gobject-2.0 gstreamer-1.0 gstreamer-app-1.0 gstreamer-audio-1.0],
1160# if both exist, prefer libidn2 694 [gst=1],
1161# if none exist, fail and message that libidn or libidn2 695 [gst=0])
1162# is required with a preference for libidn2.
1163# TODO: What we have right here can probably be improved.
1164AC_MSG_CHECKING(for idn or idn2)
1165
1166AC_MSG_CHECKING(for idn)
1167my_with_libidn=1
1168AC_ARG_WITH(libidn,
1169 AS_HELP_STRING([--with-libidn=pathname],
1170 [Support IDN (needs libidn)]),
1171 [],
1172 [withval="yes"])
1173AS_IF([test x_$withval = x_yes],
1174 [AC_CHECK_HEADERS([idna.h],
1175 AC_MSG_NOTICE([Found idna.h]),
1176 AC_CHECK_HEADERS([idn/idna.h],
1177 AC_MSG_NOTICE([Found idn/idna.h]),
1178 my_with_libidn=0))],
1179 [AS_IF([test x_$withval != x_no],
1180 [CFLAGS="$CFLAGS -I$withval/include"
1181 LDFLAGS="$LDFLAGS -L$withval/lib"
1182 AC_CHECK_HEADERS([idna.h],
1183 AC_MSG_NOTICE([Found idna.h]),
1184 [AC_MSG_NOTICE([Failed to find idna.h])
1185 my_with_libidn=0])],
1186 [my_with_libidn=0])])
1187
1188AC_MSG_CHECKING(for idn2)
1189my_with_libidn2=1
1190AC_ARG_WITH(libidn2,
1191 AS_HELP_STRING([--with-libidn2=pathname],
1192 [Support IDN (needs libidn2)]),
1193 [],
1194 [withval="yes"])
1195AS_IF([test x_$withval = x_yes],
1196 [AC_CHECK_HEADERS([idn2.h],
1197 AC_MSG_NOTICE([Found idn2.h]),
1198 AC_CHECK_HEADERS([idn2/idn2.h],
1199 AC_MSG_NOTICE([Found idn2/idn2.h]),
1200 [AC_MSG_NOTICE([Failed to find idn2.h])
1201 my_with_libidn2=0]))],
1202 [AS_IF([test x_$withval != x_no],
1203 [CFLAGS="$CFLAGS -I$withval/include"
1204 LDFLAGS="$LDFLAGS -L$withval/lib"
1205 AC_CHECK_HEADERS([idn2/idn2.h],
1206 AC_MSG_NOTICE([Found idn2/idn2.h]),
1207 [AC_MSG_NOTICE([Failed to find idn2.h])
1208 my_with_libidn2=0])],
1209 [my_with_libidn2=0])])
1210
1211AC_MSG_CHECKING([if libidn can be used])
1212# Check for LIBIDNs
1213there_can_only_be_one=1
1214
1215working_libidn1=0
1216working_libidn2=0
1217AS_IF([test x$my_with_libidn2 = x1],
1218 [AC_MSG_NOTICE([Checking for libidn2])
1219 AC_CHECK_LIB([idn2],
1220 [idn2_to_unicode_8z8z],
1221 [working_libidn2=1
1222 LIBS="-lidn2 $LIBS"
1223 AC_DEFINE_UNQUOTED([HAVE_LIBIDN2],
1224 [1],
1225 [Define to 1 if you have 'libidn2' (-lidn2).])],
1226 [MISSING_DEPS="${MISSING_DEPS}${MISSING_SEP}libidn2"
1227 MISSING_SEP=", "])])
1228AM_CONDITIONAL(HAVE_LIBIDN2, test x$working_libidn2 = x1)
1229AS_IF([test x$working_libidn2 = x0],
1230 [AS_IF([test x$my_with_libidn = x1],
1231 [AC_MSG_NOTICE([Checking for libidn])
1232 AC_CHECK_LIB([idn],
1233 [idna_to_ascii_8z],
1234 [working_libidn1=1
1235 LIBS="-lidn $LIBS"
1236 AC_DEFINE_UNQUOTED([HAVE_LIBIDN],
1237 [1],
1238 [Define to 1 if you have 'libidn' (-lidn).])],
1239 [there_can_only_be_one=0])],
1240 [AS_IF([test x$my_with_libidn2 = x1],
1241 [there_can_only_be_one=0
1242 AC_MSG_FAILURE([* There can only be one libidn.
1243 * Provide either libidn >= 1.13
1244 * or
1245 * libidn2 to the configure
1246 * script via
1247 * --with-libidn2
1248 * --with-libidn])])])])
1249AM_CONDITIONAL(HAVE_LIBIDN, test x$working_libidn1 = x1)
1250
1251AS_IF([test "$working_libidn1" = 0 -a "$working_libidn2" = 0],
1252 [AC_MSG_ERROR([GNUnet requires libidn (or libidn2)])])
1253
1254AS_IF([test x$there_can_only_be_one = x0],
1255 [AC_MSG_FAILURE([Missing dependencies: $MISSING_DEPS])])
1256
1257# test for zlib
1258SAVE_LDFLAGS=$LDFLAGS
1259SAVE_CPPFLAGS=$CPPFLAGS
1260AC_ARG_WITH(zlib,
1261 [ --with-zlib[[=DIR]] use libz in DIR],
1262 [AS_IF([test "$withval" = "no"],
1263 [AC_MSG_ERROR([GNUnet requires zlib])],
1264 [test "$withval" != "yes"],
1265 [Z_DIR=$withval
1266 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1267 LDFLAGS="${LDFLAGS} -L$withval/lib"])])
1268AC_CHECK_HEADER(zlib.h,
1269 [],
1270 [AC_MSG_ERROR([GNUnet requires zlib])])
1271AC_CHECK_LIB(z,
1272 compress2,
1273 [AC_DEFINE([HAVE_ZLIB],
1274 [],
1275 [Have compression library])
1276 if test "x${Z_DIR}" != "x"; then
1277 Z_CFLAGS="-I${Z_DIR}/include"
1278 Z_LIBS="-L${Z_DIR}/lib -lz"
1279 else
1280 Z_LIBS="-lz"
1281 fi],
1282 [AC_MSG_ERROR([GNUnet requires zlib])])
1283AC_SUBST(Z_CFLAGS)
1284AC_SUBST(Z_LIBS)
1285
1286AS_IF([test "$enable_shared" = "no"],
1287 [AC_MSG_ERROR([GNUnet only works with shared libraries. Sorry.])])
1288 696
697# check if conversation can be built and how
698AC_MSG_CHECKING([for conversation feature set to build])
699AS_IF([test "x$pulse" != "x1" || test "x$opus" != "x1" || test "x$ogg" != "x1"],
700 [AS_IF([test "x$gst" != "x1"],
701 [conversation_backend="none"
702 AM_CONDITIONAL([BUILD_PULSE_HELPERS], [false])
703 AM_CONDITIONAL([BUILD_GST_HELPERS], [false])
704 AM_CONDITIONAL([BUILD_EXPERIMENTAL_HELPERS], [false])],
705 [conversation_backend="gst"
706 AM_CONDITIONAL([BUILD_PULSE_HELPERS], [false])
707 AM_CONDITIONAL([BUILD_GST_HELPERS], [true])
708 AM_CONDITIONAL([BUILD_EXPERIMENTAL_HELPERS], [false])])],
709 [conversation_backend="pulse"
710 AM_CONDITIONAL([BUILD_PULSE_HELPERS], [true])
711 AM_CONDITIONAL([BUILD_GST_HELPERS], [false])
712 AM_CONDITIONAL([BUILD_EXPERIMENTAL_HELPERS], [false])])
713
714AM_CONDITIONAL([BUILD_CONVERSATION], [test "x$conversation_backend" != "xnone"])
715AC_MSG_RESULT([$conversation_backend])
716
717# NOTE: If we find libcurl-gnutls here we set LIBCURL to -lcurl-gnutls
718# This affects the LIBCURL_CHECK_CONFIG call below as it takes LIBCURL into
719# account when checking for curl.
720LIBCURL="-lcurl"
721AC_CHECK_LIB([curl-gnutls],
722 [curl_easy_getinfo],
723 [LIBCURL="-lcurl-gnutls"])
724
725LIBCURL_CHECK_CONFIG([], [7.85.0], [],
726 [AC_MSG_ERROR([cURL must have a version >= 7.85.0])])
727
728OLD_LIBS=$LIBS
729LIBS="$LIBS $LIBCURL"
730AC_RUN_IFELSE(
731 [AC_LANG_PROGRAM([[#include <curl/curl.h>]],
732 [[return (CURLSSLSET_OK != curl_global_sslset(CURLSSLBACKEND_GNUTLS, NULL, NULL));]])],
733 [curl_gnutls=1],
734 [AC_MSG_WARN([cURL does not have GnuTLS backend])
735 curl_gnutls=0])
736LIBS=$OLD_LIBS
737AM_CONDITIONAL([HAVE_GNUTLS_CURL], [test "x$curl_gnutls" = "x1"])
738AC_SUBST([curl_gnutls])
739
740# Even if curl is found, we check for this constant in order to determine
741# if we can use this feature.
742AC_CHECK_HEADER([curl/curl.h],
743 [AC_CHECK_DECLS([CURLINFO_TLS_SSL_PTR],
744 [],
745 [AC_MSG_ERROR([cURL must support CURLINFO_TLS_SSL_PTR])],
746 [[#include <curl/curl.h>]])])
747# libatomic
748AC_SEARCH_LIBS([__atomic_load_8], [atomic],
749 [have_libatomic=1
750 AC_DEFINE([HAVE_LIBATOMIC], [1],
751 [Define to 1 if libatomic is external])])
752AM_CONDITIONAL([HAVE_LIBATOMIC], [test "x$have_libatomic" = "x1"])
753
754# check for nss
755AC_CHECK_HEADERS([nss.h], [nss=true], [nss=false])
756AS_IF([test "x$nss" = "xfalse"],
757 [AM_CONDITIONAL([HAVE_GLIBCNSS], [false])
758 AC_MSG_WARN([NSS plugin will not be build])],
759 [AC_CHECK_DECL([NSS_STATUS_UNAVAIL],
760 [AM_CONDITIONAL([HAVE_GLIBCNSS], [true])],
761 [AM_CONDITIONAL([HAVE_GLIBCNSS], [false])
762 AC_MSG_WARN([NSS plugin will not be built])],
763 [[#include <nss.h>]])])
1289 764
1290# restore LIBS 765# test for kvm and kstat (for CPU stats under BSD/Solaris)
1291LIBS=$SAVE_LIBS 766AC_CHECK_LIB([kvm], [kvm_open])
767AC_CHECK_LIB([kstat], [kstat_open])
1292 768
769# check for libsodium version >= 1.0.18
770libsodium=0
771CHECK_WITH_LIB([sodium], [crypto_core_ed25519_scalar_mul], [sodium.h], [HAVE_SODIUM])
772AS_IF([test "x$sodium" = "x0"],
773 [AC_MSG_ERROR([GNUnet requires libsodium >= 1.0.18])])
774
775# check for libextractor
776CHECK_WITH_LIB([extractor],
777 [EXTRACTOR_plugin_add_defaults],
778 [extractor.h],
779 [HAVE_LIBEXTRACTOR])
780AS_IF([test "x$extractor" = "x0"],
781 [AC_MSG_RESULT([GNU libextractor not found, some features disabled])])
782
783# check for cloudflare-quiche
784CHECK_WITH_LIB([quiche],
785 [quiche_header_info],
786 [quiche.h],
787 [HAVE_QUICHE])
788AS_IF([test "x$quiche" = "x0"],
789 [AC_MSG_RESULT([cloudflare-quiche not found, some features disabled])])
790
791# check for libltdl
792CHECK_WITH_LIB([ltdl], [lt_dlopenext], [ltdl.h], [HAVE_LTDL])
793AS_IF([test "x$ldtl" = "x0"],
794 [AC_MSG_RESULT([libltdl (from GNU libtool) is required])])
795
796# check for libidn, first version 2 and if not found, version 1
797# if both are missing throw an error as libidn is required
798AC_ARG_WITH([libidn],
799 [AS_HELP_STRING([--with-libidn=PFX], [base of libidn/libidn2 installation])],
800 [libidn=${withval}],
801 [libidn=yes])
802
803AS_IF([test "x$libidn" = "xno"],
804 [AC_MSG_ERROR([GNUnet requires libidn or libidn2])])
805
806AS_IF([test "x$libidn" = "xyes"],
807 [AC_CHECK_HEADERS([idn2.h],
808 [libidn_version="2"],
809 [AC_CHECK_HEADERS([idn2/idn2.h],
810 [libidn_version="2"],
811 [libidn_version="0"])])],
812 [LDFLAGS="-L$libidn/lib $LDFLAGS"
813 CPPFLAGS="-I$libidn/include $CPPFLAGS"
814 AC_CHECK_HEADERS([idn2.h],
815 [libidn_version="2"],
816 [AC_CHECK_HEADERS([idn2/idn2.h],
817 [libidn_version="2"],
818 [libidn_version="0"])])])
819
820AS_IF([test "x$libidn_version" = "x0"],
821 [AS_IF([test "x$libidn" = "xyes"],
822 [AC_CHECK_HEADERS([idna.h],
823 [libidn_version="1"],
824 [AC_CHECK_HEADERS([idn/idna.h],
825 [libidn_version="1"]
826 [libidn_version="2"])])],
827 [LDFLAGS="-L$libidn/lib $LDFLAGS"
828 CPPFLAGS="-I$libidn/include $CPPFLAGS"
829 AC_CHECK_HEADERS([idna.h],
830 [libidn_version="2"],
831 [AC_CHECK_HEADERS([idn/idna.h],
832 [libidn_version="2"],
833 [libidn_version="0"])])])])
834
835AS_IF([test "x$libidn_version" = "x0"],
836 [AC_MSG_ERROR([GNUnet requires libidn or libidn2])])
837
838AS_IF([test "x$libidn_version" = "x2"],
839 [AC_CHECK_LIB([idn2], [idn2_to_unicode_8z8z], [libidn_ok=yes], [libidn_ok=no])],
840 [AC_CHECK_LIB([idn], [idna_to_ascii_8z], [libidn_ok=yes], [libidn_ok=no])])
841
842AS_IF([test "x$libidn_ok" = "xno"],
843 [AC_MSG_ERROR([GNUnet requires libidn or libidn2])])
844
845AM_CONDITIONAL([HAVE_LIBIDN], [test "x$libidn_version" = "x1"])
846AM_CONDITIONAL([HAVE_LIBIDN2], [test "x$libidn_version" = "x2"])
847AS_IF([test "x$libidn_version" = "x2"],
848 [AC_DEFINE([HAVE_LIBIDN2], [1], [Define to 1 if libidn2 is available])],
849 [AC_DEFINE([HAVE_LIBIDN], [1], [Define to 1 if libidn is available])])
850
851# check for zlib
852AC_ARG_WITH([zlib],
853 [AS_HELP_STRING([--with-zlib=PFX], [base of zlib installation])],
854 [zlib=${withval}],
855 [zlib=yes])
856
857AS_IF([test "x$zlib" = "xno"], [AC_MSG_ERROR([GNUnet requires zlib])])
858
859AS_IF([test "x$zlib" = "xyes"],
860 [AC_CHECK_HEADER([zlib.h],
861 [AC_CHECK_LIB([z], [compress2], [zlib_ok=1], [zlib_ok=0])],
862 [zlib_ok=0])],
863 [LDFLAGS="-L$zlib/lib $LDFLAGS"
864 CPPFLAGS="-I$zlib/include $CPPFLAGS"
865 AC_CHECK_HEADER([zlib.h],
866 [AC_CHECK_LIB([z], [compress2], [zlib_ok=1], [zlib_ok=0])],
867 [zlib_ok=0])])
868
869AS_IF([test "x$zlib_ok" = "x0"], [AC_MSG_ERROR([GNUnet requires zlib])])
870AS_IF([test "x$zlib" = "xyes"],
871 [Z_CFLAGS=""
872 Z_LIBS="-lz"],
873 [Z_CFLAGS="-I${zlib}/include"
874 Z_LIBS="-L${zlib}/lib -lz"])
875AC_SUBST([Z_CFLAGS])
876AC_SUBST([Z_LIBS])
877
878AM_CONDITIONAL([HAVE_ZLIB], [test "x$zlib_ok" = "x1"])
879AC_DEFINE_UNQUOTED([HAVE_ZLIB], [$zlib_ok], [Define to 1 if zlib is available])
1293 880
1294# check for iconv 881# check for iconv
1295AM_ICONV 882AM_ICONV
1296 883
1297# test for libunistring 884# check for libunistring
1298gl_LIBUNISTRING 885CHECK_WITH_LIB([unistring], [u16_strstr], [unistr.h], [HAVE_UNISTRING])
1299AS_IF([test $HAVE_LIBUNISTRING != yes], 886AS_IF([test "x$unistring" = "x0"],
1300 [AC_MSG_ERROR([GNUnet requires libunistring])]) 887 [AC_MSG_ERROR([GNUnet requires unistring])])
1301 888
1302# Currently broken on Debian :-( 889# Currently broken on Debian :-(
1303#AS_VERSION_COMPARE([$LIBUNISTRING_VERSION],[0.9.1.1], 890# AS_VERSION_COMPARE([$LIBUNISTRING_VERSION], [0.9.1.1],
1304# [AC_MSG_ERROR([GNUnet requires libunistring >= 0.9.1.1, found $LIBUNISTRING_VERSION])]) 891# [AC_MSG_ERROR([GNUnet requires libunistring >= 0.9.1.1, found $LIBUNISTRING_VERSION])],
1305 892# [AC_MSG_ERROR([GNUnet requires libunistring >= 0.9.1.1, found $LIBUNISTRING_VERSION])])
1306AC_CHECK_HEADERS([unistr.h], 893
1307 , 894# check for sqlite
1308 AC_MSG_ERROR([Compiling GNUnet requires unistr.h (from libunistring) to be installed])) 895CHECK_WITH_LIB([sqlite3], [sqlite3_open], [sqlite3.h], [HAVE_SQLITE])
896
897# check for postgres
898AX_LIB_POSTGRESQL([12.0], [postgres=1], [postgres=0])
899AS_IF([test "x$postgres" = "x1"],
900 [SAVE_CPPFLAGS="$CPPFLAGS"
901 CPPFLAGS="$POSTGRES_CPPFLAGS $CPPFLAGS"
902 AC_CHECK_HEADERS([libpq-fe.h], [postgres=1], [postgres=0])])
903AM_CONDITIONAL([HAVE_POSTGRESQL], [test "x$postgres" = "x1"])
904AC_DEFINE_UNQUOTED([HAVE_POSTGRESQL], [$postgres],
905 [Define to 1 if Postgres is available])
906
907CPPFLAGS="$SAVE_CPPFLAGS"
908
909# check for libmicrohttpd
910AC_ARG_WITH([microhttpd],
911 [AS_HELP_STRING([--with-microhttpd=PFX],
912 [base of libmicrohttpd installation])],
913 [SAVE_PKG_PATH="$PKG_CONFIG_PATH"
914 PKG_CONFIG_PATH="${withval}/lib/pkgconfig"
915 export PKG_CONFIG_PATH
916 PKG_CHECK_MODULES([MHD], [libmicrohttpd >= 0.9.63], [libmhd=1], [libmhd=0])
917 PKG_CONFIG_PATH="$SAVE_PKG_PATH"],
918 [PKG_CHECK_MODULES([MHD], [libmicrohttpd >= 0.9.63], [libmhd=1], [libmhd=0])])
919
920AS_IF([test "x$libmhd" = "x0"],
921 [AC_MSG_ERROR([GNUnet requires libmicrohttpd >= 0.9.63])])
922
923AM_CONDITIONAL([HAVE_MHD], [test "x$libmhd" = "x1"])
924AC_DEFINE_UNQUOTED([HAVE_MHD], [$libmhd],
925 [Define to 1 if libmicrohttpd is available])
926AM_CONDITIONAL([HAVE_REST], [true])
927
928# check for gnutls
929AC_ARG_WITH([gnutls],
930 [AS_HELP_STRING([--with-gnutls=PFX], [base of gnutls installation])],
931 [AS_CASE([$with_gnutls],
932 [no],
933 [gnutls=0],
934 [yes],
935 [AC_CHECK_HEADERS([gnutls/abstract.h],
936 [AC_CHECK_LIB([gnutls], [gnutls_priority_set],
937 [gnutls=1], [gnutls=0])],
938 [gnutls=0])
939 AC_CHECK_HEADERS([gnutls/dane.h],
940 [AC_CHECK_LIB([gnutls-dane], [dane_verify_crt_raw],
941 [gnutls_dane=1], [gnutls_dane=0])],
942 [gnutls_dane=0])],
943 [LDFLAGS="-L$with_gnutls/lib $LDFLAGS"
944 CPPFLAGS="-I$with_gnutls/include $CPPFLAGS"
945 AC_CHECK_HEADERS([gnutls/abstract.h],
946 [AC_CHECK_LIB([gnutls], [gnutls_priority_set],
947 [gnutls=1], [gnutls=0])],
948 [gnutls=0])
949 AC_CHECK_HEADERS([gnutls/dane.h],
950 [AC_CHECK_LIB([gnutls-dane], [dane_verify_crt_raw],
951 [gnutls_dane=1], [gnutls_dane=0])],
952 [gnutls_dane=0])])],
953 [AC_CHECK_HEADERS([gnutls/abstract.h],
954 [AC_CHECK_LIB([gnutls], [gnutls_priority_set],
955 [gnutls=1], [gnutls=0])],
956 [gnutls=0])
957 AC_CHECK_HEADERS([gnutls/dane.h],
958 [AC_CHECK_LIB([gnutls-dane], [dane_verify_crt_raw],
959 [gnutls_dane=1], [gnutls_dane=0])],
960 [gnutls_dane=0])])
961AM_CONDITIONAL([HAVE_GNUTLS], [test "x$gnutls" = "x1"])
962AM_CONDITIONAL([HAVE_GNUTLS_DANE], [test "x$gnutls_dane" = "x1"])
963AC_DEFINE_UNQUOTED([HAVE_GNUTLS], [$gnutls], [Define to 1 if GnuTLS is available])
964AC_DEFINE_UNQUOTED([HAVE_GNUTLS_DANE], [$gnutls_dane],
965 [Define to 1 if GnuTLS has DANE support])
1309 966
1310# restore LIBS 967# restore LIBS
1311LIBS=$SAVE_LIBS 968LIBS=$SAVE_LIBS
1312 969
1313 970# Check for standard header files.
1314
1315# Checks for standard header files.
1316AC_HEADER_DIRENT 971AC_HEADER_DIRENT
1317 972
1318# Check for headers that are ALWAYS required 973# Check for headers that are ALWAYS required
1319AC_CHECK_HEADERS([fcntl.h math.h errno.h ctype.h limits.h stdio.h stdlib.h string.h unistd.h stdarg.h signal.h locale.h sys/stat.h sys/types.h],,AC_MSG_ERROR([Compiling GNUnet requires standard UNIX headers files: fcntl.h math.h errno.h ctype.h limits.h stdio.h stdlib.h string.h unistd.h stdarg.h signal.h locale.h sys/stat.h sys/types.h])) 974# It's assumed that AC_INCLUDES_DEFAULT has been executed already, as that
1320 975# makes sure the most common headers (e.g. stdlib.h) are available
1321 976AC_CHECK_HEADERS([fcntl.h math.h errno.h ctype.h limits.h stdarg.h signal.h locale.h],
1322 977 [],
1323# Checks for headers that are only required on some systems or 978 [AC_MSG_ERROR([Compiling GNUnet requires standard UNIX header files])])
1324# opional (and where we do NOT abort if they are not there) 979
1325AC_CHECK_HEADERS([stdatomic.h malloc.h malloc/malloc.h malloc/malloc_np.h langinfo.h sys/param.h sys/mount.h sys/statvfs.h sys/select.h sockLib.h sys/mman.h sys/msg.h sys/vfs.h arpa/inet.h fcntl.h libintl.h netdb.h netinet/in.h sys/ioctl.h sys/socket.h sys/time.h unistd.h kstat.h sys/sysinfo.h kvm.h sys/file.h sys/resource.h ifaddrs.h mach/mach.h stddef.h sys/timeb.h argz.h ucred.h sys/ucred.h endian.h sys/endian.h execinfo.h byteswap.h]) 980# Check for headers required only on some systems or which are optional
1326 981AC_CHECK_HEADERS([stdatomic.h malloc.h malloc/malloc.h malloc/malloc_np.h langinfo.h sys/param.h sys/mount.h sys/statvfs.h sys/select.h sockLib.h sys/mman.h sys/msg.h sys/vfs.h arpa/inet.h libintl.h netdb.h netinet/in.h sys/ioctl.h sys/socket.h sys/time.h sys/sysinfo.h sys/file.h sys/resource.h ifaddrs.h mach/mach.h sys/timeb.h argz.h ucred.h sys/ucred.h endian.h sys/endian.h execinfo.h byteswap.h])
1327# FreeBSD requires this for netinet/in_systm.h and netinet/ip.h 982
1328AC_CHECK_HEADERS([sys/types.h netinet/in_systm.h netinet/in.h netinet/ip.h],,, 983# Required for FreeBSD's netinet/in_systm.h and netinet/ip.h
1329[#ifdef HAVE_SYS_TYPES_H 984AS_IF([test "x$build_target" = "xfreebsd"],
1330#include <sys/types.h> 985 [AC_CHECK_HEADERS([sys/types.h netinet/in_systm.h netinet/in.h, netinet/ip.h],
986 [], [],
987 [#ifdef HAVE_SYS_TYPES_H
988#include <sys/type.h>
1331#endif 989#endif
1332#ifdef HAVE_NETINET_IN_SYSTM_H 990#ifdef HAVE_NETINET_IN_SYSTM_H
1333#include <netinet/in_systm.h> 991#include <netinet/in_systm.h>
@@ -1335,574 +993,229 @@ AC_CHECK_HEADERS([sys/types.h netinet/in_systm.h netinet/in.h netinet/ip.h],,,
1335#ifdef HAVE_NETINET_IN_H 993#ifdef HAVE_NETINET_IN_H
1336#include <netinet/in.h> 994#include <netinet/in.h>
1337#endif 995#endif
1338]) 996])])
1339
1340SAVE_LDFLAGS=$LDFLAGS
1341SAVE_CPPFLAGS=$CPPFLAGS
1342
1343# test for sqlite
1344sqlite=false
1345AC_MSG_CHECKING(for SQLite)
1346AC_ARG_WITH(sqlite,
1347 [ --with-sqlite=PFX base of SQLite installation],
1348 [AC_MSG_RESULT("$with_sqlite")
1349 AS_CASE([$with_sqlite],
1350 [no],[],
1351 [yes],[
1352 AC_CHECK_HEADERS(sqlite3.h,
1353 sqlite=true)],
1354 [
1355 LDFLAGS="-L$with_sqlite/lib $LDFLAGS"
1356 CPPFLAGS="-I$with_sqlite/include $CPPFLAGS"
1357 AC_CHECK_HEADERS(sqlite3.h,
1358 EXT_LIB_PATH="-L$with_sqlite/lib $EXT_LIB_PATH"
1359 SQLITE_LDFLAGS="-L$with_sqlite/lib"
1360 SQLITE_CPPFLAGS="-I$with_sqlite/include"
1361 sqlite=true)
1362 LDFLAGS=$SAVE_LDFLAGS
1363 CPPFLAGS=$SAVE_CPPFLAGS
1364 ])
1365 ],
1366 [AC_MSG_RESULT([--with-sqlite not specified])
1367 AC_CHECK_HEADERS(sqlite3.h, sqlite=true)])
1368AM_CONDITIONAL(HAVE_SQLITE, test x$sqlite = xtrue)
1369AC_SUBST(SQLITE_CPPFLAGS)
1370AC_SUBST(SQLITE_LDFLAGS)
1371
1372LDFLAGS=$SAVE_LDFLAGS
1373CPPFLAGS=$SAVE_CPPFLAGS
1374
1375# test for postgres:
1376postgres=false
1377AX_LIB_POSTGRESQL([12.0],
1378 [CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS"
1379 AC_CHECK_HEADERS([libpq-fe.h],
1380 postgres=true)
1381 ],
1382 [AC_MSG_RESULT([no postgres])])
1383
1384AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue)
1385AS_IF([test "x$postgres" = xtrue],
1386 [AC_DEFINE([HAVE_POSTGRESQL],[1],[Have PostgreSQL])],
1387 [AC_DEFINE([HAVE_POSTGRESQL],[0],[Lacking PostgreSQL])])
1388
1389LDFLAGS=$SAVE_LDFLAGS
1390CPPFLAGS=$SAVE_CPPFLAGS
1391
1392# mysql & windows
1393AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
1394AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
1395
1396# test for mysql
1397mysql=false
1398mysqlfail=false
1399SAVE_LDFLAGS=$LDFLAGS
1400SAVE_CPPFLAGS=$CPPFLAGS
1401AC_MSG_CHECKING(for mysql)
1402AC_ARG_WITH(mysql,
1403 [ --with-mysql=PFX base of MySQL installation],
1404 [AC_MSG_RESULT([$with_mysql])
1405 AS_CASE([$with_mysql],
1406 [no],[],
1407 [yes|""],[
1408 AC_CHECK_HEADERS(mysql/mysql.h,
1409 AC_CHECK_LIB(mysqlclient, mysql_init,
1410 mysql=true), [], [])
1411 ],[
1412 LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql $LDFLAGS $ZLIBS"
1413 CPPFLAGS="-I$with_mysql/include $CPPFLAGS"
1414 AC_CHECK_HEADERS(mysql/mysql.h,
1415 AC_CHECK_LIB(mysqlclient, mysql_init,
1416 MYSQL_LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql"
1417 MYSQL_CPPFLAGS="-I$with_mysql/include"
1418
1419 mysql=true), [], [])
1420 ])
1421 ],
1422 [AC_MSG_RESULT([--with-mysql not specified])
1423 if test -d "/usr/lib64/mysql"; then
1424 MYSQL_LIBDIR="/usr/lib64/mysql"
1425 elif test -d "/usr/lib/mysql"; then
1426 MYSQL_LIBDIR="/usr/lib/mysql"
1427 else
1428 MYSQL_LIBDIR="/usr/lib"
1429 fi
1430 LDFLAGS="-L$MYSQL_LIBDIR $LDFLAGS $ZLIBS"
1431 AC_CHECK_LIB(mysqlclient, mysql_init,
1432 [AC_CHECK_HEADERS(mysql/mysql.h,
1433 MYSQL_LDFLAGS="-L$MYSQL_LIBDIR"
1434 mysql=true
1435
1436 , [], [])])
1437 ])
1438
1439AC_SUBST(MYSQL_LDFLAGS)
1440AC_SUBST(MYSQL_CPPFLAGS)
1441
1442# additional version check for mysql
1443AC_ARG_ENABLE(mysql-version-check, [ --disable-mysql-version-check do not check MySQL version],, enable_mysql_version_check=yes)
1444AS_IF([test "$mysql" = "true" -a "x$enable_mysql_version_check" = "xyes"],
1445 [
1446 AC_MSG_CHECKING(mysql version)
1447 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1448 [[
1449 #include <mysql/mysql_version.h>]],
1450 [[
1451 #if (MYSQL_VERSION_ID < 40100)
1452 #error needs at least version >= 4.1
1453 #endif
1454 ]])
1455 ],
1456 [mysql=true],
1457 [mysql=false])
1458 AS_IF([test x$mysql = xfalse],
1459 [
1460 mysqlfail=true
1461 AC_MSG_WARN([fail, MySQL >= 4.1 required])
1462 ],[
1463 AC_MSG_NOTICE([success, will keep $mysqlfail])
1464 mysqlfail=false
1465 AC_MSG_RESULT(ok)
1466 ])
1467 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1468 [[
1469 #include <mysql/mysql_version.h>]],
1470 [[
1471 #if (MYSQL_VERSION_ID < 80000)
1472 #error needs at least version >= 4.1
1473 #endif
1474 ]])
1475 ],
1476 [mysql8=true],
1477 [mysql8=false])
1478 AS_IF([test x$mysql8 = xtrue],
1479 [
1480 AC_DEFINE([HAVE_MYSQL8],[1],[Have mysql8])
1481 ],[])
1482])
1483
1484AM_CONDITIONAL(HAVE_MYSQL, test x$mysql = xtrue)
1485AM_CONDITIONAL(HAVE_MYSQLE, false)
1486# restore LIBS
1487LIBS=$SAVE_LIBS
1488LDFLAGS=$SAVE_LDFLAGS
1489CPPFLAGS=$SAVE_CPPFLAGS
1490
1491# TODO: should this test for "or" not "and"?
1492# TODO: Add postgres?
1493AS_IF([test "$sqlite" = 0 -a "$mysql" = 0],
1494[
1495 AC_MSG_ERROR([GNUnet requires SQLite or MySQL / MariaDB.])
1496])
1497
1498# libmicrohttpd
1499lmhd=0
1500m4_define([MHD_MODULE], [libmicrohttpd >= 0.9.63])
1501AC_ARG_WITH(microhttpd,
1502 [AS_HELP_STRING([--with-microhttpd[[=PFX]]],
1503 [base of libmicrohttpd installation])],
1504 [],
1505 [with_microhttpd=check])
1506AS_CASE([$with_microhttpd],
1507 [no], [],
1508 [yes], [PKG_CHECK_MODULES([MHD], [MHD_MODULE], [lmhd=1])],
1509 [check], [PKG_CHECK_MODULES([MHD], [MHD_MODULE],
1510 [lmhd=1],
1511 [AC_MSG_WARN([Building without libmicrohttpd])])],
1512 [SAVE_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
1513 PKG_CONFIG_PATH=$with_microhttpd/lib/pkgconfig
1514 export PKG_CONFIG_PATH
1515 PKG_CHECK_MODULES([MHD], [MHD_MODULE], [lmhd=1])
1516 PKG_CONFIG_PATH=$SAVE_PKG_CONFIG_PATH])
1517AM_CONDITIONAL(HAVE_MHD, test x$lmhd = x1)
1518AC_DEFINE_UNQUOTED([HAVE_MHD], $lmhd, [We have libmicrohttpd])
1519
1520AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1])
1521AM_CONDITIONAL(HAVE_REST, [test x$jansson = x1 -a x$lmhd = x1])
1522AS_IF([test "x$lmhd" != "x1"],
1523 [AC_MSG_ERROR([GNUnet requires libmicrohttpd >= 0.9.63.])])
1524
1525
1526# restore LIBS
1527LIBS=$SAVE_LIBS
1528 997
1529# check for gettext 998# check for gettext
1530AM_GNU_GETTEXT([external]) 999AM_GNU_GETTEXT([external])
1531AM_GNU_GETTEXT_VERSION([0.18.1]) 1000AM_GNU_GETTEXT_VERSION([0.18.1])
1532 1001
1533# Checks for standard typedefs, structures, and compiler characteristics. 1002# check for stantard typedefs, structures and compiler characteristics
1534AC_TYPE_PID_T 1003AC_TYPE_PID_T
1535AC_TYPE_SIZE_T 1004AC_TYPE_SIZE_T
1536AC_TYPE_MODE_T 1005AC_TYPE_MODE_T
1537AC_CHECK_HEADERS_ONCE([sys/time.h])
1538 1006
1539AC_HEADER_STAT 1007AC_HEADER_STAT
1540AC_HEADER_STDBOOL 1008AC_HEADER_STDBOOL
1541AC_STRUCT_TM 1009AC_STRUCT_TM
1542 1010
1543AC_CHECK_MEMBER([struct sockaddr_in.sin_len], 1011AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
1544 [ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [Do we have sockaddr_in.sin_len?]) 1012 [AC_DEFINE([HAVE_SOCKADDR_IN_SIN_LEN], [1],
1545 ], 1013 [Define to 1 if struct sockaddr_in has sin_len field])],
1546 [], 1014 [], [],
1547 [ 1015 [#include <sys/types.h>
1548 #include <sys/types.h> 1016#include <sys/socket.h>
1549 #include <sys/socket.h> 1017#include <netinet/in.h>])
1550 #include <netinet/in.h>
1551 ])
1552 1018
1553AC_CHECK_MEMBER([struct sockaddr_un.sun_len], 1019AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
1554 [ AC_DEFINE(HAVE_SOCKADDR_UN_SUN_LEN, 1020 [AC_DEFINE([HAVE_SOCKADDR_UN_SUN_LEN], [1],
1555 1, 1021 [Define to 1 if struct sockaddr_un has sun_len field])],
1556 [Do we have sockaddr_un.sun_len?])], 1022 [], [],
1557 [], 1023 [#include <sys/types.h>
1558 [ 1024#include <sys/socket.h>
1559 #include <sys/types.h> 1025#include <sys/un.h>])
1560 #include <sys/socket.h>
1561 #include <sys/un.h>
1562 ])
1563
1564 1026
1565
1566# Checks for library functions.
1567AC_FUNC_CLOSEDIR_VOID
1568AC_FUNC_FORK
1569AC_PROG_GCC_TRADITIONAL
1570AC_FUNC_MEMCMP
1571AC_FUNC_SELECT_ARGTYPES
1572AC_FUNC_CHOWN
1573
1574AC_FUNC_STAT
1575AC_FUNC_STRFTIME
1576AC_FUNC_VPRINTF
1577AC_HEADER_SYS_WAIT
1578AC_TYPE_OFF_T 1027AC_TYPE_OFF_T
1579AC_TYPE_UID_T 1028AC_TYPE_UID_T
1580AC_CHECK_FUNCS([atoll stat64 strnlen mremap getrlimit setrlimit sysconf initgroups strndup gethostbyname2 getpeerucred getpeereid setresuid $funcstocheck getifaddrs freeifaddrs getresgid mallinfo malloc_size malloc_usable_size getrusage random srandom stat statfs statvfs wait4 timegm])
1581 1029
1582# restore LIBS 1030# check for library functions
1583LIBS=$SAVE_LIBS 1031AC_FUNC_FORK
1032AC_FUNC_CHOWN
1033AC_CHECK_FUNCS([atoll stat64 strnlen mremap getrlimit setrlimit sysconf initgroups strndup gethostbyname2 getpeerucred getpeereid setresuid getifaddrs freeifaddrs getresgid mallinfo2 malloc_size malloc_usable_size getrusage random srandom stat statfs statvfs wait4 timegm])
1584 1034
1585GN_INTLINCL="" 1035GN_INTLINCL=""
1586GN_LIBINTL="$LTLIBINTL" 1036GN_LIBINTL="$LTLIBINTL"
1587GN_LIB_LDFLAGS="-export-dynamic -no-undefined" 1037GN_LIB_LDFLAGS="-export-dynamic -no-undefined"
1588GN_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined" 1038GN_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
1589 1039
1590AC_SUBST(GN_LIB_LDFLAGS) 1040AC_SUBST([GN_LIB_LDFLAGS])
1591AC_SUBST(GN_PLUGIN_LDFLAGS) 1041AC_SUBST([GN_PLUGIN_LDFLAGS])
1592AC_SUBST(GN_INTLINCL) 1042AC_SUBST([GN_INTLINCL])
1593AC_SUBST(GN_LIBINTL) 1043AC_SUBST([GN_LIBINTL])
1594 1044
1595AC_SUBST(CPPFLAGS) 1045AC_SUBST([CPPFLAGS])
1596AC_SUBST(LIBS) 1046AC_SUBST([LIBS])
1597AC_SUBST(LDFLAGS) 1047AC_SUBST([LDFLAGS])
1598AC_SUBST(EXT_LIB_PATH) 1048AC_SUBST([EXT_LIB_PATH])
1599AC_SUBST(EXT_LIBS) 1049AC_SUBST([EXT_LIBS])
1600 1050
1601AC_SUBST(LIBPREFIX) 1051AC_SUBST([LIBPREFIX])
1602AC_SUBST(DLLDIR) 1052AC_SUBST([DLLDIR])
1603AC_SUBST(EXT_LIB_PATH) 1053AC_SUBST([EXT_LIB_PATH])
1604 1054
1605DATAROOTDIR=$datarootdir 1055DATAROOTDIR=$datarootdir
1606AC_SUBST(DATAROOTDIR) 1056AC_SUBST([DATAROOTDIR])
1607
1608# test for sudo
1609AC_MSG_CHECKING(for sudo)
1610#AC_CHECK_PROGS(SUDO_BINARY, [sudo], false)
1611#AM_CONDITIONAL(HAVE_SUDO, test x$SUDO_BINARY != xfalse)
1612AC_ARG_WITH(sudo,
1613 [ --with-sudo=PATH path to sudo binary (or just yes)],
1614 [AC_MSG_RESULT("$with_sudo")
1615 AS_CASE([$with_sudo],
1616 [no],[SUDO_BINARY=],
1617 [yes],[SUDO_BINARY=sudo],
1618 [SUDO_BINARY=$with_sudo])],
1619 [AC_MSG_RESULT([no])])
1620AC_SUBST(SUDO_BINARY)
1621AM_CONDITIONAL([HAVE_SUDO],
1622 [test "x$SUDO_BINARY" != "x" -o -w /])
1623
1624# test for doas
1625AC_MSG_CHECKING(for doas)
1626AC_CHECK_PROGS(DOAS_BINARY, [doas], false)
1627AM_CONDITIONAL(HAVE_DOAS_BINARY, test x$DOAS_BINARY != xfalse)
1628
1629# test for gnunetdns group name
1630GNUNETDNS_GROUP=gnunetdns
1631AC_MSG_CHECKING(for gnunetdns group name)
1632AC_ARG_WITH(gnunetdns,
1633 [ --with-gnunetdns=GRPNAME name for gnunetdns group],
1634 [AC_MSG_RESULT("$with_gnunetdns")
1635 AS_CASE([$with_gnunetdns],
1636 [no],[GNUNETDNS_GROUP=gnunet],
1637 [yes],[GNUNETDNS_GROUP=gnunetdns],
1638 [GNUNETDNS_GROUP=$with_gnunetdns])],
1639 [AC_MSG_RESULT([gnunetdns])])
1640AC_SUBST(GNUNETDNS_GROUP)
1641 1057
1058# check for sudo
1059AC_CHECK_PROGS([SUDO_BINARY], [sudo], [false])
1060AM_CONDITIONAL([HAVE_SUDO], [test "x$SUDO_BINARY" != "xfalse"])
1642 1061
1062# check for doas
1063AC_CHECK_PROGS([DOAS_BINARY], [doas], [false])
1064AM_CONDITIONAL([HAVE_DOAS_BINARY], [test "x$DOAS_BINARY" != "xfalse"])
1643 1065
1644# gnutls 1066# check if NSE has to send timestamp information to testbed logger for
1645gnutls=0
1646gnutls_dane=0
1647AC_MSG_CHECKING(for gnutls)
1648AC_ARG_WITH(gnutls,
1649 [ --with-gnutls=PFX base of gnutls installation],
1650 [AC_MSG_RESULT([$with_gnutls])
1651 AS_CASE([$with_gnutls],
1652 [no],[],
1653 [yes],
1654 [AC_CHECK_HEADERS([gnutls/abstract.h],
1655 AC_CHECK_LIB([gnutls],
1656 [gnutls_priority_set],
1657 gnutls=true))
1658 AC_CHECK_HEADERS([gnutls/dane.h],
1659 AC_CHECK_LIB([gnutls-dane],
1660 [dane_verify_crt_raw],
1661 gnutls_dane=1))],
1662
1663 [LDFLAGS="-L$with_gnutls/lib $LDFLAGS"
1664 CPPFLAGS="-I$with_gnutls/include $CPPFLAGS"
1665 AC_CHECK_HEADERS([gnutls/abstract.h],
1666 AC_CHECK_LIB([gnutls], [gnutls_priority_set],
1667 EXT_LIB_PATH="-L$with_gnutls/lib $EXT_LIB_PATH"
1668 gnutls=true))
1669 AC_CHECK_HEADERS([gnutls/dane.h],
1670 AC_CHECK_LIB([gnutls-dane], [dane_verify_crt_raw],
1671 gnutls_dane=1))
1672 ])
1673 ],
1674 [AC_MSG_RESULT([--with-gnutls not specified])
1675 AC_CHECK_HEADERS([gnutls/abstract.h],
1676 AC_CHECK_LIB([gnutls], [gnutls_priority_set],
1677 gnutls=true))
1678 AC_CHECK_HEADERS([gnutls/dane.h],
1679 AC_CHECK_LIB([gnutls-dane], [dane_verify_crt_raw],
1680 gnutls_dane=1))
1681 ])
1682AM_CONDITIONAL(HAVE_GNUTLS, test x$gnutls = xtrue)
1683AC_DEFINE_UNQUOTED([HAVE_GNUTLS], $gnutls, [We have GnuTLS])
1684AM_CONDITIONAL(HAVE_GNUTLS_DANE, test x$gnutls_dane = x1)
1685AC_DEFINE_UNQUOTED([HAVE_GNUTLS_DANE], $gnutls_dane, [We have GnuTLS with DANE support])
1686
1687
1688
1689# Test if we are building for superMUC
1690AC_MSG_CHECKING(if GNUnet is being configured to run on the SuperMUC)
1691AC_ARG_ENABLE([supermuc],
1692 [AS_HELP_STRING([--enable-supermuc],
1693 [build GNUnet with support to run on the SuperMUC (default is NO)])],
1694 [AS_IF([test "x$enable_supermuc" = "xno"],
1695 [supermuc=0],
1696 [supermuc=1])],
1697 [supermuc=0
1698 enable_supermuc=no])
1699AC_MSG_RESULT($enable_SUPERMUC)
1700AM_CONDITIONAL([ENABLE_SUPERMUC], [test "x$supermuc" = "x1"])
1701AC_DEFINE_UNQUOTED([ENABLE_SUPERMUC], [$supermuc], [Build with support for SuperMUC])
1702
1703# Check if NSE has to send timestamp information to testbed logger for
1704# generating histogram of messages received 1067# generating histogram of messages received
1705AC_MSG_CHECKING(if NSE has to send timestamp information to testbed logger)
1706AC_ARG_ENABLE([nse-histogram], 1068AC_ARG_ENABLE([nse-histogram],
1707 [AS_HELP_STRING([--enable-nse-histogram], 1069 [AS_HELP_STRING([--enable-nse-histogram],
1708 [have NSE send timestamp information to testbed logger for generating 1070 [have NSE send timestamp information to testbed logger for generating a histogram of received messages. NOT useful for production (default is no)])],
1709 histogram of received messages. NOT useful for production (default is 1071 [AS_IF([test "x$enableval" = "xno"]
1710 NO)])], 1072 [nse_histogram=0],
1711 [AS_IF([test "x$enableval" = "xno"], 1073 [nse_histogram=1])],
1712 [nse_histogram=0], 1074 [nse_histogram=0])
1713 [nse_histogram=1])],
1714 [nse_histogram=0
1715 enable_nse_histogram=no])
1716AC_MSG_RESULT($enable_nse_histogram)
1717AM_CONDITIONAL([ENABLE_NSE_HISTOGRAM], [test "x$nse_histogram" = "x1"]) 1075AM_CONDITIONAL([ENABLE_NSE_HISTOGRAM], [test "x$nse_histogram" = "x1"])
1718AC_DEFINE_UNQUOTED([ENABLE_NSE_HISTOGRAM], [$nse_histogram], 1076AC_DEFINE_UNQUOTED([ENABLE_NSE_HISTOGRAM], [$nse_histogram],
1719 [have NSE send timestamp information to testbed logger]) 1077 [Define to 1 if NSE should send timestamp information])
1720 1078
1721# should 'make check' run tests? 1079# check if 'make check' should run tests
1722AC_MSG_CHECKING(whether to run tests)
1723AC_ARG_ENABLE([testruns], 1080AC_ARG_ENABLE([testruns],
1724 [AS_HELP_STRING([--disable-testruns], [disable running tests on make check (default is YES)])], 1081 [AS_HELP_STRING([--disable-testruns],
1725 [enable_tests_run=${enableval}], 1082 [disable running tests on make check])],
1726 [enable_tests_run=yes]) 1083 [enable_testruns=${enableval}],
1727AC_MSG_RESULT($enable_test_run) 1084 [enable_testruns=yes])
1728AM_CONDITIONAL([ENABLE_TEST_RUN], [test "x$enable_tests_run" = "xyes"]) 1085AM_CONDITIONAL([ENABLE_TEST_RUN], [test "x$enable_testruns" = "xyes"])
1729
1730
1731AC_MSG_CHECKING([whether to compile in benchmarks (currently for http and crypto)])
1732AC_ARG_ENABLE([benchmark],
1733 [AS_HELP_STRING([--enable-benchmark], [enable benchmarking])],
1734 [enable_benchmark=${enableval}],
1735 [enable_benchmark=no])
1736AC_MSG_RESULT($enable_benchmark)
1737AS_IF([test "x$enable_benchmark" = "xyes"],
1738 [AC_DEFINE_UNQUOTED(ENABLE_BENCHMARK,1,[Benchmarks are enabled])])
1739AM_CONDITIONAL([ENABLE_BENCHMARK], [test "x$enable_benchmark" = "xyes"])
1740
1741
1742# should expensive tests be run?
1743AC_MSG_CHECKING(whether to run expensive tests)
1744AC_ARG_ENABLE([expensivetests],
1745 [AS_HELP_STRING([--enable-expensivetests], [enable running expensive testcases])],
1746 [enable_expensive=${enableval}],
1747 [enable_expensive=no])
1748AC_MSG_RESULT($enable_expensive)
1749AM_CONDITIONAL([HAVE_EXPENSIVE_TESTS], [test "x$enable_expensive" = "xyes"])
1750
1751# should ports be open for Java services?
1752AC_MSG_CHECKING(whether to enable ports for gnunet-java)
1753AC_ARG_ENABLE([javaports],
1754 [AS_HELP_STRING([--enable-javaports], [use non-zero ports for services with Java bindings (default is NO)])],
1755 [enable_java_ports=${enableval}],
1756 [enable_java_ports=no])
1757AC_MSG_RESULT($enable_java_ports)
1758AS_IF([test "x$enable_java_ports" = "xyes"],
1759 [JAVAPORT=""],
1760 [JAVAPORT="$UNIXONLY"])
1761AC_SUBST(JAVAPORT)
1762 1086
1763# should benchmarks be run? 1087# check if benchmarks should be executed
1764AC_MSG_CHECKING(whether to run benchmarks during make check)
1765AC_ARG_ENABLE([benchmarks], 1088AC_ARG_ENABLE([benchmarks],
1766 [AS_HELP_STRING([--enable-benchmarks], [enable running benchmarks during make check])], 1089 [AS_HELP_STRING([--enable-benchmarks],
1767 [enable_benchmarks=${enableval}], 1090 [enable benchmarking (default is no)])],
1768 [enable_benchmarks=no]) 1091 [enable_benchmarks=${enableval}],
1769AC_MSG_RESULT($enable_benchmarks) 1092 [enable_benchmarks=no])
1093
1094AS_IF([test "x$enable_benchmarks" = "xyes"],
1095 [AC_DEFINE([ENABLE_BENCHMARK], [1], [Define to 1 if benchmarks are enabled])])
1096AM_CONDITIONAL([ENABLE_BENCHMARK], [test "x$enable_benchmarks" = "xyes"])
1770AM_CONDITIONAL([HAVE_BENCHMARKS], [test "x$enable_benchmarks" = "xyes"]) 1097AM_CONDITIONAL([HAVE_BENCHMARKS], [test "x$enable_benchmarks" = "xyes"])
1771 1098
1772# should gnunet-testing be compiled 1099# check if ports should be opened for Java services
1773AC_MSG_CHECKING(whether to compile gnunet-testing) 1100AC_ARG_ENABLE([javaports],
1774AC_ARG_ENABLE([testing], 1101 [AS_HELP_STRING([--enable-javaports],
1775 [AS_HELP_STRING([--disable-testing], [do not build gnunet-testing])], 1102 [use non-zero ports for services with Java bindings (default is no)])],
1776 [enable_testing=${enableval}], 1103 [enable_java_ports=${enableval}],
1777 [enable_testing=yes]) 1104 [enable_java_ports="no"])
1778AC_MSG_RESULT($enable_testing) 1105
1779AM_CONDITIONAL([HAVE_TESTING], [test "x$enable_testing" = "xyes"]) 1106AS_IF([test "x$enable_java_ports" = "xyes"],
1780 1107 [JAVAPORT=""],
1781# should experimental code be compiled (code that may not yet compile)? 1108 [JAVAPORT="$UNIXONLY"])
1782AC_MSG_CHECKING(whether to compile experimental code) 1109AC_SUBST([JAVAPORT])
1110
1111# check if experimental code should be compiled (or at least attempted to)
1783AC_ARG_ENABLE([experimental], 1112AC_ARG_ENABLE([experimental],
1784 [AS_HELP_STRING([--enable-experimental], [enable compiling experimental code])], 1113 [AS_HELP_STRING([--enable-experimental],
1785 [enable_experimental=${enableval}], 1114 [enable experimental code paths (default is no)])],
1786 [enable_experimental=no]) 1115 [AS_IF([test "x$enableval" = "xno"],
1787AC_MSG_RESULT($enable_experimental) 1116 [enable_experimental=0],
1788AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"]) 1117 [enable_experimental=1])],
1789 1118 [enable_experimental=0])
1790# should malicious code be compiled (should only be used for testing)? 1119AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "x1"])
1791AC_MSG_CHECKING(whether to compile malicious code) 1120AS_IF([test "x$enable_experimental" = "x1"],
1121 AC_DEFINE([GNUNET_EXPERIMENTAL], 1, [Set to 1 is this is an experimental build]))
1122
1123AC_SUBST([enable_experimental])
1124
1125# check if malicious code should be compiled (for testing)
1792AC_ARG_ENABLE([malicious], 1126AC_ARG_ENABLE([malicious],
1793 [AS_HELP_STRING([--enable-malicious], [enable compiling malicious code])], 1127 [AS_HELP_STRING([--enable-malicious],
1794 [AS_IF([test "x$enableval" = "xno"], 1128 [enable malicious code path (only for testing; default is no)])],
1795 [malicious=0], 1129 [AS_IF([test "x$enableval" = "xno"],
1796 [malicious=1])], 1130 [malicious=0],
1797 [malicious=0 1131 [malicious=1])],
1798 enable_malicious=no]) 1132 [malicious=0
1799AC_MSG_RESULT($enable_malicious) 1133 enable_malicious=no])
1800AM_CONDITIONAL([ENABLE_MALICIOUS], [test 1=$malicious]) 1134AM_CONDITIONAL([ENABLE_MALICIOUS], [test "x$malicious" = "x1"])
1801AC_DEFINE_UNQUOTED([ENABLE_MALICIOUS], [$malicious], 1135AC_DEFINE_UNQUOTED([ENABLE_MALICIOUS], [$malicious],
1802 [enable compilation of malicious code]) 1136 [Define to 1 if malicious code paths should be compiled])
1803 1137
1804# should services be started on demand when needed? 1138# check if services should be started on demand when needed
1805# Some services may choose to never start by default 1139# Some services may choose to never start by default
1806# and it is up to the service/module developer to decide 1140# and it is up to the service/module developer to decide
1807# by having "START_ON_DEMAND = NO" instead of 1141# by having "START_ON_DEMAND = NO" instead of
1808# "START_ON_DEMAND = @START_ON_DEMAND@" 1142# "START_ON_DEMAND = @START_ON_DEMAND@"
1809# in the service/module's conf.in file. 1143# in the service/module's conf.in file.
1810# See also IMMEDIATE_START for an unconditional immediate start. 1144# See also IMMEDIATE_START for an unconditional immediate start.
1811START_ON_DEMAND="YES"
1812AC_MSG_CHECKING(whether to start peer's services on demand by default)
1813AC_ARG_ENABLE([autostart], 1145AC_ARG_ENABLE([autostart],
1814 [AS_HELP_STRING([--disable-autostart], [do not start peer's services by default])], 1146 [AS_HELP_STRING([--disable-autostart],
1815 [enable_autostart=${enableval} 1147 [do not start peer services by default])],
1816 AS_IF([test "x$enable_autostart" = "xno"], 1148 [AS_IF([test "x$enableval" = "xno"],
1817 [START_ON_DEMAND="NO"]) 1149 [START_ON_DEMAND=NO],
1818 ], 1150 [START_ON_DEMAND=YES])],
1819 [enable_autostart=yes]) 1151 [START_ON_DEMAND=YES])
1820AC_MSG_RESULT($enable_autostart) 1152AC_SUBST([START_ON_DEMAND])
1821#AM_CONDITIONAL([HAVE_START_ON_DEMAND], [test "x$enable_autostart" = "xyes"]) 1153
1822AC_SUBST(START_ON_DEMAND) 1154# check if memory statistics should be kept (very expensive CPU-wise!)
1823
1824# should memory statistics be kept (very expensive CPU-wise!)
1825AC_MSG_CHECKING(whether to create expensive statistics on memory use)
1826AC_ARG_ENABLE([heapstats], 1155AC_ARG_ENABLE([heapstats],
1827 [AS_HELP_STRING([--enable-heapstats], [enable expensive heap statistics])], 1156 [AS_HELP_STRING([--enable-heapstats], [enable expensive heap statistics])],
1828 [enable_heapstats=1], 1157 [AS_IF([test "x$enableval" = "xno"],
1829 [enable_heapstats=0]) 1158 [enable_heapstats=0],
1830AC_MSG_RESULT($enable_heapstats) 1159 [enable_heapstats=1])],
1831AC_DEFINE_UNQUOTED([ENABLE_HEAP_STATISTICS],$enable_heapstats,[enable expensive heap statistics]) 1160 [enable_heapstats=0])
1832 1161AC_DEFINE_UNQUOTED([ENABLE_HEAP_STATISTICS], [$enable_heapstats],
1833 1162 [Define to 1 if expensive heap statistics should be enabled])
1834# Check if the __thread storage class for 1163
1835# thread-local storage is available. 1164# check if the __thread storage class is available
1836AC_MSG_CHECKING(whether __thread is supported) 1165AC_MSG_CHECKING([if __thread is supported])
1837AC_LINK_IFELSE( 1166AC_LINK_IFELSE(
1838[AC_LANG_PROGRAM([#include <stdlib.h> 1167 [AC_LANG_PROGRAM([#include <stdlib.h>
1839 #undef __thread 1168#undef __thread
1840 static __thread int a = 1;], 1169static __thread int a = 1;],
1841 [exit(a-1);])], 1170[exit(a-1);])],
1842 [have_thread_local_gcc=1],[have_thread_local_gcc=0]) 1171 [have_thread_local=1],
1843AC_DEFINE_UNQUOTED([HAVE_THREAD_LOCAL_GCC],$have_thread_local_gcc,[Define this if __thread is supported]) 1172 [have_thread_local=0])
1844AS_IF([test "x$have_thread_local_gcc" = "x1"], 1173AC_DEFINE_UNQUOTED([HAVE_THREAD_LOCAL_GCC], [$have_thread_local],
1845 [AC_MSG_RESULT(yes)], 1174 [Define to 1 if __thread is supported])
1846 [AC_MSG_RESULT(no)]) 1175AS_IF([test "x$have_thread_local" = "x1"],
1847 1176 [AC_MSG_RESULT([yes])],
1848# gcov compilation 1177 [AC_MSG_RESULT([no])])
1849AC_MSG_CHECKING(whether to compile with support for code coverage analysis) 1178
1179# check if gcov should be used
1850AC_ARG_ENABLE([coverage], 1180AC_ARG_ENABLE([coverage],
1851 AS_HELP_STRING([--enable-coverage], 1181 [AS_HELP_STRING([--enable-coverage],
1852 [compile the library with code coverage support]), 1182 [compile the library with code coverage support])],
1853 [use_gcov=${enableval}], 1183 [use_gcov=${enableval}],
1854 [use_gcov=no]) 1184 [use_gcov=no])
1855AC_MSG_RESULT($use_gcov)
1856AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) 1185AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
1857 1186
1858
1859# Temporarily disable a specific piece of code until TNG is out. 1187# Temporarily disable a specific piece of code until TNG is out.
1860AC_ARG_ENABLE([transport-timing-diagnostic], 1188AC_ARG_ENABLE([transport-timing-diagnostic],
1861 [AS_HELP_STRING([--enable-transport-timing-diagnostic], 1189 [AS_HELP_STRING([--enable-transport-timing-diagnostic],
1862 [enable logging of transport (not TNG) sending times])], 1190 [enable logging of transport (not TNG) sending times])],
1863 [enable_ttd=yes], 1191 [enable_ttd=yes],
1864 [enable_ttd=no]) 1192 [enable_ttd=no])
1865AS_IF([test "x$enable_ttd" = "xyes"], 1193AS_IF([test "x$enable_ttd" = "xyes"],
1866 [AC_DEFINE([ENABLE_TTD], [1], [Define if transport (not TNG) should warn about sending times.])]) 1194 [AC_DEFINE([ENABLE_TTD], [1],
1867 1195 [Define if transport (not TNG) should warn about sending times.])])
1868 1196
1869# version info 1197# get version information
1870# TODO: git blame says this predates our switch to git. 1198AC_PATH_PROG([gitcommand], [git])
1871# git-svn should be adjusted to simply git, or 1199AC_MSG_CHECKING([if source is under a VCS])
1872# an external script that does the job. 1200AS_IF([test "x$gitcommand" = "x"],
1873AC_PATH_PROG(svnversioncommand, svnversion) 1201 [vcs_name="no"
1874AC_PATH_PROG(gitcommand, git) 1202 vcs_version="\"release\""],
1875AC_MSG_CHECKING(for source being under a VCS) 1203 [AS_IF([test -d .git], dnl admittedly, not the best
1876 1204 [git_version=$(cd $srcdir; git log -n1 --abbrev-commit | head -n1 | cut -d ' ' -f2 2>/dev/null)
1877 1205 vcs_name='yes, git-svn'
1878# version info 1206 vcs_version="\"git-$git_version\""],
1879AC_PATH_PROG(gitcommand, git) 1207 [vcs_name="no"
1880AC_MSG_CHECKING(for source being under a VCS) 1208 vcs_version="\"release\""])])
1881git_version= 1209AC_MSG_RESULT([$vcs_name])
1882AS_IF([test ! "X$gitcommand" = "X"], 1210AC_DEFINE_UNQUOTED([VCS_VERSION], [$vcs_version],
1883[ 1211 [VCS revision/hash or tarball version])
1884 git_version=$(cd $srcdir ; git log -n1 --abbrev-commit | head -n1 | cut -d " " -f2 2>/dev/null)
1885])
1886AS_IF([test "X$git_version" = "X"],
1887 [
1888 vcs_name="no"
1889 vcs_version="\"release\""
1890 ],
1891 [
1892 vcs_name="yes, git-svn"
1893 vcs_version="\"git-$git_version\""
1894 ])
1895AC_MSG_RESULT($vcs_name)
1896
1897AC_MSG_CHECKING(VCS version)
1898AC_MSG_RESULT($vcs_version)
1899AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version])
1900 1212
1901AC_CONFIG_FILES([ 1213AC_CONFIG_FILES([
1902Makefile 1214Makefile
1903bin/Makefile
1904contrib/Makefile 1215contrib/Makefile
1905contrib/hellos/Makefile 1216data/Makefile
1217data/hellos/Makefile
1218scripts/Makefile
1906contrib/services/Makefile 1219contrib/services/Makefile
1907contrib/services/openrc/Makefile 1220contrib/services/openrc/Makefile
1908contrib/services/systemd/Makefile 1221contrib/services/systemd/Makefile
@@ -1911,112 +1224,141 @@ contrib/scripts/gnunet-logread/Makefile
1911doc/Makefile 1224doc/Makefile
1912doc/man/Makefile 1225doc/man/Makefile
1913doc/doxygen/Makefile 1226doc/doxygen/Makefile
1914doc/handbook/Makefile
1915doc/tutorial/Makefile
1916m4/Makefile 1227m4/Makefile
1917po/Makefile.in 1228po/Makefile.in
1918src/Makefile 1229src/Makefile
1919src/arm/Makefile 1230src/lib/Makefile
1920src/arm/arm.conf 1231src/lib/util/Makefile
1921src/ats/Makefile 1232src/lib/block/Makefile
1922src/ats/ats.conf 1233src/lib/curl/Makefile
1923src/ats-tool/Makefile 1234src/lib/gnsrecord/Makefile
1924src/auction/Makefile 1235src/lib/json/Makefile
1925src/block/Makefile 1236src/lib/pq/Makefile
1926src/cadet/Makefile 1237src/lib/sq/Makefile
1927src/cadet/cadet.conf 1238src/plugin/Makefile
1928src/core/Makefile 1239src/plugin/block/Makefile
1929src/core/core.conf 1240src/plugin/datacache/Makefile
1930src/consensus/Makefile 1241src/plugin/datastore/Makefile
1931src/consensus/consensus.conf 1242src/plugin/dht/Makefile
1932src/conversation/Makefile 1243src/plugin/dns/Makefile
1933src/conversation/conversation.conf 1244src/plugin/fs/Makefile
1934src/curl/Makefile 1245src/plugin/gns/Makefile
1935src/datacache/Makefile 1246src/plugin/gnsrecord/Makefile
1936src/datastore/Makefile 1247src/plugin/namecache/Makefile
1937src/datastore/datastore.conf 1248src/plugin/namestore/Makefile
1938src/dht/Makefile 1249src/plugin/peerstore/Makefile
1939src/dht/dht.conf 1250src/plugin/reclaim/Makefile
1940src/dhtu/Makefile 1251src/plugin/regex/Makefile
1941src/dns/Makefile 1252src/plugin/revocation/Makefile
1942src/dns/dns.conf 1253src/plugin/seti/Makefile
1943src/exit/Makefile 1254src/plugin/setu/Makefile
1944src/fragmentation/Makefile 1255src/plugin/messenger/Makefile
1945src/fs/Makefile 1256src/service/Makefile
1946src/fs/fs.conf 1257src/service/arm/Makefile
1947src/gns/Makefile 1258src/service/arm/arm.conf
1948src/gns/gns.conf 1259src/service/cadet/Makefile
1949src/gns/nss/Makefile 1260src/service/cadet/cadet.conf
1950src/gnsrecord/Makefile 1261src/service/core/Makefile
1951src/hello/Makefile 1262src/service/core/core.conf
1952src/identity/Makefile 1263src/service/datacache/Makefile
1953src/identity/identity.conf 1264src/service/datastore/Makefile
1265src/service/datastore/datastore.conf
1266src/service/dht/Makefile
1267src/service/dht/dht.conf
1268src/service/dns/Makefile
1269src/service/dns/dns.conf
1270src/service/exit/Makefile
1271src/service/fs/Makefile
1272src/service/fs/fs.conf
1273src/service/gns/Makefile
1274src/service/gns/gns.conf
1275src/service/gns/nss/Makefile
1276src/service/hostlist/Makefile
1277src/service/identity/Makefile
1278src/service/identity/identity.conf
1279src/service/messenger/Makefile
1280src/service/messenger/messenger.conf
1281src/service/namecache/Makefile
1282src/service/namecache/namecache.conf
1283src/service/namestore/Makefile
1284src/service/namestore/namestore.conf
1285src/service/nat/Makefile
1286src/service/nat/nat.conf
1287src/service/nat-auto/Makefile
1288src/service/nat-auto/nat-auto.conf
1289src/service/nse/Makefile
1290src/service/nse/nse.conf
1291src/service/peerstore/Makefile
1292src/service/peerstore/peerstore.conf
1293src/service/pt/Makefile
1294src/service/reclaim/Makefile
1295src/service/regex/Makefile
1296src/service/regex/regex.conf
1297src/service/rest/Makefile
1298src/service/revocation/Makefile
1299src/service/revocation/revocation.conf
1300src/service/seti/Makefile
1301src/service/seti/seti.conf
1302src/service/setu/Makefile
1303src/service/setu/setu.conf
1304src/service/statistics/Makefile
1305src/service/statistics/statistics.conf
1306src/service/testing/Makefile
1307src/service/topology/Makefile
1308src/service/transport/Makefile
1309src/service/transport/transport.conf
1310src/service/util/Makefile
1311src/service/util/resolver.conf
1312src/service/vpn/Makefile
1313src/service/vpn/vpn.conf
1314src/service/zonemaster/Makefile
1315src/service/zonemaster/zonemaster.conf
1316src/cli/Makefile
1317src/cli/arm/Makefile
1318src/cli/cadet/Makefile
1319src/cli/core/Makefile
1320src/cli/datastore/Makefile
1321src/cli/dht/Makefile
1322src/cli/fs/Makefile
1323src/cli/gns/Makefile
1324src/cli/identity/Makefile
1325src/cli/messenger/Makefile
1326src/cli/namecache/Makefile
1327src/cli/namestore/Makefile
1328src/cli/peerstore/Makefile
1329src/cli/nat/Makefile
1330src/cli/nat-auto/Makefile
1331src/cli/nse/Makefile
1332src/cli/reclaim/Makefile
1333src/cli/revocation/Makefile
1334src/cli/statistics/Makefile
1335src/cli/util/Makefile
1336src/cli/vpn/Makefile
1337src/contrib/Makefile
1338src/contrib/service/Makefile
1339src/contrib/service/abd/Makefile
1340src/contrib/service/abd/abd.conf
1341src/contrib/service/auction/Makefile
1342src/contrib/service/consensus/Makefile
1343src/contrib/service/consensus/consensus.conf
1344src/contrib/service/conversation/Makefile
1345src/contrib/service/conversation/conversation.conf
1346src/contrib/service/scalarproduct/Makefile
1347src/contrib/service/scalarproduct/scalarproduct.conf
1348src/contrib/service/secretsharing/Makefile
1349src/contrib/service/secretsharing/secretsharing.conf
1350src/contrib/service/set/Makefile
1351src/contrib/service/set/set.conf
1352src/contrib/service/rps/Makefile
1353src/contrib/service/rps/rps.conf
1354src/contrib/service/template/Makefile
1355src/contrib/cli/Makefile
1356src/contrib/cli/template/Makefile
1357src/lib/hello/Makefile
1954src/include/Makefile 1358src/include/Makefile
1955src/integration-tests/Makefile 1359src/include/gnunet_config.h
1956src/json/Makefile
1957src/hostlist/Makefile
1958src/my/Makefile
1959src/mysql/Makefile
1960src/namecache/Makefile
1961src/namecache/namecache.conf
1962src/namestore/Makefile
1963src/namestore/namestore.conf
1964src/nat/Makefile
1965src/nat/nat.conf
1966src/nat-auto/Makefile
1967src/nat-auto/nat-auto.conf
1968src/nse/Makefile
1969src/nse/nse.conf
1970src/nt/Makefile
1971src/peerinfo/Makefile
1972src/peerinfo/peerinfo.conf
1973src/peerinfo-tool/Makefile
1974src/peerstore/Makefile
1975src/peerstore/peerstore.conf
1976src/pq/Makefile
1977src/pt/Makefile
1978src/regex/Makefile
1979src/regex/regex.conf
1980src/revocation/Makefile
1981src/revocation/revocation.conf
1982src/rps/Makefile
1983src/rps/rps.conf
1984src/secretsharing/Makefile
1985src/secretsharing/secretsharing.conf
1986src/scalarproduct/Makefile
1987src/scalarproduct/scalarproduct.conf
1988src/set/Makefile
1989src/set/set.conf
1990src/seti/Makefile
1991src/seti/seti.conf
1992src/setu/Makefile
1993src/setu/setu.conf
1994src/sq/Makefile
1995src/statistics/Makefile
1996src/statistics/statistics.conf
1997src/template/Makefile
1998src/testbed/Makefile
1999src/testbed/testbed.conf
2000src/testbed-logger/Makefile
2001src/testbed-logger/testbed-logger.conf
2002src/testing/Makefile
2003src/topology/Makefile
2004src/transport/Makefile
2005src/transport/transport.conf
2006src/util/Makefile
2007src/util/resolver.conf
2008src/vpn/Makefile
2009src/vpn/vpn.conf
2010src/zonemaster/Makefile
2011src/zonemaster/zonemaster.conf
2012src/rest/Makefile
2013src/abe/Makefile
2014src/reclaim/Makefile
2015src/messenger/Makefile
2016src/messenger/messenger.conf
2017pkgconfig/Makefile 1360pkgconfig/Makefile
2018pkgconfig/gnunetarm.pc 1361pkgconfig/gnunetarm.pc
2019pkgconfig/gnunetats.pc
2020pkgconfig/gnunetblock.pc 1362pkgconfig/gnunetblock.pc
2021pkgconfig/gnunetcadet.pc 1363pkgconfig/gnunetcadet.pc
2022pkgconfig/gnunetconsensus.pc 1364pkgconfig/gnunetconsensus.pc
@@ -2026,19 +1368,18 @@ pkgconfig/gnunetdatacache.pc
2026pkgconfig/gnunetdatastore.pc 1368pkgconfig/gnunetdatastore.pc
2027pkgconfig/gnunetdht.pc 1369pkgconfig/gnunetdht.pc
2028pkgconfig/gnunetdns.pc 1370pkgconfig/gnunetdns.pc
2029pkgconfig/gnunetenv.pc
2030pkgconfig/gnunetfragmentation.pc
2031pkgconfig/gnunetfs.pc 1371pkgconfig/gnunetfs.pc
2032pkgconfig/gnunetgns.pc 1372pkgconfig/gnunetgns.pc
2033pkgconfig/gnunethello.pc 1373pkgconfig/gnunethello.pc
2034pkgconfig/gnunetidentity.pc 1374pkgconfig/gnunetidentity.pc
1375pkgconfig/gnunetjson.pc
1376pkgconfig/gnunetmessenger.pc
2035pkgconfig/gnunetmicrophone.pc 1377pkgconfig/gnunetmicrophone.pc
2036pkgconfig/gnunetmysql.pc
2037pkgconfig/gnunetnamestore.pc 1378pkgconfig/gnunetnamestore.pc
2038pkgconfig/gnunetnat.pc 1379pkgconfig/gnunetnat.pc
2039pkgconfig/gnunetnse.pc 1380pkgconfig/gnunetnse.pc
2040pkgconfig/gnunetpeerinfo.pc
2041pkgconfig/gnunetpq.pc 1381pkgconfig/gnunetpq.pc
1382pkgconfig/gnunetreclaim.pc
2042pkgconfig/gnunetregex.pc 1383pkgconfig/gnunetregex.pc
2043pkgconfig/gnunetrevocation.pc 1384pkgconfig/gnunetrevocation.pc
2044pkgconfig/gnunetrps.pc 1385pkgconfig/gnunetrps.pc
@@ -2046,151 +1387,143 @@ pkgconfig/gnunetscalarproduct.pc
2046pkgconfig/gnunetset.pc 1387pkgconfig/gnunetset.pc
2047pkgconfig/gnunetspeaker.pc 1388pkgconfig/gnunetspeaker.pc
2048pkgconfig/gnunetstatistics.pc 1389pkgconfig/gnunetstatistics.pc
2049pkgconfig/gnunettestbed.pc
2050pkgconfig/gnunettesting.pc 1390pkgconfig/gnunettesting.pc
2051pkgconfig/gnunettransport.pc 1391pkgconfig/gnunettransport.pc
2052pkgconfig/gnunetutil.pc 1392pkgconfig/gnunetutil.pc
2053pkgconfig/gnunetvpn.pc 1393pkgconfig/gnunetvpn.pc
2054]) 1394])
2055AC_OUTPUT
2056 1395
1396AC_OUTPUT
2057 1397
2058# FIXME: `some modules' -> be more specific which exact modules. 1398# notice about Java ports
2059
2060# java ports
2061AS_IF([test "x$enable_java_ports" = "xyes"], 1399AS_IF([test "x$enable_java_ports" = "xyes"],
2062 [AC_MSG_NOTICE([Opening TCP ports by default to enable gnunet-java bindings.])]) 1400 [AC_MSG_NOTICE([Opening TCP ports to enable gnunet-java bindings])
1401 java_msg="yes"],
1402 [java_msg="no"])
2063 1403
2064#### 1404# experimental code is enabled
2065#### This could be moved to the checks above, 1405AS_IF([test "x$enable_experimental" = "x1"],
2066#### but for now let's keep it here. 1406 [experimental_msg="yes"],
2067#### 1407 [experimental_msg="no"])
1408
1409# experimental code for transport is enabled
2068transport_msg="tcp udp unix http" 1410transport_msg="tcp udp unix http"
2069AS_IF([test "x$build_target" = "xlinux" -a "x$enable_experimental" = "xyes"], 1411AS_IF([test "x$build_target" = "xlinux" && test "x$enable_experimental" = "x1"],
2070 [transport_msg="$transport_msg wlan"]) 1412 [transport_msg="tcp udp unix http wlan"])
2071# -- print message regarding enabled experimental features 1413
2072experimental_msg="no" 1414# libidn version
2073AS_IF([test "x$enable_experimental" = "xyes"], 1415AS_IF([test "x$libidn_version" = "x2"],
2074 [experimental_msg="yes"]) 1416 [libidn_msg="libidn2"],
2075# -- libidn 2 1417 [libidn_msg="libidn"])
2076AS_IF([test "x$working_libidn2" = x1], 1418
2077 [libidn2_msg="libidn2"]) 1419# mandoc
2078# -- libidn 1 1420AS_IF([test "x$MANDOC_BINARY" = "xfalse"],
2079AS_IF([test "x$working_libidn1" = x1], 1421 [mandoc_msg="no"],
2080 [libidn1_msg="libidn1"]) 1422 [mandoc_msg="yes"])
2081# -- texi2mdoc-generation 1423
2082AS_IF([test "x$texi2mdoc_generation" = "xyes"], 1424# doxy
2083 [mdocml_msg="yes"], 1425AS_IF([$DOXY_BINARY],
2084 [mdocml_msg="no"]) 1426 [doxy_msg="yes"],
2085# -- texi2mdoc 1427 [doxy_msg="no"])
2086AS_IF([test "x$TEXI2MDOC_BINARY" = "false"], 1428
2087 [AC_MSG_NOTICE([texi2mdoc binary not found (will not generate mdoc documentation)]) 1429# conversation
2088 texi2mdoc_msg="no (optional)"],
2089 [texi2mdoc_msg="yes"])
2090# -- mandoc
2091AS_IF([test "x$MANDOC_BINARY" = "false"],
2092 [AC_MSG_NOTICE([mandoc binary not found (will not generate handbook as man page)])
2093 mandoc_msg="no"],
2094 [mandoc_msg="yes"])
2095# -- texinfo
2096AS_IF([test "x$makeinfo" != "x1"],
2097 [texinfo_msg="no"],
2098 [texinfo_msg="yes"])
2099# -- conversation
2100conversation_msg="no" 1430conversation_msg="no"
1431AS_IF([test "x$pulse" = "x1"],
1432 [libpulse_msg="yes"],
1433 [libpulse_msg="no"])
1434AS_IF([test "x$opus" = "x1"],
1435 [libopus_msg="yes"],
1436 [libopus_msg="no"])
1437gstreamer_msg="no"
2101AS_IF([test "x$conversation_backend" = "xnone"], 1438AS_IF([test "x$conversation_backend" = "xnone"],
2102 [AS_IF([test "x$pulse" != "x1"], 1439 [AS_IF([test "x$pulse" != "x1"],
2103 [libpulse_msg="no (required for conversation)"], 1440 [libpulse_msg="no (required to build conversation)"],
2104 [libpulse_msg="yes"]) 1441 [libpulse_msg="yes"])
2105 AS_IF([test "x$opus" != "x1"], 1442 AS_IF([test "x$opus" != "x1"],
2106 [libopus_msg="no (required for conversation)"], 1443 [libopus_msg="no (required to build conversation)"],
2107 [libopus_msg="yes"]) 1444 [libopus_msg="yes"])
2108 AS_IF([test "x$gst" != "x1"], 1445 AS_IF([test "x$gst" != "x1"],
2109 [gstreamer_msg="no (required for conversation)"], 1446 [gstreamer_msg="no (required to build conversation)"],
2110 [gstreamer_msg="yes"])], 1447 [gstreamer_msg="yes"])],
2111 [AS_IF([test "x$opus" = x1], 1448 [AS_IF([test "x$opus" = "x1"],
2112 [conversation_msg="yes (x$conversation_backend)"], 1449 [conversation_msg="yes ($conversation_backend)"],
2113 [AC_MSG_WARN([libopus not found (required to build conversation)])])]) 1450 [conversation_msg="no"])])
2114 1451
2115# -- interface 1452# default network interface
2116interface_msg=`echo $DEFAULT_INTERFACE | tr -d \"` 1453interface_msg=$(echo "$DEFAULT_INTERFACE" | tr -d \")
2117# -- jansson 1454
2118# -- libextractor 1455# libextractor
2119AS_IF([test "$extractor" != 1], 1456AS_IF([test "x$extractor" = "x0"],
2120 [AC_MSG_WARN([libextractor not found, but various file-sharing functions require it])], 1457 [libextractor_msg="no"
2121 [libextractor_msg="yes"]) 1458 AC_MSG_WARN([libextractor not found, but various file-sharing operations require it])],
2122# -- libzbar 1459 [libextractor_msg="yes"])
1460
1461AC_SUBST([extractor])
1462
1463# libzbar
2123AS_IF([test "x$zbar" = "x1"], 1464AS_IF([test "x$zbar" = "x1"],
2124 [libzbar_msg="yes"], 1465 [libzbar_msg="yes"],
2125 [libzbar_msg="no (gnunet-qr will not be built)"]) 1466 [libzbar_msg="no"])
2126# -- libgnurl 1467
2127AS_IF([test "$gnurl" = "0"], 1468# libpng
2128 [AS_IF([test "x$curl" = "xfalse"], 1469AS_IF([test "x$png" = "x1"],
2129 [AC_MSG_WARN([libgnurl not found. http client support will not be compiled.]) 1470 [libpng_msg="yes"],
2130 AC_MSG_WARN([IMPORTANT: No HTTP client library found. HTTP transports and hostlist daemon will not be compiled, and you probably WANT the hostlist daemon]) 1471 [libpng_msg="no"])
2131 http_client="none"], 1472
2132 [AC_MSG_NOTICE([Using libcurl as HTTP client library.]) 1473AS_IF([test "x$curl_gnutls" = "x0"],
2133 http_client="curl"])], 1474 [curl_tls_backend="OpenSSL"],
2134 [AC_MSG_NOTICE([Using libgnurl as HTTP client library.]) 1475 [curl_tls_backend="GnuTLS"])
2135 http_client="gnurl"]) 1476
2136AS_IF([test "x$curl" = "xtrue" -a "x$curl_gnutls" != "xtrue"], 1477# ifconfig
2137 [AC_MSG_WARN([libcurl TLS backend is not gnutls. The GNS Proxy will likely not function properly.]) 1478AS_IF([test "x$IFCONFIG_BINARY" = "xfalse"],
2138 http_client="curl-openssl"], 1479 [ifconfig_msg="no (some features might not work)"],
2139 [http_client="curl-gnutls"]) 1480 [ifconfig_msg="yes"])
2140# -- ifconfig 1481
2141AS_IF([test "$VAR_IFCONFIG_BINARY" = "false"], 1482# upnpc
2142 [ifconfig_msg="no (optional, some features will not work)"], 1483AS_IF([test "x$UPNPC_BINARY" = "xfalse"],
2143 [ifconfig_msg="yes"]) 1484 [upnpc_msg="no (NAT traversal might not work)"],
2144# -- upnpc 1485 [upnpc_msg="yes"])
2145AS_IF([test "$VAR_UPNPC_BINARY" = "false"], 1486
2146 [upnpc_msg="no (optional, NAT traversal using UPnPc will not work)"], 1487# iptables
2147 [upnpc_msg="yes"]) 1488AS_IF([test "x$IPTABLES_BINARY" = "xfalse"],
2148# -- iptables 1489 [iptables_msg="no (DNS query interception might not work)"],
2149AS_IF([test "$VAR_IPTABLES_BINARY" = "false"], 1490 [iptables_msg="yes"])
2150 [iptables_msg="no (optional, DNS query interception will not work)"], 1491
2151 [iptables_msg="yes"]) 1492# bluetooth
2152# -- bluetooth
2153AS_IF([test "x$bluetooth" = "x0"], 1493AS_IF([test "x$bluetooth" = "x0"],
2154 [bluetooth_msg="no (optional)"], 1494 [bluetooth_msg="no"],
2155 [bluetooth_msg="yes" 1495 [bluetooth_msg="yes"])
2156 transport_msg="$transport_msg bluetooth"]) 1496
2157# -- gnutls 1497# gnutls
2158AS_IF([test x$gnutls != xtrue], 1498AS_IF([test "x$gnutls" = "x0"],
2159 [AC_MSG_WARN([GnuTLS not found, gnunet-gns-proxy will not be built]) 1499 [gnutls_msg="no"],
2160 gnutls_msg="no (gnunet-gns-proxy will not be built)"], 1500 [AS_IF([test "x$gnutls_dane" = "x0"],
2161 [AS_IF([test "x$gnutls_dane" != "x1"], 1501 [gnutls_msg="yes (without DANE support)"
2162 [AC_MSG_WARN([GnuTLS lacks DANE support, DANE validation will not be possible]) 1502 AC_MSG_WARN([GnuTLS lacks DANE support; validation using it will not be possible])],
2163 gnutls_msg="yes (without DANE support)"], 1503 [gnutls_msg="yes (with DANE support)"])])
2164 [gnutls_msg="yes (with DANE support)"])]) 1504
2165# -- databases 1505# pdflatex
2166# TODO: this always returns true, the check might 1506AS_IF([test "x$PDFLATEX_BINARY" = "xfalse"],
2167# TODO: not be working as intended (for msqlfail). 1507 [latex_msg="no"],
2168AS_IF([test "$mysql" = true], 1508 [latex_msg="yes"])
2169 [features_msg="$features_msg mysql" 1509
2170 mysql_msg="yes"], 1510# database backends
2171 [mysql_msg="no"]) 1511features_msg=""
2172AS_IF([test x$mysqlfail = xtrue], 1512
2173 [AC_MSG_WARN([MySQL not found (or too old), will not create MySQL database support]) 1513AS_IF([test "x$sqlite3" = "x1"],
2174 mysql_msg="unsupported version"]) 1514 [sqlite_msg="yes"
2175AS_IF([test "$sqlite" = true], 1515 features_msg="sqlite $features_msg"],
2176 [features_msg="$features_msg sqlite" 1516 [sqlite_msg="no"])
2177 sqlite_msg="yes"], 1517
2178 [AC_MSG_ERROR([sqlite3 not found, but sqlite3 is required.]) 1518AS_IF([test "x$postgres" = "x1"],
2179 sqlite_msg="no"]) 1519 [postgres_msg="yes"
2180AS_IF([test "$postgres" = true], 1520 features_msg="postgres $features_msg"],
2181 [features_msg="$features_msg postgres" 1521 [postgres_msg="no"])
2182 postgres_msg="yes"], 1522
2183 [postgres_msg="no"]) 1523# Too new versions of Python might cause compatibility issues, so output a
2184# -- features 1524# warning when the version found goes above the recommended maximum version.
2185# ---- 1. replace spaces with newlines, 1525AS_VERSION_COMPARE([$PYTHON_VERSION],[3.8],[],[],
2186# ---- 2. sort the lines, 1526 [AC_MSG_WARN([Your version of Python is not supported, you might see issues])])
2187# ---- 3. replace the newlines with spaces.
2188features_msg=`echo $features_msg | tr ' ' '\012' | sort | tr '\012' ' '`
2189AC_SUBST(features_msg)
2190
2191
2192# The summary
2193# TODO: reduce the length of the last message block, following "IMPORTANT".
2194 1527
2195AC_MSG_NOTICE([ 1528AC_MSG_NOTICE([
2196Detected system 1529Detected system
@@ -2198,59 +1531,65 @@ Detected system
2198 1531
2199GNUnet version: ${VERSION} 1532GNUnet version: ${VERSION}
2200 1533
2201Host setup: ${host} 1534Host Setup: ${host}
2202Install prefix: ${prefix} 1535Install Prefix: ${prefix}
2203Compiler: ${CC} 1536Compiler: ${CC}
2204CFLAGS: ${CFLAGS} 1537CFLAGS: ${CFLAGS}
2205CPPFLAGS: ${CPPFLAGS} 1538CPPFLAGS: ${CPPFLAGS}
2206LDFLAGS: ${LDFLAGS} 1539LDFLAGS: ${LDFLAGS}
2207LIBS: ${LIBS} 1540LIBS: ${LIBS}
2208Build Target: $build_target 1541Build Target: ${build_target}
2209 1542
2210Default Interface: ${interface_msg} 1543Default Interface: ${interface_msg}
2211 1544
2212MySQL: ${mysql_msg}
2213PostgreSQL: ${postgres_msg}
2214sqlite3: ${sqlite_msg} 1545sqlite3: ${sqlite_msg}
2215http client: ${http_client} 1546PostgreSQL: ${postgres_msg}
2216bluetooth: ${bluetooth_msg} 1547
1548cURL TLS backend: ${curl_tls_backend}
1549Bluetooth: ${bluetooth_msg}
2217iptables: ${iptables_msg} 1550iptables: ${iptables_msg}
2218ifconfig: ${ifconfig_msg} 1551ifconfig: ${ifconfig_msg}
2219upnpc: ${upnpc_msg} 1552UPnPc: ${upnpc_msg}
2220gnutls: ${gnutls_msg} 1553GnuTLS: ${gnutls_msg}
1554
1555LaTeX: ${latex_msg}
1556
1557libextractor: ${libextractor_msg}
2221libzbar: ${libzbar_msg} 1558libzbar: ${libzbar_msg}
2222java: ${java_msg} 1559libpng: ${libpng_msg}
2223libidn: ${libidn1_msg}${libidn2_msg} 1560libidn: ${libidn_msg}
2224libopus: ${libopus_msg} 1561libopus: ${libopus_msg}
2225gstreamer: ${gstreamer_msg}
2226libpulse: ${libpulse_msg} 1562libpulse: ${libpulse_msg}
2227libextractor: ${libextractor_msg} 1563gstreamer: ${gstreamer_msg}
2228texi2mdoc: ${texi2mdoc_msg} 1564
1565Java: ${java_msg}
1566
1567doxygen: ${doxy_msg}
2229mandoc: ${mandoc_msg} 1568mandoc: ${mandoc_msg}
2230 1569
2231GNUnet configuration: 1570GNUnet configuration
2232===================== 1571====================
2233transports: ${transport_msg} 1572
2234conversation: ${conversation_msg} 1573Transports: ${transport_msg}
2235database backends: ${features_msg} 1574Conversation: ${conversation_msg}
2236experimental: ${experimental_msg} 1575Database Backends ${features_msg}
1576Experimental Code: ${experimental_msg}
2237 1577
2238texinfo manual: ${texinfo_msg} 1578Transpiled mdocml Manual: ${mdocml_msg}
2239transpiled mdocml manual: ${mdocml_msg}
2240]) 1579])
2241 1580
2242AS_IF([test x$MSG_USER_SETUP != xfalse], 1581AS_IF([test "x$MSG_USER_SETUP" != "xfalse"],
2243 [AC_MSG_WARN([Please make sure NOW to create a user and group 'gnunet' and additionally a group 'gnunetdns'. Make sure that '/var/lib/gnunet' is owned (and writable) by user 'gnunet'.]) 1582 [AC_MSG_WARN([Please make sure NOW to create a user and group 'gnunet' and additionally a group 'gnunetdns'. Make sure that '/var/lib/gnunet' is owned (and writable) by user 'gnunet'.])
2244 AS_IF([test x$HAVE_GNUNET_USER != 0], 1583 AS_IF([test "x$HAVE_GNUNET_USER" != "x0"],
2245 [AC_MSG_NOTICE([To do this on this system, run: 1584 [AC_MSG_NOTICE([To do this on this system, run:
2246# addgroup gnunetdns 1585# addgroup gnunetdns
2247# adduser --system --disabled-login --home /var/lib/gnunet gnunet 1586# adduser --system --disabled-login --home /var/lib/gnunet gnunet
2248])]) 1587])])
2249 AC_MSG_WARN([Each user of GNUnet should be added to the 'gnunet' group.]) 1588 AC_MSG_WARN([Each user of GNUnet should be added to the 'gnunet' group])
2250 AS_IF([test x$HAVE_GNUNET_USER != 0], 1589 AS_IF([test "x$HAVE_GNUNET_USER" != "x0"],
2251 [AC_MSG_NOTICE([To do this on this system, run: 1590 [AC_MSG_NOTICE([To do this on this system, run:
2252# adduser USERNAME gnunet 1591# adduser USERNAME gnunet
2253 for each of your users, replacing \"USERNAME\" with the respective login name. Users may have to login again for the changes to take effect. 1592for each of your users, replacing 'USERNAME' with the respective login name.
2254])])]) 1593Users may have to login again for the changes to take effect.])])])
2255 1594
2256AC_MSG_NOTICE([For detailed setup instructions, type 'info gnunet' after the installation or visit https://docs.gnunet.org/]) 1595AC_MSG_NOTICE([For detailed setup instructions, type 'info gnunet' after the installation or visit https://docs.gnunet.org/])