]> git.sesse.net Git - vlc/blob - m4/ac_prog_java_cc.m4
vlc-config: fixed optimizations by splitting CFLAGS_OPTIM into CFLAGS_OPTIM_SIZE...
[vlc] / m4 / ac_prog_java_cc.m4
1 dnl @synopsis AC_PROG_JAVA_CC
2 dnl
3 dnl Finds the appropriate java compiler on your path. By preference the
4 dnl java compiler is gcj, then jikes then javac.
5 dnl
6 dnl The macro can take one argument specifying a space separated list
7 dnl of java compiler names.
8 dnl
9 dnl For example:
10 dnl
11 dnl   AC_PROG_JAVA_CC(javac, gcj)
12 dnl
13 dnl The macro also sets the compiler options variable: JAVA_CC_OPTS to
14 dnl something sensible:
15 dnl
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")
18 dnl
19 dnl  - no other compiler has applicable options yet
20 dnl
21 dnl Here's an example configure.in:
22 dnl
23 dnl   AC_INIT(Makefile.in)
24 dnl   AC_PROG_JAVA_CC()
25 dnl   AC_OUTPUT(Makefile)
26 dnl   dnl End.
27 dnl
28 dnl And here's the start of the Makefile.in:
29 dnl
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@
35 dnl
36 dnl @category Java
37 dnl @author Nic Ferrier <nferrier@tapsellferrier.co.uk>
38 dnl @version 2002-03-04
39 dnl @license GPLWithACException
40
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
49 m4_ifval([$1],
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)
54 fi
55 if test -z "$JAVA_CC"; then
56   AC_CHECK_TOOL(JAVA_CC, jikes)
57 fi
58 ])
59
60 if test "$JAVA_CC" = "gcj"; then
61    if test "$GCJ_OPTS" = ""; then
62       AC_SUBST(GCJ_OPTS,-C)
63    fi
64    AC_SUBST(JAVA_CC_OPTS, @GCJ_OPTS@,
65         [Define the compilation options for GCJ])
66 fi
67 test -z "$JAVA_CC" && AC_MSG_ERROR([no acceptable java compiler found in \$PATH])
68 ])# AC_PROG_JAVA_CC