diff --git a/CMakeLists.txt b/CMakeLists.txt index 48b1493b5..df87580de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,6 +75,16 @@ check_c_source_compiles(" " HAVE__DIV64 ) +check_c_source_compiles(" + typedef float vec __attribute__((ext_vector_type(4))); + int main() + { + vec a = (vec){0, 1, 2, 3}; + return 0; + } + " + HAVE_EXT_VECTOR_TYPE +) option(CMAKE_FIND_PACKAGE_PREFER_CONFIG "Lookup package config files before using find modules" ON) diff --git a/src/m_vector.h b/src/m_vector.h index 35373549d..74755f8b4 100644 --- a/src/m_vector.h +++ b/src/m_vector.h @@ -20,9 +20,10 @@ #include +#include "config.h" #include "doomtype.h" -#if defined(__has_attribute) && defined(__clang__) && __has_attribute(ext_vector_type) +#if defined(HAVE_EXT_VECTOR_TYPE) typedef float vec __attribute__((ext_vector_type(3))); #else typedef struct @@ -33,7 +34,7 @@ typedef struct } vec; #endif -#if defined(__has_attribute) && defined(__clang__) && __has_attribute(ext_vector_type) +#if defined(HAVE_EXT_VECTOR_TYPE) typedef float quat __attribute__((ext_vector_type(4))); #else typedef struct