autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AM_AUX_DIR_EXPAND incorrect on MacOS X: how to fix?


From: Paul Eggert
Subject: Re: AM_AUX_DIR_EXPAND incorrect on MacOS X: how to fix?
Date: Fri, 12 Oct 2001 10:47:31 -0700 (PDT)

> From: Alexandre Duret-Lutz <address@hidden>
> Date: 12 Oct 2001 14:33:28 +0200

>  One idea is to strip the leading $srcdir from
> $ac_aux_dir, as in
>   am_aux_dir=$ac_top_srcdir/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`

That won't work in general, as srcdir can contain metacharacters.

> But then we still have two "minor" problems:
>   1) $ac_top_srcdir does not appear to be _always_ defined in
>      configure (although it always is in config.status)
>   2) $ac_top_srcdir is not guaranteed to be absolute

OK, how about this patch instead.  It avoids the 'cd', which is what
is causing the problem on MacOS X.  It doesn't avoid the pwd, which is
unfortunate, but it does check for pwd failure, which autoconf should
always do when it invokes pwd.

--- m4/auxdir.m4        Wed Sep 26 14:50:11 2001
+++ /tmp/auxdir.m4      Fri Oct 12 10:35:25 2001
@@ -60,5 +60,9 @@
 
 AC_DEFUN([AM_AUX_DIR_EXPAND], [
 # expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
+case $ac_aux_dir in
+/*) am_aux_dir=$ac_aux_dir;;
+*)  am_aux_dir=`pwd`/$ac_aux_dir ||
+      AC_MSG_ERROR([cannot determine working directory]);;
+esac
 ])


There are some other places in the Autoconf code that have the same
problem, e.g. lib/autoconf/status.m4.  I think we should have a new
macro that takes a pathname and makes it absolute, and use that macro
everywhere this issue comes up.  The macro would look like
AM_AUX_DIR_EXPAND, except it would take two arguments: the
possibly-relative pathname, and the name of the shell variable to
assign the absolute pathname to.  Also, this macro should prefer $PWD
to `pwd` if $PWD works, as $PWD generally is the preferred name for
the working directory.

I'm not sure where this macro belongs -- m4sh.m4, perhaps?  It could
be called AS_ABSOLUTE_PATHNAME(ABSOLUTE, [RELATIVE = .]).
If so, we could rewrite AM_AUX_DIR_EXPAND as follows:

AC_DEFUN([AM_AUX_DIR_EXPAND], [AS_ABSOLUTE_PATHNAME(am_aux_dir, $ac_aux_dir)])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]