shithub: libvpx

Download patch

ref: 03fa7018737180d6ee7c495543410c2b2f9f6d09
parent: 449e84ff064063cb5ff55e0afa2364fbd7051e34
parent: 38dc27cc6d03383cf1764e03697137e2f330d550
author: Martin Storsjö <martin@martin.st>
date: Wed Apr 18 02:23:09 EDT 2018

Merge "configure: Test linking pthreads before using it"

--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -319,6 +319,12 @@
     && 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
@@ -1485,7 +1491,11 @@
         # 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
--- a/configure
+++ b/configure
@@ -573,6 +573,9 @@
         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"
@@ -579,7 +582,11 @@
 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