This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/LGPL/JPL/jpl_paths.yap.in
vsc 31ff28d3ee upgrade JPL
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1936 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2007-09-27 15:25:34 +00:00

42 lines
1.1 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), !.
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), !.