From 333dee898c87d9008b7018a97c5eca7e3dd8372d Mon Sep 17 00:00:00 2001 From: Christian Weisgerber Date: Wed, 28 Aug 2019 20:21:44 +0000 Subject: [PATCH] Use proper autoconf test for getauxval() and elf_aux_info(). Based on work by Jeremie Courreges-Anglas for OpenBSD. PR: 239870 --- audio/flac/Makefile | 6 ++-- audio/flac/files/patch-configure.ac | 20 +++++++++++++ audio/flac/files/patch-src_libFLAC_cpu.c | 38 +++++++++++++++++++----- 3 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 audio/flac/files/patch-configure.ac diff --git a/audio/flac/Makefile b/audio/flac/Makefile index 11fa1b8561c2..646ba854cc92 100644 --- a/audio/flac/Makefile +++ b/audio/flac/Makefile @@ -16,17 +16,17 @@ LICENSE_FILE_GFDL= ${WRKSRC}/COPYING.FDL LIB_DEPENDS= libogg.so:audio/libogg -USES= compiler:c11 iconv libtool pathfix pkgconfig tar:xz +USES= autoreconf compiler:c11 iconv libtool pathfix pkgconfig tar:xz USE_LDCONFIG= yes GNU_CONFIGURE= yes CONFIGURE_ARGS= --enable-static \ --disable-sse \ + --disable-vsx \ --with-ogg="${LOCALBASE}" \ --disable-doxygen-docs \ --disable-thorough-tests \ - --disable-xmms-plugin \ - --disable-vsx + --disable-xmms-plugin INSTALL_TARGET= install-strip TEST_TARGET= check diff --git a/audio/flac/files/patch-configure.ac b/audio/flac/files/patch-configure.ac new file mode 100644 index 000000000000..5b1c9b1a05d5 --- /dev/null +++ b/audio/flac/files/patch-configure.ac @@ -0,0 +1,20 @@ +--- configure.ac.orig 2019-08-04 08:26:40 UTC ++++ configure.ac +@@ -69,7 +69,7 @@ AC_C_INLINE + AC_C_VARARRAYS + AC_C_TYPEOF + +-AC_CHECK_HEADERS([stdint.h inttypes.h byteswap.h sys/param.h sys/ioctl.h termios.h x86intrin.h cpuid.h]) ++AC_CHECK_HEADERS([stdint.h inttypes.h byteswap.h sys/param.h sys/ioctl.h termios.h x86intrin.h cpuid.h sys/auxv.h]) + + XIPH_C_BSWAP32 + XIPH_C_BSWAP16 +@@ -104,6 +104,8 @@ AC_CHECK_TYPES(socklen_t, [], []) + dnl check for getopt in standard library + dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] ) + AC_CHECK_FUNCS(getopt_long, [], []) ++ ++AC_CHECK_FUNCS([getauxval elf_aux_info]) + + AC_CHECK_SIZEOF(void*,1) + diff --git a/audio/flac/files/patch-src_libFLAC_cpu.c b/audio/flac/files/patch-src_libFLAC_cpu.c index 91898d9c2dd0..4615f3970ad7 100644 --- a/audio/flac/files/patch-src_libFLAC_cpu.c +++ b/audio/flac/files/patch-src_libFLAC_cpu.c @@ -1,16 +1,40 @@ ---- src/libFLAC/cpu.c.orig 2019-08-15 00:05:19 UTC +--- src/libFLAC/cpu.c.orig 2018-08-20 08:17:21 UTC +++ src/libFLAC/cpu.c -@@ -245,11 +245,21 @@ ppc_cpu_info (FLAC__CPUInfo *info) +@@ -53,7 +53,7 @@ + #define dfprintf(file, format, ...) + #endif + +-#if defined FLAC__CPU_PPC ++#if defined(HAVE_SYS_AUXV_H) + #include + #endif + +@@ -236,7 +236,10 @@ x86_cpu_info (FLAC__CPUInfo *info) + static void + ppc_cpu_info (FLAC__CPUInfo *info) + { +-#if defined FLAC__CPU_PPC ++ info->ppc.arch_2_07 = false; ++ info->ppc.arch_3_00 = false; ++ ++#if defined(FLAC__CPU_PPC) + #ifndef PPC_FEATURE2_ARCH_3_00 + #define PPC_FEATURE2_ARCH_3_00 0x00800000 + #endif +@@ -245,14 +248,21 @@ ppc_cpu_info (FLAC__CPUInfo *info) #define PPC_FEATURE2_ARCH_2_07 0x80000000 #endif -+#ifdef __linux__ ++#if defined(HAVE_GETAUXVAL) if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_3_00) { info->ppc.arch_3_00 = true; } else if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07) { info->ppc.arch_2_07 = true; } -+#elif defined(__FreeBSD__) +-#else +- info->ppc.arch_2_07 = false; +- info->ppc.arch_3_00 = false; ++#elif defined(HAVE_ELF_AUX_INFO) + long hwcaps; + elf_aux_info(AT_HWCAP2, &hwcaps, sizeof(hwcaps)); + if (hwcaps & PPC_FEATURE2_ARCH_3_00) { @@ -19,6 +43,6 @@ + info->ppc.arch_2_07 = true; + } +#endif - #else - info->ppc.arch_2_07 = false; - info->ppc.arch_3_00 = false; + #endif + } +