* lib/am/texi-vers.am, lib/am/subdirs.am, lib/am/scripts.am,
[platform/upstream/automake.git] / m4 / auxdir.m4
1 # AM_AUX_DIR_EXPAND
2
3 # Copyright (C) 2001, 2003 Free Software Foundation, Inc.
4
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 # 02111-1307, USA.
19
20 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
21 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
22 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
23 #
24 # Of course, Automake must honor this variable whenever it calls a
25 # tool from the auxiliary directory.  The problem is that $srcdir (and
26 # therefore $ac_aux_dir as well) can be either absolute or relative,
27 # depending on how configure is run.  This is pretty annoying, since
28 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
29 # source directory, any form will work fine, but in subdirectories a
30 # relative path needs to be adjusted first.
31 #
32 # $ac_aux_dir/missing
33 #    fails when called from a subdirectory if $ac_aux_dir is relative
34 # $top_srcdir/$ac_aux_dir/missing
35 #    fails if $ac_aux_dir is absolute,
36 #    fails when called from a subdirectory in a VPATH build with
37 #          a relative $ac_aux_dir
38 #
39 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
40 # are both prefixed by $srcdir.  In an in-source build this is usually
41 # harmless because $srcdir is `.', but things will broke when you
42 # start a VPATH build or use an absolute $srcdir.
43 #
44 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
45 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
46 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
47 # and then we would define $MISSING as
48 #   MISSING="\${SHELL} $am_aux_dir/missing"
49 # This will work as long as MISSING is not called from configure, because
50 # unfortunately $(top_srcdir) has no meaning in configure.
51 # However there are other variables, like CC, which are often used in
52 # configure, and could therefore not use this "fixed" $ac_aux_dir.
53 #
54 # Another solution, used here, is to always expand $ac_aux_dir to an
55 # absolute PATH.  The drawback is that using absolute paths prevent a
56 # configured tree to be moved without reconfiguration.
57
58 # Rely on autoconf to set up CDPATH properly.
59 AC_PREREQ([2.50])
60
61 AC_DEFUN([AM_AUX_DIR_EXPAND], [
62 # expand $ac_aux_dir to an absolute path
63 am_aux_dir=`cd $ac_aux_dir && pwd`
64 ])