Statistics
| Branch: | Revision:

root / configure @ d61a4ce8

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