# # SYNOPSIS # # AX_SAGA_CHECK_JAVA([MINIMUM-VERSION]) # # DESCRIPTION # # Test for JAVA of a particular version (or newer) # # If no path to the installed java is given, # the macro searchs under /usr, /usr/local, /opt and # $JAVA_HOME # # This macro calls: # # AC_SUBST(HAVE_JAVA) # AC_SUBST(JAVA_HOME) # AC_SUBST(HAVE_ANTLR) # AC_SUBST(ANTLR_JAR) # # LAST MODIFICATION # # 2007-03-04 # # COPYLEFT # # Copyright (c) 2008 Andre Merzky # # Copying and distribution of this file, with or without # modification, are permitted in any medium without royalty provided # the copyright notice and this notice are preserved. AC_DEFUN([AX_SAGA_CHECK_JAVA], [ AC_ARG_VAR([JAVA_HOME],[JAVA home directory]) HAVE_JAVA=no HAVE_ANTLR=no tmp_location="" AC_ARG_WITH([java], AS_HELP_STRING([--with-java=DIR], [use java (default is YES) at DIR (optional)]), [ if test "$withval" = "no"; then want_java="no" elif test "$withval" = "yes"; then want_java="yes" tmp_location="" else want_java="yes" tmp_location="$withval" fi ], [want_java="yes"]) # use JAVA_HOME if avaialble, and if not # overwritten by --with-java= if test "x$want_java" = "xyes"; then # unused # java_lib_version_req=ifelse([$1], ,1.5$1) for tmp_path in $tmp_location $JAVA_HOME /usr /usr/local /opt; do AC_MSG_CHECKING(for java in $tmp_path) if ! test -e $tmp_path/bin/java; then AC_MSG_RESULT(no) else if test -e $tmp_path/share/java/antlr.jar; then HAVE_ANTLR=yes ANTLR_JAR="$tmp_path/share/java/antlr.jar" AC_SUBST(ANTLR_JAR) fi AC_MSG_RESULT(yes) HAVE_JAVA=yes JAVA_HOME=$tmp_path JAVA=$tmp_path/bin/java export HAVE_JAVA AC_SUBST(JAVA_HOME) AC_SUBST(JAVA) if test "$tmp_location" != "" && \ test "$tmp_location" != "$tmp_path" ; then AC_MSG_WARN([JAVA found: not in $tmp_location but in $tmp_path]) fi break; fi # link ok done # foreach path if test "$HAVE_JAVA" == "no" ; then AC_MSG_WARN(JAVA not found) fi fi # want_java AC_SUBST(HAVE_ANTLR) AC_SUBST(HAVE_JAVA) ])