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:16:49 +0000 (17:16 -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 166a260b5e0bf30cf49dd9ca45ee51cc7ee3f634..6ff01a4c6dbc8ad617391fc9a69ec6abd9d4e452 100644 (file)
@@ -54,7 +54,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 0d226021adfb32149b93aa2f210304ef049c33a3..9404054d207642ca0dcc054f292c780294ee5b00 100644 (file)
@@ -8,7 +8,7 @@ doc_examples_demo_tracelogdir = ${docdir}/examples/demo-tracelog
 doc_examples_clock_overridedir = ${docdir}/examples/clock-override
 doc_examples_getcpu_overridedir = ${docdir}/examples/getcpu-override
 
-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 \
@@ -16,6 +16,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 \
@@ -74,7 +82,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; \
@@ -99,6 +107,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:
@@ -114,8 +127,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.027237 seconds and 4 git commands to generate.