From a8e1e438d4e529ba0a9d1f28b73eacb2d881071d Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Mon, 8 Oct 2012 19:34:50 +0800 Subject: [PATCH] Check a number of paths for newer config.guess/config.sub and run the latest. This helps people who are bootstrapping new systems from existing software that uses GNU autotools, config.guess and config.sub. This is very useful for distributions like Debian that add new architectures and then have to update config.sub and config.guess in every single package that uses automake or have to workaround the problem by adding code to each package to copy in the latest versions of these scripts from another package containing the latest version of the scripts (autotools-dev in Debian). --- lib/autoconf/general.m4 | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 51cee30..d6366c9 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1719,6 +1719,35 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl ])# AC_CONFIG_AUX_DIRS +# Search for the newest config.sub/config.guess +AC_DEFUN([AC_CONFIG_AUX_EXT_DIRS], +[ +cur_v=`$SHELL "$ac_aux_dir/$1" --time-stamp | sed s/-//g` +for path in \ + "$HOME/.config/autotools" \ + /usr/local/share/automake-* \ + /usr/local/share/automake \ + /usr/share/misc \ + /usr/share/gnuconfig \ + /usr/share/automake-* \ + /usr/share/automake \ + ; do + if test -x "$path/$1" ; then + v=`$SHELL "$path/$1" --time-stamp | sed s/-//g` + if test "$v" -gt "$cur_v" ; then + cur_v="$v" + latest="$path" + fi + fi +done +if test "x$latest" != x ; then + if test "x$2" != x ; then + $SHELL "$latest/$1" "$2" + else + $SHELL "$latest/$1" + if +fi +]) @@ -1804,8 +1833,11 @@ AC_CACHE_CHECK([build system type], [ac_cv_build], test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && + ac_build_alias=`AC_CONFIG_AUX_EXT_DIRS([config.guess])"` +test "x$ac_build_alias" = x && AC_MSG_ERROR([cannot guess build type; you must specify one]) ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + ac_cv_build=`AC_CONFIG_AUX_EXT_DIRS([config.sub],[$ac_build_alias])` || AC_MSG_ERROR([$SHELL $ac_aux_dir/config.sub $ac_build_alias failed]) ]) _AC_CANONICAL_SPLIT(build) @@ -1823,6 +1855,7 @@ AC_CACHE_CHECK([host system type], [ac_cv_host], ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + ac_cv_host=`AC_CONFIG_AUX_EXT_DIRS([config.sub],[$ac_host_alias])` || AC_MSG_ERROR([$SHELL $ac_aux_dir/config.sub $host_alias failed]) fi ]) @@ -1842,6 +1875,7 @@ AC_CACHE_CHECK([target system type], [ac_cv_target], ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + ac_cv_target=`AC_CONFIG_AUX_EXT_DIRS([config.sub],[$ac_target_alias])` || AC_MSG_ERROR([$SHELL $ac_aux_dir/config.sub $target_alias failed]) fi ]) -- 1.7.10.4