]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Remove unnecessary ARM_AUXV_HAS_NEON preprocessor check
authorNathan Moinvaziri <nathan@nathanm.com>
Tue, 13 Jan 2026 03:25:57 +0000 (19:25 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 22 Jan 2026 00:16:07 +0000 (01:16 +0100)
CMakeLists.txt
arch/arm/arm_features.c
configure

index 2d666c278f3c1dc23e353d7564612e9769ec4698..c89f69cade468e23c4207500942717950b4432e6 100644 (file)
@@ -742,52 +742,6 @@ if(WITH_OPTIM)
     add_definitions(-DWITH_OPTIM)
     if(BASEARCH_ARM_FOUND)
         add_definitions(-DARM_FEATURES)
-        if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
-            if(ARCH_32BIT)
-                check_c_source_compiles(
-                    "#include <sys/auxv.h>
-                    int main() {
-                      return (getauxval(AT_HWCAP) & HWCAP_ARM_NEON);
-                    }"
-                    ARM_AUXV_HAS_NEON
-                )
-                if(ARM_AUXV_HAS_NEON)
-                    add_definitions(-DARM_AUXV_HAS_NEON)
-                else()
-                    check_c_source_compiles(
-                        "#include <sys/auxv.h>
-                        int main() {
-                          return (getauxval(AT_HWCAP) & HWCAP_NEON);
-                        }"
-                        ARM_AUXV_HAS_NEON
-                    )
-                    if (ARM_AUXV_HAS_NEON)
-                        add_definitions(-DARM_AUXV_HAS_NEON)
-                    else()
-                        message(STATUS "Neither HWCAP_ARM_NEON or HWCAP_NEON present in sys/auxv.h; cannot detect support at runtime.")
-                    endif()
-                endif()
-            endif()
-        endif()
-        if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
-           ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
-            if(ARCH_32BIT)
-                check_c_source_compiles(
-                    "#include <sys/auxv.h>
-                    int main() {
-                      unsigned long hwcap;
-                      elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
-                      return (hwcap & HWCAP_NEON);
-                    }"
-                    ARM_AUXV_HAS_NEON
-                )
-                if(ARM_AUXV_HAS_NEON)
-                    add_definitions(-DARM_AUXV_HAS_NEON)
-                else()
-                    message(STATUS "HWCAP_NEON not present in sys/auxv.h; cannot detect support at runtime.")
-                endif()
-            endif()
-        endif()
         list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/arm_functions.h)
         if(WITH_RUNTIME_CPU_DETECTION)
             list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/arm_features.h)
index 3f035296cfcbbb261b8b025b43762efa8f825d5d..6572fe7032a036592aa0131f1fd8ab58cd299019 100644 (file)
@@ -150,17 +150,17 @@ static int arm_has_eor3(void) {
 #if defined(ARCH_ARM) && defined(ARCH_32BIT)
 static inline int arm_has_neon(void) {
     int has_neon = 0;
-#if defined(ARM_AUXV_HAS_NEON)
-#  if defined(__FreeBSD__) || defined(__OpenBSD__)
-     unsigned long hwcap = 0;
-     elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
-     has_neon = (hwcap & HWCAP_NEON) != 0;
-#  else
-#    ifdef HWCAP_ARM_NEON
-       has_neon = (getauxval(AT_HWCAP) & HWCAP_ARM_NEON) != 0;
-#    else
-       has_neon = (getauxval(AT_HWCAP) & HWCAP_NEON) != 0;
-#    endif
+#if defined(__linux__) && defined(HAVE_SYS_AUXV_H)
+#  ifdef HWCAP_ARM_NEON
+    has_neon = (getauxval(AT_HWCAP) & HWCAP_ARM_NEON) != 0;
+#  elif defined(HWCAP_NEON)
+    has_neon = (getauxval(AT_HWCAP) & HWCAP_NEON) != 0;
+#  endif
+#elif defined(__FreeBSD__) || defined(__OpenBSD__)
+#  ifdef HWCAP_NEON
+    unsigned long hwcap = 0;
+    elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
+    has_neon = (hwcap & HWCAP_NEON) != 0;
 #  endif
 #elif defined(__APPLE__)
     int has_feat = 0;
index 6a4e5ffc2a6cbcd230beab97c9dc0d6917b9b0c3..42ab602f3cde12fb21ef753c6b63e9dbabb0e1bf 100755 (executable)
--- a/configure
+++ b/configure
@@ -2059,54 +2059,6 @@ EOF
                 echo "Checking for arm_acle.h... No." | tee -a configure.log
             fi
 
-
-            if test $LINUX -eq 1; then
-                if test "$ARCH" != "aarch64"; then
-                    cat > $test.c <<EOF
-#include <sys/auxv.h>
-int main() {
-    return (getauxval(AT_HWCAP) & HWCAP_ARM_NEON);
-}
-EOF
-                    if try $CC -c $CFLAGS $test.c; then
-                        CFLAGS="${CFLAGS} -DARM_AUXV_HAS_NEON"
-                        SFLAGS="${SFLAGS} -DARM_AUXV_HAS_NEON"
-                    else
-                        cat > $test.c <<EOF
-#include <sys/auxv.h>
-int main() {
-    return (getauxval(AT_HWCAP) & HWCAP_NEON);
-}
-EOF
-                        if try $CC -c $CFLAGS $test.c; then
-                            CFLAGS="${CFLAGS} -DARM_AUXV_HAS_NEON"
-                            SFLAGS="${SFLAGS} -DARM_AUXV_HAS_NEON"
-                        else
-                            echo "Neither HWCAP_ARM_NEON or HWCAP_NEON present in sys/auxv.h; cannot detect support at runtime." | tee -a configure.log
-                        fi
-                    fi
-                fi
-            fi
-
-            if test $FREEBSD -eq 1 -o $OPENBSD -eq 1; then
-                if test "$ARCH" != "aarch64"; then
-                    cat > $test.c <<EOF
-#include <sys/auxv.h>
-int main() {
-    unsigned long hwcap;
-    elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
-    return (hwcap & HWCAP_NEON);
-}
-EOF
-                    if try $CC -c $CFLAGS $test.c; then
-                        CFLAGS="${CFLAGS} -DARM_AUXV_HAS_NEON"
-                        SFLAGS="${SFLAGS} -DARM_AUXV_HAS_NEON"
-                    else
-                        echo "HWCAP_NEON not present in sys/auxv.h; cannot detect support at runtime." | tee -a configure.log
-                    fi
-                fi
-            fi
-
             if test $buildneon -eq 1; then
                 check_neon_compiler_flag