forked from geneweb/geneweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·101 lines (83 loc) · 1.73 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
#!/bin/bash
# TODO? re-enable interactive and configure options
PROG_NAME=${0##*/}
# Output for the generated file
MAKEFILE=Makefile.config
STRIP=true
RM=
EXE=
OS_TYPE=
API=
API_DEP=
while [[ $# -ne 0 ]]; do
case $1 in
--api)
API_DEP="piqirun.ext redis-sync yojson curl";
API="-D API" ;;
*)
echo -e "\\x1b[33m[WARNING]\\x1b[0m Option $1 unknown and ignored.";;
esac
[[ $# -gt 0 ]] && shift
done
# Functions that print the checked information
# Length of line for print_check_*
LINE_WIDTH=65
print_check_gen() {
local n=$(( $LINE_WIDTH-${#2}-8 ))
printf "\\x1b[36m[INFO]\\x1b[0m %s " "$2"
printf ".%.0s" $(eval "echo {1.."$(($n))"}")
printf " \\x1b[%sm%s\\x1b[0m" "$1" "$3"
echo
}
print_check_ok() {
print_check_gen "32" "$1" "${2:-OK}"
}
# Functions to check the environment
check_os() {
OS_TYPE=`uname -s`
if [[ $OS_TYPE == "Linux" ]] ; then
print_check_ok "Checking OS type" "Linux"
EXE=
RM="/bin/rm -f"
STRIP=strip
elif [[ $OS_TYPE == "Darwin" ]] ; then
print_check_ok "Checking OS type" "Darwin"
EXE=
RM="/bin/rm -f"
STRIP=strip
else
print_check_ok "Checking OS type" "WINDOWS"
OS_TYPE="Win"
CAMLP5F+=" -D WINDOWS"
EXE=".exe"
RM="rm -f"
STRIP=true
fi
}
# Functions to print Makefile.config.
# Print common options, should be called first.
print_common_header() {
echo "# This file is generated by $0."
echo
echo "OS_TYPE=${OS_TYPE}"
}
print_tools() {
echo
echo "# Tools"
echo "STRIP=${STRIP}"
echo "RM=${RM}"
echo "EXE=${EXE}"
}
print_vars() {
echo "API=${API}"
echo "API_DEP=${API_DEP}"
}
print_makefile() {
(print_common_header
print_tools
print_vars
) > $MAKEFILE
}
# Print Makefile
check_os
print_makefile