From 4f638c0e31240b2fed9aa5035c25dc08e309ae15 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 25 Sep 2020 10:04:52 +0100 Subject: [PATCH] Check if UNIX 03 is needed for CMSG_DATA, for newer Solaris. From Eric N Vander Weele. --- configure.ac | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f89c590b..82be9254 100644 --- a/configure.ac +++ b/configure.ac @@ -328,8 +328,9 @@ AC_SEARCH_LIBS(inet_ntoa, nsl) AC_SEARCH_LIBS(socket, socket) AC_CHECK_LIB(xnet, socket) -# Check for CMSG_DATA. Some platforms require _XOPEN_SOURCE_EXTENDED (for -# example see xopen_networking(7) on HP-UX). +# Check for CMSG_DATA. On some platforms like HP-UX this requires UNIX 95 +# (_XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED) (see xopen_networking(7)). On +# others, UNIX 03 (_XOPEN_SOURCE 600, see standards(7) on Solaris). XOPEN_DEFINES= AC_MSG_CHECKING(for CMSG_DATA) AC_EGREP_CPP( @@ -362,6 +363,25 @@ if test "x$found_cmsg_data" = xno; then AC_MSG_RESULT($found_cmsg_data) if test "x$found_cmsg_data" = xyes; then XOPEN_DEFINES="-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED" + fi +fi +if test "x$found_cmsg_data" = xno; then + AC_MSG_CHECKING(if CMSG_DATA needs _XOPEN_SOURCE 600) + AC_EGREP_CPP( + yes, + [ + #define _XOPEN_SOURCE 600 + #include + #ifdef CMSG_DATA + yes + #endif + ], + found_cmsg_data=yes, + found_cmsg_data=no + ) + AC_MSG_RESULT($found_cmsg_data) + if test "x$found_cmsg_data" = xyes; then + XOPEN_DEFINES="-D_XOPEN_SOURCE=600" else AC_MSG_ERROR("CMSG_DATA not found") fi