From: Selva Nair Date: Tue, 19 Nov 2019 17:03:43 +0000 (-0500) Subject: Fix ACL_CHECK_ADD_COMPILE_FLAGS to work with clang X-Git-Tag: v2.5_beta1~238 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb8033d49bbfb1b02e75d8d71d0ad891e07a1b06;p=thirdparty%2Fopenvpn.git Fix ACL_CHECK_ADD_COMPILE_FLAGS to work with clang Some compilers (e.g., clang) only issue a warning for unsupported options unless an additional flag such as -Werror is used to convert the warning to an error. The behaviour is unchanged when using gcc as it either errors or ignores unknown options whether or not -Werror is present. Signed-off-by: Selva Nair Acked-by: David Sommerseth Message-Id: <1574183023-6136-1-git-send-email-selva.nair@gmail.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19170.html Signed-off-by: Gert Doering --- diff --git a/configure.ac b/configure.ac index 807804e5f..a47e0a06c 100644 --- a/configure.ac +++ b/configure.ac @@ -1275,11 +1275,14 @@ if test "${enable_pkcs11}" = "yes"; then ) fi +# When testing a compiler option, we add -Werror to force +# an error when the option is unsupported. This is not +# required for gcc, but some compilers such as clang needs it. AC_DEFUN([ACL_CHECK_ADD_COMPILE_FLAGS], [ old_cflags="$CFLAGS" - CFLAGS="$1 $CFLAGS" - AC_MSG_CHECKING([whether the compiler acceppts $1]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AC_MSG_RESULT([yes])], + CFLAGS="$1 -Werror $CFLAGS" + AC_MSG_CHECKING([whether the compiler accepts $1]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AC_MSG_RESULT([yes])]; CFLAGS="$1 $old_cflags", [AC_MSG_RESULT([no]); CFLAGS="$old_cflags"])] )