auxdir.m4 2.4 KB

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