2012-05-09 05:13:49 +04:00
|
|
|
dnl -*- shell-script -*-
|
|
|
|
dnl
|
|
|
|
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
dnl University Research and Technology
|
|
|
|
dnl Corporation. All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2006 The University of Tennessee and The University
|
|
|
|
dnl of Tennessee Research Foundation. All rights
|
|
|
|
dnl reserved.
|
|
|
|
dnl Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
|
|
|
dnl University of Stuttgart. All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2006 The Regents of the University of California.
|
|
|
|
dnl All rights reserved.
|
|
|
|
dnl Copyright (c) 2006-2012 Los Alamos National Security, LLC. All rights
|
2015-06-24 06:59:57 +03:00
|
|
|
dnl reserved.
|
2012-05-09 05:13:49 +04:00
|
|
|
dnl Copyright (c) 2007-2012 Oracle and/or its affiliates. All rights reserved.
|
2013-11-05 07:31:07 +04:00
|
|
|
dnl Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved.
|
2013-10-26 23:43:32 +04:00
|
|
|
dnl Copyright (c) 2013 Intel, Inc. All rights reserved.
|
2015-02-03 09:19:22 +03:00
|
|
|
dnl Copyright (c) 2015 Research Organization for Information Science
|
|
|
|
dnl and Technology (RIST). All rights reserved.
|
2017-05-31 07:26:45 +03:00
|
|
|
dnl Copyright (c) 2017 FUJITSU LIMITED. All rights reserved.
|
2012-05-09 05:13:49 +04:00
|
|
|
dnl $COPYRIGHT$
|
2015-06-24 06:59:57 +03:00
|
|
|
dnl
|
2012-05-09 05:13:49 +04:00
|
|
|
dnl Additional copyrights may follow
|
2015-06-24 06:59:57 +03:00
|
|
|
dnl
|
2012-05-09 05:13:49 +04:00
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
|
|
|
|
|
|
|
# This macro is necessary to get the title to be displayed first. :-)
|
2013-10-26 23:43:32 +04:00
|
|
|
AC_DEFUN([OPAL_SETUP_JAVA_BANNER],[
|
2015-06-24 06:59:57 +03:00
|
|
|
opal_show_subtitle "Java compiler"
|
2012-05-09 05:13:49 +04:00
|
|
|
])
|
|
|
|
|
2013-10-26 23:43:32 +04:00
|
|
|
# OPAL_SETUP_JAVA()
|
2012-05-09 05:13:49 +04:00
|
|
|
# ----------------
|
|
|
|
# Do everything required to setup the Java compiler. Safe to AC_REQUIRE
|
|
|
|
# this macro.
|
2013-10-26 23:43:32 +04:00
|
|
|
AC_DEFUN([OPAL_SETUP_JAVA],[
|
|
|
|
AC_REQUIRE([OPAL_SETUP_JAVA_BANNER])
|
2012-05-09 05:13:49 +04:00
|
|
|
|
2013-12-28 21:03:59 +04:00
|
|
|
OPAL_VAR_SCOPE_PUSH([opal_java_bad opal_java_found opal_java_dir opal_java_jnih opal_java_PATH_save opal_java_CPPFLAGS_save])
|
2012-05-23 23:51:27 +04:00
|
|
|
AC_ARG_ENABLE(java,
|
|
|
|
AC_HELP_STRING([--enable-java],
|
|
|
|
[Enable Java-based support in the system - use this option to disable all Java-based compiler tests (default: enabled)]))
|
|
|
|
|
2012-05-09 05:13:49 +04:00
|
|
|
AC_ARG_WITH(jdk-dir,
|
|
|
|
AC_HELP_STRING([--with-jdk-dir(=DIR)],
|
|
|
|
[Location of the JDK header directory. If you use this option, do not specify --with-jdk-bindir or --with-jdk-headers.]))
|
|
|
|
AC_ARG_WITH(jdk-bindir,
|
|
|
|
AC_HELP_STRING([--with-jdk-bindir(=DIR)],
|
|
|
|
[Location of the JDK bin directory. If you use this option, you must also use --with-jdk-headers (and you must NOT use --with-jdk-dir)]))
|
|
|
|
AC_ARG_WITH(jdk-headers,
|
|
|
|
AC_HELP_STRING([--with-jdk-headers(=DIR)],
|
|
|
|
[Location of the JDK header directory. If you use this option, you must also use --with-jdk-bindir (and you must NOT use --with-jdk-dir)]))
|
|
|
|
|
2012-05-23 23:51:27 +04:00
|
|
|
if test "$enable_java" = "no"; then
|
|
|
|
HAVE_JAVA_SUPPORT=0
|
2013-10-26 23:43:32 +04:00
|
|
|
opal_java_happy=no
|
2012-05-23 23:51:27 +04:00
|
|
|
else
|
|
|
|
# Check for bozo case: ensure a directory was specified
|
2015-02-03 09:19:22 +03:00
|
|
|
AS_IF([test "$with_jdk_dir" = "yes" || test "$with_jdk_dir" = "no"],
|
2012-05-23 23:51:27 +04:00
|
|
|
[AC_MSG_WARN([Must specify a directory name for --with-jdk-dir])
|
|
|
|
AC_MSG_ERROR([Cannot continue])])
|
2015-02-03 09:19:22 +03:00
|
|
|
AS_IF([test "$with_jdk_bindir" = "yes" || test "$with_jdk_bindir" = "no"],
|
2012-05-23 23:51:27 +04:00
|
|
|
[AC_MSG_WARN([Must specify a directory name for --with-jdk-bindir])
|
|
|
|
AC_MSG_ERROR([Cannot continue])])
|
2015-02-03 09:19:22 +03:00
|
|
|
AS_IF([test "$with_jdk_headers" = "yes" || test "$with_jdk_headers" = "no"],
|
2012-05-23 23:51:27 +04:00
|
|
|
[AC_MSG_WARN([Must specify a directory name for --with-jdk-headers])
|
|
|
|
AC_MSG_ERROR([Cannot continue])])
|
|
|
|
|
|
|
|
# Check for bozo case: either specify --with-jdk-dir or
|
|
|
|
# (--with-jdk-bindir, --with-jdk-headers) -- not both.
|
2013-12-21 02:42:49 +04:00
|
|
|
opal_java_bad=0
|
2015-02-03 09:19:22 +03:00
|
|
|
AS_IF([test -n "$with_jdk_dir" && \
|
|
|
|
(test -n "$with_jdk_bindir" || test -n "$with_jdk_headers")],
|
2013-12-21 02:42:49 +04:00
|
|
|
[opal_java_bad=1])
|
2015-02-03 09:19:22 +03:00
|
|
|
AS_IF([(test -z "$with_jdk_bindir" && test -n "$with_jdk_headers") || \
|
|
|
|
(test -n "$with_jdk_bindir" && test -z "$with_jdk_headers")],
|
2013-12-21 02:42:49 +04:00
|
|
|
[opal_java_bad=1])
|
|
|
|
AS_IF([test "$opal_java_bad" = "1"],
|
2012-05-23 23:51:27 +04:00
|
|
|
[AC_MSG_WARN([Either specify --with-jdk-dir or both of (--with-jdk_bindir, --with-jdk-headers) -- not both.])
|
|
|
|
AC_MSG_ERROR([Cannot continue])])
|
|
|
|
|
|
|
|
AS_IF([test -n "$with_jdk_dir"],
|
|
|
|
[with_jdk_bindir=$with_jdk_dir/bin
|
|
|
|
with_jdk_headers=$with_jdk_dir/include])
|
|
|
|
|
|
|
|
##################################################################
|
|
|
|
# with_jdk_dir can now be ignored; with_jdk_bindir and
|
|
|
|
# with_jdk_headers will be either empty or have valid values.
|
|
|
|
##################################################################
|
|
|
|
|
|
|
|
# Some java installations are in obscure places. So let's
|
|
|
|
# hard-code a few of the common ones so that users don't have to
|
|
|
|
# specify --with-java-<foo>=LONG_ANNOYING_DIRECTORY.
|
|
|
|
AS_IF([test -z "$with_jdk_bindir"],
|
|
|
|
[ # OS X Snow Leopard and Lion (10.6 and 10.7 -- did not
|
|
|
|
# check prior versions)
|
2013-12-21 02:42:49 +04:00
|
|
|
opal_java_found=0
|
2015-12-05 13:51:51 +03:00
|
|
|
AS_IF([test -x /usr/libexec/java_home],
|
|
|
|
[opal_java_dir=`/usr/libexec/java_home`/include],
|
|
|
|
[opal_java_dir=/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers])
|
2012-05-23 23:51:27 +04:00
|
|
|
AC_MSG_CHECKING([OSX locations])
|
2013-12-21 02:42:49 +04:00
|
|
|
AS_IF([test -d $opal_java_dir],
|
|
|
|
[AC_MSG_RESULT([found ($opal_java_dir)])
|
|
|
|
opal_java_found=1
|
2015-06-24 06:59:57 +03:00
|
|
|
with_jdk_headers=$opal_java_dir
|
2012-05-23 23:51:27 +04:00
|
|
|
with_jdk_bindir=/usr/bin],
|
2012-05-18 05:02:01 +04:00
|
|
|
[AC_MSG_RESULT([not found])])
|
2012-05-09 05:13:49 +04:00
|
|
|
|
2013-12-21 02:42:49 +04:00
|
|
|
if test "$opal_java_found" = "0"; then
|
2012-05-23 23:51:27 +04:00
|
|
|
# Various Linux
|
2012-09-12 18:30:03 +04:00
|
|
|
if test -z "$JAVA_HOME"; then
|
2013-12-21 02:42:49 +04:00
|
|
|
opal_java_dir='/usr/lib/jvm/java-*-openjdk-*/include/'
|
2012-09-07 04:41:14 +04:00
|
|
|
else
|
2013-12-21 02:42:49 +04:00
|
|
|
opal_java_dir=$JAVA_HOME/include
|
2012-09-07 04:41:14 +04:00
|
|
|
fi
|
2013-12-21 02:42:49 +04:00
|
|
|
opal_java_jnih=`ls $opal_java_dir/jni.h 2>/dev/null | head -n 1`
|
2012-05-23 23:51:27 +04:00
|
|
|
AC_MSG_CHECKING([Linux locations])
|
2015-06-24 06:59:57 +03:00
|
|
|
AS_IF([test -r "$opal_java_jnih"],
|
2013-12-21 02:42:49 +04:00
|
|
|
[with_jdk_headers=`dirname $opal_java_jnih`
|
2012-05-23 23:51:27 +04:00
|
|
|
OPAL_WHICH([javac], [with_jdk_bindir])
|
|
|
|
AS_IF([test -n "$with_jdk_bindir"],
|
2013-11-05 07:31:07 +04:00
|
|
|
[AC_MSG_RESULT([found ($with_jdk_headers)])
|
2013-12-21 02:42:49 +04:00
|
|
|
opal_java_found=1
|
2012-05-23 23:51:27 +04:00
|
|
|
with_jdk_bindir=`dirname $with_jdk_bindir`],
|
|
|
|
[with_jdk_headers=])],
|
2013-12-21 02:42:49 +04:00
|
|
|
[opal_java_dir='/usr/lib/jvm/default-java/include/'
|
|
|
|
opal_java_jnih=`ls $opal_java_dir/jni.h 2>/dev/null | head -n 1`
|
2015-06-24 06:59:57 +03:00
|
|
|
AS_IF([test -r "$opal_java_jnih"],
|
2013-12-21 02:42:49 +04:00
|
|
|
[with_jdk_headers=`dirname $opal_java_jnih`
|
2012-05-23 23:51:27 +04:00
|
|
|
OPAL_WHICH([javac], [with_jdk_bindir])
|
|
|
|
AS_IF([test -n "$with_jdk_bindir"],
|
2013-11-05 07:31:07 +04:00
|
|
|
[AC_MSG_RESULT([found ($with_jdk_headers)])
|
2013-12-21 02:42:49 +04:00
|
|
|
opal_java_found=1
|
2012-05-23 23:51:27 +04:00
|
|
|
with_jdk_bindir=`dirname $with_jdk_bindir`],
|
|
|
|
[with_jdk_headers=])],
|
|
|
|
[AC_MSG_RESULT([not found])])])
|
|
|
|
fi
|
|
|
|
|
2013-12-21 02:42:49 +04:00
|
|
|
if test "$opal_java_found" = "0"; then
|
2012-05-23 23:51:27 +04:00
|
|
|
# Solaris
|
2013-12-21 02:42:49 +04:00
|
|
|
opal_java_dir=/usr/java
|
2012-05-23 23:51:27 +04:00
|
|
|
AC_MSG_CHECKING([Solaris locations])
|
2015-02-03 09:19:22 +03:00
|
|
|
AS_IF([test -d $opal_java_dir && test -r "$opal_java_dir/include/jni.h"],
|
2013-12-21 02:42:49 +04:00
|
|
|
[AC_MSG_RESULT([found ($opal_java_dir)])
|
|
|
|
with_jdk_headers=$opal_java_dir/include
|
|
|
|
with_jdk_bindir=$opal_java_dir/bin
|
|
|
|
opal_java_found=1],
|
2012-05-23 23:51:27 +04:00
|
|
|
[AC_MSG_RESULT([not found])])
|
|
|
|
fi
|
|
|
|
],
|
2013-12-21 02:42:49 +04:00
|
|
|
[opal_java_found=1])
|
2012-05-23 23:51:27 +04:00
|
|
|
|
2013-12-21 02:42:49 +04:00
|
|
|
if test "$opal_java_found" = "1"; then
|
2014-05-01 19:38:07 +04:00
|
|
|
OPAL_CHECK_WITHDIR([jdk-bindir], [$with_jdk_bindir], [javac])
|
|
|
|
OPAL_CHECK_WITHDIR([jdk-headers], [$with_jdk_headers], [jni.h])
|
2012-05-23 23:51:27 +04:00
|
|
|
|
|
|
|
# Look for various Java-related programs
|
2013-10-26 23:43:32 +04:00
|
|
|
opal_java_happy=no
|
2013-12-21 02:42:49 +04:00
|
|
|
opal_java_PATH_save=$PATH
|
2015-02-03 09:19:22 +03:00
|
|
|
AS_IF([test -n "$with_jdk_bindir" && test "$with_jdk_bindir" != "yes" && test "$with_jdk_bindir" != "no"],
|
2012-09-22 23:08:52 +04:00
|
|
|
[PATH="$with_jdk_bindir:$PATH"])
|
2012-05-23 23:51:27 +04:00
|
|
|
AC_PATH_PROG(JAVAC, javac)
|
|
|
|
AC_PATH_PROG(JAVAH, javah)
|
|
|
|
AC_PATH_PROG(JAR, jar)
|
2017-05-31 07:26:45 +03:00
|
|
|
AC_PATH_PROG(JAVADOC, javadoc)
|
2013-12-21 02:42:49 +04:00
|
|
|
PATH=$opal_java_PATH_save
|
2012-05-23 23:51:27 +04:00
|
|
|
|
2017-05-31 07:26:45 +03:00
|
|
|
# Check to see if we have all 4 programs.
|
|
|
|
AS_IF([test -z "$JAVAC" || test -z "$JAVAH" || test -z "$JAR" || test -z "$JAVADOC"],
|
2013-10-26 23:43:32 +04:00
|
|
|
[opal_java_happy=no
|
2012-05-23 23:51:27 +04:00
|
|
|
HAVE_JAVA_SUPPORT=0],
|
2013-10-26 23:43:32 +04:00
|
|
|
[opal_java_happy=yes
|
2012-05-23 23:51:27 +04:00
|
|
|
HAVE_JAVA_SUPPORT=1])
|
|
|
|
|
|
|
|
# Look for jni.h
|
2013-10-26 23:43:32 +04:00
|
|
|
AS_IF([test "$opal_java_happy" = "yes"],
|
2013-12-21 02:42:49 +04:00
|
|
|
[opal_java_CPPFLAGS_save=$CPPFLAGS
|
2012-05-23 23:51:27 +04:00
|
|
|
# silence a stupid Mac warning
|
|
|
|
CPPFLAGS="$CPPFLAGS -DTARGET_RT_MAC_CFM=0"
|
2015-02-03 09:19:22 +03:00
|
|
|
AS_IF([test -n "$with_jdk_headers" && test "$with_jdk_headers" != "yes" && test "$with_jdk_headers" != "no"],
|
2013-10-26 23:43:32 +04:00
|
|
|
[OPAL_JDK_CPPFLAGS="-I$with_jdk_headers"
|
2012-05-23 23:51:27 +04:00
|
|
|
# Some flavors of JDK also require -I<blah>/linux.
|
|
|
|
# See if that's there, and if so, add a -I for that,
|
|
|
|
# too. Ugh.
|
|
|
|
AS_IF([test -d "$with_jdk_headers/linux"],
|
2013-10-26 23:43:32 +04:00
|
|
|
[OPAL_JDK_CPPFLAGS="$OPAL_JDK_CPPFLAGS -I$with_jdk_headers/linux"])
|
2012-05-23 23:51:27 +04:00
|
|
|
# Solaris JDK also require -I<blah>/solaris.
|
|
|
|
# See if that's there, and if so, add a -I for that,
|
|
|
|
# too. Ugh.
|
|
|
|
AS_IF([test -d "$with_jdk_headers/solaris"],
|
2013-10-26 23:43:32 +04:00
|
|
|
[OPAL_JDK_CPPFLAGS="$OPAL_JDK_CPPFLAGS -I$with_jdk_headers/solaris"])
|
2015-11-28 19:54:43 +03:00
|
|
|
# Darwin JDK also require -I<blah>/darwin.
|
|
|
|
# See if that's there, and if so, add a -I for that,
|
|
|
|
# too. Ugh.
|
|
|
|
AS_IF([test -d "$with_jdk_headers/darwin"],
|
|
|
|
[OPAL_JDK_CPPFLAGS="$OPAL_JDK_CPPFLAGS -I$with_jdk_headers/darwin"])
|
2012-05-23 23:51:27 +04:00
|
|
|
|
2013-10-26 23:43:32 +04:00
|
|
|
CPPFLAGS="$CPPFLAGS $OPAL_JDK_CPPFLAGS"])
|
2015-06-24 06:59:57 +03:00
|
|
|
AC_CHECK_HEADER([jni.h], [],
|
2013-10-26 23:43:32 +04:00
|
|
|
[opal_java_happy=no])
|
2013-12-21 02:42:49 +04:00
|
|
|
CPPFLAGS=$opal_java_CPPFLAGS_save
|
2012-05-23 23:51:27 +04:00
|
|
|
])
|
|
|
|
else
|
2013-10-26 23:43:32 +04:00
|
|
|
opal_java_happy=no;
|
2012-05-23 23:51:27 +04:00
|
|
|
HAVE_JAVA_SUPPORT=no;
|
|
|
|
fi
|
2013-10-26 23:43:32 +04:00
|
|
|
AC_SUBST(OPAL_JDK_CPPFLAGS)
|
2012-05-10 05:51:02 +04:00
|
|
|
fi
|
2012-05-09 05:13:49 +04:00
|
|
|
|
|
|
|
# Are we happy?
|
|
|
|
AC_MSG_CHECKING([Java support available])
|
2013-10-26 23:43:32 +04:00
|
|
|
AS_IF([test "$opal_java_happy" = "no"],
|
2012-05-09 05:13:49 +04:00
|
|
|
[AC_MSG_RESULT([no])],
|
|
|
|
[AC_MSG_RESULT([yes])])
|
|
|
|
|
2013-10-26 23:43:32 +04:00
|
|
|
AC_DEFINE_UNQUOTED([OPAL_HAVE_JAVA_SUPPORT], [$HAVE_JAVA_SUPPORT], [do we have Java support])
|
|
|
|
AM_CONDITIONAL(OPAL_HAVE_JAVA_SUPPORT, test "$opal_java_happy" = "yes")
|
2013-12-07 03:40:34 +04:00
|
|
|
OPAL_VAR_SCOPE_POP
|
2012-05-09 05:13:49 +04:00
|
|
|
])
|