diff --git a/Makefile.am b/Makefile.am index 4c8d072..ee65608 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,11 +10,16 @@ else JNI_LA = libopenslide-jni.la endif +if USE_CROSS_HEADERS +CROSS_H = cross/jni.h cross/jni_md.h +endif + export JAVA_HOME export ANT_HOME pkglib_LTLIBRARIES = $(JNI_LA) -libopenslide_jni_la_SOURCES = openslide-jni.c +libopenslide_jni_la_SOURCES = openslide-jni.c $(CROSS_H) +openslide_jni_la_SOURCES = $(libopenslide_jni_la_SOURCES) # Building without lib prefix requires -module. # On the other hand, the JNI ABI on Mac OS X precludes it. openslide_jni_la_LDFLAGS = -module $(AM_LDFLAGS) diff --git a/README.txt b/README.txt index 64027bb..0b3f3c9 100644 --- a/README.txt +++ b/README.txt @@ -15,9 +15,6 @@ make install Cross-compiling for Windows with MinGW-w64 ------------------------------------------ -You will need the GNU Classpath version of jni.h installed. (On Fedora -this is in the libgcj-devel package.) - PKG_CONFIG=pkg-config \ PKG_CONFIG_PATH=/path/to/cross/compiled/openslide/lib/pkgconfig \ ./configure --host=i686-w64-mingw32 --build=$(build-aux/config.guess) diff --git a/configure.ac b/configure.ac index ec0f2ea..c44c58a 100644 --- a/configure.ac +++ b/configure.ac @@ -52,8 +52,8 @@ fi AC_ARG_WITH([java], [AS_HELP_STRING([--with-java], [path to JDK])], [], [with_java="$JAVA_HOME:$DEFAULT_JAVA_HOME:/usr/lib/jvm/java"]) AC_ARG_WITH([jni-headers], [AS_HELP_STRING([--with-jni-headers=PLATFORM], - [use JNI headers for PLATFORM. Specify "cross" to use Classpath - headers from the build platform.])], [], [with_jni_headers=guess]) + [use JNI headers for PLATFORM. Specify "cross" to use bundled + Classpath headers.])], [], [with_jni_headers=guess]) if test z$with_jni_headers = zguess ; then if test $host = $build ; then AS_CASE([$host], @@ -81,30 +81,15 @@ if test z$with_jni_headers != zcross ; then JNI_CFLAGS="\"-I$jni_h_dir\" \"-I$jni_md_h_dir\"" else # For cross builds, we don't have the OpenJDK jni_md.h for the target - # platform, so use the GNU Classpath JNI headers in the build system's - # gcj include directory instead. Autoconf doesn't give us a variable - # for the build compiler, which is okay because anything other than - # GCC probably won't support this syntax. + # platform, so use our own copy of the GNU Classpath JNI headers instead. # # Don't set JAVA_HOME unless it was specified on the command line. - # - # This is terrible. - JNI_CFLAGS= - AC_MSG_CHECKING([for cross jni.h and jni_md.h]) - for word in $(gcc - -v -E < /dev/null 2>&1) - do - if test -r "$word/jni.h" && test -r "$word/jni_md.h" ; then - AC_MSG_RESULT([$word]) - JNI_CFLAGS="-I$word" - break - fi - done - if test "x$JNI_CFLAGS" = x ; then - AC_MSG_RESULT([not found]) - AC_MSG_ERROR([cannot find JNI headers]) - fi + AC_MSG_CHECKING([whether to use bundled JNI headers]) + AC_MSG_RESULT([yes]) + JNI_CFLAGS='-I$(top_srcdir)/cross' fi AC_SUBST([JNI_CFLAGS]) +AM_CONDITIONAL([USE_CROSS_HEADERS], [test x$with_jni_headers = xcross]) # Checks for typedefs, structures, and compiler characteristics. diff --git a/cross/jni_md.h b/cross/jni_md.h index 7709c0b..c65beb9 100644 --- a/cross/jni_md.h +++ b/cross/jni_md.h @@ -27,7 +27,7 @@ executable file might be covered by the GNU General Public License. */ #ifndef __GCJ_JNI_MD_H__ #define __GCJ_JNI_MD_H__ -#include +#define JV_HAVE_INTTYPES_H 1 #ifdef __GCJ_JNI_IMPL__