From 60cc9f9404dde852cc00fa05ff03108ac6ec31d8 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Mon, 17 Jan 2011 21:14:54 +0100 Subject: [PATCH] build-sys: link with socketlibs when necessary To link an object which references socket functions, you need to link with -lsocket -lnsl on Solaris. Signed-off-by: Fabian Groffen --- configure.ac | 11 +++++++++++ shlibs/uuid/src/Makefile.am | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5b491f8e..c38cca43 100644 --- a/configure.ac +++ b/configure.ac @@ -211,6 +211,17 @@ AC_CHECK_MEMBER(struct sockaddr.sa_len, [#include #include ]) +SOCKET_LIBS= +AC_SEARCH_LIBS([gethostbyname], [nsl], + [if test x"$ac_cv_search_gethostbyname" != x"none required"; then + SOCKET_LIBS="$SOCKET_LIBS -lnsl"; + fi]) +AC_SEARCH_LIBS([socket], [socket], + [if test x"$ac_cv_search_socket" != x"none required"; then + SOCKET_LIBS="$SOCKET_LIBS -lsocket"; + fi]) +AC_SUBST([SOCKET_LIBS]) + dnl Static compilation m4_define([UTIL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk, blkid]) diff --git a/shlibs/uuid/src/Makefile.am b/shlibs/uuid/src/Makefile.am index 9af1979e..31cb9a2e 100644 --- a/shlibs/uuid/src/Makefile.am +++ b/shlibs/uuid/src/Makefile.am @@ -3,7 +3,7 @@ include $(top_srcdir)/config/include-Makefile.am AM_CPPFLAGS += -I$(ul_libuuid_srcdir) noinst_PROGRAMS = tst_uuid -tst_uuid_LDADD = libuuid.la #$(ul_libuuid_la) +tst_uuid_LDADD = libuuid.la $(SOCKET_LIBS) #$(ul_libuuid_la) # includes uuidincdir = $(includedir)/uuid @@ -16,6 +16,8 @@ libuuid_la_SOURCES = clear.c compare.c copy.c gen_uuid.c \ libuuid_la_DEPENDENCIES = uuid.sym +libuuid_la_LIBADD = $(SOCKET_LIBS) + libuuid_la_LDFLAGS = -Wl,--version-script=$(ul_libuuid_srcdir)/uuid.sym \ -version-info $(LIBUUID_VERSION_INFO) -- 2.39.5