summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-02-25 08:42:17 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-02-25 08:42:51 +0100
commitded6334f7016cb59dcb140a23339b1ca3418ca8c (patch)
tree508e1268d9f7bf804807759e6171c1d68a8ec8b4 /configure.ac
parent4a9347fa320d892b60fd03082925f63a1d69cfb9 (diff)
Make JUnit/Hamcrest detection more flexible
...so it accepts a hand-crafted junit.jar that references the hamcrest jar on its manifest class-path. Change-Id: I9a6c7c1be8cd4a70c263de0f799973baf8d2b951
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac25
1 files changed, 9 insertions, 16 deletions
diff --git a/configure.ac b/configure.ac
index 092d4e128c55..c400d23112b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11923,24 +11923,17 @@ if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
if test "$_os" = "WINNT"; then
OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
fi
- "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" 2>&5 | \
- grep org/junit/Before.class > /dev/null 2>&5
- if test $? -eq 0; then
- # check if either class-path entry is available for hamcrest or
- # it's bundled
- if "$JAVA_HOME/bin/jar" tf "$OOO_JUNIT_JAR" |$GREP -q hamcrest || \
- "$UNZIP" -c "$OOO_JUNIT_JAR" META-INF/MANIFEST.MF |$GREP 'Class-Path:' | $GREP -q 'hamcrest'; then
- AC_MSG_RESULT([$OOO_JUNIT_JAR])
- else
- AC_MSG_ERROR([your junit jar neither sets a classpath nor includes hamcrest; please
-provide a full junit jar or use --without-junit])
- fi
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
-location (/usr/share/java), specify its pathname via
+ printf 'import org.junit.Before; import org.hamcrest.BaseDescription;' \
+ > conftest.java
+ if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
+ AC_MSG_RESULT([$OOO_JUNIT_JAR])
+ else
+ AC_MSG_ERROR(
+[cannot find JUnit 4 jar, or JUnit 4 jar does not provide Hamcrest; please
+install one in the default location (/usr/share/java), specify its pathname via
--with-junit=..., or disable it via --without-junit])
fi
+ rm -f conftestj.class conftestj.java
if test $OOO_JUNIT_JAR != ""; then
BUILD_TYPE="$BUILD_TYPE QADEVOOO"
fi