Statistics
| Branch: | Revision:

root / configure @ e6c3b0f7

History | View | Annotate | Download (79.8 kB)

1 7d13299d bellard
#!/bin/sh
2 7d13299d bellard
#
3 3ef693a0 bellard
# qemu configure script (c) 2003 Fabrice Bellard
4 7d13299d bellard
#
5 7d13299d bellard
# set temporary file name
6 7d13299d bellard
if test ! -z "$TMPDIR" ; then
7 7d13299d bellard
    TMPDIR1="${TMPDIR}"
8 7d13299d bellard
elif test ! -z "$TEMPDIR" ; then
9 7d13299d bellard
    TMPDIR1="${TEMPDIR}"
10 7d13299d bellard
else
11 7d13299d bellard
    TMPDIR1="/tmp"
12 7d13299d bellard
fi
13 7d13299d bellard
14 3ef693a0 bellard
TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 3ef693a0 bellard
TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 a91b857c malc
TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
17 7d13299d bellard
18 0ba8681e Loïc Minier
# NB: do not call "exit" in the trap handler; this is buggy with some shells;
19 0ba8681e Loïc Minier
# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
20 0ba8681e Loïc Minier
trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
21 da1d85e3 Gerd Hoffmann
rm -f config.log
22 9ac81bbb malc
23 52166aa0 Juan Quintela
compile_object() {
24 da1d85e3 Gerd Hoffmann
  echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
25 da1d85e3 Gerd Hoffmann
  $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
26 52166aa0 Juan Quintela
}
27 52166aa0 Juan Quintela
28 52166aa0 Juan Quintela
compile_prog() {
29 52166aa0 Juan Quintela
  local_cflags="$1"
30 52166aa0 Juan Quintela
  local_ldflags="$2"
31 da1d85e3 Gerd Hoffmann
  echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
32 da1d85e3 Gerd Hoffmann
  $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
33 52166aa0 Juan Quintela
}
34 52166aa0 Juan Quintela
35 0dba6195 Loïc Minier
# check whether a command is available to this shell (may be either an
36 0dba6195 Loïc Minier
# executable or a builtin)
37 0dba6195 Loïc Minier
has() {
38 0dba6195 Loïc Minier
    type "$1" >/dev/null 2>&1
39 0dba6195 Loïc Minier
}
40 0dba6195 Loïc Minier
41 0dba6195 Loïc Minier
# search for an executable in PATH
42 0dba6195 Loïc Minier
path_of() {
43 0dba6195 Loïc Minier
    local_command="$1"
44 0dba6195 Loïc Minier
    local_ifs="$IFS"
45 0dba6195 Loïc Minier
    local_dir=""
46 0dba6195 Loïc Minier
47 0dba6195 Loïc Minier
    # pathname has a dir component?
48 0dba6195 Loïc Minier
    if [ "${local_command#*/}" != "$local_command" ]; then
49 0dba6195 Loïc Minier
        if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
50 0dba6195 Loïc Minier
            echo "$local_command"
51 0dba6195 Loïc Minier
            return 0
52 0dba6195 Loïc Minier
        fi
53 0dba6195 Loïc Minier
    fi
54 0dba6195 Loïc Minier
    if [ -z "$local_command" ]; then
55 0dba6195 Loïc Minier
        return 1
56 0dba6195 Loïc Minier
    fi
57 0dba6195 Loïc Minier
58 0dba6195 Loïc Minier
    IFS=:
59 0dba6195 Loïc Minier
    for local_dir in $PATH; do
60 0dba6195 Loïc Minier
        if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
61 0dba6195 Loïc Minier
            echo "$local_dir/$local_command"
62 0dba6195 Loïc Minier
            IFS="${local_ifs:-$(printf ' \t\n')}"
63 0dba6195 Loïc Minier
            return 0
64 0dba6195 Loïc Minier
        fi
65 0dba6195 Loïc Minier
    done
66 0dba6195 Loïc Minier
    # not found
67 0dba6195 Loïc Minier
    IFS="${local_ifs:-$(printf ' \t\n')}"
68 0dba6195 Loïc Minier
    return 1
69 0dba6195 Loïc Minier
}
70 0dba6195 Loïc Minier
71 7d13299d bellard
# default parameters
72 2ff6b91e Juan Quintela
cpu=""
73 1e43adfc bellard
interp_prefix="/usr/gnemul/qemu-%M"
74 43ce4dfe bellard
static="no"
75 ed968ff1 Juan Quintela
sparc_cpu=""
76 7d13299d bellard
cross_prefix=""
77 7d13299d bellard
cc="gcc"
78 0c58ac1c malc
audio_drv_list=""
79 4c9b53e3 malc
audio_card_list="ac97 es1370 sb16"
80 4c9b53e3 malc
audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
81 eb852011 Markus Armbruster
block_drv_whitelist=""
82 7d13299d bellard
host_cc="gcc"
83 7d13299d bellard
ar="ar"
84 7d13299d bellard
make="make"
85 6a882643 pbrook
install="install"
86 7aa486fe Anthony Liguori
objcopy="objcopy"
87 7aa486fe Anthony Liguori
ld="ld"
88 52ba784d Hollis Blanchard
strip="strip"
89 9fe6de94 Blue Swirl
windres="windres"
90 c81da56e Juan Quintela
helper_cflags=""
91 73da375e Juan Quintela
libs_softmmu=""
92 3e2e0e6b Juan Quintela
libs_tools=""
93 67f86e8e Juan Quintela
audio_pt_int=""
94 d5631638 malc
audio_win_int=""
95 ac0df51d aliguori
96 ac0df51d aliguori
# parse CC options first
97 ac0df51d aliguori
for opt do
98 ac0df51d aliguori
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
99 ac0df51d aliguori
  case "$opt" in
100 ac0df51d aliguori
  --cross-prefix=*) cross_prefix="$optarg"
101 ac0df51d aliguori
  ;;
102 ac0df51d aliguori
  --cc=*) cc="$optarg"
103 ac0df51d aliguori
  ;;
104 2ff6b91e Juan Quintela
  --cpu=*) cpu="$optarg"
105 2ff6b91e Juan Quintela
  ;;
106 a558ee17 Juan Quintela
  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
107 e2a2ed06 Juan Quintela
  ;;
108 e2a2ed06 Juan Quintela
  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
109 e2a2ed06 Juan Quintela
  ;;
110 50e7b1a0 Juan Quintela
  --sparc_cpu=*)
111 50e7b1a0 Juan Quintela
    sparc_cpu="$optarg"
112 50e7b1a0 Juan Quintela
    case $sparc_cpu in
113 ed968ff1 Juan Quintela
    v7|v8|v8plus|v8plusa)
114 50e7b1a0 Juan Quintela
      cpu="sparc"
115 50e7b1a0 Juan Quintela
    ;;
116 50e7b1a0 Juan Quintela
    v9)
117 50e7b1a0 Juan Quintela
      cpu="sparc64"
118 50e7b1a0 Juan Quintela
    ;;
119 50e7b1a0 Juan Quintela
    *)
120 50e7b1a0 Juan Quintela
      echo "undefined SPARC architecture. Exiting";
121 50e7b1a0 Juan Quintela
      exit 1
122 50e7b1a0 Juan Quintela
    ;;
123 50e7b1a0 Juan Quintela
    esac
124 50e7b1a0 Juan Quintela
  ;;
125 ac0df51d aliguori
  esac
126 ac0df51d aliguori
done
127 ac0df51d aliguori
# OS specific
128 ac0df51d aliguori
# Using uname is really, really broken.  Once we have the right set of checks
129 ac0df51d aliguori
# we can eliminate it's usage altogether
130 ac0df51d aliguori
131 ac0df51d aliguori
cc="${cross_prefix}${cc}"
132 ac0df51d aliguori
ar="${cross_prefix}${ar}"
133 7aa486fe Anthony Liguori
objcopy="${cross_prefix}${objcopy}"
134 7aa486fe Anthony Liguori
ld="${cross_prefix}${ld}"
135 52ba784d Hollis Blanchard
strip="${cross_prefix}${strip}"
136 9fe6de94 Blue Swirl
windres="${cross_prefix}${windres}"
137 ac0df51d aliguori
138 be17dc90 Michael S. Tsirkin
# default flags for all hosts
139 be17dc90 Michael S. Tsirkin
QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
140 be17dc90 Michael S. Tsirkin
CFLAGS="-g $CFLAGS"
141 be17dc90 Michael S. Tsirkin
QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
142 be17dc90 Michael S. Tsirkin
QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
143 be17dc90 Michael S. Tsirkin
QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
144 84958305 Kirill A. Shutemov
QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
145 be17dc90 Michael S. Tsirkin
QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS"
146 be17dc90 Michael S. Tsirkin
LDFLAGS="-g $LDFLAGS"
147 be17dc90 Michael S. Tsirkin
148 a21493e0 Blue Swirl
gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
149 a21493e0 Blue Swirl
gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
150 0b65b9e1 Blue Swirl
gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
151 a21493e0 Blue Swirl
gcc_flags="-fstack-protector-all $gcc_flags"
152 be17dc90 Michael S. Tsirkin
cat > $TMPC << EOF
153 aa527b65 Aurelien Jarno
int main(void) { return 0; }
154 be17dc90 Michael S. Tsirkin
EOF
155 be17dc90 Michael S. Tsirkin
for flag in $gcc_flags; do
156 aa527b65 Aurelien Jarno
    if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
157 1e027be7 Markus Armbruster
	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
158 be17dc90 Michael S. Tsirkin
    fi
159 be17dc90 Michael S. Tsirkin
done
160 be17dc90 Michael S. Tsirkin
161 ac0df51d aliguori
# check that the C compiler works.
162 ac0df51d aliguori
cat > $TMPC <<EOF
163 ac0df51d aliguori
int main(void) {}
164 ac0df51d aliguori
EOF
165 ac0df51d aliguori
166 52166aa0 Juan Quintela
if compile_object ; then
167 ac0df51d aliguori
  : C compiler works ok
168 ac0df51d aliguori
else
169 ac0df51d aliguori
    echo "ERROR: \"$cc\" either does not exist or does not work"
170 ac0df51d aliguori
    exit 1
171 ac0df51d aliguori
fi
172 ac0df51d aliguori
173 ac0df51d aliguori
check_define() {
174 ac0df51d aliguori
cat > $TMPC <<EOF
175 ac0df51d aliguori
#if !defined($1)
176 ac0df51d aliguori
#error Not defined
177 ac0df51d aliguori
#endif
178 ac0df51d aliguori
int main(void) { return 0; }
179 ac0df51d aliguori
EOF
180 52166aa0 Juan Quintela
  compile_object
181 ac0df51d aliguori
}
182 ac0df51d aliguori
183 2ff6b91e Juan Quintela
if test ! -z "$cpu" ; then
184 2ff6b91e Juan Quintela
  # command line argument
185 2ff6b91e Juan Quintela
  :
186 2ff6b91e Juan Quintela
elif check_define __i386__ ; then
187 ac0df51d aliguori
  cpu="i386"
188 ac0df51d aliguori
elif check_define __x86_64__ ; then
189 ac0df51d aliguori
  cpu="x86_64"
190 3aa9bd6c blueswir1
elif check_define __sparc__ ; then
191 3aa9bd6c blueswir1
  # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
192 3aa9bd6c blueswir1
  # They must be specified using --sparc_cpu
193 3aa9bd6c blueswir1
  if check_define __arch64__ ; then
194 3aa9bd6c blueswir1
    cpu="sparc64"
195 3aa9bd6c blueswir1
  else
196 3aa9bd6c blueswir1
    cpu="sparc"
197 3aa9bd6c blueswir1
  fi
198 fdf7ed96 malc
elif check_define _ARCH_PPC ; then
199 fdf7ed96 malc
  if check_define _ARCH_PPC64 ; then
200 fdf7ed96 malc
    cpu="ppc64"
201 fdf7ed96 malc
  else
202 fdf7ed96 malc
    cpu="ppc"
203 fdf7ed96 malc
  fi
204 afa05235 Aurelien Jarno
elif check_define __mips__ ; then
205 afa05235 Aurelien Jarno
  cpu="mips"
206 477ba620 Aurelien Jarno
elif check_define __ia64__ ; then
207 477ba620 Aurelien Jarno
  cpu="ia64"
208 d66ed0ea Aurelien Jarno
elif check_define __s390__ ; then
209 d66ed0ea Aurelien Jarno
  if check_define __s390x__ ; then
210 d66ed0ea Aurelien Jarno
    cpu="s390x"
211 d66ed0ea Aurelien Jarno
  else
212 d66ed0ea Aurelien Jarno
    cpu="s390"
213 d66ed0ea Aurelien Jarno
  fi
214 ac0df51d aliguori
else
215 fdf7ed96 malc
  cpu=`uname -m`
216 ac0df51d aliguori
fi
217 ac0df51d aliguori
218 5327cf48 bellard
target_list=""
219 7d13299d bellard
case "$cpu" in
220 afa05235 Aurelien Jarno
  alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64)
221 ea8f20f8 Juan Quintela
    cpu="$cpu"
222 ea8f20f8 Juan Quintela
  ;;
223 7d13299d bellard
  i386|i486|i586|i686|i86pc|BePC)
224 97a847bc bellard
    cpu="i386"
225 7d13299d bellard
  ;;
226 aaa5fa14 aurel32
  x86_64|amd64)
227 aaa5fa14 aurel32
    cpu="x86_64"
228 aaa5fa14 aurel32
  ;;
229 ba68055e bellard
  armv*b)
230 808c4954 bellard
    cpu="armv4b"
231 808c4954 bellard
  ;;
232 ba68055e bellard
  armv*l)
233 7d13299d bellard
    cpu="armv4l"
234 7d13299d bellard
  ;;
235 f54b3f92 aurel32
  parisc|parisc64)
236 f54b3f92 aurel32
    cpu="hppa"
237 f54b3f92 aurel32
  ;;
238 afa05235 Aurelien Jarno
  mips*)
239 afa05235 Aurelien Jarno
    cpu="mips"
240 afa05235 Aurelien Jarno
  ;;
241 24e804ec Alexander Graf
  s390)
242 fb3e5849 bellard
    cpu="s390"
243 fb3e5849 bellard
  ;;
244 24e804ec Alexander Graf
  s390x)
245 24e804ec Alexander Graf
    cpu="s390x"
246 24e804ec Alexander Graf
  ;;
247 3142255c blueswir1
  sparc|sun4[cdmuv])
248 ae228531 bellard
    cpu="sparc"
249 ae228531 bellard
  ;;
250 7d13299d bellard
  *)
251 a447d4dc Paolo Bonzini
    echo "Unsupported CPU = $cpu"
252 a447d4dc Paolo Bonzini
    exit 1
253 7d13299d bellard
  ;;
254 7d13299d bellard
esac
255 e2d52ad3 Juan Quintela
256 3a3fb96d Stefan Weil
# Default value for a variable defining feature "foo".
257 3a3fb96d Stefan Weil
#  * foo="no"  feature will only be used if --enable-foo arg is given
258 3a3fb96d Stefan Weil
#  * foo=""    feature will be searched for, and if found, will be used
259 3a3fb96d Stefan Weil
#              unless --disable-foo is given
260 3a3fb96d Stefan Weil
#  * foo="yes" this value will only be set by --enable-foo flag.
261 3a3fb96d Stefan Weil
#              feature will searched for,
262 3a3fb96d Stefan Weil
#              if not found, configure exits with error
263 e2d52ad3 Juan Quintela
#
264 3a3fb96d Stefan Weil
# Always add --enable-foo and --disable-foo command line args.
265 3a3fb96d Stefan Weil
# Distributions want to ensure that several features are compiled in, and it
266 3a3fb96d Stefan Weil
# is impossible without a --enable-foo that exits if a feature is not found.
267 e2d52ad3 Juan Quintela
268 a20a6f46 Juan Quintela
bluez=""
269 4ffcedb6 Juan Quintela
brlapi=""
270 788c8196 Juan Quintela
curl=""
271 c584a6d0 Juan Quintela
curses=""
272 a25dba17 Juan Quintela
docs=""
273 2df87df7 Juan Quintela
fdt=""
274 b31a0277 Juan Quintela
kvm=""
275 dae5079a Jan Kiszka
kvm_para=""
276 b0a47e79 Juan Quintela
nptl=""
277 c4198157 Juan Quintela
sdl=""
278 dfffc653 Juan Quintela
sparse="no"
279 ee682d27 Stefan Weil
uuid=""
280 dfb278bd Juan Quintela
vde=""
281 1be10ad2 Juan Quintela
vnc_tls=""
282 ea784e3b Juan Quintela
vnc_sasl=""
283 2f6f5c7a Corentin Chary
vnc_jpeg=""
284 efe556ad Corentin Chary
vnc_png=""
285 96763cf9 Corentin Chary
vnc_thread="no"
286 fc321b4b Juan Quintela
xen=""
287 5c6c3a6c Christoph Hellwig
linux_aio=""
288 758e8e38 Venkateswararao Jujjuri (JV)
attr=""
289 d5970055 Michael S. Tsirkin
vhost_net=""
290 dfb278bd Juan Quintela
291 7d13299d bellard
gprof="no"
292 f8393946 aurel32
debug_tcg="no"
293 b4475aa2 Luiz Capitulino
debug_mon="no"
294 f3d08ee6 Paul Brook
debug="no"
295 1625af87 aliguori
strip_opt="yes"
296 7d13299d bellard
bigendian="no"
297 67b915a5 bellard
mingw32="no"
298 67b915a5 bellard
EXESUF=""
299 683035de Paolo Bonzini
prefix="/usr/local"
300 683035de Paolo Bonzini
mandir="\${prefix}/share/man"
301 683035de Paolo Bonzini
datadir="\${prefix}/share/qemu"
302 683035de Paolo Bonzini
docdir="\${prefix}/share/doc/qemu"
303 683035de Paolo Bonzini
bindir="\${prefix}/bin"
304 683035de Paolo Bonzini
sysconfdir="\${prefix}/etc"
305 683035de Paolo Bonzini
confsuffix="/qemu"
306 443f1376 bellard
slirp="yes"
307 102a52e4 bellard
fmod_lib=""
308 102a52e4 bellard
fmod_inc=""
309 2f6a1ab0 blueswir1
oss_lib=""
310 b1a550a0 pbrook
bsd="no"
311 5327cf48 bellard
linux="no"
312 d2c7c9b8 blueswir1
solaris="no"
313 05c2a3e7 bellard
profiler="no"
314 5b0753e0 bellard
cocoa="no"
315 0a8e90f4 pbrook
softmmu="yes"
316 831b7825 ths
linux_user="no"
317 831b7825 ths
darwin_user="no"
318 84778508 blueswir1
bsd_user="no"
319 379f6698 Paul Brook
guest_base=""
320 c5937220 pbrook
uname_release=""
321 e5d355d1 aliguori
io_thread="no"
322 8ff9cbf7 malc
mixemu="no"
323 eac30262 aliguori
kerneldir=""
324 b29fe3ed malc
aix="no"
325 179cf400 Andreas Färber
haiku="no"
326 77755340 ths
blobs="yes"
327 4a19f1ec pbrook
pkgversion=""
328 5495ed11 Luiz Capitulino
check_utests="no"
329 34005a00 Kirill A. Shutemov
user_pie="no"
330 20ff6c80 Anthony Liguori
zero_malloc=""
331 94a420b1 Stefan Hajnoczi
trace_backend="nop"
332 9410b56c Prerna Saxena
trace_file="trace"
333 cd4ec0b4 Gerd Hoffmann
spice=""
334 7d13299d bellard
335 7d13299d bellard
# OS specific
336 ac0df51d aliguori
if check_define __linux__ ; then
337 ac0df51d aliguori
  targetos="Linux"
338 ac0df51d aliguori
elif check_define _WIN32 ; then
339 ac0df51d aliguori
  targetos='MINGW32'
340 169dc5d3 blueswir1
elif check_define __OpenBSD__ ; then
341 169dc5d3 blueswir1
  targetos='OpenBSD'
342 169dc5d3 blueswir1
elif check_define __sun__ ; then
343 169dc5d3 blueswir1
  targetos='SunOS'
344 179cf400 Andreas Färber
elif check_define __HAIKU__ ; then
345 179cf400 Andreas Färber
  targetos='Haiku'
346 ac0df51d aliguori
else
347 ac0df51d aliguori
  targetos=`uname -s`
348 ac0df51d aliguori
fi
349 0dbfc675 Juan Quintela
350 7d13299d bellard
case $targetos in
351 c326e0af bellard
CYGWIN*)
352 0dbfc675 Juan Quintela
  mingw32="yes"
353 a558ee17 Juan Quintela
  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
354 d5631638 malc
  audio_possible_drivers="winwave sdl"
355 d5631638 malc
  audio_drv_list="winwave"
356 c326e0af bellard
;;
357 67b915a5 bellard
MINGW32*)
358 0dbfc675 Juan Quintela
  mingw32="yes"
359 d5631638 malc
  audio_possible_drivers="winwave dsound sdl fmod"
360 d5631638 malc
  audio_drv_list="winwave"
361 67b915a5 bellard
;;
362 5c40d2bd ths
GNU/kFreeBSD)
363 a167ba50 Aurelien Jarno
  bsd="yes"
364 0dbfc675 Juan Quintela
  audio_drv_list="oss"
365 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd pa"
366 5c40d2bd ths
;;
367 7d3505c5 bellard
FreeBSD)
368 0dbfc675 Juan Quintela
  bsd="yes"
369 a167ba50 Aurelien Jarno
  make="gmake"
370 0dbfc675 Juan Quintela
  audio_drv_list="oss"
371 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd pa"
372 f01576f1 Juergen Lock
  # needed for kinfo_getvmmap(3) in libutil.h
373 f01576f1 Juergen Lock
  LIBS="-lutil $LIBS"
374 7d3505c5 bellard
;;
375 c5e97233 blueswir1
DragonFly)
376 0dbfc675 Juan Quintela
  bsd="yes"
377 a167ba50 Aurelien Jarno
  make="gmake"
378 0dbfc675 Juan Quintela
  audio_drv_list="oss"
379 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd pa"
380 c5e97233 blueswir1
;;
381 7d3505c5 bellard
NetBSD)
382 0dbfc675 Juan Quintela
  bsd="yes"
383 a167ba50 Aurelien Jarno
  make="gmake"
384 0dbfc675 Juan Quintela
  audio_drv_list="oss"
385 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd"
386 0dbfc675 Juan Quintela
  oss_lib="-lossaudio"
387 7d3505c5 bellard
;;
388 7d3505c5 bellard
OpenBSD)
389 0dbfc675 Juan Quintela
  bsd="yes"
390 a167ba50 Aurelien Jarno
  make="gmake"
391 0dbfc675 Juan Quintela
  audio_drv_list="oss"
392 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd"
393 0dbfc675 Juan Quintela
  oss_lib="-lossaudio"
394 7d3505c5 bellard
;;
395 83fb7adf bellard
Darwin)
396 0dbfc675 Juan Quintela
  bsd="yes"
397 0dbfc675 Juan Quintela
  darwin="yes"
398 0dbfc675 Juan Quintela
  # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
399 0dbfc675 Juan Quintela
  # run 64-bit userspace code
400 0dbfc675 Juan Quintela
  if [ "$cpu" = "i386" ] ; then
401 aab8588a malc
    is_x86_64=`sysctl -n hw.optional.x86_64`
402 aab8588a malc
    [ "$is_x86_64" = "1" ] && cpu=x86_64
403 0dbfc675 Juan Quintela
  fi
404 0dbfc675 Juan Quintela
  if [ "$cpu" = "x86_64" ] ; then
405 a558ee17 Juan Quintela
    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
406 0c439cbf Juan Quintela
    LDFLAGS="-arch x86_64 $LDFLAGS"
407 0dbfc675 Juan Quintela
  else
408 a558ee17 Juan Quintela
    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
409 0dbfc675 Juan Quintela
  fi
410 0dbfc675 Juan Quintela
  darwin_user="yes"
411 0dbfc675 Juan Quintela
  cocoa="yes"
412 0dbfc675 Juan Quintela
  audio_drv_list="coreaudio"
413 0dbfc675 Juan Quintela
  audio_possible_drivers="coreaudio sdl fmod"
414 0dbfc675 Juan Quintela
  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
415 7973f21c Juan Quintela
  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
416 83fb7adf bellard
;;
417 ec530c81 bellard
SunOS)
418 0dbfc675 Juan Quintela
  solaris="yes"
419 0dbfc675 Juan Quintela
  make="gmake"
420 0dbfc675 Juan Quintela
  install="ginstall"
421 fa58948d Blue Swirl
  ld="gld"
422 0dbfc675 Juan Quintela
  needs_libsunmath="no"
423 0dbfc675 Juan Quintela
  solarisrev=`uname -r | cut -f2 -d.`
424 0dbfc675 Juan Quintela
  # have to select again, because `uname -m` returns i86pc
425 0dbfc675 Juan Quintela
  # even on an x86_64 box.
