Split handling of compiler target from host architecture.
authorChris Hanson <org/chris-hanson/cph>
Wed, 17 Oct 2018 02:28:14 +0000 (19:28 -0700)
committerChris Hanson <org/chris-hanson/cph>
Wed, 17 Oct 2018 02:28:14 +0000 (19:28 -0700)
src/configure.ac
src/microcode/aclocal.m4

index c7169c95116486a85c2f5c7705fcd63255004f72..8479772049297cd8b0ee8b3ee3ede189a6ea307b 100644 (file)
@@ -45,6 +45,11 @@ AC_ARG_ENABLE([native-code],
        [Support native compiled code if available [[yes]]]))
 : ${enable_native_code=yes}
 
+AC_ARG_WITH([compiler-target],
+    AS_HELP_STRING([--with-compiler-target],
+       [Compiler target architecture [[same as native code]]]))
+: ${with_compiler_target=yes}
+
 AC_ARG_ENABLE([host-scheme-test],
     AS_HELP_STRING([--enable-host-scheme-test],
        [Test for working scheme on build host [[if necessary]]]))
@@ -58,7 +63,7 @@ AC_ARG_ENABLE([cross-compiling],
     AS_HELP_STRING([--enable-cross-compiling],
        [Cross-compile scheme, even if to the same target]))
 : ${enable_cross_compiling=no}
-if test "x$enable_cross_compiling" = xyes; then
+if test "x${enable_cross_compiling}" = xyes; then
     IF_CROSS=
 else
     IF_CROSS=\#
@@ -98,6 +103,33 @@ svm1)
     INSTALL_LIARC_BUNDLES=
     ;;
 esac
+
+AC_MSG_CHECKING([for compiler target])
+MIT_SCHEME_ARCHITECTURE([${with_compiler_target}])
+case ${mit_scheme_architecture} in
+yes)
+    mit_scheme_compiler_target=${mit_scheme_native_code}
+    ;;
+*)
+    mit_scheme_compiler_target=${mit_scheme_architecture}
+    ;;
+esac
+
+case ${mit_scheme_compiler_target} in
+none)
+    AC_MSG_RESULT([none])
+    ;;
+c)
+    AC_MSG_RESULT([yes, using portable C code])
+    ;;
+svm1)
+    AC_MSG_RESULT([yes, using portable SVM code])
+    ;;
+*)
+    AC_MSG_RESULT([yes, for ${mit_scheme_compiler_target}])
+    ;;
+esac
+
 AUXDIR_NAME=mit-scheme-${mit_scheme_native_code}
 AUXDIR='$(libdir)'/${AUXDIR_NAME}
 
@@ -168,7 +200,7 @@ fi
 # A 32bit host running LIAR/svm needs a large heap.
 small_words='(= 4 (vector-ref (gc-space-status) 0))'
 if test x"${mit_scheme_native_code}" = xsvm1 \
-   && ${MIT_SCHEME_EXE} --eval "(%exit (if ${small_words} 0 1))"; then \
+   && ${MIT_SCHEME_EXE} --eval "(%exit (if ${small_words} 0 1))" >/dev/null; then \
     HOST_COMPILER_HEAP="--heap 10000"
 fi
 
@@ -187,10 +219,10 @@ AC_SUBST([HOST_COMPILER_HEAP])
 AC_PROG_INSTALL
 AC_PROG_LN_S
 
-echo etc/create-makefiles.sh "${MIT_SCHEME_EXE}" "${mit_scheme_native_code}"
-etc/create-makefiles.sh "${MIT_SCHEME_EXE}" "${mit_scheme_native_code}" \
+echo etc/create-makefiles.sh "${MIT_SCHEME_EXE}" "${mit_scheme_compiler_target}"
+etc/create-makefiles.sh "${MIT_SCHEME_EXE}" "${mit_scheme_compiler_target}" \
   || exit $?
-compiler/configure "${mit_scheme_native_code}" || exit $?
+compiler/configure "${mit_scheme_compiler_target}" || exit $?
 
 AC_CONFIG_SUBDIRS([microcode])
 
index 0d43d87f84bfe06c97e771fc442fd0766f740cb0..4113994d83db29912e72734c4f65750ec0595040 100644 (file)
@@ -1,11 +1,14 @@
 # MIT_SCHEME_NATIVE_CODE(SPEC, HOST_CPU)
-# ----------------------
+# --------------------------------------
 AC_DEFUN([MIT_SCHEME_NATIVE_CODE],[
 _mit_scheme_native_code_spec=$1
 _mit_scheme_native_code_host_cpu=$2
 
-case ${_mit_scheme_native_code_spec} in
-yes|YES|y|Y)
+AC_MSG_CHECKING([for native-code support])
+MIT_SCHEME_ARCHITECTURE([${_mit_scheme_native_code_spec}])
+
+case ${mit_scheme_architecture} in
+yes)
     case ${_mit_scheme_native_code_host_cpu} in
     i?86)
        AC_CHECK_DECL([__x86_64__],
@@ -16,9 +19,8 @@ yes|YES|y|Y)
     ;;
 esac
 
-AC_MSG_CHECKING([for native-code support])
-case ${_mit_scheme_native_code_spec} in
-yes|YES|y|Y)
+case ${mit_scheme_architecture} in
+yes)
     case ${_mit_scheme_native_code_host_cpu} in
     i386)
        mit_scheme_native_code=i386
@@ -27,27 +29,12 @@ yes|YES|y|Y)
        mit_scheme_native_code=x86-64
        ;;
     *)
-       AC_MSG_ERROR([unable to determine native-code type])
+       AC_MSG_ERROR([unable to determine host architecture])
        ;;
     esac
     ;;
-c|C)
-    mit_scheme_native_code=c
-    ;;
-svm|svm1)
-    mit_scheme_native_code=svm1
-    ;;
-no|NO|none|NONE|n|N)
-    mit_scheme_native_code=none
-    ;;
-i?86|x86)
-    mit_scheme_native_code=i386
-    ;;
-x86-64|x86_64|amd64)
-    mit_scheme_native_code=x86-64
-    ;;
 *)
-    AC_MSG_ERROR([unknown native-code type: ${_mit_scheme_native_code_spec}])
+    mit_scheme_native_code=${mit_scheme_architecture}
     ;;
 esac
 
@@ -66,3 +53,34 @@ svm1)
     ;;
 esac
 ])
+
+
+# MIT_SCHEME_ARCHITECTURE(SPEC)
+# -----------------------------
+AC_DEFUN([MIT_SCHEME_ARCHITECTURE],[
+_mit_scheme_architecture_spec=$1
+
+case ${_mit_scheme_architecture_spec} in
+yes|YES|y|Y)
+    mit_scheme_architecture=yes
+    ;;
+c|C)
+    mit_scheme_architecture=c
+    ;;
+svm|svm1)
+    mit_scheme_architecture=svm1
+    ;;
+no|NO|none|NONE|n|N)
+    mit_scheme_architecture=none
+    ;;
+i?86|x86)
+    mit_scheme_architecture=i386
+    ;;
+x86-64|x86_64|amd64)
+    mit_scheme_architecture=x86-64
+    ;;
+*)
+    AC_MSG_ERROR([unknown compiler architecture: ${_mit_scheme_architecture_spec}])
+    ;;
+esac
+])