(cc-ing automake mailing list) Hi all, do you think that there would be possible to cover upstream creation of system wide config.{sub,guess} scripts? Possible patch is at the bottom of this mail.
Nothing would change from the target-project point of view - just that if the user's distribution distributes these sys-wide scripts, they are going to be called instead of the ones distributed by `make dist`-created tarball (in a case the --time-stamp output of sys-wide script is newer). Even the direct download of config.guess/config.sub files stays unchanged (for automake and other project purposes). The problem this patch solves is that there is a lot of packages containing non-up2date config.{guess,sub} scripts copied during autoconf phase from automake distribution. Thus, when distribution decides to e.g. support new architecture which is already covered by config.guess/sub upstream, it must patch whole bunch of packages replacing those scripts. Distros are able to deal with this problem on the packaging system site - but every distro then must improve their packaging system to automatically replace those scripts... and such upstream-like solution would help to all distributions globally. If you agree with these changes (and no obvious consequences are seen), I'll be able to clean/improve things in proposed patch - and write some README file suggesting how to package gnuconfig (the sys.config.{sub,guess} scripts are intended to reside in users $PATH). Thanks for discussion, Pavel diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..44c744e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +sys.config.guess +sys.config.sub diff --git a/ChangeLog b/ChangeLog index 0e49c17..9685e2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2013-04-05 Pavel Raiskup <prais...@redhat.com> + + * config.guess: Allow running the system-wide version of this + script when existent. + * config.sub: Likewise. + * Makefile: Generate new sys.config.guess and sys.config.sub + scripts. + * .gitignore: New file. + 2013-02-12 Christian Svensson <b...@cmd.nu> * config.guess (or1k:Linux:*:*): New. diff --git a/Makefile b/Makefile index 5d8a2bb..98df7c7 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all: +all: sys-scripts check: check-guess check-sub @@ -7,3 +7,20 @@ check-guess: check-sub: cd testsuite && sh config-sub.sh + +sys-scripts: sys.config.guess sys.config.sub + +SYS_CONF_SUB=sys.config.sub +SYS_CONF_GUESS=sys.config.guess +CLEANER=sed "/\# == try to run system-wide script ==/,/try_run_sys='yes'/{d}" + +$(SYS_CONF_GUESS): config.guess + $(CLEANER) config.guess > $(SYS_CONF_GUESS) + chmod +x $(SYS_CONF_GUESS) + +$(SYS_CONF_SUB): config.sub + $(CLEANER) config.sub > $(SYS_CONF_SUB) + chmod +x $(SYS_CONF_SUB) + +clean: + rm -rf $(SYS_CONF_GUESS) $(SYS_CONF_SUB) diff --git a/config.guess b/config.guess index f475ceb..e5ea362 100755 --- a/config.guess +++ b/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2013-02-12' +timestamp='2013-04-05' # 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 @@ -31,6 +31,15 @@ timestamp='2013-02-12' # # Please send patches with a ChangeLog entry to config-patc...@gnu.org. +# == try to run system-wide script == +# +# This script is trying to search for a system-wide version of itself and +# run it instead. The system-wide script is run only if its timestamp is +# newer then the one specified at top of this script. This behaviour is +# possible to suppress by setting the following variable to 'no'. +try_run_sys='yes' + +sys_script_name='sys.config.guess' me=`echo "$0" | sed -e 's,.*/,,'` @@ -84,6 +93,17 @@ if test $# != 0; then exit 1 fi +# try to run system-wide script +if test "x$try_run_sys" = "xyes"; then + if command -v $sys_script_name >/dev/null; then + sys_timestamp=`$sys_script_name --time-stamp` + if test $timestamp '<' $sys_timestamp; then + $sys_script_name + exit $? + fi + fi +fi + trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a diff --git a/config.sub b/config.sub index 872199a..b58f7ba 100755 --- a/config.sub +++ b/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2013-02-12' +timestamp='2013-04-05' # 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 @@ -50,6 +50,16 @@ timestamp='2013-02-12' # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. +# == try to run system-wide script == +# +# This script is trying to search for a system-wide version of itself and +# run it instead. The system-wide script is run only if its timestamp is +# newer then the one specified at top of this script. This behaviour is +# possible to suppress by setting the following variable to 'no'. +try_run_sys='yes' + +sys_script_name='sys.config.sub' + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ @@ -111,6 +121,17 @@ case $# in exit 1;; esac +# try to run system-wide script +if test "x$try_run_sys" = "xyes"; then + if command -v $sys_script_name >/dev/null; then + sys_timestamp=`$sys_script_name --time-stamp` + if test $timestamp '<' $sys_timestamp; then + $sys_script_name $1 + exit $? + fi + fi +fi + # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`