forked from crokignol/geneweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·78 lines (66 loc) · 2.36 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
#!/bin/bash
OCAML_MIN_VER="4.02"
verge() {
# osx doesn't have sort -V
# [ "$2" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
[ "$2" = "`echo -e "$1\n$2" | tr ' ' '\n' | sort -n | head -n1`" ]
}
if ocamlc -v >/dev/null 2>&1; then
echo "ocamlc ... OK"
else
echo "You need the command ocamlc accessible in the path!"
echo "Configuration script failed!"
exit 1
fi
OCAML_VER="`ocamlc -version`"
if verge "$OCAML_VER" "$OCAML_MIN_VER"; then
echo "ocamlc version $OCAML_VER >= $OCAML_MIN_VER ... OK"
else
echo "OCaml version $OCAML_MIN_VER or newer needed"
echo "Configuration script failed!"
exit 1
fi
if camlp5 -v >/dev/null 2>&1; then
echo "camlp5 ... OK"
else
echo "You need the command camlp5 accessible in the path!"
echo "Configuration script failed!"
exit 1
fi
if [ "`echo 'print_endline Sys.os_type;;' | ocaml -stdin -noprompt`" = "Unix" ]; then
echo "OS type ... Unix"
cp tools/Makefile.inc.unix tools/Makefile.inc
else
echo "OS type ... Windows"
cp tools/Makefile.inc.win tools/Makefile.inc
fi
D_GW_DIR=`pwd`/
if test -e "tools/Makefile.inc"; then
sed "s|^\(GW_DIR=\).*|\1$D_GW_DIR|" tools/Makefile.inc > tools/Makefile.inc.tmp
mv tools/Makefile.inc.tmp tools/Makefile.inc
fi
cp tools/Makefile.ocaml.inc tools/Makefile.ocaml
if ocamlfind printconf >/dev/null 2>&1; then :
else
echo "Could not find ocamlfind in the path."
echo "You may need to update Makefile.ocaml by hand."
exit 1
fi
D_CAMLP5D=`ocamlfind query camlp5`/
D_MYSQL=`ocamlfind query mysql`/
D_OCURL=`ocamlfind query curl`/
D_OREDIS=`ocamlfind query redis`/
D_RE=`ocamlfind query re`/
if test -e "tools/Makefile.ocaml"; then
sed "s|^\(CAMLP5D=\).*|\1$D_CAMLP5D|" tools/Makefile.ocaml > tools/Makefile.ocaml.tmp
mv tools/Makefile.ocaml.tmp tools/Makefile.ocaml
sed "s|^\(MYSQL=\).*|\1$D_MYSQL|" tools/Makefile.ocaml > tools/Makefile.ocaml.tmp
mv tools/Makefile.ocaml.tmp tools/Makefile.ocaml
sed "s|^\(OCURL=\).*|\1$D_OCURL|" tools/Makefile.ocaml > tools/Makefile.ocaml.tmp
mv tools/Makefile.ocaml.tmp tools/Makefile.ocaml
sed "s|^\(OREDIS=\).*|\1$D_OREDIS|" tools/Makefile.ocaml > tools/Makefile.ocaml.tmp
mv tools/Makefile.ocaml.tmp tools/Makefile.ocaml
sed "s|^\(RE=\).*|\1$D_RE|" tools/Makefile.ocaml > tools/Makefile.ocaml.tmp
mv tools/Makefile.ocaml.tmp tools/Makefile.ocaml
fi
echo "Configuration script succeeded!"