426 0dbfc675 Juan Quintela
  solariscpu=`isainfo -k`
427 0dbfc675 Juan Quintela
  if test "${solariscpu}" = "amd64" ; then
428 0dbfc675 Juan Quintela
    cpu="x86_64"
429 0dbfc675 Juan Quintela
  fi
430 0dbfc675 Juan Quintela
  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
431 0dbfc675 Juan Quintela
    if test "$solarisrev" -le 9 ; then
432 0dbfc675 Juan Quintela
      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
433 0dbfc675 Juan Quintela
        needs_libsunmath="yes"
434 f14bfdf9 Juan Quintela
        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
435 f14bfdf9 Juan Quintela
        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
436 f14bfdf9 Juan Quintela
        LIBS="-lsunmath $LIBS"
437 0dbfc675 Juan Quintela
      else
438 0dbfc675 Juan Quintela
        echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
439 0dbfc675 Juan Quintela
        echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
440 0dbfc675 Juan Quintela
        echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
441 0dbfc675 Juan Quintela
        echo "Studio 11 can be downloaded from www.sun.com."
442 0dbfc675 Juan Quintela
        exit 1
443 0dbfc675 Juan Quintela
      fi
444 86b2bd93 ths
    fi
445 0dbfc675 Juan Quintela
  fi
446 0dbfc675 Juan Quintela
  if test -f /usr/include/sys/soundcard.h ; then
447 0dbfc675 Juan Quintela
    audio_drv_list="oss"
448 0dbfc675 Juan Quintela
  fi
449 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl"
450 d741429a Blue Swirl
# needed for CMSG_ macros in sys/socket.h
451 d741429a Blue Swirl
  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
452 d741429a Blue Swirl
# needed for TIOCWIN* defines in termios.h
453 d741429a Blue Swirl
  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
454 a558ee17 Juan Quintela
  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
455 e174c0bb Juan Quintela
  LIBS="-lsocket -lnsl -lresolv $LIBS"
456 86b2bd93 ths
;;
457 b29fe3ed malc
AIX)
458 0dbfc675 Juan Quintela
  aix="yes"
459 0dbfc675 Juan Quintela
  make="gmake"
460 b29fe3ed malc
;;
461 179cf400 Andreas Färber
Haiku)
462 179cf400 Andreas Färber
  haiku="yes"
463 179cf400 Andreas Färber
  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
464 179cf400 Andreas Färber
  LIBS="-lposix_error_mapper -lnetwork $LIBS"
465 179cf400 Andreas Färber
;;
466 1d14ffa9 bellard
*)
467 0dbfc675 Juan Quintela
  audio_drv_list="oss"
468 0dbfc675 Juan Quintela
  audio_possible_drivers="oss alsa sdl esd pa"
469 0dbfc675 Juan Quintela
  linux="yes"
470 0dbfc675 Juan Quintela
  linux_user="yes"
471 0dbfc675 Juan Quintela
  usb="linux"
472 0dbfc675 Juan Quintela
  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
473 c2de5c91 malc
    audio_possible_drivers="$audio_possible_drivers fmod"
474 0dbfc675 Juan Quintela
  fi
475 fb065187 bellard
;;
476 7d13299d bellard
esac
477 7d13299d bellard
478 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
479 b1a550a0 pbrook
  if [ "$darwin" != "yes" ] ; then
480 68063649 blueswir1
    usb="bsd"
481 83fb7adf bellard
  fi
482 84778508 blueswir1
  bsd_user="yes"
483 7d3505c5 bellard
fi
484 7d3505c5 bellard
485 3457a3f8 Juan Quintela
if test "$mingw32" = "yes" ; then
486 3457a3f8 Juan Quintela
  EXESUF=".exe"
487 a558ee17 Juan Quintela
  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
488 e94a7936 Stefan Weil
  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
489 e94a7936 Stefan Weil
  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
490 884044aa Juan Quintela
  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
491 683035de Paolo Bonzini
  prefix="c:/Program Files/Qemu"
492 683035de Paolo Bonzini
  mandir="\${prefix}"
493 683035de Paolo Bonzini
  datadir="\${prefix}"
494 683035de Paolo Bonzini
  docdir="\${prefix}"
495 683035de Paolo Bonzini
  bindir="\${prefix}"
496 683035de Paolo Bonzini
  sysconfdir="\${prefix}"
497 683035de Paolo Bonzini
  confsuffix=""
498 3457a3f8 Juan Quintela
fi
499 3457a3f8 Juan Quintela
500 7d13299d bellard
# find source path
501 ad064840 pbrook
source_path=`dirname "$0"`
502 59faef3a balrog
source_path_used="no"
503 59faef3a balrog
workdir=`pwd`
504 ad064840 pbrook
if [ -z "$source_path" ]; then
505 59faef3a balrog
    source_path=$workdir
506 ad064840 pbrook
else
507 ad064840 pbrook
    source_path=`cd "$source_path"; pwd`
508 7d13299d bellard
fi
509 724db118 pbrook
[ -f "$workdir/vl.c" ] || source_path_used="yes"
510 7d13299d bellard
511 487fefdb Anthony Liguori
werror=""
512 85aa5189 bellard
513 7d13299d bellard
for opt do
514 a46e4035 pbrook
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
515 7d13299d bellard
  case "$opt" in
516 2efc3265 bellard
  --help|-h) show_help=yes
517 2efc3265 bellard
  ;;
518 b1a550a0 pbrook
  --prefix=*) prefix="$optarg"
519 7d13299d bellard
  ;;
520 b1a550a0 pbrook
  --interp-prefix=*) interp_prefix="$optarg"
521 32ce6337 bellard
  ;;
522 b1a550a0 pbrook
  --source-path=*) source_path="$optarg"
523 ad064840 pbrook
  source_path_used="yes"
524 7d13299d bellard
  ;;
525 ac0df51d aliguori
  --cross-prefix=*)
526 7d13299d bellard
  ;;
527 ac0df51d aliguori
  --cc=*)
528 7d13299d bellard
  ;;
529 b1a550a0 pbrook
  --host-cc=*) host_cc="$optarg"
530 83469015 bellard
  ;;
531 b1a550a0 pbrook
  --make=*) make="$optarg"
532 7d13299d bellard
  ;;
533 6a882643 pbrook
  --install=*) install="$optarg"
534 6a882643 pbrook
  ;;
535 e2a2ed06 Juan Quintela
  --extra-cflags=*)
536 7d13299d bellard
  ;;
537 e2a2ed06 Juan Quintela
  --extra-ldflags=*)
538 7d13299d bellard
  ;;
539 2ff6b91e Juan Quintela
  --cpu=*)
540 7d13299d bellard
  ;;
541 b1a550a0 pbrook
  --target-list=*) target_list="$optarg"
542 de83cd02 bellard
  ;;
543 94a420b1 Stefan Hajnoczi
  --trace-backend=*) trace_backend="$optarg"
544 94a420b1 Stefan Hajnoczi
  ;;
545 9410b56c Prerna Saxena
  --trace-file=*) trace_file="$optarg"
546 9410b56c Prerna Saxena
  ;;
547 7d13299d bellard
  --enable-gprof) gprof="yes"
548 7d13299d bellard
  ;;
549 79427693 Loïc Minier
  --static)
550 79427693 Loïc Minier
    static="yes"
551 79427693 Loïc Minier
    LDFLAGS="-static $LDFLAGS"
552 43ce4dfe bellard
  ;;
553 0b24e75f Paolo Bonzini
  --mandir=*) mandir="$optarg"
554 0b24e75f Paolo Bonzini
  ;;
555 0b24e75f Paolo Bonzini
  --bindir=*) bindir="$optarg"
556 0b24e75f Paolo Bonzini
  ;;
557 0b24e75f Paolo Bonzini
  --datadir=*) datadir="$optarg"
558 0b24e75f Paolo Bonzini
  ;;
559 0b24e75f Paolo Bonzini
  --docdir=*) docdir="$optarg"
560 0b24e75f Paolo Bonzini
  ;;
561 ca2fb938 Andre Przywara
  --sysconfdir=*) sysconfdir="$optarg"
562 07381cc1 Anthony Liguori
  ;;
563 97a847bc bellard
  --disable-sdl) sdl="no"
564 97a847bc bellard
  ;;
565 c4198157 Juan Quintela
  --enable-sdl) sdl="yes"
566 c4198157 Juan Quintela
  ;;
567 0c58ac1c malc
  --fmod-lib=*) fmod_lib="$optarg"
568 1d14ffa9 bellard
  ;;
569 c2de5c91 malc
  --fmod-inc=*) fmod_inc="$optarg"
570 c2de5c91 malc
  ;;
571 2f6a1ab0 blueswir1
  --oss-lib=*) oss_lib="$optarg"
572 2f6a1ab0 blueswir1
  ;;
573 2fa7d3bf malc
  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
574 102a52e4 bellard
  ;;
575 0c58ac1c malc
  --audio-drv-list=*) audio_drv_list="$optarg"
576 102a52e4 bellard
  ;;
577 eb852011 Markus Armbruster
  --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
578 eb852011 Markus Armbruster
  ;;
579 f8393946 aurel32
  --enable-debug-tcg) debug_tcg="yes"
580 f8393946 aurel32
  ;;
581 f8393946 aurel32
  --disable-debug-tcg) debug_tcg="no"
582 f8393946 aurel32
  ;;
583 b4475aa2 Luiz Capitulino
  --enable-debug-mon) debug_mon="yes"
584 b4475aa2 Luiz Capitulino
  ;;
585 b4475aa2 Luiz Capitulino
  --disable-debug-mon) debug_mon="no"
586 b4475aa2 Luiz Capitulino
  ;;
587 f3d08ee6 Paul Brook
  --enable-debug)
588 f3d08ee6 Paul Brook
      # Enable debugging options that aren't excessively noisy
589 f3d08ee6 Paul Brook
      debug_tcg="yes"
590 b4475aa2 Luiz Capitulino
      debug_mon="yes"
591 f3d08ee6 Paul Brook
      debug="yes"
592 f3d08ee6 Paul Brook
      strip_opt="no"
593 f3d08ee6 Paul Brook
  ;;
594 03b4fe7d aliguori
  --enable-sparse) sparse="yes"
595 03b4fe7d aliguori
  ;;
596 03b4fe7d aliguori
  --disable-sparse) sparse="no"
597 03b4fe7d aliguori
  ;;
598 1625af87 aliguori
  --disable-strip) strip_opt="no"
599 1625af87 aliguori
  ;;
600 8d5d2d4c ths
  --disable-vnc-tls) vnc_tls="no"
601 8d5d2d4c ths
  ;;
602 1be10ad2 Juan Quintela
  --enable-vnc-tls) vnc_tls="yes"
603 1be10ad2 Juan Quintela
  ;;
604 2f9606b3 aliguori
  --disable-vnc-sasl) vnc_sasl="no"
605 2f9606b3 aliguori
  ;;
606 ea784e3b Juan Quintela
  --enable-vnc-sasl) vnc_sasl="yes"
607 ea784e3b Juan Quintela
  ;;
608 2f6f5c7a Corentin Chary
  --disable-vnc-jpeg) vnc_jpeg="no"
609 2f6f5c7a Corentin Chary
  ;;
610 2f6f5c7a Corentin Chary
  --enable-vnc-jpeg) vnc_jpeg="yes"
611 2f6f5c7a Corentin Chary
  ;;
612 efe556ad Corentin Chary
  --disable-vnc-png) vnc_png="no"
613 efe556ad Corentin Chary
  ;;
614 efe556ad Corentin Chary
  --enable-vnc-png) vnc_png="yes"
615 efe556ad Corentin Chary
  ;;
616 bd023f95 Corentin Chary
  --disable-vnc-thread) vnc_thread="no"
617 bd023f95 Corentin Chary
  ;;
618 bd023f95 Corentin Chary
  --enable-vnc-thread) vnc_thread="yes"
619 bd023f95 Corentin Chary
  ;;
620 443f1376 bellard
  --disable-slirp) slirp="no"
621 1d14ffa9 bellard
  ;;
622 ee682d27 Stefan Weil
  --disable-uuid) uuid="no"
623 ee682d27 Stefan Weil
  ;;
624 ee682d27 Stefan Weil
  --enable-uuid) uuid="yes"
625 ee682d27 Stefan Weil
  ;;
626 e0e6c8c0 aliguori
  --disable-vde) vde="no"
627 8a16d273 ths
  ;;
628 dfb278bd Juan Quintela
  --enable-vde) vde="yes"
629 dfb278bd Juan Quintela
  ;;
630 e37630ca aliguori
  --disable-xen) xen="no"
631 e37630ca aliguori
  ;;
632 fc321b4b Juan Quintela
  --enable-xen) xen="yes"
633 fc321b4b Juan Quintela
  ;;
634 2e4d9fb1 aurel32
  --disable-brlapi) brlapi="no"
635 2e4d9fb1 aurel32
  ;;
636 4ffcedb6 Juan Quintela
  --enable-brlapi) brlapi="yes"
637 4ffcedb6 Juan Quintela
  ;;
638 fb599c9a balrog
  --disable-bluez) bluez="no"
639 fb599c9a balrog
  ;;
640 a20a6f46 Juan Quintela
  --enable-bluez) bluez="yes"
641 a20a6f46 Juan Quintela
  ;;
642 7ba1e619 aliguori
  --disable-kvm) kvm="no"
643 7ba1e619 aliguori
  ;;
644 b31a0277 Juan Quintela
  --enable-kvm) kvm="yes"
645 b31a0277 Juan Quintela
  ;;
646 cd4ec0b4 Gerd Hoffmann
  --disable-spice) spice="no"
647 cd4ec0b4 Gerd Hoffmann
  ;;
648 cd4ec0b4 Gerd Hoffmann
  --enable-spice) spice="yes"
649 cd4ec0b4 Gerd Hoffmann
  ;;
650 05c2a3e7 bellard
  --enable-profiler) profiler="yes"
651 05c2a3e7 bellard
  ;;
652 c2de5c91 malc
  --enable-cocoa)
653 c2de5c91 malc
      cocoa="yes" ;
654 c2de5c91 malc
      sdl="no" ;
655 c2de5c91 malc
      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
656 1d14ffa9 bellard
  ;;
657 cad25d69 pbrook
  --disable-system) softmmu="no"
658 0a8e90f4 pbrook
  ;;
659 cad25d69 pbrook
  --enable-system) softmmu="yes"
660 0a8e90f4 pbrook
  ;;
661 0953a80f Zachary Amsden
  --disable-user)
662 0953a80f Zachary Amsden
      linux_user="no" ;
663 0953a80f Zachary Amsden
      bsd_user="no" ;
664 0953a80f Zachary Amsden
      darwin_user="no"
665 0953a80f Zachary Amsden
  ;;
666 0953a80f Zachary Amsden
  --enable-user) ;;
667 831b7825 ths
  --disable-linux-user) linux_user="no"
668 0a8e90f4 pbrook
  ;;
669 831b7825 ths
  --enable-linux-user) linux_user="yes"
670 831b7825 ths
  ;;
671 831b7825 ths
  --disable-darwin-user) darwin_user="no"
672 831b7825 ths
  ;;
673 831b7825 ths
  --enable-darwin-user) darwin_user="yes"
674 0a8e90f4 pbrook
  ;;
675 84778508 blueswir1
  --disable-bsd-user) bsd_user="no"
676 84778508 blueswir1
  ;;
677 84778508 blueswir1
  --enable-bsd-user) bsd_user="yes"
678 84778508 blueswir1
  ;;
679 379f6698 Paul Brook
  --enable-guest-base) guest_base="yes"
680 379f6698 Paul Brook
  ;;
681 379f6698 Paul Brook
  --disable-guest-base) guest_base="no"
682 379f6698 Paul Brook
  ;;
683 34005a00 Kirill A. Shutemov
  --enable-user-pie) user_pie="yes"
684 34005a00 Kirill A. Shutemov
  ;;
685 34005a00 Kirill A. Shutemov
  --disable-user-pie) user_pie="no"
686 34005a00 Kirill A. Shutemov
  ;;
687 c5937220 pbrook
  --enable-uname-release=*) uname_release="$optarg"
688 c5937220 pbrook
  ;;
689 3142255c blueswir1
  --sparc_cpu=*)
690 3142255c blueswir1
  ;;
691 85aa5189 bellard
  --enable-werror) werror="yes"
692 85aa5189 bellard
  ;;
693 85aa5189 bellard
  --disable-werror) werror="no"
694 85aa5189 bellard
  ;;
695 4d3b6f6e balrog
  --disable-curses) curses="no"
696 4d3b6f6e balrog
  ;;
697 c584a6d0 Juan Quintela
  --enable-curses) curses="yes"
698 c584a6d0 Juan Quintela
  ;;
699 769ce76d Alexander Graf
  --disable-curl) curl="no"
700 769ce76d Alexander Graf
  ;;
701 788c8196 Juan Quintela
  --enable-curl) curl="yes"
702 788c8196 Juan Quintela
  ;;
703 2df87df7 Juan Quintela
  --disable-fdt) fdt="no"
704 2df87df7 Juan Quintela
  ;;
705 2df87df7 Juan Quintela
  --enable-fdt) fdt="yes"
706 2df87df7 Juan Quintela
  ;;
707 5495ed11 Luiz Capitulino
  --disable-check-utests) check_utests="no"
708 5495ed11 Luiz Capitulino
  ;;
709 5495ed11 Luiz Capitulino
  --enable-check-utests) check_utests="yes"
710 5495ed11 Luiz Capitulino
  ;;
711 bd0c5661 pbrook
  --disable-nptl) nptl="no"
712 bd0c5661 pbrook
  ;;
713 b0a47e79 Juan Quintela
  --enable-nptl) nptl="yes"
714 b0a47e79 Juan Quintela
  ;;
715 8ff9cbf7 malc
  --enable-mixemu) mixemu="yes"
716 8ff9cbf7 malc
  ;;
717 5c6c3a6c Christoph Hellwig
  --disable-linux-aio) linux_aio="no"
718 5c6c3a6c Christoph Hellwig
  ;;
719 5c6c3a6c Christoph Hellwig
  --enable-linux-aio) linux_aio="yes"
720 5c6c3a6c Christoph Hellwig
  ;;
721 758e8e38 Venkateswararao Jujjuri (JV)
  --disable-attr) attr="no"
722 758e8e38 Venkateswararao Jujjuri (JV)
  ;;
723 758e8e38 Venkateswararao Jujjuri (JV)
  --enable-attr) attr="yes"
724 758e8e38 Venkateswararao Jujjuri (JV)
  ;;
725 e5d355d1 aliguori
  --enable-io-thread) io_thread="yes"
726 e5d355d1 aliguori
  ;;
727 77755340 ths
  --disable-blobs) blobs="no"
728 77755340 ths
  ;;
729 eac30262 aliguori
  --kerneldir=*) kerneldir="$optarg"
730 eac30262 aliguori
  ;;
731 4a19f1ec pbrook
  --with-pkgversion=*) pkgversion=" ($optarg)"
732 4a19f1ec pbrook
  ;;
733 a25dba17 Juan Quintela
  --disable-docs) docs="no"
734 70ec5dc0 Anthony Liguori
  ;;
735 a25dba17 Juan Quintela
  --enable-docs) docs="yes"
736 83a3ab8b Juan Quintela
  ;;
737 d5970055 Michael S. Tsirkin
  --disable-vhost-net) vhost_net="no"
738 d5970055 Michael S. Tsirkin
  ;;
739 d5970055 Michael S. Tsirkin
  --enable-vhost-net) vhost_net="yes"
740 d5970055 Michael S. Tsirkin
  ;;
741 6bde81cb Paolo Bonzini
  --*dir)
742 6bde81cb Paolo Bonzini
  ;;
743 7f1559c6 balrog
  *) echo "ERROR: unknown option $opt"; show_help="yes"
744 7f1559c6 balrog
  ;;
745 7d13299d bellard
  esac
746 7d13299d bellard
done
747 7d13299d bellard
748 3142255c blueswir1
#
749 3142255c blueswir1
# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
750 a558ee17 Juan Quintela
# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
751 3142255c blueswir1
#
752 379f6698 Paul Brook
host_guest_base="no"
753 40293e58 bellard
case "$cpu" in
754 ed968ff1 Juan Quintela
    sparc) case $sparc_cpu in
755 ed968ff1 Juan Quintela
           v7|v8)
756 a558ee17 Juan Quintela
             QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
757 ed968ff1 Juan Quintela
           ;;
758 ed968ff1 Juan Quintela
           v8plus|v8plusa)
759 a558ee17 Juan Quintela
             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
760 ed968ff1 Juan Quintela
           ;;
761 ed968ff1 Juan Quintela
           *) # sparc_cpu not defined in the command line
762 a558ee17 Juan Quintela
             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
763 ed968ff1 Juan Quintela
           esac
764 ed968ff1 Juan Quintela
           LDFLAGS="-m32 $LDFLAGS"
765 a558ee17 Juan Quintela
           QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
766 762e8230 blueswir1
           if test "$solaris" = "no" ; then
767 a558ee17 Juan Quintela
             QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
768 c81da56e Juan Quintela
             helper_cflags="-ffixed-i0"
769 762e8230 blueswir1
           fi
770 3142255c blueswir1
           ;;
771 ed968ff1 Juan Quintela
    sparc64)
772 a558ee17 Juan Quintela
           QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
773 ed968ff1 Juan Quintela
           LDFLAGS="-m64 $LDFLAGS"
774 a558ee17 Juan Quintela
           QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
775 ed968ff1 Juan Quintela
           if test "$solaris" != "no" ; then
776 a558ee17 Juan Quintela
             QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
777 762e8230 blueswir1
           fi
778 3142255c blueswir1
           ;;
779 76d83bde ths
    s390)
780 28d7cc49 Richard Henderson
           QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
781 28d7cc49 Richard Henderson
           LDFLAGS="-m31 $LDFLAGS"
782 48bb3750 Richard Henderson
           host_guest_base="yes"
783 28d7cc49 Richard Henderson
           ;;
784 28d7cc49 Richard Henderson
    s390x)
785 28d7cc49 Richard Henderson
           QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
786 28d7cc49 Richard Henderson
           LDFLAGS="-m64 $LDFLAGS"
787 48bb3750 Richard Henderson
           host_guest_base="yes"
788 76d83bde ths
           ;;
789 40293e58 bellard
    i386)
790 a558ee17 Juan Quintela
           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
791 0c439cbf Juan Quintela
           LDFLAGS="-m32 $LDFLAGS"
792 c81da56e Juan Quintela
           helper_cflags="-fomit-frame-pointer"
793 379f6698 Paul Brook
           host_guest_base="yes"
794 40293e58 bellard
           ;;
795 40293e58 bellard
    x86_64)
796 a558ee17 Juan Quintela
           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
797 0c439cbf Juan Quintela
           LDFLAGS="-m64 $LDFLAGS"
798 379f6698 Paul Brook
           host_guest_base="yes"
799 379f6698 Paul Brook
           ;;
800 379f6698 Paul Brook
    arm*)
801 379f6698 Paul Brook
           host_guest_base="yes"
802 40293e58 bellard
           ;;
803 f6548c0a malc
    ppc*)
804 f6548c0a malc
           host_guest_base="yes"
805 f6548c0a malc
           ;;
806 cc01cc8e Aurelien Jarno
    mips*)
807 cc01cc8e Aurelien Jarno
           host_guest_base="yes"
808 cc01cc8e Aurelien Jarno
           ;;
809 477ba620 Aurelien Jarno
    ia64*)
810 477ba620 Aurelien Jarno
           host_guest_base="yes"
811 477ba620 Aurelien Jarno
           ;;
812 fd76e73a Richard Henderson
    hppa*)
813 fd76e73a Richard Henderson
           host_guest_base="yes"
814 fd76e73a Richard Henderson
           ;;
