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