Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.

Bug 498964

Summary: openjdk-devel does not provide jni.h
Product: [Fedora] Fedora Reporter: Stepan Kasal <kasal>
Component: java-1.6.0-openjdkAssignee: Lillian Angel <langel>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: dbhole, langel, lkundrak, mjw, omajid
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-11 11:26:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Stepan Kasal 2009-05-04 15:44:57 UTC
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?

Comment 1 Omair Majid 2009-05-04 18:38:34 UTC
It does:
$ rpm -ql java-1.6.0-openjdk-devel | grep jni

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- $CPPFLAGS"
CPPFLAGS="-I/usr/lib/jvm/java-1.6.0-openjdk- $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

Comment 2 Stepan Kasal 2009-05-11 11:26:15 UTC
(In reply to comment #1)
> CPPFLAGS="-I/usr/lib/jvm/java-1.6.0-openjdk- $CPPFLAGS"
> CPPFLAGS="-I/usr/lib/jvm/java-1.6.0-openjdk- $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 

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
for i in -I/usr/lib/jvm/java/include{,/linux}; do
      java_inc="$java_inc $i"
%configure CPPFLAGS="$java_inc"