diff --git a/build_posix/Make.subdirs b/build_posix/Make.subdirs index aeb2316d634..133cc6bded8 100644 --- a/build_posix/Make.subdirs +++ b/build_posix/Make.subdirs @@ -8,6 +8,7 @@ bench/tcbench bench/wtperf examples/c +examples/java JAVA ext/collators/reverse ext/compressors/bzip2 BZIP2 ext/compressors/nop diff --git a/build_posix/aclocal/ax_prog_jar.m4 b/build_posix/aclocal/ax_prog_jar.m4 new file mode 100644 index 00000000000..776e804ad9f --- /dev/null +++ b/build_posix/aclocal/ax_prog_jar.m4 @@ -0,0 +1,52 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_jar.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAR +# +# DESCRIPTION +# +# AX_PROG_JAR tests for an existing jar program. It uses the environment +# variable JAR then tests in sequence various common jar programs. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAR=yourcompiler before calling +# AX_PROG_JAR +# +# - at the configure level, setenv JAR +# +# You can use the JAR variable in your Makefile.in, with @JAR@. +# +# Note: This macro depends on the autoconf M4 macros for Java programs. It +# is VERY IMPORTANT that you download that whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. +# +# The general documentation of those macros, as well as the sample +# configure.in, is included in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Egon Willighagen +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AU_ALIAS([AC_PROG_JAR], [AX_PROG_JAR]) +AC_DEFUN([AX_PROG_JAR],[ +AC_REQUIRE([AC_EXEEXT])dnl +if test "x$JAVAPREFIX" = x; then + test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar$EXEEXT) +else + test "x$JAR" = x && AC_CHECK_PROGS(JAR, jar, $JAVAPREFIX) +fi +test "x$JAR" = x && AC_MSG_ERROR([no acceptable jar program found in \$PATH]) +AC_PROVIDE([$0])dnl +]) diff --git a/build_posix/configure.ac.in b/build_posix/configure.ac.in index befd393865e..384ef08cc5a 100644 --- a/build_posix/configure.ac.in +++ b/build_posix/configure.ac.in @@ -59,6 +59,7 @@ fi if test "$wt_cv_enable_java" = "yes"; then JAVAC=${JAVAC-javac} AX_PROG_JAVAC + AX_PROG_JAR AX_JNI_INCLUDE_DIR for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS ; do JNI_CPPFLAGS="$JNI_CPPFLAGS -I$JNI_INCLUDE_DIR" diff --git a/examples/java/Makefile.am b/examples/java/Makefile.am index e69de29bb2d..c7fbfffa48c 100644 --- a/examples/java/Makefile.am +++ b/examples/java/Makefile.am @@ -0,0 +1,21 @@ +AM_CPPFLAGS = -I$(abs_top_builddir) + +JAVAEXAMPLES = $(top_srcdir)/examples/java/com/wiredtiger/examples + +# TODO: How to add to existing Javadoc from main API? +# JDOCDIR = $(top_srcdir)/docs/java +# java_DATA = $(JDOCDIR)/index.html + +javadir = $(datadir)/java +dist_java_JAVA = \ + $(JAVAEXAMPLES)/ex_access.java + +all-local: wiredtiger.jar + +$(JDOCDIR)/index.html: $(dist_java_JAVA) + mkdir -p $(JDOCDIR) + javadoc -public -d $(JDOCDIR) -link http://docs.oracle.com/javase/6/docs/api $(JAVAEXAMPLES)/[A-Z]*.java + +wiredtiger.jar: $(dist_java_JAVA) + (cd $(top_builddir) && \ + $(JAR) -cf wiredtiger.jar com/) diff --git a/examples/java/ex_access.java b/examples/java/com/wiredtiger/examples/ex_access.java similarity index 93% rename from examples/java/ex_access.java rename to examples/java/com/wiredtiger/examples/ex_access.java index 568919ed9c7..1d0904f1c73 100644 --- a/examples/java/ex_access.java +++ b/examples/java/com/wiredtiger/examples/ex_access.java @@ -1,3 +1,4 @@ +package com.wiredtiger.examples; import com.wiredtiger.db.*; public class ex_access { diff --git a/lang/java/Makefile.am b/lang/java/Makefile.am index 81ac4373850..3f9b1ad9ec3 100644 --- a/lang/java/Makefile.am +++ b/lang/java/Makefile.am @@ -19,6 +19,7 @@ dist_java_JAVA = \ $(JAVADESTFULL)/wiredtiger.java \ $(JAVADESTFULL)/wiredtigerConstants.java \ $(JAVADESTFULL)/wiredtigerJNI.java + java_LTLIBRARIES = libwiredtiger_java.la CPPFLAGS += $(JNI_CPPFLAGS) @@ -28,6 +29,7 @@ libwiredtiger_java_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES) #libwiredtiger_java_la_LDFLAGS = -module libwiredtiger_java_la_LIBADD = $(abs_top_builddir)/libwiredtiger.la +all-local: wiredtiger.jar $(JAVASRC)/wiredtiger_wrap.c: $(top_srcdir)/src/include/wiredtiger.in $(SWIG_SOURCES) (cd $(JAVASRC) && \ $(SWIG) -Wall -v -java -nodefaultctor -nodefaultdtor -package com.wiredtiger.db -I$(abs_top_builddir) -outdir $(JAVADEST) -o wiredtiger_wrap.c wiredtiger.i) @@ -35,3 +37,8 @@ $(JAVASRC)/wiredtiger_wrap.c: $(top_srcdir)/src/include/wiredtiger.in $(SWIG_SOU $(JDOCDIR)/index.html: $(dist_java_JAVA) mkdir -p $(JDOCDIR) javadoc -public -d $(JDOCDIR) -link http://docs.oracle.com/javase/6/docs/api $(JAVADESTFULL)/wiredtiger.java $(JAVADESTFULL)/wiredtigerConstants.java $(JAVADESTFULL)/[A-Z]*.java + +wiredtiger.jar: $(dist_java_JAVA) + (cd $(top_builddir) && \ + $(JAR) -cf wiredtiger.jar com/) +