From: Marcus Comstedt Date: Wed, 20 Aug 2014 12:15:24 +0000 (+0200) Subject: configure.ac: Fix jni.h check when cross compiling X-Git-Tag: libsigrok-0.4.0~1134 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3e27b177c413063cfbdbe682504d11c03059b851;p=libsigrok.git 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. --- diff --git a/configure.ac b/configure.ac index dce87872..2fe7fe8c 100644 --- a/configure.ac +++ b/configure.ac @@ -175,6 +175,11 @@ AC_ARG_ENABLE(java, [build Java bindings [default=yes]]), [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. 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 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 CXXFLAGS="$CXXFLAGS -I$JNI_INCLUDE_DIR" done + AC_LANG_PUSH([C++]) + AC_CHECK_HEADERS([jni.h], [], [BINDINGS_JAVA="no"; java_msg="Java JNI headers required"]) + AC_LANG_POP([C++]) else BINDINGS_JAVA="no"; java_msg="Java compiler required" fi