1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html
3 # ===========================================================================
11 # Finds the appropriate java compiler on your path. By preference the java
12 # compiler is gcj, then jikes then javac.
14 # The macro can take one argument specifying a space separated list of
15 # java compiler names.
19 # AX_PROG_JAVA_CC(javac, gcj)
21 # The macro also sets the compiler options variable: JAVA_CC_OPTS to
24 # - for GCJ it sets it to: @GCJ_OPTS@
25 # (if GCJ_OPTS is not yet defined then it is set to "-C")
27 # - no other compiler has applicable options yet
29 # Here's an example configure.in:
31 # AC_INIT(Makefile.in)
36 # And here's the start of the Makefile.in:
38 # PROJECT_ROOT := @srcdir@
41 # JAVAC_OPTS := @JAVA_CC_OPTS@
42 # JAR_TOOL := @jar_tool@
46 # Copyright (c) 2008 Nic Ferrier <nferrier@tapsellferrier.co.uk>
48 # This program is free software; you can redistribute it and/or modify it
49 # under the terms of the GNU General Public License as published by the
50 # Free Software Foundation; either version 2 of the License, or (at your
51 # option) any later version.
53 # This program is distributed in the hope that it will be useful, but
54 # WITHOUT ANY WARRANTY; without even the implied warranty of
55 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
56 # Public License for more details.
58 # You should have received a copy of the GNU General Public License along
59 # with this program. If not, see <http://www.gnu.org/licenses/>.
61 # As a special exception, the respective Autoconf Macro's copyright owner
62 # gives unlimited permission to copy, distribute and modify the configure
63 # scripts that are the output of Autoconf when processing the Macro. You
64 # need not follow the terms of the GNU General Public License when using
65 # or distributing such scripts, even though portions of the text of the
66 # Macro appear in them. The GNU General Public License (GPL) does govern
67 # all other use of the material that constitutes the Autoconf Macro.
69 # This special exception to the GPL applies to versions of the Autoconf
70 # Macro released by the Autoconf Archive. When you make and distribute a
71 # modified version of the Autoconf Macro, you may extend this special
72 # exception to the GPL to apply to your modified version as well.
76 # AX_PROG_JAVA_CC([COMPILER ...])
77 # --------------------------
78 # COMPILER ... is a space separated list of java compilers to search for.
79 # This just gives the user an opportunity to specify an alternative
80 # search list for the java compiler.
81 AU_ALIAS([AC_PROG_JAVA_CC], [AX_PROG_JAVA_CC])
82 AC_DEFUN([AX_PROG_JAVA_CC],
83 [AC_ARG_VAR([JAVA_CC], [java compiler command])dnl
84 AC_ARG_VAR([JAVA_CC_FLAGS], [java compiler flags])dnl
86 [AC_CHECK_TOOLS(JAVA_CC, [$1])],
87 [AC_CHECK_TOOL(JAVA_CC, gcj)
88 if test -z "$JAVA_CC"; then
89 AC_CHECK_TOOL(JAVA_CC, javac)
91 if test -z "$JAVA_CC"; then
92 AC_CHECK_TOOL(JAVA_CC, jikes)
96 if test "$JAVA_CC" = "gcj"; then
97 if test "$GCJ_OPTS" = ""; then
100 AC_SUBST(JAVA_CC_OPTS, @GCJ_OPTS@,
101 [Define the compilation options for GCJ])
103 test -z "$JAVA_CC" && AC_MSG_ERROR([no acceptable java compiler found in \$PATH])