From: Schanzenbach, Martin Date: Mon, 9 Sep 2019 12:11:38 +0000 (+0200) Subject: attempt fix flag detection again X-Git-Tag: v0.11.7~130 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=be6ab0620c2cac18847bd0124310f9225b5f5ba6;p=oweals%2Fgnunet.git attempt fix flag detection again --- diff --git a/configure.ac b/configure.ac index 7ca7250e7..5e0b3bd14 100644 --- a/configure.ac +++ b/configure.ac @@ -71,7 +71,7 @@ AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [ AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]), [ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $1" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])], + AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])], [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"], [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"]) CFLAGS="$ac_save_CFLAGS" @@ -81,9 +81,22 @@ AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [ [$2], [$3]) ]) + +# CC_CHECK_CFLAG_APPEND(FLAG, [action-if-found], [action-if-not-found]) +# Check for CFLAG and appends them to CFLAGS if supported +AC_DEFUN([CC_CHECK_CFLAG_APPEND], [ + AC_CACHE_CHECK([if $CC supports $1 flag], + AS_TR_SH([cc_cv_cflags_$1]), + CC_CHECK_CFLAGS_SILENT([$1]) + ) + + AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], + [CFLAGS="$CFLAGS $1"; $2], [$3]) +]) + + # We make heavy use of this, llvm/gcc and gcc-9 give warnings so disable. -CC_CHECK_CFLAGS_SILENT([-Wno-address-of-packed-member], - [CFLAGS="-Wno-address-of-packed-member $CFLAGS"]) +CC_CHECK_CFLAG_APPEND([-Wno-address-of-packed-member]) # Use Linux interface name unless the OS has a different preference DEFAULT_INTERFACE="\"eth0\""