aclocal-install-mkdir.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #! /bin/sh
  2. # Copyright (C) 2012-2017 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Check that "aclocal --install" creates the local m4 directory if
  17. # necessary.
  18. # FIXME: this is a good candidate for a conversion to TAP.
  19. am_create_testdir=empty
  20. . test-init.sh
  21. cat > configure.ac <<END
  22. AC_INIT([$me], [1.0])
  23. MY_MACRO
  24. END
  25. mkdir sys-acdir
  26. cat > sys-acdir/my-defs.m4 <<END
  27. AC_DEFUN([MY_MACRO], [:])
  28. END
  29. ACLOCAL="$ACLOCAL --system-acdir=sys-acdir"
  30. $ACLOCAL -I foo --install
  31. test -f foo/my-defs.m4
  32. $ACLOCAL --install -I "$(pwd)/bar"
  33. test -f bar/my-defs.m4
  34. $ACLOCAL --install -I baz/sub/sub2
  35. test -f baz/sub/sub2/my-defs.m4
  36. # What should happen:
  37. # * zardoz1 should be created, and required m4 files copied into there.
  38. # * zardoz2 shouldn't be preferred to quux, even if the former exists
  39. # while the latter does not.
  40. mkdir zardoz2
  41. $ACLOCAL --install -I zardoz1 -I zardoz2
  42. test -d zardoz1
  43. grep MY_MACRO zardoz1/my-defs.m4
  44. ls zardoz2 | grep . && exit 1
  45. # Directories in ACLOCAL_PATH should never be created if they don't
  46. # exist.
  47. ACLOCAL_PATH="$(pwd)/none:$(pwd)/none2" $ACLOCAL --install && exit 1
  48. test ! -e none
  49. test ! -e none2
  50. ACLOCAL_PATH="$(pwd)/none:$(pwd)/none2" $ACLOCAL --install -I x
  51. test -f x/my-defs.m4
  52. test ! -e none
  53. test ! -e none2
  54. # It's better if aclocal doesn't create the first include dir on failure.
  55. $ACLOCAL --install -I none -I none2 && exit 1
  56. test ! -e none
  57. test ! -e none2
  58. :