From 7179df600980ea2f318dc2610562703842e50534 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 2 May 2021 13:31:55 -0600 Subject: [PATCH] configure: improve platform detection and reporting --- racket/src/ChezScheme/configure | 21 ++++++++++++++++++--- racket/src/ChezScheme/workarea | 2 +- racket/src/cs/c/configure | 17 +++++++++++++++++ racket/src/cs/c/configure.ac | 17 +++++++++++++++++ 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure index 55207895fe..c56f33973b 100755 --- a/racket/src/ChezScheme/configure +++ b/racket/src/ChezScheme/configure @@ -168,7 +168,7 @@ if [ "$unixsuffix" != "" ] ; then m64=a6${unixsuffix} tm32=ti3${unixsuffix} tm64=ta6${unixsuffix} - elif uname -a | egrep 'power|macppc' > /dev/null 2>&1 ; then + elif uname -a | egrep 'power|ppc' > /dev/null 2>&1 ; then m32=ppc32${unixsuffix} tm32=tppc32${unixsuffix} elif uname -a | egrep 'armv|aarch64' > /dev/null 2>&1 ; then @@ -347,7 +347,7 @@ if [ "$m" = "pb" ] ; then fi if [ "$bits" = "" ] ; then - if uname -a | egrep 'amd64|x86_64|aarch64|arm64' > /dev/null 2>&1 ; then + if uname -a | egrep 'amd64|x86_64|aarch64|arm64|ppc64|powerpc64' > /dev/null 2>&1 ; then bits=64 else bits=32 @@ -370,6 +370,16 @@ if [ "$m" = "" ] ; then m=pb if [ $bits = 64 ] ; then mpbhost=$m64 ; else mpbhost=$m32 ; fi flagsm=$mpbhost + if [ "$mpbhost" = "" ] ; then + echo "Could not infer current machine type." + echo "" + echo "Event for a pb build, a machine type is needed to select C compiler" + echo "and linker flags. You can use" + echo " $0 --pb -m=" + echo "to specify the available machine type, but since it wasn't inferred," + echo "probably your OS and architecture combination is not supported." + exit 1 + fi else m=$defaultm flagsm=$m @@ -765,7 +775,12 @@ case "$srcdir" in ;; esac -"$srcdir"/workarea $m $w $mpbhost +if "$srcdir"/workarea $m $w $mpbhost ; then + : +else + # not a recognized host, or other error + exit 1 +fi sed -e 's/$(m)/'$m'/g'\ -e 's/$(defaultm)/'$defaultm'/g'\ diff --git a/racket/src/ChezScheme/workarea b/racket/src/ChezScheme/workarea index 13e21e1db7..b650869be4 100755 --- a/racket/src/ChezScheme/workarea +++ b/racket/src/ChezScheme/workarea @@ -105,7 +105,7 @@ case "$Mhost" in tppc32nb) ;; tppc32osx) ;; tarm64osx) ;; - *) echo "Unrecognized machine name $Mhost"; exit 1 ;; + *) echo "unrecognized machine name: $Mhost"; exit 1 ;; esac Muni=`echo $M | sed -e 's/^t//'` diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure index 5aeb6f849f..f7e8e30c3e 100755 --- a/racket/src/cs/c/configure +++ b/racket/src/cs/c/configure @@ -4569,11 +4569,21 @@ case "$MACH_HOST_CPU" in arm*) MACH="${thread_prefix}arm32${MACH_OS}" ;; + powerpc64*) + MACH="" + # MACH="${thread_prefix}ppc64${MACH_OS}" + ;; power*) MACH="${thread_prefix}ppc32${MACH_OS}" ;; esac +if test "$MACH" = "" -o "$MACH_OS" = "" ; then + echo "Platform is not supported by Racket CS." + echo 'Try `--enable-bcdefault`, instead.' + exit 1 +fi + if test "${enable_mach}" != "" ; then MACH="${enable_mach}" fi @@ -4626,9 +4636,16 @@ elif test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then arm*) BUILD_MACH="${BUILD_THREAD_PREFIX}arm32${BUILD_OS}" ;; + powerpc64*) + BUILD_MACH="${BUILD_THREAD_PREFIX}ppc64${BUILD_OS}" + ;; power*) BUILD_MACH="${BUILD_THREAD_PREFIX}ppc32${BUILD_OS}" ;; + *) + echo "unknown build CPU" + exit 1 + ;; esac TARGET_MACH=${MACH} MACH=${BUILD_MACH} diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac index e8e67fc8c2..b40fb2d717 100644 --- a/racket/src/cs/c/configure.ac +++ b/racket/src/cs/c/configure.ac @@ -375,11 +375,21 @@ case "$MACH_HOST_CPU" in arm*) MACH="${thread_prefix}arm32${MACH_OS}" ;; + powerpc64*) + MACH="" + # MACH="${thread_prefix}ppc64${MACH_OS}" + ;; power*) MACH="${thread_prefix}ppc32${MACH_OS}" ;; esac +if test "$MACH" = "" -o "$MACH_OS" = "" ; then + echo "Platform is not supported by Racket CS." + echo 'Try `--enable-bcdefault`, instead.' + exit 1 +fi + if test "${enable_mach}" != "" ; then MACH="${enable_mach}" fi @@ -432,9 +442,16 @@ elif test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then arm*) BUILD_MACH="${BUILD_THREAD_PREFIX}arm32${BUILD_OS}" ;; + powerpc64*) + BUILD_MACH="${BUILD_THREAD_PREFIX}ppc64${BUILD_OS}" + ;; power*) BUILD_MACH="${BUILD_THREAD_PREFIX}ppc32${BUILD_OS}" ;; + *) + echo "unknown build CPU" + exit 1 + ;; esac TARGET_MACH=${MACH} MACH=${BUILD_MACH}