diff options
author | Yang Tse <yangsita@gmail.com> | 2009-06-20 17:24:43 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2009-06-20 17:24:43 +0000 |
commit | 1ff4e9008b70ccf521179ad1a2438bdc93554fd4 (patch) | |
tree | 595ceb96e6f72cc8e06a314e297b23b4b29dc0d1 /m4 | |
parent | 2d716517a884010f06a03529a4df933a0ba49d77 (diff) |
Refactor how libraries are checked for connect() function,
and check for connect() as it is done for other functions.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/curl-functions.m4 | 100 |
1 files changed, 99 insertions, 1 deletions
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4 index df750478c..b078d8fec 100644 --- a/m4/curl-functions.m4 +++ b/m4/curl-functions.m4 @@ -22,7 +22,7 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 50 +# serial 51 dnl CURL_INCLUDES_ARPA_INET @@ -782,6 +782,104 @@ AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET_CAMEL], [ ]) +dnl CURL_CHECK_FUNC_CONNECT +dnl ------------------------------------------------- +dnl Verify if connect is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_connect, then +dnl HAVE_CONNECT will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_CONNECT], [ + AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl + AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl + AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl + # + tst_links_connect="unknown" + tst_proto_connect="unknown" + tst_compi_connect="unknown" + tst_allow_connect="unknown" + # + AC_MSG_CHECKING([if connect can be linked]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + ]],[[ + if(0 != connect(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_connect="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_connect="no" + ]) + # + if test "$tst_links_connect" = "yes"; then + AC_MSG_CHECKING([if connect is prototyped]) + AC_EGREP_CPP([connect],[ + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + ],[ + AC_MSG_RESULT([yes]) + tst_proto_connect="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_connect="no" + ]) + fi + # + if test "$tst_proto_connect" = "yes"; then + AC_MSG_CHECKING([if connect is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + ]],[[ + if(0 != connect(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_connect="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_connect="no" + ]) + fi + # + if test "$tst_compi_connect" = "yes"; then + AC_MSG_CHECKING([if connect usage allowed]) + if test "x$curl_disallow_connect" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_connect="yes" + else + AC_MSG_RESULT([no]) + tst_allow_connect="no" + fi + fi + # + AC_MSG_CHECKING([if connect might be used]) + if test "$tst_links_connect" = "yes" && + test "$tst_proto_connect" = "yes" && + test "$tst_compi_connect" = "yes" && + test "$tst_allow_connect" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_CONNECT, 1, + [Define to 1 if you have the connect function.]) + ac_cv_func_connect="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_connect="no" + fi +]) + + dnl CURL_CHECK_FUNC_FCNTL dnl ------------------------------------------------- dnl Verify if fcntl is available, prototyped, and |