ghc/6e12e3c178fe9ad16131eb3c089...

49 lines
1.4 KiB
Diff

From 6e12e3c178fe9ad16131eb3c089bd6578976f5d6 Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Tue, 3 May 2022 13:48:56 -0400
Subject: [PATCH] configure: Check for ffi.h
As noted in #21485, we checked for ffi.h yet then failed to throw an
error if it is missing.
Fixes #21485.
---
m4/fp_find_libffi.m4 | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/m4/fp_find_libffi.m4 b/m4/fp_find_libffi.m4
index ddc511553c8..bf52afefbb8 100644
--- a/m4/fp_find_libffi.m4
+++ b/m4/fp_find_libffi.m4
@@ -49,6 +49,7 @@ AC_DEFUN([FP_FIND_LIBFFI],
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
@@ -58,10 +59,16 @@ AC_DEFUN([FP_FIND_LIBFFI],
# symbols.
LDFLAGS="$LDFLAGS -lpthread"
fi
+
AC_CHECK_LIB(ffi, ffi_call,
- [AC_CHECK_HEADERS([ffi.h], [break], [])
- AC_DEFINE([HAVE_SYSTEM_LIBFFI], [1], [Define to 1 if you have libffi.])],
- [AC_MSG_ERROR([Cannot find system libffi])])
+ [AC_CHECK_HEADERS(
+ [ffi.h],
+ [AC_DEFINE([HAVE_SYSTEM_LIBFFI], [1], [Define to 1 if you have libffi.])],
+ [AC_MSG_ERROR([Cannot find ffi.h for system libffi])]
+ )],
+ [AC_MSG_ERROR([Cannot find system libffi])]
+ )
+
CFLAGS="$CFLAGS2"
LDFLAGS="$LDFLAGS2"
])
--
GitLab