changeset 60168:18cc3b9dcebf

8239566: gtest/GTestWrapper.java fails due to "libstlport.so.1: open failed: No such file or directory" Reviewed-by: redestad
author ihse
date Fri, 21 Feb 2020 10:23:51 +0100
parents 9c05db2c5715
children 67268dd9d46a
files make/autoconf/hotspot.m4 make/autoconf/libraries.m4
diffstat 2 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/make/autoconf/hotspot.m4	Thu Feb 20 23:07:02 2020 -0500
+++ b/make/autoconf/hotspot.m4	Fri Feb 21 10:23:51 2020 +0100
@@ -119,25 +119,37 @@
   AC_ARG_ENABLE([hotspot-gtest], [AS_HELP_STRING([--disable-hotspot-gtest],
       [Disables building of the Hotspot unit tests @<:@enabled@:>@])])
 
+  GTEST_AVAILABLE=true
+
+  AC_MSG_CHECKING([if Hotspot gtest test source is present])
   if test -e "${TOPDIR}/test/hotspot/gtest"; then
-    GTEST_DIR_EXISTS="true"
+    AC_MSG_RESULT([yes])
   else
-    GTEST_DIR_EXISTS="false"
+    AC_MSG_RESULT([no, cannot run gtest])
+    GTEST_AVAILABLE=false
+  fi
+
+  # On solaris, we also must have the libstlport.so.1 library, setup in
+  # LIB_SETUP_LIBRARIES.
+  if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
+    if test "x$STLPORT_LIB" = "x"; then
+      GTEST_AVAILABLE=false
+    fi
   fi
 
   AC_MSG_CHECKING([if Hotspot gtest unit tests should be built])
   if test "x$enable_hotspot_gtest" = "xyes"; then
-    if test "x$GTEST_DIR_EXISTS" = "xtrue"; then
+    if test "x$GTEST_AVAILABLE" = "xtrue"; then
       AC_MSG_RESULT([yes, forced])
       BUILD_GTEST="true"
     else
-      AC_MSG_ERROR([Cannot build gtest without the test source])
+      AC_MSG_ERROR([Cannot build gtest with missing dependencies])
     fi
   elif test "x$enable_hotspot_gtest" = "xno"; then
     AC_MSG_RESULT([no, forced])
     BUILD_GTEST="false"
   elif test "x$enable_hotspot_gtest" = "x"; then
-    if test "x$GTEST_DIR_EXISTS" = "xtrue"; then
+    if test "x$GTEST_AVAILABLE" = "xtrue"; then
       AC_MSG_RESULT([yes])
       BUILD_GTEST="true"
     else
--- a/make/autoconf/libraries.m4	Thu Feb 20 23:07:02 2020 -0500
+++ b/make/autoconf/libraries.m4	Fri Feb 21 10:23:51 2020 +0100
@@ -196,7 +196,7 @@
 ################################################################################
 AC_DEFUN_ONCE([LIB_SETUP_SOLARIS_STLPORT],
 [
-  if test "$OPENJDK_TARGET_OS" = "solaris" && test "x$BUILD_GTEST" = "xtrue"; then
+  if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
     # Find the root of the Solaris Studio installation from the compiler path
     SOLARIS_STUDIO_DIR="$(dirname $CC)/.."
     STLPORT_LIB="$SOLARIS_STUDIO_DIR/lib/stlport4$OPENJDK_TARGET_CPU_ISADIR/libstlport.so.1"
@@ -209,8 +209,7 @@
       AC_MSG_RESULT([yes, $STLPORT_LIB])
       BASIC_FIXUP_PATH([STLPORT_LIB])
     else
-      AC_MSG_RESULT([no, not found at $STLPORT_LIB])
-      AC_MSG_ERROR([Failed to find libstlport.so.1, cannot build Hotspot gtests])
+      AC_MSG_RESULT([no, not found at $STLPORT_LIB, cannot build Hotspot gtests])
     fi
     AC_SUBST(STLPORT_LIB)
   fi