config-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 3/4] config.guess: Revise diagnostic output produced on failur


From: Zack Weinberg
Subject: [PATCH v2 3/4] config.guess: Revise diagnostic output produced on failure.
Date: Mon, 13 May 2024 16:55:30 -0400

The output now varies based on which of three different situations is
detected:

1. If config.guess’s embedded timestamp is more than three years old,
   we instruct the user to update it from Savannah, and we don’t say
   anything else.

2. If we tried to use a C compiler but none was found (not just in
   the mips:linux case), we tell the user to try installing a C
   compiler, and we don’t say anything else.

3. Only if neither of those is true will we print detailed diagnostics
   and suggest contacting config-patches@gnu.org for assistance.
   We still recommend checking for a newer config.guess first.

   The diagnostic dump for this case is slightly revised: it includes
   the current date as well as the config.guess timestamp, and I added
   a report on whether ‘uname’ and four different common names for a
   C compiler were available from $PATH.  It should also hopefully be
   clearer why uname -m/-r/-s/-v is being printed twice.

This won’t help the people who try to build tarballs from 2000 on a
CPU architecture that didn’t exist in 2000, but I hope it will help
the people twenty years from now who try to build tarballs from 2025
on a CPU architecture that didn’t exist in 2025.
---
 config.guess | 112 ++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 76 insertions(+), 36 deletions(-)

diff --git a/config.guess b/config.guess
index 0ec3a83..d28bbe4 100755
--- a/config.guess
+++ b/config.guess
@@ -4,7 +4,7 @@
 
 # shellcheck disable=SC2006,SC2268 # see below for rationale
 
-timestamp='2024-04-04'
+timestamp='2024-05-12'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -1738,47 +1738,73 @@ $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && 
SYSTEM_NAME=`"$dummy"` &&
 # Apollos put the system type in the environment.
 test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
 
-echo "$0: unable to guess system type" >&2
+echo >&2 "$0: unable to guess system type
 
-case $UNAME_MACHINE:$UNAME_SYSTEM in
-    mips:Linux | mips64:Linux)
-       # If we got here on MIPS GNU/Linux, output extra information.
-       cat >&2 <<EOF
-
-NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
-the system type. Please install a C compiler and try again.
-EOF
-       ;;
-esac
-
-cat >&2 <<EOF
-
-This script (version $timestamp), has failed to recognize the
-operating system you are using. If your script is old, overwrite *all*
-copies of config.guess and config.sub with the latest versions from:
+config.guess has failed to recognize the operating system you are using."
 
+where_to_get_new_scripts="
   https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
-and
   https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
-EOF
+"
 
+# Is this script more than a few years old?
+today=`date +%Y-%m-%d`
 our_year=`echo $timestamp | sed 's,-.*,,'`
-thisyear=`date +%Y`
-# shellcheck disable=SC2003
-script_age=`expr "$thisyear" - "$our_year"`
-if test "$script_age" -lt 3 ; then
-   cat >&2 <<EOF
+thisyear=`echo $today | sed 's,-.*,,'`
 
-If $0 has already been updated, send the following data and any
-information you think might be pertinent to config-patches@gnu.org to
-provide the necessary information to handle your system.
+script_age=`expr "$thisyear" - "$our_year"`
+if test "$script_age" -gt 3 ; then
+    cat >&2 <<EOF
+This was probably because it has not been updated since $timestamp.
+(Today is $today, $script_age years later.)
+
+Please find *all* copies of config.guess and config.sub within
+the source tree of the program you were trying to build, and replace
+them with the latest versions, found at these URLs:
+$where_to_get_new_scripts
+Then try to build your program again.
+
+EOF
+    exit 1
+fi
+
+# Did we try to run a C compiler and fail?
+if [ -n "$tmp" ] && [ "$CC_FOR_BUILD" = no_compiler_found ]; then
+    cat >&2 <<\EOF
+This may have been because it could not find a C compiler.
+Please install a C compiler, ensure it is accessible via $PATH, and try again.
+
+If you got this message while trying to build a C compiler, you might
+not have realized that most C compilers are written in compiled
+languages, therefore you must already have a compiler for the
+appropriate language to build them!  You should be able to get a
+pre-built compiler for *some* language from the same place you got the
+operating system.
+
+EOF
+    exit 1
+fi
+
+# Might be a genuinely unrecognized system.
+cat >&2 <<EOF
+Before you do anything else, find *all* copies of config.guess and
+config.sub within the source tree of the program you were trying to
+build, and replace them with the latest versions, found at these URLs:
+$where_to_get_new_scripts
+Then try to build your program again.
+
+If you already did that and it didn't help, please contact
+<config-patches@gnu.org> for assistance.  Please include all of
+the following diagnostic information, plus anything else you think
+might be relevant.
 
 config.guess timestamp = $timestamp
+attempted build date   = $today
 
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
+UNAME_MACHINE = $UNAME_MACHINE
+UNAME_RELEASE = $UNAME_RELEASE
+UNAME_SYSTEM  = $UNAME_SYSTEM
+UNAME_VERSION = $UNAME_VERSION
 
 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
 /bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
@@ -1790,13 +1816,27 @@ hostinfo               = `(hostinfo) 2>/dev/null`
 /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
 
-UNAME_MACHINE = "$UNAME_MACHINE"
-UNAME_RELEASE = "$UNAME_RELEASE"
-UNAME_SYSTEM  = "$UNAME_SYSTEM"
-UNAME_VERSION = "$UNAME_VERSION"
+command -v cc     = `(command -v cc) 2>/dev/null    || echo not found`
+command -v gcc    = `(command -v gcc) 2>/dev/null   || echo not found`
+command -v c89    = `(command -v c89) 2>/dev/null   || echo not found`
+command -v c99    = `(command -v c99) 2>/dev/null   || echo not found`
+EOF
+
+command_uname=`(command -v uname) 2>/dev/null || echo not found`
+if [ x"$command_uname" = "xnot found" ]; then
+    echo "command -v uname  = not found"
+else
+    echo "command -v uname  = $command_uname"
+    cat <<EOF
+
+uname -m = `"$command_uname" -m`
+uname -r = `"$command_uname" -r`
+uname -s = `"$command_uname" -s`
+uname -v = `"$command_uname" -v`
 EOF
 fi
 
+
 exit 1
 
 # Local variables:
-- 
2.43.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]