From: Piotr Kubaj Date: Mon, 3 Oct 2022 23:43:02 +0000 (+0200) Subject: Fix configure script for FreeBSD/powerpc* X-Git-Tag: 2.1.0-beta1~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=296bd8c0ab372bd30118ddc679e9392dd5cabb98;p=thirdparty%2Fzlib-ng.git Fix configure script for FreeBSD/powerpc* --- diff --git a/configure b/configure index bb8d15c8e..5e21b449b 100755 --- a/configure +++ b/configure @@ -739,13 +739,20 @@ else echo "Checking for strerror... No." | tee -a configure.log fi -# check for getauxval() for architecture feature detection at run-time +# check for getauxval() or elf_aux_info() for architecture feature detection at run-time cat > $test.c < -int main() { return getauxval(0); } +int main() { +#ifdef __FreeBSD__ +int test; +return elf_aux_info(AT_PAGESZ, &test, sizeof(test)); +#else +return getauxval(0); +#endif +} EOF if try $CC $CFLAGS -o $test $test.c $LDSHAREDLIBC; then - echo "Checking for getauxval() in sys/auxv.h... Yes." | tee -a configure.log + echo "Checking for getauxval() or elf_aux_info() in sys/auxv.h... Yes." | tee -a configure.log CFLAGS="${CFLAGS} -DHAVE_SYS_AUXV_H" SFLAGS="${SFLAGS} -DHAVE_SYS_AUXV_H" else @@ -1242,8 +1249,19 @@ EOF echo "Checking if -mno-vsx is supported ... No." | tee -a configure.log fi cat > $test.c << EOF +#ifdef __FreeBSD__ +#include +#endif #include -int main() { return (getauxval(AT_HWCAP) & PPC_FEATURE_HAS_ALTIVEC); } +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 +} EOF if try $CC -c $CFLAGS -maltivec $test.c; then HAVE_VMX=1 @@ -1257,8 +1275,19 @@ EOF check_power8_intrinsics() { # Check whether features needed by POWER8 optimisations are available cat > $test.c << EOF +#ifdef __FreeBSD__ +#include +#endif #include -int main() { return (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07); } +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 +} EOF if test $buildpower8 -eq 1 && try $CC -c $CFLAGS -mcpu=power8 $test.c; then HAVE_POWER8_INTRIN=1