Module: sip-router
Branch: vseva/app_java_makefile
Commit: 3c672ccdc15b852ac37acbd0ca1f27e2b47a9d09
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3c672cc…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: Thu Dec 12 08:53:59 2013 +0100
app_java: detect JAVA_HOME and use proper libgcj versioning
---
modules/app_java/Makefile | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/modules/app_java/Makefile b/modules/app_java/Makefile
index 6a95251..68b8f8a 100644
--- a/modules/app_java/Makefile
+++ b/modules/app_java/Makefile
@@ -15,14 +15,17 @@ JVM_PATH = $(shell dirname `find /usr/lib/jvm/java/ -name
"libjvm.so"`)
DEFS += $(shell pkg-config libgcj-4.4 --cflags)
LIBS += $(shell pkg-config libgcj-4.4 --cflags) -L$(JVM_PATH) -ljvm
else
-# for now is hard coded, will resolve this later
-JAVA_HOME ?= /usr/lib/jvm/java-gcj-4.7
-DEFS += $(shell pkg-config libgcj-4.7 --cflags) -I$(JAVA_HOME)/include
-LIBS += $(shell pkg-config libgcj-4.7 --libs) -L$(JAVA_HOME)/lib -ljvm
+# try to detect JAVA_HOME
+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
ifeq ($(OS), freebsd)
LIBS+=-pthread
endif
+ifeq ($(OS), linux)
+DEFS += -I$(JAVA_HOME)/include/linux
+endif
endif
# disable optimisation for segfaults debugging