build-sys: Make 'make check' work on FreeBSD

On FreeBSD we need to set the SHELL explicitly to /bin/bash since csh
is used otherwise and wouldn't allow us to run the check-local rule.
Besides that we need -shared for the check to pass. However, the FreeBSD
compiler doesn't allow us to recognize undefined symbols, which seem
to get suppressed with the -shared parameter. If the -shared is not passed
we get error messages due to undefined symbols _progname and environ from
libc.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
Stefan Berger 2018-09-05 22:27:53 +00:00
parent 314f8080d3
commit 3300bbbcae

View File

@ -570,10 +570,11 @@ LDFLAGS_ARCH += $(findstring -m64, $(CFLAGS))
LDFLAGS_ARCH += $(findstring -m32, $(LDFLAGS))
LDFLAGS_ARCH += $(findstring -m64, $(LDFLAGS))
check-local: SHELL?=/bin/bash
check-local:
@case $(host_os) in \
openbsd*) ADDLIBS="-lc" ;; \
darwin*) LDFLAGS_OS="-shared" ;; \
darwin*|freebsd*) LDFLAGS_OS="-shared" ;; \
*) ADDLIBS="" ;; \
esac; \
($(CC) $$LDFLAGS_OS $(LDFLAGS_ARCH) -nostdlib -L./.libs -ltpms $$ADDLIBS 2>/dev/null || \
@ -581,7 +582,7 @@ check-local:
$(CC) $$LDFLAGS_OS $(LDFLAGS_ARCH) -nostdlib -L./.libs -ltpms $$ADDLIBS 2>&1 | grep libtpms))
@case $(host_os) in \
openbsd*) ADDLIBS="-lc" ;; \
darwin*) LDFLAGS_OS="-shared" ;; \
darwin*|freebsd*) LDFLAGS_OS="-shared" ;; \
*) ADDLIBS="" ;; \
esac; \
$(CC) $$LDFLAGS_OS $(LDFLAGS_ARCH) -nostdlib -L./.libs -ltpms $$ADDLIBS 2>/dev/null