]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
Build: Sync the compile check changes from CMakeLists.txt
authorLasse Collin <lasse.collin@tukaani.org>
Mon, 24 Jun 2024 20:34:34 +0000 (23:34 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Fri, 6 Sep 2024 16:25:52 +0000 (19:25 +0300)
It's nice to keep these in sync. The use of main() will later allow
AC_LINK_IFELSE usage too which may avoid the more fragile -Werror.

(cherry picked from commit 5a728813c378cc3c4c9c95793762452418d08f1b)

configure.ac

index 2e3320f0ec1a700e734c314b03088700a929927b..5698cdf5c0660d8a3d27ebc50de984622d485f36 100644 (file)
@@ -1028,10 +1028,11 @@ AS_IF([test "x$enable_clmul_crc" = xno], [
 #if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
 __attribute__((__target__("ssse3,sse4.1,pclmul")))
 #endif
-__m128i my_clmul(__m128i a)
+int main(void)
 {
-       const __m128i b = _mm_set_epi64x(1, 2);
-       return _mm_clmulepi64_si128(a, b, 0);
+       __m128i a = _mm_set_epi64x(1, 2);
+       a = _mm_clmulepi64_si128(a, a, 0);
+       return 0;
 }
        ]])], [
                AC_DEFINE([HAVE_USABLE_CLMUL], [1],
@@ -1068,9 +1069,9 @@ AS_IF([test "x$enable_arm64_crc32" = xno], [
 #if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
 __attribute__((__target__("+crc")))
 #endif
-uint32_t my_crc(uint32_t a, uint64_t b)
+int main(void)
 {
-       return __crc32d(a, b);
+       return __crc32d(1, 2) != 0;
 }
        ]])], [
                AC_DEFINE([HAVE_ARM64_CRC32], [1],
@@ -1131,13 +1132,13 @@ AS_CASE([$enable_sandbox],
                        #include <sys/syscall.h>
                        #include <sys/prctl.h>
 
-                       void my_sandbox(void)
+                       int main(void)
                        {
                                (void)prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
                                (void)SYS_landlock_create_ruleset;
                                (void)SYS_landlock_restrict_self;
                                (void)LANDLOCK_CREATE_RULESET_VERSION;
-                               return;
+                               return 0;
                        }
                ]])], [
                        enable_sandbox=found