summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorBradley Sepos <[email protected]>2018-06-10 21:22:43 -0400
committerBradley Sepos <[email protected]>2018-06-10 21:22:43 -0400
commit0bb4e7e5d20770fbc20d8ea6fb44d6a866db75ef (patch)
tree1fe3d058a85e4f404118322348309523a51dd636 /contrib
parentc70981efae72a8392c18a7e92db667eddbc55485 (diff)
contrib: Add compatibility patches for libvpx.
The avx-512 patch should avoid breakage with wonky compilers and older systems such as macOS <= 10.11. The pthread detection patch can be applied more generally but really is a safety check targeting win32.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libvpx/A01-avx-512-detection.patch36
-rw-r--r--contrib/libvpx/P03-mingw-pthread-test.patch80
2 files changed, 116 insertions, 0 deletions
diff --git a/contrib/libvpx/A01-avx-512-detection.patch b/contrib/libvpx/A01-avx-512-detection.patch
new file mode 100644
index 000000000..5cb1e6039
--- /dev/null
+++ b/contrib/libvpx/A01-avx-512-detection.patch
@@ -0,0 +1,36 @@
+From 393f7856587d58292febb0a3e82edc405aab4498 Mon Sep 17 00:00:00 2001
+From: Tom Finegan <[email protected]>
+Date: Thu, 7 Jun 2018 12:35:05 -0700
+Subject: [PATCH] Add avx512 compile test.
+
+Some compiler releases allow the -mavx512f arg without actually
+implementing support. Test for this situation, and disable avx512
+when it is detected by configure.
+
+BUG=webm:1536
+
+Change-Id: I63952153bb4b24aa9f25267ed47a0fe845d61f8b
+---
+ build/make/configure.sh | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/build/make/configure.sh b/build/make/configure.sh
+index 480b2d0eab..e0e9fd1a73 100644
+--- a/build/make/configure.sh
++++ b/build/make/configure.sh
+@@ -1333,6 +1333,15 @@ EOF
+ else
+ if [ "$ext" = "avx512" ]; then
+ check_gcc_machine_options $ext avx512f avx512cd avx512bw avx512dq avx512vl
++
++ # Confirm that the compiler really supports avx512.
++ check_cc -mavx512f <<EOF || RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 " && soft_disable avx512
++#include <immintrin.h>
++void f(void) {
++ __m512i x = _mm512_set1_epi16(0);
++ (void)x;
++}
++EOF
+ else
+ # use the shortened version for the flag: sse4_1 -> sse4
+ check_gcc_machine_option ${ext%_*} $ext
diff --git a/contrib/libvpx/P03-mingw-pthread-test.patch b/contrib/libvpx/P03-mingw-pthread-test.patch
new file mode 100644
index 000000000..704bac746
--- /dev/null
+++ b/contrib/libvpx/P03-mingw-pthread-test.patch
@@ -0,0 +1,80 @@
+From 38dc27cc6d03383cf1764e03697137e2f330d550 Mon Sep 17 00:00:00 2001
+From: Martin Storsjo <[email protected]>
+Date: Sat, 14 Apr 2018 23:40:46 +0300
+Subject: [PATCH] configure: Test linking pthreads before using it
+
+This avoids enabling pthreads if only pthreads-w32 is available.
+pthreads-w32 provides pthread.h but has a link library with a
+different name (libpthreadGC2.a).
+
+Generally, always using win32 threads when on windows would be
+sensible.
+
+However, libstdc++ can be configured to use pthreads (winpthreads), and
+in these cases, standard C++ headers can pollute the namespace with
+pthreads declarations, which break the win32 threads headers that
+declare similar symbols - leading us to prefer pthreads on windows
+whenever available (see d167a1ae and bug 1132).
+
+Change-Id: Icd668ccdaf3aeabb7fa4e713e040ef3d67546f00
+---
+ build/make/configure.sh | 12 +++++++++++-
+ configure | 9 ++++++++-
+ 2 files changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/build/make/configure.sh b/build/make/configure.sh
+index 60fc36e430..72376373c4 100644
+--- a/build/make/configure.sh
++++ b/build/make/configure.sh
+@@ -319,6 +319,12 @@ check_ld() {
+ && check_cmd ${LD} ${LDFLAGS} "$@" -o ${TMP_X} ${TMP_O} ${extralibs}
+ }
+
++check_lib() {
++ log check_lib "$@"
++ check_cc $@ \
++ && check_cmd ${LD} ${LDFLAGS} -o ${TMP_X} ${TMP_O} "$@" ${extralibs}
++}
++
+ check_header(){
+ log check_header "$@"
+ header=$1
+@@ -1484,7 +1490,11 @@ EOF
+ # bionic includes basic pthread functionality, obviating -lpthread.
+ ;;
+ *)
+- check_header pthread.h && add_extralibs -lpthread
++ check_lib -lpthread <<EOF && enable_feature pthread_h && add_extralibs -lpthread
++#include <pthread.h>
++#include <stddef.h>
++int main(void) { return pthread_create(NULL, NULL, NULL, NULL); }
++EOF
+ ;;
+ esac
+ fi
+diff --git a/configure b/configure
+index 2f198e9a61..3174a9f4b5 100755
+--- a/configure
++++ b/configure
+@@ -573,13 +573,20 @@ process_detect() {
+ check_ld() {
+ true
+ }
++ check_lib() {
++ true
++ }
+ fi
+ check_header stdio.h || die "Unable to invoke compiler: ${CC} ${CFLAGS}"
+ check_ld <<EOF || die "Toolchain is unable to link executables"
+ int main(void) {return 0;}
+ EOF
+ # check system headers
+- check_header pthread.h
++ check_lib -lpthread <<EOF && enable_feature pthread_h
++#include <pthread.h>
++#include <stddef.h>
++int main(void) { return pthread_create(NULL, NULL, NULL, NULL); }
++EOF
+ check_header unistd.h # for sysconf(3) and friends.
+
+ check_header vpx/vpx_integer.h -I${source_path} && enable_feature vpx_ports