From: Akim Demaille Date: Tue, 4 Nov 2003 08:32:06 +0000 (+0000) Subject: AC_CONFIG_FILE([d1/foo:d2/foo]) triggers error messages when X-Git-Tag: AUTOCONF-2.58~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=610c2289142bcd37d5804f50239b07cd8a14138f;p=thirdparty%2Fautoconf.git 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. --- diff --git a/ChangeLog b/ChangeLog index 7c16b864..d66542be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2003-11-04 Akim Demaille + + 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 * doc/autoconf.texi (Generic Structure Checks): Describe diff --git a/NEWS b/NEWS index 8fdecf25..e14be173 100644 --- 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 diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 66f17d18..e43b08ba 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -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 diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 index 25221246..b918f62c 100644 --- a/lib/autoconf/status.m4 +++ b/lib/autoconf/status.m4 @@ -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]) diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 7cb2e30f..64756922 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -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