fix #5352
[oweals/gnunet.git] / configure.ac
1 # This file is part of GNUnet.
2 # (C) 2001--2019 GNUnet e.V.
3 #
4 # GNUnet is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU Affero General Public License as published
6 # by the Free Software Foundation, either version 3 of the License,
7 # or (at your option) any later version.
8 #
9 # GNUnet is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Affero General Public License for more details.
13 #
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 #
17 # SPDX-License-Identifier: AGPL3.0-or-later
18 #
19 # Process this file with autoconf to produce a configure script.
20 #
21 #
22 AC_PREREQ(2.61)
23 # Checks for programs.
24 AC_INIT([gnunet], [0.11.2], [bug-gnunet@gnu.org])
25 AC_CONFIG_AUX_DIR([build-aux])
26
27 AC_CANONICAL_TARGET
28 AC_CANONICAL_HOST
29 AC_CANONICAL_SYSTEM
30 AM_INIT_AUTOMAKE
31 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
32 AC_CONFIG_HEADERS([gnunet_config.h])
33 AH_TOP([#define _GNU_SOURCE  1])
34 AC_CONFIG_MACRO_DIR([m4])
35 AC_PROG_AWK
36 AC_PROG_CC_C99
37 AC_PROG_CPP
38 AC_PROG_CXX
39 AC_PROG_OBJC
40 AC_PROG_INSTALL
41 AC_PROG_LN_S
42 AC_PROG_MAKE_SET
43 AM_PROG_CC_C_O
44 LT_INIT([disable-static dlopen win32-dll])
45 AC_SUBST(MKDIR_P)
46
47 # large file support
48 AC_SYS_LARGEFILE
49 AC_FUNC_FSEEKO
50
51
52 CFLAGS="-Wall $CFLAGS"
53 # use '-fno-strict-aliasing', but only if the compiler can take it
54 if gcc -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1;
55 then
56  CFLAGS="-fno-strict-aliasing $CFLAGS"
57 fi
58
59 # Use Linux interface name unless the OS has a different preference
60 DEFAULT_INTERFACE="\"eth0\""
61
62 funcstocheck="getnameinfo gethostname gethostbyname gethostbyaddr getaddrinfo getaddrinfo_a"
63
64 # Srcdir in a form that native compiler understands (i.e. DOS path on W32)
65 native_srcdir=$srcdir
66
67 OLD_LDFLAGS="$LDFLAGS"
68 LDFLAGS="$LDFLAGS -Wl,--unresolved-symbols=report-all"
69
70 # Check system type
71 case "$host_os" in
72 *darwin* | *rhapsody* | *macosx*)
73      AC_DEFINE_UNQUOTED(DARWIN,1,[This is an Apple Darwin system])
74      CPPFLAGS="-D_APPLE_C_SOURCE $CPPFLAGS"
75      CFLAGS="-fno-common $CFLAGS"
76      LDFLAGS="$OLD_LDFLAGS"
77      AC_MSG_WARN([WARNING: The VPN application cannot be compiled on your OS])
78      AC_CHECK_LIB(intl, gettext)
79      build_target="darwin"
80      DEFAULT_INTERFACE="\"en0\""
81      LIBPREFIX=
82      DLLDIR=lib
83      UNIXONLY="#"
84      ;;
85 linux*)
86      AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel])
87      build_target="linux"
88      LIBPREFIX=
89      DLLDIR=lib
90      UNIXONLY="#"
91      AC_PATH_XTRA
92      ;;
93 *freebsd*)
94      AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
95      AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system])
96      CFLAGS="-D_THREAD_SAFE $CFLAGS"
97      build_target="freebsd"
98      LIBPREFIX=
99      DLLDIR=lib
100      UNIXONLY="#"
101      ;;
102 *openbsd*)
103      AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
104      AC_DEFINE_UNQUOTED(OPENBSD,1,[This is an OpenBSD system])
105      LIBS=`echo $LIBS | sed -e "s/-ldl//"`
106      build_target="openbsd"
107      LIBPREFIX=
108      DLLDIR=lib
109      UNIXONLY="#"
110      ;;
111 *netbsd*)
112      AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
113      AC_DEFINE_UNQUOTED(NETBSD,1,[This is a NetBSD system])
114      LIBPREFIX=
115      DLLDIR=lib
116      UNIXONLY="#"
117      ;;
118 *solaris*)
119      AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system])
120      AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno doesnt work])
121      AC_CHECK_LIB(resolv, res_init)
122      AC_CHECK_LIB(rt, nanosleep)
123      build_target="solaris"
124      LIBPREFIX=
125      DLLDIR=lib
126      UNIXONLY="#"
127      ;;
128 *arm-linux*)
129      AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel])
130      CFLAGS="-D_REENTRANT -fPIC -pipe $CFLAGS"
131      build_target="linux"
132      LIBPREFIX=
133      DLLDIR=lib
134      UNIXONLY="#"
135      ;;
136 *cygwin*)
137      AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system])
138      AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
139      AC_CHECK_LIB(intl, gettext)
140      CFLAGS="-mms-bitfields $CFLAGS"
141      build_target="cygwin"
142      LIBPREFIX=lib
143      DLLDIR=bin
144      AC_PROG_CXX
145      UNIXONLY=""
146      ;;
147 *mingw*)
148      AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
149      AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
150      AC_DEFINE_UNQUOTED(_WIN32,1,[This is a Windows system])
151      AC_CHECK_LIB(intl, gettext)
152      LDFLAGS="$LDFLAGS -Wl,--export-all-symbols"
153      LIBS="$LIBS -lws2_32 -lplibc -lgnurx -lole32"
154      CFLAGS="-mms-bitfields $CFLAGS"
155      CPPFLAGS="-D_WIN32_WINNT=0x0501 -DHAVE_STAT64=1 -D__USE_MINGW_ANSI_STDIO=1 $CPPFLAGS"
156      build_target="mingw"
157      AC_PROG_CXX
158      LIBPREFIX=lib
159      DLLDIR=bin
160      UNIXONLY=""
161      funcstocheck=""
162      native_srcdir=$(cd $srcdir; pwd -W)
163      ;;
164 gnu*)
165      AC_DEFINE_UNQUOTED(GNU,1,[This is a GNU system])
166      build_target="gnu"
167      UNIXONLY="#"
168      ;;
169 *)
170      AC_MSG_RESULT(Unrecognised OS $host_os)
171      AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS])
172      UNIXONLY=""
173 ;;
174 esac
175 AC_DEFINE_UNQUOTED([GNUNET_DEFAULT_INTERFACE], $DEFAULT_INTERFACE, [This should be the default choice for the name of the first network interface])
176 AC_SUBST(DEFAULT_INTERFACE)
177
178 # Disable TCP-based IPC on systems that support UNIX domain
179 # sockets in default configuratin:
180 AC_SUBST(UNIXONLY)
181
182
183 AC_MSG_CHECKING([for build target])
184 AM_CONDITIONAL(DARWIN,  test "$build_target" = "darwin")
185 AM_CONDITIONAL(CYGWIN,  test "$build_target" = "cygwin")
186 AM_CONDITIONAL(MINGW,   test "$build_target" = "mingw")
187 AM_CONDITIONAL(SOLARIS, test "$build_target" = "solaris")
188 AM_CONDITIONAL(XFREEBSD, test "$build_target" = "freebsd")
189 AM_CONDITIONAL(OPENBSD, test "$build_target" = "openbsd")
190 AM_CONDITIONAL(LINUX, test "$build_target" = "linux")
191 AM_CONDITIONAL(GNU, test "$build_target" = "gnu")
192
193 AC_MSG_RESULT([$build_target])
194 AC_SUBST(build_target)
195 AM_CONDITIONAL([am__fastdepOBJC], false)
196 AC_UNALIGNED_64_ACCESS
197
198 # some other checks for standard libs
199 AC_SEARCH_LIBS([gethostbyname], [nsl ws2_32])
200 AC_SEARCH_LIBS([memrchr], [],
201                AC_DEFINE(HAVE_MEMRCHR,1,[memrchr supported]), [])
202 AC_CHECK_LIB(socket, socket)
203 AC_CHECK_LIB(m, log)
204 AC_CHECK_LIB(c, getloadavg, AC_DEFINE(HAVE_GETLOADAVG,1,[getloadavg supported]))
205
206 AC_CHECK_PROG(VAR_GETOPT_BINARY, getopt, true, false)
207 AM_CONDITIONAL(HAVE_GETOPT_BINARY, $VAR_GETOPT_BINARY)
208
209 AC_CHECK_PROG(VAR_SSH_BINARY, ssh, true, false)
210 AM_CONDITIONAL(HAVE_SSH_BINARY, $VAR_SSH_BINARY)
211 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)
212 rm -f /tmp/gnunet_test_cosks_ssh_garbage
213
214 # autotools' m4 for python has no maximum version!
215 # python3.4 - python3.7 for tests
216 m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[python3 python3.4 python3.5 python3.6 python3.7 python])
217 AM_PATH_PYTHON([3.4],, [:])
218 AC_SUBST([PYTHON])
219 AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
220
221 # perl
222 AC_PATH_PROG( PERL, perl, ,
223               $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
224 AC_SUBST([PERL])
225
226 # iptables is a soft requirement to run tests
227 AC_PATH_TARGET_TOOL(VAR_IPTABLES_BINARY, iptables, false)
228
229 if test x"$VAR_IPTABLES_BINARY" = x"false"
230 then
231   if test -x "/sbin/iptables"
232   then
233     VAR_IPTABLES_BINARY="/sbin/iptables"
234   elif test -x "/usr/sbin/iptables"
235   then
236     VAR_IPTABLES_BINARY="/usr/sbin/iptables"
237   fi
238 fi
239
240 if test x"$VAR_IPTABLES_BINARY" != x"false"
241 then
242 AC_DEFINE_UNQUOTED([IPTABLES], "$VAR_IPTABLES_BINARY", [Path to iptables])
243 else
244 AC_MSG_WARN([warning: 'iptables' not found.])
245 fi
246
247 # ip6tables is a soft requirement for some features
248 AC_PATH_TARGET_TOOL(VAR_IP6TABLES_BINARY, ip6tables, false)
249
250 if test x"$VAR_IP6TABLES_BINARY" = x"false"
251 then
252   if test -x "/sbin/ip6tables"
253   then
254     VAR_IP6TABLES_BINARY="/sbin/ip6tables"
255   elif test -x "/usr/sbin/ip6tables"
256   then
257     VAR_IP6TABLES_BINARY="/usr/sbin/ip6tables"
258   fi
259 fi
260
261 if test x"$VAR_IP6TABLES_BINARY" != x"false"
262 then
263 AC_DEFINE_UNQUOTED([IP6TABLES], "$VAR_IP6TABLES_BINARY", [Path to ip6tables])
264 else
265 AC_MSG_WARN([warning: 'ip6tables' not found.])
266 fi
267
268 # ip is a soft requirement for some features
269 AC_PATH_TARGET_TOOL(VAR_IP_BINARY, ip, false)
270
271 if test x"$VAR_IP_BINARY" = x"false"
272 then
273   if test -x "/sbin/ip"
274   then
275     VAR_IP_BINARY="/sbin/ip"
276   elif test -x "/usr/sbin/ip"
277   then
278     VAR_IP_BINARY="/usr/sbin/ip"
279   fi
280 fi
281
282 if test x"$VAR_IP_BINARY" != x"false"
283 then
284 AC_DEFINE_UNQUOTED([PATH_TO_IP], "$VAR_IP_BINARY", [Path to ip])
285 else
286 AC_MSG_WARN([warning: 'ip' not found.])
287 fi
288
289 # locate 'ifconfig'
290 AC_PATH_TARGET_TOOL(VAR_IFCONFIG_BINARY, ifconfig, false)
291
292 AC_CHECK_PROG(VAR_IFCONFIG_BINARY, ifconfig, true, false)
293 if test x"$VAR_IFCONFIG_BINARY" = x"false"
294 then
295   if test -x "/sbin/ifconfig"
296   then
297     VAR_IFCONFIG_BINARY="/sbin/ifconfig"
298   elif test -x "/usr/sbin/ifconfig"
299   then
300     VAR_IFCONFIG_BINARY="/usr/sbin/ifconfig"
301   fi
302 fi
303 if test x"$VAR_IFCONFIG_BINARY" != x"false"
304 then
305 AC_DEFINE_UNQUOTED([IFCONFIG], "$VAR_IFCONFIG_BINARY", [Path to ifconfig])
306 else
307 AC_MSG_WARN(['ifconfig' not found.])
308 fi
309
310
311 AC_PATH_TARGET_TOOL(VAR_SYSCTL_BINARY, sysctl, false)
312
313 AC_CHECK_PROG(VAR_SYSCTL_BINARY, sysctl, true, false)
314 AS_IF([test x"$VAR_SYSCTL_BINARY" = x"false"],
315       [AS_IF([test -x "/sbin/sysctl"],
316              [VAR_SYSCTL_BINARY="/sbin/sysctl"],
317              [AS_IF([test -x "/usr/sbin/sysctl"],
318                     [VAR_SYSCTL_BINARY="/usr/sbin/sysctl"])])])
319 AS_IF([test x"$VAR_SYSCTL_BINARY" != x"false"],
320       [AC_DEFINE_UNQUOTED([SYSCTL], "$VAR_SYSCTL_BINARY", [Path to sysctl])],
321       [AC_MSG_WARN(['sysctl' not found.])])
322
323 # miniupnpc / upnpc binary is a soft runtime requirement
324 AC_PATH_TARGET_TOOL(VAR_UPNPC_BINARY, upnpc, false)
325
326 if test x"$VAR_UPNPC_BINARY" != x"false"
327 then
328 AC_DEFINE_UNQUOTED([UPNPC], "$VAR_UPNPC_BINARY", [Path to upnpc binary])
329 else
330 AC_MSG_WARN([warning: 'upnpc' binary not found.])
331 fi
332
333 AC_CHECK_MEMBER(struct tm.tm_gmtoff,
334   [AC_DEFINE(HAVE_TM_GMTOFF, 1,
335      [Define if struct tm has the tm_gmtoff member.])],
336      ,
337      [#include <time.h>])
338
339 AC_CHECK_DECLS([_stati64])
340
341 # 'save' libs; only those libs found so far will be
342 # linked against _everywhere_.  For the others, we
343 # will be more selective!
344 SAVE_LIBS=$LIBS
345
346 have_addrinfo_a=0
347 AC_CHECK_LIB(anl, getaddrinfo_a, [have_addrinfo_a=1 AC_DEFINE(HAVE_GETADDRINFO_A,1,[getaddrinfo_a supported])])
348 AM_CONDITIONAL(HAVE_GETADDRINFO_A, [test "$have_addrinfo_a" = 1])
349
350
351 # tests only run on Windows
352 if test "x$build_target" = "xmingw"
353 then
354   AC_CHECK_LIB(plibc, plibc_init, [], [AC_MSG_ERROR([GNUnet requires PlibC on Windows])])
355   AC_CHECK_LIB(gnurx, regexec, [], [AC_MSG_ERROR([GNUnet requires libgnurx on Windows])])
356 fi
357
358 # libgcrypt
359 gcrypt=0
360 NEED_LIBGCRYPT_API=1
361 NEED_LIBGCRYPT_VERSION=1.6.0
362
363
364 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION", gcrypt=1)
365 AC_CHECK_DECLS([gcry_mpi_set_opaque_copy], [], [], [[#include <gcrypt.h>]])
366
367 if test $gcrypt = 0
368 then
369   AC_MSG_ERROR([[
370 ***
371 *** You need libgcrypt to build this program.
372 **  This library is for example available at
373 ***   ftp://ftp.gnupg.org/gcrypt/libgcrypt/
374 *** (at least version $NEED_LIBGCRYPT_VERSION (API $NEED_LIBGCRYPT_API)
375 ***  is required.)
376 ***]])
377 fi
378 AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], "$NEED_LIBGCRYPT_VERSION", [required libgcrypt version])
379
380 AC_CHECK_DECLS([struct in6_ifreq], [], [], [[#include <linux/if_tun.h>]])
381
382
383
384 # should the build process be building the documentation?
385 AC_MSG_CHECKING(whether to build documentation)
386 AC_ARG_ENABLE([documentation],
387    [AS_HELP_STRING([--disable-documentation], [do not build the documentation])],
388    [documentation=${enableval}],
389    [documentation=yes])
390 AC_MSG_RESULT($documentation)
391 if test "x$documentation" = "xyes"
392 then
393   AM_CONDITIONAL([DOCUMENTATION],true)
394   AC_DEFINE([DOCUMENTATION],[1],[Building the documentation])
395 else
396   AM_CONDITIONAL([DOCUMENTATION],false)
397   AC_DEFINE([DOCUMENTATION],[0],[Not building the documentation])
398 fi
399
400 # FIXME: Something is wrong about this in the output of ./configure runs
401 AC_MSG_CHECKING(wether to include generated texi2mdoc output in installation)
402 AC_ARG_ENABLE([texi2mdoc-generation],
403     [AS_HELP_STRING([--enable-texi2mdoc-generation], [include generated texi2mdoc output in installation])],
404     [texi2mdoc_generation=${enableval}],
405     [texi2mdoc_generation=no])
406 AC_MSG_RESULT($texi2mdoc_generation)
407 if test "x$texi2mdoc_generation" = "xyes"
408 then
409   if test "$texi2mdoc" = 0
410   then
411   AC_MSG_WARN([ERROR: mdoc output currently requires texi2mdoc.])
412   AC_MSG_WARN([ERROR: texi2mdoc can be obtained via your Operating System])
413   AC_MSG_WARN([ERROR: package manager or from https://mandoc.bsd.lv/texi2mdoc/])
414   else
415   AM_CONDITIONAL([TEXI2MDOC_GENERATION],true)
416   AC_DEFINE([TEXI2MDOC_GENERATION],[1],[Building section 7 mdoc output])
417   fi
418 else
419   AM_CONDITIONAL([TEXI2MDOC_GENERATION],false)
420   AC_DEFINE([TEXI2MDOC_GENERATION],[0],[Not building section 7 mdoc output])
421 fi
422
423 # should the build process be building only the documentation?
424 AC_MSG_CHECKING(whether to build only documentation)
425 AC_ARG_ENABLE([documentation-only],
426    [AS_HELP_STRING([--enable-documentation-only], [build only the documentation])],
427    [documentation_only=${enableval}],
428    [documentation_only=no])
429 AC_MSG_RESULT($documentation_only)
430 if test "x$documentation_only" = "xyes"
431 then
432   AM_CONDITIONAL([DOCUMENTATION_ONLY],true)
433   AC_DEFINE([DOCUMENTATION_ONLY],[1],[Building only the documentation])
434 else
435   AM_CONDITIONAL([DOCUMENTATION_ONLY],false)
436   AC_DEFINE([DOCUMENTATION_ONLY],[0],[Not building only the documentation])
437 fi
438
439 # should the build process be including the manpages? (default: yes)
440 AC_MSG_CHECKING(whether to include man pages)
441 AC_ARG_ENABLE([include-manpages],
442    [AS_HELP_STRING([--disable-include-manpages], [Do not include the man pages in build and installation])],
443    [include_manpages=${enableval}],
444    [include_manpages=yes])
445 AC_MSG_RESULT($include_manpages)
446 if test "x$include_manpages" = "xyes"
447 then
448   AM_CONDITIONAL([INCLUDE_MANPAGES],true)
449   AC_DEFINE([INCLUDE_MANPAGES],[1],[Including the man pages in the build and installation])
450 else
451   AM_CONDITIONAL([INCLUDE_MANPAGES],false)
452   AC_DEFINE([INCLUDE_MANPAGES],[0],[Not including the man pages in the build and installation])
453 fi
454
455 # Adam shostack suggests the following for Windows:
456 # -D_FORTIFY_SOURCE=2 -fstack-protector-all
457 AC_ARG_ENABLE(gcc-hardening,
458    AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks),
459 [if test x$enableval = xyes; then
460     CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all"
461     CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector"
462     CFLAGS="$CFLAGS --param ssp-buffer-size=1"
463     LDFLAGS="$LDFLAGS -pie"
464 fi])
465
466 # Linker hardening options
467 # Currently these options are ELF specific - you can't use this with MacOSX
468 AC_ARG_ENABLE(linker-hardening,
469   AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups),
470 [if test x$enableval = xyes; then
471    LDFLAGS="$LDFLAGS -z relro -z now"
472 fi])
473
474
475 AC_ARG_ENABLE(sanitizer,
476   AS_HELP_STRING(--enable-sanitizer, enable Address Sanitizer and Undefined Behavior Sanitizer),
477 [if test x$enableval = xyes; then
478    LDFLAGS="$CFLAGS -fsanitize=address,undefined -fno-omit-frame-pointer"
479 fi])
480
481
482 extra_logging=GNUNET_NO
483 AC_ARG_ENABLE([logging],
484    AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose,veryverbose ('yes' is the default)]),
485    [AS_IF([test "x$enableval" = "xyes"], [],
486           [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])],
487           [test "x$enableval" = "xverbose"], [extra_logging=GNUNET_YES]
488           [test "x$enableval" = "xveryverbose"], [extra_logging=\(GNUNET_YES+1\)])
489    ], [])
490 AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise])
491
492 # should memory poisoning be enabled?
493 AC_MSG_CHECKING(whether to poison freed memory)
494 AC_ARG_ENABLE([poisoning],
495    [AS_HELP_STRING([--enable-poisoning], [enable poisoning of freed memory (good for debugging)])],
496    [enable_poisoning=${enableval}],
497    [
498      if test "x$extra_logging" != "xGNUNET_NO"; then
499        enable_poisoning="defaults to yes (extra logging is enabled)"
500      else
501        enable_poisoning=no
502      fi
503    ])
504 AC_MSG_RESULT($enable_poisoning)
505 if test ! "x$enable_poisoning" = "xno"; then
506   enable_poisoning=1
507 else
508   enable_poisoning=0
509 fi
510 AC_DEFINE_UNQUOTED([ENABLE_POISONING],[$enable_poisoning],[1 if freed memory should be poisoned, 0 otherwise])
511
512 if test $build = $target
513 then
514 AC_MSG_CHECKING([for working HMAC])
515 AC_LANG_PUSH(C)
516 LIBS="$LIBS $LIBGCRYPT_LIBS"
517 CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
518 AC_RUN_IFELSE(
519   [AC_LANG_PROGRAM([#include <gcrypt.h>
520         #include <stdio.h>], [[
521         gcry_md_hd_t mac;
522
523         unsigned char data[] = { 0xbf, 0x16, 0x6e, 0x46, 0x3a, 0x6c, 0xf3, 0x93, 0xa7, 0x72,
524             0x11, 0xa1, 0xdc, 0x0b, 0x07, 0xdb, 0x1a, 0x5e, 0xd9, 0xb9, 0x81, 0xbe,
525             0xea, 0xe4, 0x31, 0x5f, 0x24, 0xff, 0xfe, 0x50, 0x8a, 0xde };
526         unsigned char key[] = { 0xfc, 0x62, 0x76, 0x35 };
527         unsigned char result[] = {0xa2, 0xb, 0x1, 0xd9, 0xc0, 0x8b, 0x5a, 0x12, 0x80,
528             0xd5, 0x50, 0x12, 0x8e, 0xd0, 0x5b, 0xb6, 0x5c, 0x87, 0x24, 0xe2, 0xd0,
529             0xd2, 0xaf, 0x63, 0xae, 0xd1, 0xd6, 0x64, 0x14, 0xe3, 0x6e, 0x61, 0x5b,
530             0xd, 0xba, 0x17, 0x7d, 0xd3, 0x10, 0xb1, 0x37, 0x41, 0x91, 0x7d, 0xeb,
531             0x1, 0x4d, 0x71, 0xe8, 0x59, 0x71, 0x42, 0x8e, 0xd6, 0xf3, 0x29, 0x3b,
532             0x90, 0xf2, 0xd1, 0xaf, 0x65, 0x1e, 0xb3};
533
534         if (!gcry_check_version (GCRYPT_VERSION))
535         {
536           fprintf (stderr, "Version mismatch %s <-> %s \n", gcry_check_version (NULL), GCRYPT_VERSION);
537           return 1;
538         }
539
540         gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
541         gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
542
543         if (gcry_md_open(&mac, GCRY_MD_SHA512, GCRY_MD_FLAG_HMAC) != GPG_ERR_NO_ERROR)
544         {
545           fprintf (stderr, "gcry_md_open error\n");
546           return 2;
547         }
548
549         gcry_md_setkey (mac, key, sizeof (key));
550         gcry_md_write (mac, data, sizeof (data));
551
552         if (memcmp(gcry_md_read (mac, 0), result, gcry_md_get_algo_dlen (gcry_md_get_algo (mac))) != 0)
553         {
554           fprintf (stderr, "memcmp error\n");
555           return 3;
556         }
557
558         gcry_md_close (mac);
559
560         return 0;
561     ]])],
562   [AC_MSG_RESULT([yes])],
563   [
564    RESULT=$?
565    if test $RESULT = 3
566    then
567      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.])
568    fi
569    if test $RESULT = 2
570    then
571      AC_MSG_FAILURE([HMAC test failed])
572    fi
573    if test $RESULT = 1
574    then
575      AC_MSG_FAILURE([libgcrypt header version does not match library version])
576    fi
577   ],
578   [AC_MSG_RESULT([cross compiling, test skipped])])
579 AC_LANG_POP(C)
580 fi      # $build = $target
581
582 # check for bluetooth library
583 bluetooth=0
584 AC_CHECK_LIB(bluetooth, ba2str,[AC_CHECK_HEADER([bluetooth/bluetooth.h],bluetooth=1)])
585 if test "$build_target" = "mingw"
586 then
587   bluetooth=1
588 fi
589 AM_CONDITIONAL(HAVE_LIBBLUETOOTH, [test "$bluetooth" = 1])
590 if test "$bluetooth" = 1
591 then
592   AC_DEFINE([HAVE_LIBBLUETOOTH],[1],[Have bluetooth library])
593 else
594   AC_DEFINE([HAVE_LIBBLUETOOTH],[0],[Lacking bluetooth library])
595 fi
596
597 # check for zbar library
598 zbar=0
599 AC_MSG_CHECKING(for libzbar)
600 AC_ARG_WITH(zbar,
601    [  --with-zbar=PFX    base of libzbar installation],
602    [AC_MSG_RESULT([$with_zbar])
603     case $with_zbar in
604       no)
605         ;;
606       yes)
607         AC_CHECK_HEADERS(zbar.h,
608           AC_CHECK_LIB([zbar], [zbar_processor_create],
609             zbar=1))
610         ;;
611       *)
612         LDFLAGS="-L$with_zbar/lib $LDFLAGS"
613         CPPFLAGS="-I$with_zbar/include $CPPFLAGS"
614         AC_CHECK_HEADERS(zbar.h,
615           AC_CHECK_LIB([zbar], [zbar_processor_create],
616             EXT_LIB_PATH="-L$with_zbar/lib $EXT_LIB_PATH"
617             zbar=1))
618         ;;
619     esac
620    ],
621    [AC_MSG_RESULT([--with-zbar not specified])
622     AC_CHECK_HEADERS(zbar.h,
623      AC_CHECK_LIB([zbar], [zbar_processor_create],
624       zbar=1))])
625 AM_CONDITIONAL(HAVE_ZBAR, [test "$zbar" = 1])
626 AS_IF([test "x$zbar" = x1],
627       [AC_DEFINE([HAVE_ZBAR],[1],[Have zbar library])],
628       [AC_DEFINE([HAVE_ZBAR],[0],[Lacking zbar library])])
629
630 # check for jansson library
631 jansson=0
632 AC_MSG_CHECKING(for libjansson)
633 AC_ARG_WITH(jansson,
634    [  --with-jansson=PFX    base of libjansson installation],
635    [AC_MSG_RESULT([$with_jansson])
636     case $with_jansson in
637       no)
638         ;;
639       yes)
640         AC_CHECK_HEADERS(jansson.h,
641           AC_CHECK_LIB([jansson], [json_loads],
642             jansson=1))
643         ;;
644       *)
645         LDFLAGS="-L$with_jansson/lib $LDFLAGS"
646         CPPFLAGS="-I$with_jansson/include $CPPFLAGS"
647         AC_CHECK_HEADERS(jansson.h,
648           AC_CHECK_LIB([jansson], [json_loads],
649             EXT_LIB_PATH="-L$with_jansson/lib $EXT_LIB_PATH"
650             jansson=1))
651         ;;
652     esac
653    ],
654    [AC_MSG_RESULT([--with-jansson not specified])
655     AC_CHECK_HEADERS(jansson.h,
656      AC_CHECK_LIB([jansson], [json_loads],
657       jansson=1))])
658 AM_CONDITIONAL(HAVE_JANSSON, [test "$jansson" = 1])
659 AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1])
660 AS_IF([test "x$jansson" = x1],
661       [AC_DEFINE([HAVE_JANSSON],[1],[Have jansson library])],
662       [AC_DEFINE([HAVE_JANSSON],[0],[Lacking jansson library])])
663
664
665 # check for libpulse(audio) library
666 pulse=0
667 AC_CHECK_LIB(pulse,pa_stream_peek,
668   [AC_CHECK_HEADER([pulse/simple.h],pulse=1)])
669 AS_IF([test "$build_target" = "mingw"],
670       [pulse=0])
671 AS_IF([test "$pulse" = 1],
672       [AC_DEFINE([HAVE_PULSE],[1],[Have libpulse(audio) library])])
673
674 # check for libopus(audio) library
675 opus=0
676 AC_CHECK_LIB(opus,opus_decode_float,
677   [AC_CHECK_HEADER([opus/opus.h],
678     [AC_CHECK_DECL([OPUS_SET_GAIN],[opus=1],[],[[#include <opus/opus.h>]]
679     )]
680   )]
681 )
682 AS_IF([test "x$opus" = x1],
683       [AC_DEFINE([HAVE_OPUS],[1],[Have libopus library])])
684
685 # libogg
686 AC_CHECK_LIB(ogg, ogg_stream_flush_fill,
687         [AC_CHECK_HEADERS([ogg/ogg.h],
688           AM_CONDITIONAL(HAVE_OGG, true)
689           ogg=1
690           AC_DEFINE(HAVE_OGG,1,[Have ogg]),
691           AM_CONDITIONAL(HAVE_OGG, false)
692           ogg=0
693           AC_DEFINE(HAVE_OGG,0,[lacking ogg]))],
694         AM_CONDITIONAL(HAVE_OGG, false)
695         ogg=0)
696
697
698 PKG_CHECK_MODULES([GLIB],
699                   [glib-2.0],
700   [# check for pbc library
701   pbc=0
702    AC_CHECK_HEADER([pbc/pbc.h],pbc=1)
703    AC_CHECK_HEADER([gabe.h],abe=1)
704    AM_CONDITIONAL(HAVE_PBC, [test "x$pbc" = x1])
705    AM_CONDITIONAL(HAVE_ABE, [test "x$abe" = x1])
706    AS_IF([test "x$pbc" = x1],
707      [AC_DEFINE([HAVE_PBC],[1],[Have pbc library])],
708      [AC_DEFINE([HAVE_PBC],[0],[Lacking pbc library])])
709    AS_IF([test "x$abe" = x1],
710     [AC_DEFINE([HAVE_ABE],[1],[Have ABE library])],
711     [AC_DEFINE([HAVE_ABE],[0],[Lacking ABE library])])],
712   [# glib-2 not found
713    AM_CONDITIONAL(HAVE_PBC, [false])
714    AM_CONDITIONAL(HAVE_ABE, [false])
715    AC_DEFINE([HAVE_PBC],[0],[Lacking glib library])])
716
717 gst=0
718 PKG_CHECK_MODULES(
719   [GST],
720   [glib-2.0 gobject-2.0 gstreamer-1.0 gstreamer-app-1.0 gstreamer-audio-1.0],
721   [gst=1],
722   [gst=0])
723
724 # Pulse Audio
725 if test "x$pulse" != "x1" -o "x$opus" != "x1" -o "x$ogg" != "x1"
726 then
727  if test "x$gst" != "x1"
728  then
729   conversation_backend=none
730   AM_CONDITIONAL(BUILD_PULSE_HELPERS, false)
731   AM_CONDITIONAL(BUILD_GST_HELPERS, false)
732   AM_CONDITIONAL(BUILD_EXPERIMENTAL_HELPERS, false)
733  else
734    conversation_backend=gst
735    AM_CONDITIONAL(BUILD_PULSE_HELPERS, false)
736    AM_CONDITIONAL(BUILD_GST_HELPERS, true)
737    AM_CONDITIONAL(BUILD_EXPERIMENTAL_HELPERS, false)
738  fi
739 else
740
741  conversation_backend=pulse
742  AM_CONDITIONAL(BUILD_PULSE_HELPERS, true)
743  AM_CONDITIONAL(BUILD_GST_HELPERS, false)
744  AM_CONDITIONAL(BUILD_EXPERIMENTAL_HELPERS, false)
745 fi
746
747 # libgnurl
748 LIBGNURL_CHECK_CONFIG(,7.34.0,gnurl=1,gnurl=0)
749 if test "$gnurl" = 1
750 then
751         AM_CONDITIONAL(HAVE_LIBGNURL, true)
752         AC_DEFINE([HAVE_LIBGNURL],[1],[Have libgnurl])
753 else
754         AM_CONDITIONAL(HAVE_LIBGNURL, false)
755         AC_DEFINE([HAVE_LIBGNURL],[0],[Lacking libgnurl])
756 fi
757
758 SAVE_CPPFLAGS=$CPPFLAGS
759 CPPFLAGS="$LIBGNURL_CPPFLAGS $LIBCURL_CPPFLAGS $CPPFLAGS"
760 LIBS="$LIBGNURL $LIBCURL $LIBS"
761
762 # libcurl-gnutls
763 LIBCURL_CHECK_CONFIG(,7.34.0,[curl=true],[curl=false])
764 if test "x$curl" = xtrue
765 then
766
767  AC_CHECK_HEADERS([curl/curl.h],
768   AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=true],[curl=false],[[#include <curl/curl.h>]]),
769   [curl=false])
770  AC_CHECK_HEADERS([gnurl/curl.h],
771   AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=true],,[[#include <gnurl/curl.h>]]))
772  # need libcurl-gnutls.so, everything else is not acceptable
773  AC_CHECK_LIB([curl-gnutls],[curl_easy_getinfo],,[curl=false])
774  # cURL must support CURLINFO_TLS_SESSION, version >= 7.34
775 fi
776
777 # Check for curl/curl.h and gnurl/curl.h so we can use #ifdef
778 # HAVE_CURL_CURL_H later (the above LIBCURL_CHECK_CONFIG accepted
779 # *either* header set).
780 AC_CHECK_HEADERS([curl/curl.h],,
781   curl=false
782   AC_CHECK_HEADERS([gnurl/curl.h],,
783   gnurl=false))
784
785
786
787 if test x$curl = xfalse
788 then
789         AM_CONDITIONAL(HAVE_LIBCURL, false)
790 if test "$gnurl" = 0
791 then
792         AC_MSG_WARN([ERROR: GNUnet requires libcurl-gnutls or gnurl >= 7.34])
793 fi
794 else
795         AM_CONDITIONAL(HAVE_LIBCURL, true)
796         AC_DEFINE([HAVE_LIBCURL],[1],[Have CURL])
797 fi
798
799 AC_SEARCH_LIBS(__atomic_load_8, atomic, [have_libatomic=1 AC_DEFINE(HAVE_LIBATOMIC,1,[external libatomic])])
800 AM_CONDITIONAL(HAVE_LIBATOMIC, [test "$have_libatomic" = 1])
801
802 # restore LIBS & CPPFLAGS
803 LIBS=$SAVE_LIBS
804 CPPFLAGS=$SAVE_CPPFLAGS
805
806 AC_CHECK_HEADERS([glpk.h],[glpk=true],[glpk=false])
807 # GLPK must support glpk_init_env, version >= 4.43
808 AC_CHECK_LIB([glpk],[glp_init_env],,[glpk=false])
809 # GLPK must support atm MLP presolving, version >= 4.32
810 AC_CHECK_MEMBERS(glp_iocp.presolve,,[glpk=false],[[#include <glpk.h>]])
811 if test "x$glpk" = xfalse
812 then
813         AM_CONDITIONAL(HAVE_LIBGLPK, false)
814         AC_MSG_WARN([ERROR: GNUnet requires GLPK  >= 4.32])
815 else
816         AM_CONDITIONAL(HAVE_LIBGLPK, true)
817         AC_DEFINE([HAVE_LIBGLPK],[1],[Have GLPK])
818 fi
819
820
821 AC_CHECK_HEADERS([nss.h],[nss=true],[nss=false])
822 if test x$nss = xfalse
823 then
824         AM_CONDITIONAL(HAVE_GLIBCNSS, false)
825         AC_MSG_WARN([No GNU libc nss header, will not build NSS plugin])
826 else
827         NSS_INCLUDES="
828         #include <nss.h>
829         "
830         AC_CHECK_DECL([NSS_STATUS_UNAVAIL],
831                 [AM_CONDITIONAL(HAVE_GLIBCNSS, true)],
832                 [AM_CONDITIONAL(HAVE_GLIBCNSS, false)
833                  AC_MSG_WARN([No nss header fails to define NSS_STATUS_UNAVAIl, will not build NSS plugin])],
834                 [$NSS_INCLUDES])
835 fi
836
837
838
839 # test for kvm and kstat (for CPU stats under BSD/Solaris)
840 AC_CHECK_LIB([kvm],[kvm_open])
841 AC_CHECK_LIB([kstat],[kstat_open])
842
843
844 # should the build process be restricted to the code required
845 # for GNU Taler wallets?
846 AC_MSG_CHECKING(whether to compile GNU Taler Wallet library ONLY)
847 AC_ARG_ENABLE([taler-wallet],
848    [AS_HELP_STRING([--enable-taler-wallet], [only compile for Taler wallet])],
849    [taler_only=${enableval}],
850    [taler_only=no])
851 AC_MSG_RESULT($taler_only)
852 if test "x$taler_only" = "xyes"
853 then
854   AM_CONDITIONAL([TALER_ONLY],true)
855   AC_DEFINE([TALER_WALLET_ONLY],[1],[Compiling for Taler wallet])
856 else
857   AM_CONDITIONAL([TALER_ONLY],false)
858   AC_DEFINE([TALER_WALLET_ONLY],[0],[Canonical compilation])
859 fi
860
861 # test for libextractor
862 extractor=0
863 AC_MSG_CHECKING(for libextractor)
864 AC_ARG_WITH(extractor,
865    [  --with-extractor=PFX    base of libextractor installation],
866    [AC_MSG_RESULT([$with_extractor])
867     case $with_extractor in
868       no)
869         ;;
870       yes)
871         AC_CHECK_HEADERS([extractor.h],
872           AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
873             extractor=1))
874         ;;
875       *)
876         LDFLAGS="-L$with_extractor/lib $LDFLAGS"
877         CPPFLAGS="-I$with_extractor/include $CPPFLAGS"
878         AC_CHECK_HEADERS([extractor.h],
879           AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
880             EXT_LIB_PATH="-L$with_extractor/lib $EXT_LIB_PATH"
881             extractor=1))
882         ;;
883     esac
884    ],
885    [AC_MSG_RESULT([--with-extractor not specified])
886     AC_CHECK_HEADERS([extractor.h],
887      AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
888       extractor=1))])
889 # restore LIBS
890 LIBS=$SAVE_LIBS
891
892 if test "$extractor" != 1
893 then
894  AM_CONDITIONAL(HAVE_LIBEXTRACTOR, false)
895  AC_DEFINE([HAVE_LIBEXTRACTOR],[0],[Lacking libextractor])
896 else
897  AM_CONDITIONAL(HAVE_LIBEXTRACTOR, true)
898  AC_DEFINE([HAVE_LIBEXTRACTOR],[1],[Have libextractor])
899 fi
900
901
902 if test "$taler_only" != yes
903 then
904
905 # Check for libltdl header (#2999)
906 ltdl=0
907 AC_MSG_CHECKING(for libltdl)
908 AC_ARG_WITH(ltdl,
909    [  --with-ltdl=PFX    base of libltdl installation],
910    [AC_MSG_RESULT([$with_ltdl])
911     case $with_ltdl in
912       no)
913         ;;
914       yes)
915         AC_CHECK_HEADERS(ltdl.h,
916           AC_CHECK_LIB([ltdl], [lt_dlopenext],
917             ltdl=1))
918         ;;
919       *)
920         LDFLAGS="-L$with_ltdl/lib $LDFLAGS"
921         CPPFLAGS="-I$with_ltdl/include $CPPFLAGS"
922         AC_CHECK_HEADERS(ltdl.h,
923           AC_CHECK_LIB([ltdl], [lt_dlopenext],
924             EXT_LIB_PATH="-L$with_ltdl/lib $EXT_LIB_PATH"
925             ltdl=1))
926         ;;
927     esac
928    ],
929    [AC_MSG_RESULT([--with-ltdl not specified])
930     AC_CHECK_HEADERS(ltdl.h,
931      AC_CHECK_LIB([ltdl], [lt_dlopenext],
932       ltdl=1))])
933 if test x$ltdl = x1
934 then
935  AC_MSG_RESULT([libltdl found])
936 else
937  AC_MSG_ERROR([GNUnet requires libltdl (from GNU libtool), try installing libltdl-dev])
938 fi
939 # restore LIBS
940 LIBS=$SAVE_LIBS
941
942 # libidn and libidn2. The ideal goal is this:
943 # check for libidn2, if it doesn't exist check for libidn
944 # if both exist, prefer libidn2
945 # if none exist, fail and message that libidn or libidn2
946 # is required with a preference for libidn2.
947 # TODO: What we have right here can probably be improved.
948 my_with_libidn=1
949 AC_ARG_WITH(libidn,
950             AS_HELP_STRING([--with-libidn=pathname],
951                            [Support IDN (needs libidn)]),
952             [],
953             [withval="yes"])
954 AS_IF([test x_$withval = x_yes],
955       [AC_CHECK_HEADERS([idna.h],
956           AC_MSG_NOTICE([Found idna.h]),
957           AC_CHECK_HEADERS([idn/idna.h],
958                AC_MSG_NOTICE([Found idn/idna.h]),
959                my_with_libidn=0))],
960       [AS_IF([test x_$withval != x_no],
961              [CFLAGS="$CFLAGS -I$withval/include"
962               LDFLAGS="$LDFLAGS -L$withval/lib"
963               AC_CHECK_HEADERS([idna.h],
964                 AC_MSG_NOTICE([Found idna.h]),
965                 [AC_MSG_NOTICE([Failed to find idna.h])
966                  my_with_libidn=0])],
967              [my_with_libidn=0])])
968
969 my_with_libidn2=1
970 AC_ARG_WITH(libidn2,
971             AS_HELP_STRING([--with-libidn2=pathname],
972                            [Support IDN (needs libidn2)]),
973             [],
974             [withval="yes"])
975 AS_IF([test x_$withval = x_yes],
976       [AC_CHECK_HEADERS([idn2.h],
977        AC_MSG_NOTICE([Found idn2.h]),
978        AC_CHECK_HEADERS([idn2/idn2.h],
979           AC_MSG_NOTICE([Found idn2/idn2.h]),
980           [AC_MSG_NOTICE([Failed to find idn2.h])
981            my_with_libidn2=0]))],
982       [AS_IF([test x_$withval != x_no],
983              [CFLAGS="$CFLAGS -I$withval/include"
984               LDFLAGS="$LDFLAGS -L$withval/lib"],
985              [my_with_libidn2=0])])
986
987 AC_MSG_CHECKING([if libidn can be used])
988 # Check for LIBIDNs
989 there_can_only_be_one=1
990
991 working_libidn1=0
992 working_libidn2=0
993 AS_IF([test x$my_with_libidn2 = x1],
994       [AC_MSG_NOTICE([Checking for libidn2])
995        AC_CHECK_LIB([idn2],
996                     [idn2_to_unicode_8z8z],
997                     [working_libidn2=1
998                     LIBS="-lidn2 $LIBS"
999                     AC_DEFINE_UNQUOTED([HAVE_LIBIDN2],
1000                                        [1],
1001                                         [Define to 1 if you have 'libidn2' (-lidn2).])],
1002                      [MISSING_DEPS="${MISSING_DEPS}${MISSING_SEP}libidn2"
1003                      MISSING_SEP=", "])])
1004 AM_CONDITIONAL(HAVE_LIBIDN2, test x$working_libidn2 = x1)
1005 AS_IF([test x$working_libidn2 = x0],
1006       [AS_IF([test x$my_with_libidn = x1],
1007              [AC_MSG_NOTICE([Checking for libidn])
1008               AC_CHECK_LIB([idn],
1009                            [idna_to_ascii_8z],
1010                            [working_libidn1=1
1011                            LIBS="-lidn $LIBS"
1012                              AC_DEFINE_UNQUOTED([HAVE_LIBIDN],
1013                                                 [1],
1014                                                 [Define to 1 if you have 'libidn' (-lidn).])],
1015                              [there_can_only_be_one=0])],
1016              [AS_IF([test x$my_with_libidn2 = x1],
1017                     [there_can_only_be_one=0
1018                      AC_MSG_FAILURE([* There can only be one libidn.
1019                                      * Provide either libidn >= 1.13
1020                                      * or
1021                                      * libidn2 to the configure
1022                                      * script via
1023                                      * --with-libidn2
1024                                      * --with-libidn])])])])
1025 AM_CONDITIONAL(HAVE_LIBIDN, test x$working_libidn1 = x1)
1026
1027 AS_IF([test "$working_libidn1" = 0 -a "$working_libidn2" = 0],
1028       [AC_MSG_ERROR([GNUnet requires libidn (or libidn2)])])
1029
1030 AS_IF([test x$there_can_only_be_one = x0],
1031       [AC_MSG_FAILURE([Missing dependencies: $MISSING_DEPS])])
1032
1033 # test for zlib
1034 SAVE_LDFLAGS=$LDFLAGS
1035 SAVE_CPPFLAGS=$CPPFLAGS
1036 AC_ARG_WITH(zlib,
1037             [  --with-zlib[[=DIR]]       use libz in DIR],
1038             [AS_IF([test "$withval" = "no"],
1039                    [AC_MSG_ERROR([GNUnet requires zlib])],
1040                    [test "$withval" != "yes"],
1041                    [
1042                      Z_DIR=$withval
1043                      CPPFLAGS="${CPPFLAGS} -I$withval/include"
1044                      LDFLAGS="${LDFLAGS} -L$withval/lib"
1045                    ])
1046             ])
1047 AC_CHECK_HEADER(zlib.h,
1048                 [],
1049                 [AC_MSG_ERROR([GNUnet requires zlib])])
1050 AC_CHECK_LIB(z, compress2,
1051              [
1052               AC_DEFINE([HAVE_ZLIB], [], [Have compression library])
1053               if test "x${Z_DIR}" != "x"; then
1054                       Z_CFLAGS="-I${Z_DIR}/include"
1055                       Z_LIBS="-L${Z_DIR}/lib -lz"
1056               else
1057                       Z_LIBS="-lz"
1058               fi],
1059               [AC_MSG_ERROR([GNUnet requires zlib])])
1060 AC_SUBST(Z_CFLAGS)
1061 AC_SUBST(Z_LIBS)
1062
1063 if test "$enable_shared" = "no"
1064 then
1065  AC_MSG_ERROR([GNUnet only works with shared libraries. Sorry.])
1066 fi
1067
1068
1069
1070 # restore LIBS
1071 LIBS=$SAVE_LIBS
1072
1073
1074 fi
1075
1076 # check for iconv
1077 AM_ICONV
1078
1079 # test for libunistring
1080 gl_LIBUNISTRING
1081 if test $HAVE_LIBUNISTRING != yes; then
1082  AC_MSG_ERROR([GNUnet requires libunistring])
1083 fi
1084 # under emscripten, $gl_libunistring_hexversion is undefined
1085 if test "$taler_only" != yes; then
1086 if test "x$gl_libunistring_hexversion" = "x" || test "$gl_libunistring_hexversion" -le 2305; then
1087  AC_MSG_ERROR([GNUnet requires libunistring >= 0.9.1.1])
1088 fi
1089 fi
1090 AC_CHECK_HEADERS([unistr.h],,AC_MSG_ERROR([Compiling GNUnet requires unistr.h (from libunistring) to be installed]))
1091
1092 # restore LIBS
1093 LIBS=$SAVE_LIBS
1094
1095
1096
1097 # Checks for standard header files.
1098 AC_HEADER_DIRENT
1099 AC_HEADER_STDC
1100
1101 # Check for headers that are ALWAYS required
1102 AC_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]))
1103
1104
1105
1106 # Checks for headers that are only required on some systems or opional (and where we do NOT abort if they are not there)
1107 AC_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 terminos.h argz.h ucred.h sys/ucred.h endian.h sys/endian.h execinfo.h byteswap.h])
1108
1109 # FreeBSD requires something more funky for netinet/in_systm.h and netinet/ip.h...
1110 AC_CHECK_HEADERS([sys/types.h netinet/in_systm.h netinet/in.h netinet/ip.h],,,
1111 [#ifdef HAVE_SYS_TYPES_H
1112 #include <sys/types.h>
1113 #endif
1114 #ifdef HAVE_NETINET_IN_SYSTM_H
1115 #include <netinet/in_systm.h>
1116 #endif
1117 #ifdef HAVE_NETINET_IN_H
1118 #include <netinet/in.h>
1119 #endif
1120 ])
1121
1122 SAVE_LDFLAGS=$LDFLAGS
1123 SAVE_CPPFLAGS=$CPPFLAGS
1124
1125 # test for sqlite
1126 sqlite=false
1127 AC_MSG_CHECKING(for SQLite)
1128 AC_ARG_WITH(sqlite,
1129   [  --with-sqlite=PFX       base of SQLite installation],
1130   [AC_MSG_RESULT("$with_sqlite")
1131    case $with_sqlite in
1132    no)
1133      ;;
1134    yes)
1135     AC_CHECK_HEADERS(sqlite3.h,
1136      sqlite=true)
1137      ;;
1138    *)
1139     LDFLAGS="-L$with_sqlite/lib $LDFLAGS"
1140     CPPFLAGS="-I$with_sqlite/include $CPPFLAGS"
1141     AC_CHECK_HEADERS(sqlite3.h,
1142      EXT_LIB_PATH="-L$with_sqlite/lib $EXT_LIB_PATH"
1143      SQLITE_LDFLAGS="-L$with_sqlite/lib"
1144      SQLITE_CPPFLAGS="-I$with_sqlite/include"
1145      sqlite=true)
1146     LDFLAGS=$SAVE_LDFLAGS
1147     CPPFLAGS=$SAVE_CPPFLAGS
1148     ;;
1149    esac
1150   ],
1151   [AC_MSG_RESULT([--with-sqlite not specified])
1152     AC_CHECK_HEADERS(sqlite3.h, sqlite=true)])
1153 AM_CONDITIONAL(HAVE_SQLITE, test x$sqlite = xtrue)
1154 AC_SUBST(SQLITE_CPPFLAGS)
1155 AC_SUBST(SQLITE_LDFLAGS)
1156
1157 LDFLAGS=$SAVE_LDFLAGS
1158 CPPFLAGS=$SAVE_CPPFLAGS
1159
1160 # test for postgres
1161 postgres=false
1162 # even running the check for postgres breaks emscripten ...
1163 AS_IF([test "$taler_only" != yes],
1164       [AX_LIB_POSTGRESQL([9.5],
1165         [CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS"
1166          AC_CHECK_HEADERS([libpq-fe.h],
1167          postgres=true)
1168         ],
1169         [AC_MSG_RESULT([no postgres])])])
1170 AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue)
1171
1172
1173 LDFLAGS=$SAVE_LDFLAGS
1174 CPPFLAGS=$SAVE_CPPFLAGS
1175
1176 # mysql & windows
1177 AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
1178 AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
1179
1180 if test "$build_target" = "mingw"
1181 then
1182   CYGWIN_MYSQL_MAGIC="#include <mysql/my_global.h>"
1183 fi
1184
1185 # test for mysql
1186 mysql=false
1187 mysqlfail=false
1188 SAVE_LDFLAGS=$LDFLAGS
1189 SAVE_CPPFLAGS=$CPPFLAGS
1190 AC_MSG_CHECKING(for mysql)
1191 AC_ARG_WITH(mysql,
1192   [  --with-mysql=PFX        base of MySQL installation],
1193   [AC_MSG_RESULT([$with_mysql])
1194    case $with_mysql in
1195    no)
1196       ;;
1197    yes|"")
1198       AC_CHECK_HEADERS(mysql/mysql.h,
1199        AC_CHECK_LIB(mysqlclient, mysql_init,
1200
1201        mysql=true), [], [$CYGWIN_MYSQL_MAGIC])
1202       ;;
1203    *)
1204       LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql $LDFLAGS $ZLIBS"
1205       CPPFLAGS="-I$with_mysql/include $CPPFLAGS"
1206       AC_CHECK_HEADERS(mysql/mysql.h,
1207        AC_CHECK_LIB(mysqlclient, mysql_init,
1208         MYSQL_LDFLAGS="-L$with_mysql/lib -L$with_mysql/lib/mysql"
1209         MYSQL_CPPFLAGS="-I$with_mysql/include"
1210
1211         mysql=true), [], [$CYGWIN_MYSQL_MAGIC])
1212       ;;
1213    esac
1214   ],
1215   [AC_MSG_RESULT([--with-mysql not specified])
1216    if test -d "/usr/lib64/mysql"; then
1217     MYSQL_LIBDIR="/usr/lib64/mysql"
1218    elif test -d "/usr/lib/mysql"; then
1219     MYSQL_LIBDIR="/usr/lib/mysql"
1220    else
1221     MYSQL_LIBDIR="/usr/lib"
1222    fi
1223    LDFLAGS="-L$MYSQL_LIBDIR $LDFLAGS $ZLIBS"
1224    AC_CHECK_LIB(mysqlclient, mysql_init,
1225     [AC_CHECK_HEADERS(mysql/mysql.h,
1226       MYSQL_LDFLAGS="-L$MYSQL_LIBDIR"
1227       mysql=true
1228
1229      , [], [$CYGWIN_MYSQL_MAGIC])])
1230   ])
1231
1232 AC_SUBST(MYSQL_LDFLAGS)
1233 AC_SUBST(MYSQL_CPPFLAGS)
1234
1235 # additional version check for mysql
1236 AC_ARG_ENABLE(mysql-version-check, [  --disable-mysql-version-check  do not check MySQL version],, enable_mysql_version_check=yes)
1237 if test "$mysql" = "true" -a "x$enable_mysql_version_check" = "xyes"
1238 then
1239   AC_MSG_CHECKING(mysql version)
1240   AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1241     [[$CYGWIN_MYSQL_MAGIC
1242       #include <mysql/mysql.h>]],
1243     [[
1244       #if (MYSQL_VERSION_ID < 40100)
1245       #error needs at least version >= 4.1
1246       #endif
1247       int main () { return 0; }
1248     ]])
1249     ],mysql=true,mysql=false)
1250   if test "$mysql" = "false"
1251   then
1252     mysqlfail=true
1253     AC_MSG_RESULT([fail, >= 4.1 required])
1254   else
1255     AC_MSG_RESULT(ok)
1256   fi
1257 fi
1258 AM_CONDITIONAL(HAVE_MYSQL, test x$mysql = xtrue)
1259 AM_CONDITIONAL(HAVE_MYSQLE, false)
1260 # restore LIBS
1261 LIBS=$SAVE_LIBS
1262 LDFLAGS=$SAVE_LDFLAGS
1263 CPPFLAGS=$SAVE_CPPFLAGS
1264
1265 if test "$sqlite" = 0 -a "$mysql" = 0
1266 then
1267  AC_MSG_ERROR([GNUnet requires SQLite or MySQL])
1268 fi
1269
1270 # libmicrohttpd
1271 lmhd=0
1272 AC_MSG_CHECKING([for libmicrohttpd])
1273 AC_ARG_WITH(microhttpd,
1274    [  --with-microhttpd=PFX   base of libmicrohttpd installation],
1275    [AC_MSG_RESULT([$with_microhttpd])
1276     case $with_microhttpd in
1277       no)
1278         ;;
1279       yes|"")
1280         AC_CHECK_HEADERS([microhttpd.h],
1281           AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
1282             AC_CHECK_LIB([microhttpd], [MHD_get_fdset2],
1283               [AC_MSG_CHECKING([for libmicrohttpd >= 0.9.52])
1284               AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1285                 #include "$native_srcdir/src/include/platform.h"
1286                 #include <microhttpd.h>
1287                 #if (MHD_VERSION < 0x0094200)
1288                 #error needs at least version 0.9.42
1289                 #endif
1290                 int main () { return 0; }
1291                ])],
1292                [AC_MSG_RESULT(ok)
1293                 lmhd=1],
1294                [AC_MSG_RESULT(failed)])]),
1295             [],[#include "$native_srcdir/src/include/platform.h"
1296                 #include <microhttpd.h>]),,
1297             [#include "$native_srcdir/src/include/platform.h"])
1298         ;;
1299       *)
1300         LDFLAGS="-L$with_microhttpd/lib $LDFLAGS"
1301         CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"
1302         AC_CHECK_HEADERS(microhttpd.h,
1303           AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
1304             AC_CHECK_LIB([microhttpd], [MHD_get_fdset2],
1305               EXT_LIB_PATH="-L$with_microhttpd/lib $EXT_LIB_PATH"
1306               [AC_MSG_CHECKING([for libmicrohttpd >= 0.9.52])
1307                AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1308                 #include "$native_srcdir/src/include/platform.h"
1309                 #include <microhttpd.h>
1310                 #if (MHD_VERSION < 0x0094200)
1311                 #error needs at least version 0.9.42
1312                 #endif
1313                 int main () { return 0; }
1314                ])],
1315                [AC_MSG_RESULT(ok)
1316                 lmhd=1],
1317                [AC_MSG_RESULT(failed)])]),
1318             [],[#include "$native_srcdir/src/include/platform.h"
1319                 #include <microhttpd.h>]),,
1320             [#include "$native_srcdir/src/include/platform.h"])
1321         ;;
1322     esac
1323    ],
1324    [AC_MSG_RESULT([--with-microhttpd not specified])
1325     AC_CHECK_HEADERS([microhttpd.h],
1326       AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT,
1327         AC_CHECK_LIB([microhttpd], [MHD_get_fdset2],
1328           [AC_MSG_CHECKING([for libmicrohttpd >= 0.9.52])
1329               AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1330                 #include "$native_srcdir/src/include/platform.h"
1331                 #include <microhttpd.h>
1332                 #if (MHD_VERSION < 0x0094200)
1333                 #error needs at least version 0.9.52
1334                 #endif
1335                ])],
1336                [AC_MSG_RESULT(ok)
1337                 lmhd=1],
1338                [AC_MSG_RESULT(failed)])]),
1339         [],[#include "$native_srcdir/src/include/platform.h"
1340             #include <microhttpd.h>]),,
1341        [#include "$native_srcdir/src/include/platform.h"])])
1342 AM_CONDITIONAL(HAVE_MHD, test x$lmhd = x1)
1343 AC_DEFINE_UNQUOTED([HAVE_MHD], $lmhd, [We have libmicrohttpd])
1344
1345 AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1])
1346
1347 # restore LIBS
1348 LIBS=$SAVE_LIBS
1349
1350 # check for gettext
1351 AM_GNU_GETTEXT([external])
1352 AM_GNU_GETTEXT_VERSION([0.18.1])
1353
1354 # Checks for standard typedefs, structures, and compiler characteristics.
1355 AC_TYPE_PID_T
1356 AC_TYPE_SIZE_T
1357 AC_TYPE_MODE_T
1358 AC_HEADER_TIME
1359 AC_HEADER_STAT
1360 AC_HEADER_STDBOOL
1361 AC_STRUCT_TM
1362
1363 AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
1364    [ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [Do we have sockaddr_in.sin_len?])
1365    ],
1366    [],
1367    [
1368       #include <sys/types.h>
1369       #include <sys/socket.h>
1370       #include <netinet/in.h>
1371    ])
1372
1373 AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
1374    [ AC_DEFINE(HAVE_SOCKADDR_UN_SUN_LEN, 1, [Do we have sockaddr_un.sun_len?])
1375    ],
1376    [],
1377    [
1378       #include <sys/types.h>
1379       #include <sys/socket.h>
1380       #include <sys/un.h>
1381    ])
1382
1383
1384
1385 # Checks for library functions.
1386 AC_FUNC_CLOSEDIR_VOID
1387 AC_FUNC_FORK
1388 AC_PROG_GCC_TRADITIONAL
1389 AC_FUNC_MEMCMP
1390 AC_FUNC_SELECT_ARGTYPES
1391 AC_FUNC_CHOWN
1392
1393 AC_TYPE_SIGNAL
1394 AC_FUNC_STAT
1395 AC_FUNC_STRFTIME
1396 AC_FUNC_VPRINTF
1397 AC_HEADER_SYS_WAIT
1398 AC_TYPE_OFF_T
1399 AC_TYPE_UID_T
1400 AC_CHECK_FUNCS([atoll stat64 strnlen mremap getrlimit setrlimit sysconf initgroups strndup gethostbyname2 getpeerucred getpeereid setresuid $funcstocheck getifaddrs freeifaddrs getresgid mallinfo malloc_size malloc_usable_size getrusage random srandom stat statfs statvfs wait4])
1401
1402 # restore LIBS
1403 LIBS=$SAVE_LIBS
1404
1405 GN_INTLINCL=""
1406 GN_LIBINTL="$LTLIBINTL"
1407 AC_ARG_ENABLE(framework, [  --enable-framework      enable Mac OS X framework build helpers],enable_framework_build=$enableval)
1408 AM_CONDITIONAL(WANT_FRAMEWORK, test x$enable_framework_build = xyes)
1409 if test x$enable_framework_build = xyes
1410 then
1411   AC_DEFINE([FRAMEWORK_BUILD], 1, [Build a Mac OS X Framework])
1412   GN_INTLINCL='-I$(top_srcdir)/src/intlemu'
1413   GN_LIBINTL='$(top_builddir)/src/intlemu/libintlemu.la -framework CoreFoundation'
1414   AC_LIB_APPENDTOVAR([CPPFLAGS], [$GN_INTLINCL])
1415 fi
1416
1417 GN_LIB_LDFLAGS="-export-dynamic -no-undefined"
1418 GN_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
1419
1420 AC_SUBST(GN_LIB_LDFLAGS)
1421 AC_SUBST(GN_PLUGIN_LDFLAGS)
1422 AC_SUBST(GN_INTLINCL)
1423 AC_SUBST(GN_LIBINTL)
1424
1425 AC_SUBST(CPPFLAGS)
1426 AC_SUBST(LIBS)
1427 AC_SUBST(LDFLAGS)
1428 AC_SUBST(EXT_LIB_PATH)
1429 AC_SUBST(EXT_LIBS)
1430
1431 AC_SUBST(LIBPREFIX)
1432 AC_SUBST(DLLDIR)
1433 AC_SUBST(EXT_LIB_PATH)
1434
1435 DATAROOTDIR=$datarootdir
1436 AC_SUBST(DATAROOTDIR)
1437
1438 # test for sudo
1439 # TODO: do we need to change anything for "doas" on openbsd?
1440 AC_MSG_CHECKING(for sudo)
1441 AC_ARG_WITH(sudo,
1442   [  --with-sudo=PATH       path to sudo binary (or just yes)],
1443   [AC_MSG_RESULT("$with_sudo")
1444    case $with_sudo in
1445    no)
1446      SUDO_BINARY=
1447      ;;
1448    yes)
1449      SUDO_BINARY=sudo
1450      ;;
1451    *)
1452      SUDO_BINARY=$with_sudo
1453     ;;
1454    esac
1455   ],
1456   [AC_MSG_RESULT([no])])
1457 AC_SUBST(SUDO_BINARY)
1458 AM_CONDITIONAL([HAVE_SUDO], [test "x$SUDO_BINARY" != "x" -o -w /])
1459
1460
1461 # test for gnunetdns group name
1462 GNUNETDNS_GROUP=gnunetdns
1463 AC_MSG_CHECKING(for gnunetdns group name)
1464 AC_ARG_WITH(gnunetdns,
1465   [  --with-gnunetdns=GRPNAME       name for gnunetdns group],
1466   [AC_MSG_RESULT("$with_gnunetdns")
1467    case $with_gnunetdns in
1468    no)
1469      GNUNETDNS_GROUP=gnunet
1470      ;;
1471    yes)
1472      GNUNETDNS_GROUP=gnunetdns
1473      ;;
1474    *)
1475      GNUNETDNS_GROUP=$with_gnunetdns
1476     ;;
1477    esac
1478   ],
1479   [AC_MSG_RESULT([gnunetdns])])
1480 AC_SUBST(GNUNETDNS_GROUP)
1481
1482
1483
1484 # gnutls
1485 gnutls=0
1486 gnutls_dane=0
1487 AC_MSG_CHECKING(for gnutls)
1488 AC_ARG_WITH(gnutls,
1489    [  --with-gnutls=PFX   base of gnutls installation],
1490    [AC_MSG_RESULT([$with_gnutls])
1491     case $with_gnutls in
1492       no)
1493         ;;
1494       yes)
1495         AC_CHECK_HEADERS([gnutls/abstract.h],
1496             AC_CHECK_LIB([gnutls], [gnutls_priority_set],
1497              gnutls=true))
1498         AC_CHECK_HEADERS([gnutls/dane.h],
1499             AC_CHECK_LIB([gnutls-dane], [dane_verify_crt_raw],
1500               gnutls_dane=1))
1501         ;;
1502       *)
1503         LDFLAGS="-L$with_gnutls/lib $LDFLAGS"
1504         CPPFLAGS="-I$with_gnutls/include $CPPFLAGS"
1505         AC_CHECK_HEADERS([gnutls/abstract.h],
1506             AC_CHECK_LIB([gnutls], [gnutls_priority_set],
1507               EXT_LIB_PATH="-L$with_gnutls/lib $EXT_LIB_PATH"
1508               gnutls=true))
1509         AC_CHECK_HEADERS([gnutls/dane.h],
1510             AC_CHECK_LIB([gnutls-dane], [dane_verify_crt_raw],
1511               gnutls_dane=1))
1512         ;;
1513     esac
1514    ],
1515    [AC_MSG_RESULT([--with-gnutls not specified])
1516     AC_CHECK_HEADERS([gnutls/abstract.h],
1517         AC_CHECK_LIB([gnutls], [gnutls_priority_set],
1518           gnutls=true))
1519     AC_CHECK_HEADERS([gnutls/dane.h],
1520         AC_CHECK_LIB([gnutls-dane], [dane_verify_crt_raw],
1521                      gnutls_dane=1))
1522    ])
1523 AM_CONDITIONAL(HAVE_GNUTLS, test x$gnutls = xtrue)
1524 AC_DEFINE_UNQUOTED([HAVE_GNUTLS], $gnutls, [We have GnuTLS])
1525 AM_CONDITIONAL(HAVE_GNUTLS_DANE, test x$gnutls_dane = x1)
1526 AC_DEFINE_UNQUOTED([HAVE_GNUTLS_DANE], $gnutls_dane, [We have GnuTLS with DANE support])
1527
1528
1529
1530 # Test if we are building for superMUC
1531 AC_MSG_CHECKING(if GNUnet is being configured to run on the SuperMUC)
1532 AC_ARG_ENABLE([supermuc],
1533     [AS_HELP_STRING([--enable-supermuc],
1534        [build GNUnet with support to run on the SuperMUC (default is NO)])],
1535     [if test "x$enable_supermuc" = "xno"
1536      then
1537        supermuc=0
1538      else
1539        supermuc=1
1540      fi],
1541     [supermuc=0
1542      enable_supermuc=no])
1543 AC_MSG_RESULT($enable_SUPERMUC)
1544 AM_CONDITIONAL([ENABLE_SUPERMUC], [test "x$supermuc" = "x1"])
1545 AC_DEFINE_UNQUOTED([ENABLE_SUPERMUC], [$supermuc], [Build with support for SuperMUC])
1546
1547 # Check if NSE has to send timestamp information to testbed logger for
1548 # generating histogram of messages received
1549 AC_MSG_CHECKING(if NSE has to send timestamp information to testbed logger)
1550 AC_ARG_ENABLE([nse-histogram],
1551     [AS_HELP_STRING([--enable-nse-histogram],
1552        [have NSE send timestamp information to testbed logger for generating
1553        histogram of received messages.  NOT useful for production (default is
1554        NO)])],
1555     [if test "x$enableval" = "xno"
1556      then
1557        nse_histogram=0
1558      else
1559        nse_histogram=1
1560      fi],
1561     [nse_histogram=0
1562      enable_nse_histogram=no])
1563 AC_MSG_RESULT($enable_nse_histogram)
1564 AM_CONDITIONAL([ENABLE_NSE_HISTOGRAM], [test "x$nse_histogram" = "x1"])
1565 AC_DEFINE_UNQUOTED([ENABLE_NSE_HISTOGRAM], [$nse_histogram],
1566                    [have NSE send timestamp information to testbed logger])
1567
1568 # should 'make check' run tests?
1569 AC_MSG_CHECKING(whether to run tests)
1570 AC_ARG_ENABLE([testruns],
1571    [AS_HELP_STRING([--disable-testruns], [disable running tests on make check (default is YES)])],
1572    [enable_tests_run=${enableval}],
1573    [enable_tests_run=yes])
1574 AC_MSG_RESULT($enable_test_run)
1575 AM_CONDITIONAL([ENABLE_TEST_RUN], [test "x$enable_tests_run" = "xyes"])
1576
1577
1578 AC_MSG_CHECKING([whether to compile in benchmarks (currently for http and crypto)])
1579 AC_ARG_ENABLE([benchmark],
1580    [AS_HELP_STRING([--enable-benchmark], [enable benchmarking])],
1581    [enable_benchmark=${enableval}],
1582    [enable_benchmark=no])
1583 AC_MSG_RESULT($enable_benchmark)
1584 AS_IF([test "x$enable_benchmark" = "xyes"],
1585       [AC_DEFINE_UNQUOTED(ENABLE_BENCHMARK,1,[Benchmarks are enabled])])
1586 AM_CONDITIONAL([ENABLE_BENCHMARK], [test "x$enable_benchmark" = "xyes"])
1587
1588
1589 # should expensive tests be run?
1590 AC_MSG_CHECKING(whether to run expensive tests)
1591 AC_ARG_ENABLE([expensivetests],
1592    [AS_HELP_STRING([--enable-expensivetests], [enable running expensive testcases])],
1593    [enable_expensive=${enableval}],
1594    [enable_expensive=no])
1595 AC_MSG_RESULT($enable_expensive)
1596 AM_CONDITIONAL([HAVE_EXPENSIVE_TESTS], [test "x$enable_expensive" = "xyes"])
1597
1598 # should ports be open for Java services?
1599 AC_MSG_CHECKING(whether to enable ports for gnunet-java)
1600 AC_ARG_ENABLE([javaports],
1601    [AS_HELP_STRING([--enable-javaports], [use non-zero ports for services with Java bindings (default is NO)])],
1602    [enable_java_ports=${enableval}],
1603    [enable_java_ports=no])
1604 AC_MSG_RESULT($enable_java_ports)
1605 if test "x$enable_java_ports" = "xyes"
1606 then
1607   JAVAPORT=""
1608 else
1609   JAVAPORT="$UNIXONLY"
1610 fi
1611 AC_SUBST(JAVAPORT)
1612
1613 # should benchmarks be run?
1614 AC_MSG_CHECKING(whether to run benchmarks during make check)
1615 AC_ARG_ENABLE([benchmarks],
1616    [AS_HELP_STRING([--enable-benchmarks], [enable running benchmarks during make check])],
1617    [enable_benchmarks=${enableval}],
1618    [enable_benchmarks=no])
1619 AC_MSG_RESULT($enable_benchmarks)
1620 AM_CONDITIONAL([HAVE_BENCHMARKS], [test "x$enable_benchmarks" = "xyes"])
1621
1622 # should gnunet-testing be compiled
1623 AC_MSG_CHECKING(wether to compile gnunet-testing)
1624 AC_ARG_ENABLE([testing],
1625    [AS_HELP_STRING([--disable-testing], [do not build gnunet-testing])],
1626    [enable_testing=${enableval}],
1627    [enable_testing=yes])
1628 AC_MSG_RESULT($enable_testing)
1629 AM_CONDITIONAL([HAVE_TESTING], [test "x$enable_testing" = "xyes"])
1630
1631 # should experimental code be compiled (code that may not yet compile)?
1632 AC_MSG_CHECKING(whether to compile experimental code)
1633 AC_ARG_ENABLE([experimental],
1634    [AS_HELP_STRING([--enable-experimental], [enable compiling experimental code])],
1635    [enable_experimental=${enableval}],
1636    [enable_experimental=no])
1637 AC_MSG_RESULT($enable_experimental)
1638 AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])
1639
1640 # should malicious code be compiled (should only be used for testing)?
1641 AC_MSG_CHECKING(whether to compile malicious code)
1642 AC_ARG_ENABLE([malicious],
1643    [AS_HELP_STRING([--enable-malicious], [enable compiling malicious code])],
1644    [if test "x$enableval" = "xno"
1645      then
1646        malicious=0
1647      else
1648        malicious=1
1649      fi],
1650    [malicious=0
1651     enable_malicious=no])
1652 AC_MSG_RESULT($enable_malicious)
1653 AM_CONDITIONAL([ENABLE_MALICIOUS], [test 1=$malicious])
1654 AC_DEFINE_UNQUOTED([ENABLE_MALICIOUS], [$malicious],
1655                    [enable compilation of malicious code])
1656
1657 # should services be started on demand when needed?  Some services may choose to
1658 # never start by default and it is up to the service/module developer to decide
1659 # by having "START_ON_DEMAND = NO" instead of "START_ON_DEMAND = @START_ON_DEMAND@"
1660 # in the service/module's conf.in file.
1661 # See also IMMEDIATE_START for an unconditional immediate start.
1662 START_ON_DEMAND="YES"
1663 AC_MSG_CHECKING(whether to start peer's services on demand by default)
1664 AC_ARG_ENABLE([autostart],
1665    [AS_HELP_STRING([--disable-autostart], [do not start peer's services by default])],
1666    [enable_autostart=${enableval}
1667     if test "x$enable_autostart" = "xno"
1668     then
1669         START_ON_DEMAND="NO"
1670     fi
1671    ],
1672    [enable_autostart=yes])
1673 AC_MSG_RESULT($enable_autostart)
1674 #AM_CONDITIONAL([HAVE_START_ON_DEMAND], [test "x$enable_autostart" = "xyes"])
1675 AC_SUBST(START_ON_DEMAND)
1676
1677 # should memory statistics be kept (very expensive CPU-wise!)
1678 AC_MSG_CHECKING(whether to create expensive statistics on memory use)
1679 AC_ARG_ENABLE([heapstats],
1680    [AS_HELP_STRING([--enable-heapstats], [enable expensive heap statistics])],
1681    [enable_heapstats=1],
1682    [enable_heapstats=0])
1683 AC_MSG_RESULT($enable_heapstats)
1684 AC_DEFINE_UNQUOTED([ENABLE_HEAP_STATISTICS],$enable_heapstats,[enable expensive heap statistics])
1685
1686 # should code be enabled that works around missing OS functionality on Windows?
1687 # used for test cases
1688 if test $build_target = "mingw"
1689 then
1690         workarounds=1
1691
1692 AC_LINK_IFELSE(
1693  [AC_LANG_PROGRAM(
1694   [#include <ws2tcpip.h>
1695   ],[
1696   int s = socket (0, 0, 0);])
1697  ],[
1698   AC_DEFINE_UNQUOTED([HAVE_SOCKET],1,[Define this if socket() is available])
1699  ],[
1700   AC_DEFINE_UNQUOTED([HAVE_SOCKET],0,[Define this if socket() is available])
1701  ])
1702
1703 AC_LINK_IFELSE(
1704  [AC_LANG_PROGRAM(
1705   [#include <ws2tcpip.h>
1706   ],[
1707   int s = select (0, NULL, NULL, NULL, NULL);])
1708  ],[
1709   AC_DEFINE_UNQUOTED([HAVE_SELECT],1,[Define this if select() is available])
1710  ],[
1711   AC_DEFINE_UNQUOTED([HAVE_SELECT],0,[Define this if select() is available])
1712  ])
1713
1714 AC_LINK_IFELSE(
1715  [AC_LANG_PROGRAM(
1716   [#include <ws2tcpip.h>
1717   ],[
1718   struct in_addr i;
1719   char *s = inet_ntoa (i);])
1720  ],[
1721   AC_DEFINE_UNQUOTED([HAVE_INET_NTOA],1,[Define this if inet_ntoa() is available])
1722  ],[
1723   AC_DEFINE_UNQUOTED([HAVE_INET_NTOA],0,[Define this if inet_ntoa() is available])
1724  ])
1725
1726 AC_LINK_IFELSE(
1727  [AC_LANG_PROGRAM(
1728   [#include <ws2tcpip.h>
1729   ],[
1730   int s = getnameinfo (NULL, 0, NULL, 0, NULL, 0, 0);])
1731  ],[
1732   AC_DEFINE_UNQUOTED([HAVE_GETNAMEINFO],1,[Define this if getnameinfo() is available])
1733  ],[
1734   AC_DEFINE_UNQUOTED([HAVE_GETNAMEINFO],0,[Define this if getnameinfo() is available])
1735  ])
1736
1737 AC_LINK_IFELSE(
1738  [AC_LANG_PROGRAM(
1739   [#include <ws2tcpip.h>
1740   ],[
1741   int s = gethostname (NULL, 0);])
1742  ],[
1743   AC_DEFINE_UNQUOTED([HAVE_GETHOSTNAME],1,[Define this if gethostname() is available])
1744  ],[
1745   AC_DEFINE_UNQUOTED([HAVE_GETHOSTNAME],0,[Define this if gethostname() is available])
1746  ])
1747
1748 AC_LINK_IFELSE(
1749  [AC_LANG_PROGRAM(
1750   [#include <ws2tcpip.h>
1751   ],[
1752   void *s = gethostbyname (NULL);])
1753  ],[
1754   AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYNAME],1,[Define this if gethostbyname() is available])
1755  ],[
1756   AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYNAME],0,[Define this if gethostbyname() is available])
1757  ])
1758
1759 AC_LINK_IFELSE(
1760  [AC_LANG_PROGRAM(
1761   [#include <ws2tcpip.h>
1762   ],[
1763   void *s = gethostbyaddr (NULL, 0, 0);])
1764  ],[
1765   AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYADDR],1,[Define this if gethostbyaddr() is available])
1766  ],[
1767   AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYADDR],0,[Define this if gethostbyaddr() is available])
1768  ])
1769
1770 AC_LINK_IFELSE(
1771  [AC_LANG_PROGRAM(
1772   [#include <ws2tcpip.h>
1773   ],[
1774   int s = getaddrinfo (NULL, NULL, NULL, NULL);])
1775  ],[
1776   AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO],1,[Define this if getaddrinfo() is available])
1777  ],[
1778   AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO],0,[Define this if getaddrinfo() is available])
1779  ])
1780
1781 else
1782   AC_MSG_CHECKING(whether to enable windows workarounds)
1783   AC_ARG_ENABLE([windows_workarounds],
1784      [AS_HELP_STRING([--enable-windows_workarounds], [enable workarounds used on Windows (only useful for test cases)])],
1785      [enable_workarounds=${enableval}],
1786      [enable_workarounds=no])
1787   AC_MSG_RESULT($enable_workarounds)
1788   if test x$enable_windows_workarounds = "xyes"
1789   then
1790      workarounds=1
1791   else
1792      workarounds=0
1793    fi
1794 fi
1795 AC_DEFINE_UNQUOTED([ENABLE_WINDOWS_WORKAROUNDS], $workarounds, [enable workarounds used on Windows (only useful for test cases)])
1796
1797 # gcov compilation
1798 AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
1799 AC_ARG_ENABLE([coverage],
1800               AS_HELP_STRING([--enable-coverage],
1801                              [compile the library with code coverage support]),
1802               [use_gcov=${enableval}],
1803               [use_gcov=no])
1804 AC_MSG_RESULT($use_gcov)
1805 AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
1806
1807
1808 # version info
1809 # TODO: git blame says this predates our switch to git. git-svn should be adjusted to simply git, or
1810 # an external script that does the job.
1811 AC_PATH_PROG(svnversioncommand, svnversion)
1812 AC_PATH_PROG(gitcommand, git)
1813 AC_MSG_CHECKING(for source being under a VCS)
1814
1815
1816 # version info
1817 AC_PATH_PROG(gitcommand, git)
1818 AC_MSG_CHECKING(for source being under a VCS)
1819 git_version=
1820 AS_IF([test ! "X$gitcommand" = "X"],
1821 [
1822   git_version=$(cd $srcdir ; git rev-list --full-history --all --abbrev-commit | head -n 1 2>/dev/null)
1823 ])
1824 AS_IF([test "X$git_version" = "X"],
1825   [
1826     vcs_name="no"
1827     vcs_version="\"release\""
1828   ],
1829   [
1830     vcs_name="yes, git-svn"
1831     vcs_version="\"git-$git_version\""
1832   ])
1833 AC_MSG_RESULT($vcs_name)
1834
1835 AC_MSG_CHECKING(VCS version)
1836 AC_MSG_RESULT($vcs_version)
1837 AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version])
1838
1839 AC_CONFIG_FILES([
1840 Makefile
1841 contrib/Makefile
1842 contrib/scripts/Makefile
1843 contrib/scripts/gnunet-logread/Makefile
1844 doc/Makefile
1845 doc/man/Makefile
1846 doc/doxygen/Makefile
1847 doc/handbook/Makefile
1848 doc/tutorial/Makefile
1849 lint/Makefile
1850 m4/Makefile
1851 po/Makefile.in
1852 src/Makefile
1853 src/arm/Makefile
1854 src/arm/arm.conf
1855 src/ats/Makefile
1856 src/ats/ats.conf
1857 src/ats-tool/Makefile
1858 src/ats-tests/Makefile
1859 src/auction/Makefile
1860 src/block/Makefile
1861 src/cadet/Makefile
1862 src/cadet/cadet.conf
1863 src/core/Makefile
1864 src/core/core.conf
1865 src/consensus/Makefile
1866 src/consensus/consensus.conf
1867 src/conversation/Makefile
1868 src/conversation/conversation.conf
1869 src/curl/Makefile
1870 src/datacache/Makefile
1871 src/datastore/Makefile
1872 src/datastore/datastore.conf
1873 src/dht/Makefile
1874 src/dht/dht.conf
1875 src/dns/Makefile
1876 src/dns/dns.conf
1877 src/exit/Makefile
1878 src/fragmentation/Makefile
1879 src/fs/Makefile
1880 src/fs/fs.conf
1881 src/gns/Makefile
1882 src/gns/gns.conf
1883 src/gns/nss/Makefile
1884 src/gnsrecord/Makefile
1885 src/hello/Makefile
1886 src/identity/Makefile
1887 src/identity/identity.conf
1888 src/credential/Makefile
1889 src/credential/credential.conf
1890 src/include/Makefile
1891 src/integration-tests/Makefile
1892 src/json/Makefile
1893 src/hostlist/Makefile
1894 src/my/Makefile
1895 src/mysql/Makefile
1896 src/namecache/Makefile
1897 src/namecache/namecache.conf
1898 src/namestore/Makefile
1899 src/namestore/namestore.conf
1900 src/nat/Makefile
1901 src/nat/nat.conf
1902 src/nat-auto/Makefile
1903 src/nat-auto/nat-auto.conf
1904 src/nse/Makefile
1905 src/nse/nse.conf
1906 src/nt/Makefile
1907 src/peerinfo/Makefile
1908 src/peerinfo/peerinfo.conf
1909 src/peerinfo-tool/Makefile
1910 src/peerstore/Makefile
1911 src/peerstore/peerstore.conf
1912 src/pq/Makefile
1913 src/pt/Makefile
1914 src/regex/Makefile
1915 src/regex/regex.conf
1916 src/revocation/Makefile
1917 src/revocation/revocation.conf
1918 src/rps/Makefile
1919 src/rps/rps.conf
1920 src/secretsharing/Makefile
1921 src/secretsharing/secretsharing.conf
1922 src/scalarproduct/Makefile
1923 src/scalarproduct/scalarproduct.conf
1924 src/set/Makefile
1925 src/set/set.conf
1926 src/sq/Makefile
1927 src/statistics/Makefile
1928 src/statistics/statistics.conf
1929 src/template/Makefile
1930 src/testbed/Makefile
1931 src/testbed/testbed.conf
1932 src/testbed-logger/Makefile
1933 src/testbed-logger/testbed-logger.conf
1934 src/testing/Makefile
1935 src/topology/Makefile
1936 src/transport/Makefile
1937 src/transport/transport.conf
1938 src/util/Makefile
1939 src/util/resolver.conf
1940 src/vpn/Makefile
1941 src/vpn/vpn.conf
1942 src/zonemaster/Makefile
1943 src/zonemaster/zonemaster.conf
1944 src/rest/Makefile
1945 src/abe/Makefile
1946 src/reclaim-attribute/Makefile
1947 src/reclaim/Makefile
1948 pkgconfig/Makefile
1949 pkgconfig/gnunetarm.pc
1950 pkgconfig/gnunetats.pc
1951 pkgconfig/gnunetblock.pc
1952 pkgconfig/gnunetcadet.pc
1953 pkgconfig/gnunetconsensus.pc
1954 pkgconfig/gnunetconversation.pc
1955 pkgconfig/gnunetcore.pc
1956 pkgconfig/gnunetdatacache.pc
1957 pkgconfig/gnunetdatastore.pc
1958 pkgconfig/gnunetdht.pc
1959 pkgconfig/gnunetdns.pc
1960 pkgconfig/gnunetenv.pc
1961 pkgconfig/gnunetfragmentation.pc
1962 pkgconfig/gnunetfs.pc
1963 pkgconfig/gnunetgns.pc
1964 pkgconfig/gnunethello.pc
1965 pkgconfig/gnunetidentity.pc
1966 pkgconfig/gnunetmicrophone.pc
1967 pkgconfig/gnunetmysql.pc
1968 pkgconfig/gnunetnamestore.pc
1969 pkgconfig/gnunetnat.pc
1970 pkgconfig/gnunetnse.pc
1971 pkgconfig/gnunetpeerinfo.pc
1972 pkgconfig/gnunetpq.pc
1973 pkgconfig/gnunetregex.pc
1974 pkgconfig/gnunetrevocation.pc
1975 pkgconfig/gnunetrps.pc
1976 pkgconfig/gnunetscalarproduct.pc
1977 pkgconfig/gnunetset.pc
1978 pkgconfig/gnunetspeaker.pc
1979 pkgconfig/gnunetstatistics.pc
1980 pkgconfig/gnunettestbed.pc
1981 pkgconfig/gnunettesting.pc
1982 pkgconfig/gnunettransport.pc
1983 pkgconfig/gnunetutil.pc
1984 pkgconfig/gnunetvpn.pc
1985 ])
1986 AC_OUTPUT
1987
1988 # Finally: summary!
1989
1990 # warn user if mysql found but not used due to version
1991 AS_IF([test "$mysqlfail" = "true"]
1992       [AC_MSG_NOTICE([WARNING: optional MySQL not found (or too old)])])
1993
1994 # sqlite
1995 AS_IF([test "x$sqlite" = "x0"],
1996       [AC_MSG_ERROR([ERROR: sqlite3 not found, but sqlite3 is required.])])
1997
1998 # libgnurl
1999 AS_IF([test "$gnurl" = "0"],
2000   [AS_IF([test "x$curl" = "xfalse"],
2001     [AC_MSG_NOTICE([WARNING: libgnurl not found.  http client support will not be compiled.])
2002      AC_MSG_WARN([ERROR: libgnurl not found.  hostlist daemon will not be compiled, and you probably WANT the hostlist daemon])],
2003     [AC_MSG_NOTICE([WARNING: libgnurl not found, trying to use libcurl-gnutls instead.])])])
2004
2005 # bluetooth
2006 AS_IF([test "x$bluetooth" = "x0"],
2007       [AC_MSG_NOTICE([WARNING: optional bluetooth library not found.])])
2008
2009
2010 # jansson
2011 AS_IF([test "x$jansson" = "x0"],
2012       [AC_MSG_NOTICE([WARNING: optional jansson library not found.])])
2013
2014 #
2015 # FIXME: `some modules' -> be more specific which exact modules.
2016 #
2017
2018 # warn user if iptables is not found
2019 AS_IF([test "$VAR_IPTABLES_BINARY" = "false"],
2020  [AC_MSG_NOTICE([WARNING: optional iptables not found])])
2021
2022 # warn user if ifconfig is not found
2023 AS_IF([test "$VAR_IFCONFIG_BINARY" = "false"],
2024  [AC_MSG_NOTICE([WARNING: optional ifconfig not found])])
2025
2026 # warn user if upnpc binary is not found
2027 AS_IF([test "$VAR_UPNPC_BINARY" = "false"],
2028   [AC_MSG_NOTICE([WARNING: optional upnpc binary not found])])
2029
2030 #gnutls
2031 AS_IF([test x$gnutls != xtrue],
2032  [AC_MSG_NOTICE([WARNING: GnuTLS not found, gnunet-gns-proxy will not be built])],
2033  [AS_IF([test "x$gnutls_dane" != "x1"],
2034   [AC_MSG_NOTICE([WARNING: GnuTLS has no DANE support, DANE validation will not be possible])])])
2035
2036 # warn user if libzbar is not found
2037 AS_IF([test "$have_zbar" = 0],
2038       [AC_MSG_NOTICE([WARNING: zbar not found, gnunet-qr will not be built.])])
2039
2040 # java ports
2041 AS_IF([test "x$enable_java_ports" = "xyes"],
2042       [AC_MSG_NOTICE([NOTICE: Opening ports for gnunet-java bindings by default.])])
2043
2044 # MHD
2045 AS_IF([test "x$lmhd" != "x1"],
2046       [AC_MSG_NOTICE([WARNING: optional libmicrohttpd not found])])
2047
2048 # conversation
2049 AS_IF([test "x$conversation_backend" = "xnone"],
2050  [AS_IF([test "x$pulse" != "x1"],
2051    [AC_MSG_NOTICE([WARNING: libpulse(audio) not found, conversation will not be built.])])
2052   AS_IF([test "x$opus" != "x1"],
2053    [AC_MSG_NOTICE([WARNING: libopus not found, conversation will not be built.])])
2054   AS_IF([test "x$gst" != "x1"],
2055    [AC_MSG_NOTICE([WARNING: GStreamer not found, conversation will not be built.])])])
2056
2057 AS_IF([test "$extractor" != 1],
2058       [AC_MSG_WARN([ERROR: libextractor not found, but various file-sharing functions require it])])
2059
2060 AS_IF([test "x$working_libidn2" = x1],
2061       [AC_MSG_NOTICE([INFO: Using libidn2])])
2062 AS_IF([test "x$working_libidn1" = x1],
2063       [AC_MSG_NOTICE([INFO: Using libidn1])])
2064
2065 AC_MSG_NOTICE([NOTICE: Database support is set to MySQL: $mysql, SQLite: $sqlite, Postgres: $postgres])
2066
2067 AS_IF([test "$enable_framework_build" = "yes"],
2068       [AC_MSG_NOTICE([Mac OS X framework build enabled.])])
2069
2070 AC_MSG_NOTICE([********************************************
2071 Please make sure NOW that you have created a user and group 'gnunet'
2072 and additionally a group 'gnunetdns'. On Debian and Ubuntu GNU/Linux, type:
2073         addgroup gnunetdns
2074         adduser --system --group --disabled-login --home /var/lib/gnunet gnunet
2075
2076 Make sure that '/var/lib/gnunet' is owned (and writable) by user
2077 'gnunet'.  Then, you can compile GNUnet with
2078         make
2079
2080 After that, run (if necessary as 'root')
2081         make install
2082 to install everything.
2083
2084 Each GNUnet user should be added to the 'gnunet' group (may
2085 require fresh login to come into effect):
2086         adduser USERNAME gnunet
2087 (run the above command as root once for each of your users, replacing
2088 "USERNAME" with the respective login names).  If you have a global IP
2089 address, no further configuration is required.
2090
2091 For more detailed setup instructions, see https://docs.gnunet.org/
2092
2093 Optionally, download and compile gnunet-gtk to get a GUI for
2094 file-sharing and configuration.  This is particularly recommended
2095 if your network setup is non-trivial, as gnunet-setup can be
2096 used to test in the GUI if your network configuration is working.
2097 gnunet-setup should be run as the "gnunet" user under X.  As it
2098 does very little with the network, running it as "root" is likely
2099 also harmless.  You can also run it as a normal user, but then
2100 you have to copy ~/.gnunet/gnunet.conf" over to the "gnunet" user's
2101 home directory in the end.
2102
2103 Once you have configured your peer, run (as the 'gnunet' user)
2104         gnunet-arm -s
2105 to start the peer.  You can then run the various GNUnet-tools as
2106 your "normal" user (who should only be in the group 'gnunet').
2107 ********************************************])