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

44 lines
1.2 KiB
Plaintext
Raw Normal View History

:- 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), !.