Jelajahi Sumber

app_java: detect JAVA_HOME and use proper libgcj versioning

Victor Seva 11 tahun lalu
induk
melakukan
5c1b8e0f0f
1 mengubah file dengan 7 tambahan dan 4 penghapusan
  1. 7 4
      modules/app_java/Makefile

+ 7 - 4
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