+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
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
# 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
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
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])
])# _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