[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 20:46 +0800, Paul Wise wrote:

> So, Debian is in the process of bringing up our upcoming arm64 port.
> Unfortunately we are also coming across lots of packages with rather
> outdated config.guess and config.sub files (see links below).

I've taken on board advice received during this thread and elsewhere and
updated the patch to always use the latest config.guess and config.sub
files. I've also tested the result on one of the things I'm upstream for
and it works to my satisfaction. The only downside is that there is a
code block that occurs twice in each generated configure script, but I'm
not sure how to avoid that, any pointers? Please see the attached patch.

-- 
bye,
pabs

http://bonedaddy.net/pabs3/
From daf894f36dd53c7b3033a727aef73a149c7030b3 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 |   57 ++++++++++++++++++++++++++++++++++-------------
 1 file changed, 41 insertions(+), 16 deletions(-)

diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 51cee30..116bf95 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -1680,6 +1680,36 @@ 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/share/misc \
+  /usr/share/gnuconfig \
+  /usr/share/automake-* \
+  /usr/share/automake \
+  /usr/share/libtool/config \
+  ; 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 +1738,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 +1821,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 +1847,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 +1866,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