From e87a6a04c705ab36ea92791e1f804ea78ef9a3b3 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 4 Feb 2015 10:00:28 -0800 Subject: [PATCH] opal_setup_cc.m4: see if -fno-common is supported If we want picky compilation, add -fno-common to CFLAGS if it is supported. --- config/opal_setup_cc.m4 | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/config/opal_setup_cc.m4 b/config/opal_setup_cc.m4 index 3e05e0e739..3f3e53a5f4 100644 --- a/config/opal_setup_cc.m4 +++ b/config/opal_setup_cc.m4 @@ -11,7 +11,7 @@ dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2006 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved. -dnl Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2012 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2015 Research Organization for Information Science @@ -131,6 +131,24 @@ AC_DEFUN([OPAL_SETUP_CC],[ # These flags are generally gcc-specific; even the # gcc-impersonating compilers won't accept them. OPAL_CFLAGS_BEFORE_PICKY="$CFLAGS" + + # If we want picky, see if the -fno-common flag is supported + if test $WANT_PICKY_COMPILER -eq 1; then + CFLAGS_orig="$CFLAGS" + CFLAGS="$CFLAGS -fno-common" + AC_CACHE_CHECK([if $CC supports -fno-common], + [opal_cv_cc_fno_common], + [AC_TRY_COMPILE([], [], + [opal_cv_cc_fno_common=yes], + [opal_cv_cc_fno_common=no]) + ]) + if test "$opal_cv_cc_fno_common" = "yes" ; then + AC_MSG_WARN([-fno-common has been added to CFLAGS (--enable-picky)]) + else + CFLAGS=$CFLAGS_orig + fi + fi + if test "$WANT_PICKY_COMPILER" = 1 && test "$opal_c_vendor" = "gnu" ; then add="-Wall -Wundef -Wno-long-long -Wsign-compare" add="$add -Wmissing-prototypes -Wstrict-prototypes"