summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2021-10-12 14:36:08 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-10-13 17:56:43 +0000
commitb9e5823d950496f1ae3945f00cb4c76dabc24e9e (patch)
tree63fe6f303ae9e5e4645d294f8123036f349a432a /SConstruct
parent791308c096563937ca6e8d35e7ee326c735b17ae (diff)
downloadmongo-b9e5823d950496f1ae3945f00cb4c76dabc24e9e.tar.gz
SERVER-59498 Enforce current compiler minima for C++20 mode
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct99
1 files changed, 69 insertions, 30 deletions
diff --git a/SConstruct b/SConstruct
index 28f4cbffe74..fafda675b84 100644
--- a/SConstruct
+++ b/SConstruct
@@ -2624,41 +2624,80 @@ def doConfigure(myenv):
}
""" % compiler_minimum_string)
elif myenv.ToolchainIs('gcc'):
- compiler_minimum_string = "GCC 8.2"
- compiler_test_body = textwrap.dedent(
- """
- #if !defined(__GNUC__) || defined(__clang__)
- #error
- #endif
+ if get_option('cxx-std') == "20":
+ compiler_minimum_string = "GCC 11.2"
+ compiler_test_body = textwrap.dedent(
+ """
+ #if !defined(__GNUC__) || defined(__clang__)
+ #error
+ #endif
- #if (__GNUC__ < 8) || (__GNUC__ == 8 && __GNUC_MINOR__ < 2)
- #error %s or newer is required to build MongoDB
- #endif
+ #if (__GNUC__ < 11) || (__GNUC__ == 11 && __GNUC_MINOR__ < 2)
+ #error %s or newer is required to build MongoDB
+ #endif
- int main(int argc, char* argv[]) {
- return 0;
- }
- """ % compiler_minimum_string)
+ int main(int argc, char* argv[]) {
+ return 0;
+ }
+ """ % compiler_minimum_string)
+ else:
+ compiler_minimum_string = "GCC 8.2"
+ compiler_test_body = textwrap.dedent(
+ """
+ #if !defined(__GNUC__) || defined(__clang__)
+ #error
+ #endif
+
+ #if (__GNUC__ < 8) || (__GNUC__ == 8 && __GNUC_MINOR__ < 2)
+ #error %s or newer is required to build MongoDB
+ #endif
+
+ int main(int argc, char* argv[]) {
+ return 0;
+ }
+ """ % compiler_minimum_string)
elif myenv.ToolchainIs('clang'):
- compiler_minimum_string = "clang 7.0 (or Apple XCode 10.2)"
- compiler_test_body = textwrap.dedent(
- """
- #if !defined(__clang__)
- #error
- #endif
+ if get_option('cxx-std') == "20":
+ compiler_minimum_string = "clang 12.0 (or Apple XCode 13.0)"
+ compiler_test_body = textwrap.dedent(
+ """
+ #if !defined(__clang__)
+ #error
+ #endif
- #if defined(__apple_build_version__)
- #if __apple_build_version__ < 10010046
- #error %s or newer is required to build MongoDB
- #endif
- #elif (__clang_major__ < 7) || (__clang_major__ == 7 && __clang_minor__ < 0)
- #error %s or newer is required to build MongoDB
- #endif
+ #if defined(__apple_build_version__)
+ #if __apple_build_version__ < 13000029
+ #error %s or newer is required to build MongoDB
+ #endif
+ #elif (__clang_major__ < 12) || (__clang_major__ == 12 && __clang_minor__ < 0)
+ #error %s or newer is required to build MongoDB
+ #endif
+
+ int main(int argc, char* argv[]) {
+ return 0;
+ }
+ """ % (compiler_minimum_string, compiler_minimum_string))
+ else:
+ compiler_minimum_string = "clang 7.0 (or Apple XCode 10.2)"
+ compiler_test_body = textwrap.dedent(
+ """
+ #if !defined(__clang__)
+ #error
+ #endif
+
+ #if defined(__apple_build_version__)
+ #if __apple_build_version__ < 10010046
+ #error %s or newer is required to build MongoDB
+ #endif
+ #elif (__clang_major__ < 7) || (__clang_major__ == 7 && __clang_minor__ < 0)
+ #error %s or newer is required to build MongoDB
+ #endif
+
+ int main(int argc, char* argv[]) {
+ return 0;
+ }
+ """ % (compiler_minimum_string, compiler_minimum_string))
- int main(int argc, char* argv[]) {
- return 0;
- }
- """ % (compiler_minimum_string, compiler_minimum_string))
else:
myenv.ConfError("Error: can't check compiler minimum; don't know this compiler...")