Hello,

there is a patch which is pending some time.  The thread started at:
http://lists.gnu.org/archive/html/bug-autoconf/2005-01/msg00046.html

and Paul approved the patch here:
http://lists.gnu.org/archive/html/bug-autoconf/2005-02/msg00007.html

Today, I incorporated Pauls comments and made some minor variations
to adapt the patch to my recent changes to ac_abs-* computation.

Then I commited the patch, as attached to this mail.

Stepan

2005-05-20  Stepan Kasal  <[EMAIL PROTECTED]>

        * NEWS: @top_builddir@ is now a dirname, ac_top_builddir will follow.
        * lib/autoconf/status.m4 (_AC_SRCDIRS): Rename ...
        (ac_top_builddir): ... this ...
        (ac_top_build_prefix): ... to this; the old name is also kept, for
          backward compatibility.
        (ac_top_builddir_sub): New variable, without the trailing slash,
          always nonempty.
        (_AC_OUTPUT_FILES): s/@top_builddir@/$ac_top_builddir_sub/
        * doc/autoconf.texi (Configuration Actions): Rename
          ac_top_builddir to ac_top_build_prefix.
        * lib/autoconf/autotest.m4 (AC_CONFIG_TESTDIR): Rename
          at_top_builddir to at_top_build_prefix.
        * lib/autotest/general.m4 (AT_INIT): Likewise.

Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.340
diff -u -r1.340 NEWS
--- NEWS        14 May 2005 18:33:30 -0000      1.340
+++ NEWS        20 May 2005 07:06:32 -0000
@@ -31,6 +31,11 @@
   [EMAIL PROTECTED]@' in a file, you will have to ensure `${datarootdir}' is
   defined in this file.
 
+** @top_builddir@ is now a dir name: it is always nonempty and doesn't have
+  a trailing slash.  Similar change will be made to ac_top_builddir in a
+  future release; the old style value, which matches (../)*, is (and will
+  continue to be) available as ac_top_build_prefix.
+
 ** AC_PROG_CC_C89, AC_PROG_CC_C99
   New macros for ISO C99 support.  AC_PROG_CC_C89 and AC_PROG_CC_C99
   check for ANSI C89 and ISO C99 support respectively.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.898
diff -u -r1.898 autoconf.texi
--- doc/autoconf.texi   14 May 2005 18:33:30 -0000      1.898
+++ doc/autoconf.texi   20 May 2005 07:06:33 -0000
@@ -1970,7 +1970,7 @@
 directory is the current build directory.
 
 
[EMAIL PROTECTED] ac_top_builddir
[EMAIL PROTECTED] ac_top_build_prefix
 The name of the top build directory, assuming that the working
 directory is the current build directory.
 It can be empty, or else ends with a slash, so that you may concatenate
@@ -1997,8 +1997,8 @@
 # Argument of --srcdir
 srcdir='../package'
 # Reversing deep/dir
-ac_top_builddir='../../'
-# Concatenation of $ac_top_builddir and srcdir
+ac_top_build_prefix='../../'
+# Concatenation of $ac_top_build_prefix and srcdir
 ac_top_srcdir='../../../package'
 # Concatenation of $ac_top_srcdir and deep/dir
 ac_srcdir='../../../package/deep/dir'
Index: lib/autoconf/autotest.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/autotest.m4,v
retrieving revision 1.17
diff -u -r1.17 autotest.m4
--- lib/autoconf/autotest.m4    14 May 2005 07:00:39 -0000      1.17
+++ lib/autoconf/autotest.m4    20 May 2005 07:06:33 -0000
@@ -1,7 +1,7 @@
 # This file is part of Autoconf.                       -*- Autoconf -*-
 # Interface with Autotest.
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2005 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -75,7 +75,7 @@
 abs_srcdir='$ac_abs_srcdir'
 at_top_srcdir='$ac_top_srcdir'
 abs_top_srcdir='$ac_abs_top_srcdir'
-at_top_builddir='$ac_top_builddir'
+at_top_build_prefix='$ac_top_build_prefix'
 abs_top_builddir='$ac_abs_top_builddir'
 
 AUTOTEST_PATH='m4_default([$2], [$1])'
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.56
diff -u -r1.56 status.m4
--- lib/autoconf/status.m4      17 May 2005 09:29:05 -0000      1.56
+++ lib/autoconf/status.m4      20 May 2005 07:06:33 -0000
@@ -126,43 +126,46 @@
 #   - BUILD-DIR-NAME is `top-build -> build' and `top-src -> src'
 #   - `$srcdir' is `top-build -> top-src'
 #
-# Ouputs:
+# Outputs:
 # - `ac_builddir' is `.', for symmetry only.
