2
0

java-empty-classpath.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. # Java compilation works also when CLASSPATH is unset or empty at
  17. # compilation time. See automake bug#9306.
  18. required=javac
  19. . test-init.sh
  20. cat >> configure.ac <<'END'
  21. AC_CONFIG_SRCDIR([org/gnu/bug/Library.java])
  22. AC_CONFIG_FILES([
  23. org/Makefile
  24. org/gnu/Makefile
  25. org/gnu/bug/Makefile
  26. ])
  27. AC_OUTPUT
  28. END
  29. mkdir org org/gnu org/gnu/bug
  30. cat > Makefile.am <<END
  31. CLEANFILES = *.class
  32. SUBDIRS = org
  33. END
  34. echo SUBDIRS = gnu > org/Makefile.am
  35. echo SUBDIRS = bug > org/gnu/Makefile.am
  36. cat > org/gnu/bug/Makefile.am <<'END'
  37. JAVAROOT = ../../..
  38. dist_noinst_JAVA = Library.java Application.java
  39. END
  40. cat > org/gnu/bug/Library.java <<'END'
  41. package org.gnu.bug;
  42. public class Library
  43. {
  44. public Library ()
  45. {
  46. // Nothing to do.
  47. }
  48. public static void doSomethingUseful (String arg)
  49. {
  50. System.out.println (arg);
  51. }
  52. }
  53. END
  54. cat > org/gnu/bug/Application.java <<'END'
  55. import org.gnu.bug.*;
  56. public class Application
  57. {
  58. public static void main (String args[])
  59. {
  60. Library lib = new Library ();
  61. lib.doSomethingUseful ("PLUGH");
  62. }
  63. }
  64. END
  65. $ACLOCAL
  66. $AUTOCONF
  67. $AUTOMAKE
  68. ./configure
  69. unset CLASSPATH
  70. $MAKE
  71. $MAKE clean
  72. CLASSPATH=''; export CLASSPATH
  73. $MAKE
  74. $MAKE clean
  75. unset CLASSPATH
  76. $MAKE distcheck
  77. :