Statistics
| Branch: | Revision:

root / configure @ 212b6008

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