815 3142255c blueswir1
esac
816 3142255c blueswir1
817 379f6698 Paul Brook
[ -z "$guest_base" ] && guest_base="$host_guest_base"
818 379f6698 Paul Brook
819 af5db58e pbrook
if test x"$show_help" = x"yes" ; then
820 af5db58e pbrook
cat << EOF
821 af5db58e pbrook
822 af5db58e pbrook
Usage: configure [options]
823 af5db58e pbrook
Options: [defaults in brackets after descriptions]
824 af5db58e pbrook
825 af5db58e pbrook
EOF
826 af5db58e pbrook
echo "Standard options:"
827 af5db58e pbrook
echo "  --help                   print this message"
828 af5db58e pbrook
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
829 af5db58e pbrook
echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
830 af5db58e pbrook
echo "                           use %M for cpu name [$interp_prefix]"
831 af5db58e pbrook
echo "  --target-list=LIST       set target list [$target_list]"
832 af5db58e pbrook
echo ""
833 af5db58e pbrook
echo "Advanced options (experts only):"
834 af5db58e pbrook
echo "  --source-path=PATH       path of source code [$source_path]"
835 af5db58e pbrook
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
836 af5db58e pbrook
echo "  --cc=CC                  use C compiler CC [$cc]"
837 0bfe8cc0 Paolo Bonzini
echo "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
838 0bfe8cc0 Paolo Bonzini
echo "                           build time"
839 a558ee17 Juan Quintela
echo "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
840 e3fc14c3 Jan Kiszka
echo "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
841 af5db58e pbrook
echo "  --make=MAKE              use specified make [$make]"
842 6a882643 pbrook
echo "  --install=INSTALL        use specified install [$install]"
843 af5db58e pbrook
echo "  --static                 enable static build [$static]"
844 0b24e75f Paolo Bonzini
echo "  --mandir=PATH            install man pages in PATH"
845 0b24e75f Paolo Bonzini
echo "  --datadir=PATH           install firmware in PATH"
846 0b24e75f Paolo Bonzini
echo "  --docdir=PATH            install documentation in PATH"
847 0b24e75f Paolo Bonzini
echo "  --bindir=PATH            install binaries in PATH"
848 0b24e75f Paolo Bonzini
echo "  --sysconfdir=PATH        install config in PATH/qemu"
849 f8393946 aurel32
echo "  --enable-debug-tcg       enable TCG debugging"
850 f8393946 aurel32
echo "  --disable-debug-tcg      disable TCG debugging (default)"
851 09695a4a Stefan Weil
echo "  --enable-debug           enable common debug build options"
852 890b1658 aliguori
echo "  --enable-sparse          enable sparse checker"
853 890b1658 aliguori
echo "  --disable-sparse         disable sparse checker (default)"
854 1625af87 aliguori
echo "  --disable-strip          disable stripping binaries"
855 85aa5189 bellard
echo "  --disable-werror         disable compilation abort on warning"
856 fe8f78e4 balrog
echo "  --disable-sdl            disable SDL"
857 c4198157 Juan Quintela
echo "  --enable-sdl             enable SDL"
858 af5db58e pbrook
echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
859 c2de5c91 malc
echo "  --audio-drv-list=LIST    set audio drivers list:"
860 c2de5c91 malc
echo "                           Available drivers: $audio_possible_drivers"
861 4c9b53e3 malc
echo "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
862 4c9b53e3 malc
echo "                           Available cards: $audio_possible_cards"
863 eb852011 Markus Armbruster
echo "  --block-drv-whitelist=L  set block driver whitelist"
864 eb852011 Markus Armbruster
echo "                           (affects only QEMU, not qemu-img)"
865 8ff9cbf7 malc
echo "  --enable-mixemu          enable mixer emulation"
866 e37630ca aliguori
echo "  --disable-xen            disable xen backend driver support"
867 fc321b4b Juan Quintela
echo "  --enable-xen             enable xen backend driver support"
868 2e4d9fb1 aurel32
echo "  --disable-brlapi         disable BrlAPI"
869 4ffcedb6 Juan Quintela
echo "  --enable-brlapi          enable BrlAPI"
870 8d5d2d4c ths
echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
871 1be10ad2 Juan Quintela
echo "  --enable-vnc-tls         enable TLS encryption for VNC server"
872 2f9606b3 aliguori
echo "  --disable-vnc-sasl       disable SASL encryption for VNC server"
873 ea784e3b Juan Quintela
echo "  --enable-vnc-sasl        enable SASL encryption for VNC server"
874 2f6f5c7a Corentin Chary
echo "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
875 2f6f5c7a Corentin Chary
echo "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
876 96763cf9 Corentin Chary
echo "  --disable-vnc-png        disable PNG compression for VNC server (default)"
877 efe556ad Corentin Chary
echo "  --enable-vnc-png         enable PNG compression for VNC server"
878 bd023f95 Corentin Chary
echo "  --disable-vnc-thread     disable threaded VNC server"
879 bd023f95 Corentin Chary
echo "  --enable-vnc-thread      enable threaded VNC server"
880 af896aaa pbrook
echo "  --disable-curses         disable curses output"
881 c584a6d0 Juan Quintela
echo "  --enable-curses          enable curses output"
882 769ce76d Alexander Graf
echo "  --disable-curl           disable curl connectivity"
883 788c8196 Juan Quintela
echo "  --enable-curl            enable curl connectivity"
884 2df87df7 Juan Quintela
echo "  --disable-fdt            disable fdt device tree"
885 2df87df7 Juan Quintela
echo "  --enable-fdt             enable fdt device tree"
886 5495ed11 Luiz Capitulino
echo "  --disable-check-utests   disable check unit-tests"
887 5495ed11 Luiz Capitulino
echo "  --enable-check-utests    enable check unit-tests"
888 fb599c9a balrog
echo "  --disable-bluez          disable bluez stack connectivity"
889 a20a6f46 Juan Quintela
echo "  --enable-bluez           enable bluez stack connectivity"
890 7ba1e619 aliguori
echo "  --disable-kvm            disable KVM acceleration support"
891 b31a0277 Juan Quintela
echo "  --enable-kvm             enable KVM acceleration support"
892 bd0c5661 pbrook
echo "  --disable-nptl           disable usermode NPTL support"
893 e5934d33 Andre Przywara
echo "  --enable-nptl            enable usermode NPTL support"
894 af5db58e pbrook
echo "  --enable-system          enable all system emulation targets"
895 af5db58e pbrook
echo "  --disable-system         disable all system emulation targets"
896 0953a80f Zachary Amsden
echo "  --enable-user            enable supported user emulation targets"
897 0953a80f Zachary Amsden
echo "  --disable-user           disable all user emulation targets"
898 831b7825 ths
echo "  --enable-linux-user      enable all linux usermode emulation targets"
899 831b7825 ths
echo "  --disable-linux-user     disable all linux usermode emulation targets"
900 831b7825 ths
echo "  --enable-darwin-user     enable all darwin usermode emulation targets"
901 831b7825 ths
echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
902 84778508 blueswir1
echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
903 84778508 blueswir1
echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
904 379f6698 Paul Brook
echo "  --enable-guest-base      enable GUEST_BASE support for usermode"
905 379f6698 Paul Brook
echo "                           emulation targets"
906 379f6698 Paul Brook
echo "  --disable-guest-base     disable GUEST_BASE support"
907 34005a00 Kirill A. Shutemov
echo "  --enable-user-pie        build usermode emulation targets as PIE"
908 34005a00 Kirill A. Shutemov
echo "  --disable-user-pie       do not build usermode emulation targets as PIE"
909 af5db58e pbrook
echo "  --fmod-lib               path to FMOD library"
910 af5db58e pbrook
echo "  --fmod-inc               path to FMOD includes"
911 2f6a1ab0 blueswir1
echo "  --oss-lib                path to OSS library"
912 c5937220 pbrook
echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
913 3142255c blueswir1
echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
914 ee682d27 Stefan Weil
echo "  --disable-uuid           disable uuid support"
915 ee682d27 Stefan Weil
echo "  --enable-uuid            enable uuid support"
916 e0e6c8c0 aliguori
echo "  --disable-vde            disable support for vde network"
917 dfb278bd Juan Quintela
echo "  --enable-vde             enable support for vde network"
918 5c6c3a6c Christoph Hellwig
echo "  --disable-linux-aio      disable Linux AIO support"
919 5c6c3a6c Christoph Hellwig
echo "  --enable-linux-aio       enable Linux AIO support"
920 758e8e38 Venkateswararao Jujjuri (JV)
echo "  --disable-attr           disables attr and xattr support"
921 758e8e38 Venkateswararao Jujjuri (JV)
echo "  --enable-attr            enable attr and xattr support"
922 e5d355d1 aliguori
echo "  --enable-io-thread       enable IO thread"
923 77755340 ths
echo "  --disable-blobs          disable installing provided firmware blobs"
924 eac30262 aliguori
echo "  --kerneldir=PATH         look for kernel includes in PATH"
925 d2807bc9 Dirk Ullrich
echo "  --enable-docs            enable documentation build"
926 d2807bc9 Dirk Ullrich
echo "  --disable-docs           disable documentation build"
927 d5970055 Michael S. Tsirkin
echo "  --disable-vhost-net      disable vhost-net acceleration support"
928 d5970055 Michael S. Tsirkin
echo "  --enable-vhost-net       enable vhost-net acceleration support"
929 7e24e92a Stefan Hajnoczi
echo "  --trace-backend=B        Trace backend nop simple ust"
930 9410b56c Prerna Saxena
echo "  --trace-file=NAME        Full PATH,NAME of file to store traces"
931 9410b56c Prerna Saxena
echo "                           Default:trace-<pid>"
932 cd4ec0b4 Gerd Hoffmann
echo "  --disable-spice          disable spice"
933 cd4ec0b4 Gerd Hoffmann
echo "  --enable-spice           enable spice"
934 af5db58e pbrook
echo ""
935 5bf08934 ths
echo "NOTE: The object files are built at the place where configure is launched"
936 af5db58e pbrook
exit 1
937 af5db58e pbrook
fi
938 af5db58e pbrook
939 ec530c81 bellard
#
940 ec530c81 bellard
# Solaris specific configure tool chain decisions
941 ec530c81 bellard
#
942 ec530c81 bellard
if test "$solaris" = "yes" ; then
943 6792aa11 Loïc Minier
  if has $install; then
944 6792aa11 Loïc Minier
    :
945 6792aa11 Loïc Minier
  else
946 ec530c81 bellard
    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
947 ec530c81 bellard
    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
948 ec530c81 bellard
    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
949 ec530c81 bellard
    exit 1
950 ec530c81 bellard
  fi
951 6792aa11 Loïc Minier
  if test "`path_of $install`" = "/usr/sbin/install" ; then
952 ec530c81 bellard
    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
953 ec530c81 bellard
    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
954 ec530c81 bellard
    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
955 ec530c81 bellard
    exit 1
956 ec530c81 bellard
  fi
957 6792aa11 Loïc Minier
  if has ar; then
958 6792aa11 Loïc Minier
    :
959 6792aa11 Loïc Minier
  else
960 ec530c81 bellard
    echo "Error: No path includes ar"
961 ec530c81 bellard
    if test -f /usr/ccs/bin/ar ; then
962 ec530c81 bellard
      echo "Add /usr/ccs/bin to your path and rerun configure"
963 ec530c81 bellard
    fi
964 ec530c81 bellard
    exit 1
965 ec530c81 bellard
  fi
966 5fafdf24 ths
fi
967 ec530c81 bellard
968 ec530c81 bellard
969 5327cf48 bellard
if test -z "$target_list" ; then
970 5327cf48 bellard
# these targets are portable
971 0a8e90f4 pbrook
    if [ "$softmmu" = "yes" ] ; then
972 2408a527 aurel32
        target_list="\
973 2408a527 aurel32
i386-softmmu \
974 2408a527 aurel32
x86_64-softmmu \
975 2408a527 aurel32
arm-softmmu \
976 2408a527 aurel32
cris-softmmu \
977 2408a527 aurel32
m68k-softmmu \
978 72b675ca Edgar E. Iglesias
microblaze-softmmu \
979 2408a527 aurel32
mips-softmmu \
980 2408a527 aurel32
mipsel-softmmu \
981 2408a527 aurel32
mips64-softmmu \
982 2408a527 aurel32
mips64el-softmmu \
983 2408a527 aurel32
ppc-softmmu \
984 2408a527 aurel32
ppcemb-softmmu \
985 2408a527 aurel32
ppc64-softmmu \
986 2408a527 aurel32
sh4-softmmu \
987 2408a527 aurel32
sh4eb-softmmu \
988 2408a527 aurel32
sparc-softmmu \
989 1b64fcae Igor V. Kovalenko
sparc64-softmmu \
990 2408a527 aurel32
"
991 0a8e90f4 pbrook
    fi
992 5327cf48 bellard
# the following are Linux specific
993 831b7825 ths
    if [ "$linux_user" = "yes" ] ; then
994 2408a527 aurel32
        target_list="${target_list}\
995 2408a527 aurel32
i386-linux-user \
996 2408a527 aurel32
x86_64-linux-user \
997 2408a527 aurel32
alpha-linux-user \
998 2408a527 aurel32
arm-linux-user \
999 2408a527 aurel32
armeb-linux-user \
1000 2408a527 aurel32
cris-linux-user \
1001 2408a527 aurel32
m68k-linux-user \
1002 72b675ca Edgar E. Iglesias
microblaze-linux-user \
1003 2408a527 aurel32
mips-linux-user \
1004 2408a527 aurel32
mipsel-linux-user \
1005 2408a527 aurel32
ppc-linux-user \
1006 2408a527 aurel32
ppc64-linux-user \
1007 2408a527 aurel32
ppc64abi32-linux-user \
1008 2408a527 aurel32
sh4-linux-user \
1009 2408a527 aurel32
sh4eb-linux-user \
1010 2408a527 aurel32
sparc-linux-user \
1011 2408a527 aurel32
sparc64-linux-user \
1012 2408a527 aurel32
sparc32plus-linux-user \
1013 2408a527 aurel32
"
1014 831b7825 ths
    fi
1015 831b7825 ths
# the following are Darwin specific
1016 831b7825 ths
    if [ "$darwin_user" = "yes" ] ; then
1017 6cdc7375 malc
        target_list="$target_list i386-darwin-user ppc-darwin-user "
1018 5327cf48 bellard
    fi
1019 84778508 blueswir1
# the following are BSD specific
1020 84778508 blueswir1
    if [ "$bsd_user" = "yes" ] ; then
1021 84778508 blueswir1
        target_list="${target_list}\
1022 31fc12df blueswir1
i386-bsd-user \
1023 31fc12df blueswir1
x86_64-bsd-user \
1024 31fc12df blueswir1
sparc-bsd-user \
1025 84778508 blueswir1
sparc64-bsd-user \
1026 84778508 blueswir1
"
1027 84778508 blueswir1
    fi
1028 6e20a45f bellard
else
1029 b1a550a0 pbrook
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
1030 5327cf48 bellard
fi
1031 0a8e90f4 pbrook
if test -z "$target_list" ; then
1032 0a8e90f4 pbrook
    echo "No targets enabled"
1033 0a8e90f4 pbrook
    exit 1
1034 0a8e90f4 pbrook
fi
1035 f55fe278 Paolo Bonzini
# see if system emulation was really requested
1036 f55fe278 Paolo Bonzini
case " $target_list " in
1037 f55fe278 Paolo Bonzini
  *"-softmmu "*) softmmu=yes
1038 f55fe278 Paolo Bonzini
  ;;
1039 f55fe278 Paolo Bonzini
  *) softmmu=no
1040 f55fe278 Paolo Bonzini
  ;;
1041 f55fe278 Paolo Bonzini
esac
1042 5327cf48 bellard
1043 249247c9 Juan Quintela
feature_not_found() {
1044 249247c9 Juan Quintela
  feature=$1
1045 249247c9 Juan Quintela
1046 249247c9 Juan Quintela
  echo "ERROR"
1047 249247c9 Juan Quintela
  echo "ERROR: User requested feature $feature"
1048 9332f6a2 Sebastian Herbszt
  echo "ERROR: configure was not able to find it"
1049 249247c9 Juan Quintela
  echo "ERROR"
1050 249247c9 Juan Quintela
  exit 1;
1051 249247c9 Juan Quintela
}
1052 249247c9 Juan Quintela
1053 7d13299d bellard
if test -z "$cross_prefix" ; then
1054 7d13299d bellard
1055 7d13299d bellard
# ---
1056 7d13299d bellard
# big/little endian test
1057 7d13299d bellard
cat > $TMPC << EOF
1058 7d13299d bellard
#include <inttypes.h>
1059 7d13299d bellard
int main(int argc, char ** argv){
1060 1d14ffa9 bellard
        volatile uint32_t i=0x01234567;
1061 1d14ffa9 bellard
        return (*((uint8_t*)(&i))) == 0x67;
1062 7d13299d bellard
}
1063 7d13299d bellard
EOF
1064 7d13299d bellard
1065 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1066 7d13299d bellard
$TMPE && bigendian="yes"
1067 7d13299d bellard
else
1068 7d13299d bellard
echo big/little test failed
1069 7d13299d bellard
fi
1070 7d13299d bellard
1071 7d13299d bellard
else
1072 7d13299d bellard
1073 7d13299d bellard
# if cross compiling, cannot launch a program, so make a static guess
1074 ea8f20f8 Juan Quintela
case "$cpu" in
1075 24e804ec Alexander Graf
  armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1076 ea8f20f8 Juan Quintela
    bigendian=yes
1077 ea8f20f8 Juan Quintela
  ;;
1078 ea8f20f8 Juan Quintela
esac
1079 7d13299d bellard
1080 7d13299d bellard
fi
1081 7d13299d bellard
1082 b6853697 bellard
# host long bits test
1083 b6853697 bellard
hostlongbits="32"
1084 ea8f20f8 Juan Quintela
case "$cpu" in
1085 24e804ec Alexander Graf
  x86_64|alpha|ia64|sparc64|ppc64|s390x)
1086 ea8f20f8 Juan Quintela
    hostlongbits=64
1087 ea8f20f8 Juan Quintela
  ;;
1088 ea8f20f8 Juan Quintela
esac
1089 b6853697 bellard
1090 b0a47e79 Juan Quintela
1091 b0a47e79 Juan Quintela
##########################################
1092 b0a47e79 Juan Quintela
# NPTL probe
1093 b0a47e79 Juan Quintela
1094 b0a47e79 Juan Quintela
if test "$nptl" != "no" ; then
1095 b0a47e79 Juan Quintela
  cat > $TMPC <<EOF
1096 bd0c5661 pbrook
#include <sched.h>
1097 30813cea pbrook
#include <linux/futex.h>
1098 bd0c5661 pbrook
void foo()
1099 bd0c5661 pbrook
{
1100 bd0c5661 pbrook
#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1101 bd0c5661 pbrook
#error bork
1102 bd0c5661 pbrook
#endif
1103 bd0c5661 pbrook
}
1104 bd0c5661 pbrook
EOF
1105 bd0c5661 pbrook
1106 b0a47e79 Juan Quintela
  if compile_object ; then
1107 b0a47e79 Juan Quintela
    nptl=yes
1108 b0a47e79 Juan Quintela
  else
1109 b0a47e79 Juan Quintela
    if test "$nptl" = "yes" ; then
1110 b0a47e79 Juan Quintela
      feature_not_found "nptl"
1111 b0a47e79 Juan Quintela
    fi
1112 b0a47e79 Juan Quintela
    nptl=no
1113 b0a47e79 Juan Quintela
  fi
1114 bd0c5661 pbrook
fi
1115 bd0c5661 pbrook
1116 11d9f695 bellard
##########################################
1117 ac62922e balrog
# zlib check
1118 ac62922e balrog
1119 ac62922e balrog
cat > $TMPC << EOF
1120 ac62922e balrog
#include <zlib.h>
1121 ac62922e balrog
int main(void) { zlibVersion(); return 0; }
1122 ac62922e balrog
EOF
1123 52166aa0 Juan Quintela
if compile_prog "" "-lz" ; then
1124 ac62922e balrog
    :
1125 ac62922e balrog
else
1126 ac62922e balrog
    echo
1127 ac62922e balrog
    echo "Error: zlib check failed"
1128 ac62922e balrog
    echo "Make sure to have the zlib libs and headers installed."
1129 ac62922e balrog
    echo
1130 ac62922e balrog
    exit 1
1131 ac62922e balrog
fi
1132 ac62922e balrog
1133 ac62922e balrog
##########################################
1134 e37630ca aliguori
# xen probe
1135 e37630ca aliguori
1136 fc321b4b Juan Quintela
if test "$xen" != "no" ; then
1137 b2266bee Juan Quintela
  xen_libs="-lxenstore -lxenctrl -lxenguest"
1138 b2266bee Juan Quintela
  cat > $TMPC <<EOF
1139 e37630ca aliguori
#include <xenctrl.h>
1140 e37630ca aliguori
#include <xs.h>
1141 df7a607b Christoph Egger
int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
1142 e37630ca aliguori
EOF
1143 52166aa0 Juan Quintela
  if compile_prog "" "$xen_libs" ; then
1144 fc321b4b Juan Quintela
    xen=yes
1145 3efd632b Juan Quintela
    libs_softmmu="$xen_libs $libs_softmmu"
1146 b2266bee Juan Quintela
  else
1147 fc321b4b Juan Quintela
    if test "$xen" = "yes" ; then
1148 fc321b4b Juan Quintela
      feature_not_found "xen"
1149 fc321b4b Juan Quintela
    fi
1150 fc321b4b Juan Quintela
    xen=no
1151 b2266bee Juan Quintela
  fi
1152 e37630ca aliguori
fi
1153 e37630ca aliguori
1154 e37630ca aliguori
##########################################
1155 f91672e5 Paolo Bonzini
# pkgconfig probe
1156 f91672e5 Paolo Bonzini
1157 f91672e5 Paolo Bonzini
pkgconfig="${cross_prefix}pkg-config"
1158 0dba6195 Loïc Minier
if ! has $pkgconfig; then
1159 f91672e5 Paolo Bonzini
  # likely not cross compiling, or hope for the best
1160 f91672e5 Paolo Bonzini
  pkgconfig=pkg-config
1161 f91672e5 Paolo Bonzini
fi
1162 f91672e5 Paolo Bonzini
1163 f91672e5 Paolo Bonzini
##########################################
1164 dfffc653 Juan Quintela
# Sparse probe
1165 dfffc653 Juan Quintela
if test "$sparse" != "no" ; then
1166 0dba6195 Loïc Minier
  if has cgcc; then
1167 dfffc653 Juan Quintela
    sparse=yes
1168 dfffc653 Juan Quintela
  else
1169 dfffc653 Juan Quintela
    if test "$sparse" = "yes" ; then
1170 dfffc653 Juan Quintela
      feature_not_found "sparse"
1171 dfffc653 Juan Quintela
    fi
1172 dfffc653 Juan Quintela
    sparse=no
1173 dfffc653 Juan Quintela
  fi
1174 dfffc653 Juan Quintela
fi
1175 dfffc653 Juan Quintela
1176 dfffc653 Juan Quintela
##########################################
1177 11d9f695 bellard
# SDL probe
1178 11d9f695 bellard
1179 fec0e3e8 Stefan Weil
# Look for sdl configuration program (pkg-config or sdl-config).
1180 fec0e3e8 Stefan Weil
# Prefer variant with cross prefix if cross compiling,
1181 fec0e3e8 Stefan Weil
# and favour pkg-config with sdl over sdl-config.
1182 fec0e3e8 Stefan Weil
if test -n "$cross_prefix" -a $pkgconfig != pkg-config && \
1183 fec0e3e8 Stefan Weil
     $pkgconfig sdl --modversion >/dev/null 2>&1; then
1184 fec0e3e8 Stefan Weil
  sdlconfig="$pkgconfig sdl"
1185 fec0e3e8 Stefan Weil
  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1186 fec0e3e8 Stefan Weil
elif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then
1187 fec0e3e8 Stefan Weil
  sdlconfig="${cross_prefix}sdl-config"
1188 fec0e3e8 Stefan Weil
  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1189 fec0e3e8 Stefan Weil
elif $pkgconfig sdl --modversion >/dev/null 2>&1; then
1190 9316f803 Paolo Bonzini
  sdlconfig="$pkgconfig sdl"
1191 9316f803 Paolo Bonzini
  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1192 0dba6195 Loïc Minier
elif has sdl-config; then
1193 9316f803 Paolo Bonzini
  sdlconfig='sdl-config'
1194 9316f803 Paolo Bonzini
  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1195 a0dfd8a4 Loïc Minier
else
1196 a0dfd8a4 Loïc Minier
  if test "$sdl" = "yes" ; then
1197 a0dfd8a4 Loïc Minier
    feature_not_found "sdl"
1198 a0dfd8a4 Loïc Minier
  fi
1199 a0dfd8a4 Loïc Minier
  sdl=no
1200 9316f803 Paolo Bonzini
fi
1201 11d9f695 bellard
1202 9316f803 Paolo Bonzini
sdl_too_old=no
1203 c4198157 Juan Quintela
if test "$sdl" != "no" ; then
1204 ac119f9d Juan Quintela
  cat > $TMPC << EOF
1205 11d9f695 bellard
#include <SDL.h>
1206 11d9f695 bellard
#undef main /* We don't want SDL to override our main() */
1207 11d9f695 bellard
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1208 11d9f695 bellard
EOF
1209 9316f803 Paolo Bonzini
  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
1210 74f42e18 TeLeMan
  if test "$static" = "yes" ; then
1211 74f42e18 TeLeMan
    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1212 74f42e18 TeLeMan
  else
1213 74f42e18 TeLeMan
    sdl_libs=`$sdlconfig --libs 2> /dev/null`
1214 74f42e18 TeLeMan
  fi
1215 52166aa0 Juan Quintela
  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1216 ac119f9d Juan Quintela
    if test "$_sdlversion" -lt 121 ; then
1217 ac119f9d Juan Quintela
      sdl_too_old=yes
1218 ac119f9d Juan Quintela
    else
1219 ac119f9d Juan Quintela
      if test "$cocoa" = "no" ; then
1220 ac119f9d Juan Quintela
        sdl=yes
1221 ac119f9d Juan Quintela
      fi
