aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-05-13 09:51:18 +0200
committerChristian Grothoff <christian@grothoff.org>2019-05-13 09:51:18 +0200
commit321c6b87981c455809251d567fe23476f0ad7e71 (patch)
treed10b943739f909d2af3b2893e8af8b3b3b2d57bd /configure.ac
parentd22f368443dabdca0de859f8e87b2be41d75ab1b (diff)
downloadgnunet-321c6b87981c455809251d567fe23476f0ad7e71.tar.gz
gnunet-321c6b87981c455809251d567fe23476f0ad7e71.zip
use AS_CASE/AS_IF
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac190
1 files changed, 72 insertions, 118 deletions
diff --git a/configure.ac b/configure.ac
index d90598cfc..815c015f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,13 +28,9 @@ AC_CONFIG_AUX_DIR([build-aux])
28AC_ARG_WITH(nssdir, 28AC_ARG_WITH(nssdir,
29 [ --with-nssdir=DIR legacy switch, no longer supported, do not use], 29 [ --with-nssdir=DIR legacy switch, no longer supported, do not use],
30 [AC_MSG_RESULT([$with_nssdir]) 30 [AC_MSG_RESULT([$with_nssdir])
31 case $with_nssdir in 31 AS_CASE([$with_nssdir],
32 no) 32 [no],[],
33 ;; 33 [AC_MSG_ERROR([--with-nssdir is no longer supported])])
34 *)
35 AC_MSG_ERROR([--with-nssdir is no longer supported])
36 ;;
37 esac
38 ]) 34 ])
39 35
40AC_CANONICAL_TARGET 36AC_CANONICAL_TARGET
@@ -64,10 +60,8 @@ AC_FUNC_FSEEKO
64 60
65CFLAGS="-Wall $CFLAGS" 61CFLAGS="-Wall $CFLAGS"
66# use '-fno-strict-aliasing', but only if the compiler can take it 62# use '-fno-strict-aliasing', but only if the compiler can take it
67if gcc -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1; 63AS_IF([gcc -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1],
68then 64 [CFLAGS="-fno-strict-aliasing $CFLAGS"])
69 CFLAGS="-fno-strict-aliasing $CFLAGS"
70fi
71 65
72# Use Linux interface name unless the OS has a different preference 66# Use Linux interface name unless the OS has a different preference
73DEFAULT_INTERFACE="\"eth0\"" 67DEFAULT_INTERFACE="\"eth0\""
@@ -243,86 +237,56 @@ AC_SUBST([PERL])
243# iptables is a soft requirement to run tests 237# iptables is a soft requirement to run tests
244AC_PATH_TARGET_TOOL(VAR_IPTABLES_BINARY, iptables, false) 238AC_PATH_TARGET_TOOL(VAR_IPTABLES_BINARY, iptables, false)
245 239
246if test x"$VAR_IPTABLES_BINARY" = x"false" 240AS_IF([test x"$VAR_IPTABLES_BINARY" = x"false"],
247then 241 [AS_IF([test -x "/sbin/iptables"],
248 if test -x "/sbin/iptables" 242 [VAR_IPTABLES_BINARY="/sbin/iptables"],
249 then 243 [AS_IF([test -x "/usr/sbin/iptables"],
250 VAR_IPTABLES_BINARY="/sbin/iptables" 244 [VAR_IPTABLES_BINARY="/usr/sbin/iptables"])])])
251 elif test -x "/usr/sbin/iptables"
252 then
253 VAR_IPTABLES_BINARY="/usr/sbin/iptables"
254 fi
255fi
256 245
257if test x"$VAR_IPTABLES_BINARY" != x"false" 246AS_IF([test x"$VAR_IPTABLES_BINARY" != x"false"],
258then 247 [AC_DEFINE_UNQUOTED([IPTABLES], "$VAR_IPTABLES_BINARY", [Path to iptables])],
259AC_DEFINE_UNQUOTED([IPTABLES], "$VAR_IPTABLES_BINARY", [Path to iptables]) 248 [AC_MSG_WARN([warning: 'iptables' not found.])])
260else
261AC_MSG_WARN([warning: 'iptables' not found.])
262fi
263 249
264# ip6tables is a soft requirement for some features 250# ip6tables is a soft requirement for some features
265AC_PATH_TARGET_TOOL(VAR_IP6TABLES_BINARY, ip6tables, false) 251AC_PATH_TARGET_TOOL(VAR_IP6TABLES_BINARY, ip6tables, false)
266 252
267if test x"$VAR_IP6TABLES_BINARY" = x"false" 253AS_IF([test x"$VAR_IP6TABLES_BINARY" = x"false"],
268then 254 [AS_IF([test -x "/sbin/ip6tables"],
269 if test -x "/sbin/ip6tables" 255 [VAR_IP6TABLES_BINARY="/sbin/ip6tables"],
270 then 256 [AS_IF([test -x "/usr/sbin/ip6tables"],
271 VAR_IP6TABLES_BINARY="/sbin/ip6tables" 257 [VAR_IP6TABLES_BINARY="/usr/sbin/ip6tables"])])])
272 elif test -x "/usr/sbin/ip6tables" 258
273 then
274 VAR_IP6TABLES_BINARY="/usr/sbin/ip6tables"
275 fi
276fi
277 259
278if test x"$VAR_IP6TABLES_BINARY" != x"false" 260AS_IF([test x"$VAR_IP6TABLES_BINARY" != x"false"],
279then 261 [AC_DEFINE_UNQUOTED([IP6TABLES], "$VAR_IP6TABLES_BINARY", [Path to ip6tables])],
280AC_DEFINE_UNQUOTED([IP6TABLES], "$VAR_IP6TABLES_BINARY", [Path to ip6tables]) 262 [AC_MSG_WARN([warning: 'ip6tables' not found.])])
281else
282AC_MSG_WARN([warning: 'ip6tables' not found.])
283fi
284 263
285# ip is a soft requirement for some features 264# ip is a soft requirement for some features
286AC_PATH_TARGET_TOOL(VAR_IP_BINARY, ip, false) 265AC_PATH_TARGET_TOOL(VAR_IP_BINARY, ip, false)
287 266
288if test x"$VAR_IP_BINARY" = x"false" 267AS_IF([test x"$VAR_IP_BINARY" = x"false"],
289then 268 [AS_IF([test -x "/sbin/ip"],
290 if test -x "/sbin/ip" 269 [VAR_IP_BINARY="/sbin/ip"],
291 then 270 [AS_IF([test -x "/usr/sbin/ip"],
292 VAR_IP_BINARY="/sbin/ip" 271 [VAR_IP_BINARY="/usr/sbin/ip"])])])
293 elif test -x "/usr/sbin/ip"
294 then
295 VAR_IP_BINARY="/usr/sbin/ip"
296 fi
297fi
298 272
299if test x"$VAR_IP_BINARY" != x"false" 273AS_IF([test x"$VAR_IP_BINARY" != x"false"],
300then 274 [AC_DEFINE_UNQUOTED([PATH_TO_IP], "$VAR_IP_BINARY", [Path to ip])],
301AC_DEFINE_UNQUOTED([PATH_TO_IP], "$VAR_IP_BINARY", [Path to ip]) 275 [AC_MSG_WARN([warning: 'ip' not found.])])
302else
303AC_MSG_WARN([warning: 'ip' not found.])
304fi
305 276
306# locate 'ifconfig' 277# locate 'ifconfig'
307AC_PATH_TARGET_TOOL(VAR_IFCONFIG_BINARY, ifconfig, false) 278AC_PATH_TARGET_TOOL(VAR_IFCONFIG_BINARY, ifconfig, false)
308 279
309AC_CHECK_PROG(VAR_IFCONFIG_BINARY, ifconfig, true, false) 280AC_CHECK_PROG(VAR_IFCONFIG_BINARY, ifconfig, true, false)
310if test x"$VAR_IFCONFIG_BINARY" = x"false" 281AS_IF([test x"$VAR_IFCONFIG_BINARY" = x"false"],
311then 282 [AS_IF([test -x "/sbin/ifconfig"],
312 if test -x "/sbin/ifconfig" 283 [VAR_IFCONFIG_BINARY="/sbin/ifconfig"],
313 then 284 [AS_IF([test -x "/usr/sbin/ifconfig"],
314 VAR_IFCONFIG_BINARY="/sbin/ifconfig" 285 [VAR_IFCONFIG_BINARY="/usr/sbin/ifconfig"])])])
315 elif test -x "/usr/sbin/ifconfig" 286
316 then 287AS_IF([test x"$VAR_IFCONFIG_BINARY" != x"false"],
317 VAR_IFCONFIG_BINARY="/usr/sbin/ifconfig" 288 [AC_DEFINE_UNQUOTED([IFCONFIG], "$VAR_IFCONFIG_BINARY", [Path to ifconfig])],
318 fi 289 [AC_MSG_WARN(['ifconfig' not found.])])
319fi
320if test x"$VAR_IFCONFIG_BINARY" != x"false"
321then
322AC_DEFINE_UNQUOTED([IFCONFIG], "$VAR_IFCONFIG_BINARY", [Path to ifconfig])
323else
324AC_MSG_WARN(['ifconfig' not found.])
325fi
326 290
327 291
328AC_PATH_TARGET_TOOL(VAR_SYSCTL_BINARY, sysctl, false) 292AC_PATH_TARGET_TOOL(VAR_SYSCTL_BINARY, sysctl, false)
@@ -340,12 +304,9 @@ AS_IF([test x"$VAR_SYSCTL_BINARY" != x"false"],
340# miniupnpc / upnpc binary is a soft runtime requirement 304# miniupnpc / upnpc binary is a soft runtime requirement
341AC_PATH_TARGET_TOOL(VAR_UPNPC_BINARY, upnpc, false) 305AC_PATH_TARGET_TOOL(VAR_UPNPC_BINARY, upnpc, false)
342 306
343if test x"$VAR_UPNPC_BINARY" != x"false" 307AS_IF([test x"$VAR_UPNPC_BINARY" != x"false"],
344then 308 [AC_DEFINE_UNQUOTED([UPNPC], "$VAR_UPNPC_BINARY", [Path to upnpc binary])],
345AC_DEFINE_UNQUOTED([UPNPC], "$VAR_UPNPC_BINARY", [Path to upnpc binary]) 309 [AC_MSG_WARN([warning: 'upnpc' binary not found.])])
346else
347AC_MSG_WARN([warning: 'upnpc' binary not found.])
348fi
349 310
350AC_CHECK_MEMBER(struct tm.tm_gmtoff, 311AC_CHECK_MEMBER(struct tm.tm_gmtoff,
351 [AC_DEFINE(HAVE_TM_GMTOFF, 1, 312 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
@@ -366,11 +327,9 @@ AM_CONDITIONAL(HAVE_GETADDRINFO_A, [test "$have_addrinfo_a" = 1])
366 327
367 328
368# tests only run on Windows 329# tests only run on Windows
369if test "x$build_target" = "xmingw" 330AS_IF([test "x$build_target" = "xmingw"],
370then 331 [AC_CHECK_LIB(plibc, plibc_init, [], [AC_MSG_ERROR([GNUnet requires PlibC on Windows])])
371 AC_CHECK_LIB(plibc, plibc_init, [], [AC_MSG_ERROR([GNUnet requires PlibC on Windows])]) 332 AC_CHECK_LIB(gnurx, regexec, [], [AC_MSG_ERROR([GNUnet requires libgnurx on Windows])])])
372 AC_CHECK_LIB(gnurx, regexec, [], [AC_MSG_ERROR([GNUnet requires libgnurx on Windows])])
373fi
374 333
375# libgcrypt 334# libgcrypt
376gcrypt=0 335gcrypt=0
@@ -381,8 +340,8 @@ NEED_LIBGCRYPT_VERSION=1.6.0
381AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION", gcrypt=1) 340AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION", gcrypt=1)
382AC_CHECK_DECLS([gcry_mpi_set_opaque_copy], [], [], [[#include <gcrypt.h>]]) 341AC_CHECK_DECLS([gcry_mpi_set_opaque_copy], [], [], [[#include <gcrypt.h>]])
383 342
384if test $gcrypt = 0 343AS_IF([test $gcrypt = 0],
385then 344 [
386 AC_MSG_ERROR([[ 345 AC_MSG_ERROR([[
387*** 346***
388*** You need libgcrypt to build this program. 347*** You need libgcrypt to build this program.
@@ -391,7 +350,7 @@ then
391*** (at least version $NEED_LIBGCRYPT_VERSION (API $NEED_LIBGCRYPT_API) 350*** (at least version $NEED_LIBGCRYPT_VERSION (API $NEED_LIBGCRYPT_API)
392*** is required.) 351*** is required.)
393***]]) 352***]])
394fi 353])
395AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], "$NEED_LIBGCRYPT_VERSION", [required libgcrypt version]) 354AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], "$NEED_LIBGCRYPT_VERSION", [required libgcrypt version])
396 355
397AC_CHECK_DECLS([struct in6_ifreq], [], [], [[#include <linux/if_tun.h>]]) 356AC_CHECK_DECLS([struct in6_ifreq], [], [], [[#include <linux/if_tun.h>]])
@@ -405,14 +364,14 @@ AC_ARG_ENABLE([documentation],
405 [documentation=${enableval}], 364 [documentation=${enableval}],
406 [documentation=yes]) 365 [documentation=yes])
407AC_MSG_RESULT($documentation) 366AC_MSG_RESULT($documentation)
408if test "x$documentation" = "xyes" 367AS_IF([test "x$documentation" = "xyes"],
409then 368[
410 AM_CONDITIONAL([DOCUMENTATION],true) 369 AM_CONDITIONAL([DOCUMENTATION],true)
411 AC_DEFINE([DOCUMENTATION],[1],[Building the documentation]) 370 AC_DEFINE([DOCUMENTATION],[1],[Building the documentation])
412else 371],[
413 AM_CONDITIONAL([DOCUMENTATION],false) 372 AM_CONDITIONAL([DOCUMENTATION],false)
414 AC_DEFINE([DOCUMENTATION],[0],[Not building the documentation]) 373 AC_DEFINE([DOCUMENTATION],[0],[Not building the documentation])
415fi 374])
416 375
417# FIXME: Something is wrong about this in the output of ./configure runs 376# FIXME: Something is wrong about this in the output of ./configure runs
418AC_MSG_CHECKING(wether to include generated texi2mdoc output in installation) 377AC_MSG_CHECKING(wether to include generated texi2mdoc output in installation)
@@ -444,14 +403,14 @@ AC_ARG_ENABLE([documentation-only],
444 [documentation_only=${enableval}], 403 [documentation_only=${enableval}],
445 [documentation_only=no]) 404 [documentation_only=no])
446AC_MSG_RESULT($documentation_only) 405AC_MSG_RESULT($documentation_only)
447if test "x$documentation_only" = "xyes" 406AS_IF([test "x$documentation_only" = "xyes"],
448then 407 [
449 AM_CONDITIONAL([DOCUMENTATION_ONLY],true) 408 AM_CONDITIONAL([DOCUMENTATION_ONLY],true)
450 AC_DEFINE([DOCUMENTATION_ONLY],[1],[Building only the documentation]) 409 AC_DEFINE([DOCUMENTATION_ONLY],[1],[Building only the documentation])
451else 410 ],[
452 AM_CONDITIONAL([DOCUMENTATION_ONLY],false) 411 AM_CONDITIONAL([DOCUMENTATION_ONLY],false)
453 AC_DEFINE([DOCUMENTATION_ONLY],[0],[Not building only the documentation]) 412 AC_DEFINE([DOCUMENTATION_ONLY],[0],[Not building only the documentation])
454fi 413 ])
455 414
456# should the build process be including the manpages? (default: yes) 415# should the build process be including the manpages? (default: yes)
457AC_MSG_CHECKING(whether to include man pages) 416AC_MSG_CHECKING(whether to include man pages)
@@ -460,40 +419,39 @@ AC_ARG_ENABLE([include-manpages],
460 [include_manpages=${enableval}], 419 [include_manpages=${enableval}],
461 [include_manpages=yes]) 420 [include_manpages=yes])
462AC_MSG_RESULT($include_manpages) 421AC_MSG_RESULT($include_manpages)
463if test "x$include_manpages" = "xyes" 422AS_IF([test "x$include_manpages" = "xyes"],
464then 423 [
465 AM_CONDITIONAL([INCLUDE_MANPAGES],true) 424 AM_CONDITIONAL([INCLUDE_MANPAGES],true)
466 AC_DEFINE([INCLUDE_MANPAGES],[1],[Including the man pages in the build and installation]) 425 AC_DEFINE([INCLUDE_MANPAGES],[1],[Including the man pages in the build and installation])
467else 426 ],[
468 AM_CONDITIONAL([INCLUDE_MANPAGES],false) 427 AM_CONDITIONAL([INCLUDE_MANPAGES],false)
469 AC_DEFINE([INCLUDE_MANPAGES],[0],[Not including the man pages in the build and installation]) 428 AC_DEFINE([INCLUDE_MANPAGES],[0],[Not including the man pages in the build and installation])
470fi 429 ])
471 430
472# Adam shostack suggests the following for Windows: 431# Adam shostack suggests the following for Windows:
473# -D_FORTIFY_SOURCE=2 -fstack-protector-all 432# -D_FORTIFY_SOURCE=2 -fstack-protector-all
474AC_ARG_ENABLE(gcc-hardening, 433AC_ARG_ENABLE(gcc-hardening,
475 AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks), 434 AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks),
476[if test x$enableval = xyes; then 435[AS_IF([test x$enableval = xyes],[
477 CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all" 436 CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all"
478 CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector" 437 CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector"
479 CFLAGS="$CFLAGS --param ssp-buffer-size=1" 438 CFLAGS="$CFLAGS --param ssp-buffer-size=1"
480 LDFLAGS="$LDFLAGS -pie" 439 LDFLAGS="$LDFLAGS -pie"
481fi]) 440 ])])
482 441
483# Linker hardening options 442# Linker hardening options
484# Currently these options are ELF specific - you can't use this with MacOSX 443# Currently these options are ELF specific - you can't use this with MacOSX
485AC_ARG_ENABLE(linker-hardening, 444AC_ARG_ENABLE(linker-hardening,
486 AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups), 445 AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups),
487[if test x$enableval = xyes; then 446[AS_IF([test x$enableval = xyes],
488 LDFLAGS="$LDFLAGS -z relro -z now" 447 [LDFLAGS="$LDFLAGS -z relro -z now"])])
489fi])
490 448
491 449
492AC_ARG_ENABLE(sanitizer, 450AC_ARG_ENABLE(sanitizer,
493 AS_HELP_STRING(--enable-sanitizer, enable Address Sanitizer and Undefined Behavior Sanitizer), 451 AS_HELP_STRING(--enable-sanitizer, enable Address Sanitizer and Undefined Behavior Sanitizer),
494[if test x$enableval = xyes; then 452[AS_IF([test x$enableval = xyes],[
495 LDFLAGS="$CFLAGS -fsanitize=address,undefined -fno-omit-frame-pointer" 453 LDFLAGS="$CFLAGS -fsanitize=address,undefined -fno-omit-frame-pointer"
496fi]) 454 ])])
497 455
498 456
499extra_logging=GNUNET_NO 457extra_logging=GNUNET_NO
@@ -512,18 +470,14 @@ AC_ARG_ENABLE([poisoning],
512 [AS_HELP_STRING([--enable-poisoning], [enable poisoning of freed memory (good for debugging)])], 470 [AS_HELP_STRING([--enable-poisoning], [enable poisoning of freed memory (good for debugging)])],
513 [enable_poisoning=${enableval}], 471 [enable_poisoning=${enableval}],
514 [ 472 [
515 if test "x$extra_logging" != "xGNUNET_NO"; then 473 AS_IF([test "x$extra_logging" != "xGNUNET_NO"],
516 enable_poisoning="defaults to yes (extra logging is enabled)" 474 [enable_poisoning="defaults to yes (extra logging is enabled)"],
517 else 475 [enable_poisoning=no])
518 enable_poisoning=no
519 fi
520 ]) 476 ])
521AC_MSG_RESULT($enable_poisoning) 477AC_MSG_RESULT($enable_poisoning)
522if test ! "x$enable_poisoning" = "xno"; then 478AS_IF([test ! "x$enable_poisoning" = "xno"],
523 enable_poisoning=1 479 [enable_poisoning=1],
524else 480 [enable_poisoning=0])
525 enable_poisoning=0
526fi
527AC_DEFINE_UNQUOTED([ENABLE_POISONING],[$enable_poisoning],[1 if freed memory should be poisoned, 0 otherwise]) 481AC_DEFINE_UNQUOTED([ENABLE_POISONING],[$enable_poisoning],[1 if freed memory should be poisoned, 0 otherwise])
528 482
529if test $build = $target 483if test $build = $target