]> granicus.if.org Git - curl/commitdiff
configure: fix for --enable-pthreads
authorJay Satiro <raysatiro@yahoo.com>
Wed, 1 Mar 2017 08:11:36 +0000 (03:11 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Thu, 2 Mar 2017 07:43:10 +0000 (02:43 -0500)
Better handle options conflicts that can occur if --enable-pthreads.

Bug: https://github.com/curl/curl/pull/1295
Reported-by: Marc-Antoine Perennou
configure.ac
m4/curl-confopts.m4

index 1e76c491894da239fcebb06e3a0a82ca77416ecd..5c77b0f4c8f50cf6af57410a81e0363d7000d1f3 100644 (file)
@@ -3427,8 +3427,28 @@ AC_HELP_STRING([--disable-pthreads],[Disable POSIX threads]),
        want_pthreads=auto
        ]
 )
-if test "$want_thres" = "yes" && test "$dontwant_rt" = "no" && \
-   test "$want_pthreads" != "no"; then
+
+dnl turn off pthreads if rt is disabled
+if test "$want_pthreads" != "no"; then
+  if test "$want_pthreads" = "yes" && test "$dontwant_rt" = "yes"; then
+    AC_MSG_ERROR([options --enable-pthreads and --disable-rt are mutually exclusive])
+  fi
+  if test "$dontwant_rt" != "no"; then
+    dnl if --enable-pthreads was explicit then warn it's being ignored
+    if test "$want_pthreads" = "yes"; then
+      AC_MSG_WARN([--enable-pthreads Ignored since librt is disabled.])
+    fi
+    want_pthreads=no
+  fi
+fi
+
+dnl turn off pthreads if no threaded resolver
+if test "$want_pthreads" != "no" && test "$want_thres" != "yes"; then
+  want_pthreads=no
+fi
+
+dnl detect pthreads
+if test "$want_pthreads" != "no"; then
   AC_CHECK_HEADER(pthread.h,
     [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
       save_CFLAGS="$CFLAGS"
@@ -3452,23 +3472,22 @@ if test "$want_thres" = "yes" && test "$dontwant_rt" = "no" && \
       fi
   ])
 fi
-if test "x$USE_THREADS_POSIX" != "x1"; then
+
+dnl threaded resolver check
+if test "$want_thres" = "yes" && test "x$USE_THREADS_POSIX" != "x1"; then
   if test "$want_pthreads" = "yes"; then
     AC_MSG_ERROR([--enable-pthreads but pthreads was not found])
   fi
-  if test "$want_thres" = "yes"; then
-    dnl If native Windows fallback on Win32 threads since no POSIX threads
-    if test "$curl_cv_native_windows" = "yes"; then
-      USE_THREADS_WIN32=1
-      AC_DEFINE(USE_THREADS_WIN32, 1, [if you want Win32 threaded DNS lookup])
-      curl_res_msg="Win32 threaded"
-    else
-      AC_MSG_ERROR([Threaded resolver enabled but no thread library found])
-    fi
+  dnl If native Windows fallback on Win32 threads since no POSIX threads
+  if test "$curl_cv_native_windows" = "yes"; then
+    USE_THREADS_WIN32=1
+    AC_DEFINE(USE_THREADS_WIN32, 1, [if you want Win32 threaded DNS lookup])
+    curl_res_msg="Win32 threaded"
+  else
+    AC_MSG_ERROR([Threaded resolver enabled but no thread library found])
   fi
 fi
 
-
 dnl ************************************************************
 dnl disable verbose text strings
 dnl
index 69b9a1431893993eb629a0c8218c51a1bd2e6a47..b86e0fc4fd58dab0b9b97bc4e5b5b57490ecfa25 100644 (file)
@@ -346,10 +346,6 @@ AC_DEFUN([CURL_CHECK_OPTION_RT], [
       AC_MSG_RESULT([no])
       ;;
   esac
-  dnl TODO: may require mutual exclusion
-  if test "$dontwant_rt" = "yes" && test "$want_thres" = "yes" ; then
-    AC_MSG_ERROR([options --disable-rt and --enable-thread-resolver are mutually exclusive, at most one can be selected.])
-  fi
 ])