Statistics
| Branch: | Revision:

root / configure @ eabba580

History | View | Annotate | Download (82.1 kB)

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