diff --git a/libsharp/sharp_core.c b/libsharp/sharp_core.c
index 6cfb694681abdc5036d377100d015e3884fae354..f54a058b0e72e80a389bc420d3f59f3c4c463c7f 100644
--- a/libsharp/sharp_core.c
+++ b/libsharp/sharp_core.c
@@ -18,6 +18,11 @@ static t_architecture architecture_ = NULL;
 
 #ifdef MULTIARCH
 
+#if (defined(___AVX512F__) || defined(__FMA4__) || defined(__FMA__) || \
+     defined(__AVX2__) || defined(__AVX__))
+#error MULTIARCH specified but platform-specific flags detected
+#endif
+
 #define DECL(arch) \
 static int XCONCATX2(have,arch)(void) \
   { \
@@ -37,21 +42,11 @@ int XCONCATX2(sharp_veclen,arch) (void); \
 int XCONCATX2(sharp_max_nvec,arch) (int spin); \
 const char *XCONCATX2(sharp_architecture,arch) (void);
 
-#if (!defined(__AVX512F__))
 DECL(avx512f)
-#endif
-#if (!defined(__FMA4__))
 DECL(fma4)
-#endif
-#if (!defined(__FMA__))
 DECL(fma)
-#endif
-#if (!defined(__AVX2__))
 DECL(avx2)
-#endif
-#if (!defined(__AVX__))
 DECL(avx)
-#endif
 
 #endif
 
@@ -67,21 +62,11 @@ static void assign_funcs(void)
     architecture_ = XCONCATX2(sharp_architecture,arch); \
     return; \
     }
-#if (!defined(__AVX512F__))
 DECL2(avx512f)
-#endif
-#if (!defined(__FMA4__))
 DECL2(fma4)
-#endif
-#if (!defined(__FMA__))
 DECL2(fma)
-#endif
-#if (!defined(__AVX2__))
 DECL2(avx2)
-#endif
-#if (!defined(__AVX__))
 DECL2(avx)
-#endif
 #endif
   inner_loop_ = inner_loop_default;
   veclen_ = sharp_veclen_default;