-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv.sh
73 lines (63 loc) · 1.64 KB
/
env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
################################################################
# Setup the environment for compiling and running JPL-linked Java code.
# Should never be called directly.
# Is called by run_xxx.sh Scripts like run_Example.sh.
#
# Required setup:
#
# * The directory holding java and javac must be in $PATH
# * JPL must be installed
# * Prolog must be available as one of "swi-prolog", "swipl"
# or "pl" in $PATH
#
################################################################
findexe()
{ oldifs="$IFS"
IFS=:
for d in $PATH; do
if [ -x $d/$1 ]; then
IFS="$oldifs"
return 0
fi
done
IFS="$oldifs"
return 1
}
for f in swi-prolog swipl pl; do
if [ -z "$PL" ]; then
if findexe $f; then
PL="$f"
fi
fi
done
if findexe java; then
true
elif [ -x "$JAVA_HOME"/bin/java ]; then
PATH="$PATH:$JAVA_HOME/bin"
else
echo "ERROR: Cannot find java. Please ensure JAVA_HOME is set"
echo "ERROR: properly or java is in $PATH"
exit 1
fi
if findexe javac; then
true
else
echo "ERROR: Cannot find javac. This demo requires the SDK to"
echo "ERROR: be installed and accessible through JAVA_HOME"
echo "ERROR: or PATH"
exit 1
fi
################################################################
# Setup the environment
################################################################
eval `$PL -dump-runtime-variables`
JPLJAR="src/java/lib/jpl.jar"
# JPLJAR="$PLBASE/lib/jpl.jar"
PLLIBDIR="$PLBASE/lib/$PLARCH"
if [ -z "$LD_LIBRARY_PATH" ]; then
LD_LIBRARY_PATH="$PLLIBDIR";
else
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PLLIBDIR"
fi
CLASSPATH="$CLASSPATH:$JPLJAR"
export LD_LIBRARY_PATH CLASSPATH PLLIBDIR