Re: [RFC] 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 Fri, 2013-05-17 at 16:05 -0300, Henrique de Moraes Holschuh wrote:

> Yes.  It would have been really useful if autofoo used whatever is in
> /usr/share/misc, unless there is a config.sub.override or
> config.guess.override file in the source directory (or even better,
> something pointed to by environment variables), and deprecate
> source-directory config.guess and config.sub.

My original patch didn't allow overrides, here is an updated one.

-- 
bye,
pabs

http://bonedaddy.net/pabs3/
From 17afa8e123997e21e55755cfaaae07b5f84de690 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).

Allow software authors and distro porters to override the latest version.
---
 lib/autoconf/general.m4 | 72 ++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 56 insertions(+), 16 deletions(-)

diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 70b0168..f746b73 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -1680,6 +1680,51 @@ AC_DEFUN([AC_CONFIG_AUX_DIR],
 AC_DEFUN([AC_CONFIG_AUX_DIR_DEFAULT],
 [AC_CONFIG_AUX_DIRS("$srcdir" "$srcdir/.." "$srcdir/../..")])
 
+# AC_CONFIG_AUX_DIR
+# -------------------------
+# Internal subroutine.
+# Find the latest version of config.guess and config.sub that is
+# available on the system to prevent issues with bootstrapping.
+# Allows explicitly overriding the latest one where needed.
+AC_DEFUN([AC_CONFIG_AUX_DIR,
+[
+for path in \
+  "$AUTOCONF_AUX_DIR" \
+  "$HOME/.config/autotools" \
+  "$2" \
+  ; do
+    if test -x "$path/config.$1.override" ; then
+      ac_config_$1="$path/config.$1.override"
+    fi
+done
+if test -z "$ac_config_$1" ; then
+  cur_v=0
+  for path in \
+    "$AUTOCONF_AUX_DIR" \
+    "$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"
+fi
+])# AC_CONFIG_AUX_DIR
+
 
 # AC_CONFIG_AUX_DIRS(DIR ...)
 # ---------------------------
@@ -1708,13 +1753,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([guess],[$1])
+AC_CONFIG_AUX_DIR([sub],[$1])
 
 AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 ])# AC_CONFIG_AUX_DIRS
@@ -1832,17 +1872,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
@@ -1858,8 +1898,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])
@@ -1877,8 +1917,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.8.3.rc2

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