libav: remove libav from qemu
[sdk/emulator/qemu.git] / tizen / emulator_configure.sh
1 #!/bin/sh
2
3 CONFIGURE_APPEND=""
4 EMUL_TARGET_LIST=""
5 VIRTIOGL_EN=""
6 YAGL_EN=""
7 YAGL_STATS_EN=""
8 VIGS_EN=""
9
10 usage() {
11     echo "usage: build.sh [options] [target]"
12     echo ""
13     echo "target"
14     echo "    emulator target, one of: [x86|i386|i486|i586|i686|arm|all]. Defaults to \"all\""
15     echo ""
16     echo "options:"
17     echo "-d, --debug"
18     echo "    build debug configuration"
19     echo "-vgl|--virtio-gl"
20     echo "    enable virtio GL support"
21     echo "-yagl|--yagl-device"
22     echo "    enable YaGL passthrough device"
23     echo "-ys|--yagl-stats"
24     echo "    enable YaGL stats"
25     echo "-vigs|--vigs-device"
26     echo "    enable VIGS device"
27     echo "-e|--extra"
28     echo "    extra options for QEMU configure"
29     echo "-u|-h|--help|--usage"
30     echo "    display this help message and exit"
31 }
32
33 virtgl_enable() {
34   case "$1" in
35   0|no|disable)
36     VIRTIOGL_EN="no"
37   ;;
38   1|yes|enable)
39     VIRTIOGL_EN="yes"
40   ;;
41   *)
42     usage
43     exit 1
44   ;;
45   esac
46 }
47
48 yagl_enable() {
49   case "$1" in
50   0|no|disable)
51     YAGL_EN="no"
52   ;;
53   1|yes|enable)
54     YAGL_EN="yes"
55   ;;
56   *)
57     usage
58     exit 1
59   ;;
60   esac
61 }
62
63 yagl_stats_enable() {
64   case "$1" in
65   0|no|disable)
66     YAGL_STATS_EN="no"
67   ;;
68   1|yes|enable)
69     YAGL_STATS_EN="yes"
70   ;;
71   *)
72     usage
73     exit 1
74   ;;
75   esac
76 }
77
78 vigs_enable() {
79   case "$1" in
80   0|no|disable)
81     VIGS_EN="no"
82   ;;
83   1|yes|enable)
84     VIGS_EN="yes"
85   ;;
86   *)
87     usage
88     exit 1
89   ;;
90   esac
91 }
92
93 set_target() {
94   if [ ! -z "$EMUL_TARGET_LIST" ] ; then
95       usage
96       exit 1
97   fi
98
99   case "$1" in
100   x86|i386|i486|i586|i686)
101     EMUL_TARGET_LIST="i386-softmmu"
102     if [ -z "$VIRTIOGL_EN" ] ; then
103       virtgl_enable yes
104     fi
105     if [ -z "$YAGL_EN" ] ; then
106       yagl_enable yes
107     fi
108     if [ -z "$VIGS_EN" ] ; then
109       vigs_enable yes
110     fi
111   ;;
112   arm)
113     EMUL_TARGET_LIST="arm-softmmu"
114     if [ -z "$YAGL_EN" ] && [ "$targetos" != "Darwin" ] ; then
115       yagl_enable yes
116     fi
117     if [ -z "$VIGS_EN" ] && [ "$targetos" != "Darwin" ] ; then
118       vigs_enable yes
119     fi
120   ;;
121   all)
122 #    EMUL_TARGET_LIST="i386-softmmu,arm-softmmu"
123     EMUL_TARGET_LIST="i386-softmmu"
124     if [ -z "$VIRTIOGL_EN" ] ; then
125       virtgl_enable yes
126     fi
127     if [ -z "$YAGL_EN" ] ; then   
128         yagl_enable yes
129     fi
130     if [ -z "$VIGS_EN" ] ; then
131       vigs_enable yes
132     fi
133   ;;
134   esac
135 }
136
137
138 # OS specific
139 targetos=`uname -s`
140 echo "##### checking for os... targetos $targetos"
141
142 echo "$*"
143
144 while [ "$#" -gt "0" ]
145 do
146     case $1 in
147     x86|i386|i486|i586|i686|arm|all)
148         set_target $1
149     ;;
150     -d|--debug)
151         CONFIGURE_APPEND="$CONFIGURE_APPEND --enable-debug"
152     ;;
153     -e|--extra)
154         shift
155         CONFIGURE_APPEND="$CONFIGURE_APPEND $1"
156     ;;
157     -vgl|--virtio-gl)
158         virtgl_enable 1
159     ;;
160     -yagl|--yagl-device)
161         yagl_enable 1
162     ;;
163     -ys|--yagl-stats)
164         yagl_stats_enable 1
165     ;;
166     -vigs|--vigs-device)
167         vigs_enable 1
168     ;;
169     -u|-h|--help|--usage)
170         usage
171         exit 0
172     ;;
173     *)
174         echo "Syntax Error"
175         usage
176         exit 1
177     ;;
178     esac
179     shift
180 done
181
182 if [ -z "$EMUL_TARGET_LIST" ] ; then
183   set_target all
184 fi
185
186 CONFIGURE_APPEND="--target-list=$EMUL_TARGET_LIST $CONFIGURE_APPEND"
187
188 if test "$VIRTIOGL_EN" = "yes" ; then
189   CONFIGURE_APPEND="$CONFIGURE_APPEND --enable-gl"
190 else
191   CONFIGURE_APPEND="$CONFIGURE_APPEND --disable-gl"
192 fi
193
194 if test "$YAGL_EN" = "yes" ; then
195   CONFIGURE_APPEND="$CONFIGURE_APPEND --enable-yagl"
196 else
197   CONFIGURE_APPEND="$CONFIGURE_APPEND --disable-yagl"
198 fi
199
200 if test "$YAGL_STATS_EN" = "yes" ; then
201   CONFIGURE_APPEND="$CONFIGURE_APPEND --enable-yagl-stats"
202 else
203   CONFIGURE_APPEND="$CONFIGURE_APPEND --disable-yagl-stats"
204 fi
205
206 if test "$VIGS_EN" = "yes" ; then
207   CONFIGURE_APPEND="$CONFIGURE_APPEND --enable-vigs"
208 else
209   CONFIGURE_APPEND="$CONFIGURE_APPEND --disable-vigs"
210 fi
211
212 case $targetos in
213 Linux*)
214 cd ..
215 echo ""
216 echo "##### QEMU configuring for emulator"
217 echo "##### QEMU configure append:" $CONFIGURE_APPEND
218 export PKG_CONFIG_PATH=${HOME}/tizen-sdk-dev/distrib/lib/pkgconfig:${PKG_CONFIG_PATH}
219 exec ./configure \
220  --enable-werror \
221  --audio-drv-list=alsa \
222  --enable-maru \
223  --disable-vnc \
224  --disable-pie $1 \
225  --enable-virtfs \
226  --disable-xen \
227  $CONFIGURE_APPEND \
228 ;;
229 MINGW*)
230 cd ..
231 echo ""
232 echo "##### QEMU configuring for emulator"
233 echo "##### QEMU configure append:" $CONFIGURE_APPEND
234 # We add CFLAGS '-fno-omit-frame-pointer'.
235 # A GCC might have a bug related with omitting frame pointer. It generates weird instructions.
236 exec ./configure \
237  --extra-cflags=-fno-omit-frame-pointer \
238  --extra-ldflags=-Wl,--large-address-aware \
239  --cc=gcc \
240  --audio-drv-list=winwave \
241  --enable-hax \
242  --enable-maru \
243  --disable-vnc $1 \
244  $CONFIGURE_APPEND \
245 ;;
246 Darwin*)
247 cd ..
248 echo ""
249 echo "##### QEMU configuring for emulator"
250 echo "##### QEMU configure append:" $CONFIGURE_APPEND
251 ./configure \
252  --extra-cflags=-mmacosx-version-min=10.4 \
253  --audio-drv-list=coreaudio \
254  --enable-maru \
255  --enable-shm \
256  --enable-hax \
257  --disable-vnc \
258  --disable-cocoa \
259  --enable-gl \
260  --disable-sdl $1 \
261  $CONFIGURE_APPEND \
262 ;;
263 esac