summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-11-29 22:22:39 +0000
committerIan Lynagh <ian@well-typed.com>2012-11-29 22:22:39 +0000
commit3005e90936c47c1f71672bf6c84fff20cb14014b (patch)
treefc2c6afe163460596b197665f68544de8c3ad044 /configure.ac
parentbd9e029927b25274f574104d837de0028e45a3d6 (diff)
downloadhaskell-3005e90936c47c1f71672bf6c84fff20cb14014b.tar.gz
Add configure option to use system provided libffi; fixes #5743
Based on patch from Peter Trommler: From 293495d40f62e691520331a41c6d85d82e120169 Mon Sep 17 00:00:00 2001 From: Peter Trommler <ptrommler@acm.org> Date: Sun, 21 Oct 2012 18:47:01 +0200 Subject: [PATCH] Add configure option to use system provided libffi This fixes track # 5743 and #4496.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac55
1 files changed, 55 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 54e7c1444e..6b9335edda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,6 +86,61 @@ AC_ARG_WITH([ghc],
fi
WithGhc="$GHC"])
+# system libffi
+
+AC_ARG_WITH([system-libffi],
+[AC_HELP_STRING([--with-system-libffi],
+ [Use system provided libffi for RTS [default=no]])
+])
+
+AS_IF([test "x$with_system_libffi" = "xyes"],
+ [UseSystemLibFFI="YES"], [UseSystemLibFFI="NO"]
+)
+
+
+AC_SUBST(UseSystemLibFFI)
+
+AC_ARG_WITH([ffi-includes],
+[AC_HELP_STRING([--with-ffi-includes=ARG]
+ [Find includes for libffi in ARG [default=system default]])
+],
+[
+ if test "x$UseSystemLibFFI" != "xYES"; then
+ AC_MSG_WARN([--with-ffi-includes will be ignored, --with-system-libffi not set])
+ else
+ FFIIncludeDir="$withval"
+ LIBFFI_CFLAGS="-I $withval"
+ fi
+])
+
+AC_SUBST(FFIIncludeDir)
+
+AC_ARG_WITH([ffi-libraries],
+[AC_HELP_STRING([--with-ffi-libraries=ARG]
+ [Find libffi in ARG [default=system default]])
+],
+[
+ if test "x$UseSystemLibFFI" != "xYES"; then
+ AC_MSG_WARN([--with-ffi-libraries will be ignored, --with-system-libffi not set])
+ else
+ FFILibDir="$withval" LIBFFI_LDFLAGS="-L$withval"
+ fi
+])
+
+AC_SUBST(FFILibDir)
+
+AS_IF([test "$UseSystemLibFFI" = "YES"], [
+ CFLAGS2="$CFLAGS"
+ CFLAGS="$LIBFFI_CFLAGS $CFLAGS"
+ LDFLAGS2="$LDFLAGS"
+ LDFLAGS="$LIBFFI_LDFLAGS $LDFLAGS"
+ AC_CHECK_LIB(ffi, ffi_call,
+ [AC_CHECK_HEADERS([ffi.h], [break], [])
+ AC_DEFINE([HAVE_LIBFFI], [1], [Define to 1 if you have libffi.])],
+ [UseSystemLibFFI="NO"])
+ CFLAGS="$CFLAGS2"
+ LDFLAGS="$LDFLAGS2"
+])
dnl ** Tell the make system which OS we are using
dnl $OSTYPE is set by the operating system to "msys" or "cygwin" or something