From 02f4566a61fa5857150f69398e9a0a9af2652e7f Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Wed, 26 Dec 2012 10:23:17 -0800
Subject: [PATCH] Add :alien-callback to *faatures* for platforms that support
 it.

bootfiles/20d/boot-2012-12-1.lisp::
  Add :alien-callback to *features*

bin/build.sh::
  Change bootstrap directory to 20d.

code/lispinit.lisp::
  * Register :alien-callback feature if enabled.
  * Heap overflow checking depends on gencgc, so register that only if
    both are enabled.

tools/comcom.lisp::
  Compile c-callback only if :alien-callback is a feature.

tools/worldcom.lisp:
  Compile alien-callback onlf if :alien-callback is a feature.
---
 bin/build.sh                          | 2 +-
 src/bootfiles/20d/boot-2012-12-1.lisp | 6 ++++++
 src/code/lispinit.lisp                | 6 +++++-
 src/tools/comcom.lisp                 | 3 ++-
 src/tools/worldcom.lisp               | 3 ++-
 5 files changed, 16 insertions(+), 4 deletions(-)
 create mode 100644 src/bootfiles/20d/boot-2012-12-1.lisp

diff --git a/bin/build.sh b/bin/build.sh
index 0ac13c8f0..f451ac110 100755
--- a/bin/build.sh
+++ b/bin/build.sh
@@ -39,7 +39,7 @@ ENABLE2="yes"
 ENABLE3="yes"
 ENABLE4="yes"
 
-version=20c
+version=20d
 SRCDIR=src
 BINDIR=bin
 TOOLDIR=$BINDIR
diff --git a/src/bootfiles/20d/boot-2012-12-1.lisp b/src/bootfiles/20d/boot-2012-12-1.lisp
new file mode 100644
index 000000000..58dc3161b
--- /dev/null
+++ b/src/bootfiles/20d/boot-2012-12-1.lisp
@@ -0,0 +1,6 @@
+;; Add :alien-callback to *features* to build callback support for
+;; platforms that support alien callbacks.
+
+#+(or x86 sparc ppc)
+(pushnew :alien-callback *features*)
+
diff --git a/src/code/lispinit.lisp b/src/code/lispinit.lisp
index f5548b23d..81a6e20a3 100644
--- a/src/code/lispinit.lisp
+++ b/src/code/lispinit.lisp
@@ -39,12 +39,16 @@
 #+stack-checking
 (sys:register-lisp-runtime-feature :stack-checking)
 
-#+heap-overflow-check
+;; Currently, heap-overflow-check depends on gencgc.
+#+(and heap-overflow-check gencgc)
 (sys:register-lisp-runtime-feature :heap-overflow-check)
 
 #+double-double
 (sys:register-lisp-feature :double-double)
 
+#+alien-callback
+(sys:register-lisp-feature :alien-callback)
+
 ;;; Make the error system enable interrupts.
 
 (defconstant most-positive-fixnum #.vm:target-most-positive-fixnum
diff --git a/src/tools/comcom.lisp b/src/tools/comcom.lisp
index 0953dc07d..2205e11f0 100644
--- a/src/tools/comcom.lisp
+++ b/src/tools/comcom.lisp
@@ -197,7 +197,8 @@
 	    (vmdir "target:compiler/sse2-c-call")
 	    (vmdir "target:compiler/x87-c-call"))
 	:byte-compile *byte-compile*))
-(comf (vmdir "target:compiler/c-callback"))
+(when (c:target-featurep :alien-callback)
+  (comf (vmdir "target:compiler/c-callback")))
 (comf (vmdir "target:compiler/cell"))
 (comf (vmdir "target:compiler/values") :byte-compile *byte-compile*)
 (comf (vmdir "target:compiler/alloc"))
diff --git a/src/tools/worldcom.lisp b/src/tools/worldcom.lisp
index 9a74818bd..f8ac65ac0 100644
--- a/src/tools/worldcom.lisp
+++ b/src/tools/worldcom.lisp
@@ -138,7 +138,8 @@
 (setf (fdefinition 'lisp::%deftype) *original-%deftype*)
 
 (comf "target:code/alieneval")
-(comf "target:code/alien-callback")
+(when (c:target-featurep :alien-callback)
+  (comf "target:code/alien-callback"))
 (comf "target:code/c-call")
 (comf "target:code/sap")
 
-- 
GitLab