[sr-dev] git:master: Fixed bug with JAVA_HOME detection.

Konstantin Mosesov ez at voipgroup.org.ua
Sat May 24 04:53:04 CEST 2014

Module: sip-router
Branch: master
Commit: 5a05370f35bdeb7277b2f53f5c3e95fb672d4024
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5a05370f35bdeb7277b2f53f5c3e95fb672d4024

Author: Konstantin Mosesov <ez at voipgroup.org.ua>
Committer: Konstantin Mosesov <ez at voipgroup.org.ua>
Date:   Sat May 24 05:57:16 2014 +0400

Fixed bug with JAVA_HOME detection.


 modules/app_java/Makefile |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/modules/app_java/Makefile b/modules/app_java/Makefile
index 68b8f8a..792a116 100644
--- a/modules/app_java/Makefile
+++ b/modules/app_java/Makefile
@@ -20,6 +20,15 @@ JAVA_HOME ?= $(shell readlink -f /usr/bin/javac | sed "s:bin/javac::")
 DEFS += $(shell pkg-config libgcj12 --cflags) -I$(JAVA_HOME)/include
 LIBS += $(shell pkg-config libgcj12 --libs) -L$(JAVA_HOME)/lib  -ljvm
+# On Debian 7.5 there is a bug with JAVA_HOME detection.
+# $(shell readlink -f /usr/bin/javac | sed "s:bin/javac::") points to perl wrapper script (/usr/bin/gcj-wrapper-4.7)
+# whereas the real compiler is at /usr/bin/gcj-4.7. As the result, JAVA_HOME will not be a directory, that is incorrect.
+# At this point I don't see any universal method as explicit setting this variable at the compile phase.
+# -- ez
+ifeq ($(shell [ -d "${JAVA_HOME}" -a -f "$(JAVA_HOME)/include/jni.h" -a -f "$(JAVA_HOME)/lib/libjvm.so" ] && echo 1 || echo 0),0)
+    $(error Can't locate Java Development Kit. You have to specify environment JAVA_HOME to build app_java)
 ifeq ($(OS), freebsd)

More information about the sr-dev mailing list