diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-11-29 22:22:39 +0000 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-11-29 22:22:39 +0000 |
commit | 3005e90936c47c1f71672bf6c84fff20cb14014b (patch) | |
tree | fc2c6afe163460596b197665f68544de8c3ad044 /rts/ghc.mk | |
parent | bd9e029927b25274f574104d837de0028e45a3d6 (diff) | |
download | haskell-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 'rts/ghc.mk')
-rw-r--r-- | rts/ghc.mk | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/rts/ghc.mk b/rts/ghc.mk index fe26ee1f10..bf01a90d5a 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -107,8 +107,10 @@ $(foreach lib,$(ALL_RTS_DEF_LIBNAMES),$(eval $(call make-importlib-def,$(lib)))) endif ifneq "$(BINDIST)" "YES" +ifneq "$(UseSystemLibFFI)" "YES" rts_ffi_objs_stamp = rts/dist/ffi/stamp rts_ffi_objs = rts/dist/ffi/*.o + $(rts_ffi_objs_stamp): $(libffi_STATIC_LIB) $(TOUCH_DEP) | $$(dir $$@)/. cd rts/dist/ffi && $(AR) x ../../../$(libffi_STATIC_LIB) "$(TOUCH_CMD)" $@ @@ -121,6 +123,7 @@ rts/dist/build/libffi$(soext): libffi/build/inst/lib/libffi$(soext) rts/dist/build/$(LIBFFI_DLL): libffi/build/inst/bin/$(LIBFFI_DLL) cp $< $@ endif +endif #----------------------------------------------------------------------------- # Building one way @@ -177,6 +180,12 @@ endif rts_dist_$1_CC_OPTS += -DRtsWay=\"rts_$1\" +ifneq "$(UseSystemLibFFI)" "YES" +rts_dist_FFI_SO = rts/dist/build/libffi$(soext) +else +rts_dist_FFI_SO = +endif + # Making a shared library for the RTS. ifneq "$$(findstring dyn, $1)" "" ifeq "$$(HostOS_CPP)" "mingw32" @@ -185,10 +194,10 @@ $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend rts/dist/b "$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \ -no-auto-link-packages -Lrts/dist/build -l$(LIBFFI_WINDOWS_LIB) `cat rts/libs.depend` $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) -o $$@ else -$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend rts/dist/build/libffi$$(soext) +$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend $$(rts_dist_FFI_SO) "$$(RM)" $$(RM_OPTS) $$@ "$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \ - -no-auto-link-packages -Lrts/dist/build -lffi `cat rts/libs.depend` $$(rts_$1_OBJS) \ + -no-auto-link-packages $$(LIBFFI_LIBS) `cat rts/libs.depend` $$(rts_$1_OBJS) \ $$(rts_$1_DTRACE_OBJS) -o $$@ endif else @@ -377,10 +386,16 @@ rts/dist/build/AutoApply_HC_OPTS += -fno-PIC -static endif endif +# add CFLAGS for libffi # ffi.h triggers prototype warnings, so disable them here: -rts/Interpreter_CC_OPTS += -Wno-strict-prototypes -rts/Adjustor_CC_OPTS += -Wno-strict-prototypes -rts/sm/Storage_CC_OPTS += -Wno-strict-prototypes +ifeq "$(UseSystemLibFFI)" "YES" +LIBFFI_CFLAGS = $(addprefix -I,$(FFIIncludeDir)) +else +LIBFFI_CFLAGS = +endif +rts/Interpreter_CC_OPTS += -Wno-strict-prototypes $(LIBFFI_CFLAGS) +rts/Adjustor_CC_OPTS += -Wno-strict-prototypes $(LIBFFI_CFLAGS) +rts/sm/Storage_CC_OPTS += -Wno-strict-prototypes $(LIBFFI_CFLAGS) # inlining warnings happen in Compact rts/sm/Compact_CC_OPTS += -Wno-inline @@ -438,6 +453,21 @@ rts_PACKAGE_CPP_OPTS += -DPAPI_LIB_DIR="" endif +#----------------------------------------------------------------------------- +# Use system provided libffi + +ifeq "$(UseSystemLibFFI)" "YES" + +rts_PACKAGE_CPP_OPTS += -DFFI_INCLUDE_DIR=$(FFIIncludeDir) +rts_PACKAGE_CPP_OPTS += -DFFI_LIB_DIR=$(FFILibDir) + +else # UseSystemLibFFI==YES + +rts_PACKAGE_CPP_OPTS += -DFFI_INCLUDE_DIR="" +rts_PACKAGE_CPP_OPTS += -DFFI_LIB_DIR="" + +endif + # ----------------------------------------------------------------------------- # dependencies @@ -515,7 +545,9 @@ RTS_INSTALL_LIBS += $(ALL_RTS_LIBS) RTS_INSTALL_LIBS += $(wildcard rts/dist/build/libffi$(soext)*) RTS_INSTALL_LIBS += $(wildcard rts/dist/build/$(LIBFFI_DLL)) +ifneq "$(UseSystemLibFFI)" "YES" install: install_libffi_headers +endif .PHONY: install_libffi_headers install_libffi_headers : |