aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2013-04-11 16:21:49 +0200
committerDaniel Stenberg <daniel@haxx.se>2013-04-12 22:58:28 +0200
commitedddf394b8634079a0b7c43c126e33ed9fa578b1 (patch)
tree4be8154624d477a3f59564fe2b1ab3eb76300d78 /configure.ac
parent61d259f95045c2ec029d4234af80b00d91fec080 (diff)
configure: try pthread_create without -lpthread
For libc variants without a spearate pthread lib (like bionic), try using pthreads without the pthreads lib first and only if that fails try the -lpthread linker flag. Bug: http://curl.haxx.se/bug/view.cgi?id=1216 Reported by: Duncan
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac28
1 files changed, 20 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 08ddbc518..1a46fd9c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3158,14 +3158,26 @@ if test "$want_thres" = "yes"; then
AC_CHECK_HEADER(pthread.h,
[ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -pthread"
- AC_CHECK_LIB(pthread, pthread_create,
- [ AC_MSG_NOTICE([using POSIX threaded DNS lookup])
- AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
- USE_THREADS_POSIX=1
- curl_res_msg="threaded"
- ],
- [ CFLAGS="$save_CFLAGS"])
+
+ dnl first check for function without lib
+ AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
+
+ dnl if it wasn't found without lib, search for it in pthread lib
+ if test "$USE_THREADS_POSIX" != "1"
+ then
+ CFLAGS="$CFLAGS -pthread"
+ AC_CHECK_LIB(pthread, pthread_create,
+ [USE_THREADS_POSIX=1],
+ [ CFLAGS="$save_CFLAGS"])
+ fi
+
+ if test "x$USE_THREADS_POSIX" = "x1"
+ then
+ AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
+ curl_res_msg="POSIX threaded"
+ fi
+
+
])
fi