+if test "x$gethostbyaddrrstyle" = "xBSD"; then
+ AC_MSG_WARN([ ****** BSD-style gethostbyaddr might NOT be thread-safe! ****** ])
+fi
+
+dnl Check the style of gethostbyname, in order of preference
+dnl GNU (_r seven args)
+dnl SYSV (_r five args)
+dnl BSD (two args, may not be thread safe)
+dnl Tru64 has BSD version, but it _is_ thread safe
+dnl http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1946____.HTM
+dnl We need #stdio.h to define NULL on FreeBSD (at least)
+gethostbynamerstyle=""
+AC_MSG_CHECKING([gethostbyname_r() syntax])
+AC_TRY_LINK([
+#include <stdio.h>
+#include <netdb.h>
+], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL) ], [
+ AC_DEFINE(GETHOSTBYNAMERSTYLE, GNUSTYLE, [style of gethostbyname_r functions ])
+ gethostbynamerstyle=GNU
+])
+if test "x$gethostbynamerstyle" = "x"; then
+ AC_TRY_LINK([
+#include <stdio.h>
+#include <netdb.h>
+], [ gethostbyname_r(NULL, NULL, NULL, 0, NULL) ] , [
+ AC_DEFINE(GETHOSTBYNAMERSTYLE, SYSVSTYLE, [style of gethostbyname_r functions ])
+ gethostbynamerstyle=SYSV
+ ])
+fi
+if test "x$gethostbynamerstyle" = "x"; then
+ AC_TRY_LINK([
+#include <stdio.h>
+#include <netdb.h>
+], [ gethostbyname(NULL) ], [
+ AC_DEFINE(GETHOSTBYNAMERSTYLE, BSDSTYLE, [style of gethostbyname_r functions ])
+ gethostbynamerstyle=BSD
+ ])
+fi
+
+if test "x$gethostbynamerstyle" = "x"; then
+ AC_MSG_RESULT([none! It must not exist, here.])
+else
+ AC_MSG_RESULT([${gethostbynamerstyle}-style])
+fi
+
+if test "x$gethostbynamerstyle" = "xBSD"; then
+ AC_MSG_WARN([ ****** BSD-style gethostbyname might NOT be thread-safe! ****** ])
+fi
+
+dnl check for non-posix solaris ctime_r (extra buflen int arg)
+AC_DEFINE(POSIXSTYLE, [1], [Posix-Style ctime_r])
+AC_DEFINE(SOLARISSTYLE, [2], [Solaris-Style ctime_r])
+ctimerstyle=""
+AC_MSG_CHECKING([ctime_r() syntax])
+AC_TRY_LINK([
+#include <time.h>
+], [ ctime_r(NULL, NULL, 0) ], [
+ AC_DEFINE(CTIMERSTYLE, SOLARISSTYLE, [style of ctime_r function])
+ ctimerstyle="SOLARIS"
+])
+if test "x$ctimerstyle" = "x"; then
+ AC_TRY_LINK([
+#include <time.h>
+], [ ctime_r(NULL, NULL) ], [
+ AC_DEFINE(CTIMERSTYLE, POSIXSTYLE, [style of ctime_r function])
+ ctimerstyle="POSIX"
+ ])
+fi
+
+if test "x$ctimerstyle" = "x"; then
+ AC_MSG_RESULT([none! It must not exist, here.])
+else
+ AC_MSG_RESULT([${ctimerstyle}-style])
+fi
+
+AC_SUBST(HOSTINFO, $host)