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