257c3a2cbc
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2233 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
44 lines
1.2 KiB
Plaintext
44 lines
1.2 KiB
Plaintext
|
|
:- ensure_loaded(library(swi)).
|
|
|
|
jpl_java_home('@JAVA_HOME@').
|
|
|
|
yap.
|
|
|
|
load_jpl_lib :-
|
|
jpl_java_home(JavaHome),
|
|
fetch_arch(Arch),
|
|
gen_jvm_lib(JavaHome,Arch,JPL,JLibs),
|
|
load_foreign_files(JPL, JLibs, install), !.
|
|
|
|
fetch_arch(Arch) :-
|
|
current_prolog_flag(host_type,Name),
|
|
atom_codes(Name,Codes),
|
|
gen_arch(Codes,Arch).
|
|
|
|
gen_arch(L,mac) :-
|
|
append(_,[0'd,0'a,0'r,0'w,0'i,0'n|_],L), !.
|
|
% handle compilation in 64 bit machine of 32 bit binary.
|
|
gen_arch([0'x,0'8,0'6,0'_,0'6,0'4|_],i386) :- yap_flag(max_tagged_integer, 67108863).
|
|
gen_arch([0'x,0'8,0'6,0'_,0'6,0'4|_],amd64).
|
|
gen_arch([0'i,_,0'8,0'6|_],i386). % take all versions of X86
|
|
gen_arch([0's,0'p,0'a,0'r,0'c|_],sparc).
|
|
gen_arch([0'/,0'u,0's,0'r|_],mac).
|
|
|
|
gen_jvm_lib(_,mac,[jpl],[]) :- !.
|
|
gen_jvm_lib(JavaHome,Arch,[jpl], [JLib]) :-
|
|
atom_concat([JavaHome,'/jre/lib/',Arch,'/client/libjvm.so'],JLib),
|
|
exists(JLib), !.
|
|
gen_jvm_lib(JavaHome,Arch,[jpl], [JLib]) :-
|
|
atom_concat([JavaHome,'/jre/lib/',Arch,'/server/libjvm.so'],JLib),
|
|
exists(JLib), !.
|
|
gen_jvm_lib(JavaHome,Arch,[jpl], [JLib]) :-
|
|
atom_concat([JavaHome,'/jre/lib/',Arch,'/classic/libjvm.so'],JLib),
|
|
exists(JLib), !.
|
|
gen_jvm_lib(JavaHome,Arch,[jpl], [JLib]) :-
|
|
atom_concat([JavaHome,'/jre/lib/',Arch,'/libjvm.so'],JLib),
|
|
exists(JLib), !.
|
|
|
|
|
|
|