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
This commit is contained in:
Jay Satiro 2017-03-01 03:11:36 -05:00
Родитель 0966ab5bd4
Коммит 5f139d6b6f
2 изменённых файлов: 32 добавлений и 17 удалений

Просмотреть файл

@ -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,11 +3472,12 @@ 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
@ -3465,10 +3486,8 @@ if test "x$USE_THREADS_POSIX" != "x1"; then
else
AC_MSG_ERROR([Threaded resolver enabled but no thread library found])
fi
fi
fi
dnl ************************************************************
dnl disable verbose text strings
dnl

Просмотреть файл

@ -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
])