diff options
author | Jia Tan <jiat0218@gmail.com> | 2023-10-19 16:09:01 +0800 |
---|---|---|
committer | Jia Tan <jiat0218@gmail.com> | 2023-10-31 18:44:59 +0800 |
commit | 1695021e4a233a9388ddd428654c1447f0ea3bfb (patch) | |
tree | 49f2e7e3d85b239dde2a7c9ee2a62ac38bac7fae | |
parent | tuklib_integer: Revise unaligned reads and writes on strict-align archs. (diff) | |
download | xz-1695021e4a233a9388ddd428654c1447f0ea3bfb.tar.xz |
CMake: Add ALLOW_CLMUL_CRC option to enable/disable CLMUL.
The option is enabled by default, but will only be visible to a user
listing cache variables or using a CMake GUI application if the
immintrin.h header file is found.
This mirrors our Autotools build --disable-clmul-crc functionality.
-rw-r--r-- | CMakeLists.txt | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d329c25f..63f5af31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -802,23 +802,29 @@ if(HAVE_IMMINTRIN_H) tuklib_add_definition_if(liblzma HAVE__MM_MOVEMASK_EPI8) # CLMUL intrinsic: - check_c_source_compiles(" - #include <immintrin.h> - #if defined(__e2k__) && __iset__ < 6 - # error - #endif - #if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__) - __attribute__((__target__(\"ssse3,sse4.1,pclmul\"))) - #endif - __m128i my_clmul(__m128i a) - { - const __m128i b = _mm_set_epi64x(1, 2); - return _mm_clmulepi64_si128(a, b, 0); - } - int main(void) { return 0; } - " - HAVE_USABLE_CLMUL) - tuklib_add_definition_if(liblzma HAVE_USABLE_CLMUL) + option(ALLOW_CLMUL_CRC "Allow carryless multiplication for CRC \ +calculation if supported by the system" ON) + + if(ALLOW_CLMUL_CRC) + check_c_source_compiles(" + #include <immintrin.h> + #if defined(__e2k__) && __iset__ < 6 + # error + #endif + #if (defined(__GNUC__) || defined(__clang__)) \ + && !defined(__EDG__) + __attribute__((__target__(\"ssse3,sse4.1,pclmul\"))) + #endif + __m128i my_clmul(__m128i a) + { + const __m128i b = _mm_set_epi64x(1, 2); + return _mm_clmulepi64_si128(a, b, 0); + } + int main(void) { return 0; } + " + HAVE_USABLE_CLMUL) + tuklib_add_definition_if(liblzma HAVE_USABLE_CLMUL) + endif() endif() # Support -fvisiblity=hidden when building shared liblzma. |