diff options
author | Yang Tse <yangsita@gmail.com> | 2012-03-28 18:46:08 +0200 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2012-03-28 18:48:38 +0200 |
commit | 809c809281398d85002e740243963c44207e7f8c (patch) | |
tree | bf8eb22036089e40a315f526ab9963be5b6bece6 /m4/curl-functions.m4 | |
parent | 0580b6062243d24f90c544414b7dfa8c896b1ad0 (diff) | |
download | curl-809c809281398d85002e740243963c44207e7f8c.tar.gz |
curl-functions.m4: update detection logic of getaddrinfo() thread-safeness
Take in account that h_errno might be a modifiable lvalue not defined as
a C preprocessor macro
Diffstat (limited to 'm4/curl-functions.m4')
-rw-r--r-- | m4/curl-functions.m4 | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4 index 9fdc3bce1..930084d5d 100644 --- a/m4/curl-functions.m4 +++ b/m4/curl-functions.m4 @@ -21,7 +21,7 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 69 +# serial 70 dnl CURL_INCLUDES_ARPA_INET @@ -2020,6 +2020,7 @@ AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [ AC_REQUIRE([CURL_INCLUDES_STRING])dnl AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl AC_REQUIRE([CURL_INCLUDES_NETDB])dnl + AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl # tst_links_getaddrinfo="unknown" tst_proto_getaddrinfo="unknown" @@ -2196,7 +2197,34 @@ AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [ tst_tsafe_getaddrinfo="yes" ;; esac + if test "$tst_tsafe_getaddrinfo" = "unknown" && + test "$ac_cv_native_windows" = "yes"; then + tst_tsafe_getaddrinfo="yes" + fi if test "$tst_tsafe_getaddrinfo" = "unknown"; then + CURL_CHECK_DEF_CC([h_errno], [ + $curl_includes_sys_socket + $curl_includes_netdb + ], [silent]) + if test "$curl_cv_have_def_h_errno" = "yes"; then + tst_h_errno_macro="yes" + else + tst_h_errno_macro="no" + fi + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_socket + $curl_includes_netdb + ]],[[ + h_errno = 2; + if(0 != h_errno) + return 1; + ]]) + ],[ + tst_h_errno_modifiable_lvalue="yes" + ],[ + tst_h_errno_modifiable_lvalue="no" + ]) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ ]],[[ @@ -2209,22 +2237,18 @@ AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [ #endif ]]) ],[ - tst_tsafe_getaddrinfo="yes" + tst_h_errno_sbs_issue_7="yes" + ],[ + tst_h_errno_sbs_issue_7="no" ]) - fi - if test "$tst_tsafe_getaddrinfo" = "unknown"; then - CURL_CHECK_DEF_CC([h_errno], [ - $curl_includes_ws2tcpip - $curl_includes_sys_socket - $curl_includes_netdb - ], [silent]) - if test "$curl_cv_have_def_h_errno" = "no"; then + if test "$tst_h_errno_macro" = "no" && + test "$tst_h_errno_modifiable_lvalue" = "no" && + test "$tst_h_errno_sbs_issue_7" = "no"; then tst_tsafe_getaddrinfo="no" + else + tst_tsafe_getaddrinfo="yes" fi fi - if test "$tst_tsafe_getaddrinfo" = "unknown"; then - tst_tsafe_getaddrinfo="yes" - fi AC_MSG_RESULT([$tst_tsafe_getaddrinfo]) if test "$tst_tsafe_getaddrinfo" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1, |