-# - `ac_top_builddir' is `build -> top_build'.
+# - `ac_top_builddir_sub' is `build -> top_build'.
+#      This is used for @[EMAIL PROTECTED]
+# - `ac_top_build_prefix' is `build -> top_build'.
 #      If not empty, has a trailing slash.
 # - `ac_srcdir' is `build -> src'.
 # - `ac_top_srcdir' is `build -> top-src'.
-#
 # and `ac_abs_builddir' etc., the absolute directory names.
 m4_define([_AC_SRCDIRS],
 [ac_builddir=.
 
-if test $1 != .; then
+case $1 in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
   ac_dir_suffix=/`echo $1 | sed 's,^\.[[\\/]],,'`
-  # A "../" for each directory in $ac_dir_suffix.
-  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[[^\\/]]*,../,g'`
-else
-  ac_dir_suffix= ac_top_builddir=
-fi
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[[^\\/]]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
 ac_abs_top_builddir=$ac_pwd
 ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
 
 case $srcdir in
   .)  # No --srcdir option.  We are building in place.
     ac_srcdir=.
-    if test -z "$ac_top_builddir"; then
-       ac_top_srcdir=.
-    else
-       ac_top_srcdir=`expr $ac_top_builddir : ['\(.*[^/]\)']`
-    fi
+    ac_top_srcdir=$ac_top_builddir_sub
     ac_abs_top_srcdir=$ac_pwd ;;
   [[\\/]]* | ?:[[\\/]]* )  # Absolute name.
     ac_srcdir=$srcdir$ac_dir_suffix;
     ac_top_srcdir=$srcdir
     ac_abs_top_srcdir=$srcdir ;;
   *) # Relative name.
-    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_builddir$srcdir
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
     ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
 esac
 ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
@@ -815,7 +818,7 @@
 
   case $srcdir in
   [[\\/$]]* | ?:[[\\/]]* ) ac_rel_source=$srcdir/$ac_source ;;
-      *) ac_rel_source=$ac_top_builddir$srcdir/$ac_source ;;
+      *) ac_rel_source=$ac_top_build_prefix$srcdir/$ac_source ;;
   esac
 
   # Try a symlink, then a hard link, then a copy.
@@ -976,7 +979,7 @@
 AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
 [  case $INSTALL in
   [[\\/$]]* | ?:[[\\/]]* ) ac_INSTALL=$INSTALL ;;
-  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
   esac
 ])dnl
 
@@ -1036,7 +1039,7 @@
 s|@abs_top_srcdir@|$ac_abs_top_srcdir|;t t
 s|@builddir@|$ac_builddir|;t t
 s|@abs_builddir@|$ac_abs_builddir|;t t
-s|@top_builddir@|$ac_top_builddir|;t t
+s|@top_builddir@|$ac_top_builddir_sub|;t t
 s|@abs_top_builddir@|$ac_abs_top_builddir|;t t
 AC_PROVIDE_IFELSE([AC_PROG_INSTALL], [s,@INSTALL@,$ac_INSTALL,;t t
 ])dnl
@@ -1178,7 +1181,7 @@
       case $cache_file in
       [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
       *) # Relative name.
-       ac_sub_cache_file=$ac_top_builddir$cache_file ;;
+       ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
       esac
 
       AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args 
--cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
Index: lib/autotest/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.178
diff -u -r1.178 general.m4
--- lib/autotest/general.m4     17 May 2005 09:29:05 -0000      1.178
+++ lib/autotest/general.m4     20 May 2005 07:06:33 -0000
@@ -182,7 +182,7 @@
 # in, but the groups themselves are run in testsuite-dir/group-dir.
 if test -n "$at_top_srcdir"; then
   builddir=../..
-  for at_dir in srcdir top_srcdir top_builddir
+  for at_dir in srcdir top_srcdir top_build_prefix
   do
     at_val=AS_VAR_GET(at_$at_dir)
     AS_VAR_SET($at_dir, $at_val/../..)
@@ -479,12 +479,12 @@
     at_path=$at_path$as_dir
     ;;
   * )
-    if test -z "$at_top_builddir"; then
+    if test -z "$at_top_build_prefix"; then
       # Stand-alone test suite.
       at_path=$at_path$as_dir
     else
       # Embedded test suite.
-      at_path=$at_path$at_top_builddir/$as_dir$PATH_SEPARATOR
+      at_path=$at_path$at_top_build_prefix$as_dir$PATH_SEPARATOR
       at_path=$at_path$at_top_srcdir/$as_dir
     fi
     ;;
@@ -899,8 +899,8 @@
       echo
     fi
     if test -n "$at_top_srcdir"; then
-      AS_BOX([$at_top_builddir/config.log])
-      sed 's/^/| /' $at_top_builddir/config.log
+      AS_BOX([${at_top_build_prefix}config.log])
+      sed 's/^/| /' ${at_top_build_prefix}config.log
       echo
     fi
   } >&AS_MESSAGE_LOG_FD

Reply via email to