1 # AM_AUX_DIR_EXPAND -*- Autoconf -*-
3 # Copyright (C) 2001-2013 Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
10 # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
11 # '$srcdir', '$srcdir/..', or '$srcdir/../..'.
13 # Of course, Automake must honor this variable whenever it calls a
14 # tool from the auxiliary directory. The problem is that $srcdir (and
15 # therefore $ac_aux_dir as well) can be either absolute or relative,
16 # depending on how configure is run. This is pretty annoying, since
17 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
18 # source directory, any form will work fine, but in subdirectories a
19 # relative path needs to be adjusted first.
22 # fails when called from a subdirectory if $ac_aux_dir is relative
23 # $top_srcdir/$ac_aux_dir/missing
24 # fails if $ac_aux_dir is absolute,
25 # fails when called from a subdirectory in a VPATH build with
26 # a relative $ac_aux_dir
28 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
29 # are both prefixed by $srcdir. In an in-source build this is usually
30 # harmless because $srcdir is '.', but things will broke when you
31 # start a VPATH build or use an absolute $srcdir.
33 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
34 # iff we strip the leading $srcdir from $ac_aux_dir. That would be:
35 # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
36 # and then we would define $MISSING as
37 # MISSING="\${SHELL} $am_aux_dir/missing"
38 # This will work as long as MISSING is not called from configure, because
39 # unfortunately $(top_srcdir) has no meaning in configure.
40 # However there are other variables, like CC, which are often used in
41 # configure, and could therefore not use this "fixed" $ac_aux_dir.
43 # Another solution, used here, is to always expand $ac_aux_dir to an
44 # absolute PATH. The drawback is that using absolute paths prevent a
45 # configured tree to be moved without reconfiguration.
47 AC_DEFUN([AM_AUX_DIR_EXPAND],
48 [dnl Rely on autoconf to set up CDPATH properly.
50 # expand $ac_aux_dir to an absolute path
51 am_aux_dir=`cd $ac_aux_dir && pwd`