summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Groffen2011-01-17 21:14:54 +0100
committerKarel Zak2011-01-20 23:03:01 +0100
commit60cc9f9404dde852cc00fa05ff03108ac6ec31d8 (patch)
treecc21398f4ff075f06d8af0168d44fab3b3ef4223
parentbuild-sys: check for loff_t, it may not exist (diff)
downloadkernel-qcow2-util-linux-60cc9f9404dde852cc00fa05ff03108ac6ec31d8.tar.gz
kernel-qcow2-util-linux-60cc9f9404dde852cc00fa05ff03108ac6ec31d8.tar.xz
kernel-qcow2-util-linux-60cc9f9404dde852cc00fa05ff03108ac6ec31d8.zip
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 <grobian@gentoo.org>
-rw-r--r--configure.ac11
-rw-r--r--shlibs/uuid/src/Makefile.am4
2 files changed, 14 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 5b491f8ef..c38cca43f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -211,6 +211,17 @@ AC_CHECK_MEMBER(struct sockaddr.sa_len,
[#include <sys/types.h>
#include <sys/socket.h>])
+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 9af1979ea..31cb9a2e1 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)