When java-1.6.0-oenjdk-devel.i586 is installed and then configure checks for jni.h (a simple AC_CHECK_HEADER), then is is not found. In contrast to this, with java-1.5.0-gcj-devel (and thus libgcj-devel), jni.h is immediately available. Shouldn't openjdk's java-devel provide jni.h as well?
It does: $ rpm -ql java-1.6.0-openjdk-devel | grep jni /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/include/jni.h /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/include/linux/jni_md.h However, java-1.6.0-openjdk doesnt add it to the default search path. AC_CHECK_HEADER uses cpp to find out if the header is available. So cpp needs to be told about java-1.6.0-openjdk's include dir. This works for me: CPPFLAGS="-I/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/include/linux $CPPFLAGS" CPPFLAGS="-I/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/include $CPPFLAGS" AC_CHECK_HEADER([jni.h],, [AC_ERROR(jni.h not found)]) Please see this for more information: http://sources.redhat.com/ml/automake/2001-05/msg00012.html
(In reply to comment #1) > CPPFLAGS="-I/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/include/linux $CPPFLAGS" > CPPFLAGS="-I/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/include $CPPFLAGS" > AC_CHECK_HEADER([jni.h],, [AC_ERROR(jni.h not found)]) I do not think that hardwiring these directories to configure.ac is the right solution. But your advice was the first hint towards the solution; then more hints came from fedora-devel-java-list, see http://thread.gmane.org/gmane.linux.redhat.fedora.java/2993/focus=3007 To sum up: even though gcj has jni.h in the default cpp search path, this is not guaranteed by all java implementations. But every java alternative should place jni.h under the directory /usr/lib/jvm/java, which is maintained by the alternatives utility. The following seems to be the right bit to make *.spec portable to all archs: BuildRequires: java-devel [...] %build for i in -I/usr/lib/jvm/java/include{,/linux}; do java_inc="$java_inc $i" done %configure CPPFLAGS="$java_inc"