diff options
author | Yang Tse <yangsita@gmail.com> | 2008-09-24 12:38:11 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2008-09-24 12:38:11 +0000 |
commit | 006cab3e9e1fa4dc6882305c9e83e80a6b24a4cb (patch) | |
tree | 34b8a382ac6109f9e522c8b6943c4f5fd4d9e423 /m4 | |
parent | 4e909ee8b1e7e9f174af629615224180568a7e92 (diff) |
temporarily enable CURL_CHECK_FUNC_INET_NTOA_R
Diffstat (limited to 'm4')
-rw-r--r-- | m4/curl-functions.m4 | 153 |
1 files changed, 152 insertions, 1 deletions
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4 index 09af726b4..bbb0656e7 100644 --- a/m4/curl-functions.m4 +++ b/m4/curl-functions.m4 @@ -22,7 +22,34 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 20 +# serial 21 + + +dnl CURL_INCLUDES_ARPA_INET +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when arpa/inet.h is to be included. + +AC_DEFUN([CURL_INCLUDES_ARPA_INET], [ +curl_includes_arpa_inet="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +# include <sys/socket.h> +#endif +#ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +#endif +#ifdef HAVE_ARPA_INET_H +# include <arpa_inet.h> +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h sys/socket.h netinet/in.h arpa/inet.h, + [], [], [$curl_includes_arpa_inet]) +]) dnl CURL_INCLUDES_NETDB @@ -1119,6 +1146,130 @@ AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [ ]) +dnl CURL_CHECK_FUNC_INET_NTOA_R +dnl ------------------------------------------------- +dnl Verify if inet_ntoa_r is available, prototyped, +dnl and can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_inet_ntoa_r, then +dnl HAVE_INET_NTOA_R will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_INET_NTOA_R], [ + AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl + # + tst_links_inet_ntoa_r="unknown" + tst_proto_inet_ntoa_r="unknown" + tst_compi_inet_ntoa_r="unknown" + tst_allow_inet_ntoa_r="unknown" + tst_nargs_inet_ntoa_r="unknown" + # + AC_MSG_CHECKING([if inet_ntoa_r can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([inet_ntoa_r]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_inet_ntoa_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_inet_ntoa_r="no" + ]) + # + if test "$tst_links_inet_ntoa_r" = "yes"; then + AC_MSG_CHECKING([if inet_ntoa_r is prototyped]) + AC_EGREP_CPP([inet_ntoa_r],[ + $curl_includes_arpa_inet + ],[ + AC_MSG_RESULT([yes]) + tst_proto_inet_ntoa_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_inet_ntoa_r="no" + ]) + fi + # + if test "$tst_proto_inet_ntoa_r" = "yes"; then + if test "$tst_nargs_inet_ntoa_r" = "unknown"; then + AC_MSG_CHECKING([if inet_ntoa_r takes 2 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_arpa_inet + ]],[[ + struct in_addr addr; + if(0 != inet_ntoa_r(addr, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_inet_ntoa_r="yes" + tst_nargs_inet_ntoa_r="2" + ],[ + AC_MSG_RESULT([no]) + tst_compi_inet_ntoa_r="no" + ]) + fi + if test "$tst_nargs_inet_ntoa_r" = "unknown"; then + AC_MSG_CHECKING([if inet_ntoa_r takes 3 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_arpa_inet + ]],[[ + struct in_addr addr; + if(0 != inet_ntoa_r(addr, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_inet_ntoa_r="yes" + tst_nargs_inet_ntoa_r="3" + ],[ + AC_MSG_RESULT([no]) + tst_compi_inet_ntoa_r="no" + ]) + fi + AC_MSG_CHECKING([if inet_ntoa_r is compilable]) + if test "$tst_compi_inet_ntoa_r" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + if test "$tst_compi_inet_ntoa_r" = "yes"; then + AC_MSG_CHECKING([if inet_ntoa_r usage allowed]) + if test "x$curl_disallow_inet_ntoa_r" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_inet_ntoa_r="yes" + else + AC_MSG_RESULT([no]) + tst_allow_inet_ntoa_r="no" + fi + fi + # + AC_MSG_CHECKING([if inet_ntoa_r might be used]) + if test "$tst_links_inet_ntoa_r" = "yes" && + test "$tst_proto_inet_ntoa_r" = "yes" && + test "$tst_compi_inet_ntoa_r" = "yes" && + test "$tst_allow_inet_ntoa_r" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_INET_NTOA_R, 1, + [Define to 1 if you have the inet_ntoa_r function.]) + dnl AC_DEFINE_UNQUOTED(INET_NTOA_R_ARGS, $tst_nargs_inet_ntoa_r, + dnl [Specifies the number of arguments to inet_ntoa_r]) + # + if test "$tst_nargs_inet_ntoa_r" -eq "2"; then + AC_DEFINE(HAVE_INET_NTOA_R_2, 1, [inet_ntoa_r() takes 2 args]) + elif test "$tst_nargs_inet_ntoa_r" -eq "3"; then + AC_DEFINE(HAVE_INET_NTOA_R_3, 1, [inet_ntoa_r() takes 3 args]) + fi + # + ac_cv_func_inet_ntoa_r="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_inet_ntoa_r="no" + fi +]) + + dnl CURL_CHECK_FUNC_LOCALTIME_R dnl ------------------------------------------------- dnl Verify if localtime_r is available, prototyped, can |