/
configure
executable file
·118 lines (94 loc) · 2.49 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#! /bin/sh
# adapted from ocamlnet's configure
#######################################################################
# Helpers:
# Split $PATH into words:
oldifs="$IFS"
IFS=" :"
spacepath=`echo $PATH`
IFS="$oldifs"
get_path () {
for d in $spacepath; do
if test -x "$d/$1"; then
echo "$d/$1"
return
fi
done
}
ocamlc=`get_path ocamlc`
version="0.2"
exec_suffix=""
check_library () {
# $1: the name of the library (findlib)
ocamlfind query "$1" >/dev/null 2>/dev/null
return
return 1 # not found
}
check_libraryjs () {
# $1: the name of the library (findlib)
ocamlfindjs query "$1" >/dev/null 2>/dev/null
return
return 1 # not found
}
echo "Welcome to froc version $version" >&2
######################################################################
# Check ocamlfind
printf "%s" "Checking for findlib... "
if check_library stdlib; then
echo "found"
else
echo "not found"
echo "Download findlib from http://projects.camlcity.org/projects/findlib.html"
exit 1
fi
######################################################################
# Check that ocamljs is available:
printf "%s" "Checking for ocamljs... "
has_ocamljs=0
if check_libraryjs ocamljs; then
echo "found"
has_ocamljs=1
else
echo "not found, continuing"
echo "Download ocamljs from http://github.com/jaked/ocamljs/"
fi
######################################################################
# Check that delimcc is available:
printf "%s" "Checking for delimcc... "
has_delimcc=0
if check_library delimcc; then
echo "found"
has_delimcc=1
else
echo "not found, continuing"
echo "Download delimcc from http://okmij.org/ftp/continuations/"
fi
######################################################################
# Summary
pkglist="froc froc-syntax"
if [ $has_ocamljs -gt 0 ]; then
pkglist="$pkglist froc-dom"
fi
if [ $has_delimcc -gt 0 ]; then
pkglist="$pkglist froc-direct"
fi
######################################################################
# Write Makefile.conf
echo "Writing Makefile.conf"
cat <<_EOF_ >Makefile.conf
# Makefike.conf written by configure
# The froc version
VERSION = $version
# The packages to build in the right order:
PKGLIST = $pkglist
HAS_OCAMLJS = $has_ocamljs
HAS_DELIMCC = $has_delimcc
_EOF_
######################################################################
# Finish
echo
echo "You can now compile froc by invoking"
echo " make all"
echo "Finally, a"
echo " make install"
echo "will install the package(s)."