$NetBSD: patch-configure.ac,v 1.4 2021/12/15 14:06:21 schmonz Exp $ Remove anonymous inner functions to build with clang. Remove outdated OpenSSL check to build with 1.1.x. Respect CFLAGS. --- configure.ac.orig 2015-04-30 00:53:36.000000000 +0000 +++ configure.ac @@ -22,7 +22,7 @@ AC_CONFIG_SRCDIR([spamdyke.h]) AC_CONFIG_HEADER([config.h]) AC_LANG_WERROR -CFLAGS=-Wall +CFLAGS="${CFLAGS} -Wall" # Checks for programs. AC_PROG_CC([[gcc]]) @@ -148,25 +148,15 @@ AS_IF([ test "x$enable_tls" != "xno" ], [], [ AC_MSG_RESULT([yes]) - AC_SEARCH_LIBS([RSA_sign], [ssl crypto], [], [ AC_MSG_FAILURE([--enable-tls was given but OpenSSL was not found]) ]) - AC_SEARCH_LIBS([SSL_library_init], - [ssl crypto], - [ LIBS="$LIBS -lssl" - AC_DEFINE([HAVE_LIBSSL], [1]) - AC_MSG_CHECKING([for OpenSSL libraries (for TLS support)]) - AC_MSG_RESULT([yes]) - ], - [ AS_IF([ test "x$enable_tls" = "xcheck" ], - [ AC_MSG_CHECKING([for OpenSSL libraries (for TLS support)]) - AC_MSG_RESULT([no, TLS disabled]) ], - [ AC_MSG_FAILURE([--enable-tls was given but OpenSSL was not found]) - ]) - ]) + AC_SEARCH_LIBS([RSA_sign], [ssl crypto], + [ LIBS="$LIBS -lssl" + AC_DEFINE([HAVE_LIBSSL], [1]) + ], + [ AC_MSG_FAILURE([--enable-tls was given but OpenSSL was not found]) ]) ], [ AC_MSG_RESULT([no]) - AC_MSG_NOTICE([Unable to include openssl/ssl.h (required by OpenSSL), TLS support disabled]) - enable_tls="no" + AC_MSG_NOTICE([Unable to include openssl/ssl.h (required by OpenSSL)]) ]) ], [ AC_MSG_NOTICE([OpenSSL check skipped, TLS support disabled]) ] @@ -188,37 +178,6 @@ AC_SEARCH_LIBS([getopt_long], [ AC_MSG_FAILURE([unable to compile without getopt_long(), you may need to install the libgnugetopt package/port]) ]) ]) -# Checks for the flag to compile anonymous inner functions. -AC_MSG_CHECKING([whether anonymous inner functions are supported by default]) -AC_TRY_COMPILE([], - [ int (*bar)(int) = ({ int tmp_action(int foo) { foo++; return(0); } &tmp_action; }); (*bar)(0); ], - [ AC_MSG_RESULT([yes]) ], - [ AC_MSG_RESULT([no]) - OLD_CFLAGS=$CFLAGS - CFLAGS="$OLD_CFLAGS -fnested-functions" - AC_MSG_CHECKING([whether anonymous inner functions are supported with -fnested-functions]) - AC_TRY_COMPILE([], - [ int (*bar)(int) = ({ int tmp_action(int foo) { foo++; return(0); } &tmp_action; }); (*bar)(0); ], - [ AC_MSG_RESULT([yes]) ], - [ AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS -ftrampolines" - AC_MSG_CHECKING([whether anonymous inner functions are supported with -ftrampolines]) - AC_TRY_COMPILE([], - [ int (*bar)(int) = ({ int tmp_action(int foo) { foo++; return(0); } &tmp_action; }); (*bar)(0); ], - [ AC_MSG_RESULT([yes]) ], - [ AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS -Wp,-Wno-trampolines" - AC_MSG_CHECKING([whether anonymous inner functions are supported with -Wp,-Wno-trampolines]) - AC_TRY_COMPILE([], - [ int (*bar)(int) = ({ int tmp_action(int foo) { foo++; return(0); } &tmp_action; }); (*bar)(0); ], - [ AC_MSG_RESULT([yes]) ], - [ AC_MSG_RESULT([no]) - AC_MSG_FAILURE([Unable to compile without anonymous inner function support.]) - ]) - ]) - ]) - ]) - AC_MSG_CHECKING([whether struct option is defined in getopt.h]) AC_TRY_COMPILE([ #define _GNU_SOURCE #include