]> git.ipfire.org Git - thirdparty/gcc.git/blame - libjava/classpath/m4/ac_prog_javac.m4
re PR other/66259 (Combined gcc and binutils build from git-master fails, with gas...
[thirdparty/gcc.git] / libjava / classpath / m4 / ac_prog_javac.m4
CommitLineData
e0441a5b
MK
1dnl @synopsis AC_PROG_JAVAC
2dnl
3dnl AC_PROG_JAVAC tests an existing Java compiler. It uses the
4dnl environment variable JAVAC then tests in sequence various common
5dnl Java compilers. For political reasons, it starts with the free
6dnl ones.
7dnl
8dnl If you want to force a specific compiler:
9dnl
6b1786aa 10dnl - at the configure.ac level, set JAVAC=yourcompiler before calling
e0441a5b
MK
11dnl AC_PROG_JAVAC
12dnl
13dnl - at the configure level, setenv JAVAC
14dnl
15dnl You can use the JAVAC variable in your Makefile.in, with @JAVAC@.
16dnl
17dnl *Warning*: its success or failure can depend on a proper setting of
18dnl the CLASSPATH env. variable.
19dnl
20dnl TODO: allow to exclude compilers (rationale: most Java programs
21dnl cannot compile with some compilers like guavac).
22dnl
23dnl Note: This is part of the set of autoconf M4 macros for Java
24dnl programs. It is VERY IMPORTANT that you download the whole set,
25dnl some macros depend on other. Unfortunately, the autoconf archive
26dnl does not support the concept of set of macros, so I had to break it
27dnl for submission. The general documentation, as well as the sample
6b1786aa 28dnl configure.ac, is included in the AC_PROG_JAVA macro.
e0441a5b
MK
29dnl
30dnl @category Java
31dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
32dnl @version 2000-07-19
33dnl @license GPLWithACException
34dnl
35dnl Modified to remove jikes by Andrew John Hughes on 2008-02-11
36
729530c0 37AC_DEFUN_ONCE([AC_PROG_JAVAC],[
e0441a5b 38AC_REQUIRE([AC_EXEEXT])dnl
a1906e8b 39ECJ_OPTS="-warn:-deprecation,serial,unusedImport,unusedPrivate,resource"
cd6d4007
MK
40JAVAC_OPTS="-Xlint:unchecked,cast,divzero,empty,finally,overrides"
41GCJ_OPTS="-g"
e0441a5b 42if test "x$JAVAPREFIX" = x; then
cd6d4007 43 test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, ["ecj$EXEEXT $ECJ_OPTS"] ["ecj-3.3$EXEEXT $ECJ_OPTS"] ["ecj-3.2$EXEEXT $ECJ_OPTS"] ["javac$EXEEXT $JAVAC_OPTS"] "gcj$EXEEXT -C")
e0441a5b 44else
cd6d4007 45 test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, ["ecj$EXEEXT $ECJ_OPTS"] ["ecj-3.3$EXEEXT $ECJ_OPTS"] ["ecj-3.2$EXEEXT $ECJ_OPTS"] ["javac$EXEEXT $JAVAC_OPTS"] "gcj$EXEEXT -C", $JAVAPREFIX)
e0441a5b
MK
46fi
47test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH])
cd6d4007 48AC_CACHE_CHECK([if $JAVAC is a version of gcj], ac_cv_prog_javac_is_gcj, [
729530c0 49if $JAVAC --version 2>&1 | grep gcj >&AS_MESSAGE_LOG_FD ; then
cd6d4007
MK
50 ac_cv_prog_javac_is_gcj=yes;
51 JAVAC="$JAVAC $GCJ_OPTS";
729530c0
AJH
52else
53 ac_cv_prog_javac_is_gcj=no;
54fi
55])
cd6d4007
MK
56AC_SUBST(JAVAC_IS_GCJ, $ac_cv_prog_javac_is_gcj)
57AM_CONDITIONAL(GCJ_JAVAC, test x"${JAVAC_IS_GCJ}" = xyes)
e0441a5b
MK
58dnl END GCJ LOCAL
59AC_PROVIDE([$0])dnl
60])