-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfigure
executable file
·70 lines (65 loc) · 1.39 KB
/
configure
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
#!/bin/bash
# Helpers {{{
# just a shorthand for populating .install.mk
inst () {
echo -e "\t@install $1" >> .install.mk
}
split () {
local i=0
OLDIFS=$IFS
IFS=$2
for x in $3; do
eval $1[$i]=$x
i=$((i+1))
done
IFS=$OLDIFS
}
# returns 0 iff $1 > $2
# $1 and $2 must be lists of numbers, dot-separated
too_old () {
local A
local B
split A . "$1"
split B . "$2"
for (( i=0; i<${#A[*]} || i<${#B[*]}; ++i )); do
if (( ${A[$i]:-0} > ${B[$i]:-0} )); then
return 0
fi
done
return 1
}
# }}}
# Parse arguments {{{
while (( $# )); do
case "$1" in
--prefix=*)
PREFIX="${1:9}";;
--prefix)
shift
if (( $# == 0 )); then
echo "Missing prefix."
exit 2
fi
PREFIX=$1;;
*)
echo "Strange argument: $1" 2> /dev/stderr
exit 2;;
esac
shift
done
# }}}
# Check that an OCaml compiler is present. {{{
OCAML_VERSION=$(ocamlc -version 2> /dev/null)
if too_old 3.11 $OCAML_VERSION; then
echo "Please make sure that ocamlc >=3.11 is in your PATH." 2>&1
echo "See http://caml.inria.fr/ocaml/release.en.html" 2>&1
exit 1
fi
# }}}
# Generate install target {{{
echo -e "install: install.native\n\ninstall.%:%" > .install.mk
inst "-d $PREFIX/bin"
inst "-m=rx bin/jstar $PREFIX/bin"
for d in `find library -type d`; do inst "-d $PREFIX/$d"; done
for f in `find library -type f`; do inst "-m=r $f $PREFIX/$f"; done
# }}}