1
dnl @synopsis AC_PROG_JAVA_WORKS
5
dnl Note: This is part of the set of autoconf M4 macros for Java programs.
6
dnl It is VERY IMPORTANT that you download the whole set, some
7
dnl macros depend on other. Unfortunately, the autoconf archive does not
8
dnl support the concept of set of macros, so I had to break it for
10
dnl The general documentation, as well as the sample configure.in, is
11
dnl included in the AC_PROG_JAVA macro.
13
dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
16
AC_DEFUN([AC_PROG_JAVA_WORKS], [
17
AC_CHECK_PROG(uudecode, uudecode$EXEEXT, yes)
18
if test x$uudecode = xyes; then
19
AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [
21
dnl * Test.java: used to test if java compiler works.
26
dnl public static void
27
dnl main( String[] argv )
33
cat << \EOF > Test.uue
34
begin-base64 644 Test.class
35
yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
36
bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
37
bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s
38
YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG
39
aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB
40
AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB
41
AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ=
44
if uudecode$EXEEXT Test.uue; then
45
ac_cv_prog_uudecode_base64=yes
47
echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC
48
echo "configure: failed file was:" >&AC_FD_CC
49
cat Test.uue >&AC_FD_CC
50
ac_cv_prog_uudecode_base64=no
54
if test x$ac_cv_prog_uudecode_base64 != xyes; then
56
AC_MSG_WARN([I have to compile Test.class from scratch])
57
if test x$ac_cv_prog_javac_works = xno; then
58
AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly])
60
if test x$ac_cv_prog_javac_works = x; then
64
AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [
69
cat << \EOF > $JAVA_TEST
70
/* [#]line __oline__ "configure" */
72
public static void main (String args[]) {
77
if test x$ac_cv_prog_uudecode_base64 != xyes; then
78
if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then
81
echo "configure: failed program was:" >&AC_FD_CC
82
cat $JAVA_TEST >&AC_FD_CC
83
AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?))
86
if AC_TRY_COMMAND($JAVA $JAVAFLAGS $TEST) >/dev/null 2>&1; then
87
ac_cv_prog_java_works=yes
89
echo "configure: failed program was:" >&AC_FD_CC
90
cat $JAVA_TEST >&AC_FD_CC
91
AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?))
93
rm -fr $JAVA_TEST $CLASS_TEST Test.uue