2007-09-27 16:25:34 +01:00
|
|
|
|
|
|
|
:- ensure_loaded(library(swi)).
|
|
|
|
|
2005-03-14 17:01:29 +00:00
|
|
|
jpl_java_home('@JAVA_HOME@').
|
|
|
|
|
2007-09-27 16:25:34 +01:00
|
|
|
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), !.
|
|
|
|
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), !.
|
|
|
|
|
|
|
|
|
2005-03-14 17:01:29 +00:00
|
|
|
|