aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2016-08-16 22:10:48 +0200
committerSimon Warta <[email protected]>2016-08-16 22:13:54 +0200
commit6fbeda78c3bd252dde96eb51d4e023d09d0dd81a (patch)
tree97c30bcb42c9bdbfc714383d18330eb9b2e6bb68
parentc2c77c3ec0bcbf5bdaffd4e89b36636789ceac84 (diff)
Check configured CPU arch against compiler setting
This adds a fast fail when trying to build Botan configured for 32 bit using a 64 bit compiler or vice versa. Check running python configure.py --cpu="x86_32" && make python configure.py --cpu="x86_64" && make or python configure.py && nmake on 64 bit Windows in a 32 bit Command Prompt. Closes #456.
-rw-r--r--src/build-data/buildh.in16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in
index 1d643248e..8b8f09ed5 100644
--- a/src/build-data/buildh.in
+++ b/src/build-data/buildh.in
@@ -272,4 +272,20 @@ Each read generates 32 bits of output
// The struct is only declared to force the semicolon, it is never defined.
#define BOTAN_FORCE_SEMICOLON struct BOTAN_DUMMY_STRUCT
+#if defined(BOTAN_TARGET_ARCH_IS_X86_64) && (\
+ (defined(_MSC_VER) && !defined(_WIN64)) || \
+ (defined(__clang__) && !defined(__x86_64__)) || \
+ (defined(__GNUG__) && !defined(__x86_64__)) \
+)
+ #error "Trying to compile Botan configured as x86_64 with non-x86_64 compiler."
+#endif
+
+#if defined(BOTAN_TARGET_ARCH_IS_X86_32) && (\
+ (defined(_MSC_VER) && defined(_WIN64)) || \
+ (defined(__clang__) && !defined(__i386__)) || \
+ (defined(__GNUG__) && !defined(__i386__)) \
+)
+ #error "Trying to compile Botan configured as x86_32 with non-x86_32 compiler."
+#endif
+
#endif