Statistics
| Branch: | Revision:

root / configure @ 179cf400

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