libbsd/test/Makefile.am
Guillem Jover e7cf8c5785 Switch md5 compatibility logic back to direct linking
When using the recent dlsym() based wrapper, we are not requiring any
symbol from libmd, as we resolve those dynamically at run-time. We were
ending up linking against libmd because in another part of the code we
require (depending on the architecture) the SHA512 functions for the
getentropy() local implementation. But that function might be provided
by the system libc on some systems, which means we end up not linking
against libmd at all.

To solve this we go back to the previous simpler solution of linking
directly, which had the main drawback of then making programs fail to
link when not specifying -lmd (on platforms that need it). And then
switch the .so link point from a symlink to a linker script, so that we
can inject the -lmd library as-needed. This is similar to what glibc is
doing.

Fixes: commit 31f034e386
2021-12-01 04:14:35 +01:00

85 lines
1.5 KiB
Makefile

## Process this file with automake to produce Makefile.in
HEADERS_CPPFLAGS = \
-I$(top_builddir) \
-include $(top_builddir)/config.h \
-DLIBBSD_DISABLE_DEPRECATED \
-D__REENTRANT
AM_CPPFLAGS = \
-isystem $(top_srcdir)/include/bsd/ \
$(HEADERS_CPPFLAGS) \
-DLIBBSD_OVERLAY
AM_TESTS_ENVIRONMENT = \
export CC="$(CC)"; \
export CPPFLAGS="$(HEADERS_CPPFLAGS)"; \
export top_srcdir="$(top_srcdir)"; \
$(nil)
LDADD = $(top_builddir)/src/libbsd.la
EXTRA_DIST = \
headers-overlay.sh \
headers-system.sh \
$(nil)
check_SCRIPTS = \
headers-overlay.sh \
headers-system.sh \
$(nil)
check_PROGRAMS = \
overlay \
bzero \
closefrom \
endian \
humanize \
fgetln \
funopen \
fparseln \
fpurge \
md5 \
nlist \
proctitle \
proctitle-init \
progname \
pwcache \
setmode \
strl \
strmode \
strnstr \
vis \
vis-openbsd \
$(nil)
if HAVE_LIBTESTU01
arc4random_LDADD = $(LDADD) $(TESTU01_LIBS)
check_PROGRAMS += arc4random
endif
if BUILD_LIBBSD_CTOR
proctitle_LDFLAGS = \
-Wl,-u,libbsd_init_func \
$(top_builddir)/src/libbsd-ctor.a \
$(top_builddir)/src/libbsd.la \
$(nil)
check_PROGRAMS += proctitle
endif
if NEED_TRANSPARENT_LIBMD
# On the installed system this is handled via the ld script.
md5_LDADD = $(LDADD) $(MD5_LIBS)
endif
fgetln_SOURCES = test-stream.c test-stream.h fgetln.c
fgetln_CFLAGS = -Wno-deprecated-declarations
fparseln_SOURCES = test-stream.c test-stream.h fparseln.c
proctitle_init_SOURCES = proctitle.c
proctitle_init_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_USE_SETPROCTITLE_INIT=1
TESTS = $(check_SCRIPTS) $(check_PROGRAMS)