Skip to content

Commit e58b6a4

Browse files
committed
Use bundled JNI headers for cross builds
1 parent 68a35ed commit e58b6a4

File tree

4 files changed

+14
-27
lines changed

4 files changed

+14
-27
lines changed

Makefile.am

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ else
1010
JNI_LA = libopenslide-jni.la
1111
endif
1212

13+
if USE_CROSS_HEADERS
14+
CROSS_H = cross/jni.h cross/jni_md.h
15+
endif
16+
1317
export JAVA_HOME
1418
export ANT_HOME
1519

1620
pkglib_LTLIBRARIES = $(JNI_LA)
17-
libopenslide_jni_la_SOURCES = openslide-jni.c
21+
libopenslide_jni_la_SOURCES = openslide-jni.c $(CROSS_H)
22+
openslide_jni_la_SOURCES = $(libopenslide_jni_la_SOURCES)
1823
# Building without lib prefix requires -module.
1924
# On the other hand, the JNI ABI on Mac OS X precludes it.
2025
openslide_jni_la_LDFLAGS = -module $(AM_LDFLAGS)

README.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ make install
1515
Cross-compiling for Windows with MinGW-w64
1616
------------------------------------------
1717

18-
You will need the GNU Classpath version of jni.h installed. (On Fedora
19-
this is in the libgcj-devel package.)
20-
2118
PKG_CONFIG=pkg-config \
2219
PKG_CONFIG_PATH=/path/to/cross/compiled/openslide/lib/pkgconfig \
2320
./configure --host=i686-w64-mingw32 --build=$(build-aux/config.guess)

configure.ac

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ fi
5252
AC_ARG_WITH([java], [AS_HELP_STRING([--with-java], [path to JDK])], [],
5353
[with_java="$JAVA_HOME:$DEFAULT_JAVA_HOME:/usr/lib/jvm/java"])
5454
AC_ARG_WITH([jni-headers], [AS_HELP_STRING([--with-jni-headers=PLATFORM],
55-
[use JNI headers for PLATFORM. Specify "cross" to use Classpath
56-
headers from the build platform.])], [], [with_jni_headers=guess])
55+
[use JNI headers for PLATFORM. Specify "cross" to use bundled
56+
Classpath headers.])], [], [with_jni_headers=guess])
5757
if test z$with_jni_headers = zguess ; then
5858
if test $host = $build ; then
5959
AS_CASE([$host],
@@ -81,30 +81,15 @@ if test z$with_jni_headers != zcross ; then
8181
JNI_CFLAGS="\"-I$jni_h_dir\" \"-I$jni_md_h_dir\""
8282
else
8383
# For cross builds, we don't have the OpenJDK jni_md.h for the target
84-
# platform, so use the GNU Classpath JNI headers in the build system's
85-
# gcj include directory instead. Autoconf doesn't give us a variable
86-
# for the build compiler, which is okay because anything other than
87-
# GCC probably won't support this syntax.
84+
# platform, so use our own copy of the GNU Classpath JNI headers instead.
8885
#
8986
# Don't set JAVA_HOME unless it was specified on the command line.
90-
#
91-
# This is terrible.
92-
JNI_CFLAGS=
93-
AC_MSG_CHECKING([for cross jni.h and jni_md.h])
94-
for word in $(gcc - -v -E < /dev/null 2>&1)
95-
do
96-
if test -r "$word/jni.h" && test -r "$word/jni_md.h" ; then
97-
AC_MSG_RESULT([$word])
98-
JNI_CFLAGS="-I$word"
99-
break
100-
fi
101-
done
102-
if test "x$JNI_CFLAGS" = x ; then
103-
AC_MSG_RESULT([not found])
104-
AC_MSG_ERROR([cannot find JNI headers])
105-
fi
87+
AC_MSG_CHECKING([whether to use bundled JNI headers])
88+
AC_MSG_RESULT([yes])
89+
JNI_CFLAGS='-I$(top_srcdir)/cross'
10690
fi
10791
AC_SUBST([JNI_CFLAGS])
92+
AM_CONDITIONAL([USE_CROSS_HEADERS], [test x$with_jni_headers = xcross])
10893

10994
# Checks for typedefs, structures, and compiler characteristics.
11095

cross/jni_md.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ executable file might be covered by the GNU General Public License. */
2727
#ifndef __GCJ_JNI_MD_H__
2828
#define __GCJ_JNI_MD_H__
2929

30-
#include <gcj/libgcj-config.h>
30+
#define JV_HAVE_INTTYPES_H 1
3131

3232
#ifdef __GCJ_JNI_IMPL__
3333

0 commit comments

Comments
 (0)