Re: [RFC] pass #2 at getting rid of the config.guess/sub problem when bootstrapping new ports/systems

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

 



On Mon, 2012-10-08 at 22:03 -0600, Eric Blake wrote:

> I still prefer the idea of being able to set an environment variable,
> $CONFIG_GUESS, rather than going hunting ourselves.  Then, porting to a
> new config.guess script is a matter of calling:
> 
> ./configure CONFIG_GUESS=/path/to/new/version
> 
> rather than hoping that a hard-coded hunt will find the new config.guess
> appropriate for the system wanting the upgrade path.

Changing the command-line to ./configure doesn't scale. Exporting an
environment variable possibly sounds like an approach some folks would
need, so I have added it in the attached patch. For Debian it would be
easiest to just install the autotools-dev package in build chroots
(config.guess and config.sub are placed in /usr/share/misc) since it
doesn't require fiddling about with configuration files for build daemon
software, which usually doesn't leak random environment variables into
the build process.

-- 
bye,
pabs

http://bonedaddy.net/pabs3/
From 97029cdf7c526212ee4a470bbc47075aaefc6c4e Mon Sep 17 00:00:00 2001
From: Paul Wise <pabs3@xxxxxxxxxxxxx>
Date: Tue, 9 Oct 2012 11:06:37 +0800
Subject: [PATCH] Check a number of paths for newer config.guess/config.sub,
 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 |   59 ++++++++++++++++++++++++++++++++++-------------
 1 file changed, 43 insertions(+), 16 deletions(-)

diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 51cee30..6f26116 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -1680,6 +1680,38 @@ AC_DEFUN([AC_CONFIG_AUX_DIR],
 AC_DEFUN([AC_CONFIG_AUX_DIR_DEFAULT],
 [AC_CONFIG_AUX_DIRS("$srcdir" "$srcdir/.." "$srcdir/../..")])
 
+# AC_CONFIG_AUX_DIR_LATEST
+# -------------------------
+# Internal subroutine.
+# Find the latest version of config.guess and config.sub that is
+# available on the system to prevent issues with bootstrapping.
+AC_DEFUN([AC_CONFIG_AUX_DIR_LATEST],
+[
+cur_v=0
+for path in \
+  $2 \
+  "$HOME/.config/autotools" \
+  /usr/local/share/automake-* \
+  /usr/local/share/automake \
+  /usr/local/share/libtool/config \
+  /usr/share/misc \
+  /usr/share/gnuconfig \
+  /usr/share/automake-* \
+  /usr/share/automake \
+  /usr/share/libtool/config \
+  "$[CONFIG_]m4_toupper([$1])" \
+  ; do
+    if test -x "$path/config.$1" ; then
+      v=`$SHELL "$path/config.$1" --time-stamp | sed s/-//g`
+      if test "$v" -gt "$cur_v" ; then
+        cur_v="$v"
+        latest="$path"
+      fi
+    fi
+done
+ac_config_$1="$latest/config.$1"
+])# AC_CONFIG_AUX_DIR_LATEST
+
 
 # AC_CONFIG_AUX_DIRS(DIR ...)
 # ---------------------------
@@ -1708,13 +1740,8 @@ if test -z "$ac_aux_dir"; then
   AC_MSG_ERROR([cannot find install-sh, install.sh, or shtool in $1])
 fi
 
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+AC_CONFIG_AUX_DIR_LATEST([guess],[$1])
+AC_CONFIG_AUX_DIR_LATEST([sub],[$1])
 
 AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 ])# AC_CONFIG_AUX_DIRS
@@ -1796,17 +1823,17 @@ m4_divert_once([HELP_CANON],
 System types:
   --build=BUILD     configure for building on BUILD [guessed]]])dnl
 # Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  AC_MSG_ERROR([cannot run $SHELL $ac_aux_dir/config.sub])
+$SHELL "$ac_config_sub" sun4 >/dev/null 2>&1 ||
+  AC_MSG_ERROR([cannot run $SHELL $ac_config_sub])
 
 AC_CACHE_CHECK([build system type], [ac_cv_build],
 [ac_build_alias=$build_alias
 test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+  ac_build_alias=`$SHELL "$ac_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_MSG_ERROR([$SHELL $ac_aux_dir/config.sub $ac_build_alias failed])
+ac_cv_build=`$SHELL "$ac_config_sub" $ac_build_alias` ||
+  AC_MSG_ERROR([$SHELL $ac_config_sub $ac_build_alias failed])
 ])
 _AC_CANONICAL_SPLIT(build)
 ])# AC_CANONICAL_BUILD
@@ -1822,8 +1849,8 @@ AC_CACHE_CHECK([host system type], [ac_cv_host],
 [if test "x$host_alias" = x; then
   ac_cv_host=$ac_cv_build
 else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    AC_MSG_ERROR([$SHELL $ac_aux_dir/config.sub $host_alias failed])
+  ac_cv_host=`$SHELL "$ac_config_sub" $host_alias` ||
+    AC_MSG_ERROR([$SHELL $ac_config_sub $host_alias failed])
 fi
 ])
 _AC_CANONICAL_SPLIT([host])
@@ -1841,8 +1868,8 @@ AC_CACHE_CHECK([target system type], [ac_cv_target],
 [if test "x$target_alias" = x; then
   ac_cv_target=$ac_cv_host
 else
-  ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
-    AC_MSG_ERROR([$SHELL $ac_aux_dir/config.sub $target_alias failed])
+  ac_cv_target=`$SHELL "$ac_config_sub" $target_alias` ||
+    AC_MSG_ERROR([$SHELL $ac_config_sub $target_alias failed])
 fi
 ])
 _AC_CANONICAL_SPLIT([target])
-- 
1.7.10.4

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux