Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: mjeanson@efficios.com (Michael Jeanson)
Subject: [lttng-dev] [PATCH lttng-ust] Fix: Use env CLASSPATH when building log4j example
Date: Thu, 25 Jun 2015 19:00:22 -0400	[thread overview]
Message-ID: <1435273222-19462-1-git-send-email-mjeanson@efficios.com> (raw)

The location of the log4j jar file is specified during configure with
the CLASSPATH envvar, reuse it when building the example.

Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
---
 doc/examples/java-log4j/Makefile | 10 +++++++---
 doc/examples/java-log4j/run      | 10 +++++++---
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/doc/examples/java-log4j/Makefile b/doc/examples/java-log4j/Makefile
index 4b59964..2c629c3 100644
--- a/doc/examples/java-log4j/Makefile
+++ b/doc/examples/java-log4j/Makefile
@@ -20,7 +20,11 @@ JFLAGS = -g
 
 # Default JUL jar name.
 JARFILE=liblttng-ust-agent.jar
-LOG4J=/usr/share/java/log4j.jar
+
+# If system classpath is empty, try to guess log4j location
+ifeq "$(CLASSPATH)" ""
+	CLASSPATH="/usr/local/share/java/log4j.jar:/usr/share/java/log4j.jar"
+endif
 
 # Check if the top level makefile overrides the JUL Jar file name.
 ifneq "$(JAVA_JARFILE_OVERRIDE)" ""
@@ -29,9 +33,9 @@ endif
 
 # Check if the top level makefile overrides the JUL classpath.
 ifeq "$(JAVA_CLASSPATH_OVERRIDE)" ""
-	CLASSPATH=/usr/local/share/java/$(JARFILE):/usr/share/java/$(JARFILE):$(LOG4J)
+	CLASSPATH:=/usr/local/share/java/$(JARFILE):/usr/share/java/$(JARFILE):$(CLASSPATH)
 else
-	CLASSPATH=$(JAVA_CLASSPATH_OVERRIDE)/$(JARFILE):$(LOG4J)
+	CLASSPATH:=$(JAVA_CLASSPATH_OVERRIDE)/$(JARFILE):$(CLASSPATH)
 endif
 
 JC = javac -classpath "$(CLASSPATH):."
diff --git a/doc/examples/java-log4j/run b/doc/examples/java-log4j/run
index 5e3cbeb..9dca608 100755
--- a/doc/examples/java-log4j/run
+++ b/doc/examples/java-log4j/run
@@ -8,15 +8,19 @@
 
 DIR=`dirname $0`
 JARFILE="liblttng-ust-agent.jar"
-LOG4J="/usr/local/share/java/log4j.jar:/usr/share/java/log4j.jar"
+
+# If system classpath is empty, try to guess log4j location
+if [ "x$CLASSPATH" = "x" ]; then
+	CLASSPATH="/usr/local/share/java/log4j.jar:/usr/share/java/log4j.jar"
+fi
 
 cd $DIR
 
 if [ -f "$DIR/.intree" ]; then
-	CLASSPATH="../../../liblttng-ust-java-agent/java/$JARFILE:$LOG4J"
+	CLASSPATH="../../../liblttng-ust-java-agent/java/$JARFILE:$CLASSPATH"
 	LIBPATH="../../../liblttng-ust-java-agent/jni/log4j/.libs"
 else
-	CLASSPATH="/usr/local/share/java/$JARFILE:/usr/share/java/$JARFILE:$LOG4J"
+	CLASSPATH="/usr/local/share/java/$JARFILE:/usr/share/java/$JARFILE:$CLASSPATH"
 	# Use system defined java.library.path
 	#LIBPATH="/usr/local/lib:/usr/lib"
 fi
-- 
1.9.1




             reply	other threads:[~2015-06-25 23:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25 23:00 Michael Jeanson [this message]
2015-06-25 23:05 ` Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435273222-19462-1-git-send-email-mjeanson@efficios.com \
    --to=mjeanson@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox