Monday, June 24, 2024

Re: update infrastructure/db/config.{guess,sub} to latest version

On 2024/06/24 15:31, Claudio Jeker wrote:
> I was surprised that autoconf-2.72 ships with a config.guess file from
> 2012-09-25 and config.sub from 2012-10-10 (which is not really true since
> the timestamp is wrong).
>
> Some long time ago there was this issue with amd64 vs x86_64 which
> resulted in a patched up config.guess. This got backported quickly and
> what we have in tree is actually the version from config.git.
> Since OpenBSD uses arch(1) output to build the tripple, it always works.
> On the other hand other systems requirer updated files to handle for
> example risc-v.
>
> This is an update to the latest HEAD of config.git (2024-01-01).
> tb@ ran this through a bulk build and did not see any fallout.
>
> Since the logic for OpenBSD is still the same as the 2012 version we have
> I do not expect any issues with this.
>
> The only thing I dropped is the last commit that increases the size of the
> mktemp call. IMO it is not worth to change this locally (6 X is the
> minimum but probably enough).

OK.

> --
> :wq Claudio
>
> Index: infrastructure/db/config.guess
> ===================================================================
> RCS file: /cvs/ports/infrastructure/db/config.guess,v
> diff -u -p -r1.14 config.guess
> --- infrastructure/db/config.guess 15 Sep 2013 09:27:27 -0000 1.14
> +++ infrastructure/db/config.guess 20 Jun 2024 13:06:22 -0000
> @@ -1,14 +1,14 @@
> #! /bin/sh
> # Attempt to guess a canonical system name.
> -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
> -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
> -# 2011, 2012 Free Software Foundation, Inc.
> +# Copyright 1992-2024 Free Software Foundation, Inc.
>
> -timestamp='2012-09-25'
> +# shellcheck disable=SC2006,SC2268 # see below for rationale
> +
> +timestamp='2024-01-01'
>
> # 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
> -# the Free Software Foundation; either version 2 of the License, or
> +# the Free Software Foundation, either version 3 of the License, or
> # (at your option) any later version.
> #
> # This program is distributed in the hope that it will be useful, but
> @@ -17,33 +17,39 @@ timestamp='2012-09-25'
> # General Public License for more details.
> #
> # You should have received a copy of the GNU General Public License
> -# along with this program; if not, see <http://www.gnu.org/licenses/>.
> +# along with this program; if not, see <https://www.gnu.org/licenses/>.
> #
> # As a special exception to the GNU General Public License, if you
> # distribute this file as part of a program that contains a
> # configuration script generated by Autoconf, you may include it under
> -# the same distribution terms that you use for the rest of that program.
> -
> -
> -# Originally written by Per Bothner. Please send patches (context
> -# diff format) to <config-patches@gnu.org> and include a ChangeLog
> -# entry.
> +# the same distribution terms that you use for the rest of that
> +# program. This Exception is an additional permission under section 7
> +# of the GNU General Public License, version 3 ("GPLv3").
> #
> -# This script attempts to guess a canonical system name similar to
> -# config.sub. If it succeeds, it prints the system name on stdout, and
> -# exits with 0. Otherwise, it exits with 1.
> +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
> #
> # You can get the latest version of this script from:
> -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
> +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
> +#
> +# Please send patches to <config-patches@gnu.org>.
> +
> +
> +# The "shellcheck disable" line above the timestamp inhibits complaints
> +# about features and limitations of the classic Bourne shell that were
> +# superseded or lifted in POSIX. However, this script identifies a wide
> +# variety of pre-POSIX systems that do not have POSIX shells at all, and
> +# even some reasonably current systems (Solaris 10 as case-in-point) still
> +# have a pre-POSIX /bin/sh.
> +
>
> me=`echo "$0" | sed -e 's,.*/,,'`
>
> usage="\
> Usage: $0 [OPTION]
>
> -Output the configuration name of the system \`$me' is run on.
> +Output the configuration name of the system '$me' is run on.
>
> -Operation modes:
> +Options:
> -h, --help print this help, then exit
> -t, --time-stamp print date of last modification, then exit
> -v, --version print version number, then exit
> @@ -54,15 +60,13 @@ version="\
> GNU config.guess ($timestamp)
>
> Originally written by Per Bothner.
> -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
> -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
> -Free Software Foundation, Inc.
> +Copyright 1992-2024 Free Software Foundation, Inc.
>
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
>
> help="
> -Try \`$me --help' for more information."
> +Try '$me --help' for more information."
>
> # Parse command line
> while test $# -gt 0 ; do
> @@ -90,57 +94,109 @@ if test $# != 0; then
> exit 1
> fi
>
> -trap 'exit 1' 1 2 15
> +# Just in case it came from the environment.
> +GUESS=
>
> # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
> # compiler to aid in system detection is discouraged as it requires
> # temporary files to be created and, as you can see below, it is a
> # headache to deal with in a portable fashion.
>
> -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
> -# use `HOST_CC' if defined, but it is deprecated.
> +# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still
> +# use 'HOST_CC' if defined, but it is deprecated.
>
> # Portable tmp directory creation inspired by the Autoconf team.
>
> -set_cc_for_build='
> -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
> -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
> -: ${TMPDIR=/tmp} ;
> - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
> - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
> - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
> - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
> -dummy=$tmp/dummy ;
> -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
> -case $CC_FOR_BUILD,$HOST_CC,$CC in
> - ,,) echo "int x;" > $dummy.c ;
> - for c in cc gcc c89 c99 ; do
> - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
> - CC_FOR_BUILD="$c"; break ;
> - fi ;
> - done ;
> - if test x"$CC_FOR_BUILD" = x ; then
> - CC_FOR_BUILD=no_compiler_found ;
> - fi
> - ;;
> - ,,*) CC_FOR_BUILD=$CC ;;
> - ,*,*) CC_FOR_BUILD=$HOST_CC ;;
> -esac ; set_cc_for_build= ;'
> +tmp=
> +# shellcheck disable=SC2172
> +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
> +
> +set_cc_for_build() {
> + # prevent multiple calls if $tmp is already set
> + test "$tmp" && return 0
> + : "${TMPDIR=/tmp}"
> + # shellcheck disable=SC2039,SC3028
> + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
> + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
> + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
> + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
> + dummy=$tmp/dummy
> + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
> + ,,) echo "int x;" > "$dummy.c"
> + for driver in cc gcc c89 c99 ; do
> + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
> + CC_FOR_BUILD=$driver
> + break
> + fi
> + done
> + if test x"$CC_FOR_BUILD" = x ; then
> + CC_FOR_BUILD=no_compiler_found
> + fi
> + ;;
> + ,,*) CC_FOR_BUILD=$CC ;;
> + ,*,*) CC_FOR_BUILD=$HOST_CC ;;
> + esac
> +}
>
> # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
> # (ghazi@noc.rutgers.edu 1994-08-24)
> -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
> +if test -f /.attbin/uname ; then
> PATH=$PATH:/.attbin ; export PATH
> fi
>
> UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
> UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
> -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
> +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
> UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
>
> +case $UNAME_SYSTEM in
> +Linux|GNU|GNU/*)
> + LIBC=unknown
> +
> + set_cc_for_build
> + cat <<-EOF > "$dummy.c"
> + #if defined(__ANDROID__)
> + LIBC=android
> + #else
> + #include <features.h>
> + #if defined(__UCLIBC__)
> + LIBC=uclibc
> + #elif defined(__dietlibc__)
> + LIBC=dietlibc
> + #elif defined(__GLIBC__)
> + LIBC=gnu
> + #elif defined(__LLVM_LIBC__)
> + LIBC=llvm
> + #else
> + #include <stdarg.h>
> + /* First heuristic to detect musl libc. */
> + #ifdef __DEFINED_va_list
> + LIBC=musl
> +

No comments:

Post a Comment