summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorKarel Gardas <karel.gardas@centrum.cz>2015-11-01 10:18:55 +0100
committerBen Gamari <ben@smart-cactus.org>2015-11-01 10:18:55 +0100
commitc8e866a190d4d5866bf364ee794db28b227a2e0e (patch)
tree98b4aa069c891ea0288c0c294b499ec1751e916a /configure.ac
parent4ad2a8f9a503a5ee060eb8e0d5ae71b98d605cfa (diff)
downloadhaskell-c8e866a190d4d5866bf364ee794db28b227a2e0e.tar.gz
Enforce linkage with pthread library on OpenBSD
This patch enforces linkage with pthread library on OpenBSD. This is done in order to avoid linker errors when linking with libffi which requires POSIX threading but itself is not linked with libpthread directly. So client binaries (of libffi) needs to link against libpthread explicitly Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D1410
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac9
1 files changed, 9 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index bc18c124cb..6bd21030c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -919,6 +919,15 @@ AS_IF([test "$UseSystemLibFFI" = "YES"], [
CFLAGS="$LIBFFI_CFLAGS $CFLAGS"
LDFLAGS2="$LDFLAGS"
LDFLAGS="$LIBFFI_LDFLAGS $LDFLAGS"
+ if test "$HostOS" = "openbsd";
+ then
+ # OpenBSD's libffi is not directly linked to the libpthread but
+ # still requires pthread functionality. This means that any client
+ # binary which links with libffi also needs to link with
+ # libpthread. If it does not, then linking fails with unresolved
+ # symbols.
+ LDFLAGS="$LDFLAGS -lpthread"
+ fi
AC_CHECK_LIB(ffi, ffi_call,
[AC_CHECK_HEADERS([ffi.h], [break], [])
AC_DEFINE([HAVE_LIBFFI], [1], [Define to 1 if you have libffi.])],