summaryrefslogtreecommitdiff
path: root/aclocal
diff options
context:
space:
mode:
authorDavid Reiss <dreiss@apache.org>2009-05-12 23:16:53 +0000
committerDavid Reiss <dreiss@apache.org>2009-05-12 23:16:53 +0000
commiteaa8d7e565a4ee4a1aa9357bebdaec023a540717 (patch)
treedfca8b5c212807fdab5245c3640d1c4d78bb6fab /aclocal
parentaf3b6309b5fcb2c650a730ed8d655c9d3205a178 (diff)
downloadthrift-eaa8d7e565a4ee4a1aa9357bebdaec023a540717.tar.gz
Extend ax_javac_and_java.m4 to test for specific classes
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@774130 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'aclocal')
-rw-r--r--aclocal/ax_javac_and_java.m433
1 files changed, 28 insertions, 5 deletions
diff --git a/aclocal/ax_javac_and_java.m4 b/aclocal/ax_javac_and_java.m4
index 3c8577f46..03ab08e46 100644
--- a/aclocal/ax_javac_and_java.m4
+++ b/aclocal/ax_javac_and_java.m4
@@ -1,20 +1,24 @@
dnl @synopsis AX_JAVAC_AND_JAVA
+dnl @synopsis AX_CHECK_JAVA_CLASS(CLASSNAME)
dnl
-dnl Test for the presence of a JDK.
+dnl Test for the presence of a JDK, and (optionally) specific classes.
dnl
dnl If "JAVA" is defined in the environment, that will be the only
dnl java command tested. Otherwise, a hard-coded list will be used.
dnl Similarly for "JAVAC".
dnl
-dnl This macro does not currenly support testing for a particular
-dnl Java version, the presence of a particular class, testing for
-dnl only one of "java" and "javac", or compiling or running
-dnl user-provided Java code.
+dnl AX_JAVAC_AND_JAVA does not currenly support testing for a particular
+dnl Java version, testing for only one of "java" and "javac", or
+dnl compiling or running user-provided Java code.
dnl
dnl After AX_JAVAC_AND_JAVA runs, the shell variables "success" and
dnl "ax_javac_and_java" are set to "yes" or "no", and "JAVAC" and
dnl "JAVA" are set to the appropriate commands.
dnl
+dnl AX_CHECK_JAVA_CLASS must be run after AX_JAVAC_AND_JAVA.
+dnl It tests for the presence of a class based on a fully-qualified name.
+dnl It sets the shell variable "success" to "yes" or "no".
+dnl
dnl @category Java
dnl @version 2009-02-09
dnl @license AllPermissive
@@ -82,3 +86,22 @@ AC_DEFUN([AX_JAVAC_AND_JAVA],
ax_javac_and_java="$success"
])
+
+
+AC_DEFUN([AX_CHECK_JAVA_CLASS],
+ [
+ AC_MSG_CHECKING(for Java class [$1])
+
+ echo "import $1; public class configtest_ax_javac_and_java { public static void main(String args@<:@@:>@) { } }" > configtest_ax_javac_and_java.java
+
+ echo "Running \"$JAVAC configtest_ax_javac_and_java.java\"" >&AS_MESSAGE_LOG_FD
+ if $JAVAC configtest_ax_javac_and_java.java >&AS_MESSAGE_LOG_FD 2>&1 ; then
+ AC_MSG_RESULT(yes)
+ success=yes
+ else
+ AC_MSG_RESULT(no)
+ success=no
+ fi
+
+ rm -f configtest_ax_javac_and_java.java configtest_ax_javac_and_java.class
+ ])