|
|
|
@ -186,6 +186,24 @@ cares_includes_stropts="\ |
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dnl CARES_INCLUDES_SYS_RANDOM |
|
|
|
|
dnl ------------------------------------------------- |
|
|
|
|
dnl Set up variable with list of headers that must be |
|
|
|
|
dnl included when sys/random.h is to be included. |
|
|
|
|
|
|
|
|
|
AC_DEFUN([CARES_INCLUDES_SYS_RANDOM], [ |
|
|
|
|
cares_includes_sys_random="\ |
|
|
|
|
/* includes start */ |
|
|
|
|
#ifdef HAVE_SYS_RANDOM_H |
|
|
|
|
# include <sys/random.h> |
|
|
|
|
#endif |
|
|
|
|
/* includes end */" |
|
|
|
|
AC_CHECK_HEADERS( |
|
|
|
|
sys/random.h, |
|
|
|
|
[], [], [$cares_includes_sys_random]) |
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dnl CARES_INCLUDES_SYS_SOCKET |
|
|
|
|
dnl ------------------------------------------------- |
|
|
|
|
dnl Set up variable with list of headers that must be |
|
|
|
@ -1520,6 +1538,90 @@ AC_DEFUN([CARES_CHECK_FUNC_GETHOSTNAME], [ |
|
|
|
|
fi |
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
dnl CARES_CHECK_FUNC_GETRANDOM |
|
|
|
|
dnl ------------------------------------------------- |
|
|
|
|
dnl Verify if getrandom 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_getrandom, then |
|
|
|
|
dnl HAVE_GETRANDOM will be defined. |
|
|
|
|
|
|
|
|
|
AC_DEFUN([CARES_CHECK_FUNC_GETRANDOM], [ |
|
|
|
|
AC_REQUIRE([CARES_INCLUDES_SYS_RANDOM])dnl |
|
|
|
|
# |
|
|
|
|
tst_links_getrandom="unknown" |
|
|
|
|
tst_proto_getrandom="unknown" |
|
|
|
|
tst_compi_getrandom="unknown" |
|
|
|
|
tst_allow_getrandom="unknown" |
|
|
|
|
# |
|
|
|
|
AC_MSG_CHECKING([if getrandom can be linked]) |
|
|
|
|
AC_LINK_IFELSE([ |
|
|
|
|
AC_LANG_FUNC_LINK_TRY([getrandom]) |
|
|
|
|
],[ |
|
|
|
|
AC_MSG_RESULT([yes]) |
|
|
|
|
tst_links_getrandom="yes" |
|
|
|
|
],[ |
|
|
|
|
AC_MSG_RESULT([no]) |
|
|
|
|
tst_links_getrandom="no" |
|
|
|
|
]) |
|
|
|
|
# |
|
|
|
|
if test "$tst_links_getrandom" = "yes"; then |
|
|
|
|
AC_MSG_CHECKING([if getrandom is prototyped]) |
|
|
|
|
AC_EGREP_CPP([getrandom],[ |
|
|
|
|
$cares_includes_sys_random |
|
|
|
|
],[ |
|
|
|
|
AC_MSG_RESULT([yes]) |
|
|
|
|
tst_proto_getrandom="yes" |
|
|
|
|
],[ |
|
|
|
|
AC_MSG_RESULT([no]) |
|
|
|
|
tst_proto_getrandom="no" |
|
|
|
|
]) |
|
|
|
|
fi |
|
|
|
|
# |
|
|
|
|
if test "$tst_proto_getrandom" = "yes"; then |
|
|
|
|
AC_MSG_CHECKING([if getrandom is compilable]) |
|
|
|
|
AC_COMPILE_IFELSE([ |
|
|
|
|
AC_LANG_PROGRAM([[ |
|
|
|
|
$cares_includes_sys_random |
|
|
|
|
]],[[ |
|
|
|
|
if(0 != getrandom(0, 0, 0)) |
|
|
|
|
return 1; |
|
|
|
|
]]) |
|
|
|
|
],[ |
|
|
|
|
AC_MSG_RESULT([yes]) |
|
|
|
|
tst_compi_getrandom="yes" |
|
|
|
|
],[ |
|
|
|
|
AC_MSG_RESULT([no]) |
|
|
|
|
tst_compi_getrandom="no" |
|
|
|
|
]) |
|
|
|
|
fi |
|
|
|
|
# |
|
|
|
|
if test "$tst_compi_getrandom" = "yes"; then |
|
|
|
|
AC_MSG_CHECKING([if getrandom usage allowed]) |
|
|
|
|
if test "x$cares_disallow_getrandom" != "xyes"; then |
|
|
|
|
AC_MSG_RESULT([yes]) |
|
|
|
|
tst_allow_getrandom="yes" |
|
|
|
|
else |
|
|
|
|
AC_MSG_RESULT([no]) |
|
|
|
|
tst_allow_getrandom="no" |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
# |
|
|
|
|
AC_MSG_CHECKING([if getrandom might be used]) |
|
|
|
|
if test "$tst_links_getrandom" = "yes" && |
|
|
|
|
test "$tst_proto_getrandom" = "yes" && |
|
|
|
|
test "$tst_compi_getrandom" = "yes" && |
|
|
|
|
test "$tst_allow_getrandom" = "yes"; then |
|
|
|
|
AC_MSG_RESULT([yes]) |
|
|
|
|
AC_DEFINE_UNQUOTED(HAVE_GETRANDOM, 1, |
|
|
|
|
[Define to 1 if you have the getrandom function.]) |
|
|
|
|
ac_cv_func_getrandom="yes" |
|
|
|
|
else |
|
|
|
|
AC_MSG_RESULT([no]) |
|
|
|
|
ac_cv_func_getrandom="no" |
|
|
|
|
fi |
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dnl CARES_CHECK_FUNC_GETSERVBYPORT_R |
|
|
|
|
dnl ------------------------------------------------- |
|
|
|
|