-
Notifications
You must be signed in to change notification settings - Fork 4
/
configure
executable file
·149 lines (120 loc) · 3.37 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#! /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.3"
exec_suffix=""
check_library () {
# $1: the name of the library (findlib)
ocamlfind query "$1" >/dev/null 2>/dev/null
return
return 1 # not found
}
echo "Welcome to lwt-equeue 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 Lwt is available:
printf "%s" "Checking for Lwt... "
if check_library lwt; then
echo "found"
else
echo "not found"
echo "Download Lwt from http://ocsigen.org/lwt/"
exit 1
fi
######################################################################
# Check that equeue is available:
printf "%s" "Checking for equeue... "
if check_library equeue; then
echo "found"
else
echo "not found"
echo "Download equeue from http://projects.camlcity.org/projects/ocamlnet.html"
exit 1
fi
######################################################################
# Check that cohttpserver is available:
printf "%s" "Checking for cohttpserver... "
has_cohttpserver=0
if check_library cohttpserver; then
echo "found"
has_cohttpserver=1
else
echo "not found, continuing"
echo "Download cohttpserver from http://github.com/jaked/ocaml-cohttpserver/"
fi
######################################################################
# Check that netplex is available:
printf "%s" "Checking for netplex... "
has_netplex=0
if check_library netplex; then
echo "found"
has_netplex=1
else
has_cohttpserver=0
echo "not found"
echo "Download netplex from http://projects.camlcity.org/projects/ocamlnet.html"
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="lwt-equeue lwt-stuff"
if [ $has_cohttpserver -gt 0 ]; then
pkglist="$pkglist cohttpserver-netplex"
fi
if [ $has_delimcc -gt 0 ]; then
pkglist="$pkglist lwt-fiber"
fi
######################################################################
# Write Makefile.conf
echo "Writing Makefile.conf"
cat <<_EOF_ >Makefile.conf
# Makefike.conf written by configure
# The lwt-equeue version
VERSION = $version
# The packages to build in the right order:
PKGLIST = $pkglist
HAS_COHTTPSERVER = $has_cohttpserver
HAS_DELIMCC = $has_delimcc
_EOF_
######################################################################
# Finish
echo
echo "You can now compile lwt-equeue by invoking"
echo " make all"
echo "Finally, a"
echo " make install"
echo "will install the package(s)."