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 1.3 2000/01/28 11:54:26 bortz 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]) 108dnl @synopsis AC_PROG_JAVA 109dnl 110dnl Here is a summary of the main macros: 111dnl 112dnl AC_PROG_JAVAC: finds a Java compiler. 113dnl 114dnl AC_PROG_JAVA: finds a Java virtual machine. 115dnl 116dnl AC_CHECK_CLASS: finds if we have the given class (beware of CLASSPATH!). 117dnl 118dnl AC_CHECK_RQRD_CLASS: finds if we have the given class and stops otherwise. 119dnl 120dnl AC_TRY_COMPILE_JAVA: attempt to compile user given source. 121dnl 122dnl AC_TRY_RUN_JAVA: attempt to compile and run user given source. 123dnl 124dnl AC_JAVA_OPTIONS: adds Java configure options. 125dnl 126dnl AC_PROG_JAVA tests an existing Java virtual machine. It uses the 127dnl environment variable JAVA then tests in sequence various common Java 128dnl virtual machines. For political reasons, it starts with the free ones. 129dnl You *must* call [AC_PROG_JAVAC] before. 130dnl 131dnl If you want to force a specific VM: 132dnl 133dnl - at the configure.in level, set JAVA=yourvm before calling AC_PROG_JAVA 134dnl (but after AC_INIT) 135dnl 136dnl - at the configure level, setenv JAVA 137dnl 138dnl You can use the JAVA variable in your Makefile.in, with @JAVA@. 139dnl 140dnl *Warning*: its success or failure can depend on a proper setting of the 141dnl CLASSPATH env. variable. 142dnl 143dnl TODO: allow to exclude virtual machines (rationale: most Java programs 144dnl cannot run with some VM like kaffe). 145dnl 146dnl Note: This is part of the set of autoconf M4 macros for Java programs. 147dnl It is VERY IMPORTANT that you download the whole set, some 148dnl macros depend on other. Unfortunately, the autoconf archive does not 149dnl support the concept of set of macros, so I had to break it for 150dnl submission. 151dnl 152dnl A Web page, with a link to the latest CVS snapshot is at 153dnl <http://www.internatif.org/bortzmeyer/autoconf-Java/>. 154dnl 155dnl This is a sample configure.in 156dnl Process this file with autoconf to produce a configure script. 157dnl 158dnl AC_INIT(UnTag.java) 159dnl 160dnl dnl Checks for programs. 161dnl AC_CHECK_CLASSPATH 162dnl AC_PROG_JAVAC 163dnl AC_PROG_JAVA 164dnl 165dnl dnl Checks for classes 166dnl AC_CHECK_RQRD_CLASS(org.xml.sax.Parser) 167dnl AC_CHECK_RQRD_CLASS(com.jclark.xml.sax.Driver) 168dnl 169dnl AC_OUTPUT(Makefile) 170dnl 171dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr> 172dnl @version $Id: ac_prog_java.m4,v 1.5 2000/01/02 16:07:12 bortz Exp $ 173dnl 174AC_DEFUN([AC_PROG_JAVA],[ 175AC_REQUIRE([AC_EXEEXT])dnl 176if test x$JAVAPREFIX = x; then 177 test x$JAVA = x && AC_CHECK_PROGS(JAVA, kaffe$EXEEXT java$EXEEXT) 178else 179 test x$JAVA = x && AC_CHECK_PROGS(JAVA, kaffe$EXEEXT java$EXEEXT, $JAVAPREFIX) 180fi 181test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH]) 182AC_PROG_JAVA_WORKS 183AC_PROVIDE([$0])dnl 184]) 185dnl @synopsis AC_PROG_JAVAC_WORKS 186dnl 187dnl Internal use ONLY. 188dnl 189dnl Note: This is part of the set of autoconf M4 macros for Java programs. 190dnl It is VERY IMPORTANT that you download the whole set, some 191dnl macros depend on other. Unfortunately, the autoconf archive does not 192dnl support the concept of set of macros, so I had to break it for 193dnl submission. 194dnl The general documentation, as well as the sample configure.in, is 195dnl included in the AC_PROG_JAVA macro. 196dnl 197dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr> 198dnl @version $Id: ac_prog_javac_works.m4,v 1.2 1999/12/29 09:58:48 bortz Exp $ 199dnl 200AC_DEFUN([AC_PROG_JAVAC_WORKS],[ 201AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [ 202JAVA_TEST=Test.java 203CLASS_TEST=Test.class 204cat << \EOF > $JAVA_TEST 205/* [#]line __oline__ "configure" */ 206public class Test { 207} 208EOF 209if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then 210 ac_cv_prog_javac_works=yes 211else 212 AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)]) 213 echo "configure: failed program was:" >&AC_FD_CC 214 cat $JAVA_TEST >&AC_FD_CC 215fi 216rm -f $JAVA_TEST $CLASS_TEST 217]) 218AC_PROVIDE([$0])dnl 219]) 220dnl @synopsis AC_CHECK_CLASSPATH 221dnl 222dnl AC_CHECK_CLASSPATH just displays the CLASSPATH, for the edification 223dnl of the user. 224dnl 225dnl Note: This is part of the set of autoconf M4 macros for Java programs. 226dnl It is VERY IMPORTANT that you download the whole set, some 227dnl macros depend on other. Unfortunately, the autoconf archive does not 228dnl support the concept of set of macros, so I had to break it for 229dnl submission. 230dnl The general documentation, as well as the sample configure.in, is 231dnl included in the AC_PROG_JAVA macro. 232dnl 233dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr> 234dnl @version $Id: ac_check_classpath.m4,v 1.3 1999/12/29 10:45:03 bortz Exp $ 235dnl 236AC_DEFUN([AC_CHECK_CLASSPATH],[ 237if test "x$CLASSPATH" = x; then 238 echo "You have no CLASSPATH, I hope it is good" 239else 240 echo "You have CLASSPATH $CLASSPATH, hope it is correct" 241fi 242]) 243 244 245 246dnl @synopsis AC_PROG_JAVA_WORKS 247dnl 248dnl Internal use ONLY. 249dnl 250dnl Note: This is part of the set of autoconf M4 macros for Java programs. 251dnl It is VERY IMPORTANT that you download the whole set, some 252dnl macros depend on other. Unfortunately, the autoconf archive does not 253dnl support the concept of set of macros, so I had to break it for 254dnl submission. 255dnl The general documentation, as well as the sample configure.in, is 256dnl included in the AC_PROG_JAVA macro. 257dnl 258dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr> 259dnl @version $Id: ac_prog_java_works.m4,v 1.2 1999/12/29 09:58:48 bortz Exp $ 260dnl 261AC_DEFUN([AC_PROG_JAVA_WORKS], [ 262AC_CHECK_PROG(uudecode, uudecode$EXEEXT, yes) 263if test x$uudecode = xyes; then 264AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ 265dnl /** 266dnl * Test.java: used to test if java compiler works. 267dnl */ 268dnl public class Test 269dnl { 270dnl 271dnl public static void 272dnl main( String[] argv ) 273dnl { 274dnl System.exit (0); 275dnl } 276dnl 277dnl } 278cat << \EOF > Test.uue 279begin-base64 644 Test.class 280yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE 281bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 282bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s 283YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG 284aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB 285AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB 286AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= 287==== 288EOF 289if uudecode$EXEEXT Test.uue; then 290 ac_cv_prog_uudecode_base64=yes 291else 292 echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC 293 echo "configure: failed file was:" >&AC_FD_CC 294 cat Test.uue >&AC_FD_CC 295 ac_cv_prog_uudecode_base64=no 296fi 297rm -f Test.uue]) 298fi 299if test x$ac_cv_prog_uudecode_base64 != xyes; then 300 rm -f Test.class 301 AC_MSG_WARN([I have to compile Test.class from scratch]) 302 if test x$ac_cv_prog_javac_works = xno; then 303 AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) 304 fi 305 if test x$ac_cv_prog_javac_works = x; then 306 AC_PROG_JAVAC 307 fi 308fi 309AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ 310JAVA_TEST=Test.java 311CLASS_TEST=Test.class 312TEST=Test 313changequote(, )dnl 314cat << \EOF > $JAVA_TEST 315/* [#]line __oline__ "configure" */ 316public class Test { 317public static void main (String args[]) { 318 System.exit (0); 319} } 320EOF 321changequote([, ])dnl 322if test x$ac_cv_prog_uudecode_base64 != xyes; then 323 if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then 324 : 325 else 326 echo "configure: failed program was:" >&AC_FD_CC 327 cat $JAVA_TEST >&AC_FD_CC 328 AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) 329 fi 330fi 331if AC_TRY_COMMAND($JAVA $JAVAFLAGS $TEST) >/dev/null 2>&1; then 332 ac_cv_prog_java_works=yes 333else 334 echo "configure: failed program was:" >&AC_FD_CC 335 cat $JAVA_TEST >&AC_FD_CC 336 AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) 337fi 338rm -fr $JAVA_TEST $CLASS_TEST Test.uue 339]) 340AC_PROVIDE([$0])dnl 341] 342) 343dnl @synopsis AC_CHECK_RQRD_CLASS 344dnl 345dnl AC_CHECK_RQRD_CLASS tests the existence of a given Java class, either in 346dnl a jar or in a '.class' file and fails if it doesn't exist. 347dnl Its success or failure can depend on a proper setting of the 348dnl CLASSPATH env. variable. 349dnl 350dnl Note: This is part of the set of autoconf M4 macros for Java programs. 351dnl It is VERY IMPORTANT that you download the whole set, some 352dnl macros depend on other. Unfortunately, the autoconf archive does not 353dnl support the concept of set of macros, so I had to break it for 354dnl submission. 355dnl The general documentation, as well as the sample configure.in, is 356dnl included in the AC_PROG_JAVA macro. 357dnl 358dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr> 359dnl @version $Id: ac_check_rqrd_class.m4,v 1.1 1999/12/29 09:22:26 bortz Exp $ 360dnl 361 362AC_DEFUN([AC_CHECK_RQRD_CLASS],[ 363CLASS=`echo $1|sed 's/\./_/g'` 364AC_CHECK_CLASS($1) 365if test "$HAVE_LAST_CLASS" = "no"; then 366 AC_MSG_ERROR([Required class $1 missing, exiting.]) 367fi 368]) 369dnl @synopsis AC_PROG_JAVAC 370dnl 371dnl AC_PROG_JAVAC tests an existing Java compiler. It uses the environment 372dnl variable JAVAC then tests in sequence various common Java compilers. For 373dnl political reasons, it starts with the free ones. 374dnl 375dnl If you want to force a specific compiler: 376dnl 377dnl - at the configure.in level, set JAVAC=yourcompiler before calling 378dnl AC_PROG_JAVAC 379dnl 380dnl - at the configure level, setenv JAVAC 381dnl 382dnl You can use the JAVAC variable in your Makefile.in, with @JAVAC@. 383dnl 384dnl *Warning*: its success or failure can depend on a proper setting of the 385dnl CLASSPATH env. variable. 386dnl 387dnl TODO: allow to exclude compilers (rationale: most Java programs cannot compile 388dnl with some compilers like guavac). 389dnl 390dnl Note: This is part of the set of autoconf M4 macros for Java programs. 391dnl It is VERY IMPORTANT that you download the whole set, some 392dnl macros depend on other. Unfortunately, the autoconf archive does not 393dnl support the concept of set of macros, so I had to break it for 394dnl submission. 395dnl The general documentation, as well as the sample configure.in, is 396dnl included in the AC_PROG_JAVA macro. 397dnl 398dnl @author Stephane Bortzmeyer <bortzmeyer@pasteur.fr> 399dnl @version $Id: ac_prog_javac.m4,v 1.3 1999/12/29 10:46:15 bortz Exp $ 400dnl 401AC_DEFUN([AC_PROG_JAVAC],[ 402AC_REQUIRE([AC_EXEEXT])dnl 403if test "x$JAVAPREFIX" = x; then 404 test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, "gcj$EXEEXT -C" guavac$EXEEXT jikes$EXEEXT javac$EXEEXT) 405else 406 test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, "gcj$EXEEXT -C" guavac$EXEEXT jikes$EXEEXT javac$EXEEXT, $JAVAPREFIX) 407fi 408test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH]) 409AC_PROG_JAVAC_WORKS 410AC_PROVIDE([$0])dnl 411]) 412dnl @synopsis AC_JAVA_OPTIONS 413dnl 414dnl AC_JAVA_OPTIONS adds configure command line options used for Java m4 415dnl macros. This Macro is optional. 416dnl 417dnl Note: This is part of the set of autoconf M4 macros for Java programs. 418dnl It is VERY IMPORTANT that you download the whole set, some 419dnl macros depend on other. Unfortunately, the autoconf archive does not 420dnl support the concept of set of macros, so I had to break it for 421dnl submission. 422dnl The general documentation, as well as the sample configure.in, is 423dnl included in the AC_PROG_JAVA macro. 424dnl 425dnl @author Devin Weaver <ktohg@tritarget.com> 426dnl @version $Id: ac_java_options.m4,v 1.2 2000/01/02 16:07:12 bortz Exp $ 427dnl 428AC_DEFUN([AC_JAVA_OPTIONS],[ 429AC_ARG_WITH(java-prefix, 430 [ --with-java-prefix=PFX prefix where Java runtime is installed (optional)]) 431AC_ARG_WITH(javac-flags, 432 [ --with-javac-flags=FLAGS flags to pass to the Java compiler (optional)]) 433AC_ARG_WITH(java-flags, 434 [ --with-java-flags=FLAGS flags to pass to the Java VM (optional)]) 435JAVAPREFIX=$with_java_prefix 436JAVACFLAGS=$with_javac_flags 437JAVAFLAGS=$with_java_flags 438AC_SUBST(JAVAPREFIX)dnl 439AC_SUBST(JAVACFLAGS)dnl 440AC_SUBST(JAVAFLAGS)dnl 441AC_SUBST(JAVA)dnl 442AC_SUBST(JAVAC)dnl 443]) 444dnl @synopsis AC_TRY_COMPILE_JAVA 445dnl 446dnl AC_TRY_COMPILE_JAVA attempt to compile user given source. 447dnl 448dnl *Warning*: its success or failure can depend on a proper setting of the 449dnl CLASSPATH env. variable. 450dnl 451dnl Note: This is part of the set of autoconf M4 macros for Java programs. 452dnl It is VERY IMPORTANT that you download the whole set, some 453dnl macros depend on other. Unfortunately, the autoconf archive does not 454dnl support the concept of set of macros, so I had to break it for 455dnl submission. 456dnl The general documentation, as well as the sample configure.in, is 457dnl included in the AC_PROG_JAVA macro. 458dnl 459dnl @author Devin Weaver <ktohg@tritarget.com> 460dnl @version $Id: ac_try_compile_java.m4,v 1.1 1999/12/29 09:59:34 bortz Exp $ 461dnl 462AC_DEFUN([AC_TRY_COMPILE_JAVA],[ 463AC_REQUIRE([AC_PROG_JAVAC])dnl 464cat << \EOF > Test.java 465/* [#]line __oline__ "configure" */ 466ifelse([$1], , , [import $1;]) 467public class Test { 468[$2] 469} 470EOF 471if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class 472then 473dnl Don't remove the temporary files here, so they can be examined. 474 ifelse([$3], , :, [$3]) 475else 476 echo "configure: failed program was:" >&AC_FD_CC 477 cat Test.java >&AC_FD_CC 478ifelse([$4], , , [ rm -fr Test* 479 $4 480])dnl 481fi 482rm -fr Test*]) 483dnl @synopsis AC_TRY_RUN_JAVA 484dnl 485dnl AC_TRY_RUN_JAVA attempt to compile and run user given source. 486dnl 487dnl *Warning*: its success or failure can depend on a proper setting of the 488dnl CLASSPATH env. variable. 489dnl 490dnl Note: This is part of the set of autoconf M4 macros for Java programs. 491dnl It is VERY IMPORTANT that you download the whole set, some 492dnl macros depend on other. Unfortunately, the autoconf archive does not 493dnl support the concept of set of macros, so I had to break it for 494dnl submission. 495dnl The general documentation, as well as the sample configure.in, is 496dnl included in the AC_PROG_JAVA macro. 497dnl 498dnl @author Devin Weaver <ktohg@tritarget.com> 499dnl @version $Id: ac_try_run_java.m4,v 1.1 1999/12/29 09:59:34 bortz Exp $ 500dnl 501AC_DEFUN([AC_TRY_RUN_JAVA],[ 502AC_REQUIRE([AC_PROG_JAVAC])dnl 503AC_REQUIRE([AC_PROG_JAVA])dnl 504cat << \EOF > Test.java 505/* [#]line __oline__ "configure" */ 506ifelse([$1], , , [include $1;]) 507public class Test { 508[$2] 509} 510EOF 511if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class && ($JAVA $JAVAFLAGS Test; exit) 2>/dev/null 512then 513dnl Don't remove the temporary files here, so they can be examined. 514 ifelse([$3], , :, [$3]) 515else 516 echo "configure: failed program was:" >&AC_FD_CC 517 cat Test.java >&AC_FD_CC 518ifelse([$4], , , [ rm -fr Test* 519 $4 520])dnl 521fi 522rm -fr Test*]) 523dnl @synopsis AC_PROG_JAVAH 524dnl 525dnl AC_PROG_JAVAH tests the availability of the javah header generator 526dnl and looks for the jni.h header file. If available, JAVAH is set to 527dnl the full path of javah and CPPFLAGS is updated accordingly. 528dnl 529dnl @author Luc Maisonobe 530dnl @version $Id: ac_prog_javah.m4,v 1.2 2000/07/19 13:03:32 simons Exp $ 531dnl 532AC_DEFUN([AC_PROG_JAVAH],[ 533AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl 534AC_REQUIRE([AC_PROG_CPP])dnl 535AC_PATH_PROG(JAVAH,javah) 536if test x"`eval 'echo $ac_cv_path_JAVAH'`" != x ; then 537 AC_TRY_CPP([#include <jni.h>],,[ 538 ac_save_CPPFLAGS="$CPPFLAGS" 539changequote(, )dnl 540 ac_dir=`echo $ac_cv_path_JAVAH | sed 's,\(.*\)/[^/]*/[^/]*$,\1/include,'` 541 ac_machdep=`echo $build_os | sed 's,[-0-9].*,,'` 542changequote([, ])dnl 543 CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep" 544 AC_TRY_CPP([#include <jni.h>], 545 ac_save_CPPFLAGS="$CPPFLAGS", 546 AC_MSG_WARN([unable to include <jni.h>])) 547 CPPFLAGS="$ac_save_CPPFLAGS"]) 548fi]) 549dnl @synopsis AC_JNI_INCLUDE_DIR 550dnl 551dnl AC_JNI_INCLUDE_DIR finds include directories needed 552dnl for compiling programs using the JNI interface. 553dnl 554dnl JNI include directories are usually in the java distribution 555dnl This is deduced from the value of JAVAC. When this macro 556dnl completes, a list of directories is left in the variable 557dnl JNI_INCLUDE_DIRS. 558dnl 559dnl Example usage follows: 560dnl 561dnl AC_JNI_INCLUDE_DIR 562dnl 563dnl for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS 564dnl do 565dnl CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR" 566dnl done 567dnl 568dnl If you want to force a specific compiler: 569dnl 570dnl - at the configure.in level, set JAVAC=yourcompiler before calling 571dnl AC_JNI_INCLUDE_DIR 572dnl 573dnl - at the configure level, setenv JAVAC 574dnl 575dnl Note: This macro can work with the autoconf M4 macros for Java programs. 576dnl This particular macro is not part of the original set of macros. 577dnl 578dnl @author Don Anderson <dda@sleepycat.com> 579dnl @version $Id: ac_jni_include_dirs.m4,v 1.1 2001/09/20 11:58:31 simons Exp $ 580dnl 581AC_DEFUN([AC_JNI_INCLUDE_DIR],[ 582 583JNI_INCLUDE_DIRS="" 584 585test "x$JAVAC" = x && AC_MSG_ERROR(['$JAVAC' undefined]) 586AC_PATH_PROG(_ACJNI_JAVAC, $JAVAC, no) 587test "x$_ACJNI_JAVAC" = xno && AC_MSG_ERROR([$JAVAC could not be found in path]) 588 589_ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC") 590_JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'` 591case "$host_os" in 592 darwin*) _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` 593 _JINC="$_JTOPDIR/Headers";; 594 *) _JINC="$_JTOPDIR/include";; 595esac 596if test -f "$_JINC/jni.h"; then 597 JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC" 598else 599 _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` 600 if test -f "$_JTOPDIR/include/jni.h"; then 601 JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include" 602 else 603 AC_MSG_ERROR([cannot find java include files]) 604 fi 605fi 606 607# get the likely subdirectories for system specific java includes 608case "$host_os" in 609bsdi*) _JNI_INC_SUBDIRS="bsdos";; 610linux*) _JNI_INC_SUBDIRS="linux genunix";; 611osf*) _JNI_INC_SUBDIRS="alpha";; 612solaris*) _JNI_INC_SUBDIRS="solaris";; 613*) _JNI_INC_SUBDIRS="genunix";; 614esac 615 616# add any subdirectories that are present 617for JINCSUBDIR in $_JNI_INC_SUBDIRS 618do 619 if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then 620 JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR" 621 fi 622done 623]) 624 625# _ACJNI_FOLLOW_SYMLINKS <path> 626# Follows symbolic links on <path>, 627# finally setting variable _ACJNI_FOLLOWED 628# -------------------- 629AC_DEFUN([_ACJNI_FOLLOW_SYMLINKS],[ 630# find the include directory relative to the javac executable 631_cur="$1" 632while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do 633 AC_MSG_CHECKING(symlink for $_cur) 634 _slink=`ls -ld "$_cur" | sed 's/.* -> //'` 635 case "$_slink" in 636 /*) _cur="$_slink";; 637 # 'X' avoids triggering unwanted echo options. 638 *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";; 639 esac 640 AC_MSG_RESULT($_cur) 641done 642_ACJNI_FOLLOWED="$_cur" 643])# _ACJNI 644dnl @synopsis AC_PROG_JAVADOC 645dnl 646dnl AC_PROG_JAVADOC tests for an existing javadoc generator. It uses the environment 647dnl variable JAVADOC then tests in sequence various common javadoc generator. 648dnl 649dnl If you want to force a specific compiler: 650dnl 651dnl - at the configure.in level, set JAVADOC=yourgenerator before calling 652dnl AC_PROG_JAVADOC 653dnl 654dnl - at the configure level, setenv JAVADOC 655dnl 656dnl You can use the JAVADOC variable in your Makefile.in, with @JAVADOC@. 657dnl 658dnl Note: This macro depends on the autoconf M4 macros for Java programs. 659dnl It is VERY IMPORTANT that you download that whole set, some 660dnl macros depend on other. Unfortunately, the autoconf archive does not 661dnl support the concept of set of macros, so I had to break it for 662dnl submission. 663dnl 664dnl The general documentation of those macros, as well as the sample 665dnl configure.in, is included in the AC_PROG_JAVA macro. 666dnl 667dnl @author Egon Willighagen <egonw@sci.kun.nl> 668dnl @version $Id: ac_prog_javadoc.m4,v 1.2 2000/07/19 13:03:32 simons Exp $ 669dnl 670AC_DEFUN([AC_PROG_JAVADOC],[ 671AC_REQUIRE([AC_EXEEXT])dnl 672if test "x$JAVAPREFIX" = x; then 673 test "x$JAVADOC" = x && AC_CHECK_PROGS(JAVADOC, javadoc$EXEEXT) 674else 675 test "x$JAVADOC" = x && AC_CHECK_PROGS(JAVADOC, javadoc, $JAVAPREFIX) 676fi 677test "x$JAVADOC" = x && AC_MSG_ERROR([no acceptable javadoc generator found in \$PATH]) 678AC_PROVIDE([$0])dnl 679]) 680 681dnl @synopsis AC_PROG_JAR 682dnl 683dnl AC_PROG_JAR tests for an existing jar program. It uses the environment 684dnl variable JAR then tests in sequence various common jar programs. 685dnl 686dnl If you want to force a specific compiler: 687dnl 688dnl - at the configure.in level, set JAR=yourcompiler before calling 689dnl AC_PROG_JAR 690dnl 691dnl - at the configure level, setenv JAR 692dnl 693dnl You can use the JAR variable in your Makefile.in, with @JAR@. 694dnl 695dnl Note: This macro depends on the autoconf M4 macros for Java programs. 696dnl It is VERY IMPORTANT that you download that whole set, some 697dnl macros depend on other. Unfortunately, the autoconf archive does not 698dnl support the concept of set of macros, so I had to break it for 699dnl submission. 700dnl 701dnl The general documentation of those macros, as well as the sample 702dnl configure.in, is included in the AC_PROG_JAVA macro. 703dnl 704dnl @author Egon Willighagen <egonw@sci.kun.nl> 705dnl @version $Id: ac_prog_jar.m4,v 1.2 2000/07/19 13:03:32 simons Exp $ 706dnl 707AC_DEFUN([AC_PROG_JAR],[ 708AC_REQUIRE([AC_EXEEXT])dnl 709if test "x$JAVAPREFIX" = x; then 710 test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar$EXEEXT) 711else 712 test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar, $JAVAPREFIX) 713fi 714test "x$JAR" = x && AC_MSG_ERROR([no acceptable jar program found in \$PATH]) 715AC_PROVIDE([$0])dnl 716]) 717