[PATCH] build-sys: link with socketlibs when necessary

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To link an object which references socket functions, you need to link
with -lsocket -lnsl on Solaris.

Signed-off-by: Fabian Groffen <grobian@xxxxxxxxxx>

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -219,6 +219,11 @@
                 AC_MSG_RESULT(yes)],
                [AC_MSG_RESULT(no)])
 
+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
--- a/shlibs/uuid/src/Makefile.am
+++ b/shlibs/uuid/src/Makefile.am
@@ -3,7 +3,7 @@
 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_DEPENDENCIES = uuid.sym
 
+libuuid_la_LIBADD = $(SOCKET_LIBS)
+
 libuuid_la_LDFLAGS = -Wl,--version-script=$(ul_libuuid_srcdir)/uuid.sym \
                      -version-info $(LIBUUID_VERSION_INFO)
 
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux