java-check.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #! /bin/sh
  2. # Copyright (C) 2011-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. # Make sure that check_JAVA causes *.class files to be built only with
  17. # "make check", and not also with "make all".
  18. # See automake bug#8234.
  19. required=javac
  20. . test-init.sh
  21. cat >> configure.ac << 'END'
  22. AC_OUTPUT
  23. END
  24. cat > Makefile.am << 'END'
  25. check_JAVA = One.java Two.java
  26. END
  27. cat > One.java <<'END'
  28. class One { }
  29. END
  30. cat > Two.java <<'END'
  31. class Two { // Deliberately missing closing bracket.
  32. END
  33. $ACLOCAL
  34. $AUTOCONF
  35. $AUTOMAKE
  36. inst=$(pwd)/_inst
  37. ./configure --prefix="$inst"
  38. $MAKE
  39. ls | $EGREP '\.(class|stamp)$' && exit 1
  40. # Make Two.java compilable.
  41. echo '}' >> Two.java
  42. # "make check" should compile files in $(check_JAVA) ...
  43. $MAKE check
  44. ls -l # For debugging.
  45. test -f One.class
  46. test -f Two.class
  47. # ... but should *not* install them.
  48. $FGREP checkdir Makefile && exit 1
  49. $MAKE install
  50. test -d _inst && exit 1
  51. :