[commit: ghc] master: libffi build system tweaks (c793cc3)

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/c793cc35a0959a3e68ab09802e2c978750e94ace

>---------------------------------------------------------------

commit c793cc35a0959a3e68ab09802e2c978750e94ace
Author: Ian Lynagh <[email protected]>
Date:   Thu Nov 29 23:52:07 2012 +0000

    libffi build system tweaks

>---------------------------------------------------------------

 compiler/ghc.mk |    3 +++
 configure.ac    |    2 +-
 ghc.mk          |    8 +-------
 libffi/ghc.mk   |    1 +
 rts/ghc.mk      |    5 ++++-
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index 887f91b..0e53ca5 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -500,7 +500,10 @@ $(foreach way,$$(compiler_stage3_WAYS),\
 compiler/prelude/PrimOp_HC_OPTS  += -fforce-recomp
 
 # LibFFI.hs #includes ffi.h
+ifneq "$(UseSystemLibFFI)" "YES"
 compiler/stage2/build/LibFFI.hs : $(libffi_HEADERS)
+endif
+
 # On Windows it seems we also need to link directly to libffi
 ifeq "$(HostOS_CPP)" "mingw32"
 define windowsDynLinkToFfi
diff --git a/configure.ac b/configure.ac
index 6b9335e..0651235 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,7 +137,7 @@ AS_IF([test "$UseSystemLibFFI" = "YES"], [
  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"])
+  [AC_MSG_ERROR([Cannot find system libffi])])
  CFLAGS="$CFLAGS2"
  LDFLAGS="$LDFLAGS2"
 ])
diff --git a/ghc.mk b/ghc.mk
index 852baa9..f73c801 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -618,18 +618,12 @@ else
 MAYBE_GHCI=driver/ghci
 endif
 
-ifeq "$(UseSystemLibFFI)" "YES"
-MAYBE_LIBFFI=
-else
-MAYBE_LIBFFI=libffi
-endif
-
 BUILD_DIRS += \
    driver \
    $(MAYBE_GHCI) \
    driver/ghc \
    driver/haddock \
-   $(MAYBE_LIBFFI) \
+   libffi \
    includes \
    rts
 
diff --git a/libffi/ghc.mk b/libffi/ghc.mk
index 07d6d3d..3ced476 100644
--- a/libffi/ghc.mk
+++ b/libffi/ghc.mk
@@ -44,6 +44,7 @@ endif
 
 ifneq "$(BINDIST)" "YES"
 $(libffi_STAMP_CONFIGURE): $(TOUCH_DEP)
+	false ffi
 	$(call removeFiles,$(libffi_STAMP_STATIC_CONFIGURE))
 	$(call removeFiles,$(libffi_STAMP_STATIC_BUILD))
 	$(call removeFiles,$(libffi_STAMP_STATIC_INSTALL))
diff --git a/rts/ghc.mk b/rts/ghc.mk
index bf01a90..e3c9fa6 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -493,7 +493,10 @@ endif
 
 $(eval $(call dependencies,rts,dist,1))
 
-$(rts_dist_depfile_c_asm) : $(libffi_HEADERS) $(DTRACEPROBES_H)
+$(rts_dist_depfile_c_asm) : $(DTRACEPROBES_H)
+ifneq "$(UseSystemLibFFI)" "YES"
+$(rts_dist_depfile_c_asm) : $(libffi_HEADERS)
+endif
 
 # -----------------------------------------------------------------------------
 # compile dtrace probes if dtrace is supported
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.