From 79dc74e84de3e239f2c7e2e03317ad2bcf679ab7 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 25 Apr 2010 23:24:05 +0200 Subject: new configure option --enable-threaded-resolver --- CHANGES | 8 ++++++++ RELEASE-NOTES | 1 + configure.ac | 28 +++++++++++++++++++++++++--- m4/curl-confopts.m4 | 29 +++++++++++++++++++++++++++-- 4 files changed, 61 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 01856fe6a..573bc6334 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,14 @@ Changelog +Daniel Stenberg (25 Apr 2010) +- Based on work by Kamil Dudka, I've introduced the new configure option + --enable-threaded-resolver. When used, the configure script will check for + pthreads and if around, it will build libcurl to use pthreads to do name + resolving in a threaded manner. Note that this is just a fix to offer an + option that can enable the code that already included. The threader resolver + code was mostly added on Jan 26 2010. + Daniel Stenberg (24 Apr 2010) - Alex Bligh introduced the --proto and -proto-redir options that limit what protocols curl accepts for the requests and when following redirects. diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 24b809327..da41c0eca 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -10,6 +10,7 @@ Curl and libcurl 7.20.2 This release includes the following changes: o added the --proto and -proto-redir options + o new configure option --enable-threaded-resolver This release includes the following bugfixes: diff --git a/configure.ac b/configure.ac index e18227b78..92db8add7 100644 --- a/configure.ac +++ b/configure.ac @@ -127,7 +127,7 @@ dnl initialize all the info variables curl_krb4_msg="no (--with-krb4*)" curl_gss_msg="no (--with-gssapi)" curl_spnego_msg="no (--with-spnego)" - curl_ares_msg="no (--enable-ares)" + curl_res_msg="default (--enable-ares / --enable-threaded-resolver)" curl_ipv6_msg="no (--enable-ipv6)" curl_idn_msg="no (--with-libidn)" curl_manual_msg="no (--enable-manual)" @@ -2290,6 +2290,28 @@ AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1) CURL_CHECK_LIB_ARES AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes) +CURL_CHECK_OPTION_THREADED_RESOLVER + +if test "x$want_thres" = xyes && test "x$want_ares" = xyes; then + AC_MSG_ERROR( +[Options --enable-threaded-resolver and --enable-ares are mutually exclusive]) +fi + +if test "$want_thres" = "yes"; then + AC_CHECK_HEADER(pthread.h, + [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have ]) + 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"]) + ]) +fi + dnl ************************************************************ dnl disable verbose text strings dnl @@ -2483,7 +2505,7 @@ fi if test "x$HAVE_LIBZ" = "x1"; then SUPPORT_FEATURES="$SUPPORT_FEATURES libz" fi -if test "x$USE_ARES" = "x1"; then +if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1"; then SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS" fi if test "x$IDN_ENABLED" = "x1"; then @@ -2625,7 +2647,7 @@ AC_MSG_NOTICE([Configured to build curl/libcurl: krb4 support: ${curl_krb4_msg} GSSAPI support: ${curl_gss_msg} SPNEGO support: ${curl_spnego_msg} - c-ares support: ${curl_ares_msg} + resolver: ${curl_res_msg} ipv6 support: ${curl_ipv6_msg} IDN support: ${curl_idn_msg} Build libcurl: Shared=${enable_shared}, Static=${enable_static} diff --git a/m4/curl-confopts.m4 b/m4/curl-confopts.m4 index fb11ee3cb..5a43b1961 100644 --- a/m4/curl-confopts.m4 +++ b/m4/curl-confopts.m4 @@ -21,8 +21,33 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 11 +# serial 12 +dnl CURL_CHECK_OPTION_THREADED_RESOLVER +dnl ------------------------------------------------- +dnl Verify if configure has been invoked with option +dnl --enable-threaded-resolver or --disable-threaded-resover, and +dnl set shell variable want_thres as appropriate. + +AC_DEFUN([CURL_CHECK_OPTION_THREADED_RESOLVER], [ + AC_MSG_CHECKING([whether to enable the threaded resolver]) + OPT_THRES="default" + AC_ARG_ENABLE(threaded_resolver, +AC_HELP_STRING([--enable-threaded-resolver],[Enable threaded resolver]) +AC_HELP_STRING([--disable-threaded-resover],[Disable threaded resolver]), + OPT_THRES=$enableval) + case "$OPT_THRES" in + yes) + dnl --enable-threaded-resolver option used + want_thres="yes" + ;; + *) + dnl configure option not specified + want_thres="no" + ;; + esac + AC_MSG_RESULT([$want_thres]) +]) dnl CURL_CHECK_OPTION_ARES dnl ------------------------------------------------- @@ -433,7 +458,7 @@ AC_DEFUN([CURL_CHECK_LIB_ARES], [ dnl finally c-ares will be used AC_DEFINE(USE_ARES, 1, [Define to enable c-ares support]) AC_SUBST([USE_ARES], [1]) - curl_ares_msg="enabled" + curl_res_msg="c-ares" fi fi ]) -- cgit v1.2.3