1dnl @synopsis AC_CHECK_CLASS 2dnl 3dnl AC_CHECK_CLASS tests the existence of a given Java class, either in 4dnl a jar or in a '.class' file. 5dnl 6dnl *Warning*: its success or failure can depend on a proper setting of the 7dnl CLASSPATH env. variable. 8dnl 9dnl Note: This is part of the set of autoconf M4 macros for Java programs. 10dnl It is VERY IMPORTANT that you download the whole set, some 11dnl macros depend on other. Unfortunately, the autoconf archive does not 12dnl support the concept of set of macros, so I had to break it for 13dnl submission. 14dnl The general documentation, as well as the sample configure.in, is 15dnl included in the AC_PROG_JAVA macro. 16dnl 17dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr> 18dnl @version $Id: ac_check_class.m4,v 12.0 2004/11/17 03:43:38 bostic Exp $ 19dnl 20AC_DEFUN([AC_CHECK_CLASS],[ 21AC_REQUIRE([AC_PROG_JAVA]) 22ac_var_name=`echo $1 | sed 's/\./_/g'` 23dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is 24dnl dynamic I need an extra level of extraction 25AC_MSG_CHECKING([for $1 class]) 26AC_CACHE_VAL(ac_cv_class_$ac_var_name, [ 27if test x$ac_cv_prog_uudecode_base64 = xyes; then 28dnl /** 29dnl * Test.java: used to test dynamicaly if a class exists. 30dnl */ 31dnl public class Test 32dnl { 33dnl 34dnl public static void 35dnl main( String[] argv ) 36dnl { 37dnl Class lib; 38dnl if (argv.length < 1) 39dnl { 40dnl System.err.println ("Missing argument"); 41dnl System.exit (77); 42dnl } 43dnl try 44dnl { 45dnl lib = Class.forName (argv[0]); 46dnl } 47dnl catch (ClassNotFoundException e) 48dnl { 49dnl System.exit (1); 50dnl } 51dnl lib = null; 52dnl System.exit (0); 53dnl } 54dnl 55dnl } 56cat << \EOF > Test.uue 57begin-base64 644 Test.class 58yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE 59bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 60bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ 61AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt 62ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV 63ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp 64VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM 65amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi 66AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B 67AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA 68AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN 69uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK 70AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA 71JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA 72JwAAAAIAKA== 73==== 74EOF 75 if uudecode$EXEEXT Test.uue; then 76 : 77 else 78 echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC 79 echo "configure: failed file was:" >&AC_FD_CC 80 cat Test.uue >&AC_FD_CC 81 ac_cv_prog_uudecode_base64=no 82 fi 83 rm -f Test.uue 84 if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then 85 eval "ac_cv_class_$ac_var_name=yes" 86 else 87 eval "ac_cv_class_$ac_var_name=no" 88 fi 89 rm -f Test.class 90else 91 AC_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"], 92 [eval "ac_cv_class_$ac_var_name=no"]) 93fi 94eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" 95eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`" 96HAVE_LAST_CLASS=$ac_var_val 97if test x$ac_var_val = xyes; then 98 ifelse([$2], , :, [$2]) 99else 100 ifelse([$3], , :, [$3]) 101fi 102]) 103dnl for some reason the above statment didn't fall though here? 104dnl do scripts have variable scoping? 105eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" 106AC_MSG_RESULT($ac_var_val) 107]) 108