ac_prog_java_works.m4 (3036B)
1 dnl @synopsis AC_PROG_JAVA_WORKS 2 dnl 3 dnl Internal use ONLY. 4 dnl 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 9 dnl submission. 10 dnl The general documentation, as well as the sample configure.in, is 11 dnl included in the AC_PROG_JAVA macro. 12 dnl 13 dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr> 14 dnl @version $Id: ac_prog_java_works.m4,v 1.2 1999/12/29 09:58:48 bortz Exp $ 15 dnl 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, [ 20 dnl /** 21 dnl * Test.java: used to test if java compiler works. 22 dnl */ 23 dnl public class Test 24 dnl { 25 dnl 26 dnl public static void 27 dnl main( String[] argv ) 28 dnl { 29 dnl System.exit (0); 30 dnl } 31 dnl 32 dnl } 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= 42 ==== 43 EOF 44 if uudecode$EXEEXT Test.uue; then 45 ac_cv_prog_uudecode_base64=yes 46 else 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 51 fi 52 rm -f Test.uue]) 53 fi 54 if test x$ac_cv_prog_uudecode_base64 != xyes; then 55 rm -f Test.class 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]) 59 fi 60 if test x$ac_cv_prog_javac_works = x; then 61 AC_PROG_JAVAC 62 fi 63 fi 64 AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ 65 JAVA_TEST=Test.java 66 CLASS_TEST=Test.class 67 TEST=Test 68 changequote(, )dnl 69 cat << \EOF > $JAVA_TEST 70 /* [#]line __oline__ "configure" */ 71 public class Test { 72 public static void main (String args[]) { 73 System.exit (0); 74 } } 75 EOF 76 changequote([, ])dnl 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 79 : 80 else 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?)) 84 fi 85 fi 86 if AC_TRY_COMMAND($JAVA $JAVAFLAGS $TEST) >/dev/null 2>&1; then 87 ac_cv_prog_java_works=yes 88 else 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?)) 92 fi 93 rm -fr $JAVA_TEST $CLASS_TEST Test.uue 94 ]) 95 AC_PROVIDE([$0])dnl 96 ] 97 )