]> granicus.if.org Git - curl/commitdiff
new configure option --enable-threaded-resolver
authorDaniel Stenberg <daniel@haxx.se>
Sun, 25 Apr 2010 21:24:05 +0000 (23:24 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 25 Apr 2010 21:24:05 +0000 (23:24 +0200)
CHANGES
RELEASE-NOTES
configure.ac
m4/curl-confopts.m4

diff --git a/CHANGES b/CHANGES
index 01856fe6a397fed13564c1516d3e7cef35e55a7c..573bc63345b6a885553307cf4547d15ff8111ee7 100644 (file)
--- 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.
index 24b809327c67c90c12ba3e76e4d283934629c6c7..da41c0ecaa97465d4d701df178ef0ed715353043 100644 (file)
@@ -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:
 
index e18227b786825e8420a0a91be8f5f7bfc193812e..92db8add715e3c0eb96ee0d22c7f55a40f2670e5 100644 (file)
@@ -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 <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"])
+  ])
+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}
index fb11ee3cbd8c30b1c47e4164c8f4183750de00e1..5a43b1961f6f7b32e9643413f69eb9f935c98c51 100644 (file)
 #***************************************************************************
 
 # 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
 ])