summaryrefslogtreecommitdiff
path: root/build_posix
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-08-28 13:29:15 +1000
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-08-28 13:29:15 +1000
commit4230afc96cb910b3764a87d4fecd6a677f787a7d (patch)
tree3fcf449eb8cf41ca55470db74123ae3b4cd86879 /build_posix
parent9e072cef2ea18f7f1c53f91ed508dbbcb2e528ad (diff)
downloadmongo-4230afc96cb910b3764a87d4fecd6a677f787a7d.tar.gz
Update to the current version of the autoconf macro we use to search for JNI includes (thanks, @ddanderson!). Switch from AC_CHECK_FILE to AC_CHECK_HEADER to suppress cross-compilation warnings from autoconf.
Diffstat (limited to 'build_posix')
-rw-r--r--build_posix/aclocal/ax_jni_include_dir.m446
1 files changed, 26 insertions, 20 deletions
diff --git a/build_posix/aclocal/ax_jni_include_dir.m4 b/build_posix/aclocal/ax_jni_include_dir.m4
index 7ce12e10c82..0b86a503c46 100644
--- a/build_posix/aclocal/ax_jni_include_dir.m4
+++ b/build_posix/aclocal/ax_jni_include_dir.m4
@@ -11,9 +11,10 @@
# AX_JNI_INCLUDE_DIR finds include directories needed for compiling
# programs using the JNI interface.
#
-# JNI include directories are usually in the java distribution This is
-# deduced from the value of JAVAC. When this macro completes, a list of
-# directories is left in the variable JNI_INCLUDE_DIRS.
+# JNI include directories are usually in the Java distribution. This is
+# deduced from the value of $JAVA_HOME, $JAVAC, or the path to "javac", in
+# that order. When this macro completes, a list of directories is left in
+# the variable JNI_INCLUDE_DIRS.
#
# Example usage follows:
#
@@ -43,19 +44,27 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 7
+#serial 10
AU_ALIAS([AC_JNI_INCLUDE_DIR], [AX_JNI_INCLUDE_DIR])
AC_DEFUN([AX_JNI_INCLUDE_DIR],[
JNI_INCLUDE_DIRS=""
-test "x$JAVAC" = x && AC_MSG_ERROR(['\$JAVAC' undefined])
-AC_PATH_PROG([_ACJNI_JAVAC], [$JAVAC], [no])
-test "x$_ACJNI_JAVAC" = xno && AC_MSG_ERROR([$JAVAC could not be found in path])
+if test "x$JAVA_HOME" != x; then
+ _JTOPDIR="$JAVA_HOME"
+else
+ if test "x$JAVAC" = x; then
+ JAVAC=javac
+ fi
+ AC_PATH_PROG([_ACJNI_JAVAC], [$JAVAC], [no])
+ if test "x$_ACJNI_JAVAC" = xno; then
+ AC_MSG_ERROR([cannot find JDK; try setting \$JAVAC or \$JAVA_HOME])
+ fi
+ _ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC")
+ _JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'`
+fi
-_ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC")
-_JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'`
case "$host_os" in
darwin*) _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
_JINC="$_JTOPDIR/Headers";;
@@ -66,17 +75,14 @@ _AS_ECHO_LOG([_JINC=$_JINC])
# On Mac OS X 10.6.4, jni.h is a symlink:
# /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h
-# -> ../../CurrentJDK/Headers/jni.h.
-if test -f "$_JINC/jni.h" || test -L "$_JINC/jni.h"; then
- JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"
-else
- _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
- if test -f "$_JTOPDIR/include/jni.h"; then
- JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"
- else
- AC_MSG_ERROR([cannot find java include files])
- fi
-fi
+# -> ../../CurrentJDK/jeaders/jni.h.
+AC_CHECK_HEADER([$_JINC/jni.h],
+ [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"],
+ [_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
+ AC_CHECK_HEADER([$_JTOPDIR/include/jni.h],
+ [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"],
+ AC_MSG_ERROR([cannot find JDK header files]))
+ ])
# get the likely subdirectories for system specific java includes
case "$host_os" in