aclocal-amflags.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 the obsolescent idiom of setting $(ACLOCAL_AMFLAGS) in
  17. # Makefile.am still works. Remove this test once support for this
  18. # obsolescent idiom is removed.
  19. . test-init.sh
  20. cat >> configure.ac <<'END'
  21. MACRO_FOO || AS_EXIT([1])
  22. AC_OUTPUT
  23. END
  24. mkdir m4_1 m4_2
  25. cat > m4_1/foo.m4 <<'END'
  26. AC_DEFUN([MACRO_FOO], [: > foo])
  27. END
  28. cat > m4_2/bar.m4 <<'END'
  29. AC_DEFUN([MACRO_BAR], [: > bar])
  30. END
  31. cat > Makefile.am <<'END'
  32. ACLOCAL_AMFLAGS = -I m4_2 --verbose
  33. check-local:
  34. test ! -r foo
  35. test -f bar
  36. DISTCLEANFILES = bar
  37. END
  38. $ACLOCAL -I m4_1 >output 2>&1 || { cat output; exit 1; }
  39. cat output
  40. grep 'found macro' output && exit 1 # Sanity check.
  41. $AUTOCONF
  42. $AUTOMAKE
  43. ./configure
  44. test -f foo
  45. rm -f foo
  46. # ACLOCAL_AMFLAGS is used in rebuild rules, so trigger them.
  47. $sleep
  48. sed 's/MACRO_FOO/MACRO_BAR/' configure.ac > t
  49. mv -f t configure.ac
  50. run_make -M Makefile
  51. grep "^aclocal.*:.*found macro.*MACRO_BAR.*m4_2/bar\.m4" output
  52. grep "macro.*MACRO_FOO" output && exit 1
  53. test ! -r foo
  54. test -f bar
  55. $MAKE distcheck
  56. :