1dnl @synopsis AC_PROG_JAVA_WORKS 2dnl 3dnl Internal use ONLY. 4dnl 5dnl Note: This is part of the set of autoconf M4 macros for Java programs. 6dnl It is VERY IMPORTANT that you download the whole set, some 7dnl macros depend on other. Unfortunately, the autoconf archive does not 8dnl support the concept of set of macros, so I had to break it for 9dnl submission. 10dnl The general documentation, as well as the sample configure.in, is 11dnl included in the AC_PROG_JAVA macro. 12dnl 13dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr> 14dnl @version $Id: ac_prog_java_works.m4,v 12.0 2004/11/17 03:43:38 bostic Exp $ 15dnl 16AC_DEFUN([AC_PROG_JAVA_WORKS], [ 17AC_CHECK_PROG(uudecode, uudecode$EXEEXT, yes) 18if test x$uudecode = xyes; then 19AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ 20dnl /** 21dnl * Test.java: used to test if java compiler works. 22dnl */ 23dnl public class Test 24dnl { 25dnl 26dnl public static void 27dnl main( String[] argv ) 28dnl { 29dnl System.exit (0); 30dnl } 31dnl 32dnl } 33cat << \EOF > Test.uue 34begin-base64 644 Test.class 35yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE 36bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 37bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s 38YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG 39aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB 40AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB 41AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= 42==== 43EOF 44if uudecode$EXEEXT Test.uue; then 45 ac_cv_prog_uudecode_base64=yes 46else 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 51fi 52rm -f Test.uue]) 53fi 54if 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 63fi 64AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ 65JAVA_TEST=Test.java 66CLASS_TEST=Test.class 67TEST=Test 68changequote(, )dnl 69cat << \EOF > $JAVA_TEST 70/* [#]line __oline__ "configure" */ 71public class Test { 72public static void main (String args[]) { 73 System.exit (0); 74} } 75EOF 76changequote([, ])dnl 77if 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 85fi 86if AC_TRY_COMMAND($JAVA $JAVAFLAGS $TEST) >/dev/null 2>&1; then 87 ac_cv_prog_java_works=yes 88else 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?)) 92fi 93rm -fr $JAVA_TEST $CLASS_TEST Test.uue 94]) 95AC_PROVIDE([$0])dnl 96] 97) 98