1 #
   2 # Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 ###############################################################################
  27 #
  28 # Check for graalunit libs, needed for running graalunit tests.
  29 #
  30 AC_DEFUN_ONCE([LIB_TESTS_SETUP_GRAALUNIT],
  31 [
  32   AC_ARG_WITH(graalunit-lib, [AS_HELP_STRING([--with-graalunit-lib],
  33       [specify location of 3rd party libraries used by Graal unit tests])])
  34 
  35   GRAALUNIT_LIB=
  36   if test "x${with_graalunit_lib}" != x; then
  37     AC_MSG_CHECKING([for graalunit libs])
  38     if test "x${with_graalunit_lib}" = xno; then
  39       AC_MSG_RESULT([disabled, graalunit tests can not be run])
  40     elif test "x${with_graalunit_lib}" = xyes; then
  41       AC_MSG_RESULT([not specified])
  42       AC_MSG_ERROR([You must specify the path to 3rd party libraries used by Graal unit tests])
  43     else
  44       GRAALUNIT_LIB="${with_graalunit_lib}"
  45       if test ! -d "${GRAALUNIT_LIB}"; then
  46         AC_MSG_RESULT([no])
  47         AC_MSG_ERROR([Could not find graalunit 3rd party libraries as specified. (${with_graalunit_lib})])
  48       else
  49         AC_MSG_RESULT([$GRAALUNIT_LIB])
  50       fi
  51     fi
  52   fi
  53 
  54   BASIC_FIXUP_PATH([GRAALUNIT_LIB])
  55   AC_SUBST(GRAALUNIT_LIB)
  56 ])
  57 
  58 ###############################################################################
  59 #
  60 # Setup and check the Java Microbenchmark Harness
  61 #
  62 AC_DEFUN_ONCE([LIB_TESTS_SETUP_JMH],
  63 [
  64   AC_ARG_WITH(jmh, [AS_HELP_STRING([--with-jmh],
  65       [Java Microbenchmark Harness for building the OpenJDK Microbenchmark Suite])])
  66 
  67   AC_MSG_CHECKING([for jmh (Java Microbenchmark Harness)])
  68   if test "x$with_jmh" = xno || test "x$with_jmh" = x; then
  69     AC_MSG_RESULT([no, disabled])
  70   elif test "x$with_jmh" = xyes; then
  71     AC_MSG_RESULT([no, error])
  72     AC_MSG_ERROR([--with-jmh requires a directory containing all jars needed by JMH])
  73   else
  74     # Path specified
  75     JMH_HOME="$with_jmh"
  76     if test ! -d [$JMH_HOME]; then
  77       AC_MSG_RESULT([no, error])
  78       AC_MSG_ERROR([$JMH_HOME does not exist or is not a directory])
  79     fi
  80     BASIC_FIXUP_PATH([JMH_HOME])
  81 
  82     jar_names="jmh-core jmh-generator-annprocess jopt-simple commons-math3"
  83     for jar in $jar_names; do
  84       found_jar_files=$($ECHO $(ls $JMH_HOME/$jar-*.jar 2> /dev/null))
  85 
  86       if test "x$found_jar_files" = x; then
  87         AC_MSG_RESULT([no])
  88         AC_MSG_ERROR([--with-jmh does not contain $jar-*.jar])
  89       elif ! test -e "$found_jar_files"; then
  90         AC_MSG_RESULT([no])
  91         AC_MSG_ERROR([--with-jmh contain multiple $jar-*.jar: $found_jar_files])
  92       fi
  93 
  94       found_jar_var_name=found_${jar//-/_}
  95       eval $found_jar_var_name='"'$found_jar_files'"'
  96     done
  97     AC_MSG_RESULT([yes])
  98 
  99     JMH_CORE_JAR=$found_jmh_core
 100     JMH_GENERATOR_JAR=$found_jmh_generator_annprocess
 101     JMH_JOPT_SIMPLE_JAR=$found_jopt_simple
 102     JMH_COMMONS_MATH_JAR=$found_commons_math3
 103 
 104 
 105     if [ [[ "$JMH_CORE_JAR" =~ jmh-core-(.*)\.jar$ ]] ] ; then
 106       JMH_VERSION=${BASH_REMATCH[[1]]}
 107     else
 108       JMH_VERSION=unknown
 109     fi
 110 
 111     AC_MSG_NOTICE([JMH core version: $JMH_VERSION])
 112   fi
 113 
 114   AC_SUBST(JMH_CORE_JAR)
 115   AC_SUBST(JMH_GENERATOR_JAR)
 116   AC_SUBST(JMH_JOPT_SIMPLE_JAR)
 117   AC_SUBST(JMH_COMMONS_MATH_JAR)
 118   AC_SUBST(JMH_VERSION)
 119 ])