ac_prog_javac_works.m4 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. dnl @synopsis AC_PROG_JAVAC_WORKS
  2. dnl
  3. dnl Internal use ONLY.
  4. dnl
  5. dnl Note: This is part of the set of autoconf M4 macros for Java
  6. dnl programs. It is VERY IMPORTANT that you download the whole set,
  7. dnl some macros depend on other. Unfortunately, the autoconf archive
  8. dnl does not support the concept of set of macros, so I had to break it
  9. dnl for submission. The general documentation, as well as the sample
  10. dnl configure.in, is included in the AC_PROG_JAVA macro.
  11. dnl
  12. dnl @category Java
  13. dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
  14. dnl @version 2000-07-19
  15. dnl @license GPLWithACException
  16. dnl
  17. dnl Modified to test for 1.5 by Andrew John Hughes on 2008-02-11
  18. AC_DEFUN_ONCE([AC_PROG_JAVAC_WORKS],[
  19. AC_REQUIRE([AC_PROG_JAVAC])
  20. AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [
  21. JAVA_TEST=Object.java
  22. CLASS_TEST=Object.class
  23. cat << \EOF > $JAVA_TEST
  24. /* [#]line __oline__ "configure" */
  25. package java.lang;
  26. public class Object
  27. {
  28. static <T> void doStuff()
  29. {
  30. }
  31. }
  32. EOF
  33. if test x$JAVAC_IS_GCJ = xyes; then
  34. CMD="$JAVAC $JAVACFLAGS -fsource=1.5 -ftarget=1.5 $JAVA_TEST"
  35. else
  36. CMD="$JAVAC $JAVACFLAGS -source 1.5 -target 1.5 $JAVA_TEST"
  37. fi
  38. if AC_TRY_COMMAND($CMD) >/dev/null 2>&1; then
  39. ac_cv_prog_javac_works=yes
  40. else
  41. AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)])
  42. echo "configure: failed program was:" >&AC_FD_CC
  43. cat $JAVA_TEST >&AC_FD_CC
  44. fi
  45. rm -f $JAVA_TEST $CLASS_TEST
  46. ])
  47. AC_PROVIDE([$0])dnl
  48. ])