]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
AC_CONFIG_FILE([d1/foo:d2/foo]) triggers error messages when
authorAkim Demaille <akim@epita.fr>
Tue, 4 Nov 2003 08:32:06 +0000 (08:32 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 4 Nov 2003 08:32:06 +0000 (08:32 +0000)
computing the absolute path to d1 in the source hierarchy: it may
not exist at all.  So don't cd into it.
From Alexandre Duret-Lutz.
http://mail.gnu.org/archive/html/bug-autoconf/2003-10/msg00205.html
* lib/m4sugar/m4sh.m4 (AS_SET_CATFILE): New.
From Paul Eggert, but named after Perl's IO::Spec->catfile.
* doc/autoconf.texi (Programming in M4sh): Document.
* lib/autoconf/status.m4 (_AC_SRCPATHS): Use it.

ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/status.m4
lib/m4sugar/m4sh.m4

index 7c16b864fb909b4781ce28887e6c100ed603f48d..d66542be8e9fbe078831d11183d196992a4b6566 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2003-11-04  Akim Demaille  <akim@epita.fr>
+
+       AC_CONFIG_FILE([d1/foo:d2/foo]) triggers error messages when
+       computing the absolute path to d1 in the source hierarchy: it may
+       not exist at all.  So don't cd into it.
+       From Alexandre Duret-Lutz.
+       http://mail.gnu.org/archive/html/bug-autoconf/2003-10/msg00205.html
+
+       * lib/m4sugar/m4sh.m4 (AS_SET_CATFILE): New.
+       From Paul Eggert, but named after Perl's IO::Spec->catfile.
+       * doc/autoconf.texi (Programming in M4sh): Document.
+       * lib/autoconf/status.m4 (_AC_SRCPATHS): Use it.
+
 2003-11-03  Pavel Roskin  <proski@gnu.org>
 
        * doc/autoconf.texi (Generic Structure Checks): Describe
diff --git a/NEWS b/NEWS
index 8fdecf2507a6fb8c07f08a6ab157fea0e74b9f85..e14be173b65247217f39067bda214c89f95e5422 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,7 @@
   core.* files are no longer removed, as they may be valid user files.
 
 ** New macros
-  AC_LANG_ASSERT.
+  AC_LANG_ASSERT, AS_SET_CATFILE.
 
 * Major changes in Autoconf 2.57g
 
index 66f17d186b4fe132268d165b5b0a0f075a0551b6..e43b08bae65f2da8513f7937bb03352cde01daed 100644 (file)
@@ -8476,6 +8476,15 @@ except that it is portable to older versions of @command{mkdir} that
 lack support for the @option{-p} option.
 @end defmac
 
+@defmac AS_SET_CATFILE (@var{var}, @var{dir}, @var{file})
+@asindex{SET_CATFILE}
+Set the shell variable @var{var} to @var{dir}/@var{file}, but
+optimizing the common cases (@var{dir} or @var{file} is @samp{.},
+@var{file} is absolute etc.).
+@end defmac
+
+
+
 @c=================================================== Writing Autoconf Macros.
 
 @node Writing Autoconf Macros
index 252212466fedb1d875f488086a4f0f9fd9f9a171..b918f62cfcf0cac6d969783908974fa0eb1c5a50 100644 (file)
@@ -1,6 +1,6 @@
 # This file is part of Autoconf.                       -*- Autoconf -*-
 # Parameterizing and creating config.status.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
 # 2002, 2003 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -160,12 +160,10 @@ case $srcdir in
     ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
     ac_top_srcdir=$ac_top_builddir$srcdir ;;
 esac
-# Don't blindly perform a `cd $1/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd $1 && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd $1 && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd $1 && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd $1 && cd $ac_top_srcdir && pwd`
+AS_SET_CATFILE([ac_abs_builddir],     [$1], [$ac_builddir])
+AS_SET_CATFILE([ac_abs_top_builddir], [$1], [${ac_top_builddir}.])
+AS_SET_CATFILE([ac_abs_srcdir],       [$1], [$ac_srcdir])
+AS_SET_CATFILE([ac_abs_top_srcdir],   [$1], [$ac_top_srcdir])
 ])# _AC_SRCPATHS
 
 
@@ -366,7 +364,7 @@ for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
   ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
   ac_source=`echo "$ac_file" | sed 's,[[^:]]*:,,'`
   ac_dir=`AS_DIRNAME(["$ac_dest"])`
-  AS_MKDIR_P(["$ac_dir"])  
+  AS_MKDIR_P(["$ac_dir"])
   _AC_SRCPATHS(["$ac_dir"])
 
   AC_MSG_NOTICE([executing $ac_dest commands])
index 7cb2e30fe248196ea5c199f1a9c738253f3c2540..64756922fef6d993c4e67ced61c62418c08cf846 100644 (file)
@@ -748,6 +748,23 @@ m4_defun([_AS_TEST_PREPARE],
 ])# _AS_BROKEN_TEST_PREPARE
 
 
+# AS_SET_CATFILE(VAR, DIR-NAME, FILE-NAME)
+# ----------------------------------------
+# Set VAR to DIR-NAME/FILE-NAME.
+# Optimize the common case where $2 or $3 is '.'.
+# Don't blindly perform a $1=`cd $2/$3 && pwd`, since $3 can be absolute,
+# and also $3 might not exist yet.
+m4_define([AS_SET_CATFILE],
+[case $2 in
+.) $1=$3;;
+*)
+  case $3 in
+  .) $1=$2;;
+  [[\\/]]* | ?:[[\\/]]* ) $1=$3;;
+  *) $1=$2/$3;;
+  esac;;
+esac[]dnl
+])# AS_SET_CATFILE