Statistics
| Branch: | Revision:

root / configure @ ff952ba2

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