[lttng-dev] [PATCH lttng-ust] Fix: Use env CLASSPATH when building log4j example
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Thu Jun 25 19:05:51 EDT 2015
merged, thanks!
Mathieu
----- On Jun 25, 2015, at 7:00 PM, Michael Jeanson mjeanson at efficios.com wrote:
> 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
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list