diff options
author | Jay Satiro <raysatiro@yahoo.com> | 2017-03-01 03:11:36 -0500 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2017-03-02 02:43:10 -0500 |
commit | 5f139d6b6f1de89ed8449a327ed743f5461ac2ec (patch) | |
tree | 0b23e59edcc86c9c38f97c41389ca15fb4c85c0b | |
parent | 0966ab5bd4ad547c74e1032899c87f7214bc5b73 (diff) |
configure: fix for --enable-pthreads
Better handle options conflicts that can occur if --enable-pthreads.
Bug: https://github.com/curl/curl/pull/1295
Reported-by: Marc-Antoine Perennou
-rw-r--r-- | configure.ac | 45 | ||||
-rw-r--r-- | m4/curl-confopts.m4 | 4 |
2 files changed, 32 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac index 1e76c4918..5c77b0f4c 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/m4/curl-confopts.m4 b/m4/curl-confopts.m4 index 69b9a1431..b86e0fc4f 100644 --- a/m4/curl-confopts.m4 +++ b/m4/curl-confopts.m4 @@ -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 ]) |