This repository has been archived by the owner on Apr 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure
executable file
·84 lines (69 loc) · 1.53 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
#!/bin/sh
set -e
MYDIR="$(dirname "$(realpath "$0")")"
CONFIG_VAR_FILE=${MYDIR}/config.vars
WITH_KALEIDOSCOPE=1
WITH_BIFROST=1
ECHO=/bin/echo
OS=$(uname)
if [ $OS == "Darwin" ];
then
STATIC=""
else
STATIC="-static"
fi
usage_with_default()
{
if [ $# = 4 ]; then
if [ "$2" = 1 ]; then
DEF=$3
else
DEF=$4
fi
else
DEF=$2
fi
$ECHO " $1 (default $DEF)"
}
usage()
{
$ECHO "Usage: ./configure [setting=value] [options]"
$ECHO ""
$ECHO "Options include:"
usage_with_default "--enable/disable-kaleidoscope" "WITH_KALEIDOSCOPE" "enable" "enable"
$ECHO " Add libkaleidoscope that contains some utilities to build transactions"
usage_with_default "--enable/disable-bifrost" "WITH_BIFROST" "enable" "enable"
$ECHO " Add libbifrost, an implementation of a Bifrost client"
$ECHO 1
}
add_var()
{
if [ -n "$2" ]; then
$ECHO "Setting $1... $2"
else
$ECHO "$1 not found"
fi
$ECHO "$1=$2" >> $CONFIG_VAR_FILE
[ -z "$3" ] || echo "#define $1 $2" >> "$3"
}
for opt in "$@"; do
case "$opt" in
--enable-kaleidoscope) WITH_KALEIDOSCOPE=1;;
--disable-kaleidoscope) WITH_KALEIDOSCOPE=0;;
--enable-bifrost) WITH_BIFROST=1;;
--disable-bifrost) WITH_BIFROST=0;;
--help|-h) usage;;
*)
$ECHO "Unknown option '$opt'" >&2
usage
;;
esac
done
# Empty file, overwrite if already present
$ECHO -n > $CONFIG_VAR_FILE
add_var WITH_KALEIDOSCOPE "$WITH_KALEIDOSCOPE"
add_var WITH_BIFROST "$WITH_BIFROST"
if [ -n "$STATIC" ];
then
add_var STATIC "$STATIC"
fi