[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_CONFIG_FILES assumes that build directories have sibling in the s
From: |
Akim Demaille |
Subject: |
Re: AC_CONFIG_FILES assumes that build directories have sibling in the source tree |
Date: |
Tue, 04 Nov 2003 09:33:20 +0100 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
>>>> I've suggested option 1 in my previous mail because that seems
>>>> the easier to implement, and I can't see why one would want to
>>>> use this variable when the source directory does not exist.
Akim> So why define it at all?
>> For uniformity.
> Hm... Well, OK. Let's go for it.
>> Actually Paul's patch seems the best solution to me. IFAICT
>> what he calls (3) is what I call 2: the semantic of @srcdir@ and
>> @abs_srcdir@ isn't changed.
> OK, let's install it please.
I installed it as the following.
Index: ChangeLog
from Akim Demaille <address@hidden>
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.
Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.318
diff -u -u -r1.318 NEWS
--- NEWS 31 Oct 2003 08:44:46 -0000 1.318
+++ NEWS 4 Nov 2003 08:30:20 -0000
@@ -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: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.772
diff -u -u -r1.772 autoconf.texi
--- doc/autoconf.texi 31 Oct 2003 08:44:46 -0000 1.772
+++ doc/autoconf.texi 4 Nov 2003 08:30:22 -0000
@@ -8473,6 +8473,15 @@
lack support for the @option{-p} option.
@end defmac
address@hidden AS_SET_CATFILE (@var{var}, @var{dir}, @var{file})
address@hidden
+Set the shell variable @var{var} to @var{dir}/@var{file}, but
+optimizing the common cases (@var{dir} or @var{file} is @samp{.},
address@hidden is absolute etc.).
address@hidden defmac
+
+
+
@c=================================================== Writing Autoconf Macros.
@node Writing Autoconf Macros
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.37
diff -u -u -r1.37 status.m4
--- lib/autoconf/status.m4 26 Sep 2003 13:55:06 -0000 1.37
+++ lib/autoconf/status.m4 4 Nov 2003 08:30:22 -0000
@@ -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 @@
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 @@
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: lib/m4sugar/m4sh.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v
retrieving revision 1.104
diff -u -u -r1.104 m4sh.m4
--- lib/m4sugar/m4sh.m4 20 Oct 2003 23:24:37 -0000 1.104
+++ lib/m4sugar/m4sh.m4 4 Nov 2003 08:30:22 -0000
@@ -748,6 +748,23 @@
])# _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
- Re: AC_CONFIG_FILES assumes that build directories have sibling in the source tree,
Akim Demaille <=