Module: kamailio
Branch: master
Commit: 3422f3c87b9d19444723cf59d30665cb49019127
URL:
https://github.com/kamailio/kamailio/commit/3422f3c87b9d19444723cf59d30665c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-07-04T10:21:25+02:00
app_java: Makefile - condition on USE_GCJ to compile with gcc or not
- GH #1487, patch built reusing part of the one from A. Messina
- set USE_GCJ=yes if OS has GCC with Java compiler, by default it is
USE_GCJ=no (gcc 7 has removed gcj)
---
Modified: src/modules/app_java/Makefile
---
Diff:
https://github.com/kamailio/kamailio/commit/3422f3c87b9d19444723cf59d30665c…
Patch:
https://github.com/kamailio/kamailio/commit/3422f3c87b9d19444723cf59d30665c…
---
diff --git a/src/modules/app_java/Makefile b/src/modules/app_java/Makefile
index c925b41fee..57cbbec757 100644
--- a/src/modules/app_java/Makefile
+++ b/src/modules/app_java/Makefile
@@ -7,6 +7,8 @@ include ../../Makefile.defs
auto_gen=
NAME=app_java.so
+USE_GCJ=?no
+
#DEFS += -DEXTRA_DEBUG
DIST = $(shell if [ -f "/etc/redhat-release" ]; then cat /etc/redhat-release |
sed "s/.*\([0-9]\)\.[0-9].*/\1/g"; fi)
@@ -16,20 +18,39 @@ DEFS += $(shell pkg-config libgcj-4.4 --cflags)
LIBS += $(shell pkg-config libgcj-4.4 --cflags) -L$(JVM_PATH) -ljvm
else
# try to detect JAVA_HOME
+ifeq ($(USE_GCJ),yes)
JAVA_HOME ?= $(shell readlink -f /usr/bin/javac | sed "s:bin/javac::")
DEFS += $(shell pkg-config libgcj --cflags) -I$(JAVA_HOME)/include
LIBS += $(shell pkg-config libgcj --libs) -L$(JAVA_HOME)/lib -ljvm
+else
+ifeq ($(ARCH),i386)
+ATYPE=i386
+else ifeq ($(ARCH),x86_64)
+ATYPE=amd64
+endif
+JAVA_HOME ?= /usr/lib/jvm/java
+DEFS += -I$(JAVA_HOME)/include
+LIBS += -L$(JAVA_HOME)/jre/lib/$(ATYPE)/server -ljvm
+endif
# 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 ($(USE_GCJ),yes)
ifeq ($(shell [ -d "${JAVA_HOME}" -a -f "$(JAVA_HOME)/include/jni.h"
-a -f "$(JAVA_HOME)/lib/libjvm.so" ] && echo 1 || echo 0),0)
ifneq ($(DOCBUILD),yes)
$(error Cannot locate Java Development Kit. You have to specify environment JAVA_HOME to
build app_java)
endif
endif
+else
+ifeq ($(shell [ -d "${JAVA_HOME}" -a -f "$(JAVA_HOME)/include/jni.h"
-a -f "$(JAVA_HOME)/jre/lib/$(ATYPE)/server/libjvm.so" ] && echo 1 ||
echo 0),0)
+ifneq ($(DOCBUILD),yes)
+$(error Cannot locate Java Development Kit. You have to specify environment JAVA_HOME to
build app_java)
+endif
+endif
+endif
ifeq ($(OS), freebsd)
LIBS+=-pthread
@@ -40,8 +61,10 @@ endif
endif
# disable optimisation for segfaults debugging
+ifeq ($(USE_GCJ),yes)
INCLUDE += -O0 -g
INCLUDES += -O0 -g
+endif
DEFS+=-DKAMAILIO_MOD_INTERFACE