From a7e6e1fa8b89c930ae0a451ef1f1a52360760db3 Mon Sep 17 00:00:00 2001 From: Andrew Morrow Date: Wed, 13 Mar 2013 17:00:06 -0400 Subject: [PATCH] SERVER-8464 For C++11 builds, specify C99 mode for any C compiles --- SConstruct | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index 63610dbe241..6b8454a9666 100644 --- a/SConstruct +++ b/SConstruct @@ -885,9 +885,9 @@ def doConfigure(myenv): env.Append(**mutation) return available - # TOOD(acm): For clang, for instance, we need -Werror or invalid - # flags are only warnings. This should be handled more flexibly, but I'm - # leaving it here just to demonstrate. + def AddToCFLAGSIfSupported(env, flag): + return AddFlagIfSupported(env, 'C', '.c', flag, CFLAGS=[flag]) + def AddToCCFLAGSIfSupported(env, flag): return AddFlagIfSupported(env, 'C', '.c', flag, CCFLAGS=[flag]) @@ -933,6 +933,9 @@ def doConfigure(myenv): print( 'TCMalloc is not currently compatible with C++11' ) Exit(1) + if not AddToCFLAGSIfSupported(myenv, '-std=c99'): + print( 'C++11 mode selected for C++ files, but failed to enable C99 for C files' ) + # This needs to happen before we check for libc++, since it affects whether libc++ is available. if darwin and has_option('osx-version-min'): min_version = get_option('osx-version-min')