bug-autoconf
[Top][All Lists]
Advanced

[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: Paul Eggert
Subject: Re: AC_CONFIG_FILES assumes that build directories have sibling in the source tree
Date: 27 Oct 2003 14:10:46 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Akim Demaille <address@hidden> writes:

> AFAICS there are three sounds options:
> 
> 1. ignore and do as 2.13: output junk
> 2. ignore but ac_subst @srcdir@ as "" (or NONE?  or don't ac_subst it?)
> 3. recognize case and output "in/" as srcdir
> 
> 3 of course "fails" when there are more that one source file.  But
> that's the common case.

How about (3)?  Here's an untested fix to do that.

2003-10-27  Paul Eggert  <address@hidden>

        * lib/autoconf/status.m4 (_AC_SET_ABS_PATH): New macro.
        (_AC_SRCPATHS): Use it, so that we don't assume that the build
        dirs exist already.

--- status.m4.~1.37.~   Fri Sep 26 06:55:06 2003
+++ status.m4   Mon Oct 27 14:09:41 2003
@@ -120,6 +120,24 @@
 ## Auxiliary macros.  ##
 ## ------------------ ##
 
+# _AC_SET_ABS_PATH(VAR, WORKING-DIR-NAME, DIR-NAME)
+# -------------------------------------------------
+# Set VAR to an absolute path name for DIR-NAME, when it is interpreted
+# in a context where WORKING-DIR-NAME is the current working directory.
+# 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([_AC_SET_ABS_PATH],
+[case $2 in
+.) $1=$3;;
+*)
+  case $3 in
+  .) $1=$2;;
+  [[\\/]]* | ?:[[\\/]]* ) $1=$3;;
+  *) $1=$2/$3;;
+  esac;;
+esac])# _AC_SET_ABS_PATH
+
 # _AC_SRCPATHS(BUILD-DIR-NAME)
 # ----------------------------
 # Inputs:
@@ -160,12 +178,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`
+_AC_SET_ABS_PATH([ac_abs_builddir], [$1], [$ac_builddir])
+_AC_SET_ABS_PATH([ac_abs_top_builddir], [$1], [${ac_top_builddir}.])
+_AC_SET_ABS_PATH([ac_abs_srcdir], [$1], [$ac_srcdir])
+_AC_SET_ABS_PATH([ac_abs_top_srcdir], [$1], [$ac_top_srcdir])
 ])# _AC_SRCPATHS
 
 




reply via email to

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