ax_prog_javac.m4 revision 237944f3
1# ===========================================================================
2#       http://www.gnu.org/software/autoconf-archive/ax_prog_javac.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7#   AX_PROG_JAVAC
8#
9# DESCRIPTION
10#
11#   AX_PROG_JAVAC tests an existing Java compiler. It uses the environment
12#   variable JAVAC then tests in sequence various common Java compilers. For
13#   political reasons, it starts with the free ones.
14#
15#   If you want to force a specific compiler:
16#
17#   - at the configure.in level, set JAVAC=yourcompiler before calling
18#   AX_PROG_JAVAC
19#
20#   - at the configure level, setenv JAVAC
21#
22#   You can use the JAVAC variable in your Makefile.in, with @JAVAC@.
23#
24#   *Warning*: its success or failure can depend on a proper setting of the
25#   CLASSPATH env. variable.
26#
27#   TODO: allow to exclude compilers (rationale: most Java programs cannot
28#   compile with some compilers like guavac).
29#
30#   Note: This is part of the set of autoconf M4 macros for Java programs.
31#   It is VERY IMPORTANT that you download the whole set, some macros depend
32#   on other. Unfortunately, the autoconf archive does not support the
33#   concept of set of macros, so I had to break it for submission. The
34#   general documentation, as well as the sample configure.in, is included
35#   in the AX_PROG_JAVA macro.
36#
37# LICENSE
38#
39#   Copyright (c) 2008 Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
40#
41#   This program is free software; you can redistribute it and/or modify it
42#   under the terms of the GNU General Public License as published by the
43#   Free Software Foundation; either version 2 of the License, or (at your
44#   option) any later version.
45#
46#   This program is distributed in the hope that it will be useful, but
47#   WITHOUT ANY WARRANTY; without even the implied warranty of
48#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
49#   Public License for more details.
50#
51#   You should have received a copy of the GNU General Public License along
52#   with this program. If not, see <http://www.gnu.org/licenses/>.
53#
54#   As a special exception, the respective Autoconf Macro's copyright owner
55#   gives unlimited permission to copy, distribute and modify the configure
56#   scripts that are the output of Autoconf when processing the Macro. You
57#   need not follow the terms of the GNU General Public License when using
58#   or distributing such scripts, even though portions of the text of the
59#   Macro appear in them. The GNU General Public License (GPL) does govern
60#   all other use of the material that constitutes the Autoconf Macro.
61#
62#   This special exception to the GPL applies to versions of the Autoconf
63#   Macro released by the Autoconf Archive. When you make and distribute a
64#   modified version of the Autoconf Macro, you may extend this special
65#   exception to the GPL to apply to your modified version as well.
66
67#serial 7
68
69AU_ALIAS([AC_PROG_JAVAC], [AX_PROG_JAVAC])
70AC_DEFUN([AX_PROG_JAVAC],[
71m4_define([m4_ax_prog_javac_list],["gcj -C" guavac jikes javac])dnl
72AS_IF([test "x$JAVAPREFIX" = x],
73      [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list])],
74      [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list], [], [$JAVAPREFIX/bin])])
75m4_undefine([m4_ax_prog_javac_list])dnl
76test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH])
77AX_PROG_JAVAC_WORKS
78AC_PROVIDE([$0])dnl
79])
80