File: Restrict-socket-lib-to-where-it-s-actually-needed.patch

package info (click to toggle)
libqb 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,796 kB
  • ctags: 2,139
  • sloc: ansic: 18,844; sh: 11,559; makefile: 359
file content (57 lines) | stat: -rw-r--r-- 2,162 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi@debian.org>
Date: Mon, 5 Dec 2016 23:01:49 +0100
Subject: Restrict socket lib to where it's actually needed

---
 configure.ac         | 5 ++++-
 examples/Makefile.am | 4 ++--
 lib/Makefile.am      | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 65b71d0..9c9895d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -107,7 +107,10 @@ AX_SAVE_FLAGS
 AC_SEARCH_LIBS([dlopen],[dl],,[AC_MSG_ERROR([cannot find dlopen() function])])
 AC_SUBST([dlopen_LIBS],[$LIBS])
 AX_RESTORE_FLAGS
-AC_SEARCH_LIBS([socket], [socket])
+AX_SAVE_FLAGS
+AC_SEARCH_LIBS([socket], [socket],,[AC_MSG_ERROR([cannot find socket() function])])
+AC_SUBST([socket_LIBS],[$LIBS])
+AX_RESTORE_FLAGS
 AC_SEARCH_LIBS([gethostbyname], [nsl])
 
 # look for testing harness "check"
diff --git a/examples/Makefile.am b/examples/Makefile.am
index d546fca..3ba95fb 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -33,11 +33,11 @@ simplelog_LDADD = $(top_builddir)/lib/libqb.la
 
 tcpclient_SOURCES = tcpclient.c $(top_builddir)/include/qb/qbloop.h
 tcpclient_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
-tcpclient_LDADD = $(top_builddir)/lib/libqb.la
+tcpclient_LDADD = $(top_builddir)/lib/libqb.la $(socket_LIBS)
 
 tcpserver_SOURCES = tcpserver.c $(top_builddir)/include/qb/qbloop.h
 tcpserver_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
-tcpserver_LDADD = $(top_builddir)/lib/libqb.la
+tcpserver_LDADD = $(top_builddir)/lib/libqb.la $(socket_LIBS)
 
 ipcclient_SOURCES = ipcclient.c $(top_builddir)/include/qb/qbloop.h \
 		    $(top_builddir)/include/qb/qbipcc.h
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 0e7b0dc..b372628 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -41,7 +41,7 @@ source_to_lint		= util.c hdb.c ringbuffer.c ringbuffer_helper.c \
 
 libqb_la_SOURCES	= $(source_to_lint) unix.c
 libqb_la_CFLAGS		= $(PTHREAD_CFLAGS)
-libqb_la_LIBADD		= $(LTLIBOBJS) $(dlopen_LIBS) $(PTHREAD_LIBS)
+libqb_la_LIBADD		= $(LTLIBOBJS) $(dlopen_LIBS) $(PTHREAD_LIBS) $(socket_LIBS)
 
 AM_LDFLAGS 	= $(LDFLAGS_COPY:-Bsymbolic-functions=)