Skip to content

Commit 27b57d9

Browse files
authored
More specific library linking (#24)
Currently, the main binary and all output modules are linked to the same set of libraries. This changes the linking so that only the main binary is linked to pcap, and only addrwatch_mysql is linked to mysqlclient. This allows the main binary and output modules to be packaged separately with fewer dependencies for each individual package.
1 parent 374cfd2 commit 27b57d9

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ optional_modules=""
1212
AC_SUBST([optional_modules])
1313

1414
# Checks for libraries.
15-
AC_CHECK_LIB([pcap], [pcap_open_live])
15+
AC_CHECK_LIB([pcap], [pcap_open_live], :)
1616
AC_CHECK_LIB([rt], [shm_open])
1717

1818
PKG_CHECK_MODULES(LIBEVENT, [libevent >= 1.4], , [
@@ -46,7 +46,7 @@ AC_ARG_ENABLE([sqlite3],
4646
)
4747
AC_ARG_ENABLE([mysql],
4848
AS_HELP_STRING([--enable-mysql], [Enable MySQL database output]),
49-
AC_CHECK_LIB([mysqlclient], [mysql_real_connect], , [
49+
AC_CHECK_LIB([mysqlclient], [mysql_real_connect], :, [
5050
AC_MSG_ERROR([Unable to find libmysqlclient.])
5151
])
5252
optional_modules="${optional_modules} addrwatch_mysql"

src/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ addrwatch_stdout_SOURCES = addrwatch_stdout.c shm_client.c shm_client.h
99
addrwatch_syslog_SOURCES = addrwatch_syslog.c shm_client.c shm_client.h
1010
addrwatch_mysql_SOURCES = addrwatch_mysql.c shm_client.c shm_client.h util.c util.h
1111

12-
addrwatch_LDADD = @LIBEVENT_LIBS@
12+
addrwatch_LDADD = @LIBEVENT_LIBS@ -lpcap
13+
addrwatch_mysql_LDADD = -lmysqlclient
1314

0 commit comments

Comments
 (0)