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