I had some trouble with the tool so I wrote this patch, hopefully its ok haha!

- added `sol2%` as an alias to `solaris2%`.
  some shorthands actually already use it and ld et al use it in
  their target names

- improve error message for inputs which provide
  both an OS and/or kernel and a Machine code format.

  unfortunately if just an OS name is provided it can still
  fail silently, treating the OS name as the manufacturer.
  however I couldn't think of a clean way to check for that :/

- add a VERBOSE feature, allowing a user to inspect how a configuration
  name is understood.

  unfortunately the script currently has a very non extendable cli
  parsing system so I had to use an envvar

--
- Lily A. N.

From db4b582fc3e49b5806aa6d9d27bc32a43f59998f Mon Sep 17 00:00:00 2001
From: "Lilith N." <minek...@dimension.sh>
Date: Thu, 20 Mar 2025 19:30:14 +0100
Subject: [PATCH] config.sub: sol2 and UX improvements

- added `sol2%` as an alias to `solaris2%`.
- improve error message for inputs which provide
  both an OS and/or kernel and a Machine code format.
- add a VERBOSE feature, allowing a user to inspect how a configuration
  name is understood.
---
 config.sub                | 20 +++++++++++++++++++-
 testsuite/config-sub.data |  2 ++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/config.sub b/config.sub
index 4aaae46..2e52d75 100755
--- a/config.sub
+++ b/config.sub
@@ -71,6 +71,8 @@ Options:
   -t, --time-stamp   print date of last modification, then exit
   -v, --version      print version number, then exit
 
+Set VERBOSE to see each part labeled
+
 Report bugs and patches to <config-patches@gnu.org>."
 
 version="\
@@ -1554,6 +1556,9 @@ case $os in
 	solaris)
 		os=solaris2
 		;;
+	sol2*)
+		os=`echo "$os" | sed -e 's|sol|solaris|'`
+		;;
 	unixware*)
 		os=sysv4.2uw
 		;;
@@ -2259,10 +2264,15 @@ case $kernel-$os-$obj in
 	--*)
 		# Blank kernel and OS with real machine code file format is always fine.
 		;;
-	*-*-*)
+	*-*-)
 		echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2
 		exit 1
 		;;
+	*-*-*)
+		# Kernel and/or OS but machine code format is specified
+		echo "Invalid configuration '$1': Machine code format cannot be specified if the OS is." 1>&2
+		exit 1
+		;;
 esac
 
 # Here we handle the case where we know the os, and the CPU type, but not the
@@ -2344,6 +2354,14 @@ case $vendor in
 esac
 
 echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}"
+if [ ${VERBOSE+x} ] ; then
+	echo "cpu:   " $cpu    >2
+	echo "vendor:" $vendor >2
+	echo "kernel:" $kernel >2
+	echo "os:    " $os     >2
+	echo "obj:   " $obj    >2
+fi
+
 exit
 
 # Local variables:
diff --git a/testsuite/config-sub.data b/testsuite/config-sub.data
index b528544..3e61afb 100644
--- a/testsuite/config-sub.data
+++ b/testsuite/config-sub.data
@@ -1159,3 +1159,5 @@ ymp						ymp-cray-unicos
 z80						z80-unknown-none
 z80-coff					z80-unknown-coff
 z8k						z8k-unknown-none
+sparc-sol2					sparc-sun-solaris2
+sparcv9-sol2.10					sparcv9-sun-solaris2.10
-- 
2.43.0

Attachment: OpenPGP_0x7958BA4EC2BD0BB6.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to