From 4e90d19ea3de6b8938d097d84f6df3fcf6eb0422 Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Mon, 15 Feb 2021 13:59:02 -0500 Subject: [PATCH] build: detect ICC, only try ICC options if ICC Some ICC command-line options can cause confusion for other compilers; test for ICC specifically, and only try to use those options if ICC is being used. Signed-off-by: Mark Stapp --- configure.ac | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 266f37a1129..f3d1f38986a 100755 --- a/configure.ac +++ b/configure.ac @@ -191,6 +191,11 @@ CXXFLAGS="$orig_cxxflags" AC_PROG_CC_C99 dnl NB: see C11 below +dnl Some special handling for ICC later on +if test "$CC" = "icc"; then + cc_is_icc="yes" +fi + PKG_PROG_PKG_CONFIG dnl it's 2019, sed is sed. @@ -252,7 +257,9 @@ AC_DEFUN([AC_LINK_IFELSE_FLAGS], [{ dnl ICC won't bail on unknown options without -diag-error 10006 dnl need to do this first so we get useful results for the other options -AC_C_FLAG([-diag-error 10006]) +if test "$cc_is_icc" = "yes"; then + AC_C_FLAG([-diag-error 10006]) +fi dnl AC_PROG_CC_C99 may change CC to include -std=gnu99 or something ac_cc="$CC" @@ -335,7 +342,9 @@ AC_SUBST([CXX_COMPAT_CFLAGS]) dnl ICC emits a broken warning for const char *x = a ? "b" : "c"; dnl for some reason the string consts get 'promoted' to char *, dnl triggering a const to non-const conversion warning. -AC_C_FLAG([-diag-disable 3179]) +if test "$cc_is_icc" = "yes"; then + AC_C_FLAG([-diag-disable 3179]) +fi if test "$enable_werror" = "yes" ; then WERROR="-Werror"