1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# javacomp.m4 serial 5 (gettext-0.11.4)
dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
# Prerequisites of javacomp.sh.
# Sets HAVE_JAVACOMP to nonempty if javacomp.sh will work.
AC_DEFUN([gt_JAVACOMP],
[
AC_MSG_CHECKING([for Java compiler])
AC_EGREP_CPP(yes, [
#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
yes
#endif
], CLASSPATH_SEPARATOR=';', CLASSPATH_SEPARATOR=':')
HAVE_JAVACOMP=1
if test -n "$JAVAC"; then
ac_result="$JAVAC"
else
pushdef([AC_MSG_CHECKING],[:])dnl
pushdef([AC_CHECKING],[:])dnl
pushdef([AC_MSG_RESULT],[:])dnl
AC_CHECK_PROG(HAVE_GCJ_IN_PATH, gcj, yes)
AC_CHECK_PROG(HAVE_JAVAC_IN_PATH, javac, yes)
AC_CHECK_PROG(HAVE_JIKES_IN_PATH, jikes, yes)
popdef([AC_MSG_RESULT])dnl
popdef([AC_CHECKING])dnl
popdef([AC_MSG_CHECKING])dnl
changequote(,)dnl
# Test for a good gcj version (>= 3.0).
# Exclude some versions of gcj: gcj 3.0.4 compiles GetURL.java to invalid
# bytecode, that crashes with an IllegalAccessError when executed by
# gij 3.0.4 or with a VerifyError when executed by Sun Java. Likewise for
# gcj 3.1.
# I also exclude gcj 3.2, 3.3 etc. because I have no idea when this bug
# will be fixed. FIXME: Check new versions of gcj as they come out.
if test -n "$HAVE_GCJ_IN_PATH" \
&& gcj --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^3\.[0123456789]/d' | grep '^[3-9]' >/dev/null \
&& (
# See if libgcj.jar is well installed.
cat > conftest.java <<EOF
public class conftest {
public static void main (String[] args) {
}
}
EOF
gcj -C -d . conftest.java 2>/dev/null
error=$?
rm -f conftest.java conftest.class
exit $error
); then
HAVE_GCJ_C=1
ac_result="gcj -C"
else
if test -n "$HAVE_JAVAC_IN_PATH" \
&& (javac -version >/dev/null 2>/dev/null || test $? -le 2) \
&& (if javac -help 2>&1 >/dev/null | grep at.dms.kjc.Main >/dev/null && javac -help 2>/dev/null | grep 'released.*2000' >/dev/null ; then exit 1; else exit 0; fi); then
HAVE_JAVAC=1
ac_result="javac"
else
if test -n "$HAVE_JIKES_IN_PATH" \
&& (jikes >/dev/null 2>/dev/null || test $? = 1) \
&& (
# See if the existing CLASSPATH is sufficient to make jikes work.
cat > conftest.java <<EOF
public class conftest {
public static void main (String[] args) {
}
}
EOF
unset JAVA_HOME
jikes conftest.java 2>/dev/null
error=$?
rm -f conftest.java conftest.class
exit $error
); then
HAVE_JIKES=1
ac_result="jikes"
else
HAVE_JAVACOMP=
ac_result="no"
fi
fi
fi
changequote([,])dnl
fi
AC_MSG_RESULT([$ac_result])
AC_SUBST(JAVAC)
AC_SUBST(CLASSPATH)
AC_SUBST(CLASSPATH_SEPARATOR)
AC_SUBST(HAVE_GCJ_C)
AC_SUBST(HAVE_JAVAC)
AC_SUBST(HAVE_JIKES)
])
|