Statistics
| Branch: | Revision:

root / configure @ 01668d98

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