[Libreoffice-commits] core.git: configure.ac

Stephan Bergmann sbergman at redhat.com
Mon Feb 24 23:43:23 PST 2014


 configure.ac |   25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

New commits:
commit ded6334f7016cb59dcb140a23339b1ca3418ca8c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 25 08:42:17 2014 +0100

    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

diff --git a/configure.ac b/configure.ac
index 092d4e1..c400d23 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


More information about the Libreoffice-commits mailing list