1222 ac119f9d Juan Quintela
    fi
1223 cd01b4a3 aliguori
1224 67c274d3 Paolo Bonzini
    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
1225 ac119f9d Juan Quintela
    if test "$sdl" = "yes" -a "$static" = "yes" ; then
1226 67c274d3 Paolo Bonzini
      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1227 f8aa6c7b Stefan Weil
         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1228 f8aa6c7b Stefan Weil
         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
1229 ac119f9d Juan Quintela
      fi
1230 52166aa0 Juan Quintela
      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1231 ac119f9d Juan Quintela
	:
1232 ac119f9d Juan Quintela
      else
1233 ac119f9d Juan Quintela
        sdl=no
1234 ac119f9d Juan Quintela
      fi
1235 ac119f9d Juan Quintela
    fi # static link
1236 c4198157 Juan Quintela
  else # sdl not found
1237 c4198157 Juan Quintela
    if test "$sdl" = "yes" ; then
1238 c4198157 Juan Quintela
      feature_not_found "sdl"
1239 c4198157 Juan Quintela
    fi
1240 c4198157 Juan Quintela
    sdl=no
1241 ac119f9d Juan Quintela
  fi # sdl compile test
1242 a68551bc Juan Quintela
fi
1243 11d9f695 bellard
1244 5368a422 aliguori
if test "$sdl" = "yes" ; then
1245 ac119f9d Juan Quintela
  cat > $TMPC <<EOF
1246 5368a422 aliguori
#include <SDL.h>
1247 5368a422 aliguori
#if defined(SDL_VIDEO_DRIVER_X11)
1248 5368a422 aliguori
#include <X11/XKBlib.h>
1249 5368a422 aliguori
#else
1250 5368a422 aliguori
#error No x11 support
1251 5368a422 aliguori
#endif
1252 5368a422 aliguori
int main(void) { return 0; }
1253 5368a422 aliguori
EOF
1254 52166aa0 Juan Quintela
  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1255 ac119f9d Juan Quintela
    sdl_libs="$sdl_libs -lX11"
1256 ac119f9d Juan Quintela
  fi
1257 07d9ac44 Juan Quintela
  if test "$mingw32" = "yes" ; then
1258 07d9ac44 Juan Quintela
    sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1259 07d9ac44 Juan Quintela
  fi
1260 0705667e Juan Quintela
  libs_softmmu="$sdl_libs $libs_softmmu"
1261 5368a422 aliguori
fi
1262 5368a422 aliguori
1263 8f28f3fb ths
##########################################
1264 8d5d2d4c ths
# VNC TLS detection
1265 1be10ad2 Juan Quintela
if test "$vnc_tls" != "no" ; then
1266 1be10ad2 Juan Quintela
  cat > $TMPC <<EOF
1267 ae6b5e5a aliguori
#include <gnutls/gnutls.h>
1268 ae6b5e5a aliguori
int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1269 ae6b5e5a aliguori
EOF
1270 f91672e5 Paolo Bonzini
  vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null`
1271 f91672e5 Paolo Bonzini
  vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null`
1272 1be10ad2 Juan Quintela
  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1273 1be10ad2 Juan Quintela
    vnc_tls=yes
1274 1be10ad2 Juan Quintela
    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1275 1be10ad2 Juan Quintela
  else
1276 1be10ad2 Juan Quintela
    if test "$vnc_tls" = "yes" ; then
1277 1be10ad2 Juan Quintela
      feature_not_found "vnc-tls"
1278 ae6b5e5a aliguori
    fi
1279 1be10ad2 Juan Quintela
    vnc_tls=no
1280 1be10ad2 Juan Quintela
  fi
1281 8d5d2d4c ths
fi
1282 8d5d2d4c ths
1283 8d5d2d4c ths
##########################################
1284 2f9606b3 aliguori
# VNC SASL detection
1285 3aefa744 Juan Quintela
if test "$vnc_sasl" != "no" ; then
1286 ea784e3b Juan Quintela
  cat > $TMPC <<EOF
1287 2f9606b3 aliguori
#include <sasl/sasl.h>
1288 2f9606b3 aliguori
#include <stdio.h>
1289 2f9606b3 aliguori
int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1290 2f9606b3 aliguori
EOF
1291 ea784e3b Juan Quintela
  # Assuming Cyrus-SASL installed in /usr prefix
1292 ea784e3b Juan Quintela
  vnc_sasl_cflags=""
1293 ea784e3b Juan Quintela
  vnc_sasl_libs="-lsasl2"
1294 ea784e3b Juan Quintela
  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1295 ea784e3b Juan Quintela
    vnc_sasl=yes
1296 ea784e3b Juan Quintela
    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1297 ea784e3b Juan Quintela
  else
1298 ea784e3b Juan Quintela
    if test "$vnc_sasl" = "yes" ; then
1299 ea784e3b Juan Quintela
      feature_not_found "vnc-sasl"
1300 2f9606b3 aliguori
    fi
1301 ea784e3b Juan Quintela
    vnc_sasl=no
1302 ea784e3b Juan Quintela
  fi
1303 2f9606b3 aliguori
fi
1304 2f9606b3 aliguori
1305 2f9606b3 aliguori
##########################################
1306 2f6f5c7a Corentin Chary
# VNC JPEG detection
1307 96763cf9 Corentin Chary
if test "$vnc_jpeg" != "no" ; then
1308 2f6f5c7a Corentin Chary
cat > $TMPC <<EOF
1309 2f6f5c7a Corentin Chary
#include <stdio.h>
1310 2f6f5c7a Corentin Chary
#include <jpeglib.h>
1311 2f6f5c7a Corentin Chary
int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1312 2f6f5c7a Corentin Chary
EOF
1313 2f6f5c7a Corentin Chary
    vnc_jpeg_cflags=""
1314 2f6f5c7a Corentin Chary
    vnc_jpeg_libs="-ljpeg"
1315 2f6f5c7a Corentin Chary
  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1316 2f6f5c7a Corentin Chary
    vnc_jpeg=yes
1317 2f6f5c7a Corentin Chary
    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1318 2f6f5c7a Corentin Chary
  else
1319 2f6f5c7a Corentin Chary
    if test "$vnc_jpeg" = "yes" ; then
1320 2f6f5c7a Corentin Chary
      feature_not_found "vnc-jpeg"
1321 2f6f5c7a Corentin Chary
    fi
1322 2f6f5c7a Corentin Chary
    vnc_jpeg=no
1323 2f6f5c7a Corentin Chary
  fi
1324 2f6f5c7a Corentin Chary
fi
1325 2f6f5c7a Corentin Chary
1326 2f6f5c7a Corentin Chary
##########################################
1327 efe556ad Corentin Chary
# VNC PNG detection
1328 96763cf9 Corentin Chary
if test "$vnc_png" != "no" ; then
1329 efe556ad Corentin Chary
cat > $TMPC <<EOF
1330 efe556ad Corentin Chary
//#include <stdio.h>
1331 efe556ad Corentin Chary
#include <png.h>
1332 832ce9c2 Scott Wood
#include <stddef.h>
1333 efe556ad Corentin Chary
int main(void) {
1334 efe556ad Corentin Chary
    png_structp png_ptr;
1335 efe556ad Corentin Chary
    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1336 efe556ad Corentin Chary
    return 0;
1337 efe556ad Corentin Chary
}
1338 efe556ad Corentin Chary
EOF
1339 efe556ad Corentin Chary
    vnc_png_cflags=""
1340 efe556ad Corentin Chary
    vnc_png_libs="-lpng"
1341 efe556ad Corentin Chary
  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1342 efe556ad Corentin Chary
    vnc_png=yes
1343 efe556ad Corentin Chary
    libs_softmmu="$vnc_png_libs $libs_softmmu"
1344 efe556ad Corentin Chary
  else
1345 efe556ad Corentin Chary
    if test "$vnc_png" = "yes" ; then
1346 efe556ad Corentin Chary
      feature_not_found "vnc-png"
1347 efe556ad Corentin Chary
    fi
1348 efe556ad Corentin Chary
    vnc_png=no
1349 efe556ad Corentin Chary
  fi
1350 efe556ad Corentin Chary
fi
1351 efe556ad Corentin Chary
1352 efe556ad Corentin Chary
##########################################
1353 76655d6d aliguori
# fnmatch() probe, used for ACL routines
1354 76655d6d aliguori
fnmatch="no"
1355 76655d6d aliguori
cat > $TMPC << EOF
1356 76655d6d aliguori
#include <fnmatch.h>
1357 76655d6d aliguori
int main(void)
1358 76655d6d aliguori
{
1359 76655d6d aliguori
    fnmatch("foo", "foo", 0);
1360 76655d6d aliguori
    return 0;
1361 76655d6d aliguori
}
1362 76655d6d aliguori
EOF
1363 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1364 76655d6d aliguori
   fnmatch="yes"
1365 76655d6d aliguori
fi
1366 76655d6d aliguori
1367 76655d6d aliguori
##########################################
1368 ee682d27 Stefan Weil
# uuid_generate() probe, used for vdi block driver
1369 ee682d27 Stefan Weil
if test "$uuid" != "no" ; then
1370 ee682d27 Stefan Weil
  uuid_libs="-luuid"
1371 ee682d27 Stefan Weil
  cat > $TMPC << EOF
1372 ee682d27 Stefan Weil
#include <uuid/uuid.h>
1373 ee682d27 Stefan Weil
int main(void)
1374 ee682d27 Stefan Weil
{
1375 ee682d27 Stefan Weil
    uuid_t my_uuid;
1376 ee682d27 Stefan Weil
    uuid_generate(my_uuid);
1377 ee682d27 Stefan Weil
    return 0;
1378 ee682d27 Stefan Weil
}
1379 ee682d27 Stefan Weil
EOF
1380 ee682d27 Stefan Weil
  if compile_prog "" "$uuid_libs" ; then
1381 ee682d27 Stefan Weil
    uuid="yes"
1382 ee682d27 Stefan Weil
    libs_softmmu="$uuid_libs $libs_softmmu"
1383 ee682d27 Stefan Weil
    libs_tools="$uuid_libs $libs_tools"
1384 ee682d27 Stefan Weil
  else
1385 ee682d27 Stefan Weil
    if test "$uuid" = "yes" ; then
1386 ee682d27 Stefan Weil
      feature_not_found "uuid"
1387 ee682d27 Stefan Weil
    fi
1388 ee682d27 Stefan Weil
    uuid=no
1389 ee682d27 Stefan Weil
  fi
1390 ee682d27 Stefan Weil
fi
1391 ee682d27 Stefan Weil
1392 ee682d27 Stefan Weil
##########################################
1393 8a16d273 ths
# vde libraries probe
1394 dfb278bd Juan Quintela
if test "$vde" != "no" ; then
1395 4baae0ac Juan Quintela
  vde_libs="-lvdeplug"
1396 8a16d273 ths
  cat > $TMPC << EOF
1397 8a16d273 ths
#include <libvdeplug.h>
1398 4a7f0e06 pbrook
int main(void)
1399 4a7f0e06 pbrook
{
1400 4a7f0e06 pbrook
    struct vde_open_args a = {0, 0, 0};
1401 4a7f0e06 pbrook
    vde_open("", "", &a);
1402 4a7f0e06 pbrook
    return 0;
1403 4a7f0e06 pbrook
}
1404 8a16d273 ths
EOF
1405 52166aa0 Juan Quintela
  if compile_prog "" "$vde_libs" ; then
1406 4baae0ac Juan Quintela
    vde=yes
1407 8e02e54c Juan Quintela
    libs_softmmu="$vde_libs $libs_softmmu"
1408 8e02e54c Juan Quintela
    libs_tools="$vde_libs $libs_tools"
1409 dfb278bd Juan Quintela
  else
1410 dfb278bd Juan Quintela
    if test "$vde" = "yes" ; then
1411 dfb278bd Juan Quintela
      feature_not_found "vde"
1412 dfb278bd Juan Quintela
    fi
1413 dfb278bd Juan Quintela
    vde=no
1414 4baae0ac Juan Quintela
  fi
1415 8a16d273 ths
fi
1416 8a16d273 ths
1417 8a16d273 ths
##########################################
1418 c2de5c91 malc
# Sound support libraries probe
1419 8f28f3fb ths
1420 c2de5c91 malc
audio_drv_probe()
1421 c2de5c91 malc
{
1422 c2de5c91 malc
    drv=$1
1423 c2de5c91 malc
    hdr=$2
1424 c2de5c91 malc
    lib=$3
1425 c2de5c91 malc
    exp=$4
1426 c2de5c91 malc
    cfl=$5
1427 c2de5c91 malc
        cat > $TMPC << EOF
1428 c2de5c91 malc
#include <$hdr>
1429 c2de5c91 malc
int main(void) { $exp }
1430 8f28f3fb ths
EOF
1431 52166aa0 Juan Quintela
    if compile_prog "$cfl" "$lib" ; then
1432 c2de5c91 malc
        :
1433 c2de5c91 malc
    else
1434 c2de5c91 malc
        echo
1435 c2de5c91 malc
        echo "Error: $drv check failed"
1436 c2de5c91 malc
        echo "Make sure to have the $drv libs and headers installed."
1437 c2de5c91 malc
        echo
1438 c2de5c91 malc
        exit 1
1439 c2de5c91 malc
    fi
1440 c2de5c91 malc
}
1441 c2de5c91 malc
1442 2fa7d3bf malc
audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1443 c2de5c91 malc
for drv in $audio_drv_list; do
1444 c2de5c91 malc
    case $drv in
1445 c2de5c91 malc
    alsa)
1446 c2de5c91 malc
    audio_drv_probe $drv alsa/asoundlib.h -lasound \
1447 c2de5c91 malc
        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1448 a4bf6780 Juan Quintela
    libs_softmmu="-lasound $libs_softmmu"
1449 c2de5c91 malc
    ;;
1450 c2de5c91 malc
1451 c2de5c91 malc
    fmod)
1452 c2de5c91 malc
    if test -z $fmod_lib || test -z $fmod_inc; then
1453 c2de5c91 malc
        echo
1454 c2de5c91 malc
        echo "Error: You must specify path to FMOD library and headers"
1455 c2de5c91 malc
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1456 c2de5c91 malc
        echo
1457 c2de5c91 malc
        exit 1
1458 c2de5c91 malc
    fi
1459 c2de5c91 malc
    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1460 a4bf6780 Juan Quintela
    libs_softmmu="$fmod_lib $libs_softmmu"
1461 c2de5c91 malc
    ;;
1462 c2de5c91 malc
1463 c2de5c91 malc
    esd)
1464 c2de5c91 malc
    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1465 a4bf6780 Juan Quintela
    libs_softmmu="-lesd $libs_softmmu"
1466 67f86e8e Juan Quintela
    audio_pt_int="yes"
1467 c2de5c91 malc
    ;;
1468 b8e59f18 malc
1469 b8e59f18 malc
    pa)
1470 493abda6 Aurelien Jarno
    audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1471 b8e59f18 malc
        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1472 493abda6 Aurelien Jarno
    libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
1473 67f86e8e Juan Quintela
    audio_pt_int="yes"
1474 b8e59f18 malc
    ;;
1475 b8e59f18 malc
1476 997e690a Juan Quintela
    coreaudio)
1477 997e690a Juan Quintela
      libs_softmmu="-framework CoreAudio $libs_softmmu"
1478 997e690a Juan Quintela
    ;;
1479 997e690a Juan Quintela
1480 a4bf6780 Juan Quintela
    dsound)
1481 a4bf6780 Juan Quintela
      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1482 d5631638 malc
      audio_win_int="yes"
1483 a4bf6780 Juan Quintela
    ;;
1484 a4bf6780 Juan Quintela
1485 a4bf6780 Juan Quintela
    oss)
1486 a4bf6780 Juan Quintela
      libs_softmmu="$oss_lib $libs_softmmu"
1487 a4bf6780 Juan Quintela
    ;;
1488 a4bf6780 Juan Quintela
1489 a4bf6780 Juan Quintela
    sdl|wav)
1490 2f6a1ab0 blueswir1
    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1491 2f6a1ab0 blueswir1
    ;;
1492 2f6a1ab0 blueswir1
1493 d5631638 malc
    winwave)
1494 d5631638 malc
      libs_softmmu="-lwinmm $libs_softmmu"
1495 d5631638 malc
      audio_win_int="yes"
1496 d5631638 malc
    ;;
1497 d5631638 malc
1498 e4c63a6a malc
    *)
1499 1c9b2a52 malc
    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1500 e4c63a6a malc
        echo
1501 e4c63a6a malc
        echo "Error: Unknown driver '$drv' selected"
1502 e4c63a6a malc
        echo "Possible drivers are: $audio_possible_drivers"
1503 e4c63a6a malc
        echo
1504 e4c63a6a malc
        exit 1
1505 e4c63a6a malc
    }
1506 e4c63a6a malc
    ;;
1507 c2de5c91 malc
    esac
1508 c2de5c91 malc
done
1509 8f28f3fb ths
1510 4d3b6f6e balrog
##########################################
1511 2e4d9fb1 aurel32
# BrlAPI probe
1512 2e4d9fb1 aurel32
1513 4ffcedb6 Juan Quintela
if test "$brlapi" != "no" ; then
1514 eb82284f Juan Quintela
  brlapi_libs="-lbrlapi"
1515 eb82284f Juan Quintela
  cat > $TMPC << EOF
1516 2e4d9fb1 aurel32
#include <brlapi.h>
1517 832ce9c2 Scott Wood
#include <stddef.h>
1518 2e4d9fb1 aurel32
int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1519 2e4d9fb1 aurel32
EOF
1520 52166aa0 Juan Quintela
  if compile_prog "" "$brlapi_libs" ; then
1521 eb82284f Juan Quintela
    brlapi=yes
1522 264606b3 Juan Quintela
    libs_softmmu="$brlapi_libs $libs_softmmu"
1523 4ffcedb6 Juan Quintela
  else
1524 4ffcedb6 Juan Quintela
    if test "$brlapi" = "yes" ; then
1525 4ffcedb6 Juan Quintela
      feature_not_found "brlapi"
1526 4ffcedb6 Juan Quintela
    fi
1527 4ffcedb6 Juan Quintela
    brlapi=no
1528 eb82284f Juan Quintela
  fi
1529 eb82284f Juan Quintela
fi
1530 2e4d9fb1 aurel32
1531 2e4d9fb1 aurel32
##########################################
1532 4d3b6f6e balrog
# curses probe
1533 4f78ef9a Juan Quintela
curses_list="-lncurses -lcurses"
1534 4d3b6f6e balrog
1535 c584a6d0 Juan Quintela
if test "$curses" != "no" ; then
1536 c584a6d0 Juan Quintela
  curses_found=no
1537 4d3b6f6e balrog
  cat > $TMPC << EOF
1538 4d3b6f6e balrog
#include <curses.h>
1539 5a8ff3aa blueswir1
#ifdef __OpenBSD__
1540 5a8ff3aa blueswir1
#define resize_term resizeterm
1541 5a8ff3aa blueswir1
#endif
1542 5a8ff3aa blueswir1
int main(void) { resize_term(0, 0); return curses_version(); }
1543 4d3b6f6e balrog
EOF
1544 4f78ef9a Juan Quintela
  for curses_lib in $curses_list; do
1545 4f78ef9a Juan Quintela
    if compile_prog "" "$curses_lib" ; then
1546 c584a6d0 Juan Quintela
      curses_found=yes
1547 4f78ef9a Juan Quintela
      libs_softmmu="$curses_lib $libs_softmmu"
1548 4f78ef9a Juan Quintela
      break
1549 4f78ef9a Juan Quintela
    fi
1550 4f78ef9a Juan Quintela
  done
1551 c584a6d0 Juan Quintela
  if test "$curses_found" = "yes" ; then
1552 c584a6d0 Juan Quintela
    curses=yes
1553 c584a6d0 Juan Quintela
  else
1554 c584a6d0 Juan Quintela
    if test "$curses" = "yes" ; then
1555 c584a6d0 Juan Quintela
      feature_not_found "curses"
1556 c584a6d0 Juan Quintela
    fi
1557 c584a6d0 Juan Quintela
    curses=no
1558 c584a6d0 Juan Quintela
  fi
1559 4f78ef9a Juan Quintela
fi
1560 4d3b6f6e balrog
1561 414f0dab blueswir1
##########################################
1562 769ce76d Alexander Graf
# curl probe
1563 769ce76d Alexander Graf
1564 4e2b0658 Paolo Bonzini
if $pkgconfig libcurl --modversion >/dev/null 2>&1; then
1565 4e2b0658 Paolo Bonzini
  curlconfig="$pkgconfig libcurl"
1566 4e2b0658 Paolo Bonzini
else
1567 4e2b0658 Paolo Bonzini
  curlconfig=curl-config
1568 4e2b0658 Paolo Bonzini
fi
1569 4e2b0658 Paolo Bonzini
1570 788c8196 Juan Quintela
if test "$curl" != "no" ; then
1571 769ce76d Alexander Graf
  cat > $TMPC << EOF
1572 769ce76d Alexander Graf
#include <curl/curl.h>
1573 769ce76d Alexander Graf
int main(void) { return curl_easy_init(); }
1574 769ce76d Alexander Graf
EOF
1575 4e2b0658 Paolo Bonzini
  curl_cflags=`$curlconfig --cflags 2>/dev/null`
1576 4e2b0658 Paolo Bonzini
  curl_libs=`$curlconfig --libs 2>/dev/null`
1577 b1d5a277 Juan Quintela
  if compile_prog "$curl_cflags" "$curl_libs" ; then
1578 769ce76d Alexander Graf
    curl=yes
1579 f0302935 Juan Quintela
    libs_tools="$curl_libs $libs_tools"
1580 f0302935 Juan Quintela
    libs_softmmu="$curl_libs $libs_softmmu"
1581 788c8196 Juan Quintela
  else
1582 788c8196 Juan Quintela
    if test "$curl" = "yes" ; then
1583 788c8196 Juan Quintela
      feature_not_found "curl"
1584 788c8196 Juan Quintela
    fi
1585 788c8196 Juan Quintela
    curl=no
1586 769ce76d Alexander Graf
  fi
1587 769ce76d Alexander Graf
fi # test "$curl"
1588 769ce76d Alexander Graf
1589 769ce76d Alexander Graf
##########################################
1590 5495ed11 Luiz Capitulino
# check framework probe
1591 5495ed11 Luiz Capitulino
1592 5495ed11 Luiz Capitulino
if test "$check_utests" != "no" ; then
1593 5495ed11 Luiz Capitulino
  cat > $TMPC << EOF
1594 5495ed11 Luiz Capitulino
#include <check.h>
1595 5495ed11 Luiz Capitulino
int main(void) { suite_create("qemu test"); return 0; }
1596 5495ed11 Luiz Capitulino
EOF
1597 f91672e5 Paolo Bonzini
  check_libs=`$pkgconfig --libs check`
1598 5495ed11 Luiz Capitulino
  if compile_prog "" $check_libs ; then
1599 5495ed11 Luiz Capitulino
    check_utests=yes
1600 5495ed11 Luiz Capitulino
    libs_tools="$check_libs $libs_tools"
1601 5495ed11 Luiz Capitulino
  else
1602 5495ed11 Luiz Capitulino
    if test "$check_utests" = "yes" ; then
1603 5495ed11 Luiz Capitulino
      feature_not_found "check"
1604 5495ed11 Luiz Capitulino
    fi
1605 5495ed11 Luiz Capitulino
    check_utests=no
1606 5495ed11 Luiz Capitulino
  fi
1607 5495ed11 Luiz Capitulino
fi # test "$check_utests"
1608 5495ed11 Luiz Capitulino
1609 5495ed11 Luiz Capitulino
##########################################
1610 fb599c9a balrog
# bluez support probe
1611 a20a6f46 Juan Quintela
if test "$bluez" != "no" ; then
1612 e820e3f4 balrog
  cat > $TMPC << EOF
