Statistics
| Branch: | Revision:

root / configure @ df2dbb4a

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