And use it to check for pthreads support.

Unbreak f058f384a0d76bfd125f4738dceab7c890186432 for *BSD since
their libc presents pthread_join and many other pthread symbols
in libc while pthread_create is available only when passing
-pthread and linking to libthr.

Signed-off-by: Luca Barbato <[email protected]>
---

The simpler but more hackish alternative is to move down the no-flags check.

 configure | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index f63c70b..ae9dd8d 100755
--- a/configure
+++ b/configure
@@ -844,6 +844,24 @@ int main(void){ $func(); }
 EOF
 }

+check_funcs(){
+    log check_funcs "$@"
+    key=$1
+    shift
+    func=$1
+    shift
+    disable $key
+    for fn in $func; do
+        d="$d extern int $fn();"
+        c="$c $fn();"
+    done
+
+    check_ld "$@" <<EOF && enable $func
+$d
+int main(void){ $c }
+EOF
+}
+
 check_mathfunc(){
     log check_mathfunc "$@"
     func=$1
@@ -3840,19 +3858,18 @@ fi
 # check for some common methods of building with pthread support
 # do this before the optional library checks as some of them require pthreads
 if ! disabled pthreads && ! enabled w32threads; then
-    enable pthreads
-    if check_func pthread_join; then
+    if check_funcs pthreads "pthread_join pthread_create"; then
         :
-    elif check_func pthread_join -pthread; then
+    elif check_funcs pthreads "pthread_join pthread_create" -pthread; then
         add_cflags -pthread
         add_extralibs -pthread
-    elif check_func pthread_join -pthreads; then
+    elif check_funcs pthreads "pthread_join pthread_create" -pthreads; then
         add_cflags -pthreads
         add_extralibs -pthreads
-    elif check_func pthread_join -lpthreadGC2; then
+    elif check_funcs pthreads "pthread_join pthread_create" -lpthreadGC2; then
         add_extralibs -lpthreadGC2
-    elif ! check_lib pthread.h pthread_join -lpthread; then
-        disable pthreads
+    else
+        check_funcs pthreads "pthread_join pthread_create" -lpthread
     fi
 fi

--
1.8.5.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to