* configure.ac: New switch for disabling -O2 (--disable-optimizations).
[cacao.git] / m4 / ac_prog_javac_works.m4
1 dnl taken from http://ac-archive.sourceforge.net/
2
3 dnl @synopsis AC_PROG_JAVAC_WORKS
4 dnl
5 dnl Internal use ONLY.
6 dnl
7 dnl Note: This is part of the set of autoconf M4 macros for Java
8 dnl programs. It is VERY IMPORTANT that you download the whole set,
9 dnl some macros depend on other. Unfortunately, the autoconf archive
10 dnl does not support the concept of set of macros, so I had to break it
11 dnl for submission. The general documentation, as well as the sample
12 dnl configure.in, is included in the AC_PROG_JAVA macro.
13 dnl
14 dnl @category Java
15 dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
16 dnl @version 2000-07-19
17 dnl @license GPLWithACException
18
19 AC_DEFUN([AC_PROG_JAVAC_WORKS],[
20 AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [
21 JAVA_TEST=Test.java
22 CLASS_TEST=Test.class
23 cat << \EOF > $JAVA_TEST
24 /* [#]line __oline__ "configure" */
25 public class Test {
26 }
27 EOF
28 if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then
29   ac_cv_prog_javac_works=yes
30 else
31   AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)])
32   echo "configure: failed program was:" >&AC_FD_CC
33   cat $JAVA_TEST >&AC_FD_CC
34 fi
35 rm -f $JAVA_TEST $CLASS_TEST
36 ])
37 AC_PROVIDE([$0])dnl
38 ])