CPPFLAGS="$CPPFLAGS $JNI_CPPFLAGS"
AX_PROG_JAVAH
CPPFLAGS="$saved_CPPFLAGS"
+
+ AM_CONDITIONAL([HAVE_JAVAH], [test "x$JAVAH" != "x"])
])
AS_IF([test "x$java_agent_log4j" = "xyes"], [
$(jarfile): classnoinst.stamp
$(JAR) cfm $(JARFLAGS) $@ $(jarfile_manifest) $(classes) && rm -f $(jarfile_symlink) && $(LN_S) $@ $(jarfile_symlink)
+if !HAVE_JAVAH
+# If we don't have javah, assume we are running openjdk >= 10 and use javac
+# to generate the jni header file.
+AM_JAVACFLAGS = -h $(jnioutdir)
+else
context-jni-header.stamp: $(dist_noinst_JAVA)
$(JAVAH) -classpath $(CLASSPATH):$(srcdir) -d $(jnioutdir) $(JAVAHFLAGS) org.lttng.ust.agent.context.LttngContextApi && \
echo "Context API JNI header generated" > context-jni-header.stamp
all-local: context-jni-header.stamp
+endif
install-data-hook:
cd $(DESTDIR)/$(jardir) && rm -f $(jarfile_symlink) && $(LN_S) $(jarfile) $(jarfile_symlink)
$(jarfile): classnoinst.stamp
$(JAR) cfm $(JARFLAGS) $@ $(jarfile_manifest) $(classes) && rm -f $(jarfile_symlink) && $(LN_S) $@ $(jarfile_symlink)
+if !HAVE_JAVAH
+# If we don't have javah, assume we are running openjdk >= 10 and use javac
+# to generate the jni header file.
+AM_JAVACFLAGS = -h $(juljniout)
+else
jul-jni-header.stamp: $(dist_noinst_JAVA)
$(JAVAH) -classpath $(CLASSPATH):$(srcdir) -d $(juljniout) $(JAVAHFLAGS) org.lttng.ust.agent.jul.LttngJulApi && \
echo "JUL JNI header generated" > jul-jni-header.stamp
all-local: $(stamp)
+endif
install-data-hook:
cd $(DESTDIR)/$(jardir) && rm -f $(jarfile_symlink) && $(LN_S) $(jarfile) $(jarfile_symlink)
$(jarfile): classnoinst.stamp
$(JAR) cfm $(JARFLAGS) $@ $(jarfile_manifest) $(classes) && rm -f $(jarfile_symlink) && $(LN_S) $@ $(jarfile_symlink)
+if !HAVE_JAVAH
+# If we don't have javah, assume we are running openjdk >= 10 and use javac
+# to generate the jni header file.
+AM_JAVACFLAGS = -h $(log4jjniout)
+else
log4j-jni-header.stamp: $(dist_noinst_JAVA)
$(JAVAH) -classpath $(CLASSPATH):$(srcdir) -d $(log4jjniout) $(JAVAHFLAGS) org.lttng.ust.agent.log4j.LttngLog4jApi && \
echo "Log4j JNI header generated" > log4j-jni-header.stamp
all-local: $(stamp)
+endif
install-data-hook:
cd $(DESTDIR)/$(jardir) && rm -f $(jarfile_symlink) && $(LN_S) $(jarfile) $(jarfile_symlink)
$(jarfile): classnoinst.stamp
$(JAR) cf $(JARFLAGS) $@ $(pkgpath)/*.class
+if !HAVE_JAVAH
+# If we don't have javah, assume we are running openjdk >= 10 and use javac
+# to generate the jni header file.
+AM_JAVACFLAGS = -h .
+
+org_lttng_ust_LTTngUst.h: $(jarfile)
+else
org_lttng_ust_LTTngUst.h: jni-header.stamp
jni-header.stamp: $(dist_noinst_JAVA)
$(JAVAH) -classpath $(srcdir) $(JAVAHFLAGS) org.lttng.ust.LTTngUst && \
echo "JNI header generated" > jni-header.stamp
+endif
all-local: org_lttng_ust_LTTngUst.h