Skip to content

Commit

Permalink
Fix build without libtool
Browse files Browse the repository at this point in the history
When libtool is not installed, automake calls the linker with the
library flags (`-llib`) _before_ the object files. In order to
successfully resolve symbols, the library flags need to come _after_ any
object file needing them. libtool does that correctly by itself, but
when automake cannot rely on libtool, we need to tell it about libraries
via `mybin_LDADD` instead of the global `AM_LDFLAGS`.
  • Loading branch information
ahans committed Sep 27, 2023
1 parent 74dd964 commit 0b3adf0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
bin_PROGRAMS = dropwatch dwdump

AM_CFLAGS = -g -Wall -Werror $(LIBNL3_CFLAGS) $(LIBNLG3_CFLAGS) $(READLINE_CFLAGS)
AM_LDFLAGS = $(LIBNL3_LIBS) $(LIBNLG3_LIBS) $(READLINE_LIBS) -lpcap
AM_LDFLAGS =
ALL_LIBS = $(LIBNL3_LIBS) $(LIBNLG3_LIBS) $(READLINE_LIBS) $(LIBPCAP_LIBS)
dropwatch_LDADD = $(ALL_LIBS)
dwdump_LDADD = $(ALL_LIBS)
AM_CPPFLAGS = -D_GNU_SOURCE

dropwatch_SOURCES = main.c lookup.c lookup_kas.c
dwdump_SOURCES = dwdump.c

if USE_BFD
dropwatch_SOURCES += lookup_bfd.c
AM_LDFLAGS += -lbfd
dropwatch_LDADD += -lbfd
endif

0 comments on commit 0b3adf0

Please sign in to comment.