From 0e187c2e852386f767305e69d26fc020fc31d5e8 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 11 May 2009 10:12:46 +0200 Subject: [PATCH] Build system: Build and install .java files in bindings/java/ automatically. --- bindings/Makefile.am | 9 +++++++-- bindings/java/Makefile.am | 35 +++++++++++++++++++++++++++++++++++ configure.in | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 bindings/java/Makefile.am diff --git a/bindings/Makefile.am b/bindings/Makefile.am index 3ab4c871..fb68657c 100644 --- a/bindings/Makefile.am +++ b/bindings/Makefile.am @@ -1,5 +1,10 @@ -EXTRA_DIST = java/org/collectd/java/*.java java/org/collectd/api/*.java \ - perl/Collectd.pm perl/Makefile.PL perl/Collectd/Makefile.PL \ +SUBDIRS = + +if BUILD_WITH_JAVA +SUBDIRS += java +endif + +EXTRA_DIST = perl/Collectd.pm perl/Makefile.PL perl/Collectd/Makefile.PL \ perl/Collectd/Unixsock.pm all-local: @PERL_BINDINGS@ diff --git a/bindings/java/Makefile.am b/bindings/java/Makefile.am new file mode 100644 index 00000000..6eead28e --- /dev/null +++ b/bindings/java/Makefile.am @@ -0,0 +1,35 @@ +EXTRA_DIST = org/collectd/api/CollectdConfigInterface.java \ + org/collectd/api/CollectdFlushInterface.java \ + org/collectd/api/CollectdInitInterface.java \ + org/collectd/api/Collectd.java \ + org/collectd/api/CollectdLogInterface.java \ + org/collectd/api/CollectdMatchFactoryInterface.java \ + org/collectd/api/CollectdMatchInterface.java \ + org/collectd/api/CollectdNotificationInterface.java \ + org/collectd/api/CollectdReadInterface.java \ + org/collectd/api/CollectdShutdownInterface.java \ + org/collectd/api/CollectdTargetFactoryInterface.java \ + org/collectd/api/CollectdTargetInterface.java \ + org/collectd/api/CollectdWriteInterface.java \ + org/collectd/api/DataSet.java \ + org/collectd/api/DataSource.java \ + org/collectd/api/Notification.java \ + org/collectd/api/OConfigItem.java \ + org/collectd/api/OConfigValue.java \ + org/collectd/api/PluginData.java \ + org/collectd/api/ValueList.java + +java-build-stamp: org/collectd/api/*.java + $(JAVAC) -d "$(builddir)" "$(srcdir)/org/collectd/api"/*.java + touch "$@" + +all-local: java-build-stamp + +install-exec-local: java-build-stamp + mkdir -p "$(pkglibdir)/java/org/collectd/api" + $(INSTALL) -m 644 "$(builddir)/org/collectd/api"/*.class \ + "$(DESTDIR)$(pkglibdir)/java/org/collectd/api/" + +clean-local: + rm -f "$(builddir)/org/collectd/api"/*.class + rm -f "$(builddir)/java-build-stamp" diff --git a/configure.in b/configure.in index bed0c5df..e37a8ab2 100644 --- a/configure.in +++ b/configure.in @@ -1481,6 +1481,7 @@ with_java_home="$JAVA_HOME" with_java_vmtype="client" with_java_cflags="" with_java_libs="" +JAVAC="$JAVAC" AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])], [ if test "x$withval" = "xno" @@ -1528,6 +1529,19 @@ then else AC_MSG_RESULT([not found]) fi + + if test "x$JAVAC" = "x" + then + AC_MSG_CHECKING([for javac]) + TMPDIR=`find -L "$with_java_home" -name javac | head -n 1` + if test "x$TMPDIR" != "x" + then + JAVAC="$TMPDIR" + AC_MSG_RESULT([$JAVAC]) + else + AC_MSG_RESULT([not found]) + fi + fi else if test "x$with_java_home" != "x" then AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home]) @@ -1546,6 +1560,24 @@ if test "x$JAVA_LDFLAGS" != "x" then AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS]) fi +if test "x$JAVAC" = "x" +then + with_javac_path="$PATH" + if test "x$with_java_home" != "x" + then + with_javac_path="$with_java_home:with_javac_path" + if test -d "$with_java_home/bin" + then + with_javac_path="$with_java_home/bin:with_javac_path" + fi + fi + + AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path") +fi +if test "x$JAVAC" = "x" +then + with_java="no (javac not found)" +fi SAVE_CPPFLAGS="$CPPFLAGS" SAVE_CFLAGS="$CFLAGS" @@ -3691,7 +3723,7 @@ AC_SUBST(LCC_VERSION_STRING) AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h) -AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile) +AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile) if test "x$with_librrd" = "xyes" \ && test "x$librrd_threadsafe" != "xyes" -- 2.11.0