1124N/AFrom ef06be83bcbd285f49d53e9145f4537fbd299f68 Mon Sep 17 00:00:00 2001
1124N/AFrom: Alan Coopersmith <alan.coopersmith@sun.com>
1124N/ADate: Fri, 30 Oct 2009 22:19:51 -0700
1124N/ASubject: [PATCH] Fix detection of network libraries & functions on Solaris/OpenSolaris
1124N/A
1124N/A---
1124N/A common/network/Makefile.am | 1 +
1124N/A configure.ac | 13 ++++++++++++-
1124N/A 2 files changed, 13 insertions(+), 1 deletions(-)
1124N/A
1124N/Adiff --git a/common/network/Makefile.am b/common/network/Makefile.am
1276N/Aindex ab8d5ae..a2cad30 100644
1124N/A--- a/common/network/Makefile.am
1124N/A+++ b/common/network/Makefile.am
1124N/A@@ -6,4 +6,6 @@ libnetwork_la_SOURCES = $(HDRS) TcpSocket.cxx
1124N/A
1124N/A libnetwork_la_CPPFLAGS = -I$(top_srcdir)/common
1124N/A
1124N/A+libnetwork_la_LIBADD = $(SOCKET_LIB) $(INET_LIB)
1124N/A+
1124N/A EXTRA_DIST = CMakeLists.txt
1124N/Adiff --git a/configure.ac b/configure.ac
1276N/Aindex 1f9786e..f5285c3 100644
1124N/A--- a/configure.ac
1124N/A+++ b/configure.ac
1276N/A@@ -168,16 +168,24 @@ AC_SUBST(READDISPLAY_DEFINE)
1124N/A
1124N/A dnl Under Lynx/OS 2.3, we have to link with -lbsd to resolve
1124N/A dnl gethostbyname, inet_addr, htons etc. Check if it's necessary.
1124N/A+dnl Under Solaris and other SVR4 OS'es, those require -lnsl and
1124N/A+dnl the socket functions require -lsocket
1124N/A dnl NOTE: Did not want to use AC_SEARCH_LIBS which would add
1124N/A dnl -lbsd to LIBS. We set INET_LIB instead.
1124N/A AC_LANG_SAVE
1124N/A AC_LANG_C
1124N/A AC_CHECK_FUNC(gethostbyname,INET_LIB_REQ=,INET_LIB_REQ=yes)
1124N/A if test "$INET_LIB_REQ" = yes; then
1124N/A- AC_CHECK_LIB(bsd,gethostbyname,INET_LIB=-lbsd,INET_LIB=)
1124N/A+ AC_CHECK_LIB(bsd,gethostbyname,INET_LIB=-lbsd,
1124N/A+ AC_CHECK_LIB(nsl,gethostbyname,INET_LIB=-lnsl,INET_LIB=))
1124N/A+fi
1124N/A+AC_CHECK_FUNC(connect,SOCKET_LIB_REQ=,SOCKET_LIB_REQ=yes)
1124N/A+if test "$SOCKET_LIB_REQ" = yes; then
1124N/A+ AC_CHECK_LIB(socket,connect,SOCKET_LIB=-lsocket,SOCKET_LIB=,$INET_LIB)
1124N/A fi
1124N/A AC_LANG_RESTORE
1124N/A AC_SUBST(INET_LIB)
1124N/A+AC_SUBST(SOCKET_LIB)
1124N/A
1276N/A AC_CHECK_FUNC(setenv, AC_DEFINE([HAVE_SETENV], [1], [Is setenv() present?]))
1276N/A
1276N/A@@ -215,7 +223,10 @@ AC_SEARCH_LIBS([inet_aton], [resolv])
1124N/A AC_CHECK_FUNCS([inet_aton])
1124N/A
1124N/A # IPv6 related functions
1124N/A+save_LIBS="$LIBS"
1124N/A+LIBS="$LIBS $SOCKET_LIB $INET_LIB"
1124N/A AC_CHECK_FUNCS([inet_ntop getaddrinfo])
1124N/A+LIBS="$save_LIBS"
1124N/A
1124N/A AC_CHECK_TYPES([socklen_t], [], [], [[#include <sys/socket.h>]])
1124N/A