xref: /OK3568_Linux_fs/buildroot/package/ffmpeg/0003-libavutil-Fix-mips-build.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 6e8daf0d502a2a822f1f08f42368d7d676dc1a9e Mon Sep 17 00:00:00 2001
2From: Bernd Kuhls <bernd.kuhls@t-online.de>
3Date: Sun, 6 Jun 2021 08:54:53 +0200
4Subject: [PATCH] libavutil: Fix mips build
5
6Check for sys/auxv.h because not all toolchains contain this header.
7
8Fixes https://trac.ffmpeg.org/ticket/9138
9
10Patch sent upstream:
11http://ffmpeg.org/pipermail/ffmpeg-devel/2021-June/281272.html
12
13Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
14---
15 configure            | 2 ++
16 libavutil/mips/cpu.c | 6 +++---
17 2 files changed, 5 insertions(+), 3 deletions(-)
18
19diff --git a/configure b/configure
20index 6bfd98b384..773a7d516c 100755
21--- a/configure
22+++ b/configure
23@@ -2161,6 +2161,7 @@ HEADERS_LIST="
24     opencv2_core_core_c_h
25     OpenGL_gl3_h
26     poll_h
27+    sys_auxv_h
28     sys_param_h
29     sys_resource_h
30     sys_select_h
31@@ -6218,6 +6219,7 @@ check_func_headers VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepa
32 check_headers windows.h
33 check_headers X11/extensions/XvMClib.h
34 check_headers asm/types.h
35+check_headers sys/auxv.h
36
37 # it seems there are versions of clang in some distros that try to use the
38 # gcc headers, which explodes for stdatomic
39diff --git a/libavutil/mips/cpu.c b/libavutil/mips/cpu.c
40index 59619d54de..19196de50b 100644
41--- a/libavutil/mips/cpu.c
42+++ b/libavutil/mips/cpu.c
43@@ -19,7 +19,7 @@
44 #include "libavutil/cpu.h"
45 #include "libavutil/cpu_internal.h"
46 #include "config.h"
47-#if defined __linux__ || defined __ANDROID__
48+#if (defined __linux__ || defined __ANDROID__) && HAVE_SYS_AUXV_H
49 #include <stdint.h>
50 #include <stdio.h>
51 #include <string.h>
52@@ -28,7 +28,7 @@
53 #include "libavutil/avstring.h"
54 #endif
55
56-#if defined __linux__ || defined __ANDROID__
57+#if (defined __linux__ || defined __ANDROID__) && HAVE_SYS_AUXV_H
58
59 #define HWCAP_LOONGSON_CPUCFG (1 << 14)
60
61@@ -105,7 +105,7 @@ static int cpu_flags_cpuinfo(void)
62
63 int ff_get_cpu_flags_mips(void)
64 {
65-#if defined __linux__ || defined __ANDROID__
66+#if (defined __linux__ || defined __ANDROID__) && HAVE_SYS_AUXV_H
67     if (cpucfg_available())
68         return cpu_flags_cpucfg();
69     else
70--
712.29.2
72
73