From: Matt Birkholz <matt@birkholz.chandler.az.us>
Date: Wed, 18 May 2011 01:51:12 +0000 (-0700)
Subject: Trying to get FFI test shim to link on Mac OS X.
X-Git-Tag: 20110609-Gtk~5^2~3
X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=62f656bfa73d75375ee6b9c1d87d527652948f7f;p=mit-scheme.git

Trying to get FFI test shim to link on Mac OS X.

Following the linking of microcode modules more closely, including
SHIM_LOADER in the prerequisites for the -shim.so, and the curiously
brief SHIM_LIBS for the LINK_SHIM commandline.  Both are from
microcode/makegen/Makefile.in.in analogs, like MODULE_LIBS.

I'm not sure that this helps the Mac OS X build at all... so I'm
leaving build-ffis (and its test) disabled.
---

diff --git a/src/configure.ac b/src/configure.ac
index 9856d4c68..004413ab2 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -160,6 +160,7 @@ AC_SUBST([CPPFLAGS])
 AC_SUBST([LDFLAGS])
 AC_SUBST([MODULE_CFLAGS])
 AC_SUBST([MODULE_LDFLAGS])
+AC_SUBST([MODULE_LOADER])
 
 AC_CONFIG_FILES([
 Makefile
diff --git a/src/etc/std-makefile-prefix b/src/etc/std-makefile-prefix
index 0c64b6248..448525c90 100644
--- a/src/etc/std-makefile-prefix
+++ b/src/etc/std-makefile-prefix
@@ -77,10 +77,12 @@ LDFLAGS = @LDFLAGS@
 COMPILE = $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS)
 LINK = $(CCLD) $(LDFLAGS) -o $@
 
-MODULE_CFLAGS = @MODULE_CFLAGS@
-MODULE_LDFLAGS = @MODULE_LDFLAGS@
-COMPILE_SHIM = $(COMPILE) $(MODULE_CFLAGS)
-LINK_SHIM = $(LINK) $(MODULE_LDFLAGS)
+SHIM_CFLAGS = @MODULE_CFLAGS@
+SHIM_LDFLAGS = @MODULE_LDFLAGS@
+COMPILE_SHIM = $(COMPILE) $(SHIM_CFLAGS)
+LINK_SHIM = $(LINK) $(SHIM_LDFLAGS)
+SHIM_LOADER = @MODULE_LOADER@
+SHIM_LIBS = -lc
 
 AUXDIR = @AUXDIR@
 
diff --git a/src/ffi/Makefile-fragment b/src/ffi/Makefile-fragment
index 63192ccca..ca7134a74 100644
--- a/src/ffi/Makefile-fragment
+++ b/src/ffi/Makefile-fragment
@@ -21,11 +21,11 @@ install:
 # wrapper, so there is no need for the compile-ffi procedure (hint).
 build: ffi-test-shim.so ffi-test-types.bin ffi-test-const.bin
 
-ffi-test-shim.so: ffi-test-shim.o ffi-test.o
-	$(LINK_SHIM) ffi-test-shim.o ffi-test.o -o $@
+ffi-test-shim.so: ffi-test-shim.o ffi-test.o $(SHIM_LOADER)
+	$(LINK_SHIM) ffi-test-shim.o ffi-test.o $(SHIM_LIBS)
 
 ffi-test-shim.o: ffi-test-shim.c ffi-test.h
-	$(COMPILE_SHIM) -o $@ -c $<
+	$(COMPILE_SHIM) -c $*.c
 
 ffi-test-shim.c ffi-test-const.c ffi-test-types.bin: ffi-test.cdecl
 	(echo "(load-option 'FFI)"; \
diff --git a/tests/check.scm b/tests/check.scm
index 9d04953fb..990d633d9 100644
--- a/tests/check.scm
+++ b/tests/check.scm
@@ -50,7 +50,7 @@ USA.
     "runtime/test-process"
     "runtime/test-regsexp"
     ("runtime/test-wttree" (runtime wt-tree))
-    "ffi/test-ffi"
+    ;;"ffi/test-ffi"
     ))
 
 (with-working-directory-pathname