AC_DEFUN(AC_LBL_LIBRARY_NET, [
# Most operating systems have gethostbyname() in the default searched
# libraries (i.e. libc):
- # Some OSes (eg. Solaris) place it in libnsl
+ # Some OSes (eg. Solaris) place it in libnsl, but in at least some
+ # versions of Solaris, there are alternate versions of these APIs
+ # in libxnet, and those versions conform to the Single UNIX
+ # Specification, meaning you can actually check for truncation
+ # of incoming datagrams in recvmsg(), so we prefer that.
# Some strange OSes (SINIX) have it in libsocket:
- AC_SEARCH_LIBS(gethostbyname, nsl socket resolv)
+ AC_SEARCH_LIBS(gethostbyname, xnet nsl socket resolv)
# Unfortunately libsocket sometimes depends on libnsl and
# AC_SEARCH_LIBS isn't up to the task of handling dependencies like this.
if test "$ac_cv_search_gethostbyname" = "no"
# Most operating systems have gethostbyname() in the default searched
# libraries (i.e. libc):
- # Some OSes (eg. Solaris) place it in libnsl
+ # Some OSes (eg. Solaris) place it in libnsl, but in at least some
+ # versions of Solaris, there are alternate versions of these APIs
+ # in libxnet, and those versions conform to the Single UNIX
+ # Specification, meaning you can actually check for truncation
+ # of incoming datagrams in recvmsg(), so we prefer that.
# Some strange OSes (SINIX) have it in libsocket:
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5
$as_echo_n "checking for library containing gethostbyname... " >&6; }
return 0;
}
_ACEOF
-for ac_lib in '' nsl socket resolv; do
+for ac_lib in '' xnet nsl socket resolv; do
if test -z "$ac_lib"; then
ac_res="none required"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+# include "ftmacros.h"
# include <sys/socket.h>
int
main ()
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+# include "ftmacros.h"
# include <sys/socket.h>
int
main ()
AC_MSG_CHECKING(if struct msghdr has a msg_control member)
AC_CACHE_VAL(ac_cv_lbl_struct_msghdr_has_msg_control,
AC_TRY_COMPILE([
+# include "ftmacros.h"
# include <sys/socket.h>],
[u_int i = sizeof(((struct msghdr *)0)->msg_control)],
ac_cv_lbl_struct_msghdr_has_msg_control=yes,
AC_MSG_CHECKING(if struct msghdr has a msg_flags member)
AC_CACHE_VAL(ac_cv_lbl_struct_msghdr_has_msg_flags,
AC_TRY_COMPILE([
+# include "ftmacros.h"
# include <sys/socket.h>],
[u_int i = sizeof(((struct msghdr *)0)->msg_flags)],
ac_cv_lbl_struct_msghdr_has_msg_flags=yes,
*/
#if defined(sun) || defined(__sun)
#define __EXTENSIONS__
+
+ /*
+ * We also need to define _XPG4_2 in order to get
+ * the Single UNIX Specification version of
+ * recvmsg().
+ */
+ #define _XPG4_2
#elif defined(_hpux) || defined(hpux) || defined(__hpux)
#define _REENTRANT
#elif defined(__linux__) || defined(linux) || defined(__linux)