1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-22 04:17:44 +00:00

Use proper autoconf test for getauxval() and elf_aux_info().

Based on work by Jeremie Courreges-Anglas for OpenBSD.

PR:		239870
This commit is contained in:
Christian Weisgerber 2019-08-28 20:21:44 +00:00
parent dfd51ffcd3
commit 333dee898c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=510099
3 changed files with 54 additions and 10 deletions

View File

@ -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

View File

@ -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)

View File

@ -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 <sys/auxv.h>
#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
}