Browse code

improved pthreads test

Originally committed as revision 7118 to svn://svn.ffmpeg.org/ffmpeg/trunk

Måns Rullgård authored on 2006/11/19 01:16:58
Showing 1 changed files
... ...
@@ -1426,11 +1426,17 @@ enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
1426 1426
 # check for some common methods of building with pthread support
1427 1427
 # do this before the optional library checks as some of them require pthreads
1428 1428
 if enabled pthreads; then
1429
-    { check_cflags -pthread && check_ldflags -pthread; } ||
1430
-    { check_cflags -pthreads && check_ldflags -pthreads; } ||
1431
-    check_lib pthread.h pthread_create -lpthread ||
1432
-    check_func pthread_create ||
1433
-    die "ERROR: can't find pthreads library"
1429
+    if check_func pthread_create; then
1430
+        :
1431
+    elif check_func pthread_create -pthread; then
1432
+        add_cflags -pthread
1433
+        add_ldflags -pthread
1434
+    elif check_func pthread_create -pthreads; then
1435
+        add_cflags -pthreads
1436
+        add_ldflags -pthreads
1437
+    elif ! check_lib pthread.h pthread_create -lpthread; then
1438
+        die "ERROR: can't find pthreads library"
1439
+    fi
1434 1440
 fi
1435 1441
 
1436 1442
 # these are off by default, so fail if requested and not available