2013-09-25 Yvan Roux <yvan.roux@linaro.org>
[official-gcc.git] / libjava / classpath / m4 / ac_prog_javac_works.m4
blob7fb298d49be5fcfeb928d3484abfdb32a28a2595
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
19 AC_DEFUN_ONCE([AC_PROG_JAVAC_WORKS],[
20 AC_REQUIRE([AC_PROG_JAVAC])
21 AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [
22 JAVA_TEST=Object.java
23 CLASS_TEST=Object.class
24 cat << \EOF > $JAVA_TEST
25 /* [#]line __oline__ "configure" */
26 package java.lang;
28 public class Object
30   static <T> void doStuff()
31   {
32   }
34 EOF
35 if test x$JAVAC_IS_GCJ = xyes; then
36   CMD="$JAVAC $JAVACFLAGS -fsource=1.5 -ftarget=1.5 $JAVA_TEST"
37 else
38   CMD="$JAVAC $JAVACFLAGS -source 1.5 -target 1.5 $JAVA_TEST"
40 if AC_TRY_COMMAND($CMD) >/dev/null 2>&1; then
41   ac_cv_prog_javac_works=yes
42 else
43   AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)])
44   echo "configure: failed program was:" >&AC_FD_CC
45   cat $JAVA_TEST >&AC_FD_CC
47 rm -f $JAVA_TEST $CLASS_TEST
49 AC_PROVIDE([$0])dnl