-
Notifications
You must be signed in to change notification settings - Fork 8
/
configure
executable file
·142 lines (119 loc) · 2.58 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
#!/bin/bash
#
# ./configure -- A very simple configure script for v86d.
#
# (c) 2006-2007, Michal Januszewski <[email protected]>
#
# In time, it will be replaced by a fully-fledged version.
#
copt_klibc=CONFIG_KLIBC
copt_klibc_desc="Link statically against klibc"
copt_klibc_type="bool"
copt_klibc_def=n
copt_debug=CONFIG_DEBUG
copt_debug_desc="Use additional debugging features"
copt_debug_type="bool"
copt_debug_def=n
copt_x86emu=CONFIG_X86EMU
copt_x86emu_desc="Use x86emu for BIOS calls"
copt_x86emu_type="bool"
copt_x86emu_def=auto
copt_x86emu_test()
{
local m=`uname -m`
if [ "$m" = "i686" -o "$m" = "i586" -o "$m" = "i486" -o "$m" = "i386" ]; then
echo "n";
elif [ "$m" = "x86_64" ]; then
echo "y";
else
echo "It looks like your architecture '$m' isn't supported by this version of v86d." >&2
exit 1
fi
}
options=`set | grep '^copt_' | sed -re 's/copt_([^_=]+)[_=].*/\1/' | uniq`
write_conf()
{
echo -n > config.h
for i in ${options} ; do
eval vval=\$copt_$i\_val
eval vtype=\$copt_$i\_type
eval vname=\$copt_$i
if [[ "$vtype" == "bool" ]]; then
if [[ "$vval" == "y" ]]; then
echo "#define $vname" >> config.h
else
echo "#undef $vname" >> config.h
fi
else
echo "#define $vname \"$vval\"" >> config.h
fi
done
echo "config.h successfully created."
echo "You can run \`make\` now."
}
usage()
{
cat <<EOTB
v86d configuration script
Please use the following options to configure v86d.
EOTB
printf " %-20s %-s\n\n" --default "Use a default v86d configuration"
for i in ${options} ; do
eval vtype=\$copt_$i\_type
eval vdesc=\$copt_$i\_desc
eval vdef=\$copt_$i\_def
if [[ ${vtype} == "string" ]]; then
with="--with-${i}=VAL"
else
with="--with-${i}"
fi
vdesc="${vdesc} (default: $vdef)"
printf " %-20s %-s\n" ${with} "${vdesc}"
done
}
if [[ $# == 0 ]]; then
usage
exit
fi
for i in ${options} ; do
eval copt_${i}_val="\$copt_${i}_def"
if [ -n "$(set | grep copt_${i}_test)" ]; then
eval copt_${i}_val="\$(copt_${i}_test)"
fi
done
for i in $* ; do
if [[ "$i" == "--help" ]]; then
usage
exit
elif [[ "$i" == "--default" ]]; then
write_conf
exit
fi
j=${i//--with-}
if [[ "$j" != "$i" ]]; then
with=y
else
j=${i//--without-}
if [[ "$j" != "$i" ]]; then
with=n
else
usage
exit
fi
fi
optval=${j#*=}
optname=${j%=*}
eval t=\$copt_${optname}_val
if [[ "x$t" == "x" ]]; then
echo "Unrecognized setting ${optname}." 1>&2
exit
fi
eval vtype=\$copt_${optname}_type
if [[ "$vtype" == "bool" ]]; then
eval copt_${optname}_val=${with}
else
eval copt_${optname}_val=${optval}
fi
done
write_conf
exit