I’m working on a configuration script for a JNI wrapper. One of the configuration parameters is the path to jni.h. What’s a good quick-and-dirty Autoconf test for whether this parameter is set correctly for C++ compilation? You can assume you’re running on Linux and g++ is available.
Alternatively, is there a way to get javah (or a supporting tool) to give me this path directly?
Checking for headers is easy; just use
AC_CHECK_HEADER. If it’s in a weird place (i.e., one the compiler doesn’t know about), it’s entirely reasonable to expect users to setCPPFLAGS.The hard part is actually locating
libjvm. You typically don’t want to link with this; but you may want to default to a location todlopenit from ifJAVA_HOMEis not set at run time.But I don’t have a better solution than requiring that
JAVA_HOMEbe set at configure time. There’s just too much variation in how this stuff is deployed across various OSes (even just Linux distributions). This is what I do: