zlib-ng: add patch for lld 17+ (#44684)
- add new patch for recent lld - remove workaround for lld - drop old versions - drop old patches
This commit is contained in:
		| @@ -21,16 +21,6 @@ class ZlibNg(AutotoolsPackage, CMakePackage): | ||||
|     version("2.1.6", sha256="a5d504c0d52e2e2721e7e7d86988dec2e290d723ced2307145dedd06aeb6fef2") | ||||
|     version("2.1.5", sha256="3f6576971397b379d4205ae5451ff5a68edf6c103b2f03c4188ed7075fbb5f04") | ||||
|     version("2.1.4", sha256="a0293475e6a44a3f6c045229fe50f69dc0eebc62a42405a51f19d46a5541e77a") | ||||
|     version( | ||||
|         "2.1.3", | ||||
|         sha256="d20e55f89d71991c59f1c5ad1ef944815e5850526c0d9cd8e504eaed5b24491a", | ||||
|         deprecated=True, | ||||
|     ) | ||||
|     version( | ||||
|         "2.1.2", | ||||
|         sha256="383560d6b00697c04e8878e26c0187b480971a8bce90ffd26a5a7b0f7ecf1a33", | ||||
|         deprecated=True, | ||||
|     ) | ||||
|     version("2.0.7", sha256="6c0853bb27738b811f2b4d4af095323c3d5ce36ceed6b50e5f773204fb8f7200") | ||||
|     version("2.0.0", sha256="86993903527d9b12fc543335c19c1d33a93797b3d4d37648b5addae83679ecd8") | ||||
| 
 | ||||
| @@ -49,15 +39,14 @@ class ZlibNg(AutotoolsPackage, CMakePackage): | ||||
|     # reused. | ||||
|     build_system("autotools", "cmake", default="autotools") | ||||
| 
 | ||||
|     # rpath shenanigans, see https://github.com/zlib-ng/zlib-ng/pull/1546 | ||||
|     with when("@2.1.3"): | ||||
|         patch("pr-1546.patch", when="platform=darwin") | ||||
|         patch("pr-1542.patch")  # fix sse4.2 detection | ||||
|         patch("pr-1561.patch", when="build_system=autotools")  # drop bash dependency | ||||
|         patch("pr-1562.patch")  # improve intrinsics detection | ||||
|     # support lld 17+, can be removed after 2.1.7 release. | ||||
|     patch( | ||||
|         "https://github.com/zlib-ng/zlib-ng/commit/39dcc5aae7ad059b0d0c3a11e37e5ba7b7430c61.patch?full_index=1", | ||||
|         sha256="6614666f50e90ab23e658902dafe74243ab1f216a20aeab17d1705fddee8741d", | ||||
|         when="@2.1:2.1.6", | ||||
|     ) | ||||
| 
 | ||||
|     # fix building with NVHPC, see https://github.com/zlib-ng/zlib-ng/pull/1698 | ||||
|     # (@2.1.0:2.1.3 need the same changes but in a different file) | ||||
|     patch("pr-1698.patch", when="@2.1.4:%nvhpc+opt") | ||||
| 
 | ||||
|     with when("build_system=cmake"): | ||||
| @@ -76,8 +65,6 @@ def libs(self): | ||||
|     def flag_handler(self, name, flags): | ||||
|         if name == "cflags" and self.spec.satisfies("+pic build_system=autotools"): | ||||
|             flags.append(self.compiler.cc_pic_flag) | ||||
|         if name == "ldflags" and self.spec.satisfies("%cce@17"): | ||||
|             flags.append("-Wl,--undefined-version") | ||||
|         return (flags, None, None) | ||||
| 
 | ||||
| 
 | ||||
|   | ||||
| @@ -1,224 +0,0 @@ | ||||
| From 8c5d5eca51d9e4cd9aa046dba8f939b3f4012256 Mon Sep 17 00:00:00 2001 | ||||
| From: Hans Kristian Rosbach <hk-git@circlestorm.org> | ||||
| Date: Fri, 21 Jul 2023 13:43:15 +0200 | ||||
| Subject: [PATCH 1/3] Clean up SSE4.2 support, and no longer use asm fallback | ||||
|  or gcc builtin. | ||||
|  | ||||
| Defines changing meaning: | ||||
| X86_SSE42 used to mean the compiler supports crc asm fallback. | ||||
| X86_SSE42_CRC_INTRIN used to mean compiler supports SSE4.2 intrinsics. | ||||
|  | ||||
| X86_SSE42 now means compiler supports SSE4.2 intrinsics. | ||||
|  | ||||
| This therefore also fixes the adler32_sse42 checks, since those were depending | ||||
| on SSE4.2 intrinsics but was mistakenly checking the X86_SSE42 define. | ||||
| Now the X86_SSE42 define actually means what it appears to. | ||||
| --- | ||||
|  CMakeLists.txt                 |  5 +---- | ||||
|  arch/x86/insert_string_sse42.c | 36 +++++---------------------------- | ||||
|  cmake/detect-intrinsics.cmake  | 23 +++------------------ | ||||
|  configure                      | 37 ++++++++-------------------------- | ||||
|  win32/Makefile.msc             |  1 - | ||||
|  5 files changed, 17 insertions(+), 85 deletions(-) | ||||
|  | ||||
| diff --git a/CMakeLists.txt b/CMakeLists.txt | ||||
| index 420a5c78..1e42239a 100644 | ||||
| --- a/CMakeLists.txt | ||||
| +++ b/CMakeLists.txt | ||||
| @@ -827,15 +827,12 @@ if(WITH_OPTIM) | ||||
|          endif() | ||||
|          if(WITH_SSE42) | ||||
|              check_sse42_intrinsics() | ||||
| -            if(HAVE_SSE42CRC_INLINE_ASM OR HAVE_SSE42CRC_INTRIN) | ||||
| +            if(HAVE_SSE42_INTRIN) | ||||
|                  add_definitions(-DX86_SSE42) | ||||
|                  set(SSE42_SRCS ${ARCHDIR}/adler32_sse42.c ${ARCHDIR}/insert_string_sse42.c) | ||||
|                  add_feature_info(SSE42_CRC 1 "Support SSE4.2 optimized CRC hash generation, using \"${SSE42FLAG}\"") | ||||
|                  list(APPEND ZLIB_ARCH_SRCS ${SSE42_SRCS}) | ||||
|                  set_property(SOURCE ${SSE42_SRCS} PROPERTY COMPILE_FLAGS "${SSE42FLAG} ${NOLTOFLAG}") | ||||
| -                if(HAVE_SSE42CRC_INTRIN) | ||||
| -                    add_definitions(-DX86_SSE42_CRC_INTRIN) | ||||
| -                endif() | ||||
|              else() | ||||
|                  set(WITH_SSE42 OFF) | ||||
|              endif() | ||||
| diff --git a/arch/x86/insert_string_sse42.c b/arch/x86/insert_string_sse42.c | ||||
| index 565d92f9..ae092a7e 100644 | ||||
| --- a/arch/x86/insert_string_sse42.c | ||||
| +++ b/arch/x86/insert_string_sse42.c | ||||
| @@ -5,38 +5,13 @@ | ||||
|   * | ||||
|   */ | ||||
|   | ||||
| +#ifdef X86_SSE42 | ||||
|  #include "../../zbuild.h" | ||||
| -#include <immintrin.h> | ||||
| -#ifdef _MSC_VER | ||||
| -#  include <nmmintrin.h> | ||||
| -#endif | ||||
| +#include <nmmintrin.h> | ||||
|  #include "../../deflate.h" | ||||
|   | ||||
| -#ifdef X86_SSE42_CRC_INTRIN | ||||
| -#  ifdef _MSC_VER | ||||
| -#    define HASH_CALC(s, h, val)\ | ||||
| -        h = _mm_crc32_u32(h, val) | ||||
| -#  else | ||||
| -#    define HASH_CALC(s, h, val)\ | ||||
| -        h = __builtin_ia32_crc32si(h, val) | ||||
| -#  endif | ||||
| -#else | ||||
| -#  ifdef _MSC_VER | ||||
| -#    define HASH_CALC(s, h, val) {\ | ||||
| -        __asm mov edx, h\ | ||||
| -        __asm mov eax, val\ | ||||
| -        __asm crc32 eax, edx\ | ||||
| -        __asm mov h, eax\ | ||||
| -    } | ||||
| -#  else | ||||
| -#    define HASH_CALC(s, h, val) \ | ||||
| -        __asm__ __volatile__ (\ | ||||
| -            "crc32 %1,%0\n\t"\ | ||||
| -            : "+r" (h)\ | ||||
| -            : "r" (val)\ | ||||
| -        ); | ||||
| -#  endif | ||||
| -#endif | ||||
| +#define HASH_CALC(s, h, val)\ | ||||
| +    h = _mm_crc32_u32(h, val) | ||||
|   | ||||
|  #define HASH_CALC_VAR       h | ||||
|  #define HASH_CALC_VAR_INIT  uint32_t h = 0 | ||||
| @@ -45,6 +20,5 @@ | ||||
|  #define INSERT_STRING       insert_string_sse42 | ||||
|  #define QUICK_INSERT_STRING quick_insert_string_sse42 | ||||
|   | ||||
| -#ifdef X86_SSE42 | ||||
| -#  include "../../insert_string_tpl.h" | ||||
| +#include "../../insert_string_tpl.h" | ||||
|  #endif | ||||
| diff --git a/cmake/detect-intrinsics.cmake b/cmake/detect-intrinsics.cmake | ||||
| index 9cbc5908..52c54dc8 100644 | ||||
| --- a/cmake/detect-intrinsics.cmake | ||||
| +++ b/cmake/detect-intrinsics.cmake | ||||
| @@ -481,35 +481,18 @@ macro(check_sse42_intrinsics) | ||||
|              set(SSE42FLAG "-msse4.2") | ||||
|          endif() | ||||
|      endif() | ||||
| -    # Check whether compiler supports SSE4.2 CRC inline asm | ||||
| +    # Check whether compiler supports SSE4.2 intrinsics | ||||
|      set(CMAKE_REQUIRED_FLAGS "${SSE42FLAG} ${NATIVEFLAG}") | ||||
|      check_c_source_compile_or_run( | ||||
| -        "int main(void) { | ||||
| -            unsigned val = 0, h = 0; | ||||
| -        #if defined(_MSC_VER) | ||||
| -            { __asm mov edx, h __asm mov eax, val __asm crc32 eax, edx __asm mov h, eax } | ||||
| -        #else | ||||
| -            __asm__ __volatile__ ( \"crc32 %1,%0\" : \"+r\" (h) : \"r\" (val) ); | ||||
| -        #endif | ||||
| -            return (int)h; | ||||
| -        }" | ||||
| -        HAVE_SSE42CRC_INLINE_ASM | ||||
| -    ) | ||||
| -    # Check whether compiler supports SSE4.2 CRC intrinsics | ||||
| -    check_c_source_compile_or_run( | ||||
| -        "#include <immintrin.h> | ||||
| +        "#include <nmmintrin.h> | ||||
|          int main(void) { | ||||
|              unsigned crc = 0; | ||||
|              char c = 'c'; | ||||
| -        #if defined(_MSC_VER) | ||||
|              crc = _mm_crc32_u32(crc, c); | ||||
| -        #else | ||||
| -            crc = __builtin_ia32_crc32qi(crc, c); | ||||
| -        #endif | ||||
|              (void)crc; | ||||
|              return 0; | ||||
|          }" | ||||
| -        HAVE_SSE42CRC_INTRIN | ||||
| +        HAVE_SSE42_INTRIN | ||||
|      ) | ||||
|      set(CMAKE_REQUIRED_FLAGS) | ||||
|  endmacro() | ||||
| diff --git a/configure b/configure | ||||
| index 8714590e..6b4e7fff 100755 | ||||
| --- a/configure | ||||
| +++ b/configure | ||||
| @@ -1431,38 +1431,23 @@ EOF | ||||
|  } | ||||
|   | ||||
|  check_sse42_intrinsics() { | ||||
| -    # Check whether compiler supports SSE4.2 CRC inline asm | ||||
| -    cat > $test.c << EOF | ||||
| -int main(void) { | ||||
| -    unsigned val = 0, h = 0; | ||||
| -    __asm__ __volatile__ ( "crc32 %1,%0" : "+r" (h) : "r" (val) ); | ||||
| -    return (int) h; | ||||
| -} | ||||
| -EOF | ||||
| -    if try ${CC} ${CFLAGS} ${sse42flag} $test.c; then | ||||
| -        echo "Checking for SSE4.2 CRC inline assembly ... Yes." | tee -a configure.log | ||||
| -        HAVE_SSE42CRC_INLINE_ASM=1 | ||||
| -    else | ||||
| -        echo "Checking for SSE4.2 CRC inline assembly ... No." | tee -a configure.log | ||||
| -        HAVE_SSE42CRC_INLINE_ASM=0 | ||||
| -    fi | ||||
| - | ||||
| -    # Check whether compiler supports SSE4.2 CRC intrinsics | ||||
| +    # Check whether compiler supports SSE4.2 intrinsics | ||||
|      cat > $test.c << EOF | ||||
| +#include <nmmintrin.h> | ||||
|  int main(void) { | ||||
|      unsigned crc = 0; | ||||
|      char c = 'c'; | ||||
| -    crc = __builtin_ia32_crc32qi(crc, c); | ||||
| +    crc = _mm_crc32_u32(crc, c); | ||||
|      (void)crc; | ||||
|      return 0; | ||||
|  } | ||||
|  EOF | ||||
|      if try ${CC} ${CFLAGS} ${sse42flag} $test.c; then | ||||
| -        echo "Checking for SSE4.2 CRC intrinsics ... Yes." | tee -a configure.log | ||||
| -        HAVE_SSE42CRC_INTRIN=1 | ||||
| +        echo "Checking for SSE4.2 intrinsics ... Yes." | tee -a configure.log | ||||
| +        HAVE_SSE42_INTRIN=1 | ||||
|      else | ||||
| -        echo "Checking for SSE4.2 CRC intrinsics ... No." | tee -a configure.log | ||||
| -        HAVE_SSE42CRC_INTRIN=0 | ||||
| +        echo "Checking for SSE4.2 intrinsics ... No." | tee -a configure.log | ||||
| +        HAVE_SSE42_INTRIN=0 | ||||
|      fi | ||||
|  } | ||||
|   | ||||
| @@ -1606,15 +1591,9 @@ case "${ARCH}" in | ||||
|   | ||||
|              check_sse42_intrinsics | ||||
|   | ||||
| -            if test ${HAVE_SSE42CRC_INTRIN} -eq 1 || test ${HAVE_SSE42CRC_INLINE_ASM} -eq 1; then | ||||
| +            if test ${HAVE_SSE42_INTRIN} -eq 1; then | ||||
|                  CFLAGS="${CFLAGS} -DX86_SSE42" | ||||
|                  SFLAGS="${SFLAGS} -DX86_SSE42" | ||||
| - | ||||
| -                if test ${HAVE_SSE42CRC_INTRIN} -eq 1; then | ||||
| -                  CFLAGS="${CFLAGS} -DX86_SSE42_CRC_INTRIN" | ||||
| -                  SFLAGS="${SFLAGS} -DX86_SSE42_CRC_INTRIN" | ||||
| -                fi | ||||
| - | ||||
|                  ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_sse42.o insert_string_sse42.o" | ||||
|                  ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_sse42.lo insert_string_sse42.lo" | ||||
|              fi | ||||
| diff --git a/win32/Makefile.msc b/win32/Makefile.msc | ||||
| index 9ed26f28..3035072b 100644 | ||||
| --- a/win32/Makefile.msc | ||||
| +++ b/win32/Makefile.msc | ||||
| @@ -31,7 +31,6 @@ WFLAGS  = \ | ||||
|  	-DX86_PCLMULQDQ_CRC \ | ||||
|  	-DX86_SSE2 \ | ||||
|  	-DX86_SSE42 \ | ||||
| -	-DX86_SSE42_CRC_INTRIN \ | ||||
|  	-DX86_SSSE3 \ | ||||
|  	-DX86_AVX2 | ||||
|   | ||||
| --  | ||||
| 2.39.2 | ||||
|  | ||||
| @@ -1,182 +0,0 @@ | ||||
| From 101bc10dcef8d2cb45a51534180c7134001b07a9 Mon Sep 17 00:00:00 2001 | ||||
| From: Harmen Stoppels <me@harmenstoppels.nl> | ||||
| Date: Mon, 24 Jul 2023 09:37:57 +0200 | ||||
| Subject: [PATCH 1/3] Relative paths CMAKE_INSTALL_*, absolute paths | ||||
|  CMAKE_INSTALL_FULL_*; use @rpath/libname as install name on macOS | ||||
|  | ||||
| --- | ||||
|  CMakeLists.txt   | 46 ++-------------------------------------------- | ||||
|  configure        |  7 +------ | ||||
|  test/pkgcheck.sh |  2 +- | ||||
|  3 files changed, 4 insertions(+), 51 deletions(-) | ||||
|  | ||||
| diff --git a/CMakeLists.txt b/CMakeLists.txt | ||||
| index 003e66db7..46b85bc48 100644 | ||||
| --- a/CMakeLists.txt | ||||
| +++ b/CMakeLists.txt | ||||
| @@ -951,36 +951,8 @@ if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) | ||||
|      endif() | ||||
|  endif() | ||||
|   | ||||
| -# Refer to prefix symbolically to ease relocation by end user, | ||||
| -# as Makefile-generated .pc file does. | ||||
| -string(FIND "${CMAKE_INSTALL_INCLUDEDIR}" "${CMAKE_INSTALL_PREFIX}/" INCLUDEDIR_POS) | ||||
| -string(FIND "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_PREFIX}/" LIBDIR_POS) | ||||
| -string(LENGTH "${CMAKE_INSTALL_PREFIX}/" INSTALL_PREFIX_LEN) | ||||
| - | ||||
| -if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") | ||||
| -  set(PC_INC_INSTALL_DIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") | ||||
| -elseif(INCLUDEDIR_POS EQUAL 0) | ||||
| -  string(SUBSTRING "${CMAKE_INSTALL_INCLUDEDIR}" "${INSTALL_PREFIX_LEN}" "-1" INCLUDEDIR_RELATIVE) | ||||
| -  set(PC_INC_INSTALL_DIR "\${prefix}/${INCLUDEDIR_RELATIVE}") | ||||
| -else() | ||||
| -  set(PC_INC_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}") | ||||
| -endif() | ||||
| - | ||||
| -if(APPLE) | ||||
| -  option(WITH_RPATH "Enable RPATH for shared library" OFF) | ||||
| -endif() | ||||
| -if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") | ||||
| -  if(APPLE AND WITH_RPATH) | ||||
| -    set(PC_LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") | ||||
| -  else() | ||||
| -    set(PC_LIB_INSTALL_DIR "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") | ||||
| -  endif() | ||||
| -elseif(LIBDIR_POS EQUAL 0) | ||||
| -  string(SUBSTRING "${CMAKE_INSTALL_LIBDIR}" "${INSTALL_PREFIX_LEN}" "-1" LIBDIR_RELATIVE) | ||||
| -  set(PC_LIB_INSTALL_DIR "\${exec_prefix}/${LIBDIR_RELATIVE}") | ||||
| -else() | ||||
| -  set(PC_LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") | ||||
| -endif() | ||||
| +set(PC_INC_INSTALL_DIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}") | ||||
| +set(PC_LIB_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}") | ||||
|   | ||||
|  #============================================================================ | ||||
|  # zlib | ||||
| @@ -1142,11 +1114,6 @@ if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) | ||||
|          if(NOT APPLE) | ||||
|              set_target_properties(zlib PROPERTIES LINK_FLAGS | ||||
|                  "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.map\"") | ||||
| -        elseif(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}" OR NOT WITH_RPATH) | ||||
| -            # Match configure/make's behavior (i.e. don't use @rpath on mac when using absolute path). | ||||
| -            set_target_properties(zlib PROPERTIES INSTALL_NAME_DIR "@rpath/${CMAKE_INSTALL_FULL_LIBDIR}") | ||||
| -        else() | ||||
| -            set_target_properties(zlib PROPERTIES INSTALL_NAME_DIR "@rpath/${CMAKE_INSTALL_LIBDIR}") | ||||
|          endif() | ||||
|      endif() | ||||
|      if(MSYS) | ||||
| @@ -1183,11 +1150,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.h.in | ||||
|  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gzread.c.in | ||||
|      ${CMAKE_CURRENT_BINARY_DIR}/gzread.c @ONLY) | ||||
|   | ||||
| -# Fix install directory after generating zlib.pc/zlib-ng.pc | ||||
| -if (NOT IS_ABSOLUTE CMAKE_INSTALL_LIBDIR AND WITH_RPATH) | ||||
| -    set(CMAKE_INSTALL_LIBDIR "/${CMAKE_INSTALL_LIBDIR}") | ||||
| -endif() | ||||
| - | ||||
|  if (NOT ZLIB_SYMBOL_PREFIX STREQUAL "") | ||||
|      add_feature_info(ZLIB_SYMBOL_PREFIX ON "Publicly exported symbols have a custom prefix") | ||||
|      configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib_name_mangling${SUFFIX}.h.in | ||||
| @@ -1286,8 +1248,4 @@ endif() | ||||
|   | ||||
|  add_feature_info(INSTALL_UTILS INSTALL_UTILS "Copy minigzip and minideflate during install") | ||||
|   | ||||
| -if(APPLE) | ||||
| -    add_feature_info(WITH_RPATH WITH_RPATH "Enable RPATH for shared library") | ||||
| -endif() | ||||
| - | ||||
|  FEATURE_SUMMARY(WHAT ALL INCLUDE_QUIET_PACKAGES) | ||||
| diff --git a/configure b/configure | ||||
| index 29a64badf..6881f7af5 100755 | ||||
| --- a/configure | ||||
| +++ b/configure | ||||
| @@ -513,12 +513,7 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then | ||||
|               SHAREDLIBM=${LIBNAME}.$VER1$shared_ext | ||||
|               SHAREDTARGET=$SHAREDLIBV | ||||
|               LDSHARED=${LDSHARED-"$cc"} | ||||
| -             case ${libdir} in | ||||
| -             /*) | ||||
| -                 LDSHAREDFLAGS="-dynamiclib -install_name ${libdir}/${SHAREDLIBM} -compatibility_version ${VER1} -current_version ${VER3}" ;; | ||||
| -             *) | ||||
| -                 LDSHAREDFLAGS="-dynamiclib -install_name @rpath/${libdir}/${SHAREDLIBM} -compatibility_version ${VER1} -current_version ${VER3}" ;; | ||||
| -             esac | ||||
| +             LDSHAREDFLAGS="-dynamiclib -install_name @rpath/${SHAREDLIBM} -compatibility_version ${VER1} -current_version ${VER3}" | ||||
|               if libtool -V 2>&1 | grep Apple > /dev/null; then | ||||
|                   AR="libtool" | ||||
|               else | ||||
| diff --git a/test/pkgcheck.sh b/test/pkgcheck.sh | ||||
| index 629f98ade..6641b300a 100644 | ||||
| --- a/test/pkgcheck.sh | ||||
| +++ b/test/pkgcheck.sh | ||||
| @@ -81,7 +81,7 @@ Darwin) | ||||
|    sysctl -n machdep.cpu.features | ||||
|    sysctl -n machdep.cpu.leaf7_features | ||||
|    sysctl -n machdep.cpu.extfeatures | ||||
| -  CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib -DPKGCONFIG_INSTALL_DIR=/lib/pkgconfig -DWITH_RPATH=on ${CMAKE_ARGS}" | ||||
| +  CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib ${CMAKE_ARGS}" | ||||
|    CONFIGURE_ARGS="--libdir=lib ${CONFIGURE_ARGS}" | ||||
|    ;; | ||||
|  *) | ||||
|  | ||||
| From c6fbd1459eda454402c3450c670b7e538233b8d4 Mon Sep 17 00:00:00 2001 | ||||
| From: Harmen Stoppels <me@harmenstoppels.nl> | ||||
| Date: Mon, 24 Jul 2023 11:37:31 +0200 | ||||
| Subject: [PATCH 2/3] relocatable pc files by default, while allowing | ||||
|  discouraged absolute paths for CMAKE_INSTALL_[LIB|INCLUDE]DIR | ||||
|  | ||||
| --- | ||||
|  CMakeLists.txt | 15 +++++++++++++-- | ||||
|  1 file changed, 13 insertions(+), 2 deletions(-) | ||||
|  | ||||
| diff --git a/CMakeLists.txt b/CMakeLists.txt | ||||
| index 46b85bc48..1894d10d5 100644 | ||||
| --- a/CMakeLists.txt | ||||
| +++ b/CMakeLists.txt | ||||
| @@ -951,8 +951,19 @@ if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) | ||||
|      endif() | ||||
|  endif() | ||||
|   | ||||
| -set(PC_INC_INSTALL_DIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}") | ||||
| -set(PC_LIB_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}") | ||||
| +# The user is allowed (but discouraged) to set absolute CMAKE_INSTALL_*DIR paths. | ||||
| +# If they do, we copy these non-relocatable paths into the pkg-config file. | ||||
| +if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") | ||||
| +    set(PC_INC_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}") | ||||
| +else() | ||||
| +    set(PC_INC_INSTALL_DIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") | ||||
| +endif() | ||||
| + | ||||
| +if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") | ||||
| +    set(PC_LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") | ||||
| +else() | ||||
| +    set(PC_LIB_INSTALL_DIR "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") | ||||
| +endif() | ||||
|   | ||||
|  #============================================================================ | ||||
|  # zlib | ||||
|  | ||||
| From 0bae8f7d8379e5863b7c9328f0d71a87a33ca02f Mon Sep 17 00:00:00 2001 | ||||
| From: Harmen Stoppels <me@harmenstoppels.nl> | ||||
| Date: Mon, 24 Jul 2023 10:20:32 +0200 | ||||
| Subject: [PATCH 3/3] Remove relative configure --lib | ||||
|  | ||||
| --- | ||||
|  test/pkgcheck.sh | 5 ----- | ||||
|  1 file changed, 5 deletions(-) | ||||
|  | ||||
| diff --git a/test/pkgcheck.sh b/test/pkgcheck.sh | ||||
| index 6641b300a..94a67a191 100644 | ||||
| --- a/test/pkgcheck.sh | ||||
| +++ b/test/pkgcheck.sh | ||||
| @@ -81,11 +81,6 @@ Darwin) | ||||
|    sysctl -n machdep.cpu.features | ||||
|    sysctl -n machdep.cpu.leaf7_features | ||||
|    sysctl -n machdep.cpu.extfeatures | ||||
| -  CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib ${CMAKE_ARGS}" | ||||
| -  CONFIGURE_ARGS="--libdir=lib ${CONFIGURE_ARGS}" | ||||
| -  ;; | ||||
| -*) | ||||
| -  CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib ${CMAKE_ARGS}" | ||||
|    ;; | ||||
|  esac | ||||
|   | ||||
| @@ -1,210 +0,0 @@ | ||||
| From f6fb1d350a7b8210cc9c45ed502b3cc34e4dac32 Mon Sep 17 00:00:00 2001 | ||||
| From: Harmen Stoppels <me@harmenstoppels.nl> | ||||
| Date: Mon, 21 Aug 2023 10:13:10 +0200 | ||||
| Subject: [PATCH 2/3] PR #1561 | ||||
|  | ||||
| --- | ||||
|  configure | 50 +++++++++++++++++++++++++------------------------- | ||||
|  1 file changed, 25 insertions(+), 25 deletions(-) | ||||
|  | ||||
| diff --git a/configure b/configure | ||||
| index 6b4e7fff..fc78a135 100755 | ||||
| --- a/configure | ||||
| +++ b/configure | ||||
| @@ -1,4 +1,4 @@ | ||||
| -#!/usr/bin/env bash | ||||
| +#!/bin/sh | ||||
|  # configure script for zlib. | ||||
|  # | ||||
|  # Normally configure builds both a static and a shared library. | ||||
| @@ -230,13 +230,13 @@ test=ztest$$ | ||||
|  # put arguments in log, also put test file in log if used in arguments | ||||
|  show() | ||||
|  { | ||||
| -  case "$*" in | ||||
| +  case "$@" in | ||||
|      *$test.c*) | ||||
|        echo "=== $test.c ===" >> configure.log | ||||
|        cat $test.c >> configure.log | ||||
|        echo "===" >> configure.log;; | ||||
|    esac | ||||
| -  echo $* >> configure.log | ||||
| +  echo "$@" >> configure.log | ||||
|  } | ||||
|   | ||||
|  # check for gcc vs. cc and set compile and link flags based on the system identified by uname | ||||
| @@ -246,7 +246,7 @@ int main() {return getchar();} | ||||
|  EOF | ||||
|   | ||||
|  cc=${CC-${CROSS_PREFIX}gcc} | ||||
| -echo -n "Checking for compiler... " | tee -a configure.log | ||||
| +printf "Checking for compiler... " | tee -a configure.log | ||||
|  case "$cc" in | ||||
|    *gcc*) gcc=1 ;; | ||||
|    *clang*) gcc=1 ;; | ||||
| @@ -401,7 +401,7 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then | ||||
|      SFLAGS="${SFLAGS} -DNDEBUG" | ||||
|    fi | ||||
|    if test -z "$uname"; then | ||||
| -    uname=$((uname -s || echo unknown) 2>/dev/null) | ||||
| +    uname=$( (uname -s || echo unknown) 2>/dev/null) | ||||
|    fi | ||||
|    case "$uname" in | ||||
|    Linux* | linux* | GNU | GNU/* | solaris*) | ||||
| @@ -483,7 +483,7 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then | ||||
|          fi | ||||
|          RC="${CROSS_PREFIX}windres" | ||||
|          RCFLAGS="-I ${BUILDDIR}" | ||||
| -        if [ "$CC" == "mingw32-gcc" ]; then | ||||
| +        if [ "$CC" = "mingw32-gcc" ]; then | ||||
|            case $ARCH in | ||||
|            i386 | i486 | i586 | i686) RCFLAGS="${RCFLAGS} -F pe-i386";; | ||||
|            esac; | ||||
| @@ -498,7 +498,7 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then | ||||
|    HP-UX*) | ||||
|           LDSHARED=${LDSHARED-"$cc"} | ||||
|           LDSHAREDFLAGS="-shared" | ||||
| -         case $((uname -m || echo unknown) 2>/dev/null) in | ||||
| +         case $( (uname -m || echo unknown) 2>/dev/null) in | ||||
|           ia64) | ||||
|                   shared_ext='.so' | ||||
|                   SHAREDLIB='${LIBNAME}.so' ;; | ||||
| @@ -539,14 +539,14 @@ else | ||||
|    gcc=0 | ||||
|    echo "$CC" | tee -a configure.log | ||||
|    if test -z "$uname"; then | ||||
| -    uname=$((uname -sr || echo unknown) 2>/dev/null) | ||||
| +    uname=$( (uname -sr || echo unknown) 2>/dev/null) | ||||
|    fi | ||||
|    case "$uname" in | ||||
|    HP-UX*)    SFLAGS=${CFLAGS-"-O +z"} | ||||
|               CFLAGS=${CFLAGS-"-O"} | ||||
|               LDSHARED=${LDSHARED-"ld"} | ||||
|               LDSHAREDFLAGS="-b" | ||||
| -         case $((uname -m || echo unknown) 2>/dev/null) in | ||||
| +         case $( (uname -m || echo unknown) 2>/dev/null) in | ||||
|           ia64) | ||||
|               shared_ext='.so' | ||||
|               SHAREDLIB='${LIBNAME}.so' ;; | ||||
| @@ -591,15 +591,15 @@ EOF | ||||
|  if ($CC -c $CFLAGS $test.c) 2>/dev/null; then | ||||
|    try() | ||||
|    { | ||||
| -    show $* | ||||
| -    test "$(\( $* \) 2>&1 | tee -a configure.log)" = "" | ||||
| +    show "$@" | ||||
| +    test "$( ("$@") 2>&1 | tee -a configure.log)" = "" | ||||
|    } | ||||
|    echo - using any output from compiler to indicate an error >> configure.log | ||||
|  else | ||||
|    try() | ||||
|    { | ||||
| -    show $* | ||||
| -    ( $* ) >> configure.log 2>&1 | ||||
| +    show "$@" | ||||
| +    ( "$@" ) >> configure.log 2>&1 | ||||
|      ret=$? | ||||
|      if test $ret -ne 0; then | ||||
|        echo "(exit code $ret)" >> configure.log | ||||
| @@ -627,7 +627,7 @@ extern int getchar(); | ||||
|  int hello() {return getchar();} | ||||
|  EOF | ||||
|  if test $shared -eq 1; then | ||||
| -  echo -n "Checking for shared library support... " | tee -a configure.log | ||||
| +  printf "Checking for shared library support... " | tee -a configure.log | ||||
|    # we must test in two steps (cc then ld), required at least on SunOS 4.x | ||||
|    if try $CC -w -c $SFLAGS $test.c && | ||||
|       try $LDSHARED $LDSHAREDFLAGS $LDFLAGS -o $test$shared_ext $test.o $LDSHAREDLIBC; then | ||||
| @@ -784,7 +784,7 @@ fi | ||||
|  # Rename @ZLIB_SYMBOL_PREFIX@ to $symbol_prefix in gzread.c, zlib.h and zlib_name_mangling.h | ||||
|  sed < $SRCDIR/gzread.c.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > gzread.c | ||||
|  sed < $SRCDIR/zlib${SUFFIX}.h.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > zlib${SUFFIX}.h | ||||
| -if [[ ! -z $symbol_prefix ]]; then | ||||
| +if [ ! -z "$symbol_prefix" ]; then | ||||
|    sed < $SRCDIR/zlib_name_mangling${SUFFIX}.h.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > zlib_name_mangling${SUFFIX}.h | ||||
|  else | ||||
|    # symbol_prefix is not set, copy the empty mangling header | ||||
| @@ -814,7 +814,7 @@ fi | ||||
|  echo >> configure.log | ||||
|   | ||||
|  # check for ptrdiff_t and save result in zconf.h | ||||
| -echo -n "Checking for ptrdiff_t... " | tee -a configure.log | ||||
| +printf "Checking for ptrdiff_t... " | tee -a configure.log | ||||
|  cat > $test.c <<EOF | ||||
|  #include <stddef.h> | ||||
|  int fun(ptrdiff_t *a) { (void)a; return 0; } | ||||
| @@ -826,7 +826,7 @@ else | ||||
|      sed < zconf${SUFFIX}.h "/^#ifdef NEED_PTRDIFF_T.* may be/s/def NEED_PTRDIFF_T\(.*\) may be/ 1\1 was/" > zconf${SUFFIX}.temp.h | ||||
|      mv zconf${SUFFIX}.temp.h zconf${SUFFIX}.h | ||||
|   | ||||
| -    echo -n "Checking for sizeof(void *)... " | tee -a configure.log | ||||
| +    printf "Checking for sizeof(void *)... " | tee -a configure.log | ||||
|      cat > $test.c <<EOF | ||||
|  #include <stdint.h> | ||||
|  #define COMPILE_TIME_ASSERT(pred) struct s { int x: (pred) ? 1 : -1; } | ||||
| @@ -864,7 +864,7 @@ if test $compat -eq 1; then | ||||
|    esac | ||||
|  fi | ||||
|   | ||||
| -if [[ ! -z $DEFFILE ]]; then | ||||
| +if [ ! -z "$DEFFILE" ]; then | ||||
|    mkdir -p win32 | ||||
|    sed < $SRCDIR/$DEFFILE.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > $DEFFILE | ||||
|  fi | ||||
| @@ -1476,14 +1476,14 @@ EOF | ||||
|   | ||||
|  check_vgfma_intrinsics() { | ||||
|      # Check whether "VECTOR GALOIS FIELD MULTIPLY SUM AND ACCUMULATE" intrinsic is available | ||||
| -    echo -n "Checking for -mzarch... " | tee -a configure.log | ||||
| +    printf "Checking for -mzarch... " | tee -a configure.log | ||||
|      if try $CC -x c -c /dev/null -o /dev/null -mzarch; then | ||||
|          echo Yes. | tee -a configure.log | ||||
|          vgfmaflag="${vgfmaflag} -mzarch" | ||||
|      else | ||||
|          echo No. | tee -a configure.log | ||||
|      fi | ||||
| -    echo -n "Checking for -fzvector... " | tee -a configure.log | ||||
| +    printf "Checking for -fzvector... " | tee -a configure.log | ||||
|      if try $CC -x c -c /dev/null -o /dev/null -fzvector; then | ||||
|          echo Yes. | tee -a configure.log | ||||
|          vgfmaflag="${vgfmaflag} -fzvector" | ||||
| @@ -1500,7 +1500,7 @@ int main(void) { | ||||
|      return c[0]; | ||||
|  } | ||||
|  EOF | ||||
| -    echo -n "Checking for VGFMA support... " | tee -a configure.log | ||||
| +    printf "Checking for VGFMA support... " | tee -a configure.log | ||||
|      if try $CC -c $CFLAGS $vgfmaflag $test.c; then | ||||
|          HAVE_VGFMA_INTRIN=1 | ||||
|          echo "Yes." | tee -a configure.log | ||||
| @@ -2156,11 +2156,11 @@ for file in $SRCDIR/*.c $SRCDIR/test/*.c $SRCDIR/test/fuzz/*.c $SRCDIR/$ARCHDIR/ | ||||
|                     # Check that the include file exists in the current dir, | ||||
|                     # otherwise it may be one of the system include header. | ||||
|                     if test -e $SRCDIR/$i; then | ||||
| -                       echo -n " \$(SRCDIR)/$i" | ||||
| +                       printf " \$(SRCDIR)/$i" | ||||
|                     fi | ||||
|                     # We also need to check whether the include file is in the ARCHDIR. | ||||
|                     if test -e $SRCDIR/$ARCHDIR/$i; then | ||||
| -                       echo -n " \$(SRCDIR)/$ARCHDIR/$i" | ||||
| +                       printf " \$(SRCDIR)/$ARCHDIR/$i" | ||||
|                     fi | ||||
|                 done) | ||||
|      obj=$(basename $(echo $file | sed -e 's/\.c/\.o/g' -e 's#^\./##g')) | ||||
| @@ -2233,11 +2233,11 @@ for file in $SRCDIR/$ARCHDIR/*.c; do | ||||
|                     # Check that the include file exists in the current dir, | ||||
|                     # otherwise it may be one of the system include header. | ||||
|                     if test -e $SRCDIR/$i; then | ||||
| -                       echo -n " \$(SRCTOP)/$i" | ||||
| +                       printf " \$(SRCTOP)/$i" | ||||
|                     fi | ||||
|                     # We also need to check whether the include file is in the ARCHDIR. | ||||
|                     if test -e $SRCDIR/$ARCHDIR/$i; then | ||||
| -                       echo -n " \$(SRCDIR)/$i" | ||||
| +                       printf " \$(SRCDIR)/$i" | ||||
|                     fi | ||||
|                 done) | ||||
|      obj=$(basename $(echo $file | sed -e 's/\.c/\.o/g' -e 's#^\./##g')) | ||||
| --  | ||||
| 2.39.2 | ||||
|  | ||||
| @@ -1,432 +0,0 @@ | ||||
| From 13df84c54aaf06cc7aeb1813ef60b17591d29ea3 Mon Sep 17 00:00:00 2001 | ||||
| From: Harmen Stoppels <me@harmenstoppels.nl> | ||||
| Date: Mon, 21 Aug 2023 11:10:29 +0200 | ||||
| Subject: [PATCH 3/3] PR #1562 | ||||
|  | ||||
| --- | ||||
|  cmake/detect-intrinsics.cmake | 118 ++++++++++++---------------------- | ||||
|  configure                     | 115 ++++++++++----------------------- | ||||
|  2 files changed, 73 insertions(+), 160 deletions(-) | ||||
|  | ||||
| diff --git a/cmake/detect-intrinsics.cmake b/cmake/detect-intrinsics.cmake | ||||
| index 52c54dc8..d476093f 100644 | ||||
| --- a/cmake/detect-intrinsics.cmake | ||||
| +++ b/cmake/detect-intrinsics.cmake | ||||
| @@ -62,28 +62,19 @@ macro(check_avx512_intrinsics) | ||||
|      set(CMAKE_REQUIRED_FLAGS "${AVX512FLAG} ${NATIVEFLAG}") | ||||
|      check_c_source_compile_or_run( | ||||
|          "#include <immintrin.h> | ||||
| -        int main(void) { | ||||
| -            __m512i x = _mm512_set1_epi8(2); | ||||
| -            const __m512i y = _mm512_set_epi32(0x1020304, 0x5060708, 0x90a0b0c, 0xd0e0f10, | ||||
| -                                               0x11121314, 0x15161718, 0x191a1b1c, 0x1d1e1f20, | ||||
| -                                               0x21222324, 0x25262728, 0x292a2b2c, 0x2d2e2f30, | ||||
| -                                               0x31323334, 0x35363738, 0x393a3b3c, 0x3d3e3f40); | ||||
| -            x = _mm512_sub_epi8(x, y); | ||||
| -            (void)x; | ||||
| -            return 0; | ||||
| -        }" | ||||
| +        __m512i f(__m512i y) { | ||||
| +          __m512i x = _mm512_set1_epi8(2); | ||||
| +          return _mm512_sub_epi8(x, y); | ||||
| +        } | ||||
| +        int main(void) { return 0; }" | ||||
|          HAVE_AVX512_INTRIN | ||||
|      ) | ||||
|   | ||||
|      # Evidently both GCC and clang were late to implementing these | ||||
|      check_c_source_compile_or_run( | ||||
|          "#include <immintrin.h> | ||||
| -        int main(void) { | ||||
| -            __mmask16 a = 0xFF; | ||||
| -            a = _knot_mask16(a); | ||||
| -            (void)a; | ||||
| -            return 0; | ||||
| -        }" | ||||
| +        __mmask16 f(__mmask16 x) { return _knot_mask16(x); } | ||||
| +        int main(void) { return 0; }" | ||||
|          HAVE_MASK_INTRIN | ||||
|      ) | ||||
|      set(CMAKE_REQUIRED_FLAGS) | ||||
| @@ -117,17 +108,11 @@ macro(check_avx512vnni_intrinsics) | ||||
|      set(CMAKE_REQUIRED_FLAGS "${AVX512VNNIFLAG} ${NATIVEFLAG}") | ||||
|      check_c_source_compile_or_run( | ||||
|          "#include <immintrin.h> | ||||
| -        int main(void) { | ||||
| -            __m512i x = _mm512_set1_epi8(2); | ||||
| -            const __m512i y = _mm512_set_epi8(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, | ||||
| -                                              20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, | ||||
| -                                              38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, | ||||
| -                                              56, 57, 58, 59, 60, 61, 62, 63, 64); | ||||
| +        __m512i f(__m512i x, __m512i y) { | ||||
|              __m512i z = _mm512_setzero_epi32(); | ||||
| -            z = _mm512_dpbusd_epi32(z, x, y); | ||||
| -            (void)z; | ||||
| -            return 0; | ||||
| -        }" | ||||
| +            return _mm512_dpbusd_epi32(z, x, y); | ||||
| +        } | ||||
| +        int main(void) { return 0; }" | ||||
|          HAVE_AVX512VNNI_INTRIN | ||||
|      ) | ||||
|      set(CMAKE_REQUIRED_FLAGS) | ||||
| @@ -151,13 +136,11 @@ macro(check_avx2_intrinsics) | ||||
|      set(CMAKE_REQUIRED_FLAGS "${AVX2FLAG} ${NATIVEFLAG}") | ||||
|      check_c_source_compile_or_run( | ||||
|          "#include <immintrin.h> | ||||
| -        int main(void) { | ||||
| -            __m256i x = _mm256_set1_epi16(2); | ||||
| +        __m256i f(__m256i x) { | ||||
|              const __m256i y = _mm256_set1_epi16(1); | ||||
| -            x = _mm256_subs_epu16(x, y); | ||||
| -            (void)x; | ||||
| -            return 0; | ||||
| -        }" | ||||
| +            return _mm256_subs_epu16(x, y); | ||||
| +        } | ||||
| +        int main(void) { return 0; }" | ||||
|          HAVE_AVX2_INTRIN | ||||
|      ) | ||||
|      set(CMAKE_REQUIRED_FLAGS) | ||||
| @@ -204,12 +187,8 @@ macro(check_neon_ld4_intrinsics) | ||||
|          #else | ||||
|          #  include <arm_neon.h> | ||||
|          #endif | ||||
| -        int main(void) { | ||||
| -            int stack_var[16]; | ||||
| -            int32x4x4_t v = vld1q_s32_x4(stack_var); | ||||
| -            (void)v; | ||||
| -            return 0; | ||||
| -        }" | ||||
| +        int32x4x4_t f(int var[16]) { return vld1q_s32_x4(var); } | ||||
| +        int main(void) { return 0; }" | ||||
|          NEON_HAS_LD4) | ||||
|      set(CMAKE_REQUIRED_FLAGS) | ||||
|  endmacro() | ||||
| @@ -226,13 +205,9 @@ macro(check_pclmulqdq_intrinsics) | ||||
|          set(CMAKE_REQUIRED_FLAGS "${PCLMULFLAG} ${NATIVEFLAG}") | ||||
|          check_c_source_compile_or_run( | ||||
|              "#include <immintrin.h> | ||||
| -            int main(void) { | ||||
| -                __m128i a = _mm_setzero_si128(); | ||||
| -                __m128i b = _mm_setzero_si128(); | ||||
| -                __m128i c = _mm_clmulepi64_si128(a, b, 0x10); | ||||
| -                (void)c; | ||||
| -                return 0; | ||||
| -            }" | ||||
| +            #include <wmmintrin.h> | ||||
| +            __m128i f(__m128i a, __m128i b) { return _mm_clmulepi64_si128(a, b, 0x10); } | ||||
| +            int main(void) { return 0; }" | ||||
|              HAVE_PCLMULQDQ_INTRIN | ||||
|          ) | ||||
|          set(CMAKE_REQUIRED_FLAGS) | ||||
| @@ -252,13 +227,12 @@ macro(check_vpclmulqdq_intrinsics) | ||||
|          set(CMAKE_REQUIRED_FLAGS "${VPCLMULFLAG} ${NATIVEFLAG}") | ||||
|          check_c_source_compile_or_run( | ||||
|              "#include <immintrin.h> | ||||
| -            int main(void) { | ||||
| -                __m512i a = _mm512_setzero_si512(); | ||||
| +            #include <wmmintrin.h> | ||||
| +            __m512i f(__m512i a) { | ||||
|                  __m512i b = _mm512_setzero_si512(); | ||||
| -                __m512i c = _mm512_clmulepi64_epi128(a, b, 0x10); | ||||
| -                (void)c; | ||||
| -                return 0; | ||||
| -            }" | ||||
| +                return _mm512_clmulepi64_epi128(a, b, 0x10); | ||||
| +            } | ||||
| +            int main(void) { return 0; }" | ||||
|              HAVE_VPCLMULQDQ_INTRIN | ||||
|          ) | ||||
|          set(CMAKE_REQUIRED_FLAGS) | ||||
| @@ -431,11 +405,8 @@ macro(check_sse2_intrinsics) | ||||
|      set(CMAKE_REQUIRED_FLAGS "${SSE2FLAG} ${NATIVEFLAG}") | ||||
|      check_c_source_compile_or_run( | ||||
|          "#include <immintrin.h> | ||||
| -        int main(void) { | ||||
| -            __m128i zero = _mm_setzero_si128(); | ||||
| -            (void)zero; | ||||
| -            return 0; | ||||
| -        }" | ||||
| +        __m128i f(__m128i x, __m128i y) { return _mm_sad_epu8(x, y); } | ||||
| +        int main(void) { return 0; }" | ||||
|          HAVE_SSE2_INTRIN | ||||
|      ) | ||||
|      set(CMAKE_REQUIRED_FLAGS) | ||||
| @@ -457,14 +428,11 @@ macro(check_ssse3_intrinsics) | ||||
|      set(CMAKE_REQUIRED_FLAGS "${SSSE3FLAG} ${NATIVEFLAG}") | ||||
|      check_c_source_compile_or_run( | ||||
|          "#include <immintrin.h> | ||||
| -        int main(void) { | ||||
| -            __m128i u, v, w; | ||||
| -            u = _mm_set1_epi32(1); | ||||
| -            v = _mm_set1_epi32(2); | ||||
| -            w = _mm_hadd_epi32(u, v); | ||||
| -            (void)w; | ||||
| -            return 0; | ||||
| -        }" | ||||
| +        __m128i f(__m128i u) { | ||||
| +          __m128i v = _mm_set1_epi32(1); | ||||
| +          return _mm_hadd_epi32(u, v); | ||||
| +        } | ||||
| +        int main(void) { return 0; }" | ||||
|          HAVE_SSSE3_INTRIN | ||||
|      ) | ||||
|  endmacro() | ||||
| @@ -485,13 +453,8 @@ macro(check_sse42_intrinsics) | ||||
|      set(CMAKE_REQUIRED_FLAGS "${SSE42FLAG} ${NATIVEFLAG}") | ||||
|      check_c_source_compile_or_run( | ||||
|          "#include <nmmintrin.h> | ||||
| -        int main(void) { | ||||
| -            unsigned crc = 0; | ||||
| -            char c = 'c'; | ||||
| -            crc = _mm_crc32_u32(crc, c); | ||||
| -            (void)crc; | ||||
| -            return 0; | ||||
| -        }" | ||||
| +        unsigned int f(unsigned int a, unsigned int b) { return _mm_crc32_u32(a, b); } | ||||
| +        int main(void) { return 0; }" | ||||
|          HAVE_SSE42_INTRIN | ||||
|      ) | ||||
|      set(CMAKE_REQUIRED_FLAGS) | ||||
| @@ -529,13 +492,12 @@ macro(check_xsave_intrinsics) | ||||
|      set(CMAKE_REQUIRED_FLAGS "${XSAVEFLAG} ${NATIVEFLAG}") | ||||
|      check_c_source_compiles( | ||||
|          "#ifdef _WIN32 | ||||
| -         #  include <intrin.h> | ||||
| -         #else | ||||
| -         #  include <x86gprintrin.h> | ||||
| -         #endif | ||||
| -         int main(void) { | ||||
| -             return _xgetbv(0); | ||||
| -         }" | ||||
| +        #  include <intrin.h> | ||||
| +        #else | ||||
| +        #  include <x86gprintrin.h> | ||||
| +        #endif | ||||
| +        unsigned int f(unsigned int a) { return _xgetbv(a); } | ||||
| +        int main(void) { return 0; }" | ||||
|          HAVE_XSAVE_INTRIN FAIL_REGEX "not supported") | ||||
|      set(CMAKE_REQUIRED_FLAGS) | ||||
|  endmacro() | ||||
| diff --git a/configure b/configure | ||||
| index fc78a135..e5a1965f 100755 | ||||
| --- a/configure | ||||
| +++ b/configure | ||||
| @@ -1023,12 +1023,8 @@ fi | ||||
|   | ||||
|  # Check for __builtin_ctz() support in compiler | ||||
|  cat > $test.c << EOF | ||||
| -int main(void) { | ||||
| -    unsigned int zero = 0; | ||||
| -    long test = __builtin_ctz(zero); | ||||
| -    (void)test; | ||||
| -    return 0; | ||||
| -} | ||||
| +long f(unsigned int x) { return __builtin_ctz(x); } | ||||
| +int main(void) { return 0; } | ||||
|  EOF | ||||
|  if try ${CC} ${CFLAGS} $test.c $LDSHAREDLIBC; then | ||||
|      echo "Checking for __builtin_ctz ... Yes." | tee -a configure.log | ||||
| @@ -1040,12 +1036,8 @@ fi | ||||
|   | ||||
|  # Check for __builtin_ctzll() support in compiler | ||||
|  cat > $test.c << EOF | ||||
| -int main(void) { | ||||
| -    unsigned long long zero = 0; | ||||
| -    long test = __builtin_ctzll(zero); | ||||
| -    (void)test; | ||||
| -    return 0; | ||||
| -} | ||||
| +long f(unsigned long long x) { return __builtin_ctzll(x); } | ||||
| +int main(void) { return 0; } | ||||
|  EOF | ||||
|  if try ${CC} ${CFLAGS} $test.c $LDSHAREDLIBC; then | ||||
|      echo "Checking for __builtin_ctzll ... Yes." | tee -a configure.log | ||||
| @@ -1059,13 +1051,11 @@ check_avx2_intrinsics() { | ||||
|      # Check whether compiler supports AVX2 intrinsics | ||||
|      cat > $test.c << EOF | ||||
|  #include <immintrin.h> | ||||
| -int main(void) { | ||||
| -    __m256i x = _mm256_set1_epi16(2); | ||||
| +__m256i f(__m256i x) { | ||||
|      const __m256i y = _mm256_set1_epi16(1); | ||||
| -    x = _mm256_subs_epu16(x, y); | ||||
| -    (void)x; | ||||
| -    return 0; | ||||
| +    return _mm256_subs_epu16(x, y); | ||||
|  } | ||||
| +int main(void) { return 0; } | ||||
|  EOF | ||||
|      if try ${CC} ${CFLAGS} ${avx2flag} $test.c; then | ||||
|          echo "Checking for AVX2 intrinsics ... Yes." | tee -a configure.log | ||||
| @@ -1080,16 +1070,11 @@ check_avx512_intrinsics() { | ||||
|      # Check whether compiler supports AVX512 intrinsics | ||||
|      cat > $test.c << EOF | ||||
|  #include <immintrin.h> | ||||
| -int main(void) { | ||||
| -    __m512i x = _mm512_set1_epi8(2); | ||||
| -    const __m512i y = _mm512_set_epi32(0x1020304, 0x5060708, 0x90a0b0c, 0xd0e0f10, | ||||
| -                                       0x11121314, 0x15161718, 0x191a1b1c, 0x1d1e1f20, | ||||
| -                                       0x21222324, 0x25262728, 0x292a2b2c, 0x2d2e2f30, | ||||
| -                                       0x31323334, 0x35363738, 0x393a3b3c, 0x3d3e3f40); | ||||
| -    x = _mm512_sub_epi8(x, y); | ||||
| -    (void)x; | ||||
| -    return 0; | ||||
| +__m512i f(__m512i y) { | ||||
| +  __m512i x = _mm512_set1_epi8(2); | ||||
| +  return _mm512_sub_epi8(x, y); | ||||
|  } | ||||
| +int main(void) { return 0; } | ||||
|  EOF | ||||
|      if try ${CC} ${CFLAGS} ${avx512flag} $test.c; then | ||||
|          echo "Checking for AVX512 intrinsics ... Yes." | tee -a configure.log | ||||
| @@ -1133,17 +1118,11 @@ check_avx512vnni_intrinsics() { | ||||
|      # Check whether compiler supports AVX512-VNNI intrinsics | ||||
|      cat > $test.c << EOF | ||||
|  #include <immintrin.h> | ||||
| -int main(void) { | ||||
| -    __m512i x = _mm512_set1_epi8(2); | ||||
| -    const __m512i y = _mm512_set_epi8(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, | ||||
| -                                      20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, | ||||
| -                                      38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, | ||||
| -                                      56, 57, 58, 59, 60, 61, 62, 63, 64); | ||||
| +__m512i f(__m512i x, __m512i y) { | ||||
|      __m512i z = _mm512_setzero_epi32(); | ||||
| -    z = _mm512_dpbusd_epi32(z, x, y); | ||||
| -    (void)z; | ||||
| -    return 0; | ||||
| +    return _mm512_dpbusd_epi32(z, x, y); | ||||
|  } | ||||
| +int main(void) { return 0; } | ||||
|  EOF | ||||
|      if try ${CC} ${CFLAGS} ${avx512vnniflag} $test.c; then | ||||
|          echo "Checking for AVX512VNNI intrinsics ... Yes." | tee -a configure.log | ||||
| @@ -1158,12 +1137,8 @@ check_mask_intrinsics() { | ||||
|      # Check whether compiler supports AVX512 k-mask intrinsics | ||||
|      cat > $test.c << EOF | ||||
|  #include <immintrin.h> | ||||
| -int main(void) { | ||||
| -    __mmask16 a = 0xFF; | ||||
| -    a = _knot_mask16(a); | ||||
| -    (void)a; | ||||
| -    return 0; | ||||
| -} | ||||
| +__mmask16 f(__mmask16 x) { return _knot_mask16(x); } | ||||
| +int main(void) { return 0; } | ||||
|  EOF | ||||
|      if try ${CC} ${CFLAGS} ${avx512flag} $test.c; then | ||||
|          echo "Checking for AVX512 k-mask intrinsics ... Yes." | tee -a configure.log | ||||
| @@ -1230,12 +1205,8 @@ check_neon_ld4_intrinsics() { | ||||
|  #else | ||||
|  #  include <arm_neon.h> | ||||
|  #endif | ||||
| -int main(void) { | ||||
| -    int stack_var[16]; | ||||
| -    int32x4x4_t v = vld1q_s32_x4(stack_var); | ||||
| -    (void)v; | ||||
| -    return 0; | ||||
| -} | ||||
| +int32x4x4_t f(int var[16]) { return vld1q_s32_x4(var); } | ||||
| +int main(void) { return 0; } | ||||
|  EOF | ||||
|      if try $CC -c $CFLAGS $neonflag $test.c; then | ||||
|          NEON_HAS_LD4=1 | ||||
| @@ -1251,13 +1222,8 @@ check_pclmulqdq_intrinsics() { | ||||
|      cat > $test.c << EOF | ||||
|  #include <immintrin.h> | ||||
|  #include <wmmintrin.h> | ||||
| -int main(void) { | ||||
| -    __m128i a = _mm_setzero_si128(); | ||||
| -    __m128i b = _mm_setzero_si128(); | ||||
| -    __m128i c = _mm_clmulepi64_si128(a, b, 0x10); | ||||
| -    (void)c; | ||||
| -    return 0; | ||||
| -} | ||||
| +__m128i f(__m128i a, __m128i b) { return _mm_clmulepi64_si128(a, b, 0x10); } | ||||
| +int main(void) { return 0; } | ||||
|  EOF | ||||
|      if try ${CC} ${CFLAGS} ${pclmulflag} $test.c; then | ||||
|          echo "Checking for PCLMULQDQ intrinsics ... Yes." | tee -a configure.log | ||||
| @@ -1273,13 +1239,11 @@ check_vpclmulqdq_intrinsics() { | ||||
|      cat > $test.c << EOF | ||||
|  #include <immintrin.h> | ||||
|  #include <wmmintrin.h> | ||||
| -int main(void) { | ||||
| -    __m512i a = _mm512_setzero_si512(); | ||||
| +__m512i f(__m512i a) { | ||||
|      __m512i b = _mm512_setzero_si512(); | ||||
| -    __m512i c = _mm512_clmulepi64_epi128(a, b, 0x10); | ||||
| -    (void)c; | ||||
| -    return 0; | ||||
| +    return _mm512_clmulepi64_epi128(a, b, 0x10); | ||||
|  } | ||||
| +int main(void) { return 0; } | ||||
|  EOF | ||||
|      if try ${CC} ${CFLAGS} ${vpclmulflag} $test.c; then | ||||
|          echo "Checking for VPCLMULQDQ intrinsics ... Yes." | tee -a configure.log | ||||
| @@ -1298,9 +1262,8 @@ check_xsave_intrinsics() { | ||||
|  #else | ||||
|  #  include <x86gprintrin.h> | ||||
|  #endif | ||||
| -int main(void) { | ||||
| -    return _xgetbv(0); | ||||
| -} | ||||
| +unsigned int f(unsigned int a) { return _xgetbv(a); } | ||||
| +int main(void) { return 0; } | ||||
|  EOF | ||||
|      if try ${CC} ${CFLAGS} ${xsaveflag} $test.c; then | ||||
|          echo "Checking for XSAVE intrinsics ... Yes." | tee -a configure.log | ||||
| @@ -1415,11 +1378,8 @@ check_sse2_intrinsics() { | ||||
|      # Check whether compiler supports SSE2 intrinsics | ||||
|      cat > $test.c << EOF | ||||
|  #include <immintrin.h> | ||||
| -int main(void) { | ||||
| -    __m128i zero = _mm_setzero_si128(); | ||||
| -    (void)zero; | ||||
| -    return 0; | ||||
| -} | ||||
| +__m128i f(__m128i x, __m128i y) { return _mm_sad_epu8(x, y); } | ||||
| +int main(void) { return 0; } | ||||
|  EOF | ||||
|      if try ${CC} ${CFLAGS} ${sse2flag} $test.c; then | ||||
|          echo "Checking for SSE2 intrinsics ... Yes." | tee -a configure.log | ||||
| @@ -1434,13 +1394,8 @@ check_sse42_intrinsics() { | ||||
|      # Check whether compiler supports SSE4.2 intrinsics | ||||
|      cat > $test.c << EOF | ||||
|  #include <nmmintrin.h> | ||||
| -int main(void) { | ||||
| -    unsigned crc = 0; | ||||
| -    char c = 'c'; | ||||
| -    crc = _mm_crc32_u32(crc, c); | ||||
| -    (void)crc; | ||||
| -    return 0; | ||||
| -} | ||||
| +unsigned int f(unsigned int a, unsigned int b) { return _mm_crc32_u32(a, b); } | ||||
| +int main(void) { return 0; } | ||||
|  EOF | ||||
|      if try ${CC} ${CFLAGS} ${sse42flag} $test.c; then | ||||
|          echo "Checking for SSE4.2 intrinsics ... Yes." | tee -a configure.log | ||||
| @@ -1455,15 +1410,11 @@ check_ssse3_intrinsics() { | ||||
|      # Check whether compiler supports SSSE3 intrinsics | ||||
|      cat > $test.c << EOF | ||||
|  #include <immintrin.h> | ||||
| -int main(void) | ||||
| -{ | ||||
| -    __m128i u, v, w; | ||||
| -    u = _mm_set1_epi32(1); | ||||
| -    v = _mm_set1_epi32(2); | ||||
| -    w = _mm_hadd_epi32(u, v); | ||||
| -    (void)w; | ||||
| -    return 0; | ||||
| +__m128i f(__m128i u) { | ||||
| +  __m128i v = _mm_set1_epi32(1); | ||||
| +  return _mm_hadd_epi32(u, v); | ||||
|  } | ||||
| +int main(void) { return 0; } | ||||
|  EOF | ||||
|      if try ${CC} ${CFLAGS} ${ssse3flag} $test.c; then | ||||
|          echo "Checking for SSSE3 intrinsics ... Yes." | tee -a configure.log | ||||
| --  | ||||
| 2.39.2 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Harmen Stoppels
					Harmen Stoppels