Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Checking for headers is easy; just use <code>AC_CHECK_HEADER</code>. If it's in a weird place (i.e., one the compiler doesn't know about), it's entirely reasonable to expect users to set <code>CPPFLAGS</code>.</p> <p>The hard part is actually locating <code>libjvm</code>. You typically don't want to link with this; but you may want to default to a location to <code>dlopen</code> it from if <code>JAVA_HOME</code> is not set at run time.</p> <p>But I don't have a better solution than requiring that <code>JAVA_HOME</code> be 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:</p> <pre><code>AC_CHECK_HEADER([jni.h], [have_jni=yes]) AC_ARG_VAR([JAVA_HOME], [Java Runtime Environment (JRE) location]) AC_ARG_ENABLE([java-feature], [AC_HELP_STRING([--disable-java-feature], [disable Java feature])]) case $target_cpu in x86_64) JVM_ARCH=amd64 ;; i?86) JVM_ARCH=i386 ;; *) JVM_ARCH=$target_cpu ;; esac AC_SUBST([JVM_ARCH]) AS_IF([test X$enable_java_feature != Xno], [AS_IF([test X$have_jni != Xyes], [AC_MSG_FAILURE([The Java Native Interface is required for Java feature.])]) AS_IF([test -z "$JAVA_HOME"], [AC_MSG_WARN([JAVA_HOME has not been set. JAVA_HOME must be set at run time to locate libjvm.])], [save_LDFLAGS=$LDFLAGS LDFLAGS="-L$JAVA_HOME/lib/$JVM_ARCH/client -L$JAVA_HOME/lib/$JVM_ARCH/server $LDFLAGS" AC_CHECK_LIB([jvm], [JNI_CreateJavaVM], [LIBS=$LIBS], [AC_MSG_WARN([no libjvm found at JAVA_HOME])]) LDFLAGS=$save_LDFLAGS ])]) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload