x86emu: add support for the rdtsc opcode
[v86d.git] / configure
blob253b71cae63329ec193ddf802c50f8c679b8446c
1 #!/bin/bash
3 # ./configure -- A very simple configure script for splashutils.
5 # (c) 2006-2007, Michal Januszewski <spock@gentoo.org>
7 # In time, it will be replaced by a fully-fledged version.
10 copt_klibc=CONFIG_KLIBC
11 copt_klibc_desc="Link statically against klibc"
12 copt_klibc_type="bool"
13 copt_klibc_def=n
15 copt_x86emu=CONFIG_X86EMU
16 copt_x86emu_desc="Use x86emu for BIOS calls"
17 copt_x86emu_type="bool"
18 copt_x86emu_def=auto
19 copt_x86emu_test()
21 local m=`uname -m`
22 if [ "$m" != "i686" -a "$m" != "i586" -a "$m" != "i486" -a "$m" != "i386" ]; then
23 echo "y";
24 else
25 echo "n";
29 options=`set | grep '^copt_' | sed -re 's/copt_([^_=]+)[_=].*/\1/' | uniq`
31 write_conf()
33 echo -n > config.h
35 for i in ${options} ; do
36 eval vval=\$copt_$i\_val
37 eval vtype=\$copt_$i\_type
38 eval vname=\$copt_$i
40 if [[ "$vtype" == "bool" ]]; then
41 if [[ "$vval" == "y" ]]; then
42 echo "#define $vname" >> config.h
43 else
44 echo "#undef $vname" >> config.h
46 else
47 echo "#define $vname \"$vval\"" >> config.h
49 done
51 echo "config.h successfully created."
52 echo "You can run \`make\` now."
55 usage()
57 cat <<EOTB
58 v86d configuration script
60 Please use the following options to configure v86d.
61 EOTB
62 printf " %-20s %-s\n\n" --default "Use a default v86d configuration"
64 for i in ${options} ; do
65 eval vtype=\$copt_$i\_type
66 eval vdesc=\$copt_$i\_desc
67 eval vdef=\$copt_$i\_def
69 if [[ ${vtype} == "string" ]]; then
70 with="--with-${i}=VAL"
71 else
72 with="--with-${i}"
75 vdesc="${vdesc} (default: $vdef)"
77 printf " %-20s %-s\n" ${with} "${vdesc}"
78 done
81 if [[ $# == 0 ]]; then
82 usage
83 exit
86 for i in ${options} ; do
87 eval copt_${i}_val="\$copt_${i}_def"
88 if [ -n "$(set | grep copt_${i}_test)" ]; then
89 eval copt_${i}_val="\$(copt_${i}_test)"
91 done
93 for i in $* ; do
94 if [[ "$i" == "--help" ]]; then
95 usage
96 exit
97 elif [[ "$i" == "--default" ]]; then
98 write_conf
99 exit
102 j=${i//--with-}
103 if [[ "$j" != "$i" ]]; then
104 with=y
105 else
106 j=${i//--without-}
107 if [[ "$j" != "$i" ]]; then
108 with=n
109 else
110 usage
111 exit
115 optval=${j#*=}
116 optname=${j%=*}
118 eval t=\$copt_${optname}_val
119 if [[ "x$t" == "x" ]]; then
120 echo "Unrecognized setting ${optname}." 1>&2
121 exit
124 eval vtype=\$copt_${optname}_type
125 if [[ "$vtype" == "bool" ]]; then
126 eval copt_${optname}_val=${with}
127 else
128 eval copt_${optname}_val=${optval}
130 done
132 write_conf
133 exit