1 dnl @synopsis AC_PROG_JAVA_CC
3 dnl Finds the appropriate java compiler on your path. By preference the
4 dnl java compiler is gcj, then jikes then javac.
6 dnl The macro can take one argument specifying a space separated list
7 dnl of java compiler names.
11 dnl AC_PROG_JAVA_CC(javac, gcj)
13 dnl The macro also sets the compiler options variable: JAVA_CC_OPTS to
14 dnl something sensible:
16 dnl - for GCJ it sets it to: @GCJ_OPTS@
17 dnl (if GCJ_OPTS is not yet defined then it is set to "-C")
19 dnl - no other compiler has applicable options yet
21 dnl Here's an example configure.in:
23 dnl AC_INIT(Makefile.in)
25 dnl AC_OUTPUT(Makefile)
28 dnl And here's the start of the Makefile.in:
30 dnl PROJECT_ROOT := @srcdir@
31 dnl # Tool definitions.
32 dnl JAVAC := @JAVA_CC@
33 dnl JAVAC_OPTS := @JAVA_CC_OPTS@
34 dnl JAR_TOOL := @jar_tool@
37 dnl @author Nic Ferrier <nferrier@tapsellferrier.co.uk>
38 dnl @version 2002-03-04
39 dnl @license GPLWithACException
41 # AC_PROG_JAVA_CC([COMPILER ...])
42 # --------------------------
43 # COMPILER ... is a space separated list of java compilers to search for.
44 # This just gives the user an opportunity to specify an alternative
45 # search list for the java compiler.
46 AC_DEFUN([AC_PROG_JAVA_CC],
47 [AC_ARG_VAR([JAVA_CC], [java compiler command])dnl
48 AC_ARG_VAR([JAVA_CC_FLAGS], [java compiler flags])dnl
50 [AC_CHECK_TOOLS(JAVA_CC, [$1])],
51 [AC_CHECK_TOOL(JAVA_CC, gcj)
52 if test -z "$JAVA_CC"; then
53 AC_CHECK_TOOL(JAVA_CC, javac)
55 if test -z "$JAVA_CC"; then
56 AC_CHECK_TOOL(JAVA_CC, jikes)
60 if test "$JAVA_CC" = "gcj"; then
61 if test "$GCJ_OPTS" = ""; then
64 AC_SUBST(JAVA_CC_OPTS, @GCJ_OPTS@,
65 [Define the compilation options for GCJ])
67 test -z "$JAVA_CC" && AC_MSG_ERROR([no acceptable java compiler found in \$PATH])