libextractor-java

GNU libextractor
Log | Files | Refs | README | LICENSE

ac_check_class.m4 (3532B)


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