From: Zack Weinberg <z...@owlfolio.org> 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 duplicate uname -m/-r/-s/-v output is replaced with diagnostics of the availability of uname and a C compiler. 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. (N.B. The Savannah URLs look a little too cgit-specific to trust that they will still be good twenty years from now. Can we maybe get the www.gnu.org admins to make /software/???/config.{guess,sub} redirect to these URLs, just for a little extra future-proofing?) --- config.guess | 99 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 36 deletions(-) diff --git a/config.guess b/config.guess index 1059f76..7de528e 100755 --- a/config.guess +++ b/config.guess @@ -1739,47 +1739,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 is 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 be 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 -m = $UNAME_MACHINE +uname -r = $UNAME_RELEASE +uname -s = $UNAME_SYSTEM +uname -v = $UNAME_VERSION /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` @@ -1791,12 +1817,13 @@ 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 uname = `(command -v uname) 2>/dev/null || echo not found` +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 -fi exit 1 -- 2.43.2