1 dnl @synopsis AC_PROG_JAVAC_WORKS
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.
13 dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
14 dnl @version 2000-07-19
15 dnl @license GPLWithACException
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, [
23 CLASS_TEST=Object.class
24 cat << \EOF > $JAVA_TEST
25 /* [#]line __oline__ "configure" */
30 static <T> void doStuff()
35 if test x$JAVAC_IS_GCJ = xyes; then
36 CMD="$JAVAC $JAVACFLAGS -fsource=1.5 -ftarget=1.5 $JAVA_TEST"
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
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