+AC_CHECK_FUNC(localtime_r, [ AC_DEFINE(HAVE_LOCALTIME_R) ])
+AC_CHECK_FUNC(gmtime_r, [ AC_DEFINE(HAVE_GMTIME_R) ])
+AC_CHECK_FUNC(readdir_r, [ AC_DEFINE(HAVE_READDIR_R) ])
+dnl By preference, we probably should use getaddrinfo which avoids thread
+dnl safety issues and supports IPv6, however there currently is no code
+dnl for it, so testing for it is temporarily disabled and we are restricted
+dnl to gethostbyname_r/gethostbyaddr_r and getservbyname_r
+
+dnl AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO), [
+ dnl no getaddrinfo, so check for gethostbyname_r and
+ dnl related functions (taken from python's configure.in)
+ dnl sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments
+ AX_FUNC_WHICH_GETHOSTBYNAME_R
+ if test "x$ac_cv_func_which_gethostbyname_r" = "xno" -o \
+ "x$ac_cv_func_which_gethostbyname_r" = "xunknown" ; then
+ AC_CHECK_FUNC(gethostbyname, [ AC_DEFINE(HAVE_GETHOSTBYNAME) ])
+ fi
+ dnl A similar test for getservbyname_r
+ dnl I'm tempted to just not do this test which is taking much time and
+ dnl do something similar as for gethostbyaddr_r, but OTOH the macro
+ dnl doing the test already exists, so using it is easy enough. - SN
+ AC_raf_FUNC_WHICH_GETSERVBYNAME_R
+ if test "x$ac_cv_func_which_getservbyname_r" = "xno" -o \
+ "x$ac_cv_func_which_getservbyname_r" = "xunknown" ; then
+ AC_CHECK_FUNCS(getservbyname,[ AC_DEFINE(HAVE_GETSERVBYNAME) ])
+ fi
+ dnl For gethostbyaddr_r, we currently do no separate test, instead, we
+ dnl silently assume it's available exactly if gethostbyname_r is
+ dnl available and always requires two more arguments than
+ dnl gethostbyname_r.
+ dnl (also, I'm lazy and there no m4 file that's ready for use for this
+ dnl function, although it should be easy to rewrite the gethostbyname_r
+ dnl check to fit this case, if it's really needed. - SN )
+dnl ]
+dnl )
+