diff options
author | Andrew Morrow <acm@10gen.com> | 2013-07-02 13:35:15 -0400 |
---|---|---|
committer | Andrew Morrow <acm@10gen.com> | 2013-07-02 13:35:15 -0400 |
commit | 2eceeb6202c17313fbcfe0cc101ec645b28bb350 (patch) | |
tree | 1c438ac2aed03e86a321b5f4f585cd5580d2de5e /SConstruct | |
parent | a6766a1b1d9cdbcdad70ed1115e129bb0bb17366 (diff) | |
download | mongo-2eceeb6202c17313fbcfe0cc101ec645b28bb350.tar.gz |
SERVER-9881 Use presence of a certain type_trait to detect libstdc++ 4.6.0 or better
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/SConstruct b/SConstruct index c47f1006c19..fc0a62513ec 100644 --- a/SConstruct +++ b/SConstruct @@ -1116,24 +1116,27 @@ def doConfigure(myenv): Exit(1) # Check to see if we are trying to use an outdated libstdc++ in C++11 mode. This is - # primarly to help people using clang in C++11 mode on OS X but forgetting to use --libc++. + # primarly to help people using clang in C++11 mode on OS X but forgetting to use + # --libc++. We would, ideally, check the __GLIBCXX__ version, but for various reasons this + # is not workable. Instead, we switch on the fact that std::is_nothrow_constructible wasn't + # introduced until libstdc++ 4.6.0. Earlier versions of libstdc++ than 4.6 are unlikely to + # work well anyway. if has_option('c++11') and not has_option('libc++'): def CheckModernLibStdCxx(context): - # See http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html for the origin of - # these values. Our choice of 4.7.0 is somewhat arbitrary. - minSupportedLibStdCxx = ("4.7.0", 20120322) - test_body = """ #include <vector> - #if defined(__GLIBCXX__) and (__GLIBCXX__ < %d) - #error + #include <cstdlib> + #if defined(__GLIBCXX__) + #include <type_traits> + int main() { + return std::is_nothrow_constructible<int>::value ? EXIT_SUCCESS : EXIT_FAILURE; + } #endif - """ % minSupportedLibStdCxx[1] + """ - messageText = 'Checking for libstdc++ %s or newer (for C++11 support)... ' - context.Message(messageText % minSupportedLibStdCxx[0]) + context.Message('Checking for libstdc++ 4.6.0 or better (for C++11 support)... ') ret = context.TryCompile(textwrap.dedent(test_body), ".cpp") context.Result(ret) return ret |