dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_check_class.html dnl AC_DEFUN([AC_CHECK_CLASS],[ AC_REQUIRE([AC_PROG_JAVA]) ac_var_name=`echo $1 | sed 's/\./_/g'` dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is dnl dynamic I need an extra level of extraction AC_MSG_CHECKING([for $1 class]) AC_CACHE_VAL(ac_cv_class_$ac_var_name, [ if test x$ac_cv_prog_uudecode_base64 = xyes; then dnl /** dnl * Test.java: used to test dynamicaly if a class exists. dnl */ dnl public class Test dnl { dnl dnl public static void dnl main( String[] argv ) dnl { dnl Class lib; dnl if (argv.length < 1) dnl { dnl System.err.println ("Missing argument"); dnl System.exit (77); dnl } dnl try dnl { dnl lib = Class.forName (argv[0]); dnl } dnl catch (ClassNotFoundException e) dnl { dnl System.exit (1); dnl } dnl lib = null; dnl System.exit (0); dnl } dnl dnl } cat << \EOF > Test.uue begin-base64 644 Test.class yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA JwAAAAIAKA== ==== EOF if uudecode$EXEEXT Test.uue; then : else echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC echo "configure: failed file was:" >&AC_FD_CC cat Test.uue >&AC_FD_CC ac_cv_prog_uudecode_base64=no fi rm -f Test.uue if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then eval "ac_cv_class_$ac_var_name=yes" else eval "ac_cv_class_$ac_var_name=no" fi rm -f Test.class else AC_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"], [eval "ac_cv_class_$ac_var_name=no"]) fi eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`" HAVE_LAST_CLASS=$ac_var_val if test x$ac_var_val = xyes; then ifelse([$2], , :, [$2]) else ifelse([$3], , :, [$3]) fi ]) dnl for some reason the above statment didn't fall though here? dnl do scripts have variable scoping? eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" AC_MSG_RESULT($ac_var_val) ]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_check_classpath.html dnl AC_DEFUN([AC_CHECK_CLASSPATH],[ if test "x$CLASSPATH" = x; then echo "You have no CLASSPATH, I hope it is good" else echo "You have CLASSPATH $CLASSPATH, hope it is correct" fi ]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_check_java_home.html dnl AC_DEFUN([AC_CHECK_JAVA_HOME],[ AC_REQUIRE([AC_EXEEXT])dnl TRY_JAVA_HOME=`ls -dr /usr/java/* 2> /dev/null | head -n 1` if test x$TRY_JAVA_HOME != x; then PATH=$PATH:$TRY_JAVA_HOME/bin fi AC_PATH_PROG(JAVA_PATH_NAME, java$EXEEXT) if test x$JAVA_PATH_NAME != x; then JAVA_HOME=`echo $JAVA_PATH_NAME | sed "s/\(.*\)[[/]]bin[[/]]java$EXEEXT$/\1/"` fi;dnl ]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_check_junit.html dnl AC_DEFUN([AC_CHECK_JUNIT],[ AC_CACHE_VAL(ac_cv_prog_JUNIT,[ AC_CHECK_CLASS(junit.textui.TestRunner) if test x"`eval 'echo $ac_cv_class_junit_textui_TestRunner'`" != xno ; then ac_cv_prog_JUNIT='$(CLASSPATH_ENV) $(JAVA) $(JAVAFLAGS) junit.textui.TestRunner' fi]) AC_MSG_CHECKING([for junit]) if test x"`eval 'echo $ac_cv_prog_JUNIT'`" != x ; then JUNIT="$ac_cv_prog_JUNIT" JAVA_JUNIT='$(JAVA_JUNIT)' TESTS_JUNIT='$(TESTS_JUNIT)' else JUNIT= JAVA_JUNIT= TESTS_JUNIT= fi AC_MSG_RESULT($JAVA_JUNIT) AC_SUBST(JUNIT) AC_SUBST(JAVA_JUNIT) AC_SUBST(TESTS_JUNIT)]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_check_rqrd_class.html dnl AC_DEFUN([AC_CHECK_RQRD_CLASS],[ CLASS=`echo $1|sed 's/\./_/g'` AC_CHECK_CLASS($1) if test "$HAVE_LAST_CLASS" = "no"; then AC_MSG_ERROR([Required class $1 missing, exiting.]) fi ]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_java_options.html dnl AC_DEFUN([AC_JAVA_OPTIONS],[ AC_ARG_WITH(java-prefix, [ --with-java-prefix=PFX prefix where Java runtime is installed (optional)]) AC_ARG_WITH(javac-flags, [ --with-javac-flags=FLAGS flags to pass to the Java compiler (optional)]) AC_ARG_WITH(java-flags, [ --with-java-flags=FLAGS flags to pass to the Java VM (optional)]) JAVAPREFIX=$with_java_prefix JAVACFLAGS=$with_javac_flags JAVAFLAGS=$with_java_flags AC_SUBST(JAVAPREFIX)dnl AC_SUBST(JAVACFLAGS)dnl AC_SUBST(JAVAFLAGS)dnl AC_SUBST(JAVA)dnl AC_SUBST(JAVAC)dnl ]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_jar.html dnl AC_DEFUN([AC_PROG_JAR],[ AC_REQUIRE([AC_EXEEXT])dnl if test "x$JAVAPREFIX" = x; then test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar$EXEEXT) else test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar, $JAVAPREFIX) fi test "x$JAR" = x && AC_MSG_ERROR([no acceptable jar program found in \$PATH]) AC_PROVIDE([$0])dnl ]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_java_cc.html dnl # AC_PROG_JAVA_CC([COMPILER ...]) # -------------------------- # COMPILER ... is a space separated list of java compilers to search for. # This just gives the user an opportunity to specify an alternative # search list for the java compiler. AC_DEFUN([AC_PROG_JAVA_CC], [AC_ARG_VAR([JAVA_CC], [java compiler command])dnl AC_ARG_VAR([JAVA_CC_FLAGS], [java compiler flags])dnl m4_ifval([$1], [AC_CHECK_TOOLS(JAVA_CC, [$1])], [AC_CHECK_TOOL(JAVA_CC, gcj) if test -z "$JAVA_CC"; then AC_CHECK_TOOL(JAVA_CC, javac) fi if test -z "$JAVA_CC"; then AC_CHECK_TOOL(JAVA_CC, jikes) fi ]) if test "$JAVA_CC" = "gcj"; then if test "$GCJ_OPTS" = ""; then AC_SUBST(GCJ_OPTS,-C) fi AC_SUBST(JAVA_CC_OPTS, @GCJ_OPTS@, [Define the compilation options for GCJ]) fi test -z "$JAVA_CC" && AC_MSG_ERROR([no acceptable java compiler found in \$PATH]) ])# AC_PROG_JAVA_CC dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_javac.html dnl AC_DEFUN([AC_PROG_JAVAC],[ AC_REQUIRE([AC_EXEEXT])dnl if test "x$JAVAPREFIX" = x; then test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, "gcj$EXEEXT -C" guavac$EXEEXT jikes$EXEEXT javac$EXEEXT) else test "x$JAVAC" = x && AC_CHECK_PROGS(JAVAC, "gcj$EXEEXT -C" guavac$EXEEXT jikes$EXEEXT javac$EXEEXT, $JAVAPREFIX) fi test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH]) AC_PROG_JAVAC_WORKS AC_PROVIDE([$0])dnl ]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_javac_works.html dnl AC_DEFUN([AC_PROG_JAVAC_WORKS],[ AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [ JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST /* [#]line __oline__ "configure" */ public class Test { } EOF if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then ac_cv_prog_javac_works=yes else AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)]) echo "configure: failed program was:" >&AC_FD_CC cat $JAVA_TEST >&AC_FD_CC fi rm -f $JAVA_TEST $CLASS_TEST ]) AC_PROVIDE([$0])dnl ]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_javadoc.html dnl AC_DEFUN([AC_PROG_JAVADOC],[ AC_REQUIRE([AC_EXEEXT])dnl if test "x$JAVAPREFIX" = x; then test "x$JAVADOC" = x && AC_CHECK_PROGS(JAVADOC, javadoc$EXEEXT) else test "x$JAVADOC" = x && AC_CHECK_PROGS(JAVADOC, javadoc, $JAVAPREFIX) fi test "x$JAVADOC" = x && AC_MSG_ERROR([no acceptable javadoc generator found in \$PATH]) AC_PROVIDE([$0])dnl ]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_javah.html dnl AC_DEFUN([AC_PROG_JAVAH],[ AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl AC_REQUIRE([AC_PROG_CPP])dnl AC_PATH_PROG(JAVAH,javah) if test x"`eval 'echo $ac_cv_path_JAVAH'`" != x ; then AC_TRY_CPP([#include ],,[ ac_save_CPPFLAGS="$CPPFLAGS" changequote(, )dnl ac_dir=`echo $ac_cv_path_JAVAH | sed 's,\(.*\)/[^/]*/[^/]*$,\1/include,'` ac_machdep=`echo $build_os | sed 's,[-0-9].*,,' | sed 's,cygwin,win32,'` changequote([, ])dnl CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep" AC_TRY_CPP([#include ], ac_save_CPPFLAGS="$CPPFLAGS", AC_MSG_WARN([unable to include ])) CPPFLAGS="$ac_save_CPPFLAGS"]) fi]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_java.html dnl AC_DEFUN([AC_PROG_JAVA],[ AC_REQUIRE([AC_EXEEXT])dnl if test x$JAVAPREFIX = x; then test x$JAVA = x && AC_CHECK_PROGS(JAVA, kaffe$EXEEXT java$EXEEXT) else test x$JAVA = x && AC_CHECK_PROGS(JAVA, kaffe$EXEEXT java$EXEEXT, $JAVAPREFIX) fi test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH]) AC_PROG_JAVA_WORKS AC_PROVIDE([$0])dnl ]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_java_works.html dnl AC_DEFUN([AC_PROG_JAVA_WORKS], [ AC_CHECK_PROG(uudecode, uudecode$EXEEXT, yes) if test x$uudecode = xyes; then AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ dnl /** dnl * Test.java: used to test if java compiler works. dnl */ dnl public class Test dnl { dnl dnl public static void dnl main( String[] argv ) dnl { dnl System.exit (0); dnl } dnl dnl } cat << \EOF > Test.uue begin-base64 644 Test.class yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= ==== EOF if uudecode$EXEEXT Test.uue; then ac_cv_prog_uudecode_base64=yes else echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC echo "configure: failed file was:" >&AC_FD_CC cat Test.uue >&AC_FD_CC ac_cv_prog_uudecode_base64=no fi rm -f Test.uue]) fi if test x$ac_cv_prog_uudecode_base64 != xyes; then rm -f Test.class AC_MSG_WARN([I have to compile Test.class from scratch]) if test x$ac_cv_prog_javac_works = xno; then AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) fi if test x$ac_cv_prog_javac_works = x; then AC_PROG_JAVAC fi fi AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ JAVA_TEST=Test.java CLASS_TEST=Test.class TEST=Test changequote(, )dnl cat << \EOF > $JAVA_TEST /* [#]line __oline__ "configure" */ public class Test { public static void main (String args[]) { System.exit (0); } } EOF changequote([, ])dnl if test x$ac_cv_prog_uudecode_base64 != xyes; then if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then : else echo "configure: failed program was:" >&AC_FD_CC cat $JAVA_TEST >&AC_FD_CC AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) fi fi if AC_TRY_COMMAND($JAVA $JAVAFLAGS $TEST) >/dev/null 2>&1; then ac_cv_prog_java_works=yes else echo "configure: failed program was:" >&AC_FD_CC cat $JAVA_TEST >&AC_FD_CC AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) fi rm -fr $JAVA_TEST $CLASS_TEST Test.uue ]) AC_PROVIDE([$0])dnl ] ) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_try_compile_java.html dnl AC_DEFUN([AC_TRY_COMPILE_JAVA],[ AC_REQUIRE([AC_PROG_JAVAC])dnl cat << \EOF > Test.java /* [#]line __oline__ "configure" */ ifelse([$1], , , [import $1;]) public class Test { [$2] } EOF if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class then dnl Don't remove the temporary files here, so they can be examined. ifelse([$3], , :, [$3]) else echo "configure: failed program was:" >&AC_FD_CC cat Test.java >&AC_FD_CC ifelse([$4], , , [ rm -fr Test* $4 ])dnl fi rm -fr Test*]) dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_try_run_javac.html dnl AC_DEFUN([AC_TRY_RUN_JAVA],[ AC_REQUIRE([AC_PROG_JAVAC])dnl AC_REQUIRE([AC_PROG_JAVA])dnl cat << \EOF > Test.java /* [#]line __oline__ "configure" */ ifelse([$1], , , [include $1;]) public class Test { [$2] } EOF if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class && ($JAVA $JAVAFLAGS Test; exit) 2>/dev/null then dnl Don't remove the temporary files here, so they can be examined. ifelse([$3], , :, [$3]) else echo "configure: failed program was:" >&AC_FD_CC cat Test.java >&AC_FD_CC ifelse([$4], , , [ rm -fr Test* $4 ])dnl fi rm -fr Test*])