aboutsummaryrefslogtreecommitdiffstats
path: root/src/build-data/detect_version.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/build-data/detect_version.cpp')
-rw-r--r--src/build-data/detect_version.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/build-data/detect_version.cpp b/src/build-data/detect_version.cpp
new file mode 100644
index 000000000..55e5db98d
--- /dev/null
+++ b/src/build-data/detect_version.cpp
@@ -0,0 +1,56 @@
+/*
+* This file is preprocessed to produce output that is examined by
+* configure.py to determine the compilers version number.
+*/
+
+#if defined(_MSC_VER)
+
+// _MSC_VER Defined as an integer literal that encodes the major and minor
+// number elements of the compiler's version number. The major number is
+// the first element of the period-delimited version number and the minor
+// number is the second element. For example, if the version number of the
+// Visual C++ compiler is 17.00.51106.1, the _MSC_VER macro evaluates to 1700.
+// https://msdn.microsoft.com/en-us/library/b0084kay.aspx
+
+MSVC _MSC_VER
+
+#elif defined(__clang__)
+
+#if defined(__apple_build_version__)
+
+/*
+Map Apple XCode versions back to standard Clang
+
+This is not a complete map, since we don't support any versions of
+Clang before 3.5 in any case, and it arbitrarily maps any version with
+XCode >= 9 to Clang 4.0. This is fine because we don't currently need
+any features not available in Clang 4.0
+*/
+
+#if __clang_major__ >= 9
+CLANG 4 0
+#elif __clang__major__ == 8
+CLANG 3 9
+#elif __clang__major__ == 7 && __clang__minor__ == 3
+CLANG 3 8
+#elif __clang__major__ == 7
+CLANG 3 7
+#else
+CLANG 3 5
+#endif
+
+#else
+
+CLANG __clang_major__ __clang_minor__
+
+#endif
+
+#elif defined(__GNUG__)
+
+GCC __GNUC__ __GNUC_MINOR__
+
+#else
+
+UNKNOWN 0 0
+
+#endif