1613 e820e3f4 balrog
#include <bluetooth/bluetooth.h>
1614 e820e3f4 balrog
int main(void) { return bt_error(0); }
1615 e820e3f4 balrog
EOF
1616 f91672e5 Paolo Bonzini
  bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null`
1617 f91672e5 Paolo Bonzini
  bluez_libs=`$pkgconfig --libs bluez 2> /dev/null`
1618 52166aa0 Juan Quintela
  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1619 a20a6f46 Juan Quintela
    bluez=yes
1620 e482d56a Juan Quintela
    libs_softmmu="$bluez_libs $libs_softmmu"
1621 e820e3f4 balrog
  else
1622 a20a6f46 Juan Quintela
    if test "$bluez" = "yes" ; then
1623 a20a6f46 Juan Quintela
      feature_not_found "bluez"
1624 a20a6f46 Juan Quintela
    fi
1625 e820e3f4 balrog
    bluez="no"
1626 e820e3f4 balrog
  fi
1627 fb599c9a balrog
fi
1628 fb599c9a balrog
1629 fb599c9a balrog
##########################################
1630 7ba1e619 aliguori
# kvm probe
1631 b31a0277 Juan Quintela
if test "$kvm" != "no" ; then
1632 7ba1e619 aliguori
    cat > $TMPC <<EOF
1633 7ba1e619 aliguori
#include <linux/kvm.h>
1634 9fd8d8d7 aliguori
#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1635 7ba1e619 aliguori
#error Invalid KVM version
1636 7ba1e619 aliguori
#endif
1637 9fd8d8d7 aliguori
#if !defined(KVM_CAP_USER_MEMORY)
1638 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_USER_MEMORY
1639 9fd8d8d7 aliguori
#endif
1640 9fd8d8d7 aliguori
#if !defined(KVM_CAP_SET_TSS_ADDR)
1641 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1642 9fd8d8d7 aliguori
#endif
1643 9fd8d8d7 aliguori
#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1644 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1645 9fd8d8d7 aliguori
#endif
1646 7ba1e619 aliguori
int main(void) { return 0; }
1647 7ba1e619 aliguori
EOF
1648 eac30262 aliguori
  if test "$kerneldir" != "" ; then
1649 eac30262 aliguori
      kvm_cflags=-I"$kerneldir"/include
1650 8444eb6e aliguori
      if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1651 8444eb6e aliguori
         -a -d "$kerneldir/arch/x86/include" ; then
1652 8444eb6e aliguori
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1653 406b430d aliguori
	elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1654 406b430d aliguori
	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1655 0e60a699 Alexander Graf
	elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
1656 0e60a699 Alexander Graf
	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
1657 8444eb6e aliguori
        elif test -d "$kerneldir/arch/$cpu/include" ; then
1658 8444eb6e aliguori
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1659 8444eb6e aliguori
      fi
1660 eac30262 aliguori
  else
1661 f038e8f7 Stefan Weil
    kvm_cflags=`$pkgconfig --cflags kvm-kmod 2>/dev/null`
1662 eac30262 aliguori
  fi
1663 52166aa0 Juan Quintela
  if compile_prog "$kvm_cflags" "" ; then
1664 b31a0277 Juan Quintela
    kvm=yes
1665 dae5079a Jan Kiszka
    cat > $TMPC <<EOF
1666 dae5079a Jan Kiszka
#include <linux/kvm_para.h>
1667 dae5079a Jan Kiszka
int main(void) { return 0; }
1668 dae5079a Jan Kiszka
EOF
1669 dae5079a Jan Kiszka
    if compile_prog "$kvm_cflags" "" ; then
1670 dae5079a Jan Kiszka
      kvm_para=yes
1671 dae5079a Jan Kiszka
    fi
1672 7ba1e619 aliguori
  else
1673 b31a0277 Juan Quintela
    if test "$kvm" = "yes" ; then
1674 0dba6195 Loïc Minier
      if has awk && has grep; then
1675 b31a0277 Juan Quintela
        kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
1676 9fd8d8d7 aliguori
	| grep "error: " \
1677 9fd8d8d7 aliguori
	| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1678 b31a0277 Juan Quintela
        if test "$kvmerr" != "" ; then
1679 b31a0277 Juan Quintela
          echo -e "${kvmerr}\n\
1680 b31a0277 Juan Quintela
      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1681 b31a0277 Juan Quintela
  recent kvm-kmod from http://sourceforge.net/projects/kvm."
1682 b31a0277 Juan Quintela
        fi
1683 9fd8d8d7 aliguori
      fi
1684 b31a0277 Juan Quintela
      feature_not_found "kvm"
1685 9fd8d8d7 aliguori
    fi
1686 b31a0277 Juan Quintela
    kvm=no
1687 7ba1e619 aliguori
  fi
1688 7ba1e619 aliguori
fi
1689 7ba1e619 aliguori
1690 7ba1e619 aliguori
##########################################
1691 d5970055 Michael S. Tsirkin
# test for vhost net
1692 d5970055 Michael S. Tsirkin
1693 d5970055 Michael S. Tsirkin
if test "$vhost_net" != "no"; then
1694 d5970055 Michael S. Tsirkin
    if test "$kvm" != "no"; then
1695 d5970055 Michael S. Tsirkin
            cat > $TMPC <<EOF
1696 d5970055 Michael S. Tsirkin
    #include <linux/vhost.h>
1697 d5970055 Michael S. Tsirkin
    int main(void) { return 0; }
1698 d5970055 Michael S. Tsirkin
EOF
1699 d5970055 Michael S. Tsirkin
            if compile_prog "$kvm_cflags" "" ; then
1700 d5970055 Michael S. Tsirkin
                vhost_net=yes
1701 d5970055 Michael S. Tsirkin
            else
1702 d5970055 Michael S. Tsirkin
                if test "$vhost_net" = "yes" ; then
1703 d5970055 Michael S. Tsirkin
                    feature_not_found "vhost-net"
1704 d5970055 Michael S. Tsirkin
                fi
1705 d5970055 Michael S. Tsirkin
                vhost_net=no
1706 d5970055 Michael S. Tsirkin
            fi
1707 d5970055 Michael S. Tsirkin
    else
1708 d5970055 Michael S. Tsirkin
            if test "$vhost_net" = "yes" ; then
1709 4021d247 Aurelien Jarno
                echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
1710 d5970055 Michael S. Tsirkin
                feature_not_found "vhost-net"
1711 d5970055 Michael S. Tsirkin
            fi
1712 d5970055 Michael S. Tsirkin
            vhost_net=no
1713 d5970055 Michael S. Tsirkin
    fi
1714 d5970055 Michael S. Tsirkin
fi
1715 d5970055 Michael S. Tsirkin
1716 d5970055 Michael S. Tsirkin
##########################################
1717 e5d355d1 aliguori
# pthread probe
1718 de65fe0f Sebastian Herbszt
PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
1719 3c529d93 aliguori
1720 4dd75c70 Christoph Hellwig
pthread=no
1721 e5d355d1 aliguori
cat > $TMPC << EOF
1722 3c529d93 aliguori
#include <pthread.h>
1723 de65fe0f Sebastian Herbszt
int main(void) { pthread_create(0,0,0,0); return 0; }
1724 414f0dab blueswir1
EOF
1725 bd00d539 Andreas Färber
if compile_prog "" "" ; then
1726 bd00d539 Andreas Färber
  pthread=yes
1727 bd00d539 Andreas Färber
else
1728 bd00d539 Andreas Färber
  for pthread_lib in $PTHREADLIBS_LIST; do
1729 bd00d539 Andreas Färber
    if compile_prog "" "$pthread_lib" ; then
1730 bd00d539 Andreas Färber
      pthread=yes
1731 bd00d539 Andreas Färber
      LIBS="$pthread_lib $LIBS"
1732 bd00d539 Andreas Färber
      break
1733 bd00d539 Andreas Färber
    fi
1734 bd00d539 Andreas Färber
  done
1735 bd00d539 Andreas Färber
fi
1736 414f0dab blueswir1
1737 4617e593 Anthony Liguori
if test "$mingw32" != yes -a "$pthread" = no; then
1738 4dd75c70 Christoph Hellwig
  echo
1739 4dd75c70 Christoph Hellwig
  echo "Error: pthread check failed"
1740 4dd75c70 Christoph Hellwig
  echo "Make sure to have the pthread libs and headers installed."
1741 4dd75c70 Christoph Hellwig
  echo
1742 4dd75c70 Christoph Hellwig
  exit 1
1743 e5d355d1 aliguori
fi
1744 e5d355d1 aliguori
1745 bf9298b9 aliguori
##########################################
1746 5c6c3a6c Christoph Hellwig
# linux-aio probe
1747 5c6c3a6c Christoph Hellwig
1748 5c6c3a6c Christoph Hellwig
if test "$linux_aio" != "no" ; then
1749 5c6c3a6c Christoph Hellwig
  cat > $TMPC <<EOF
1750 5c6c3a6c Christoph Hellwig
#include <libaio.h>
1751 5c6c3a6c Christoph Hellwig
#include <sys/eventfd.h>
1752 832ce9c2 Scott Wood
#include <stddef.h>
1753 5c6c3a6c Christoph Hellwig
int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
1754 5c6c3a6c Christoph Hellwig
EOF
1755 5c6c3a6c Christoph Hellwig
  if compile_prog "" "-laio" ; then
1756 5c6c3a6c Christoph Hellwig
    linux_aio=yes
1757 048d179f Paul Brook
    libs_softmmu="$libs_softmmu -laio"
1758 048d179f Paul Brook
    libs_tools="$libs_tools -laio"
1759 5c6c3a6c Christoph Hellwig
  else
1760 5c6c3a6c Christoph Hellwig
    if test "$linux_aio" = "yes" ; then
1761 5c6c3a6c Christoph Hellwig
      feature_not_found "linux AIO"
1762 5c6c3a6c Christoph Hellwig
    fi
1763 3cfcae3c Luiz Capitulino
    linux_aio=no
1764 5c6c3a6c Christoph Hellwig
  fi
1765 5c6c3a6c Christoph Hellwig
fi
1766 5c6c3a6c Christoph Hellwig
1767 5c6c3a6c Christoph Hellwig
##########################################
1768 758e8e38 Venkateswararao Jujjuri (JV)
# attr probe
1769 758e8e38 Venkateswararao Jujjuri (JV)
1770 758e8e38 Venkateswararao Jujjuri (JV)
if test "$attr" != "no" ; then
1771 758e8e38 Venkateswararao Jujjuri (JV)
  cat > $TMPC <<EOF
1772 758e8e38 Venkateswararao Jujjuri (JV)
#include <stdio.h>
1773 758e8e38 Venkateswararao Jujjuri (JV)
#include <sys/types.h>
1774 758e8e38 Venkateswararao Jujjuri (JV)
#include <attr/xattr.h>
1775 758e8e38 Venkateswararao Jujjuri (JV)
int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1776 758e8e38 Venkateswararao Jujjuri (JV)
EOF
1777 758e8e38 Venkateswararao Jujjuri (JV)
  if compile_prog "" "-lattr" ; then
1778 758e8e38 Venkateswararao Jujjuri (JV)
    attr=yes
1779 758e8e38 Venkateswararao Jujjuri (JV)
    LIBS="-lattr $LIBS"
1780 758e8e38 Venkateswararao Jujjuri (JV)
  else
1781 758e8e38 Venkateswararao Jujjuri (JV)
    if test "$attr" = "yes" ; then
1782 758e8e38 Venkateswararao Jujjuri (JV)
      feature_not_found "ATTR"
1783 758e8e38 Venkateswararao Jujjuri (JV)
    fi
1784 758e8e38 Venkateswararao Jujjuri (JV)
    attr=no
1785 758e8e38 Venkateswararao Jujjuri (JV)
  fi
1786 758e8e38 Venkateswararao Jujjuri (JV)
fi
1787 758e8e38 Venkateswararao Jujjuri (JV)
1788 758e8e38 Venkateswararao Jujjuri (JV)
##########################################
1789 bf9298b9 aliguori
# iovec probe
1790 bf9298b9 aliguori
cat > $TMPC <<EOF
1791 db34f0b3 blueswir1
#include <sys/types.h>
1792 bf9298b9 aliguori
#include <sys/uio.h>
1793 db34f0b3 blueswir1
#include <unistd.h>
1794 bf9298b9 aliguori
int main(void) { struct iovec iov; return 0; }
1795 bf9298b9 aliguori
EOF
1796 bf9298b9 aliguori
iovec=no
1797 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1798 bf9298b9 aliguori
  iovec=yes
1799 bf9298b9 aliguori
fi
1800 bf9298b9 aliguori
1801 f652e6af aurel32
##########################################
1802 ceb42de8 aliguori
# preadv probe
1803 ceb42de8 aliguori
cat > $TMPC <<EOF
1804 ceb42de8 aliguori
#include <sys/types.h>
1805 ceb42de8 aliguori
#include <sys/uio.h>
1806 ceb42de8 aliguori
#include <unistd.h>
1807 ceb42de8 aliguori
int main(void) { preadv; }
1808 ceb42de8 aliguori
EOF
1809 ceb42de8 aliguori
preadv=no
1810 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1811 ceb42de8 aliguori
  preadv=yes
1812 ceb42de8 aliguori
fi
1813 ceb42de8 aliguori
1814 ceb42de8 aliguori
##########################################
1815 f652e6af aurel32
# fdt probe
1816 2df87df7 Juan Quintela
if test "$fdt" != "no" ; then
1817 b41af4ba Juan Quintela
  fdt_libs="-lfdt"
1818 b41af4ba Juan Quintela
  cat > $TMPC << EOF
1819 f652e6af aurel32
int main(void) { return 0; }
1820 f652e6af aurel32
EOF
1821 52166aa0 Juan Quintela
  if compile_prog "" "$fdt_libs" ; then
1822 f652e6af aurel32
    fdt=yes
1823 e4782985 Juan Quintela
    libs_softmmu="$fdt_libs $libs_softmmu"
1824 2df87df7 Juan Quintela
  else
1825 2df87df7 Juan Quintela
    if test "$fdt" = "yes" ; then
1826 2df87df7 Juan Quintela
      feature_not_found "fdt"
1827 2df87df7 Juan Quintela
    fi
1828 2df87df7 Juan Quintela
    fdt=no
1829 f652e6af aurel32
  fi
1830 f652e6af aurel32
fi
1831 f652e6af aurel32
1832 3b3f24ad aurel32
#
1833 3b3f24ad aurel32
# Check for xxxat() functions when we are building linux-user
1834 3b3f24ad aurel32
# emulator.  This is done because older glibc versions don't
1835 3b3f24ad aurel32
# have syscall stubs for these implemented.
1836 3b3f24ad aurel32
#
1837 3b3f24ad aurel32
atfile=no
1838 67ba57f6 Riku Voipio
cat > $TMPC << EOF
1839 3b3f24ad aurel32
#define _ATFILE_SOURCE
1840 3b3f24ad aurel32
#include <sys/types.h>
1841 3b3f24ad aurel32
#include <fcntl.h>
1842 3b3f24ad aurel32
#include <unistd.h>
1843 3b3f24ad aurel32
1844 3b3f24ad aurel32
int
1845 3b3f24ad aurel32
main(void)
1846 3b3f24ad aurel32
{
1847 3b3f24ad aurel32
	/* try to unlink nonexisting file */
1848 3b3f24ad aurel32
	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1849 3b3f24ad aurel32
}
1850 3b3f24ad aurel32
EOF
1851 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1852 67ba57f6 Riku Voipio
  atfile=yes
1853 3b3f24ad aurel32
fi
1854 3b3f24ad aurel32
1855 39386ac7 aurel32
# Check for inotify functions when we are building linux-user
1856 3b3f24ad aurel32
# emulator.  This is done because older glibc versions don't
1857 3b3f24ad aurel32
# have syscall stubs for these implemented.  In that case we
1858 3b3f24ad aurel32
# don't provide them even if kernel supports them.
1859 3b3f24ad aurel32
#
1860 3b3f24ad aurel32
inotify=no
1861 67ba57f6 Riku Voipio
cat > $TMPC << EOF
1862 3b3f24ad aurel32
#include <sys/inotify.h>
1863 3b3f24ad aurel32
1864 3b3f24ad aurel32
int
1865 3b3f24ad aurel32
main(void)
1866 3b3f24ad aurel32
{
1867 3b3f24ad aurel32
	/* try to start inotify */
1868 8690e420 aurel32
	return inotify_init();
1869 3b3f24ad aurel32
}
1870 3b3f24ad aurel32
EOF
1871 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1872 67ba57f6 Riku Voipio
  inotify=yes
1873 3b3f24ad aurel32
fi
1874 3b3f24ad aurel32
1875 c05c7a73 Riku Voipio
inotify1=no
1876 c05c7a73 Riku Voipio
cat > $TMPC << EOF
1877 c05c7a73 Riku Voipio
#include <sys/inotify.h>
1878 c05c7a73 Riku Voipio
1879 c05c7a73 Riku Voipio
int
1880 c05c7a73 Riku Voipio
main(void)
1881 c05c7a73 Riku Voipio
{
1882 c05c7a73 Riku Voipio
    /* try to start inotify */
1883 c05c7a73 Riku Voipio
    return inotify_init1(0);
1884 c05c7a73 Riku Voipio
}
1885 c05c7a73 Riku Voipio
EOF
1886 c05c7a73 Riku Voipio
if compile_prog "" "" ; then
1887 c05c7a73 Riku Voipio
  inotify1=yes
1888 c05c7a73 Riku Voipio
fi
1889 c05c7a73 Riku Voipio
1890 ebc996f3 Riku Voipio
# check if utimensat and futimens are supported
1891 ebc996f3 Riku Voipio
utimens=no
1892 ebc996f3 Riku Voipio
cat > $TMPC << EOF
1893 ebc996f3 Riku Voipio
#define _ATFILE_SOURCE
1894 ebc996f3 Riku Voipio
#include <stddef.h>
1895 ebc996f3 Riku Voipio
#include <fcntl.h>
1896 ebc996f3 Riku Voipio
1897 ebc996f3 Riku Voipio
int main(void)
1898 ebc996f3 Riku Voipio
{
1899 ebc996f3 Riku Voipio
    utimensat(AT_FDCWD, "foo", NULL, 0);
1900 ebc996f3 Riku Voipio
    futimens(0, NULL);
1901 ebc996f3 Riku Voipio
    return 0;
1902 ebc996f3 Riku Voipio
}
1903 ebc996f3 Riku Voipio
EOF
1904 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1905 ebc996f3 Riku Voipio
  utimens=yes
1906 ebc996f3 Riku Voipio
fi
1907 ebc996f3 Riku Voipio
1908 099d6b0f Riku Voipio
# check if pipe2 is there
1909 099d6b0f Riku Voipio
pipe2=no
1910 099d6b0f Riku Voipio
cat > $TMPC << EOF
1911 099d6b0f Riku Voipio
#include <unistd.h>
1912 099d6b0f Riku Voipio
#include <fcntl.h>
1913 099d6b0f Riku Voipio
1914 099d6b0f Riku Voipio
int main(void)
1915 099d6b0f Riku Voipio
{
1916 099d6b0f Riku Voipio
    int pipefd[2];
1917 099d6b0f Riku Voipio
    pipe2(pipefd, O_CLOEXEC);
1918 099d6b0f Riku Voipio
    return 0;
1919 099d6b0f Riku Voipio
}
1920 099d6b0f Riku Voipio
EOF
1921 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1922 099d6b0f Riku Voipio
  pipe2=yes
1923 099d6b0f Riku Voipio
fi
1924 099d6b0f Riku Voipio
1925 40ff6d7e Kevin Wolf
# check if accept4 is there
1926 40ff6d7e Kevin Wolf
accept4=no
1927 40ff6d7e Kevin Wolf
cat > $TMPC << EOF
1928 40ff6d7e Kevin Wolf
#include <sys/socket.h>
1929 40ff6d7e Kevin Wolf
#include <stddef.h>
1930 40ff6d7e Kevin Wolf
1931 40ff6d7e Kevin Wolf
int main(void)
1932 40ff6d7e Kevin Wolf
{
1933 40ff6d7e Kevin Wolf
    accept4(0, NULL, NULL, SOCK_CLOEXEC);
1934 40ff6d7e Kevin Wolf
    return 0;
1935 40ff6d7e Kevin Wolf
}
1936 40ff6d7e Kevin Wolf
EOF
1937 40ff6d7e Kevin Wolf
if compile_prog "" "" ; then
1938 40ff6d7e Kevin Wolf
  accept4=yes
1939 40ff6d7e Kevin Wolf
fi
1940 40ff6d7e Kevin Wolf
1941 3ce34dfb vibisreenivasan
# check if tee/splice is there. vmsplice was added same time.
1942 3ce34dfb vibisreenivasan
splice=no
1943 3ce34dfb vibisreenivasan
cat > $TMPC << EOF
1944 3ce34dfb vibisreenivasan
#include <unistd.h>
1945 3ce34dfb vibisreenivasan
#include <fcntl.h>
1946 3ce34dfb vibisreenivasan
#include <limits.h>
1947 3ce34dfb vibisreenivasan
1948 3ce34dfb vibisreenivasan
int main(void)
1949 3ce34dfb vibisreenivasan
{
1950 3ce34dfb vibisreenivasan
    int len, fd;
1951 3ce34dfb vibisreenivasan
    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1952 3ce34dfb vibisreenivasan
    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1953 3ce34dfb vibisreenivasan
    return 0;
1954 3ce34dfb vibisreenivasan
}
1955 3ce34dfb vibisreenivasan
EOF
1956 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1957 3ce34dfb vibisreenivasan
  splice=yes
1958 3ce34dfb vibisreenivasan
fi
1959 3ce34dfb vibisreenivasan
1960 dcc38d1c Marcelo Tosatti
##########################################
1961 dcc38d1c Marcelo Tosatti
# signalfd probe
1962 dcc38d1c Marcelo Tosatti
signalfd="no"
1963 dcc38d1c Marcelo Tosatti
cat > $TMPC << EOF
1964 dcc38d1c Marcelo Tosatti
#define _GNU_SOURCE
1965 dcc38d1c Marcelo Tosatti
#include <unistd.h>
1966 dcc38d1c Marcelo Tosatti
#include <sys/syscall.h>
1967 dcc38d1c Marcelo Tosatti
#include <signal.h>
1968 dcc38d1c Marcelo Tosatti
int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1969 dcc38d1c Marcelo Tosatti
EOF
1970 dcc38d1c Marcelo Tosatti
1971 dcc38d1c Marcelo Tosatti
if compile_prog "" "" ; then
1972 dcc38d1c Marcelo Tosatti
  signalfd=yes
1973 dcc38d1c Marcelo Tosatti
fi
1974 dcc38d1c Marcelo Tosatti
1975 c2882b96 Riku Voipio
# check if eventfd is supported
1976 c2882b96 Riku Voipio
eventfd=no
1977 c2882b96 Riku Voipio
cat > $TMPC << EOF
1978 c2882b96 Riku Voipio
#include <sys/eventfd.h>
1979 c2882b96 Riku Voipio
1980 c2882b96 Riku Voipio
int main(void)
1981 c2882b96 Riku Voipio
{
1982 c2882b96 Riku Voipio
    int efd = eventfd(0, 0);
1983 c2882b96 Riku Voipio
    return 0;
1984 c2882b96 Riku Voipio
}
1985 c2882b96 Riku Voipio
EOF
1986 c2882b96 Riku Voipio
if compile_prog "" "" ; then
1987 c2882b96 Riku Voipio
  eventfd=yes
1988 c2882b96 Riku Voipio
fi
1989 c2882b96 Riku Voipio
1990 d0927938 Ulrich Hecht
# check for fallocate
1991 d0927938 Ulrich Hecht
fallocate=no
1992 d0927938 Ulrich Hecht
cat > $TMPC << EOF
1993 d0927938 Ulrich Hecht
#include <fcntl.h>
1994 d0927938 Ulrich Hecht
1995 d0927938 Ulrich Hecht
int main(void)
1996 d0927938 Ulrich Hecht
{
1997 d0927938 Ulrich Hecht
    fallocate(0, 0, 0, 0);
1998 d0927938 Ulrich Hecht
    return 0;
1999 d0927938 Ulrich Hecht
}
2000 d0927938 Ulrich Hecht
EOF
2001 be17dc90 Michael S. Tsirkin
if compile_prog "$ARCH_CFLAGS" "" ; then
2002 d0927938 Ulrich Hecht
  fallocate=yes
2003 d0927938 Ulrich Hecht
fi
2004 d0927938 Ulrich Hecht
2005 d0927938 Ulrich Hecht
# check for dup3
2006 d0927938 Ulrich Hecht
dup3=no
2007 d0927938 Ulrich Hecht
cat > $TMPC << EOF
2008 d0927938 Ulrich Hecht
#include <unistd.h>
2009 d0927938 Ulrich Hecht
2010 d0927938 Ulrich Hecht
int main(void)
2011 d0927938 Ulrich Hecht
{
2012 d0927938 Ulrich Hecht
    dup3(0, 0, 0);
2013 d0927938 Ulrich Hecht
    return 0;
2014 d0927938 Ulrich Hecht
}
2015 d0927938 Ulrich Hecht
EOF
2016 78f5d726 Jan Kiszka
if compile_prog "" "" ; then
2017 d0927938 Ulrich Hecht
  dup3=yes
2018 d0927938 Ulrich Hecht
fi
2019 d0927938 Ulrich Hecht
2020 cc8ae6de pbrook
# Check if tools are available to build documentation.
2021 a25dba17 Juan Quintela
if test "$docs" != "no" ; then
2022 01668d98 Stefan Weil
  if has makeinfo && has pod2man; then
2023 a25dba17 Juan Quintela
    docs=yes
2024 83a3ab8b Juan Quintela
  else
2025 a25dba17 Juan Quintela
    if test "$docs" = "yes" ; then
2026 a25dba17 Juan Quintela
      feature_not_found "docs"
2027 83a3ab8b Juan Quintela
    fi
2028 a25dba17 Juan Quintela
    docs=no
2029 83a3ab8b Juan Quintela
  fi
2030 cc8ae6de pbrook
fi
2031 cc8ae6de pbrook
2032 f514f41c Stefan Weil
# Search for bswap_32 function
2033 6ae9a1f4 Juan Quintela
byteswap_h=no
2034 6ae9a1f4 Juan Quintela
cat > $TMPC << EOF
2035 6ae9a1f4 Juan Quintela
#include <byteswap.h>
2036 6ae9a1f4 Juan Quintela
int main(void) { return bswap_32(0); }
2037 6ae9a1f4 Juan Quintela
EOF
2038 52166aa0 Juan Quintela
if compile_prog "" "" ; then
2039 6ae9a1f4 Juan Quintela
  byteswap_h=yes
2040 6ae9a1f4 Juan Quintela
fi
2041 6ae9a1f4 Juan Quintela
2042 f514f41c Stefan Weil
# Search for bswap_32 function
2043 6ae9a1f4 Juan Quintela
bswap_h=no
2044 6ae9a1f4 Juan Quintela
cat > $TMPC << EOF
2045 6ae9a1f4 Juan Quintela
#include <sys/endian.h>
2046 6ae9a1f4 Juan Quintela
#include <sys/types.h>
2047 6ae9a1f4 Juan Quintela
#include <machine/bswap.h>
2048 6ae9a1f4 Juan Quintela
int main(void) { return bswap32(0); }
2049 6ae9a1f4 Juan Quintela
EOF
2050 52166aa0 Juan Quintela
if compile_prog "" "" ; then
2051 6ae9a1f4 Juan Quintela
  bswap_h=yes
2052 6ae9a1f4 Juan Quintela
fi
2053 6ae9a1f4 Juan Quintela
2054 da93a1fd aliguori
##########################################
2055 da93a1fd aliguori
# Do we need librt
2056 da93a1fd aliguori
cat > $TMPC <<EOF
2057 da93a1fd aliguori
#include <signal.h>
2058 da93a1fd aliguori
#include <time.h>
2059 da93a1fd aliguori
int main(void) { clockid_t id; return clock_gettime(id, NULL); }
2060 da93a1fd aliguori
EOF
2061 da93a1fd aliguori
2062 52166aa0 Juan Quintela
if compile_prog "" "" ; then
2063 07ffa4bd Juan Quintela
  :
2064 52166aa0 Juan Quintela
elif compile_prog "" "-lrt" ; then
2065 07ffa4bd Juan Quintela
  LIBS="-lrt $LIBS"
2066 da93a1fd aliguori
fi
2067 da93a1fd aliguori
2068 31ff504d Blue Swirl
if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2069 179cf400 Andreas Färber
        "$aix" != "yes" -a "$haiku" != "yes" ; then
2070 6362a53f Juan Quintela
    libs_softmmu="-lutil $libs_softmmu"
2071 6362a53f Juan Quintela
fi
2072 6362a53f Juan Quintela
2073 de5071c5 Blue Swirl
##########################################
2074 de5071c5 Blue Swirl
# check if the compiler defines offsetof
2075 de5071c5 Blue Swirl
2076 de5071c5 Blue Swirl
need_offsetof=yes
2077 de5071c5 Blue Swirl
cat > $TMPC << EOF
2078 de5071c5 Blue Swirl
#include <stddef.h>
2079 de5071c5 Blue Swirl
int main(void) { struct s { int f; }; return offsetof(struct s, f); }
2080 de5071c5 Blue Swirl
EOF
2081 de5071c5 Blue Swirl
if compile_prog "" "" ; then
2082 de5071c5 Blue Swirl
    need_offsetof=no
2083 de5071c5 Blue Swirl
fi
2084 de5071c5 Blue Swirl
2085 5f6b9e8f Blue Swirl
##########################################
2086 747bbdf7 Blue Swirl
# check if the compiler understands attribute warn_unused_result
2087 747bbdf7 Blue Swirl
#
2088 747bbdf7 Blue Swirl
# This could be smarter, but gcc -Werror does not error out even when warning
2089 747bbdf7 Blue Swirl
# about attribute warn_unused_result
2090 747bbdf7 Blue Swirl
2091 747bbdf7 Blue Swirl
gcc_attribute_warn_unused_result=no
2092 747bbdf7 Blue Swirl
cat > $TMPC << EOF
2093 747bbdf7 Blue Swirl
#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
2094 747bbdf7 Blue Swirl
#error gcc 3.3 or older
2095 747bbdf7 Blue Swirl
#endif
2096 747bbdf7 Blue Swirl
int main(void) { return 0;}
2097 747bbdf7 Blue Swirl
EOF
2098 747bbdf7 Blue Swirl
if compile_prog "" ""; then
2099 747bbdf7 Blue Swirl
    gcc_attribute_warn_unused_result=yes
2100 747bbdf7 Blue Swirl
fi
2101 747bbdf7 Blue Swirl
2102 cd4ec0b4 Gerd Hoffmann
# spice probe
2103 cd4ec0b4 Gerd Hoffmann
if test "$spice" != "no" ; then
2104 cd4ec0b4 Gerd Hoffmann
  cat > $TMPC << EOF
2105 cd4ec0b4 Gerd Hoffmann
#include <spice.h>
2106 cd4ec0b4 Gerd Hoffmann
int main(void) { spice_server_new(); return 0; }
2107 cd4ec0b4 Gerd Hoffmann
EOF
2108 cd4ec0b4 Gerd Hoffmann
  spice_cflags=$($pkgconfig --cflags spice-protocol spice-server 2>/dev/null)
2109 cd4ec0b4 Gerd Hoffmann
  spice_libs=$($pkgconfig --libs spice-protocol spice-server 2>/dev/null)
2110 ba807829 Stefan Weil
  if $pkgconfig --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \
2111 cd4ec0b4 Gerd Hoffmann
     compile_prog "$spice_cflags" "$spice_libs" ; then
2112 cd4ec0b4 Gerd Hoffmann
    spice="yes"
2113 cd4ec0b4 Gerd Hoffmann
    libs_softmmu="$libs_softmmu $spice_libs"
2114 cd4ec0b4 Gerd Hoffmann
    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2115 cd4ec0b4 Gerd Hoffmann
  else
2116 cd4ec0b4 Gerd Hoffmann
    if test "$spice" = "yes" ; then
2117 cd4ec0b4 Gerd Hoffmann
      feature_not_found "spice"
2118 cd4ec0b4 Gerd Hoffmann
    fi
2119 cd4ec0b4 Gerd Hoffmann
    spice="no"
2120 cd4ec0b4 Gerd Hoffmann
  fi
2121 cd4ec0b4 Gerd Hoffmann
fi
2122 cd4ec0b4 Gerd Hoffmann
2123 cd4ec0b4 Gerd Hoffmann
##########################################
2124 cd4ec0b4 Gerd Hoffmann
2125 747bbdf7 Blue Swirl
##########################################
2126 5f6b9e8f Blue Swirl
# check if we have fdatasync
2127 5f6b9e8f Blue Swirl
2128 5f6b9e8f Blue Swirl
fdatasync=no
2129 5f6b9e8f Blue Swirl
cat > $TMPC << EOF
2130 5f6b9e8f Blue Swirl
#include <unistd.h>
2131 5f6b9e8f Blue Swirl
int main(void) { return fdatasync(0); }
2132 5f6b9e8f Blue Swirl
EOF
2133 5f6b9e8f Blue Swirl
if compile_prog "" "" ; then
2134 5f6b9e8f Blue Swirl
    fdatasync=yes
2135 5f6b9e8f Blue Swirl
fi
2136 5f6b9e8f Blue Swirl
2137 94a420b1 Stefan Hajnoczi
##########################################
2138 e78815a5 Andreas Färber
# check if we have madvise
2139 e78815a5 Andreas Färber
2140 e78815a5 Andreas Färber
madvise=no
2141 e78815a5 Andreas Färber
cat > $TMPC << EOF
2142 e78815a5 Andreas Färber
#include <sys/types.h>
2143 e78815a5 Andreas Färber
#include <sys/mman.h>
2144 832ce9c2 Scott Wood
#include <stddef.h>
2145 e78815a5 Andreas Färber
int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2146 e78815a5 Andreas Färber
EOF
2147 e78815a5 Andreas Färber
if compile_prog "" "" ; then
2148 e78815a5 Andreas Färber
    madvise=yes
2149 e78815a5 Andreas Färber
fi
2150 e78815a5 Andreas Färber
2151 e78815a5 Andreas Färber
##########################################
2152 e78815a5 Andreas Färber
# check if we have posix_madvise
2153 e78815a5 Andreas Färber
2154 e78815a5 Andreas Färber
posix_madvise=no
2155 e78815a5 Andreas Färber
cat > $TMPC << EOF
2156 e78815a5 Andreas Färber
#include <sys/mman.h>
2157 832ce9c2 Scott Wood
#include <stddef.h>
2158 e78815a5 Andreas Färber
int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2159 e78815a5 Andreas Färber
EOF
2160 e78815a5 Andreas Färber
if compile_prog "" "" ; then
2161 e78815a5 Andreas Färber
    posix_madvise=yes
2162 e78815a5 Andreas Färber
fi
2163 e78815a5 Andreas Färber
2164 e78815a5 Andreas Färber
##########################################
2165 94a420b1 Stefan Hajnoczi
# check if trace backend exists
2166 94a420b1 Stefan Hajnoczi
2167 94a420b1 Stefan Hajnoczi
sh "$source_path/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
2168 94a420b1 Stefan Hajnoczi
if test "$?" -ne 0 ; then
2169 94a420b1 Stefan Hajnoczi
  echo
2170 94a420b1 Stefan Hajnoczi
  echo "Error: invalid trace backend"
2171 94a420b1 Stefan Hajnoczi
  echo "Please choose a supported trace backend."
2172 94a420b1 Stefan Hajnoczi
  echo
2173 94a420b1 Stefan Hajnoczi
  exit 1
2174 94a420b1 Stefan Hajnoczi
fi
2175 94a420b1 Stefan Hajnoczi
2176 7e24e92a Stefan Hajnoczi
##########################################
2177 7e24e92a Stefan Hajnoczi
# For 'ust' backend, test if ust headers are present
2178 7e24e92a Stefan Hajnoczi
if test "$trace_backend" = "ust"; then
2179 7e24e92a Stefan Hajnoczi
  cat > $TMPC << EOF
2180 7e24e92a Stefan Hajnoczi
#include <ust/tracepoint.h>
2181 7e24e92a Stefan Hajnoczi
#include <ust/marker.h>
2182 7e24e92a Stefan Hajnoczi
int main(void) { return 0; }
2183 7e24e92a Stefan Hajnoczi
EOF
2184 7e24e92a Stefan Hajnoczi
  if compile_prog "" "" ; then
2185 7e24e92a Stefan Hajnoczi
    LIBS="-lust $LIBS"
2186 7e24e92a Stefan Hajnoczi
  else
2187 7e24e92a Stefan Hajnoczi
    echo
2188 7e24e92a Stefan Hajnoczi
    echo "Error: Trace backend 'ust' missing libust header files"
2189 7e24e92a Stefan Hajnoczi
    echo
2190 7e24e92a Stefan Hajnoczi
    exit 1
2191 7e24e92a Stefan Hajnoczi
  fi
2192 7e24e92a Stefan Hajnoczi
fi
2193 7e24e92a Stefan Hajnoczi
##########################################
2194 e86ecd4b Juan Quintela
# End of CC checks
2195 e86ecd4b Juan Quintela
# After here, no more $cc or $ld runs
2196 e86ecd4b Juan Quintela
2197 e86ecd4b Juan Quintela
if test "$debug" = "no" ; then
2198 1156c669 Juan Quintela
  CFLAGS="-O2 $CFLAGS"
2199 e86ecd4b Juan Quintela
fi
2200 a316e378 Juan Quintela
2201 e86ecd4b Juan Quintela
# Consult white-list to determine whether to enable werror
2202 e86ecd4b Juan Quintela
# by default.  Only enable by default for git builds
2203 20ff6c80 Anthony Liguori
z_version=`cut -f3 -d. $source_path/VERSION`
2204 20ff6c80 Anthony Liguori
2205 e86ecd4b Juan Quintela
if test -z "$werror" ; then
2206 e86ecd4b Juan Quintela
    if test "$z_version" = "50" -a \
2207 e86ecd4b Juan Quintela
        "$linux" = "yes" ; then
2208 e86ecd4b Juan Quintela
        werror="yes"
2209 e86ecd4b Juan Quintela
    else
2210 e86ecd4b Juan Quintela
        werror="no"
2211 e86ecd4b Juan Quintela
    fi
2212 e86ecd4b Juan Quintela
fi
2213 e86ecd4b Juan Quintela
2214 20ff6c80 Anthony Liguori
# Disable zero malloc errors for official releases unless explicitly told to
2215 20ff6c80 Anthony Liguori
# enable/disable
2216 20ff6c80 Anthony Liguori
if test -z "$zero_malloc" ; then
2217 20ff6c80 Anthony Liguori
    if test "$z_version" = "50" ; then
2218 20ff6c80 Anthony Liguori
	zero_malloc="no"
2219 20ff6c80 Anthony Liguori
    else
2220 20ff6c80 Anthony Liguori
	zero_malloc="yes"
2221 20ff6c80 Anthony Liguori
    fi
2222 20ff6c80 Anthony Liguori
fi
2223 20ff6c80 Anthony Liguori
2224 e86ecd4b Juan Quintela
if test "$werror" = "yes" ; then
2225 a558ee17 Juan Quintela
    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2226 e86ecd4b Juan Quintela
fi
2227 e86ecd4b Juan Quintela
2228 e86ecd4b Juan Quintela
if test "$solaris" = "no" ; then
2229 e86ecd4b Juan Quintela
    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
2230 1156c669 Juan Quintela
        LDFLAGS="-Wl,--warn-common $LDFLAGS"
2231 e86ecd4b Juan Quintela
    fi
2232 e86ecd4b Juan Quintela
fi
2233 e86ecd4b Juan Quintela
2234 952afb71 Blue Swirl
# Use ASLR, no-SEH and DEP if available
2235 952afb71 Blue Swirl
if test "$mingw32" = "yes" ; then
2236 952afb71 Blue Swirl
    for flag in --dynamicbase --no-seh --nxcompat; do
2237 952afb71 Blue Swirl
        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2238 952afb71 Blue Swirl
            LDFLAGS="-Wl,$flag $LDFLAGS"
2239 952afb71 Blue Swirl
        fi
2240 952afb71 Blue Swirl
    done
2241 952afb71 Blue Swirl
fi
2242 952afb71 Blue Swirl
2243 190e9c59 Paolo Bonzini
confdir=$sysconfdir$confsuffix
2244 e7b45cc4 Paolo Bonzini
2245 ca35f780 Paolo Bonzini
tools=
2246 ca35f780 Paolo Bonzini
if test "$softmmu" = yes ; then
2247 ca35f780 Paolo Bonzini
  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2248 ca35f780 Paolo Bonzini
  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2249 ca35f780 Paolo Bonzini
      tools="qemu-nbd\$(EXESUF) $tools"
2250 ca35f780 Paolo Bonzini
    if [ "$check_utests" = "yes" ]; then
2251 ca35f780 Paolo Bonzini
      tools="check-qint check-qstring check-qdict check-qlist $tools"
2252 ca35f780 Paolo Bonzini
      tools="check-qfloat check-qjson $tools"
2253 ca35f780 Paolo Bonzini
    fi
2254 ca35f780 Paolo Bonzini
  fi
2255 ca35f780 Paolo Bonzini
fi
2256 ca35f780 Paolo Bonzini
2257 ca35f780 Paolo Bonzini
# Mac OS X ships with a broken assembler
2258 ca35f780 Paolo Bonzini
roms=
2259 ca35f780 Paolo Bonzini
if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2260 ca35f780 Paolo Bonzini
        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2261 ca35f780 Paolo Bonzini
        "$softmmu" = yes ; then
2262 ca35f780 Paolo Bonzini
  roms="optionrom"
2263 ca35f780 Paolo Bonzini
fi
2264 ca35f780 Paolo Bonzini
2265 ca35f780 Paolo Bonzini
2266 43ce4dfe bellard
echo "Install prefix    $prefix"
2267 f2b9e1e3 Paolo Bonzini
echo "BIOS directory    `eval echo $datadir`"
2268 f2b9e1e3 Paolo Bonzini
echo "binary directory  `eval echo $bindir`"
2269 1c0fd160 Aurelien Jarno
echo "config directory  `eval echo $sysconfdir`"
2270 11d9f695 bellard
if test "$mingw32" = "no" ; then
2271 f2b9e1e3 Paolo Bonzini
echo "Manual directory  `eval echo $mandir`"
2272 43ce4dfe bellard
echo "ELF interp prefix $interp_prefix"
2273 11d9f695 bellard
fi
2274 5a67135a bellard
echo "Source path       $source_path"
2275 43ce4dfe bellard
echo "C compiler        $cc"
2276 83469015 bellard
echo "Host C compiler   $host_cc"
2277 0c439cbf Juan Quintela
echo "CFLAGS            $CFLAGS"
2278 a558ee17 Juan Quintela
echo "QEMU_CFLAGS       $QEMU_CFLAGS"
2279 0c439cbf Juan Quintela
echo "LDFLAGS           $LDFLAGS"
2280 43ce4dfe bellard
echo "make              $make"
2281 6a882643 pbrook
echo "install           $install"
2282 43ce4dfe bellard
echo "host CPU          $cpu"
2283 de83cd02 bellard
echo "host big endian   $bigendian"
2284 97a847bc bellard
echo "target list       $target_list"
2285 ade25b0d aurel32
echo "tcg debug enabled $debug_tcg"
2286 b4475aa2 Luiz Capitulino
echo "Mon debug enabled $debug_mon"
2287 43ce4dfe bellard
echo "gprof enabled     $gprof"
2288 03b4fe7d aliguori
echo "sparse enabled    $sparse"
2289 1625af87 aliguori
echo "strip binaries    $strip_opt"
2290 05c2a3e7 bellard
echo "profiler          $profiler"
2291 43ce4dfe bellard
echo "static build      $static"
2292 85aa5189 bellard
echo "-Werror enabled   $werror"
2293 5b0753e0 bellard
if test "$darwin" = "yes" ; then
2294 5b0753e0 bellard
    echo "Cocoa support     $cocoa"
2295 5b0753e0 bellard
fi
2296 97a847bc bellard
echo "SDL support       $sdl"
2297 4d3b6f6e balrog
echo "curses support    $curses"
2298 769ce76d Alexander Graf
echo "curl support      $curl"
2299 5495ed11 Luiz Capitulino
echo "check support     $check_utests"
2300 67b915a5 bellard
echo "mingw32 support   $mingw32"
2301 0c58ac1c malc
echo "Audio drivers     $audio_drv_list"
2302 0c58ac1c malc
echo "Extra audio cards $audio_card_list"
2303 eb852011 Markus Armbruster
echo "Block whitelist   $block_drv_whitelist"
2304 8ff9cbf7 malc
echo "Mixer emulation   $mixemu"
2305 8d5d2d4c ths
echo "VNC TLS support   $vnc_tls"
2306 2f9606b3 aliguori
echo "VNC SASL support  $vnc_sasl"
2307 2f6f5c7a Corentin Chary
echo "VNC JPEG support  $vnc_jpeg"
2308 efe556ad Corentin Chary
echo "VNC PNG support   $vnc_png"
2309 bd023f95 Corentin Chary
echo "VNC thread        $vnc_thread"
2310 3142255c blueswir1
if test -n "$sparc_cpu"; then
2311 3142255c blueswir1
    echo "Target Sparc Arch $sparc_cpu"
2312 3142255c blueswir1
fi
2313 e37630ca aliguori
echo "xen support       $xen"
2314 2e4d9fb1 aurel32
echo "brlapi support    $brlapi"
2315 a20a6f46 Juan Quintela
echo "bluez  support    $bluez"
2316 a25dba17 Juan Quintela
echo "Documentation     $docs"
2317 c5937220 pbrook
[ ! -z "$uname_release" ] && \
2318 c5937220 pbrook
echo "uname -r          $uname_release"
2319 bd0c5661 pbrook
echo "NPTL support      $nptl"
2320 379f6698 Paul Brook
echo "GUEST_BASE        $guest_base"
2321 34005a00 Kirill A. Shutemov
echo "PIE user targets  $user_pie"
2322 8a16d273 ths
echo "vde support       $vde"
2323 e5d355d1 aliguori
echo "IO thread         $io_thread"
2324 5c6c3a6c Christoph Hellwig
echo "Linux AIO support $linux_aio"
2325 758e8e38 Venkateswararao Jujjuri (JV)
echo "ATTR/XATTR support $attr"
2326 77755340 ths
echo "Install blobs     $blobs"
2327 b31a0277 Juan Quintela
echo "KVM support       $kvm"
2328 f652e6af aurel32
echo "fdt support       $fdt"
2329 ceb42de8 aliguori
echo "preadv support    $preadv"
2330 5f6b9e8f Blue Swirl
echo "fdatasync         $fdatasync"
2331 e78815a5 Andreas Färber
echo "madvise           $madvise"
2332 e78815a5 Andreas Färber
echo "posix_madvise     $posix_madvise"
2333 ee682d27 Stefan Weil
echo "uuid support      $uuid"
2334 d5970055 Michael S. Tsirkin
echo "vhost-net support $vhost_net"
2335 94a420b1 Stefan Hajnoczi
echo "Trace backend     $trace_backend"
2336 9410b56c Prerna Saxena
echo "Trace output file $trace_file-<pid>"
2337 cd4ec0b4 Gerd Hoffmann
echo "spice support     $spice"
2338 67b915a5 bellard
2339 97a847bc bellard
if test $sdl_too_old = "yes"; then
2340 24b55b96 bellard
echo "-> Your SDL version is too old - please upgrade to have SDL support"
2341 7c1f25b4 bellard
fi
2342 7d13299d bellard
2343 98ec69ac Juan Quintela
config_host_mak="config-host.mak"
2344 4bf6b55b Juan Quintela
config_host_ld="config-host.ld"
2345 98ec69ac Juan Quintela
2346 98ec69ac Juan Quintela
echo "# Automatically generated by configure - do not modify" > $config_host_mak
2347 98ec69ac Juan Quintela
printf "# Configured with:" >> $config_host_mak
2348 98ec69ac Juan Quintela
printf " '%s'" "$0" "$@" >> $config_host_mak
2349 98ec69ac Juan Quintela
echo >> $config_host_mak
2350 98ec69ac Juan Quintela
2351 e6c3b0f7 Paolo Bonzini
echo all: >> $config_host_mak
2352 99d7cc75 Paolo Bonzini
echo "prefix=$prefix" >> $config_host_mak
2353 99d7cc75 Paolo Bonzini
echo "bindir=$bindir" >> $config_host_mak
2354 99d7cc75 Paolo Bonzini
echo "mandir=$mandir" >> $config_host_mak
2355 99d7cc75 Paolo Bonzini
echo "datadir=$datadir" >> $config_host_mak
2356 99d7cc75 Paolo Bonzini
echo "sysconfdir=$sysconfdir" >> $config_host_mak
2357 99d7cc75 Paolo Bonzini
echo "docdir=$docdir" >> $config_host_mak
2358 1dabe05c Paolo Bonzini
echo "confdir=$confdir" >> $config_host_mak
2359 804edf29 Juan Quintela
2360 2408a527 aurel32
case "$cpu" in
2361 24e804ec Alexander Graf
  i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
2362 e0da9dd3 Juan Quintela
    ARCH=$cpu
2363 2408a527 aurel32
  ;;
2364 a302c32d Laurent Desnogues
  armv4b|armv4l)
2365 16dbd14f Juan Quintela
    ARCH=arm
2366 2408a527 aurel32
  ;;
2367 2408a527 aurel32
esac
2368 98ec69ac Juan Quintela
echo "ARCH=$ARCH" >> $config_host_mak
2369 f8393946 aurel32
if test "$debug_tcg" = "yes" ; then
2370 2358a494 Juan Quintela
  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2371 f8393946 aurel32
fi
2372 b4475aa2 Luiz Capitulino
if test "$debug_mon" = "yes" ; then
2373 b4475aa2 Luiz Capitulino
  echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2374 b4475aa2 Luiz Capitulino
fi
2375 f3d08ee6 Paul Brook
if test "$debug" = "yes" ; then
2376 2358a494 Juan Quintela
  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2377 f3d08ee6 Paul Brook
fi
2378 1625af87 aliguori
if test "$strip_opt" = "yes" ; then
2379 52ba784d Hollis Blanchard
  echo "STRIP=${strip}" >> $config_host_mak
2380 1625af87 aliguori
fi
2381 7d13299d bellard
if test "$bigendian" = "yes" ; then
2382 e2542fe2 Juan Quintela
  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
2383 97a847bc bellard
fi
2384 2358a494 Juan Quintela
echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
2385 67b915a5 bellard
if test "$mingw32" = "yes" ; then
2386 98ec69ac Juan Quintela
  echo "CONFIG_WIN32=y" >> $config_host_mak
2387 9fe6de94 Blue Swirl
  rc_version=`cat $source_path/VERSION`
2388 9fe6de94 Blue Swirl
  version_major=${rc_version%%.*}
2389 9fe6de94 Blue Swirl
  rc_version=${rc_version#*.}
2390 9fe6de94 Blue Swirl
  version_minor=${rc_version%%.*}
2391 9fe6de94 Blue Swirl
  rc_version=${rc_version#*.}
2392 9fe6de94 Blue Swirl
  version_subminor=${rc_version%%.*}
2393 9fe6de94 Blue Swirl
  version_micro=0
2394 9fe6de94 Blue Swirl
  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2395 9fe6de94 Blue Swirl
  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2396 210fa556 pbrook
else
2397 35f4df27 Juan Quintela
  echo "CONFIG_POSIX=y" >> $config_host_mak
2398 dffcb71c Mark McLoughlin
fi
2399 dffcb71c Mark McLoughlin
2400 dffcb71c Mark McLoughlin
if test "$linux" = "yes" ; then
2401 dffcb71c Mark McLoughlin
  echo "CONFIG_LINUX=y" >> $config_host_mak
2402 67b915a5 bellard
fi
2403 128ab2ff blueswir1
2404 83fb7adf bellard
if test "$darwin" = "yes" ; then
2405 98ec69ac Juan Quintela
  echo "CONFIG_DARWIN=y" >> $config_host_mak
2406 83fb7adf bellard
fi
2407 b29fe3ed malc
2408 b29fe3ed malc
if test "$aix" = "yes" ; then
2409 98ec69ac Juan Quintela
  echo "CONFIG_AIX=y" >> $config_host_mak
2410 b29fe3ed malc
fi
2411 b29fe3ed malc
2412 ec530c81 bellard
if test "$solaris" = "yes" ; then
2413 98ec69ac Juan Quintela
  echo "CONFIG_SOLARIS=y" >> $config_host_mak
2414 2358a494 Juan Quintela
  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
2415 0475a5ca ths
  if test "$needs_libsunmath" = "yes" ; then
2416 75b5a697 Juan Quintela
    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
2417 0475a5ca ths
  fi
2418 ec530c81 bellard
fi
2419 179cf400 Andreas Färber
if test "$haiku" = "yes" ; then
2420 179cf400 Andreas Färber
  echo "CONFIG_HAIKU=y" >> $config_host_mak
2421 179cf400 Andreas Färber
fi
2422 97a847bc bellard
if test "$static" = "yes" ; then
2423 98ec69ac Juan Quintela
  echo "CONFIG_STATIC=y" >> $config_host_mak
2424 7d13299d bellard
fi
2425 05c2a3e7 bellard
if test $profiler = "yes" ; then
2426 2358a494 Juan Quintela
  echo "CONFIG_PROFILER=y" >> $config_host_mak
2427 05c2a3e7 bellard
fi
2428 c20709aa bellard
if test "$slirp" = "yes" ; then
2429 98ec69ac Juan Quintela
  echo "CONFIG_SLIRP=y" >> $config_host_mak
2430 b6e31c12 Juan Quintela
  QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
2431 c20709aa bellard
fi
2432 8a16d273 ths
if test "$vde" = "yes" ; then
2433 98ec69ac Juan Quintela
  echo "CONFIG_VDE=y" >> $config_host_mak
2434 8a16d273 ths
fi
2435 0c58ac1c malc
for card in $audio_card_list; do
2436 f6e5889e pbrook
    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
2437 98ec69ac Juan Quintela
    echo "$def=y" >> $config_host_mak
2438 0c58ac1c malc
done
2439 2358a494 Juan Quintela
echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
2440 0c58ac1c malc
for drv in $audio_drv_list; do
2441 f6e5889e pbrook
    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
2442 98ec69ac Juan Quintela
    echo "$def=y" >> $config_host_mak
2443 923e4521 malc
    if test "$drv" = "fmod"; then
2444 7aac6cb1 Juan Quintela
        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
2445 0c58ac1c malc
    fi
2446 0c58ac1c malc
done
2447 67f86e8e Juan Quintela
if test "$audio_pt_int" = "yes" ; then
2448 67f86e8e Juan Quintela
  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2449 67f86e8e Juan Quintela
fi
2450 d5631638 malc
if test "$audio_win_int" = "yes" ; then
2451 d5631638 malc
  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2452 d5631638 malc
fi
2453 eb852011 Markus Armbruster
echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
2454 8ff9cbf7 malc
if test "$mixemu" = "yes" ; then
2455 98ec69ac Juan Quintela
  echo "CONFIG_MIXEMU=y" >> $config_host_mak
2456 8ff9cbf7 malc
fi
2457 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
2458 98ec69ac Juan Quintela
  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
2459 525061bf Juan Quintela
  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
2460 8d5d2d4c ths
fi
2461 2f9606b3 aliguori
if test "$vnc_sasl" = "yes" ; then
2462 98ec69ac Juan Quintela
  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
2463 60ddf533 Juan Quintela
  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
2464 2f9606b3 aliguori
fi
2465 96763cf9 Corentin Chary
if test "$vnc_jpeg" != "no" ; then
2466 2f6f5c7a Corentin Chary
  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
2467 2f6f5c7a Corentin Chary
  echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
2468 2f6f5c7a Corentin Chary
fi
2469 96763cf9 Corentin Chary
if test "$vnc_png" != "no" ; then
2470 efe556ad Corentin Chary
  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2471 efe556ad Corentin Chary
  echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2472 efe556ad Corentin Chary
fi
2473 96763cf9 Corentin Chary
if test "$vnc_thread" != "no" ; then
2474 bd023f95 Corentin Chary
  echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
2475 bd023f95 Corentin Chary
  echo "CONFIG_THREAD=y" >> $config_host_mak
2476 bd023f95 Corentin Chary
fi
2477 76655d6d aliguori
if test "$fnmatch" = "yes" ; then
2478 2358a494 Juan Quintela
  echo "CONFIG_FNMATCH=y" >> $config_host_mak
2479 76655d6d aliguori
fi
2480 ee682d27 Stefan Weil
if test "$uuid" = "yes" ; then
2481 ee682d27 Stefan Weil
  echo "CONFIG_UUID=y" >> $config_host_mak
2482 ee682d27 Stefan Weil
fi
2483 b1a550a0 pbrook
qemu_version=`head $source_path/VERSION`
2484 98ec69ac Juan Quintela
echo "VERSION=$qemu_version" >>$config_host_mak
2485 2358a494 Juan Quintela
echo "PKGVERSION=$pkgversion" >>$config_host_mak
2486 98ec69ac Juan Quintela
echo "SRC_PATH=$source_path" >> $config_host_mak
2487 98ec69ac Juan Quintela
echo "TARGET_DIRS=$target_list" >> $config_host_mak
2488 a25dba17 Juan Quintela
if [ "$docs" = "yes" ] ; then
2489 98ec69ac Juan Quintela
  echo "BUILD_DOCS=yes" >> $config_host_mak
2490 cc8ae6de pbrook
fi
2491 1ac88f28 Juan Quintela
if test "$sdl" = "yes" ; then
2492 98ec69ac Juan Quintela
  echo "CONFIG_SDL=y" >> $config_host_mak
2493 1ac88f28 Juan Quintela
  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
2494 49ecc3fa bellard
fi
2495 49ecc3fa bellard
if test "$cocoa" = "yes" ; then
2496 98ec69ac Juan Quintela
  echo "CONFIG_COCOA=y" >> $config_host_mak
2497 4d3b6f6e balrog
fi
2498 4d3b6f6e balrog
if test "$curses" = "yes" ; then
2499 98ec69ac Juan Quintela
  echo "CONFIG_CURSES=y" >> $config_host_mak
2500 49ecc3fa bellard
fi
2501 3b3f24ad aurel32
if test "$atfile" = "yes" ; then
2502 2358a494 Juan Quintela
  echo "CONFIG_ATFILE=y" >> $config_host_mak
2503 3b3f24ad aurel32
fi
2504 ebc996f3 Riku Voipio
if test "$utimens" = "yes" ; then
2505 2358a494 Juan Quintela
  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
2506 ebc996f3 Riku Voipio
fi
2507 099d6b0f Riku Voipio
if test "$pipe2" = "yes" ; then
2508 2358a494 Juan Quintela
  echo "CONFIG_PIPE2=y" >> $config_host_mak
2509 099d6b0f Riku Voipio
fi
2510 40ff6d7e Kevin Wolf
if test "$accept4" = "yes" ; then
2511 40ff6d7e Kevin Wolf
  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
2512 40ff6d7e Kevin Wolf
fi
2513 3ce34dfb vibisreenivasan
if test "$splice" = "yes" ; then
2514 2358a494 Juan Quintela
  echo "CONFIG_SPLICE=y" >> $config_host_mak
2515 3ce34dfb vibisreenivasan
fi
2516 c2882b96 Riku Voipio
if test "$eventfd" = "yes" ; then
2517 c2882b96 Riku Voipio
  echo "CONFIG_EVENTFD=y" >> $config_host_mak
2518 c2882b96 Riku Voipio
fi
2519 d0927938 Ulrich Hecht
if test "$fallocate" = "yes" ; then
2520 d0927938 Ulrich Hecht
  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2521 d0927938 Ulrich Hecht
fi
2522 d0927938 Ulrich Hecht
if test "$dup3" = "yes" ; then
2523 d0927938 Ulrich Hecht
  echo "CONFIG_DUP3=y" >> $config_host_mak
2524 d0927938 Ulrich Hecht
fi
2525 3b3f24ad aurel32
if test "$inotify" = "yes" ; then
2526 2358a494 Juan Quintela
  echo "CONFIG_INOTIFY=y" >> $config_host_mak
2527 3b3f24ad aurel32
fi
2528 c05c7a73 Riku Voipio
if test "$inotify1" = "yes" ; then
2529 c05c7a73 Riku Voipio
  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2530 c05c7a73 Riku Voipio
fi
2531 6ae9a1f4 Juan Quintela
if test "$byteswap_h" = "yes" ; then
2532 6ae9a1f4 Juan Quintela
  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
2533 6ae9a1f4 Juan Quintela
fi
2534 6ae9a1f4 Juan Quintela
if test "$bswap_h" = "yes" ; then
2535 6ae9a1f4 Juan Quintela
  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
2536 6ae9a1f4 Juan Quintela
fi
2537 769ce76d Alexander Graf
if test "$curl" = "yes" ; then
2538 98ec69ac Juan Quintela
  echo "CONFIG_CURL=y" >> $config_host_mak
2539 b1d5a277 Juan Quintela
  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
2540 769ce76d Alexander Graf
fi
2541 2e4d9fb1 aurel32
if test "$brlapi" = "yes" ; then
2542 98ec69ac Juan Quintela
  echo "CONFIG_BRLAPI=y" >> $config_host_mak
2543 2e4d9fb1 aurel32
fi
2544 fb599c9a balrog
if test "$bluez" = "yes" ; then
2545 98ec69ac Juan Quintela
  echo "CONFIG_BLUEZ=y" >> $config_host_mak
2546 ef7635ec Juan Quintela
  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
2547 fb599c9a balrog
fi
2548 e37630ca aliguori
if test "$xen" = "yes" ; then
2549 5647eb74 Juan Quintela
  echo "CONFIG_XEN=y" >> $config_host_mak
2550 e37630ca aliguori
fi
2551 e5d355d1 aliguori
if test "$io_thread" = "yes" ; then
2552 98ec69ac Juan Quintela
  echo "CONFIG_IOTHREAD=y" >> $config_host_mak
2553 bd023f95 Corentin Chary
  echo "CONFIG_THREAD=y" >> $config_host_mak
2554 e5d355d1 aliguori
fi
2555 5c6c3a6c Christoph Hellwig
if test "$linux_aio" = "yes" ; then
2556 5c6c3a6c Christoph Hellwig
  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
2557 5c6c3a6c Christoph Hellwig
fi
2558 758e8e38 Venkateswararao Jujjuri (JV)
if test "$attr" = "yes" ; then
2559 758e8e38 Venkateswararao Jujjuri (JV)
  echo "CONFIG_ATTR=y" >> $config_host_mak
2560 758e8e38 Venkateswararao Jujjuri (JV)
fi
2561 758e8e38 Venkateswararao Jujjuri (JV)
if test "$linux" = "yes" ; then
2562 758e8e38 Venkateswararao Jujjuri (JV)
  if test "$attr" = "yes" ; then
2563 758e8e38 Venkateswararao Jujjuri (JV)
    echo "CONFIG_VIRTFS=y" >> $config_host_mak
2564 758e8e38 Venkateswararao Jujjuri (JV)
  fi
2565 758e8e38 Venkateswararao Jujjuri (JV)
fi
2566 77755340 ths
if test "$blobs" = "yes" ; then
2567 98ec69ac Juan Quintela
  echo "INSTALL_BLOBS=yes" >> $config_host_mak
2568 77755340 ths
fi
2569 bf9298b9 aliguori
if test "$iovec" = "yes" ; then
2570 2358a494 Juan Quintela
  echo "CONFIG_IOVEC=y" >> $config_host_mak
2571 bf9298b9 aliguori
fi
2572 ceb42de8 aliguori
if test "$preadv" = "yes" ; then
2573 2358a494 Juan Quintela
  echo "CONFIG_PREADV=y" >> $config_host_mak
2574 ceb42de8 aliguori
fi
2575 f652e6af aurel32
if test "$fdt" = "yes" ; then
2576 3f0855b1 Juan Quintela
  echo "CONFIG_FDT=y" >> $config_host_mak
2577 f652e6af aurel32
fi
2578 dcc38d1c Marcelo Tosatti
if test "$signalfd" = "yes" ; then
2579 dcc38d1c Marcelo Tosatti
  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
2580 dcc38d1c Marcelo Tosatti
fi
2581 de5071c5 Blue Swirl
if test "$need_offsetof" = "yes" ; then
2582 de5071c5 Blue Swirl
  echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2583 de5071c5 Blue Swirl
fi
2584 747bbdf7 Blue Swirl
if test "$gcc_attribute_warn_unused_result" = "yes" ; then
2585 747bbdf7 Blue Swirl
  echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2586 747bbdf7 Blue Swirl
fi
2587 5f6b9e8f Blue Swirl
if test "$fdatasync" = "yes" ; then
2588 5f6b9e8f Blue Swirl
  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
2589 5f6b9e8f Blue Swirl
fi
2590 e78815a5 Andreas Färber
if test "$madvise" = "yes" ; then
2591 e78815a5 Andreas Färber
  echo "CONFIG_MADVISE=y" >> $config_host_mak
2592 e78815a5 Andreas Färber
fi
2593 e78815a5 Andreas Färber
if test "$posix_madvise" = "yes" ; then
2594 e78815a5 Andreas Färber
  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
2595 e78815a5 Andreas Färber
fi
2596 97a847bc bellard
2597 cd4ec0b4 Gerd Hoffmann
if test "$spice" = "yes" ; then
2598 cd4ec0b4 Gerd Hoffmann
  echo "CONFIG_SPICE=y" >> $config_host_mak
2599 cd4ec0b4 Gerd Hoffmann
fi
2600 cd4ec0b4 Gerd Hoffmann
2601 83fb7adf bellard
# XXX: suppress that
2602 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
2603 2358a494 Juan Quintela
  echo "CONFIG_BSD=y" >> $config_host_mak
2604 7d3505c5 bellard
fi
2605 7d3505c5 bellard
2606 2358a494 Juan Quintela
echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
2607 c5937220 pbrook
2608 20ff6c80 Anthony Liguori
if test "$zero_malloc" = "yes" ; then
2609 20ff6c80 Anthony Liguori
  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
2610 20ff6c80 Anthony Liguori
fi
2611 20ff6c80 Anthony Liguori
2612 68063649 blueswir1
# USB host support
2613 68063649 blueswir1
case "$usb" in
2614 68063649 blueswir1
linux)
2615 98ec69ac Juan Quintela
  echo "HOST_USB=linux" >> $config_host_mak
2616 68063649 blueswir1
;;
2617 68063649 blueswir1
bsd)
2618 98ec69ac Juan Quintela
  echo "HOST_USB=bsd" >> $config_host_mak
2619 68063649 blueswir1
;;
2620 68063649 blueswir1
*)
2621 98ec69ac Juan Quintela
  echo "HOST_USB=stub" >> $config_host_mak
2622 68063649 blueswir1
;;
2623 68063649 blueswir1
esac
2624 68063649 blueswir1
2625 94a420b1 Stefan Hajnoczi
echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
2626 22890ab5 Prerna Saxena
if test "$trace_backend" = "simple"; then
2627 22890ab5 Prerna Saxena
  echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak
2628 22890ab5 Prerna Saxena
fi
2629 9410b56c Prerna Saxena
# Set the appropriate trace file.
2630 9410b56c Prerna Saxena
if test "$trace_backend" = "simple"; then
2631 9410b56c Prerna Saxena
  trace_file="\"$trace_file-%u\""
2632 9410b56c Prerna Saxena
fi
2633 9410b56c Prerna Saxena
echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
2634 9410b56c Prerna Saxena
2635 98ec69ac Juan Quintela
echo "TOOLS=$tools" >> $config_host_mak
2636 98ec69ac Juan Quintela
echo "ROMS=$roms" >> $config_host_mak
2637 804edf29 Juan Quintela
echo "MAKE=$make" >> $config_host_mak
2638 804edf29 Juan Quintela
echo "INSTALL=$install" >> $config_host_mak
2639 804edf29 Juan Quintela
echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2640 804edf29 Juan Quintela
echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2641 804edf29 Juan Quintela
echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2642 804edf29 Juan Quintela
echo "CC=$cc" >> $config_host_mak
2643 804edf29 Juan Quintela
echo "HOST_CC=$host_cc" >> $config_host_mak
2644 804edf29 Juan Quintela
if test "$sparse" = "yes" ; then
2645 804edf29 Juan Quintela
  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
2646 804edf29 Juan Quintela
  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
2647 a558ee17 Juan Quintela
  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
2648 804edf29 Juan Quintela
fi
2649 804edf29 Juan Quintela
echo "AR=$ar" >> $config_host_mak
2650 804edf29 Juan Quintela
echo "OBJCOPY=$objcopy" >> $config_host_mak
2651 804edf29 Juan Quintela
echo "LD=$ld" >> $config_host_mak
2652 9fe6de94 Blue Swirl
echo "WINDRES=$windres" >> $config_host_mak
2653 e2a2ed06 Juan Quintela
echo "CFLAGS=$CFLAGS" >> $config_host_mak
2654 a558ee17 Juan Quintela
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
2655 c81da56e Juan Quintela
echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
2656 e2a2ed06 Juan Quintela
echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
2657 a36abbbb Juan Quintela
echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2658 a36abbbb Juan Quintela
echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
2659 73da375e Juan Quintela
echo "LIBS+=$LIBS" >> $config_host_mak
2660 3e2e0e6b Juan Quintela
echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
2661 804edf29 Juan Quintela
echo "EXESUF=$EXESUF" >> $config_host_mak
2662 804edf29 Juan Quintela
2663 4bf6b55b Juan Quintela
# generate list of library paths for linker script
2664 4bf6b55b Juan Quintela
2665 4bf6b55b Juan Quintela
$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
2666 4bf6b55b Juan Quintela
2667 4bf6b55b Juan Quintela
if test -f ${config_host_ld}~ ; then
2668 4bf6b55b Juan Quintela
  if cmp -s $config_host_ld ${config_host_ld}~ ; then
2669 4bf6b55b Juan Quintela
    mv ${config_host_ld}~ $config_host_ld
2670 4bf6b55b Juan Quintela
  else
2671 4bf6b55b Juan Quintela
    rm ${config_host_ld}~
2672 4bf6b55b Juan Quintela
  fi
2673 4bf6b55b Juan Quintela
fi
2674 4bf6b55b Juan Quintela
2675 4d904533 Blue Swirl
for d in libdis libdis-user; do
2676 4d904533 Blue Swirl
    mkdir -p $d
2677 4d904533 Blue Swirl
    rm -f $d/Makefile
2678 4d904533 Blue Swirl
    ln -s $source_path/Makefile.dis $d/Makefile
2679 4d904533 Blue Swirl
    echo > $d/config.mak
2680 4d904533 Blue Swirl
done
2681 d44cff22 Richard Henderson
if test "$static" = "no" -a "$user_pie" = "yes" ; then
2682 d44cff22 Richard Henderson
  echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
2683 d44cff22 Richard Henderson
fi
2684 4d904533 Blue Swirl
2685 1d14ffa9 bellard
for target in $target_list; do
2686 97a847bc bellard
target_dir="$target"
2687 25be210f Juan Quintela
config_target_mak=$target_dir/config-target.mak
2688 600309b6 Blue Swirl
target_arch2=`echo $target | cut -d '-' -f 1`
2689 97a847bc bellard
target_bigendian="no"
2690 1f3d3c8f Juan Quintela
2691 ea2d6a39 Juan Quintela
case "$target_arch2" in
2692 24e804ec Alexander Graf
  armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
2693 ea2d6a39 Juan Quintela
  target_bigendian=yes
2694 ea2d6a39 Juan Quintela
  ;;
2695 ea2d6a39 Juan Quintela
esac
2696 97a847bc bellard
target_softmmu="no"
2697 997344f3 bellard
target_user_only="no"
2698 831b7825 ths
target_linux_user="no"
2699 831b7825 ths
target_darwin_user="no"
2700 84778508 blueswir1
target_bsd_user="no"
2701 9e407a85 pbrook
case "$target" in
2702 600309b6 Blue Swirl
  ${target_arch2}-softmmu)
2703 9e407a85 pbrook
    target_softmmu="yes"
2704 9e407a85 pbrook
    ;;
2705 600309b6 Blue Swirl
  ${target_arch2}-linux-user)
2706 9c7a4202 Blue Swirl
    if test "$linux" != "yes" ; then
2707 9c7a4202 Blue Swirl
      echo "ERROR: Target '$target' is only available on a Linux host"
2708 9c7a4202 Blue Swirl
      exit 1
2709 9c7a4202 Blue Swirl
    fi
2710 9e407a85 pbrook
    target_user_only="yes"
2711 9e407a85 pbrook
    target_linux_user="yes"
2712 9e407a85 pbrook
    ;;
2713 600309b6 Blue Swirl
  ${target_arch2}-darwin-user)
2714 9c7a4202 Blue Swirl
    if test "$darwin" != "yes" ; then
2715 9c7a4202 Blue Swirl
      echo "ERROR: Target '$target' is only available on a Darwin host"
2716 9c7a4202 Blue Swirl
      exit 1
2717 9c7a4202 Blue Swirl
    fi
2718 9e407a85 pbrook
    target_user_only="yes"
2719 9e407a85 pbrook
    target_darwin_user="yes"
2720 9e407a85 pbrook
    ;;
2721 600309b6 Blue Swirl
  ${target_arch2}-bsd-user)
2722 9cf55765 Blue Swirl
    if test "$bsd" != "yes" ; then
2723 9c7a4202 Blue Swirl
      echo "ERROR: Target '$target' is only available on a BSD host"
2724 9c7a4202 Blue Swirl
      exit 1
2725 9c7a4202 Blue Swirl
    fi
2726 84778508 blueswir1
    target_user_only="yes"
2727 84778508 blueswir1
    target_bsd_user="yes"
2728 84778508 blueswir1
    ;;
2729 9e407a85 pbrook
  *)
2730 9e407a85 pbrook
    echo "ERROR: Target '$target' not recognised"
2731 9e407a85 pbrook
    exit 1
2732 9e407a85 pbrook
    ;;
2733 9e407a85 pbrook
esac
2734 831b7825 ths
2735 97a847bc bellard
mkdir -p $target_dir
2736 158142c2 bellard
mkdir -p $target_dir/fpu
2737 57fec1fe bellard
mkdir -p $target_dir/tcg
2738 59f2a787 Gerd Hoffmann
mkdir -p $target_dir/ide
2739 84778508 blueswir1
if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
2740 69de927c bellard
  mkdir -p $target_dir/nwfpe
2741 69de927c bellard
fi
2742 69de927c bellard
2743 ec530c81 bellard
#
2744 ec530c81 bellard
# don't use ln -sf as not all "ln -sf" over write the file/link
2745 ec530c81 bellard
#
2746 ec530c81 bellard
rm -f $target_dir/Makefile
2747 ec530c81 bellard
ln -s $source_path/Makefile.target $target_dir/Makefile
2748 ec530c81 bellard
2749 97a847bc bellard
2750 25be210f Juan Quintela
echo "# Automatically generated by configure - do not modify" > $config_target_mak
2751 de83cd02 bellard
2752 e5fe0c52 pbrook
bflt="no"
2753 bd0c5661 pbrook
target_nptl="no"
2754 600309b6 Blue Swirl
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
2755 7ee2822c Paolo Bonzini
echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
2756 56aebc89 pbrook
gdb_xml_files=""
2757 7ba1e619 aliguori
2758 938b1edd Juan Quintela
TARGET_ARCH="$target_arch2"
2759 6acff7da Juan Quintela
TARGET_BASE_ARCH=""
2760 e6e91b9c Juan Quintela
TARGET_ABI_DIR=""
2761 e73aae67 Juan Quintela
2762 600309b6 Blue Swirl
case "$target_arch2" in
2763 2408a527 aurel32
  i386)
2764 1ad2134f Paul Brook
    target_phys_bits=32
2765 2408a527 aurel32
  ;;
2766 2408a527 aurel32
  x86_64)
2767 6acff7da Juan Quintela
    TARGET_BASE_ARCH=i386
2768 1ad2134f Paul Brook
    target_phys_bits=64
2769 2408a527 aurel32
  ;;
2770 2408a527 aurel32
  alpha)
2771 1ad2134f Paul Brook
    target_phys_bits=64
2772 a4b388ff Richard Henderson
    target_nptl="yes"
2773 2408a527 aurel32
  ;;
2774 2408a527 aurel32
  arm|armeb)
2775 b498c8a0 Juan Quintela
    TARGET_ARCH=arm
2776 2408a527 aurel32
    bflt="yes"
2777 bd0c5661 pbrook
    target_nptl="yes"
2778 56aebc89 pbrook
    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2779 1ad2134f Paul Brook
    target_phys_bits=32
2780 2408a527 aurel32
  ;;
2781 2408a527 aurel32
  cris)
2782 253bd7f8 edgar_igl
    target_nptl="yes"
2783 1ad2134f Paul Brook
    target_phys_bits=32
2784 2408a527 aurel32
  ;;
2785 2408a527 aurel32
  m68k)
2786 2408a527 aurel32
    bflt="yes"
2787 56aebc89 pbrook
    gdb_xml_files="cf-core.xml cf-fp.xml"
2788 1ad2134f Paul Brook
    target_phys_bits=32
2789 2408a527 aurel32
  ;;
2790 72b675ca Edgar E. Iglesias
  microblaze)
2791 72b675ca Edgar E. Iglesias
    bflt="yes"
2792 72b675ca Edgar E. Iglesias
    target_nptl="yes"
2793 72b675ca Edgar E. Iglesias
    target_phys_bits=32
2794 72b675ca Edgar E. Iglesias
  ;;
2795 0adcffb1 Juan Quintela
  mips|mipsel)
2796 b498c8a0 Juan Quintela
    TARGET_ARCH=mips
2797 25be210f Juan Quintela
    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
2798 f04dc72f Paul Brook
    target_nptl="yes"
2799 1ad2134f Paul Brook
    target_phys_bits=64
2800 2408a527 aurel32
  ;;
2801 2408a527 aurel32
  mipsn32|mipsn32el)
2802 b498c8a0 Juan Quintela
    TARGET_ARCH=mipsn32
2803 6acff7da Juan Quintela
    TARGET_BASE_ARCH=mips
2804 25be210f Juan Quintela
    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
2805 1ad2134f Paul Brook
    target_phys_bits=64
2806 2408a527 aurel32
  ;;
2807 2408a527 aurel32
  mips64|mips64el)
2808 b498c8a0 Juan Quintela
    TARGET_ARCH=mips64
2809 6acff7da Juan Quintela
    TARGET_BASE_ARCH=mips
2810 25be210f Juan Quintela
    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
2811 1ad2134f Paul Brook
    target_phys_bits=64
2812 2408a527 aurel32
  ;;
2813 2408a527 aurel32
  ppc)
2814 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2815 1ad2134f Paul Brook
    target_phys_bits=32
2816 d6630708 Nathan Froyd
    target_nptl="yes"
2817 2408a527 aurel32
  ;;
2818 2408a527 aurel32
  ppcemb)
2819 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
2820 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
2821 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2822 1ad2134f Paul Brook
    target_phys_bits=64
2823 d6630708 Nathan Froyd
    target_nptl="yes"
2824 2408a527 aurel32
  ;;
2825 2408a527 aurel32
  ppc64)
2826 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
2827 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
2828 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2829 1ad2134f Paul Brook
    target_phys_bits=64
2830 2408a527 aurel32
  ;;
2831 2408a527 aurel32
  ppc64abi32)
2832 b498c8a0 Juan Quintela
    TARGET_ARCH=ppc64
2833 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
2834 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
2835 25be210f Juan Quintela
    echo "TARGET_ABI32=y" >> $config_target_mak
2836 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2837 1ad2134f Paul Brook
    target_phys_bits=64
2838 2408a527 aurel32
  ;;
2839 2408a527 aurel32
  sh4|sh4eb)
2840 b498c8a0 Juan Quintela
    TARGET_ARCH=sh4
2841 2408a527 aurel32
    bflt="yes"
2842 0b6d3ae0 aurel32
    target_nptl="yes"
2843 1ad2134f Paul Brook
    target_phys_bits=32
2844 2408a527 aurel32
  ;;
2845 2408a527 aurel32
  sparc)
2846 1ad2134f Paul Brook
    target_phys_bits=64
2847 2408a527 aurel32
  ;;
2848 2408a527 aurel32
  sparc64)
2849 6acff7da Juan Quintela
    TARGET_BASE_ARCH=sparc
2850 1ad2134f Paul Brook
    target_phys_bits=64
2851 2408a527 aurel32
  ;;
2852 2408a527 aurel32
  sparc32plus)
2853 b498c8a0 Juan Quintela
    TARGET_ARCH=sparc64
2854 6acff7da Juan Quintela
    TARGET_BASE_ARCH=sparc
2855 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=sparc
2856 25be210f Juan Quintela
    echo "TARGET_ABI32=y" >> $config_target_mak
2857 1ad2134f Paul Brook
    target_phys_bits=64
2858 2408a527 aurel32
  ;;
2859 24e804ec Alexander Graf
  s390x)
2860 24e804ec Alexander Graf
    target_phys_bits=64
2861 24e804ec Alexander Graf
  ;;
2862 2408a527 aurel32
  *)
2863 2408a527 aurel32
    echo "Unsupported target CPU"
2864 2408a527 aurel32
    exit 1
2865 2408a527 aurel32
  ;;
2866 2408a527 aurel32
esac
2867 25be210f Juan Quintela
echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
2868 053dd92e Juan Quintela
target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
2869 25be210f Juan Quintela
echo "TARGET_$target_arch_name=y" >> $config_target_mak
2870 25be210f Juan Quintela
echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
2871 42bc608b Juan Quintela
# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
2872 6acff7da Juan Quintela
if [ "$TARGET_BASE_ARCH" = "" ]; then
2873 6acff7da Juan Quintela
  TARGET_BASE_ARCH=$TARGET_ARCH
2874 6acff7da Juan Quintela
fi
2875 25be210f Juan Quintela
echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
2876 e6e91b9c Juan Quintela
if [ "$TARGET_ABI_DIR" = "" ]; then
2877 e6e91b9c Juan Quintela
  TARGET_ABI_DIR=$TARGET_ARCH
2878 e6e91b9c Juan Quintela
fi
2879 25be210f Juan Quintela
echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
2880 1b0c87fc Juan Quintela
case "$target_arch2" in
2881 1b0c87fc Juan Quintela
  i386|x86_64)
2882 1b0c87fc Juan Quintela
    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
2883 25be210f Juan Quintela
      echo "CONFIG_XEN=y" >> $config_target_mak
2884 1b0c87fc Juan Quintela
    fi
2885 1b0c87fc Juan Quintela
esac
2886 c59249f9 Juan Quintela
case "$target_arch2" in
2887 0e60a699 Alexander Graf
  i386|x86_64|ppcemb|ppc|ppc64|s390x)
2888 c59249f9 Juan Quintela
    # Make sure the target and host cpus are compatible
2889 c59249f9 Juan Quintela
    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2890 c59249f9 Juan Quintela
      \( "$target_arch2" = "$cpu" -o \
2891 c59249f9 Juan Quintela
      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
2892 5f114bc6 Alexander Graf
      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
2893 c59249f9 Juan Quintela
      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
2894 c59249f9 Juan Quintela
      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
2895 25be210f Juan Quintela
      echo "CONFIG_KVM=y" >> $config_target_mak
2896 25be210f Juan Quintela
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
2897 dae5079a Jan Kiszka
      if test "$kvm_para" = "yes"; then
2898 dae5079a Jan Kiszka
        echo "CONFIG_KVM_PARA=y" >> $config_target_mak
2899 dae5079a Jan Kiszka
      fi
2900 d5970055 Michael S. Tsirkin
      if test $vhost_net = "yes" ; then
2901 d5970055 Michael S. Tsirkin
        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
2902 d5970055 Michael S. Tsirkin
      fi
2903 c59249f9 Juan Quintela
    fi
2904 c59249f9 Juan Quintela
esac
2905 de83cd02 bellard
if test "$target_bigendian" = "yes" ; then
2906 25be210f Juan Quintela
  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
2907 de83cd02 bellard
fi
2908 97a847bc bellard
if test "$target_softmmu" = "yes" ; then
2909 b1aa27c4 Paul Brook
  echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
2910 25be210f Juan Quintela
  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
2911 25be210f Juan Quintela
  echo "LIBS+=$libs_softmmu" >> $config_target_mak
2912 0e8c9214 Andreas Färber
  echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
2913 5791f45b Kirill A. Shutemov
  echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
2914 43ce4dfe bellard
fi
2915 997344f3 bellard
if test "$target_user_only" = "yes" ; then
2916 25be210f Juan Quintela
  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
2917 997344f3 bellard
fi
2918 831b7825 ths
if test "$target_linux_user" = "yes" ; then
2919 25be210f Juan Quintela
  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
2920 831b7825 ths
fi
2921 831b7825 ths
if test "$target_darwin_user" = "yes" ; then
2922 25be210f Juan Quintela
  echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
2923 831b7825 ths
fi
2924 56aebc89 pbrook
list=""
2925 56aebc89 pbrook
if test ! -z "$gdb_xml_files" ; then
2926 56aebc89 pbrook
  for x in $gdb_xml_files; do
2927 56aebc89 pbrook
    list="$list $source_path/gdb-xml/$x"
2928 56aebc89 pbrook
  done
2929 3d0f1517 Juan Quintela
  echo "TARGET_XML_FILES=$list" >> $config_target_mak
2930 56aebc89 pbrook
fi
2931 97a847bc bellard
2932 f57975fb Juan Quintela
case "$target_arch2" in
2933 990b3e19 Richard Henderson
  alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
2934 25be210f Juan Quintela
    echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
2935 f57975fb Juan Quintela
    ;;
2936 d6b38939 Juan Quintela
  *)
2937 25be210f Juan Quintela
    echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
2938 d6b38939 Juan Quintela
    ;;
2939 f57975fb Juan Quintela
esac
2940 f57975fb Juan Quintela
2941 e5fe0c52 pbrook
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2942 25be210f Juan Quintela
  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
2943 e5fe0c52 pbrook
fi
2944 bd0c5661 pbrook
if test "$target_user_only" = "yes" \
2945 bd0c5661 pbrook
        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2946 25be210f Juan Quintela
  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
2947 bd0c5661 pbrook
fi
2948 379f6698 Paul Brook
if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
2949 25be210f Juan Quintela
  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
2950 379f6698 Paul Brook
fi
2951 84778508 blueswir1
if test "$target_bsd_user" = "yes" ; then
2952 25be210f Juan Quintela
  echo "CONFIG_BSD_USER=y" >> $config_target_mak
2953 84778508 blueswir1
fi
2954 5b0753e0 bellard
2955 4afddb55 Juan Quintela
# generate QEMU_CFLAGS/LDFLAGS for targets
2956 fa282484 Juan Quintela
2957 4afddb55 Juan Quintela
cflags=""
2958 fa282484 Juan Quintela
ldflags=""
2959 9b8e111f Juan Quintela
2960 57ddfbf7 Juan Quintela
if test "$ARCH" = "sparc64" ; then
2961 57ddfbf7 Juan Quintela
  cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
2962 24e804ec Alexander Graf
elif test "$ARCH" = "s390x" ; then
2963 24e804ec Alexander Graf
  cflags="-I\$(SRC_PATH)/tcg/s390 $cflags"
2964 5d8a4f8f Richard Henderson
elif test "$ARCH" = "x86_64" ; then
2965 5d8a4f8f Richard Henderson
  cflags="-I\$(SRC_PATH)/tcg/i386 $cflags"
2966 57ddfbf7 Juan Quintela
else
2967 57ddfbf7 Juan Quintela
  cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
2968 57ddfbf7 Juan Quintela
fi
2969 57ddfbf7 Juan Quintela
cflags="-I\$(SRC_PATH)/tcg $cflags"
2970 57ddfbf7 Juan Quintela
cflags="-I\$(SRC_PATH)/fpu $cflags"
2971 57ddfbf7 Juan Quintela
2972 4d904533 Blue Swirl
if test "$target_user_only" = "yes" ; then
2973 4d904533 Blue Swirl
    libdis_config_mak=libdis-user/config.mak
2974 4d904533 Blue Swirl
else
2975 4d904533 Blue Swirl
    libdis_config_mak=libdis/config.mak
2976 4d904533 Blue Swirl
fi
2977 4d904533 Blue Swirl
2978 64656024 Juan Quintela
for i in $ARCH $TARGET_BASE_ARCH ; do
2979 64656024 Juan Quintela
  case "$i" in
2980 64656024 Juan Quintela
  alpha)
2981 25be210f Juan Quintela
    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
2982 4d904533 Blue Swirl
    echo "CONFIG_ALPHA_DIS=y"  >> $libdis_config_mak
2983 64656024 Juan Quintela
  ;;
2984 64656024 Juan Quintela
  arm)
2985 25be210f Juan Quintela
    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
2986 4d904533 Blue Swirl
    echo "CONFIG_ARM_DIS=y"  >> $libdis_config_mak
2987 64656024 Juan Quintela
  ;;
2988 64656024 Juan Quintela
  cris)
2989 25be210f Juan Quintela
    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
2990 4d904533 Blue Swirl
    echo "CONFIG_CRIS_DIS=y"  >> $libdis_config_mak
2991 64656024 Juan Quintela
  ;;
2992 64656024 Juan Quintela
  hppa)
2993 25be210f Juan Quintela
    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
2994 4d904533 Blue Swirl
    echo "CONFIG_HPPA_DIS=y"  >> $libdis_config_mak
2995 64656024 Juan Quintela
  ;;
2996 64656024 Juan Quintela
  i386|x86_64)
2997 25be210f Juan Quintela
    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
2998 4d904533 Blue Swirl
    echo "CONFIG_I386_DIS=y"  >> $libdis_config_mak
2999 64656024 Juan Quintela
  ;;
3000 903ec55c Aurelien Jarno
  ia64*)
3001 903ec55c Aurelien Jarno
    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
3002 903ec55c Aurelien Jarno
    echo "CONFIG_IA64_DIS=y"  >> $libdis_config_mak
3003 903ec55c Aurelien Jarno
  ;;
3004 64656024 Juan Quintela
  m68k)
3005 25be210f Juan Quintela
    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
3006 4d904533 Blue Swirl
    echo "CONFIG_M68K_DIS=y"  >> $libdis_config_mak
3007 64656024 Juan Quintela
  ;;
3008 64656024 Juan Quintela
  microblaze)
3009 25be210f Juan Quintela
    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
3010 4d904533 Blue Swirl
    echo "CONFIG_MICROBLAZE_DIS=y"  >> $libdis_config_mak
3011 64656024 Juan Quintela
  ;;
3012 64656024 Juan Quintela
  mips*)
3013 25be210f Juan Quintela
    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
3014 4d904533 Blue Swirl
    echo "CONFIG_MIPS_DIS=y"  >> $libdis_config_mak
3015 64656024 Juan Quintela
  ;;
3016 64656024 Juan Quintela
  ppc*)
3017 25be210f Juan Quintela
    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
3018 4d904533 Blue Swirl
    echo "CONFIG_PPC_DIS=y"  >> $libdis_config_mak
3019 64656024 Juan Quintela
  ;;
3020 24e804ec Alexander Graf
  s390*)
3021 25be210f Juan Quintela
    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
3022 4d904533 Blue Swirl
    echo "CONFIG_S390_DIS=y"  >> $libdis_config_mak
3023 64656024 Juan Quintela
  ;;
3024 64656024 Juan Quintela
  sh4)
3025 25be210f Juan Quintela
    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
3026 4d904533 Blue Swirl
    echo "CONFIG_SH4_DIS=y"  >> $libdis_config_mak
3027 64656024 Juan Quintela
  ;;
3028 64656024 Juan Quintela
  sparc*)
3029 25be210f Juan Quintela
    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
3030 4d904533 Blue Swirl
    echo "CONFIG_SPARC_DIS=y"  >> $libdis_config_mak
3031 64656024 Juan Quintela
  ;;
3032 64656024 Juan Quintela
  esac
3033 64656024 Juan Quintela
done
3034 64656024 Juan Quintela
3035 6ee7126f Juan Quintela
case "$ARCH" in
3036 6ee7126f Juan Quintela
alpha)
3037 6ee7126f Juan Quintela
  # Ensure there's only a single GP
3038 6ee7126f Juan Quintela
  cflags="-msmall-data $cflags"
3039 6ee7126f Juan Quintela
;;
3040 6ee7126f Juan Quintela
esac
3041 6ee7126f Juan Quintela
3042 55d9c04b Juan Quintela
if test "$target_softmmu" = "yes" ; then
3043 55d9c04b Juan Quintela
  case "$TARGET_BASE_ARCH" in
3044 55d9c04b Juan Quintela
  arm)
3045 55d9c04b Juan Quintela
    cflags="-DHAS_AUDIO $cflags"
3046 55d9c04b Juan Quintela
  ;;
3047 55d9c04b Juan Quintela
  i386|mips|ppc)
3048 55d9c04b Juan Quintela
    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
3049 55d9c04b Juan Quintela
  ;;
3050 55d9c04b Juan Quintela
  esac
3051 55d9c04b Juan Quintela
fi
3052 55d9c04b Juan Quintela
3053 34005a00 Kirill A. Shutemov
if test "$target_user_only" = "yes" -a "$static" = "no" -a \
3054 50108930 Blue Swirl
	"$user_pie" = "yes" ; then
3055 34005a00 Kirill A. Shutemov
  cflags="-fpie $cflags"
3056 34005a00 Kirill A. Shutemov
  ldflags="-pie $ldflags"
3057 34005a00 Kirill A. Shutemov
fi
3058 34005a00 Kirill A. Shutemov
3059 471857dd Juan Quintela
if test "$target_softmmu" = "yes" -a \( \
3060 471857dd Juan Quintela
        "$TARGET_ARCH" = "microblaze" -o \
3061 471857dd Juan Quintela
        "$TARGET_ARCH" = "cris" \) ; then
3062 25be210f Juan Quintela
  echo "CONFIG_NEED_MMU=y" >> $config_target_mak
3063 471857dd Juan Quintela
fi
3064 471857dd Juan Quintela
3065 d02c1db3 Juan Quintela
if test "$gprof" = "yes" ; then
3066 25be210f Juan Quintela
  echo "TARGET_GPROF=yes" >> $config_target_mak
3067 d02c1db3 Juan Quintela
  if test "$target_linux_user" = "yes" ; then
3068 d02c1db3 Juan Quintela
    cflags="-p $cflags"
3069 d02c1db3 Juan Quintela
    ldflags="-p $ldflags"
3070 d02c1db3 Juan Quintela
  fi
3071 d02c1db3 Juan Quintela
  if test "$target_softmmu" = "yes" ; then
3072 d02c1db3 Juan Quintela
    ldflags="-p $ldflags"
3073 25be210f Juan Quintela
    echo "GPROF_CFLAGS=-p" >> $config_target_mak
3074 d02c1db3 Juan Quintela
  fi
3075 d02c1db3 Juan Quintela
fi
3076 d02c1db3 Juan Quintela
3077 6ee7126f Juan Quintela
linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
3078 9b8e111f Juan Quintela
if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
3079 fa282484 Juan Quintela
  case "$ARCH" in
3080 fa282484 Juan Quintela
  sparc)
3081 fa282484 Juan Quintela
    # -static is used to avoid g1/g3 usage by the dynamic linker
3082 322e5878 Juan Quintela
    ldflags="$linker_script -static $ldflags"
3083 fa282484 Juan Quintela
    ;;
3084 4d58be06 Richard Henderson
  alpha | s390x)
3085 4d58be06 Richard Henderson
    # The default placement of the application is fine.
3086 4d58be06 Richard Henderson
    ;;
3087 fd76e73a Richard Henderson
  *)
3088 322e5878 Juan Quintela
    ldflags="$linker_script $ldflags"
3089 fa282484 Juan Quintela
    ;;
3090 fa282484 Juan Quintela
  esac
3091 fa282484 Juan Quintela
fi
3092 fa282484 Juan Quintela
3093 25be210f Juan Quintela
echo "LDFLAGS+=$ldflags" >> $config_target_mak
3094 25be210f Juan Quintela
echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
3095 fa282484 Juan Quintela
3096 97a847bc bellard
done # for target in $targets
3097 7d13299d bellard
3098 7d13299d bellard
# build tree in object directory if source path is different from current one
3099 7d13299d bellard
if test "$source_path_used" = "yes" ; then
3100 e1144d00 Mark McLoughlin
    DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
3101 2d9f27d2 Anthony Liguori
    DIRS="$DIRS roms/seabios roms/vgabios"
3102 3e230dd2 Corentin Chary
    DIRS="$DIRS fsdev ui"
3103 7d13299d bellard
    FILES="Makefile tests/Makefile"
3104 e7daa605 ths
    FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
3105 e1ffb0f1 edgar_igl
    FILES="$FILES tests/test-mmap.c"
3106 ae0bfb79 Blue Swirl
    FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
3107 2d9f27d2 Anthony Liguori
    FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
3108 7ea78b74 Jan Kiszka
    for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
3109 7ea78b74 Jan Kiszka
        FILES="$FILES pc-bios/`basename $bios_file`"
3110 7ea78b74 Jan Kiszka
    done
3111 7d13299d bellard
    for dir in $DIRS ; do
3112 7d13299d bellard
            mkdir -p $dir
3113 7d13299d bellard
    done
3114 ec530c81 bellard
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
3115 7d13299d bellard
    for f in $FILES ; do
3116 ec530c81 bellard
        rm -f $f
3117 ec530c81 bellard
        ln -s $source_path/$f $f
3118 7d13299d bellard
    done
3119 7d13299d bellard
fi
3120 1ad2134f Paul Brook
3121 c34ebfdc Anthony Liguori
# temporary config to build submodules
3122 2d9f27d2 Anthony Liguori
for rom in seabios vgabios ; do
3123 c34ebfdc Anthony Liguori
    config_mak=roms/$rom/config.mak
3124 37116c89 Stefan Weil
    echo "# Automatically generated by configure - do not modify" > $config_mak
3125 c34ebfdc Anthony Liguori
    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3126 c34ebfdc Anthony Liguori
    echo "CC=$cc" >> $config_mak
3127 c34ebfdc Anthony Liguori
    echo "BCC=bcc" >> $config_mak
3128 c34ebfdc Anthony Liguori
    echo "CPP=${cross_prefix}cpp" >> $config_mak
3129 c34ebfdc Anthony Liguori
    echo "OBJCOPY=objcopy" >> $config_mak
3130 c34ebfdc Anthony Liguori
    echo "IASL=iasl" >> $config_mak
3131 c34ebfdc Anthony Liguori
    echo "HOST_CC=$host_cc" >> $config_mak
3132 c34ebfdc Anthony Liguori
    echo "LD=$ld" >> $config_mak
3133 c34ebfdc Anthony Liguori
done
3134 c34ebfdc Anthony Liguori
3135 1ad2134f Paul Brook
for hwlib in 32 64; do
3136 1ad2134f Paul Brook
  d=libhw$hwlib
3137 1ad2134f Paul Brook
  mkdir -p $d
3138 9953b2fc Blue Swirl
  mkdir -p $d/ide
3139 1ad2134f Paul Brook
  rm -f $d/Makefile
3140 1ad2134f Paul Brook
  ln -s $source_path/Makefile.hw $d/Makefile
3141 37116c89 Stefan Weil
  echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
3142 1ad2134f Paul Brook
done
3143 add16157 Blue Swirl
3144 add16157 Blue Swirl
d=libuser
3145 add16157 Blue Swirl
mkdir -p $d
3146 add16157 Blue Swirl
rm -f $d/Makefile
3147 add16157 Blue Swirl
ln -s $source_path/Makefile.user $d/Makefile
3148 299060a0 Kirill A. Shutemov
if test "$static" = "no" -a "$user_pie" = "yes" ; then
3149 299060a0 Kirill A. Shutemov
  echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3150 299060a0 Kirill A. Shutemov
fi
3151 b40292e7 Jan Kiszka
3152 b40292e7 Jan Kiszka
if test "$docs" = "yes" ; then
3153 b40292e7 Jan Kiszka
  mkdir -p QMP
3154 b40292e7 Jan Kiszka
fi