]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Add FreeBSD/powerpc* support to cmake/detect-intrinsics.cmake
authorPiotr Kubaj <pkubaj@FreeBSD.org>
Tue, 27 Sep 2022 22:57:46 +0000 (00:57 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 13 Jan 2023 19:23:15 +0000 (20:23 +0100)
cmake/detect-intrinsics.cmake

index 20164c5bce6932bfed0408644af12241d9f65711..3fa74b483f33ce3a46c5da9da58ab073a77e708c 100644 (file)
@@ -297,8 +297,17 @@ macro(check_ppc_intrinsics)
     set(CMAKE_REQUIRED_FLAGS "${PPCFLAGS} ${NATIVEFLAG}")
     check_c_source_compiles(
         "#include <sys/auxv.h>
+        #ifdef __FreeBSD__
+        #include <machine/cpu.h>
+        #endif
         int main() {
+        #ifdef __FreeBSD__
+            unsigned long hwcap;
+            elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
+            return (hwcap & PPC_FEATURE_HAS_ALTIVEC);
+        #else
             return (getauxval(AT_HWCAP) & PPC_FEATURE_HAS_ALTIVEC);
+        #endif
         }"
         HAVE_VMX
     )
@@ -315,8 +324,17 @@ macro(check_power8_intrinsics)
     set(CMAKE_REQUIRED_FLAGS "${POWER8FLAG} ${NATIVEFLAG}")
     check_c_source_compiles(
         "#include <sys/auxv.h>
+        #ifdef __FreeBSD__
+        #include <machine/cpu.h>
+        #endif
         int main() {
+        #ifdef __FreeBSD__
+            unsigned long hwcap;
+            elf_aux_info(AT_HWCAP2, &hwcap, sizeof(hwcap));
+            return (hwcap & PPC_FEATURE2_ARCH_2_07);
+        #else
             return (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07);
+        #endif
         }"
         HAVE_POWER8_INTRIN
     )