Alien-cares
view release on metacpan or search on metacpan
libcares/m4/cares-functions.m4 view on Meta::CPAN
],[
AC_MSG_RESULT([no])
tst_proto_freeaddrinfo="no"
])
fi
#
if test "$tst_proto_freeaddrinfo" = "yes"; then
AC_MSG_CHECKING([if freeaddrinfo is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_ws2tcpip
$cares_includes_sys_socket
$cares_includes_netdb
]],[[
freeaddrinfo(0);
]])
],[
AC_MSG_RESULT([yes])
tst_compi_freeaddrinfo="yes"
],[
AC_MSG_RESULT([no])
tst_compi_freeaddrinfo="no"
])
fi
#
if test "$tst_compi_freeaddrinfo" = "yes"; then
AC_MSG_CHECKING([if freeaddrinfo usage allowed])
if test "x$cares_disallow_freeaddrinfo" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_freeaddrinfo="yes"
else
AC_MSG_RESULT([no])
tst_allow_freeaddrinfo="no"
fi
fi
#
AC_MSG_CHECKING([if freeaddrinfo might be used])
if test "$tst_links_freeaddrinfo" = "yes" &&
test "$tst_proto_freeaddrinfo" = "yes" &&
test "$tst_compi_freeaddrinfo" = "yes" &&
test "$tst_allow_freeaddrinfo" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1,
[Define to 1 if you have the freeaddrinfo function.])
ac_cv_func_freeaddrinfo="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_freeaddrinfo="no"
fi
])
dnl CARES_CHECK_FUNC_GETADDRINFO
dnl -------------------------------------------------
dnl Verify if getaddrinfo is available, prototyped, can
dnl be compiled and seems to work. If all of these are
dnl true, and usage has not been previously disallowed
dnl with shell variable cares_disallow_getaddrinfo, then
dnl HAVE_GETADDRINFO will be defined. Additionally when
dnl HAVE_GETADDRINFO gets defined this will also attempt
dnl to find out if getaddrinfo happens to be threadsafe,
dnl defining HAVE_GETADDRINFO_THREADSAFE when true.
AC_DEFUN([CARES_CHECK_FUNC_GETADDRINFO], [
AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl
AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl
AC_REQUIRE([CARES_INCLUDES_STRING])dnl
AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl
AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
#
tst_links_getaddrinfo="unknown"
tst_proto_getaddrinfo="unknown"
tst_compi_getaddrinfo="unknown"
tst_works_getaddrinfo="unknown"
tst_allow_getaddrinfo="unknown"
tst_tsafe_getaddrinfo="unknown"
#
AC_MSG_CHECKING([if getaddrinfo can be linked])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_ws2tcpip
$cares_includes_sys_socket
$cares_includes_netdb
]],[[
if(0 != getaddrinfo(0, 0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_links_getaddrinfo="yes"
],[
AC_MSG_RESULT([no])
tst_links_getaddrinfo="no"
])
#
if test "$tst_links_getaddrinfo" = "yes"; then
AC_MSG_CHECKING([if getaddrinfo is prototyped])
AC_EGREP_CPP([getaddrinfo],[
$cares_includes_ws2tcpip
$cares_includes_sys_socket
$cares_includes_netdb
],[
AC_MSG_RESULT([yes])
tst_proto_getaddrinfo="yes"
],[
AC_MSG_RESULT([no])
tst_proto_getaddrinfo="no"
])
fi
#
if test "$tst_proto_getaddrinfo" = "yes"; then
AC_MSG_CHECKING([if getaddrinfo is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_ws2tcpip
$cares_includes_sys_socket
$cares_includes_netdb
]],[[
if(0 != getaddrinfo(0, 0, 0, 0))
return 1;
libcares/m4/cares-functions.m4 view on Meta::CPAN
dnl only do runtime verification when not cross-compiling
if test "x$cross_compiling" != "xyes" &&
test "$tst_compi_getaddrinfo" = "yes"; then
AC_MSG_CHECKING([if getaddrinfo seems to work])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_ws2tcpip
$cares_includes_stdlib
$cares_includes_string
$cares_includes_sys_socket
$cares_includes_netdb
]],[[
struct addrinfo hints;
struct addrinfo *ai = 0;
int error;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
error = getaddrinfo("127.0.0.1", 0, &hints, &ai);
if(error || !ai)
exit(1); /* fail */
else
exit(0);
]])
],[
AC_MSG_RESULT([yes])
tst_works_getaddrinfo="yes"
],[
AC_MSG_RESULT([no])
tst_works_getaddrinfo="no"
])
fi
#
if test "$tst_compi_getaddrinfo" = "yes" &&
test "$tst_works_getaddrinfo" != "no"; then
AC_MSG_CHECKING([if getaddrinfo usage allowed])
if test "x$cares_disallow_getaddrinfo" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_getaddrinfo="yes"
else
AC_MSG_RESULT([no])
tst_allow_getaddrinfo="no"
fi
fi
#
AC_MSG_CHECKING([if getaddrinfo might be used])
if test "$tst_links_getaddrinfo" = "yes" &&
test "$tst_proto_getaddrinfo" = "yes" &&
test "$tst_compi_getaddrinfo" = "yes" &&
test "$tst_allow_getaddrinfo" = "yes" &&
test "$tst_works_getaddrinfo" != "no"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1,
[Define to 1 if you have a working getaddrinfo function.])
ac_cv_func_getaddrinfo="yes"
else
AC_MSG_RESULT([no])
ac_cv_func_getaddrinfo="no"
ac_cv_func_getaddrinfo_threadsafe="no"
fi
#
if test "$ac_cv_func_getaddrinfo" = "yes"; then
AC_MSG_CHECKING([if getaddrinfo is threadsafe])
case $host_os in
aix[[1234]].* | aix5.[[01]].*)
dnl aix 5.1 and older
tst_tsafe_getaddrinfo="no"
;;
aix*)
dnl aix 5.2 and newer
tst_tsafe_getaddrinfo="yes"
;;
darwin[[12345]].*)
dnl darwin 5.0 and mac os x 10.1.X and older
tst_tsafe_getaddrinfo="no"
;;
darwin*)
dnl darwin 6.0 and mac os x 10.2.X and newer
tst_tsafe_getaddrinfo="yes"
;;
freebsd[[1234]].* | freebsd5.[[1234]]*)
dnl freebsd 5.4 and older
tst_tsafe_getaddrinfo="no"
;;
freebsd*)
dnl freebsd 5.5 and newer
tst_tsafe_getaddrinfo="yes"
;;
hpux[[123456789]].* | hpux10.* | hpux11.0* | hpux11.10*)
dnl hpux 11.10 and older
tst_tsafe_getaddrinfo="no"
;;
hpux*)
dnl hpux 11.11 and newer
tst_tsafe_getaddrinfo="yes"
;;
netbsd[[123]].*)
dnl netbsd 3.X and older
tst_tsafe_getaddrinfo="no"
;;
netbsd*)
dnl netbsd 4.X and newer
tst_tsafe_getaddrinfo="yes"
;;
*bsd*)
dnl All other bsd's
tst_tsafe_getaddrinfo="no"
;;
solaris2*)
dnl solaris which have it
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], [
$cares_includes_sys_socket
$cares_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([[
$cares_includes_sys_socket
$cares_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([[
]],[[
#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
return 0;
#elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700)
return 0;
#else
force compilation error
#endif
]])
],[
tst_h_errno_sbs_issue_7="yes"
],[
tst_h_errno_sbs_issue_7="no"
])
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
AC_MSG_RESULT([$tst_tsafe_getaddrinfo])
if test "$tst_tsafe_getaddrinfo" = "yes"; then
AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1,
[Define to 1 if the getaddrinfo function is threadsafe.])
ac_cv_func_getaddrinfo_threadsafe="yes"
else
ac_cv_func_getaddrinfo_threadsafe="no"
fi
fi
])
dnl CARES_CHECK_FUNC_GETENV
dnl -------------------------------------------------
dnl Verify if getenv 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 cares_disallow_getenv, then
dnl HAVE_GETENV will be defined.
AC_DEFUN([CARES_CHECK_FUNC_GETENV], [
AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl
#
tst_links_getenv="unknown"
tst_proto_getenv="unknown"
tst_compi_getenv="unknown"
tst_allow_getenv="unknown"
#
AC_MSG_CHECKING([if getenv can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([getenv])
],[
AC_MSG_RESULT([yes])
tst_links_getenv="yes"
],[
AC_MSG_RESULT([no])
tst_links_getenv="no"
])
#
if test "$tst_links_getenv" = "yes"; then
AC_MSG_CHECKING([if getenv is prototyped])
AC_EGREP_CPP([getenv],[
$cares_includes_stdlib
],[
AC_MSG_RESULT([yes])
tst_proto_getenv="yes"
],[
AC_MSG_RESULT([no])
tst_proto_getenv="no"
])
fi
#
if test "$tst_proto_getenv" = "yes"; then
AC_MSG_CHECKING([if getenv is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$cares_includes_stdlib
]],[[
if(0 != getenv(0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_getenv="yes"
],[
AC_MSG_RESULT([no])
tst_compi_getenv="no"
( run in 2.092 seconds using v1.01-cache-2.11-cpan-2ed5026b665 )