* configure.ac: New switch for disabling -O2 (--disable-optimizations).
[cacao.git] / m4 / ac_prog_javac.m4
1 dnl taken from http://ac-archive.sourceforge.net/
2
3 dnl @synopsis AC_PROG_JAVAC
4 dnl
5 dnl AC_PROG_JAVAC tests an existing Java compiler. It uses the
6 dnl environment variable JAVAC then tests in sequence various common
7 dnl Java compilers. For political reasons, it starts with the free
8 dnl ones.
9 dnl
10 dnl If you want to force a specific compiler:
11 dnl
12 dnl - at the configure.in level, set JAVAC=yourcompiler before calling
13 dnl AC_PROG_JAVAC
14 dnl
15 dnl - at the configure level, setenv JAVAC
16 dnl
17 dnl You can use the JAVAC variable in your Makefile.in, with @JAVAC@.
18 dnl
19 dnl *Warning*: its success or failure can depend on a proper setting of
20 dnl the CLASSPATH env. variable.
21 dnl
22 dnl TODO: allow to exclude compilers (rationale: most Java programs
23 dnl cannot compile with some compilers like guavac).
24 dnl
25 dnl Note: This is part of the set of autoconf M4 macros for Java
26 dnl programs. It is VERY IMPORTANT that you download the whole set,
27 dnl some macros depend on other. Unfortunately, the autoconf archive
28 dnl does not support the concept of set of macros, so I had to break it
29 dnl for submission. The general documentation, as well as the sample
30 dnl configure.in, is included in the AC_PROG_JAVA macro.
31 dnl
32 dnl @category Java
33 dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
34 dnl @version 2000-07-19
35 dnl @license GPLWithACException
36
37 AC_DEFUN([AC_PROG_JAVAC],[
38 AC_REQUIRE([AC_EXEEXT])dnl
39 if test "x$JAVAPREFIX" = x; then
40         test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, "javac$EXEEXT" "ecj$EXEEXT" "gcj$EXEEXT -C")
41 else
42         test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, "javac$EXEEXT" "ecj$EXEEXT" "gcj$EXEEXT -C", $JAVAPREFIX)
43 fi
44 test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH])
45 AC_PROG_JAVAC_WORKS
46 AC_PROVIDE([$0])dnl
47 ])