configure.ac: Fix jni.h check when cross compiling

Since AX_JNI_INCLUDE_DIR does not work for cross compilation, don't
invoke it when cross compiling.  Also, add a configure option to
set the jni.h include path manually if needed.
This commit is contained in:
Marcus Comstedt 2014-08-20 14:15:24 +02:00 committed by Bert Vermeulen
parent 879dd50fb6
commit 3e27b177c4
1 changed files with 15 additions and 1 deletions

View File

@ -175,6 +175,11 @@ AC_ARG_ENABLE(java,
[build Java bindings [default=yes]]), [build Java bindings [default=yes]]),
[BINDINGS_JAVA="$enableval"], [BINDINGS_JAVA=$BINDINGS_ALL]) [BINDINGS_JAVA="$enableval"], [BINDINGS_JAVA=$BINDINGS_ALL])
AC_ARG_WITH(jni-include-path,
AC_HELP_STRING([--with-jni-include-path=path],
[specify include path for JNI [default=autodetect]]),
[JNI_INCLUDE_DIRS="$withval"], [JNI_INCLUDE_DIRS=auto])
# Check if the C++ compiler supports the C++11 standard. # Check if the C++ compiler supports the C++11 standard.
m4_ifdef([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX_11(,[optional])], m4_ifdef([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX_11(,[optional])],
@ -416,10 +421,19 @@ AC_CHECK_PROG([HAVE_JAVAC], [javac], [yes], [no])
if test "x$HAVE_JAVAC" = "xyes"; then if test "x$HAVE_JAVAC" = "xyes"; then
AX_PROG_JAVAC AX_PROG_JAVAC
AX_JNI_INCLUDE_DIR if test "x$JNI_INCLUDE_DIRS" = "xauto"; then
if test "x$cross_compiling" = "xyes"; then
JNI_INCLUDE_DIRS=
else
AX_JNI_INCLUDE_DIR
fi
fi
for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS; do for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS; do
CXXFLAGS="$CXXFLAGS -I$JNI_INCLUDE_DIR" CXXFLAGS="$CXXFLAGS -I$JNI_INCLUDE_DIR"
done done
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([jni.h], [], [BINDINGS_JAVA="no"; java_msg="Java JNI headers required"])
AC_LANG_POP([C++])
else else
BINDINGS_JAVA="no"; java_msg="Java compiler required" BINDINGS_JAVA="no"; java_msg="Java compiler required"
fi fi