summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rw-r--r--extras/japi/CMakeLists.txt42
-rw-r--r--extras/japi/Makefile.am5
-rw-r--r--extras/japi/configure.ac57
-rw-r--r--extras/japi/java/CMakeLists.txt176
-rw-r--r--extras/japi/java/Makefile.am279
-rw-r--r--extras/japi/m4/ax_vpp_find_jdk8.m443
6 files changed, 384 insertions, 218 deletions
diff --git a/extras/japi/CMakeLists.txt b/extras/japi/CMakeLists.txt
deleted file mode 100644
index a0bcf5e515d..00000000000
--- a/extras/japi/CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (c) 2018 Cisco and/or its affiliates.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
-
-project(japi VERSION 18.10)
-
-include(CheckCCompilerFlag)
-
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
- set(CMAKE_C_FLAGS "-march=corei7 -mtune=corei7-avx ${CMAKE_C_FLAGS}")
-elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
- set(CMAKE_C_FLAGS "-march=armv8-a+crc ${CMAKE_C_FLAGS}")
-endif()
-
-check_c_compiler_flag("-Wno-address-of-packed-member" compiler_flag_no_address_of_packed_member)
-if (compiler_flag_no_address_of_packed_member)
- add_definitions(-Wno-address-of-packed-member)
-endif()
-
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
-set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
-set(CMAKE_INSTALL_MESSAGE NEVER)
-
-find_package(Threads REQUIRED)
-find_package(Java 1.8 REQUIRED COMPONENTS Development)
-find_package(JNI REQUIRED)
-
-message("Found java headers ${JNI_INCLUDE_DIRS}")
-message("Found javac at: " ${Java_JAVAC_EXECUTABLE})
-
-add_subdirectory(java)
diff --git a/extras/japi/Makefile.am b/extras/japi/Makefile.am
new file mode 100644
index 00000000000..81ff5bb049e
--- /dev/null
+++ b/extras/japi/Makefile.am
@@ -0,0 +1,5 @@
+
+
+AUTOMAKE_OPTIONS = foreign subdir-objects
+
+SUBDIRS = java
diff --git a/extras/japi/configure.ac b/extras/japi/configure.ac
new file mode 100644
index 00000000000..f6e7b53ac7f
--- /dev/null
+++ b/extras/japi/configure.ac
@@ -0,0 +1,57 @@
+AC_INIT(japi, 18.10)
+LT_INIT
+AM_INIT_AUTOMAKE
+AM_SILENT_RULES([yes])
+AC_PREFIX_DEFAULT([/usr])
+
+PKG_CHECK_MODULES([CHECK], [check], [HAVE_CHECK=1], [HAVE_CHECK=0])
+AM_CONDITIONAL([USE_CHECK],[test "$HAVE_CHECK" -eq 1])
+
+AC_PROG_CC
+AC_PROG_CXX
+
+# Check if compiler supports specific flag
+AC_DEFUN([CC_CHECK_FLAG],
+[
+ AC_MSG_CHECKING([if $CC supports $1])
+ AC_LANG_PUSH([C])
+ ac_saved_cflags="$CFLAGS"
+ CFLAGS="-Werror $1"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+ [cc_flag_check=yes],
+ [cc_flag_check=no]
+)
+ AC_MSG_RESULT([$cc_flag_check])
+ CFLAGS="$ac_saved_cflags"
+ AC_LANG_POP([C])
+])
+
+CC_CHECK_FLAG("-Wno-address-of-packed-member")
+AS_IF([test "$cc_flag_check" = yes],
+ [CFLAGS="${CFLAGS} -Wno-address-of-packed-member"], [])
+
+AM_CONDITIONAL(ENABLE_ACL_PLUGIN, test "yes" = "yes")
+AM_CONDITIONAL(ENABLE_NAT_PLUGIN, test "yes" = "yes")
+AM_CONDITIONAL(ENABLE_L2E_PLUGIN, test "yes" = "yes")
+AM_CONDITIONAL(ENABLE_GBP_PLUGIN, test "yes" = "yes")
+AM_CONDITIONAL(ENABLE_PPPOE_PLUGIN, test "yes" = "yes")
+AM_CONDITIONAL(ENABLE_GTPU_PLUGIN, test "yes" = "yes")
+AM_CONDITIONAL(ENABLE_IOAM_PLUGIN, test "yes" = "yes")
+AM_CONDITIONAL(ENABLE_NSH_PLUGIN, test "yes" = "yes")
+
+AX_VPP_FIND_JDK8
+AC_SUBST(JAVA_HOME)
+AC_SUBST(JAVAC)
+AC_SUBST(JAVAH)
+AC_SUBST(JAR)
+
+AS_CASE([$host_cpu],
+ [x86_64], [CPU_FLAGS="-march=corei7 -mtune=corei7-avx"],
+ [aarch64], [CPU_FLAGS="-march=armv8-a+crc"],
+ [CPU_FLAGS=""],
+)
+AC_SUBST([CPU_FLAGS])
+
+AC_OUTPUT([Makefile java/Makefile])
+
+AC_CONFIG_MACRO_DIR([m4])
diff --git a/extras/japi/java/CMakeLists.txt b/extras/japi/java/CMakeLists.txt
deleted file mode 100644
index f36fac2d4e3..00000000000
--- a/extras/japi/java/CMakeLists.txt
+++ /dev/null
@@ -1,176 +0,0 @@
-# Copyright (c) 2018 Cisco and/or its affiliates.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-include (UseJava)
-
-find_path(VNET_INCLUDE_DIR NAMES vnet/api_errno.h)
-find_library(VPPINFRA_DIR NAMES vppinfra REQUIRED)
-find_library(VLIBMEMORYCLIENT_DIR NAMES vlibmemoryclient REQUIRED)
-find_library(SVM_DIR NAMES svm REQUIRED)
-
-include_directories(${VNET_INCLUDE_DIR}
- ${VNET_INCLUDE_DIR}/vpp_plugins
- ${JNI_INCLUDE_DIRS}
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_BINARY_DIR/../vpp/plugins})
-add_compile_options(-Wall)
-############# Common package ##################
-add_library(jvpp_common SHARED jvpp-common/jvpp_common.c)
-set_target_properties(jvpp_common PROPERTIES SOVERSION ${PROJECT_VERSION})
-target_link_libraries(jvpp_common ${VPPINFRA_DIR})
-install(TARGETS jvpp_common DESTINATION lib COMPONENT libjvpp_common)
-install(FILES jvpp-common/jvpp_common.h DESTINATION include/japi/)
-
-set(JVPP_LIBS jvpp_common ${VPPINFRA_DIR} ${VLIBMEMORYCLIENT_DIR} ${SVM_DIR}
- Threads::Threads m rt)
-
-############# Registry package ##################
-set(PACKAGE_DIR_JVPP_REGISTRY io/fd/vpp/jvpp)
-unset(files)
-FILE(GLOB files RELATIVE
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/jvpp-registry/${PACKAGE_DIR_JVPP_REGISTRY}/*.java
- ${CMAKE_CURRENT_SOURCE_DIR}/jvpp-registry/${PACKAGE_DIR_JVPP_REGISTRY}/*/*.java
-)
-
-add_custom_target (jvpp-registry-classes)
-add_custom_command (TARGET jvpp-registry-classes
- PRE_BUILD
- COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/jvpp-registry
- COMMAND ${Java_JAVAC_EXECUTABLE}
- ARGS -d ${CMAKE_CURRENT_BINARY_DIR}/jvpp-registry -h jvpp-registry ${files}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-)
-
-add_library(jvpp_registry SHARED jvpp-registry/jvpp_registry.c)
-target_link_libraries(jvpp_registry ${JVPP_LIBS})
-include_directories(jvpp-registry)
-add_dependencies(jvpp_registry jvpp_common jvpp-registry-classes)
-add_jar(jvpp-registry ${files} VERSION ${PROJECT_VERSION})
-install_jar(jvpp-registry DESTINATION share/java/)
-
-############## Functions #########################
-function(japigen name)
- if(NOT VPP_JAVA_APIGEN)
- set(VPP_JAVA_APIGEN ${CMAKE_CURRENT_SOURCE_DIR}/jvpp/gen/jvpp_gen.py)
- endif()
- add_custom_target(japigen-${name} DEPENDS jvpp-registry)
- add_custom_command(TARGET japigen-${name}
- POST_BUILD
- COMMAND mkdir -p jvpp-${name}/target
- COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/jvpp-${name}
- COMMAND ${VPP_JAVA_APIGEN}
- ARGS --plugin_name ${name} --root_dir jvpp-${name} -i ${ARGN}
- COMMAND find jvpp-${name} -name \*.java > jvpp-${name}/jvpp-${name}.files
- COMMAND ${Java_JAVAC_EXECUTABLE}
- ARGS -cp ${CMAKE_CURRENT_BINARY_DIR}/jvpp-registry-${PROJECT_VERSION}.jar -d
- ${CMAKE_CURRENT_BINARY_DIR}/jvpp-${name} -h jvpp-${name}
- @jvpp-${name}/jvpp-${name}.files
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMENT "JAVA_API_GEN ${name}"
- )
-endfunction()
-
-function(jargen name)
- add_custom_command(TARGET jvpp_${name}
- POST_BUILD
- COMMAND cp ${CMAKE_BINARY_DIR}/lib/libjvpp_${name}.so jvpp-${name}/target
- COMMAND ${Java_JAR_EXECUTABLE} ARGS cf
- ${CMAKE_CURRENT_BINARY_DIR}/jvpp-${name}-${PROJECT_VERSION}.jar
- @jvpp-${name}/jvpp-${name}.files
- COMMAND rm ARGS -rf jvpp-${name}/target jvpp-${name}/jvpp-${name}.files
- jvpp-${name}/jvpp_${name}_gen.h jvpp-${name}/io_fd_vpp_jvpp_*.h
- jvpp-registry/io_fd_vpp_jvpp_*.h
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMENT "JAR_GEN ${name}"
- )
- install(
- FILES ${CMAKE_CURRENT_BINARY_DIR}/jvpp-${name}-${PROJECT_VERSION}.jar
- DESTINATION share/java
- )
-endfunction()
-
-function(java_api_binding name src_file)
- japigen (${name} ${ARGN})
- add_library(jvpp_${name} SHARED jvpp-${name}/jvpp_${src_file}.c)
- target_link_libraries(jvpp_${name} ${JVPP_LIBS})
- include_directories(jvpp-${name})
- add_dependencies(jvpp_${name} jvpp_common jvpp_registry japigen-${name})
- jargen (${name})
-endfunction()
-
-############ Core Package #######################
-unset (files)
-unset (JSON_API_PATH)
-set (JSON_API_PATH ${CMAKE_BINARY_DIR}/../vpp)
-
-FILE(GLOB_RECURSE files RELATIVE
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${JSON_API_PATH}/vnet/*.api.json
- ${JSON_API_PATH}/vpp/*.api.json
-)
-
-java_api_binding (core core ${files})
-
-############ Plugin Packages #######################
-unset (ACL_JSON_FILE)
-unset (NAT_JSON_FILE)
-unset (NSH_JSON_FILE)
-unset (GTPU_JSON_FILE)
-unset (PPPOE_JSON_FILE)
-unset (IOAM_TRACE_JSON_FILE)
-unset (IOAM_POT_JSON_FILE)
-unset (IOAM_EXPORT_JSON_FILE)
-
-set (plugin_path ${CMAKE_BINARY_DIR}/../vpp/plugins)
-
-find_file(ACL_JSON_FILE NAMES acl.api.json HINTS ${plugin_path} PATH_SUFFIXES acl)
-find_file(NAT_JSON_FILE NAMES nat.api.json HINTS ${plugin_path} PATH_SUFFIXES nat)
-find_file(NSH_JSON_FILE NAMES nsh.api.json HINTS ${plugin_path} PATH_SUFFIXES nsh)
-find_file(GTPU_JSON_FILE NAMES gtpu.api.json HINTS ${plugin_path} PATH_SUFFIXES gtpu)
-find_file(PPPOE_JSON_FILE NAMES pppoe.api.json HINTS ${plugin_path} PATH_SUFFIXES pppoe)
-find_file(IOAM_TRACE_JSON_FILE NAMES trace.api.json HINTS ${plugin_path} PATH_SUFFIXES ioam/lib-trace)
-find_file(IOAM_POT_JSON_FILE NAMES pot.api.json HINTS ${plugin_path} PATH_SUFFIXES ioam/lib-pot)
-find_file(IOAM_EXPORT_JSON_FILE NAMES ioam_export.api.json HINTS ${plugin_path} PATH_SUFFIXES ioam/export)
-
-if(ACL_JSON_FILE)
- java_api_binding (acl acl ${ACL_JSON_FILE})
-endif()
-
-if(NAT_JSON_FILE)
- java_api_binding (nat nat ${NAT_JSON_FILE})
-endif()
-
-if(NSH_JSON_FILE)
- java_api_binding (nsh nsh ${NSH_JSON_FILE})
-endif()
-
-if(GTPU_JSON_FILE)
- java_api_binding (gtpu gtpu ${GTPU_JSON_FILE})
-endif()
-
-if(PPPOE_JSON_FILE)
- java_api_binding (pppoe pppoe ${PPPOE_JSON_FILE})
-endif()
-
-if(IOAM_TRACE_JSON_FILE)
- java_api_binding (ioamtrace ioam_trace ${IOAM_TRACE_JSON_FILE})
-endif()
-
-if(IOAM_POT_JSON_FILE)
- java_api_binding (ioampot ioam_pot ${IOAM_POT_JSON_FILE})
-endif()
-
-if(IOAM_EXPORT_JSON_FILE)
- java_api_binding (ioamexport ioam_export ${IOAM_EXPORT_JSON_FILE})
-endif()
diff --git a/extras/japi/java/Makefile.am b/extras/japi/java/Makefile.am
new file mode 100644
index 00000000000..d33ae82ff0d
--- /dev/null
+++ b/extras/japi/java/Makefile.am
@@ -0,0 +1,279 @@
+# Copyright (c) 2016 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+AUTOMAKE_OPTIONS = foreign subdir-objects
+ACLOCAL_AMFLAGS = -I m4
+AM_LIBTOOLFLAGS = --quiet
+
+AM_CFLAGS = @CPU_FLAGS@ -Wall -I${top_srcdir} -I${top_builddir} \
+ -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux \
+ -I@top_srcdir@/plugins -I@top_builddir@/plugins
+
+AM_LDFLAGS = -shared -avoid-version -rpath /none -no-undefined
+
+BUILT_SOURCES =
+bin_PROGRAMS =
+noinst_LTLIBRARIES =
+JAR_FILES =
+CLEANDIRS =
+
+#
+# jvpp-common
+#
+
+nobase_include_HEADERS = \
+ jvpp-common/jvpp_common.h
+
+lib_LTLIBRARIES = libjvpp_common.la
+libjvpp_common_la_SOURCES = jvpp-common/jvpp_common.c
+libjvpp_common_la_LDFLAGS = shared -rpath /none -no-undefined -lvppinfra
+
+JVPP_LIBS = \
+ libjvpp_common.la \
+ -lvppinfra -lvlibmemoryclient -lsvm -lpthread -lm -lrt
+
+#
+# jvpp-registry (connection management + plugin registry)
+#
+
+noinst_LTLIBRARIES += libjvpp_registry.la
+
+libjvpp_registry_la_SOURCES = jvpp-registry/jvpp_registry.c
+libjvpp_registry_la_CPPFLAGS = -Ijvpp-registry
+libjvpp_registry_la_LIBADD = $(JVPP_LIBS)
+libjvpp_registry_la_DEPENDENCIES = libjvpp_common.la
+
+packagedir_jvpp_registry = io/fd/vpp/jvpp
+jvpp_registry_src_files := \
+ $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/*.java) \
+ $(wildcard @srcdir@/jvpp-registry/$(packagedir_jvpp_registry)/**/*.java)
+
+BUILT_SOURCES += jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
+CLEANDIRS += jvpp-registry/target
+JAR_FILES += jvpp-registry-$(PACKAGE_VERSION).jar
+
+jvpp_registry_ok = jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
+
+jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h: $(jvpp_registry_src_files)
+ @echo " JVPP GEN $@"
+ @rm -rf jvpp-registry/target
+ @mkdir -p jvpp-registry/target
+ @$(JAVAC) -source 8 -target 8 -d jvpp-registry/target -h jvpp-registry $^
+ @touch jvpp-registry.ok
+
+define japigen
+ @echo " JVPP GEN $@"
+ @rm -rf jvpp-$(1)/target
+ @ @srcdir@/jvpp/gen/jvpp_gen.py --plugin_name $(1) --root_dir jvpp-$(1) \
+ -i $(jvpp_$(1)_json_files)
+ @find jvpp-$(1)/target -name \*.java > jvpp-$(1).generated.files
+ @find @srcdir@/jvpp-$(1) -name \*.java > jvpp-$(1).static.files
+ @$(JAVAC) -source 8 -target 8 -classpath jvpp-registry/target \
+ -d jvpp-$(1)/target -h jvpp-$(1) @jvpp-$(1).generated.files @jvpp-$(1).static.files
+endef
+
+#
+# jvpp-core (Java wrapper for vpe.api)
+#
+noinst_LTLIBRARIES += libjvpp_core.la
+libjvpp_core_la_SOURCES = jvpp-core/jvpp_core.c jvpp-core/jvpp_core_gen.h
+libjvpp_core_la_CPPFLAGS = -Ijvpp-registry -Ijvpp-core
+libjvpp_core_la_LIBADD = $(JVPP_LIBS)
+libjvpp_core_la_DEPENDENCIES = libjvpp_common.la
+
+BUILT_SOURCES += jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h
+JAR_FILES += jvpp-core-$(PACKAGE_VERSION).jar
+CLEANDIRS += jvpp-core/target
+
+# Include all VPP API files
+jvpp_core_json_files = $(shell find @top_builddir@/../vpp/vnet -type f -name '*.api.json')
+jvpp_core_json_files += $(shell find @top_builddir@/../vpp/vpp -type f -name '*.api.json')
+# except for plugins and unsupported ones:
+# jvpp_core_json_files += @top_builddir@/vlibmemory/memclnt.api.json
+
+jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: $(jvpp_registry_ok) $(jvpp_core_json_files)
+ $(call japigen,core,JVppCoreImpl)
+
+#
+# ACL Plugin
+#
+if ENABLE_ACL_PLUGIN
+noinst_LTLIBRARIES += libjvpp_acl.la
+libjvpp_acl_la_SOURCES = jvpp-acl/jvpp_acl.c
+libjvpp_acl_la_CPPFLAGS = -Ijvpp-acl
+libjvpp_acl_la_LIBADD = $(JVPP_LIBS)
+libjvpp_acl_la_DEPENDENCIES = libjvpp_common.la
+
+BUILT_SOURCES += jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h
+JAR_FILES += jvpp-acl-$(PACKAGE_VERSION).jar
+CLEANDIRS += jvpp-acl/target
+
+jvpp_acl_json_files = @top_builddir@/../vpp/plugins/acl/acl.api.json
+
+jvpp-acl/io_fd_vpp_jvpp_acl_JVppAclImpl.h: $(jvpp_registry_ok) $(jvpp_acl_json_files)
+ $(call japigen,acl,JVppAclImpl)
+endif
+
+#
+# GTPU Plugin
+#
+if ENABLE_GTPU_PLUGIN
+noinst_LTLIBRARIES += libjvpp_gtpu.la
+libjvpp_gtpu_la_SOURCES = jvpp-gtpu/jvpp_gtpu.c
+libjvpp_gtpu_la_CPPFLAGS = -Ijvpp-gtpu
+libjvpp_gtpu_la_LIBADD = $(JVPP_LIBS)
+libjvpp_gtpu_la_DEPENDENCIES = libjvpp_common.la
+
+BUILT_SOURCES += jvpp-gtpu/io_fd_vpp_jvpp_gtpu_JVppGtpuImpl.h
+JAR_FILES += jvpp-gtpu-$(PACKAGE_VERSION).jar
+CLEANDIRS += jvpp-gtpu/target
+
+jvpp_gtpu_json_files = @top_builddir@/../vpp/plugins/gtpu/gtpu.api.json
+
+jvpp-gtpu/io_fd_vpp_jvpp_gtpu_JVppGtpuImpl.h: $(jvpp_registry_ok) $(jvpp_gtpu_json_files)
+ $(call japigen,gtpu,JVppGtpuImpl)
+endif
+
+#
+# PPPOE Plugin
+#
+if ENABLE_PPPOE_PLUGIN
+noinst_LTLIBRARIES += libjvpp_pppoe.la
+libjvpp_pppoe_la_SOURCES = jvpp-pppoe/jvpp_pppoe.c
+libjvpp_pppoe_la_CPPFLAGS = -Ijvpp-pppoe
+libjvpp_pppoe_la_LIBADD = $(JVPP_LIBS)
+libjvpp_pppoe_la_DEPENDENCIES = libjvpp_common.la
+
+BUILT_SOURCES += jvpp-pppoe/io_fd_vpp_jvpp_pppoe_JVppPppoeImpl.h
+JAR_FILES += jvpp-pppoe-$(PACKAGE_VERSION).jar
+CLEANDIRS += jvpp-pppoe/target
+
+jvpp_pppoe_json_files = @top_builddir@/../vpp/plugins/pppoe/pppoe.api.json
+
+jvpp-pppoe/io_fd_vpp_jvpp_pppoe_JVppPppoeImpl.h: $(jvpp_registry_ok) $(jvpp_pppoe_json_files)
+ $(call japigen,pppoe,JVppPppoeImpl)
+endif
+
+#
+# NAT Plugin
+#
+if ENABLE_NAT_PLUGIN
+noinst_LTLIBRARIES += libjvpp_nat.la
+libjvpp_nat_la_SOURCES = jvpp-nat/jvpp_nat.c
+libjvpp_nat_la_CPPFLAGS = -Ijvpp-nat
+libjvpp_nat_la_LIBADD = $(JVPP_LIBS)
+libjvpp_nat_la_DEPENDENCIES = libjvpp_common.la
+
+BUILT_SOURCES += jvpp-nat/io_fd_vpp_jvpp_nat_JVppNatImpl.h
+JAR_FILES += jvpp-nat-$(PACKAGE_VERSION).jar
+CLEANDIRS += jvpp-nat/target
+
+jvpp_nat_json_files = @top_builddir@/../vpp/plugins/nat/nat.api.json
+
+jvpp-nat/io_fd_vpp_jvpp_nat_JVppNatImpl.h: $(jvpp_registry_ok) $(jvpp_nat_json_files)
+ $(call japigen,nat,JVppNatImpl)
+endif
+
+#
+# NSH Plugin
+#
+if ENABLE_NSH_PLUGIN
+noinst_LTLIBRARIES += libjvpp_nsh.la
+libjvpp_nsh_la_SOURCES = jvpp-nsh/jvpp_nsh.c
+libjvpp_nsh_la_CPPFLAGS = -Ijvpp-nsh
+libjvpp_nsh_la_LIBADD = $(JVPP_LIBS)
+libjvpp_nsh_la_DEPENDENCIES = libjvpp_common.la
+
+BUILT_SOURCES += jvpp-nsh/io_fd_vpp_jvpp_nsh_JVppNshImpl.h
+JAR_FILES += jvpp-nsh-$(PACKAGE_VERSION).jar
+CLEANDIRS += jvpp-nsh/target
+
+jvpp_nsh_json_files = @top_builddir@/../vpp/plugins/nsh/nsh.api.json
+
+jvpp-nsh/io_fd_vpp_jvpp_nsh_JVppNshImpl.h: $(jvpp_registry_ok) $(jvpp_nsh_json_files)
+ $(call japigen,nsh,JVppNshImpl)
+endif
+
+#
+# iOAM Trace Plugin
+#
+if ENABLE_IOAM_PLUGIN
+noinst_LTLIBRARIES += libjvpp_ioamtrace.la
+libjvpp_ioamtrace_la_SOURCES = jvpp-ioamtrace/jvpp_ioam_trace.c
+libjvpp_ioamtrace_la_LIBADD = $(JVPP_LIBS)
+libjvpp_ioamtrace_la_DEPENDENCIES = libjvpp_common.la
+
+BUILT_SOURCES += jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h
+JAR_FILES += jvpp-ioamtrace-$(PACKAGE_VERSION).jar
+CLEANDIRS += jvpp-ioamtrace/target
+
+jvpp_ioamtrace_json_files = @top_builddir@/../vpp/plugins/ioam/lib-trace/trace.api.json
+
+jvpp-ioamtrace/io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl.h: $(jvpp_registry_ok) $(jvpp_ioamtrace_json_files)
+ $(call japigen,ioamtrace,JVppIoamtraceImpl)
+
+#
+# iOAM POT Plugin
+#
+noinst_LTLIBRARIES += libjvpp_ioampot.la
+libjvpp_ioampot_la_SOURCES = jvpp-ioampot/jvpp_ioam_pot.c
+libjvpp_ioampot_la_LIBADD = $(JVPP_LIBS)
+libjvpp_ioampot_la_DEPENDENCIES = libjvpp_common.la
+
+BUILT_SOURCES += jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h
+JAR_FILES += jvpp-ioampot-$(PACKAGE_VERSION).jar
+CLEANDIRS += jvpp-ioampot/target
+
+jvpp_ioampot_json_files = @top_builddir@/../vpp/plugins/ioam/lib-pot/pot.api.json
+
+jvpp-ioampot/io_fd_vpp_jvpp_ioampot_JVppIoampotImpl.h: $(jvpp_registry_ok) $(jvpp_ioampot_json_files)
+ $(call japigen,ioampot,JVppIoampotImpl)
+
+#
+# iOAM Export Plugin
+#
+noinst_LTLIBRARIES += libjvpp_ioamexport.la
+libjvpp_ioamexport_la_SOURCES = jvpp-ioamexport/jvpp_ioam_export.c
+libjvpp_ioamexport_la_LIBADD = $(JVPP_LIBS)
+libjvpp_ioamexport_la_DEPENDENCIES = libjvpp_common.la
+
+BUILT_SOURCES += jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h
+JAR_FILES += jvpp-ioamexport-$(PACKAGE_VERSION).jar
+CLEANDIRS += jvpp-ioamexport/target
+
+jvpp_ioamexport_json_files = @top_builddir@/../vpp/plugins/ioam/export/ioam_export.api.json
+
+jvpp-ioamexport/io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl.h: $(jvpp_registry_ok) $(jvpp_ioamexport_json_files)
+ $(call japigen,ioamexport,JVppIoamexportImpl)
+endif
+
+#
+# JAR creation
+#
+jvpp-%-$(PACKAGE_VERSION).jar: libjvpp_%.la
+ @echo " JAR $@"
+ @cp .libs/libjvpp_$*.so jvpp-$*/target
+ @$(JAR) cf $(JARFLAGS) $@ -C jvpp-$*/target .
+
+jardir = $(prefix)/share/java
+jar_DATA = $(JAR_FILES)
+
+all-local: $(JAR_FILES)
+
+#
+# Cleanup
+#
+CLEANFILES = jvpp-registry.ok $(JAR_FILES) $(BUILT_SOURCES) *.files */*.h
+
+clean-local:
+ rm -rf $(CLEANDIRS)
diff --git a/extras/japi/m4/ax_vpp_find_jdk8.m4 b/extras/japi/m4/ax_vpp_find_jdk8.m4
new file mode 100644
index 00000000000..94b785038f7
--- /dev/null
+++ b/extras/japi/m4/ax_vpp_find_jdk8.m4
@@ -0,0 +1,43 @@
+
+
+AC_DEFUN([AX_VPP_FIND_JDK8],
+[
+while true
+do
+ if test "${JAVA_HOME+set}" = set ; then
+ AC_MSG_CHECKING([${JAVA_HOME} for Java 8 compiler])
+ JAVAC=${JAVA_HOME}/bin/javac
+ JAVAH=${JAVA_HOME}/bin/javah
+ JAR=${JAVA_HOME}/bin/jar
+ JAVA_VERSION=$(${JAVA_HOME}/bin/javac -source 8 -version 2>&1)
+ if test 0 -eq "$?"; then
+ JAVA_VERSION=$(echo "${JAVA_VERSION}" | cut -d\ -f2)
+ AC_MSG_RESULT([ok])
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Java in ${JAVA_HOME} (path specified in JAVA_HOME) cannot compile Java 8 code])
+ fi
+ break
+ fi
+
+ for dir in $(find /usr/lib*/jvm/* -maxdepth 0 -type d); do
+ AC_MSG_CHECKING([${dir} for Java 8 compiler])
+ JAVA_VERSION=$(${dir}/bin/javac -source 8 -version 2>&1)
+ if test 0 -eq "$?"; then
+ JAVA_VERSION=$(echo "${JAVA_VERSION}" | cut -d\ -f2)
+ JAVA_HOME=${dir}
+ JAVAC=${dir}/bin/javac
+ JAVAH=${dir}/bin/javah
+ JAR=${dir}/bin/jar
+ AC_MSG_RESULT([found version $JAVA_VERSION])
+ break
+ else
+ JAVA_VERSION=""
+ AC_MSG_RESULT([no])
+ fi
+ done
+
+ test "${JAVA_HOME}set" = set && AC_MSG_ERROR([Could not find Java 8 compiler])
+ break
+done
+])