1 From 1988f6228225e10bccc50941798f1e1b4ca1ff62 Mon Sep 17 00:00:00 2001
2 From: Jeffery To <jeffery.to@gmail.com>
3 Date: Fri, 18 Jun 2021 15:46:47 +0800
4 Subject: [PATCH] More specific library linking
6 Currently, the main binary and all output modules are linked to the same
7 set of libraries. This changes the linking so that only the main binary
8 is linked to pcap, and only addrwatch_mysql is linked to mysqlclient.
10 This allows the main binary and output modules to be packaged separately
11 with fewer dependencies for each individual package.
14 src/Makefile.am | 3 ++-
15 2 files changed, 4 insertions(+), 3 deletions(-)
19 @@ -12,7 +12,7 @@ optional_modules=""
20 AC_SUBST([optional_modules])
22 # Checks for libraries.
23 -AC_CHECK_LIB([pcap], [pcap_open_live])
24 +AC_CHECK_LIB([pcap], [pcap_open_live], :)
25 AC_CHECK_LIB([rt], [shm_open])
27 PKG_CHECK_MODULES(LIBEVENT, [libevent >= 1.4], , [
28 @@ -46,7 +46,7 @@ AC_ARG_ENABLE([sqlite3],
30 AC_ARG_ENABLE([mysql],
31 AS_HELP_STRING([--enable-mysql], [Enable MySQL database output]),
32 - AC_CHECK_LIB([mysqlclient], [mysql_real_connect], , [
33 + AC_CHECK_LIB([mysqlclient], [mysql_real_connect], :, [
34 AC_MSG_ERROR([Unable to find libmysqlclient.])
36 optional_modules="${optional_modules} addrwatch_mysql"
39 @@ -9,5 +9,6 @@ addrwatch_stdout_SOURCES = addrwatch_std
40 addrwatch_syslog_SOURCES = addrwatch_syslog.c shm_client.c shm_client.h
41 addrwatch_mysql_SOURCES = addrwatch_mysql.c shm_client.c shm_client.h util.c util.h
43 -addrwatch_LDADD = @LIBEVENT_LIBS@
44 +addrwatch_LDADD = @LIBEVENT_LIBS@ -lpcap
45 +addrwatch_mysql_LDADD = -lmysqlclient