Fix: build log4j example when enabled
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 25 Jun 2015 21:13:07 +0000 (17:13 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 25 Jun 2015 21:17:56 +0000 (17:17 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
.gitignore
doc/examples/Makefile.am
doc/examples/java-jul/run
doc/examples/java-log4j/.intree [new file with mode: 0644]
doc/examples/java-log4j/run

index 10e4176c3fbe5c09692d8cb4bab1c84861ec1508..f5a983d4e1b0b63d34607578bccbd9f10358728c 100644 (file)
@@ -53,7 +53,7 @@ tests/benchmark/bench2
 
 # Java agent library
 *.class
-liblttng-ust-agent.jar
+liblttng-ust-agent*.jar
 classnoinst.stamp
 jni-header.stamp
 jul-jni-header.stamp
index 6f0a31aa37d777498aa516d17ba836d35b4950b6..3d2bca34ac24e4fa3c9a20725070da93ad5f340a 100644 (file)
@@ -5,7 +5,7 @@ doc_examples_demodir = ${docdir}/examples/demo
 doc_examples_hello_static_libdir = ${docdir}/examples/hello-static-lib
 doc_examples_demo_tracefdir = ${docdir}/examples/demo-tracef
 
-if BUILD_JAVA_AGENT
+if BUILD_JAVA_AGENT_WITH_JUL
 doc_examples_java_juldir = ${docdir}/examples/java-jul
 dist_doc_examples_java_jul_DATA = java-jul/Makefile \
                                  java-jul/Hello.java \
@@ -13,6 +13,14 @@ dist_doc_examples_java_jul_DATA = java-jul/Makefile \
 SUBDIRS_JUL = java-jul
 endif
 
+if BUILD_JAVA_AGENT_WITH_LOG4J
+doc_examples_java_log4jdir = ${docdir}/examples/java-log4j
+dist_doc_examples_java_log4j_DATA = java-log4j/Makefile \
+                                 java-log4j/Hello.java \
+                                 java-log4j/run
+SUBDIRS_LOG4J = java-log4j
+endif
+
 dist_doc_examples_DATA = README
 
 dist_doc_examples_easy_ust_DATA = easy-ust/Makefile \
@@ -56,7 +64,7 @@ endif
 
 all-local:
        @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-               for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL); do \
+               for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL) $(SUBDIRS_LOG4J); do \
                        cp -pfR $(srcdir)/$$subdir $(builddir); \
                done; \
        fi; \
@@ -81,6 +89,11 @@ all-local:
                for subdir in $(SUBDIRS_JUL); do \
                        (cd $(SUBDIRS_JUL) && $(MAKE) JAVA_CLASSPATH_OVERRIDE="../../../liblttng-ust-java-agent/java" JAVA_JARFILE_OVERRIDE="liblttng-ust-agent.jar" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
                done; \
+       fi; \
+       if [ x"$(SUBDIRS_LOG4J)" != x"" ]; then \
+               for subdir in $(SUBDIRS_LOG4J); do \
+                       (cd $(SUBDIRS_LOG4J) && $(MAKE) JAVA_CLASSPATH_OVERRIDE="../../../liblttng-ust-java-agent/java" JAVA_JARFILE_OVERRIDE="liblttng-ust-agent.jar" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
+               done; \
        fi;
 
 clean-local:
@@ -96,8 +109,15 @@ clean-local:
                        fi; \
                done; \
        fi; \
+       if [ x"$(SUBDIRS_LOG4J)" != x"" ]; then \
+               for subdir in $(SUBDIRS_LOG4J); do \
+                       if [ -d $$subdir ]; then \
+                               (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) clean && cd ..) || exit 1; \
+                       fi; \
+               done; \
+       fi; \
        if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-               for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL); do \
+               for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL) $(SUBDIRS_LOG4J); do \
                        rm -rf $(builddir)/$$subdir; \
                done; \
        fi;
index 1beac853f3e9cd59cdbc40887df81e11dbfc070d..37a3cfdf043b0a5df58a0df280434433a9a10c7a 100755 (executable)
@@ -16,7 +16,8 @@ if [ -f "$DIR/.intree" ]; then
        LIBPATH="../../../liblttng-ust-java-agent/jni/jul/.libs"
 else
        CLASSPATH="/usr/local/share/java/$JARFILE:/usr/share/java/$JARFILE"
-       LIBPATH="/usr/local/lib:/usr/lib"
+       # Use system defined java.library.path
+       #LIBPATH="/usr/local/lib:/usr/lib"
 fi
 
 java -classpath "$CLASSPATH:." -Djava.library.path="$LIBPATH" Hello
diff --git a/doc/examples/java-log4j/.intree b/doc/examples/java-log4j/.intree
new file mode 100644 (file)
index 0000000..e69de29
index 128725f1e2eda38bfbebcc83c89e770d7aa0a48e..5e3cbeb4b20e84bb16a9cd2ab9830dde9dfb7318 100755 (executable)
@@ -17,9 +17,10 @@ if [ -f "$DIR/.intree" ]; then
        LIBPATH="../../../liblttng-ust-java-agent/jni/log4j/.libs"
 else
        CLASSPATH="/usr/local/share/java/$JARFILE:/usr/share/java/$JARFILE:$LOG4J"
-       LIBPATH="/usr/local/lib:/usr/lib"
+       # Use system defined java.library.path
+       #LIBPATH="/usr/local/lib:/usr/lib"
 fi
 
-java -classpath "$CLASSPATH:." Hello
+java -classpath "$CLASSPATH:." -Djava.library.path="$LIBPATH" Hello
 
 cd -
This page took 0.026719 seconds and 4 git commands to generate.