java-extra.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. # Check use of EXTRA with the JAVA primary. Also test interaction
  17. # of JAVA with conditionals (it's natural to test it here, since
  18. # EXTRA_JAVA exists mostly for ensuring interoperation with Automake
  19. # conditionals).
  20. required=javac
  21. . test-init.sh
  22. cat >> configure.ac << 'END'
  23. AM_CONDITIONAL([COND], [test x"$cond" = x"yes"])
  24. AC_OUTPUT
  25. END
  26. cat > Makefile.am << 'END'
  27. javadir = $(pkgdatadir)/java
  28. EXTRA_JAVA = Class1.java Class2.java Class3.java
  29. java_JAVA = Class1.java
  30. if COND
  31. java_JAVA += Class2.java
  32. else !COND
  33. java_JAVA += Class3.java
  34. endif !COND
  35. Class3.java: Makefile
  36. echo 'class Class3 {}' > $@
  37. CLEANFILES = Class3.java
  38. END
  39. echo "class Class1 {}" > Class1.java
  40. echo "class Class2 {}" > Class2.java
  41. $ACLOCAL
  42. $AUTOCONF
  43. $AUTOMAKE
  44. ./configure cond=yes
  45. $MAKE
  46. ls -l
  47. test -f Class1.class
  48. test -f Class2.class
  49. test ! -e Class3.class
  50. test ! -e Class3.java
  51. $MAKE distclean
  52. ./configure cond=no
  53. $MAKE
  54. ls -l
  55. test -f Class1.class
  56. test ! -e Class2.class
  57. test -f Class3.class
  58. test -f Class3.java
  59. :