~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to configure

  • Committer: Bazaar Package Importer
  • Author(s): Aurelien Jarno, Aurelien Jarno
  • Date: 2009-03-07 06:20:34 UTC
  • mfrom: (1.1.9 upstream)
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20090307062034-i3pead4mw653v2el
Tags: 0.10.0-1
[ Aurelien Jarno ]
* New upstream release:
  - Fix fr-be keyboard mapping (closes: bug#514462).
  - Fix stat64 structure on ppc-linux-user (closes: bug#470231).
  - Add a chroot option (closes: bug#415996).
  - Add evdev support (closes: bug#513210).
  - Fix loop on symlinks in user mode (closes: bug#297572).
  - Bump depends on openbios-sparc.
  - Depends on openbios-ppc.
  - Update 12_signal_powerpc_support.patch.
  - Update 21_net_soopts.patch.
  - Drop 44_socklen_t_check.patch (merged upstream).
  - Drop 49_null_check.patch (merged upstream).
  - Update 64_ppc_asm_constraints.patch.
  - Drop security/CVE-2008-0928-fedora.patch (merged upstream).
  - Drop security/CVE-2007-5730.patch (merged upstream).
* patches/80_stable-branch.patch: add patches from stable branch:
  - Fix race condition between signal handler/execution loop (closes:
    bug#474386, bug#501731).
* debian/copyright: update.
* Compile and install .dtb files:
  - debian/control: build-depends on device-tree-compiler.
  - debian/patches/81_compile_dtb.patch: new patch from upstream.
  - debian/rules: compile and install bamboo.dtb and mpc8544.dtb.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16
16
TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17
17
TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
 
18
TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
 
19
TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
 
20
 
 
21
trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
18
22
 
19
23
# default parameters
20
24
prefix=""
22
26
static="no"
23
27
cross_prefix=""
24
28
cc="gcc"
25
 
gcc3_search="yes"
26
 
gcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
 
29
audio_drv_list=""
 
30
audio_card_list="ac97 es1370 sb16"
 
31
audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
27
32
host_cc="gcc"
28
33
ar="ar"
29
34
make="make"
30
35
install="install"
31
36
strip="strip"
32
 
cpu=`uname -m`
 
37
 
 
38
# parse CC options first
 
39
for opt do
 
40
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
 
41
  case "$opt" in
 
42
  --cross-prefix=*) cross_prefix="$optarg"
 
43
  ;;
 
44
  --cc=*) cc="$optarg"
 
45
  ;;
 
46
  esac
 
47
done
 
48
 
 
49
# OS specific
 
50
# Using uname is really, really broken.  Once we have the right set of checks
 
51
# we can eliminate it's usage altogether
 
52
 
 
53
cc="${cross_prefix}${cc}"
 
54
ar="${cross_prefix}${ar}"
 
55
strip="${cross_prefix}${strip}"
 
56
 
 
57
# check that the C compiler works.
 
58
cat > $TMPC <<EOF
 
59
int main(void) {}
 
60
EOF
 
61
 
 
62
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
 
63
  : C compiler works ok
 
64
else
 
65
    echo "ERROR: \"$cc\" either does not exist or does not work"
 
66
    exit 1
 
67
fi
 
68
 
 
69
check_define() {
 
70
cat > $TMPC <<EOF
 
71
#if !defined($1)
 
72
#error Not defined
 
73
#endif
 
74
int main(void) { return 0; }
 
75
EOF
 
76
  $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
 
77
}
 
78
 
 
79
if check_define __i386__ ; then
 
80
  cpu="i386"
 
81
elif check_define __x86_64__ ; then
 
82
  cpu="x86_64"
 
83
elif check_define __sparc__ ; then
 
84
  # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
 
85
  # They must be specified using --sparc_cpu
 
86
  if check_define __arch64__ ; then
 
87
    cpu="sparc64"
 
88
  else
 
89
    cpu="sparc"
 
90
  fi
 
91
elif check_define _ARCH_PPC ; then
 
92
  if check_define _ARCH_PPC64 ; then
 
93
    cpu="ppc64"
 
94
  else
 
95
    cpu="ppc"
 
96
  fi
 
97
else
 
98
  cpu=`uname -m`
 
99
fi
 
100
 
33
101
target_list=""
34
102
case "$cpu" in
35
103
  i386|i486|i586|i686|i86pc|BePC)
36
104
    cpu="i386"
37
105
  ;;
 
106
  x86_64|amd64)
 
107
    cpu="x86_64"
 
108
  ;;
 
109
  alpha)
 
110
    cpu="alpha"
 
111
  ;;
38
112
  armv*b)
39
113
    cpu="armv4b"
40
114
  ;;
41
115
  armv*l)
42
116
    cpu="armv4l"
43
117
  ;;
44
 
  alpha)
45
 
    cpu="alpha"
46
 
  ;;
47
 
  "Power Macintosh"|ppc|ppc64)
48
 
    cpu="powerpc"
 
118
  cris)
 
119
    cpu="cris"
 
120
  ;;
 
121
  parisc|parisc64)
 
122
    cpu="hppa"
 
123
  ;;
 
124
  ia64)
 
125
    cpu="ia64"
 
126
  ;;
 
127
  m68k)
 
128
    cpu="m68k"
49
129
  ;;
50
130
  mips)
51
131
    cpu="mips"
53
133
  mips64)
54
134
    cpu="mips64"
55
135
  ;;
56
 
  cris)
57
 
    cpu="cris"
 
136
  ppc)
 
137
    cpu="ppc"
 
138
  ;;
 
139
  ppc64)
 
140
    cpu="ppc64"
58
141
  ;;
59
142
  s390*)
60
143
    cpu="s390"
65
148
  sparc64)
66
149
    cpu="sparc64"
67
150
  ;;
68
 
  ia64)
69
 
    cpu="ia64"
70
 
  ;;
71
 
  m68k)
72
 
    cpu="m68k"
73
 
  ;;
74
 
  x86_64|amd64)
75
 
    cpu="x86_64"
76
 
  ;;
77
151
  *)
78
152
    cpu="unknown"
79
153
  ;;
80
154
esac
81
155
gprof="no"
 
156
sparse="no"
82
157
bigendian="no"
83
158
mingw32="no"
84
159
EXESUF=""
85
160
gdbstub="yes"
86
161
slirp="yes"
87
 
adlib="no"
88
 
oss="no"
89
 
dsound="no"
90
 
coreaudio="no"
91
 
alsa="no"
92
 
fmod="no"
 
162
vde="yes"
93
163
fmod_lib=""
94
164
fmod_inc=""
 
165
oss_lib=""
95
166
vnc_tls="yes"
96
167
bsd="no"
97
168
linux="no"
 
169
solaris="no"
98
170
kqemu="no"
99
171
profiler="no"
100
172
cocoa="no"
101
173
check_gfx="yes"
102
 
check_gcc="yes"
103
174
softmmu="yes"
104
175
linux_user="no"
105
176
darwin_user="no"
 
177
bsd_user="no"
106
178
build_docs="no"
107
179
uname_release=""
 
180
curses="yes"
 
181
aio="yes"
 
182
nptl="yes"
 
183
mixemu="no"
 
184
bluez="yes"
 
185
kvm="yes"
 
186
kerneldir=""
 
187
aix="no"
 
188
blobs="yes"
 
189
fdt="yes"
 
190
sdl_x11="no"
108
191
 
109
192
# OS specific
110
 
targetos=`uname -s`
 
193
if check_define __linux__ ; then
 
194
  targetos="Linux"
 
195
elif check_define _WIN32 ; then
 
196
  targetos='MINGW32'
 
197
else
 
198
  targetos=`uname -s`
 
199
fi
111
200
case $targetos in
112
201
CYGWIN*)
113
202
mingw32="yes"
114
203
OS_CFLAGS="-mno-cygwin"
115
 
VL_OS_LDFLAGS="-mno-cygwin"
116
204
if [ "$cpu" = "i386" ] ; then
117
205
    kqemu="yes"
118
206
fi
 
207
audio_possible_drivers="sdl"
119
208
;;
120
209
MINGW32*)
121
210
mingw32="yes"
122
211
if [ "$cpu" = "i386" ] ; then
123
212
    kqemu="yes"
124
213
fi
 
214
audio_possible_drivers="dsound sdl fmod"
125
215
;;
126
216
GNU/kFreeBSD)
127
 
oss="yes"
 
217
audio_drv_list="oss"
 
218
audio_possible_drivers="oss sdl esd pa"
128
219
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
129
220
    kqemu="yes"
130
221
fi
131
222
;;
132
223
FreeBSD)
133
224
bsd="yes"
134
 
oss="yes"
 
225
audio_drv_list="oss"
 
226
audio_possible_drivers="oss sdl esd pa"
135
227
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
136
228
    kqemu="yes"
137
229
fi
138
230
;;
139
231
NetBSD)
140
232
bsd="yes"
141
 
oss="yes"
 
233
audio_drv_list="oss"
 
234
audio_possible_drivers="oss sdl esd"
 
235
oss_lib="-lossaudio"
142
236
;;
143
237
OpenBSD)
144
238
bsd="yes"
145
 
oss="yes"
 
239
openbsd="yes"
 
240
audio_drv_list="oss"
 
241
audio_possible_drivers="oss sdl esd"
 
242
oss_lib="-lossaudio"
146
243
;;
147
244
Darwin)
148
245
bsd="yes"
149
246
darwin="yes"
 
247
# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code
 
248
if [ "$cpu" = "i386" ] ; then
 
249
    is_x86_64=`sysctl -n hw.optional.x86_64`
 
250
    [ "$is_x86_64" = "1" ] && cpu=x86_64
 
251
fi
 
252
if [ "$cpu" = "x86_64" ] ; then
 
253
    OS_CFLAGS="-arch x86_64"
 
254
    LDFLAGS="-arch x86_64"
 
255
else
 
256
    OS_CFLAGS="-mdynamic-no-pic"
 
257
fi
150
258
darwin_user="yes"
151
259
cocoa="yes"
152
 
coreaudio="yes"
153
 
OS_CFLAGS="-mdynamic-no-pic"
 
260
audio_drv_list="coreaudio"
 
261
audio_possible_drivers="coreaudio sdl fmod"
 
262
OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
154
263
;;
155
264
SunOS)
156
265
    solaris="yes"
181
290
        fi
182
291
    fi
183
292
    if test -f /usr/include/sys/soundcard.h ; then
184
 
        oss=yes
 
293
        audio_drv_list="oss"
185
294
    fi
 
295
    audio_possible_drivers="oss sdl"
 
296
;;
 
297
AIX)
 
298
aix="yes"
 
299
make="gmake"
186
300
;;
187
301
*)
188
 
oss="yes"
 
302
audio_drv_list="oss"
 
303
audio_possible_drivers="oss alsa sdl esd pa"
189
304
linux="yes"
190
305
linux_user="yes"
 
306
usb="linux"
191
307
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
192
308
    kqemu="yes"
 
309
    audio_possible_drivers="$audio_possible_drivers fmod"
193
310
fi
194
311
;;
195
312
esac
197
314
if [ "$bsd" = "yes" ] ; then
198
315
  if [ "$darwin" != "yes" ] ; then
199
316
    make="gmake"
 
317
    usb="bsd"
200
318
  fi
 
319
  bsd_user="yes"
201
320
fi
202
321
 
203
322
# find source path
204
323
source_path=`dirname "$0"`
 
324
source_path_used="no"
 
325
workdir=`pwd`
205
326
if [ -z "$source_path" ]; then
206
 
    source_path=`pwd`
 
327
    source_path=$workdir
207
328
else
208
329
    source_path=`cd "$source_path"; pwd`
209
330
fi
210
 
if test "$source_path" = `pwd` ; then
211
 
    source_path_used="no"
212
 
else
213
 
    source_path_used="yes"
214
 
fi
 
331
[ -f "$workdir/vl.c" ] || source_path_used="yes"
215
332
 
216
333
werror="no"
217
334
# generate compile errors on warnings for development builds
231
348
  --source-path=*) source_path="$optarg"
232
349
  source_path_used="yes"
233
350
  ;;
234
 
  --cross-prefix=*) cross_prefix="$optarg"
 
351
  --cross-prefix=*)
235
352
  ;;
236
 
  --cc=*) cc="$optarg"
237
 
  gcc3_search="no"
 
353
  --cc=*)
238
354
  ;;
239
355
  --host-cc=*) host_cc="$optarg"
240
356
  ;;
256
372
  ;;
257
373
  --disable-sdl) sdl="no"
258
374
  ;;
259
 
  --enable-coreaudio) coreaudio="yes"
260
 
  ;;
261
 
  --enable-alsa) alsa="yes"
262
 
  ;;
263
 
  --enable-dsound) dsound="yes"
264
 
  ;;
265
 
  --enable-fmod) fmod="yes"
266
 
  ;;
267
375
  --fmod-lib=*) fmod_lib="$optarg"
268
376
  ;;
269
377
  --fmod-inc=*) fmod_inc="$optarg"
270
378
  ;;
 
379
  --oss-lib=*) oss_lib="$optarg"
 
380
  ;;
 
381
  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
 
382
  ;;
 
383
  --audio-drv-list=*) audio_drv_list="$optarg"
 
384
  ;;
 
385
  --enable-sparse) sparse="yes"
 
386
  ;;
 
387
  --disable-sparse) sparse="no"
 
388
  ;;
271
389
  --disable-vnc-tls) vnc_tls="no"
272
390
  ;;
273
 
  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
274
 
  ;;
275
391
  --disable-slirp) slirp="no"
276
392
  ;;
277
 
  --enable-adlib) adlib="yes"
 
393
  --disable-vde) vde="no"
278
394
  ;;
279
395
  --disable-kqemu) kqemu="no"
280
396
  ;;
 
397
  --disable-brlapi) brlapi="no"
 
398
  ;;
 
399
  --disable-bluez) bluez="no"
 
400
  ;;
 
401
  --disable-kvm) kvm="no"
 
402
  ;;
281
403
  --enable-profiler) profiler="yes"
282
404
  ;;
283
 
  --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
 
405
  --enable-cocoa)
 
406
      cocoa="yes" ;
 
407
      sdl="no" ;
 
408
      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
284
409
  ;;
285
410
  --disable-gfx-check) check_gfx="no"
286
411
  ;;
287
 
  --disable-gcc-check) check_gcc="no"
288
 
  ;;
289
412
  --disable-system) softmmu="no"
290
413
  ;;
291
414
  --enable-system) softmmu="yes"
298
421
  ;;
299
422
  --enable-darwin-user) darwin_user="yes"
300
423
  ;;
 
424
  --disable-bsd-user) bsd_user="no"
 
425
  ;;
 
426
  --enable-bsd-user) bsd_user="yes"
 
427
  ;;
301
428
  --enable-uname-release=*) uname_release="$optarg"
302
429
  ;;
303
430
  --sparc_cpu=*)
316
443
  ;;
317
444
  --disable-werror) werror="no"
318
445
  ;;
 
446
  --disable-curses) curses="no"
 
447
  ;;
 
448
  --disable-nptl) nptl="no"
 
449
  ;;
 
450
  --enable-mixemu) mixemu="yes"
 
451
  ;;
 
452
  --disable-aio) aio="no"
 
453
  ;;
 
454
  --disable-blobs) blobs="no"
 
455
  ;;
 
456
  --kerneldir=*) kerneldir="$optarg"
 
457
  ;;
319
458
  *) echo "ERROR: unknown option $opt"; show_help="yes"
320
459
  ;;
321
460
  esac
322
461
done
323
462
 
324
 
if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
325
 
    AIOLIBS=
326
 
else
327
 
    # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
328
 
    AIOLIBS="-lrt -lpthread"
329
 
fi
330
 
 
331
463
# default flags for all hosts
332
 
CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
 
464
CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
 
465
CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
333
466
LDFLAGS="$LDFLAGS -g"
334
467
if test "$werror" = "yes" ; then
335
468
CFLAGS="$CFLAGS -Werror"
336
469
fi
337
470
 
 
471
if test "$solaris" = "no" ; then
 
472
    if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
 
473
        LDFLAGS="$LDFLAGS -Wl,--warn-common"
 
474
    fi
 
475
fi
 
476
 
338
477
#
339
478
# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
340
479
# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
341
480
#
342
 
case $cpu in
 
481
case "$cpu" in
343
482
    sparc) if test -z "$sparc_cpu" ; then
344
483
               ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
345
484
               ARCH_LDFLAGS="-m32"
359
498
    s390)
360
499
           ARCH_CFLAGS="-march=z900"
361
500
           ;;
 
501
    i386)
 
502
           ARCH_CFLAGS="-m32"
 
503
           ARCH_LDFLAGS="-m32"
 
504
           ;;
 
505
    x86_64)
 
506
           ARCH_CFLAGS="-m64"
 
507
           ARCH_LDFLAGS="-m64"
 
508
           ;;
362
509
esac
363
510
 
364
 
if [ "$solaris" = "yes" -a  "$cpu" = "x86_64" ] ; then
365
 
    CFLAGS="${CFLAGS} -m64"
366
 
    OS_CFLAGS="${OS_CFLAGS} -m64"
367
 
    OS_LDFLAGS="${OS_LDFLAGS} -m64"
368
 
fi
369
 
 
370
 
if [ "$solaris" = "yes" -a  "$cpu" = "i386" ] ; then
371
 
    CFLAGS="${CFLAGS} -m32"
372
 
    OS_CFLAGS="${OS_CFLAGS} -m32"
373
 
fi
374
 
 
375
511
if test x"$show_help" = x"yes" ; then
376
512
cat << EOF
377
513
 
397
533
echo "  --make=MAKE              use specified make [$make]"
398
534
echo "  --install=INSTALL        use specified install [$install]"
399
535
echo "  --static                 enable static build [$static]"
 
536
echo "  --enable-sparse          enable sparse checker"
 
537
echo "  --disable-sparse         disable sparse checker (default)"
400
538
echo "  --disable-werror         disable compilation abort on warning"
401
539
echo "  --disable-sdl            disable SDL"
402
540
echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
403
 
echo "  --enable-mingw32         enable Win32 cross compilation with mingw32"
404
 
echo "  --enable-adlib           enable Adlib emulation"
405
 
echo "  --enable-coreaudio       enable Coreaudio audio driver"
406
 
echo "  --enable-alsa            enable ALSA audio driver"
407
 
echo "  --enable-fmod            enable FMOD audio driver"
408
 
echo "  --enable-dsound          enable DirectSound audio driver"
 
541
echo "  --audio-drv-list=LIST    set audio drivers list:"
 
542
echo "                           Available drivers: $audio_possible_drivers"
 
543
echo "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
 
544
echo "                           Available cards: $audio_possible_cards"
 
545
echo "  --enable-mixemu          enable mixer emulation"
 
546
echo "  --disable-brlapi         disable BrlAPI"
409
547
echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
 
548
echo "  --disable-curses         disable curses output"
 
549
echo "  --disable-bluez          disable bluez stack connectivity"
 
550
echo "  --disable-kvm            disable KVM acceleration support"
 
551
echo "  --disable-nptl           disable usermode NPTL support"
410
552
echo "  --enable-system          enable all system emulation targets"
411
553
echo "  --disable-system         disable all system emulation targets"
412
554
echo "  --enable-linux-user      enable all linux usermode emulation targets"
413
555
echo "  --disable-linux-user     disable all linux usermode emulation targets"
414
556
echo "  --enable-darwin-user     enable all darwin usermode emulation targets"
415
557
echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
 
558
echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
 
559
echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
416
560
echo "  --fmod-lib               path to FMOD library"
417
561
echo "  --fmod-inc               path to FMOD includes"
 
562
echo "  --oss-lib                path to OSS library"
418
563
echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
419
564
echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
 
565
echo "  --disable-vde            disable support for vde network"
 
566
echo "  --disable-aio            disable AIO support"
 
567
echo "  --disable-blobs          disable installing provided firmware blobs"
 
568
echo "  --kerneldir=PATH         look for kernel includes in PATH"
420
569
echo ""
421
570
echo "NOTE: The object files are built at the place where configure is launched"
422
571
exit 1
423
572
fi
424
573
 
425
 
cc="${cross_prefix}${cc}"
426
 
ar="${cross_prefix}${ar}"
427
 
strip="${cross_prefix}${strip}"
428
 
 
429
 
# check that the C compiler works.
430
 
cat > $TMPC <<EOF
431
 
int main(void) {}
432
 
EOF
433
 
 
434
 
if $cc -c -o $TMPO $TMPC 2> /dev/null ; then
435
 
  : C compiler works ok
436
 
else
437
 
    echo "ERROR: \"$cc\" either does not exist or does not work"
438
 
    exit 1
439
 
fi
440
 
 
441
574
if test "$mingw32" = "yes" ; then
442
575
    linux="no"
443
576
    EXESUF=".exe"
444
577
    oss="no"
 
578
    linux_user="no"
 
579
    bsd_user="no"
445
580
fi
446
581
 
447
 
# Check for gcc4, error if pre-gcc4
448
 
if test "$check_gcc" = "yes" ; then
449
 
    cat > $TMPC <<EOF
450
 
#if __GNUC__ < 4
451
 
#error gcc3
452
 
#endif
453
 
int main(){return 0;}
454
 
EOF
455
 
    if "$cc" -o $TMPE $TMPC 2> /dev/null ; then
456
 
        echo "WARNING: \"$cc\" looks like gcc 4.x"
457
 
        found_compat_cc="no"
458
 
        if test "$gcc3_search" = "yes" ; then
459
 
            echo "Looking for gcc 3.x"
460
 
            for compat_cc in $gcc3_list ; do
461
 
                if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
462
 
                    echo "Found \"$compat_cc\""
463
 
                    cc="$cross_prefix$compat_cc"
464
 
                    found_compat_cc="yes"
465
 
                    break
466
 
                fi
467
 
            done
468
 
            if test "$found_compat_cc" = "no" ; then
469
 
                echo "gcc 3.x not found!"
470
 
            fi
471
 
        fi
472
 
        if test "$found_compat_cc" = "no" ; then
473
 
            echo "QEMU is known to have problems when compiled with gcc 4.x"
474
 
            echo "It is recommended that you use gcc 3.x to build QEMU"
475
 
            echo "To use this compiler anyway, configure with --disable-gcc-check"
476
 
            exit 1;
477
 
        fi
478
 
    fi
 
582
if test ! -x "$(which cgcc 2>/dev/null)"; then
 
583
    sparse="no"
479
584
fi
480
585
 
481
586
#
482
587
# Solaris specific configure tool chain decisions
483
588
#
484
589
if test "$solaris" = "yes" ; then
485
 
  #
486
 
  # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
487
 
  # override the check with --disable-gcc-check
488
 
  #
489
 
  if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
490
 
    solgcc=`which $cc`
491
 
    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
492
 
      echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
493
 
      echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
494
 
      echo "or get the latest patch from SunSolve for gcc"
495
 
      exit 1
496
 
    fi
497
 
  fi
498
590
  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
499
591
  if test -z "$solinst" ; then
500
592
    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
522
614
if test -z "$target_list" ; then
523
615
# these targets are portable
524
616
    if [ "$softmmu" = "yes" ] ; then
525
 
        target_list="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu sh4eb-softmmu cris-softmmu"
 
617
        target_list="\
 
618
i386-softmmu \
 
619
x86_64-softmmu \
 
620
arm-softmmu \
 
621
cris-softmmu \
 
622
m68k-softmmu \
 
623
mips-softmmu \
 
624
mipsel-softmmu \
 
625
mips64-softmmu \
 
626
mips64el-softmmu \
 
627
ppc-softmmu \
 
628
ppcemb-softmmu \
 
629
ppc64-softmmu \
 
630
sh4-softmmu \
 
631
sh4eb-softmmu \
 
632
sparc-softmmu \
 
633
"
526
634
    fi
527
635
# the following are Linux specific
528
636
    if [ "$linux_user" = "yes" ] ; then
529
 
        target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user sparc64-linux-user sparc32plus-linux-user mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user sh4-linux-user sh4eb-linux-user ppc-linux-user ppc64-linux-user ppc64abi32-linux-user x86_64-linux-user cris-linux-user $target_list"
 
637
        target_list="${target_list}\
 
638
i386-linux-user \
 
639
x86_64-linux-user \
 
640
alpha-linux-user \
 
641
arm-linux-user \
 
642
armeb-linux-user \
 
643
cris-linux-user \
 
644
m68k-linux-user \
 
645
mips-linux-user \
 
646
mipsel-linux-user \
 
647
ppc-linux-user \
 
648
ppc64-linux-user \
 
649
ppc64abi32-linux-user \
 
650
sh4-linux-user \
 
651
sh4eb-linux-user \
 
652
sparc-linux-user \
 
653
sparc64-linux-user \
 
654
sparc32plus-linux-user \
 
655
"
530
656
    fi
531
657
# the following are Darwin specific
532
658
    if [ "$darwin_user" = "yes" ] ; then
533
 
        target_list="i386-darwin-user ppc-darwin-user $target_list"
 
659
        target_list="$target_list i386-darwin-user ppc-darwin-user "
 
660
    fi
 
661
# the following are BSD specific
 
662
    if [ "$bsd_user" = "yes" ] ; then
 
663
        target_list="${target_list}\
 
664
sparc64-bsd-user \
 
665
"
534
666
    fi
535
667
else
536
668
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
552
684
}
553
685
EOF
554
686
 
555
 
if $cc -o $TMPE $TMPC 2> /dev/null ; then
 
687
if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
556
688
$TMPE && bigendian="yes"
557
689
else
558
690
echo big/little test failed
561
693
else
562
694
 
563
695
# if cross compiling, cannot launch a program, so make a static guess
564
 
if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "mips64" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
 
696
if test "$cpu" = "armv4b" \
 
697
     -o "$cpu" = "hppa" \
 
698
     -o "$cpu" = "m68k" \
 
699
     -o "$cpu" = "mips" \
 
700
     -o "$cpu" = "mips64" \
 
701
     -o "$cpu" = "ppc" \
 
702
     -o "$cpu" = "ppc64" \
 
703
     -o "$cpu" = "s390" \
 
704
     -o "$cpu" = "sparc" \
 
705
     -o "$cpu" = "sparc64"; then
565
706
    bigendian="yes"
566
707
fi
567
708
 
569
710
 
570
711
# host long bits test
571
712
hostlongbits="32"
572
 
if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
 
713
if test "$cpu" = "x86_64" \
 
714
     -o "$cpu" = "alpha" \
 
715
     -o "$cpu" = "ia64" \
 
716
     -o "$cpu" = "sparc64" \
 
717
     -o "$cpu" = "ppc64"; then
573
718
    hostlongbits="64"
574
719
fi
575
720
 
579
724
}
580
725
EOF
581
726
 
 
727
# Check host NPTL support
 
728
cat > $TMPC <<EOF
 
729
#include <sched.h>
 
730
#include <linux/futex.h>
 
731
void foo()
 
732
{
 
733
#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
 
734
#error bork
 
735
#endif
 
736
}
 
737
EOF
 
738
 
 
739
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
 
740
  :
 
741
else
 
742
   nptl="no"
 
743
fi
 
744
 
 
745
##########################################
 
746
# zlib check
 
747
 
 
748
cat > $TMPC << EOF
 
749
#include <zlib.h>
 
750
int main(void) { zlibVersion(); return 0; }
 
751
EOF
 
752
if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
 
753
    :
 
754
else
 
755
    echo
 
756
    echo "Error: zlib check failed"
 
757
    echo "Make sure to have the zlib libs and headers installed."
 
758
    echo
 
759
    exit 1
 
760
fi
 
761
 
582
762
##########################################
583
763
# SDL probe
584
764
 
589
769
    sdl=no
590
770
    sdl_static=no
591
771
 
592
 
    if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
593
 
    # win32 cross compilation case
594
 
        sdl_config="i386-mingw32msvc-sdl-config"
595
 
        sdl=yes
596
 
    else
597
 
        # normal SDL probe
598
772
cat > $TMPC << EOF
599
773
#include <SDL.h>
600
774
#undef main /* We don't want SDL to override our main() */
601
775
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
602
776
EOF
603
 
        if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
604
 
            _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
605
 
            if test "$_sdlversion" -lt 121 ; then
606
 
                sdl_too_old=yes
607
 
            else
608
 
                if test "$cocoa" = "no" ; then
609
 
                    sdl=yes
610
 
                fi
611
 
            fi
612
 
 
613
 
            # static link with sdl ?
614
 
            if test "$sdl" = "yes" ; then
615
 
                aa="no"
616
 
                `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
617
 
                sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
618
 
                if [ "$aa" = "yes" ] ; then
619
 
                    sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
620
 
                fi
621
 
 
622
 
                if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
623
 
                    sdl_static=yes
624
 
                fi
625
 
            fi # static link
626
 
        fi # sdl compile test
627
 
    fi # cross compilation
 
777
    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
 
778
        _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
 
779
        if test "$_sdlversion" -lt 121 ; then
 
780
            sdl_too_old=yes
 
781
        else
 
782
            if test "$cocoa" = "no" ; then
 
783
                sdl=yes
 
784
            fi
 
785
        fi
 
786
 
 
787
        # static link with sdl ?
 
788
        if test "$sdl" = "yes" ; then
 
789
            aa="no"
 
790
            `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
 
791
            sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
 
792
            if [ "$aa" = "yes" ] ; then
 
793
                sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
 
794
            fi
 
795
 
 
796
            if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
 
797
                sdl_static=yes
 
798
            fi
 
799
        fi # static link
 
800
    fi # sdl compile test
628
801
else
629
802
    # Make sure to disable cocoa if sdl was set
630
803
    if test "$sdl" = "yes" ; then
631
804
       cocoa="no"
632
 
       coreaudio="no"
 
805
       audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
633
806
    fi
634
807
fi # -z $sdl
635
808
 
 
809
if test "$sdl" = "yes" ; then
 
810
cat > $TMPC <<EOF
 
811
#include <SDL.h>
 
812
#if defined(SDL_VIDEO_DRIVER_X11)
 
813
#include <X11/XKBlib.h>
 
814
#else
 
815
#error No x11 support
 
816
#endif
 
817
int main(void) { return 0; }
 
818
EOF
 
819
    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > /dev/null 2>&1 ; then
 
820
        sdl_x11="yes"
 
821
    fi
 
822
fi
 
823
 
636
824
##########################################
637
825
# VNC TLS detection
638
826
if test "$vnc_tls" = "yes" ; then
639
 
  `pkg-config gnutls` || vnc_tls="no"
640
 
fi
641
 
if test "$vnc_tls" = "yes" ; then
642
 
  vnc_tls_cflags=`pkg-config --cflags gnutls`
643
 
  vnc_tls_libs=`pkg-config --libs gnutls`
644
 
fi
645
 
 
646
 
##########################################
647
 
# alsa sound support libraries
648
 
 
649
 
if test "$alsa" = "yes" ; then
650
 
  cat > $TMPC << EOF
651
 
#include <alsa/asoundlib.h>
652
 
int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
653
 
EOF
654
 
  if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
655
 
    :
656
 
  else
657
 
    echo
658
 
    echo "Error: Could not find alsa"
659
 
    echo "Make sure to have the alsa libs and headers installed."
660
 
    echo
661
 
    exit 1
 
827
cat > $TMPC <<EOF
 
828
#include <gnutls/gnutls.h>
 
829
int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
 
830
EOF
 
831
    vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
 
832
    vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
 
833
    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
 
834
           $vnc_tls_libs > /dev/null 2> /dev/null ; then
 
835
        :
 
836
    else
 
837
        vnc_tls="no"
 
838
    fi
 
839
fi
 
840
 
 
841
##########################################
 
842
# vde libraries probe
 
843
if test "$vde" = "yes" ; then
 
844
  cat > $TMPC << EOF
 
845
#include <libvdeplug.h>
 
846
int main(void)
 
847
{
 
848
    struct vde_open_args a = {0, 0, 0};
 
849
    vde_open("", "", &a);
 
850
    return 0;
 
851
}
 
852
EOF
 
853
    if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
 
854
        :
 
855
    else
 
856
        vde="no"
 
857
    fi
 
858
fi
 
859
 
 
860
##########################################
 
861
# Sound support libraries probe
 
862
 
 
863
audio_drv_probe()
 
864
{
 
865
    drv=$1
 
866
    hdr=$2
 
867
    lib=$3
 
868
    exp=$4
 
869
    cfl=$5
 
870
        cat > $TMPC << EOF
 
871
#include <$hdr>
 
872
int main(void) { $exp }
 
873
EOF
 
874
    if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
 
875
        :
 
876
    else
 
877
        echo
 
878
        echo "Error: $drv check failed"
 
879
        echo "Make sure to have the $drv libs and headers installed."
 
880
        echo
 
881
        exit 1
 
882
    fi
 
883
}
 
884
 
 
885
audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
 
886
for drv in $audio_drv_list; do
 
887
    case $drv in
 
888
    alsa)
 
889
    audio_drv_probe $drv alsa/asoundlib.h -lasound \
 
890
        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
 
891
    ;;
 
892
 
 
893
    fmod)
 
894
    if test -z $fmod_lib || test -z $fmod_inc; then
 
895
        echo
 
896
        echo "Error: You must specify path to FMOD library and headers"
 
897
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
 
898
        echo
 
899
        exit 1
 
900
    fi
 
901
    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
 
902
    ;;
 
903
 
 
904
    esd)
 
905
    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
 
906
    ;;
 
907
 
 
908
    pa)
 
909
    audio_drv_probe $drv pulse/simple.h -lpulse-simple \
 
910
        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
 
911
    ;;
 
912
 
 
913
    oss|sdl|core|wav|dsound)
 
914
    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
 
915
    ;;
 
916
 
 
917
    *)
 
918
    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
 
919
        echo
 
920
        echo "Error: Unknown driver '$drv' selected"
 
921
        echo "Possible drivers are: $audio_possible_drivers"
 
922
        echo
 
923
        exit 1
 
924
    }
 
925
    ;;
 
926
    esac
 
927
done
 
928
 
 
929
##########################################
 
930
# BrlAPI probe
 
931
 
 
932
if test -z "$brlapi" ; then
 
933
    brlapi=no
 
934
cat > $TMPC << EOF
 
935
#include <brlapi.h>
 
936
int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
 
937
EOF
 
938
    if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
 
939
            brlapi=yes
 
940
    fi # brlapi compile test
 
941
fi # -z $brlapi
 
942
 
 
943
##########################################
 
944
# curses probe
 
945
 
 
946
if test "$curses" = "yes" ; then
 
947
  curses=no
 
948
  cat > $TMPC << EOF
 
949
#include <curses.h>
 
950
int main(void) { return curses_version(); }
 
951
EOF
 
952
  if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
 
953
    curses=yes
 
954
  fi
 
955
fi # test "$curses"
 
956
 
 
957
##########################################
 
958
# bluez support probe
 
959
if test "$bluez" = "yes" ; then
 
960
  `pkg-config bluez` || bluez="no"
 
961
fi
 
962
if test "$bluez" = "yes" ; then
 
963
  cat > $TMPC << EOF
 
964
#include <bluetooth/bluetooth.h>
 
965
int main(void) { return bt_error(0); }
 
966
EOF
 
967
  bluez_cflags=`pkg-config --cflags bluez`
 
968
  bluez_libs=`pkg-config --libs bluez`
 
969
  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
 
970
      $bluez_libs > /dev/null 2> /dev/null ; then
 
971
    :
 
972
  else
 
973
    bluez="no"
 
974
  fi
 
975
fi
 
976
 
 
977
##########################################
 
978
# kvm probe
 
979
if test "$kvm" = "yes" ; then
 
980
    cat > $TMPC <<EOF
 
981
#include <linux/kvm.h>
 
982
#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
 
983
#error Invalid KVM version
 
984
#endif
 
985
#if !defined(KVM_CAP_USER_MEMORY)
 
986
#error Missing KVM capability KVM_CAP_USER_MEMORY
 
987
#endif
 
988
#if !defined(KVM_CAP_SET_TSS_ADDR)
 
989
#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
 
990
#endif
 
991
#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
 
992
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
 
993
#endif
 
994
int main(void) { return 0; }
 
995
EOF
 
996
  if test "$kerneldir" != "" ; then
 
997
      kvm_cflags=-I"$kerneldir"/include
 
998
      if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
 
999
         -a -d "$kerneldir/arch/x86/include" ; then
 
1000
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
 
1001
        elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
 
1002
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
 
1003
        elif test -d "$kerneldir/arch/$cpu/include" ; then
 
1004
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
 
1005
      fi
 
1006
  else
 
1007
      kvm_cflags=""
 
1008
  fi
 
1009
  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
 
1010
      > /dev/null 2>/dev/null ; then
 
1011
    :
 
1012
  else
 
1013
    kvm="no";
 
1014
    if [ -x "`which awk 2>/dev/null`" ] && \
 
1015
       [ -x "`which grep 2>/dev/null`" ]; then
 
1016
      kvmerr=`$cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
 
1017
        | grep "error: " \
 
1018
        | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
 
1019
      if test "$kvmerr" != "" ; then
 
1020
        kvm="no - (${kvmerr})"
 
1021
      fi
 
1022
    fi
 
1023
  fi
 
1024
fi
 
1025
 
 
1026
##########################################
 
1027
# AIO probe
 
1028
AIOLIBS=""
 
1029
 
 
1030
if test "$aio" = "yes" ; then
 
1031
  aio=no
 
1032
  cat > $TMPC << EOF
 
1033
#include <pthread.h>
 
1034
int main(void) { pthread_mutex_t lock;  return 0; }
 
1035
EOF
 
1036
  if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
 
1037
    aio=yes
 
1038
    AIOLIBS="-lpthread"
 
1039
  fi
 
1040
fi
 
1041
 
 
1042
##########################################
 
1043
# iovec probe
 
1044
cat > $TMPC <<EOF
 
1045
#include <sys/types.h>
 
1046
#include <sys/uio.h>
 
1047
#include <unistd.h>
 
1048
int main(void) { struct iovec iov; return 0; }
 
1049
EOF
 
1050
iovec=no
 
1051
if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
 
1052
  iovec=yes
 
1053
fi
 
1054
 
 
1055
##########################################
 
1056
# fdt probe
 
1057
if test "$fdt" = "yes" ; then
 
1058
    fdt=no
 
1059
    cat > $TMPC << EOF
 
1060
int main(void) { return 0; }
 
1061
EOF
 
1062
  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
 
1063
    fdt=yes
662
1064
  fi
663
1065
fi
664
1066
 
668
1070
  build_docs="yes"
669
1071
fi
670
1072
 
 
1073
##########################################
 
1074
# Do we need librt
 
1075
cat > $TMPC <<EOF
 
1076
#include <signal.h>
 
1077
#include <time.h>
 
1078
int main(void) { clockid_t id; return clock_gettime(id, NULL); }
 
1079
EOF
 
1080
 
 
1081
rt=no
 
1082
if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
 
1083
  :
 
1084
elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
 
1085
  rt=yes
 
1086
fi
 
1087
 
 
1088
if test "$rt" = "yes" ; then
 
1089
  # Hack, we should have a general purpose LIBS for this sort of thing
 
1090
  AIOLIBS="$AIOLIBS -lrt"
 
1091
fi
 
1092
 
671
1093
if test "$mingw32" = "yes" ; then
672
1094
  if test -z "$prefix" ; then
673
 
      prefix="/c/Program Files/Qemu"
 
1095
      prefix="c:\\\\Program Files\\\\Qemu"
674
1096
  fi
675
1097
  mansuffix=""
676
1098
  datasuffix=""
696
1118
echo "Source path       $source_path"
697
1119
echo "C compiler        $cc"
698
1120
echo "Host C compiler   $host_cc"
 
1121
echo "ARCH_CFLAGS       $ARCH_CFLAGS"
699
1122
echo "make              $make"
700
1123
echo "install           $install"
701
1124
echo "host CPU          $cpu"
702
1125
echo "host big endian   $bigendian"
703
1126
echo "target list       $target_list"
704
1127
echo "gprof enabled     $gprof"
 
1128
echo "sparse enabled    $sparse"
705
1129
echo "profiler          $profiler"
706
1130
echo "static build      $static"
707
1131
echo "-Werror enabled   $werror"
712
1136
if test "$sdl" != "no" ; then
713
1137
    echo "SDL static link   $sdl_static"
714
1138
fi
 
1139
echo "curses support    $curses"
715
1140
echo "mingw32 support   $mingw32"
716
 
echo "Adlib support     $adlib"
717
 
echo "CoreAudio support $coreaudio"
718
 
echo "ALSA support      $alsa"
719
 
echo "DSound support    $dsound"
720
 
if test "$fmod" = "yes"; then
721
 
    if test -z $fmod_lib || test -z $fmod_inc; then
722
 
        echo
723
 
        echo "Error: You must specify path to FMOD library and headers"
724
 
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
725
 
        echo
726
 
        exit 1
727
 
    fi
728
 
    fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
729
 
else
730
 
    fmod_support=""
731
 
fi
732
 
echo "FMOD support      $fmod $fmod_support"
733
 
echo "OSS support       $oss"
 
1141
echo "Audio drivers     $audio_drv_list"
 
1142
echo "Extra audio cards $audio_card_list"
 
1143
echo "Mixer emulation   $mixemu"
734
1144
echo "VNC TLS support   $vnc_tls"
735
1145
if test "$vnc_tls" = "yes" ; then
736
1146
    echo "    TLS CFLAGS    $vnc_tls_cflags"
740
1150
    echo "Target Sparc Arch $sparc_cpu"
741
1151
fi
742
1152
echo "kqemu support     $kqemu"
 
1153
echo "brlapi support    $brlapi"
743
1154
echo "Documentation     $build_docs"
744
1155
[ ! -z "$uname_release" ] && \
745
1156
echo "uname -r          $uname_release"
 
1157
echo "NPTL support      $nptl"
 
1158
echo "vde support       $vde"
 
1159
echo "AIO support       $aio"
 
1160
echo "Install blobs     $blobs"
 
1161
echo "KVM support       $kvm"
 
1162
echo "fdt support       $fdt"
746
1163
 
747
1164
if test $sdl_too_old = "yes"; then
748
1165
echo "-> Your SDL version is too old - please upgrade to have SDL support"
749
1166
fi
750
 
if [ -s /tmp/qemu-$$-sdl-config.log ]; then
 
1167
if [ -s $TMPSDLLOG ]; then
751
1168
  echo "The error log from compiling the libSDL test is: "
752
 
  cat /tmp/qemu-$$-sdl-config.log
 
1169
  cat $TMPSDLLOG
753
1170
fi
754
 
rm -f /tmp/qemu-$$-sdl-config.log
755
1171
#if test "$sdl_static" = "no"; then
756
1172
#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
757
1173
#fi
763
1179
test -f $config_h && mv $config_h ${config_h}~
764
1180
 
765
1181
echo "# Automatically generated by configure - do not modify" > $config_mak
766
 
echo "# Configured with: $0 $@" >> $config_mak
 
1182
printf "# Configured with:" >> $config_mak
 
1183
printf " '%s'" "$0" "$@" >> $config_mak
 
1184
echo >> $config_mak
767
1185
echo "/* Automatically generated by configure - do not modify */" > $config_h
768
1186
 
769
1187
echo "prefix=$prefix" >> $config_mak
778
1196
echo "HOST_CC=$host_cc" >> $config_mak
779
1197
echo "AR=$ar" >> $config_mak
780
1198
echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
 
1199
# XXX: only use CFLAGS and LDFLAGS ?  
 
1200
# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
 
1201
# compilation of dyngen tool (useful for win32 build on Linux host)
781
1202
echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
782
1203
echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
783
 
echo "VL_OS_LDFLAGS=$VL_OS_LDFLAGS" >> $config_mak
784
1204
echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
785
1205
echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
786
1206
echo "CFLAGS=$CFLAGS" >> $config_mak
787
1207
echo "LDFLAGS=$LDFLAGS" >> $config_mak
788
1208
echo "EXESUF=$EXESUF" >> $config_mak
789
1209
echo "AIOLIBS=$AIOLIBS" >> $config_mak
790
 
if test "$cpu" = "i386" ; then
791
 
  echo "ARCH=i386" >> $config_mak
792
 
  echo "#define HOST_I386 1" >> $config_h
793
 
elif test "$cpu" = "x86_64" ; then
794
 
  echo "ARCH=x86_64" >> $config_mak
795
 
  echo "#define HOST_X86_64 1" >> $config_h
796
 
elif test "$cpu" = "armv4b" ; then
797
 
  echo "ARCH=arm" >> $config_mak
798
 
  echo "#define HOST_ARM 1" >> $config_h
799
 
elif test "$cpu" = "armv4l" ; then
800
 
  echo "ARCH=arm" >> $config_mak
801
 
  echo "#define HOST_ARM 1" >> $config_h
802
 
elif test "$cpu" = "powerpc" ; then
803
 
  echo "ARCH=ppc" >> $config_mak
804
 
  echo "#define HOST_PPC 1" >> $config_h
805
 
elif test "$cpu" = "mips" ; then
806
 
  echo "ARCH=mips" >> $config_mak
807
 
  echo "#define HOST_MIPS 1" >> $config_h
808
 
elif test "$cpu" = "mips64" ; then
809
 
  echo "ARCH=mips64" >> $config_mak
810
 
  echo "#define HOST_MIPS64 1" >> $config_h
811
 
elif test "$cpu" = "cris" ; then
812
 
  echo "ARCH=cris" >> $config_mak
813
 
  echo "#define HOST_CRIS 1" >> $config_h
814
 
elif test "$cpu" = "s390" ; then
815
 
  echo "ARCH=s390" >> $config_mak
816
 
  echo "#define HOST_S390 1" >> $config_h
817
 
elif test "$cpu" = "alpha" ; then
818
 
  echo "ARCH=alpha" >> $config_mak
819
 
  echo "#define HOST_ALPHA 1" >> $config_h
820
 
elif test "$cpu" = "sparc" ; then
821
 
  echo "ARCH=sparc" >> $config_mak
822
 
  echo "#define HOST_SPARC 1" >> $config_h
823
 
elif test "$cpu" = "sparc64" ; then
824
 
  echo "ARCH=sparc64" >> $config_mak
825
 
  echo "#define HOST_SPARC64 1" >> $config_h
826
 
elif test "$cpu" = "ia64" ; then
827
 
  echo "ARCH=ia64" >> $config_mak
828
 
  echo "#define HOST_IA64 1" >> $config_h
829
 
elif test "$cpu" = "m68k" ; then
830
 
  echo "ARCH=m68k" >> $config_mak
831
 
  echo "#define HOST_M68K 1" >> $config_h
832
 
else
833
 
  echo "Unsupported CPU = $cpu"
834
 
  exit 1
 
1210
case "$cpu" in
 
1211
  i386)
 
1212
    echo "ARCH=i386" >> $config_mak
 
1213
    echo "#define HOST_I386 1" >> $config_h
 
1214
  ;;
 
1215
  x86_64)
 
1216
    echo "ARCH=x86_64" >> $config_mak
 
1217
    echo "#define HOST_X86_64 1" >> $config_h
 
1218
  ;;
 
1219
  alpha)
 
1220
    echo "ARCH=alpha" >> $config_mak
 
1221
    echo "#define HOST_ALPHA 1" >> $config_h
 
1222
  ;;
 
1223
  armv4b)
 
1224
    echo "ARCH=arm" >> $config_mak
 
1225
    echo "#define HOST_ARM 1" >> $config_h
 
1226
  ;;
 
1227
  armv4l)
 
1228
    echo "ARCH=arm" >> $config_mak
 
1229
    echo "#define HOST_ARM 1" >> $config_h
 
1230
  ;;
 
1231
  cris)
 
1232
    echo "ARCH=cris" >> $config_mak
 
1233
    echo "#define HOST_CRIS 1" >> $config_h
 
1234
  ;;
 
1235
  hppa)
 
1236
    echo "ARCH=hppa" >> $config_mak
 
1237
    echo "#define HOST_HPPA 1" >> $config_h
 
1238
  ;;
 
1239
  ia64)
 
1240
    echo "ARCH=ia64" >> $config_mak
 
1241
    echo "#define HOST_IA64 1" >> $config_h
 
1242
  ;;
 
1243
  m68k)
 
1244
    echo "ARCH=m68k" >> $config_mak
 
1245
    echo "#define HOST_M68K 1" >> $config_h
 
1246
  ;;
 
1247
  mips)
 
1248
    echo "ARCH=mips" >> $config_mak
 
1249
    echo "#define HOST_MIPS 1" >> $config_h
 
1250
  ;;
 
1251
  mips64)
 
1252
    echo "ARCH=mips64" >> $config_mak
 
1253
    echo "#define HOST_MIPS64 1" >> $config_h
 
1254
  ;;
 
1255
  ppc)
 
1256
    echo "ARCH=ppc" >> $config_mak
 
1257
    echo "#define HOST_PPC 1" >> $config_h
 
1258
  ;;
 
1259
  ppc64)
 
1260
    echo "ARCH=ppc64" >> $config_mak
 
1261
    echo "#define HOST_PPC64 1" >> $config_h
 
1262
  ;;
 
1263
  s390)
 
1264
    echo "ARCH=s390" >> $config_mak
 
1265
    echo "#define HOST_S390 1" >> $config_h
 
1266
  ;;
 
1267
  sparc)
 
1268
    echo "ARCH=sparc" >> $config_mak
 
1269
    echo "#define HOST_SPARC 1" >> $config_h
 
1270
  ;;
 
1271
  sparc64)
 
1272
    echo "ARCH=sparc64" >> $config_mak
 
1273
    echo "#define HOST_SPARC64 1" >> $config_h
 
1274
  ;;
 
1275
  *)
 
1276
    echo "Unsupported CPU = $cpu"
 
1277
    exit 1
 
1278
  ;;
 
1279
esac
 
1280
if test "$sparse" = "yes" ; then
 
1281
  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_mak
 
1282
  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_mak
 
1283
  echo "CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
835
1284
fi
836
1285
if test "$bigendian" = "yes" ; then
837
1286
  echo "WORDS_BIGENDIAN=yes" >> $config_mak
846
1295
#include <byteswap.h>
847
1296
int main(void) { return bswap_32(0); }
848
1297
EOF
849
 
  if $cc -o $TMPE $TMPC 2> /dev/null ; then
 
1298
  if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
850
1299
    echo "#define HAVE_BYTESWAP_H 1" >> $config_h
851
1300
  fi
852
 
fi
 
1301
  cat > $TMPC << EOF
 
1302
#include <sys/endian.h>
 
1303
#include <sys/types.h>
 
1304
#include <machine/bswap.h>
 
1305
int main(void) { return bswap32(0); }
 
1306
EOF
 
1307
  if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
 
1308
    echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
 
1309
  fi
 
1310
fi
 
1311
 
 
1312
if [ "$openbsd" = "yes" ] ; then
 
1313
  echo "#define ENOTSUP 4096" >> $config_h
 
1314
fi
 
1315
 
853
1316
if test "$darwin" = "yes" ; then
854
1317
  echo "CONFIG_DARWIN=yes" >> $config_mak
855
1318
  echo "#define CONFIG_DARWIN 1" >> $config_h
856
1319
fi
 
1320
 
 
1321
if test "$aix" = "yes" ; then
 
1322
  echo "CONFIG_AIX=yes" >> $config_mak
 
1323
  echo "#define CONFIG_AIX 1" >> $config_h
 
1324
fi
 
1325
 
857
1326
if test "$solaris" = "yes" ; then
858
1327
  echo "CONFIG_SOLARIS=yes" >> $config_mak
859
1328
  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
885
1354
  echo "CONFIG_SLIRP=yes" >> $config_mak
886
1355
  echo "#define CONFIG_SLIRP 1" >> $config_h
887
1356
fi
888
 
if test "$adlib" = "yes" ; then
889
 
  echo "CONFIG_ADLIB=yes" >> $config_mak
890
 
  echo "#define CONFIG_ADLIB 1" >> $config_h
891
 
fi
892
 
if test "$oss" = "yes" ; then
893
 
  echo "CONFIG_OSS=yes" >> $config_mak
894
 
  echo "#define CONFIG_OSS 1" >> $config_h
895
 
fi
896
 
if test "$coreaudio" = "yes" ; then
897
 
  echo "CONFIG_COREAUDIO=yes" >> $config_mak
898
 
  echo "#define CONFIG_COREAUDIO 1" >> $config_h
899
 
fi
900
 
if test "$alsa" = "yes" ; then
901
 
  echo "CONFIG_ALSA=yes" >> $config_mak
902
 
  echo "#define CONFIG_ALSA 1" >> $config_h
903
 
fi
904
 
if test "$dsound" = "yes" ; then
905
 
  echo "CONFIG_DSOUND=yes" >> $config_mak
906
 
  echo "#define CONFIG_DSOUND 1" >> $config_h
907
 
fi
908
 
if test "$fmod" = "yes" ; then
909
 
  echo "CONFIG_FMOD=yes" >> $config_mak
910
 
  echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
911
 
  echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
912
 
  echo "#define CONFIG_FMOD 1" >> $config_h
 
1357
if test "$vde" = "yes" ; then
 
1358
  echo "CONFIG_VDE=yes" >> $config_mak
 
1359
  echo "#define CONFIG_VDE 1" >> $config_h
 
1360
  echo "VDE_LIBS=-lvdeplug" >> $config_mak
 
1361
fi
 
1362
for card in $audio_card_list; do
 
1363
    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
 
1364
    echo "$def=yes" >> $config_mak
 
1365
    echo "#define $def 1" >> $config_h
 
1366
done
 
1367
echo "#define AUDIO_DRIVERS \\" >> $config_h
 
1368
for drv in $audio_drv_list; do
 
1369
    echo "    &${drv}_audio_driver, \\" >>$config_h
 
1370
    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
 
1371
    echo "$def=yes" >> $config_mak
 
1372
    if test "$drv" = "fmod"; then
 
1373
        echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
 
1374
        echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
 
1375
    elif test "$drv" = "oss"; then
 
1376
        echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
 
1377
    fi
 
1378
done
 
1379
echo "" >>$config_h
 
1380
if test "$mixemu" = "yes" ; then
 
1381
  echo "CONFIG_MIXEMU=yes" >> $config_mak
 
1382
  echo "#define CONFIG_MIXEMU 1" >> $config_h
913
1383
fi
914
1384
if test "$vnc_tls" = "yes" ; then
915
1385
  echo "CONFIG_VNC_TLS=yes" >> $config_mak
939
1409
  echo "CONFIG_SDL=yes" >> $config_mak
940
1410
  if test "$target_softmmu" = "no" -o "$static" = "yes"; then
941
1411
    echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
 
1412
  elif test "$sdl_x11" = "yes" ; then
 
1413
    echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
942
1414
  else
943
1415
    echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
944
1416
  fi
949
1421
  fi
950
1422
fi
951
1423
if test "$cocoa" = "yes" ; then
952
 
    echo "#define CONFIG_COCOA 1" >> $config_h
953
 
    echo "CONFIG_COCOA=yes" >> $config_mak
 
1424
  echo "#define CONFIG_COCOA 1" >> $config_h
 
1425
  echo "CONFIG_COCOA=yes" >> $config_mak
 
1426
fi
 
1427
if test "$curses" = "yes" ; then
 
1428
  echo "#define CONFIG_CURSES 1" >> $config_h
 
1429
  echo "CONFIG_CURSES=yes" >> $config_mak
 
1430
  echo "CURSES_LIBS=-lcurses" >> $config_mak
 
1431
fi
 
1432
if test "$brlapi" = "yes" ; then
 
1433
  echo "CONFIG_BRLAPI=yes" >> $config_mak
 
1434
  echo "#define CONFIG_BRLAPI 1" >> $config_h
 
1435
  echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
 
1436
fi
 
1437
if test "$bluez" = "yes" ; then
 
1438
  echo "CONFIG_BLUEZ=yes" >> $config_mak
 
1439
  echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
 
1440
  echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
 
1441
  echo "#define CONFIG_BLUEZ 1" >> $config_h
 
1442
fi
 
1443
if test "$aio" = "yes" ; then
 
1444
  echo "#define CONFIG_AIO 1" >> $config_h
 
1445
  echo "CONFIG_AIO=yes" >> $config_mak
 
1446
fi
 
1447
if test "$blobs" = "yes" ; then
 
1448
  echo "INSTALL_BLOBS=yes" >> $config_mak
 
1449
fi
 
1450
if test "$iovec" = "yes" ; then
 
1451
  echo "#define HAVE_IOVEC 1" >> $config_h
 
1452
fi
 
1453
if test "$fdt" = "yes" ; then
 
1454
  echo "#define HAVE_FDT 1" >> $config_h
 
1455
  echo "FDT_LIBS=-lfdt" >> $config_mak
954
1456
fi
955
1457
 
956
1458
# XXX: suppress that
962
1464
 
963
1465
echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
964
1466
 
 
1467
# USB host support
 
1468
case "$usb" in
 
1469
linux)
 
1470
  echo "HOST_USB=linux" >> $config_mak
 
1471
;;
 
1472
bsd)
 
1473
  echo "HOST_USB=bsd" >> $config_mak
 
1474
;;
 
1475
*)
 
1476
  echo "HOST_USB=stub" >> $config_mak
 
1477
;;
 
1478
esac
 
1479
 
965
1480
tools=
966
1481
if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
967
1482
  tools="qemu-img\$(EXESUF) $tools"
 
1483
  if [ "$linux" = "yes" ] ; then
 
1484
      tools="qemu-nbd\$(EXESUF) $tools"
 
1485
  fi
968
1486
fi
969
1487
echo "TOOLS=$tools" >> $config_mak
970
1488
 
977
1495
target_cpu=`echo $target | cut -d '-' -f 1`
978
1496
target_bigendian="no"
979
1497
[ "$target_cpu" = "armeb" ] && target_bigendian=yes
980
 
[ "$target_cpu" = "sparc" ] && target_bigendian=yes
981
 
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
982
 
[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
 
1498
[ "$target_cpu" = "m68k" ] && target_bigendian=yes
 
1499
[ "$target_cpu" = "mips" ] && target_bigendian=yes
 
1500
[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
 
1501
[ "$target_cpu" = "mips64" ] && target_bigendian=yes
983
1502
[ "$target_cpu" = "ppc" ] && target_bigendian=yes
984
1503
[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
985
1504
[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
986
1505
[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
987
 
[ "$target_cpu" = "mips" ] && target_bigendian=yes
988
 
[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
989
 
[ "$target_cpu" = "mips64" ] && target_bigendian=yes
990
1506
[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
991
 
[ "$target_cpu" = "m68k" ] && target_bigendian=yes
 
1507
[ "$target_cpu" = "sparc" ] && target_bigendian=yes
 
1508
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
 
1509
[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
992
1510
target_softmmu="no"
993
1511
target_user_only="no"
994
1512
target_linux_user="no"
995
1513
target_darwin_user="no"
 
1514
target_bsd_user="no"
996
1515
case "$target" in
997
1516
  ${target_cpu}-softmmu)
998
1517
    target_softmmu="yes"
1005
1524
    target_user_only="yes"
1006
1525
    target_darwin_user="yes"
1007
1526
    ;;
 
1527
  ${target_cpu}-bsd-user)
 
1528
    target_user_only="yes"
 
1529
    target_bsd_user="yes"
 
1530
    ;;
1008
1531
  *)
1009
1532
    echo "ERROR: Target '$target' not recognised"
1010
1533
    exit 1
1015
1538
        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1016
1539
    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1017
1540
    echo "To build QEMU without graphical output configure with --disable-gfx-check"
1018
 
    echo "Note that this will disable all output from the virtual graphics card."
 
1541
    echo "Note that this will disable all output from the virtual graphics card"
 
1542
    echo "except through VNC or curses."
1019
1543
    exit 1;
1020
1544
fi
1021
1545
 
1025
1549
 
1026
1550
mkdir -p $target_dir
1027
1551
mkdir -p $target_dir/fpu
1028
 
if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
 
1552
mkdir -p $target_dir/tcg
 
1553
if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1029
1554
  mkdir -p $target_dir/nwfpe
1030
1555
fi
1031
1556
 
1045
1570
 
1046
1571
bflt="no"
1047
1572
elfload32="no"
 
1573
target_nptl="no"
1048
1574
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1049
1575
echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1050
 
 
1051
 
if test "$target_cpu" = "i386" ; then
1052
 
  echo "TARGET_ARCH=i386" >> $config_mak
1053
 
  echo "#define TARGET_ARCH \"i386\"" >> $config_h
1054
 
  echo "#define TARGET_I386 1" >> $config_h
1055
 
  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
1056
 
    echo "#define USE_KQEMU 1" >> $config_h
1057
 
  fi
1058
 
elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
1059
 
  echo "TARGET_ARCH=arm" >> $config_mak
1060
 
  echo "#define TARGET_ARCH \"arm\"" >> $config_h
1061
 
  echo "#define TARGET_ARM 1" >> $config_h
1062
 
  bflt="yes"
1063
 
elif test "$target_cpu" = "sparc" ; then
1064
 
  echo "TARGET_ARCH=sparc" >> $config_mak
1065
 
  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1066
 
  echo "#define TARGET_SPARC 1" >> $config_h
1067
 
elif test "$target_cpu" = "sparc64" ; then
1068
 
  echo "TARGET_ARCH=sparc64" >> $config_mak
1069
 
  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1070
 
  echo "#define TARGET_SPARC 1" >> $config_h
1071
 
  echo "#define TARGET_SPARC64 1" >> $config_h
1072
 
  elfload32="yes"
1073
 
elif test "$target_cpu" = "sparc32plus" ; then
1074
 
  echo "TARGET_ARCH=sparc64" >> $config_mak
1075
 
  echo "TARGET_ABI_DIR=sparc" >> $config_mak
1076
 
  echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1077
 
  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1078
 
  echo "#define TARGET_SPARC 1" >> $config_h
1079
 
  echo "#define TARGET_SPARC64 1" >> $config_h
1080
 
  echo "#define TARGET_ABI32 1" >> $config_h
1081
 
elif test "$target_cpu" = "ppc" ; then
1082
 
  echo "TARGET_ARCH=ppc" >> $config_mak
1083
 
  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1084
 
  echo "#define TARGET_PPC 1" >> $config_h
1085
 
elif test "$target_cpu" = "ppcemb" ; then
1086
 
  echo "TARGET_ARCH=ppcemb" >> $config_mak
1087
 
  echo "TARGET_ABI_DIR=ppc" >> $config_mak
1088
 
  echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1089
 
  echo "#define TARGET_PPC 1" >> $config_h
1090
 
  echo "#define TARGET_PPCEMB 1" >> $config_h
1091
 
elif test "$target_cpu" = "ppc64" ; then
1092
 
  echo "TARGET_ARCH=ppc64" >> $config_mak
1093
 
  echo "TARGET_ABI_DIR=ppc" >> $config_mak
1094
 
  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1095
 
  echo "#define TARGET_PPC 1" >> $config_h
1096
 
  echo "#define TARGET_PPC64 1" >> $config_h
1097
 
elif test "$target_cpu" = "ppc64abi32" ; then
1098
 
  echo "TARGET_ARCH=ppc64" >> $config_mak
1099
 
  echo "TARGET_ABI_DIR=ppc" >> $config_mak
1100
 
  echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1101
 
  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1102
 
  echo "#define TARGET_PPC 1" >> $config_h
1103
 
  echo "#define TARGET_PPC64 1" >> $config_h
1104
 
  echo "#define TARGET_ABI32 1" >> $config_h
1105
 
elif test "$target_cpu" = "x86_64" ; then
1106
 
  echo "TARGET_ARCH=x86_64" >> $config_mak
1107
 
  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1108
 
  echo "#define TARGET_I386 1" >> $config_h
1109
 
  echo "#define TARGET_X86_64 1" >> $config_h
1110
 
  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
1111
 
    echo "#define USE_KQEMU 1" >> $config_h
1112
 
  fi
1113
 
elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
1114
 
  echo "TARGET_ARCH=mips" >> $config_mak
1115
 
  echo "#define TARGET_ARCH \"mips\"" >> $config_h
1116
 
  echo "#define TARGET_MIPS 1" >> $config_h
1117
 
  echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1118
 
elif test "$target_cpu" = "mipsn32" -o "$target_cpu" = "mipsn32el" ; then
1119
 
  echo "TARGET_ARCH=mipsn32" >> $config_mak
1120
 
  echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1121
 
  echo "#define TARGET_MIPS 1" >> $config_h
1122
 
  echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1123
 
elif test "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el" ; then
1124
 
  echo "TARGET_ARCH=mips64" >> $config_mak
1125
 
  echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1126
 
  echo "#define TARGET_MIPS 1" >> $config_h
1127
 
  echo "#define TARGET_MIPS64 1" >> $config_h
1128
 
  echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1129
 
elif test "$target_cpu" = "cris" ; then
1130
 
  echo "TARGET_ARCH=cris" >> $config_mak
1131
 
  echo "#define TARGET_ARCH \"cris\"" >> $config_h
1132
 
  echo "#define TARGET_CRIS 1" >> $config_h
1133
 
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1134
 
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1135
 
elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
1136
 
  echo "TARGET_ARCH=sh4" >> $config_mak
1137
 
  echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1138
 
  echo "#define TARGET_SH4 1" >> $config_h
1139
 
  bflt="yes"
1140
 
elif test "$target_cpu" = "m68k" ; then
1141
 
  echo "TARGET_ARCH=m68k" >> $config_mak
1142
 
  echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1143
 
  echo "#define TARGET_M68K 1" >> $config_h
1144
 
  bflt="yes"
1145
 
elif test "$target_cpu" = "alpha" ; then
1146
 
  echo "TARGET_ARCH=alpha" >> $config_mak
1147
 
  echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1148
 
  echo "#define TARGET_ALPHA 1" >> $config_h
1149
 
else
1150
 
  echo "Unsupported target CPU"
1151
 
  exit 1
1152
 
fi
 
1576
gdb_xml_files=""
 
1577
 
 
1578
# Make sure the target and host cpus are compatible
 
1579
if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
 
1580
  \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
 
1581
  \( "$target_cpu" = "x86_64" -a "$cpu" = "i386"   \) -o \
 
1582
  \( "$target_cpu" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
 
1583
  kvm="no"
 
1584
fi
 
1585
# Disable KVM for linux-user
 
1586
if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
 
1587
  kvm="no"
 
1588
fi
 
1589
 
 
1590
case "$target_cpu" in
 
1591
  i386)
 
1592
    echo "TARGET_ARCH=i386" >> $config_mak
 
1593
    echo "#define TARGET_ARCH \"i386\"" >> $config_h
 
1594
    echo "#define TARGET_I386 1" >> $config_h
 
1595
    if test $kqemu = "yes" -a "$target_softmmu" = "yes"
 
1596
    then
 
1597
      echo "#define USE_KQEMU 1" >> $config_h
 
1598
    fi
 
1599
    if test "$kvm" = "yes" ; then
 
1600
      echo "CONFIG_KVM=yes" >> $config_mak
 
1601
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
 
1602
      echo "#define CONFIG_KVM 1" >> $config_h
 
1603
    fi
 
1604
  ;;
 
1605
  x86_64)
 
1606
    echo "TARGET_ARCH=x86_64" >> $config_mak
 
1607
    echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
 
1608
    echo "#define TARGET_I386 1" >> $config_h
 
1609
    echo "#define TARGET_X86_64 1" >> $config_h
 
1610
    if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
 
1611
    then
 
1612
      echo "#define USE_KQEMU 1" >> $config_h
 
1613
    fi
 
1614
    if test "$kvm" = "yes" ; then
 
1615
      echo "CONFIG_KVM=yes" >> $config_mak
 
1616
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
 
1617
      echo "#define CONFIG_KVM 1" >> $config_h
 
1618
    fi
 
1619
  ;;
 
1620
  alpha)
 
1621
    echo "TARGET_ARCH=alpha" >> $config_mak
 
1622
    echo "#define TARGET_ARCH \"alpha\"" >> $config_h
 
1623
    echo "#define TARGET_ALPHA 1" >> $config_h
 
1624
  ;;
 
1625
  arm|armeb)
 
1626
    echo "TARGET_ARCH=arm" >> $config_mak
 
1627
    echo "#define TARGET_ARCH \"arm\"" >> $config_h
 
1628
    echo "#define TARGET_ARM 1" >> $config_h
 
1629
    bflt="yes"
 
1630
    target_nptl="yes"
 
1631
    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
 
1632
  ;;
 
1633
  cris)
 
1634
    echo "TARGET_ARCH=cris" >> $config_mak
 
1635
    echo "#define TARGET_ARCH \"cris\"" >> $config_h
 
1636
    echo "#define TARGET_CRIS 1" >> $config_h
 
1637
    target_nptl="yes"
 
1638
  ;;
 
1639
  m68k)
 
1640
    echo "TARGET_ARCH=m68k" >> $config_mak
 
1641
    echo "#define TARGET_ARCH \"m68k\"" >> $config_h
 
1642
    echo "#define TARGET_M68K 1" >> $config_h
 
1643
    bflt="yes"
 
1644
    gdb_xml_files="cf-core.xml cf-fp.xml"
 
1645
  ;;
 
1646
  mips|mipsel)
 
1647
    echo "TARGET_ARCH=mips" >> $config_mak
 
1648
    echo "#define TARGET_ARCH \"mips\"" >> $config_h
 
1649
    echo "#define TARGET_MIPS 1" >> $config_h
 
1650
    echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
 
1651
  ;;
 
1652
  mipsn32|mipsn32el)
 
1653
    echo "TARGET_ARCH=mipsn32" >> $config_mak
 
1654
    echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
 
1655
    echo "#define TARGET_MIPS 1" >> $config_h
 
1656
    echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
 
1657
  ;;
 
1658
  mips64|mips64el)
 
1659
    echo "TARGET_ARCH=mips64" >> $config_mak
 
1660
    echo "#define TARGET_ARCH \"mips64\"" >> $config_h
 
1661
    echo "#define TARGET_MIPS 1" >> $config_h
 
1662
    echo "#define TARGET_MIPS64 1" >> $config_h
 
1663
    echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
 
1664
  ;;
 
1665
  ppc)
 
1666
    echo "TARGET_ARCH=ppc" >> $config_mak
 
1667
    echo "#define TARGET_ARCH \"ppc\"" >> $config_h
 
1668
    echo "#define TARGET_PPC 1" >> $config_h
 
1669
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
 
1670
  ;;
 
1671
  ppcemb)
 
1672
    echo "TARGET_ARCH=ppcemb" >> $config_mak
 
1673
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
 
1674
    echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
 
1675
    echo "#define TARGET_PPC 1" >> $config_h
 
1676
    echo "#define TARGET_PPCEMB 1" >> $config_h
 
1677
    if test "$kvm" = "yes" ; then
 
1678
      echo "CONFIG_KVM=yes" >> $config_mak
 
1679
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
 
1680
      echo "#define CONFIG_KVM 1" >> $config_h
 
1681
    fi
 
1682
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
 
1683
  ;;
 
1684
  ppc64)
 
1685
    echo "TARGET_ARCH=ppc64" >> $config_mak
 
1686
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
 
1687
    echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
 
1688
    echo "#define TARGET_PPC 1" >> $config_h
 
1689
    echo "#define TARGET_PPC64 1" >> $config_h
 
1690
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
 
1691
  ;;
 
1692
  ppc64abi32)
 
1693
    echo "TARGET_ARCH=ppc64" >> $config_mak
 
1694
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
 
1695
    echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
 
1696
    echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
 
1697
    echo "#define TARGET_PPC 1" >> $config_h
 
1698
    echo "#define TARGET_PPC64 1" >> $config_h
 
1699
    echo "#define TARGET_ABI32 1" >> $config_h
 
1700
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
 
1701
  ;;
 
1702
  sh4|sh4eb)
 
1703
    echo "TARGET_ARCH=sh4" >> $config_mak
 
1704
    echo "#define TARGET_ARCH \"sh4\"" >> $config_h
 
1705
    echo "#define TARGET_SH4 1" >> $config_h
 
1706
    bflt="yes"
 
1707
    target_nptl="yes"
 
1708
  ;;
 
1709
  sparc)
 
1710
    echo "TARGET_ARCH=sparc" >> $config_mak
 
1711
    echo "#define TARGET_ARCH \"sparc\"" >> $config_h
 
1712
    echo "#define TARGET_SPARC 1" >> $config_h
 
1713
  ;;
 
1714
  sparc64)
 
1715
    echo "TARGET_ARCH=sparc64" >> $config_mak
 
1716
    echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
 
1717
    echo "#define TARGET_SPARC 1" >> $config_h
 
1718
    echo "#define TARGET_SPARC64 1" >> $config_h
 
1719
    elfload32="yes"
 
1720
  ;;
 
1721
  sparc32plus)
 
1722
    echo "TARGET_ARCH=sparc64" >> $config_mak
 
1723
    echo "TARGET_ABI_DIR=sparc" >> $config_mak
 
1724
    echo "TARGET_ARCH2=sparc32plus" >> $config_mak
 
1725
    echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
 
1726
    echo "#define TARGET_SPARC 1" >> $config_h
 
1727
    echo "#define TARGET_SPARC64 1" >> $config_h
 
1728
    echo "#define TARGET_ABI32 1" >> $config_h
 
1729
  ;;
 
1730
  *)
 
1731
    echo "Unsupported target CPU"
 
1732
    exit 1
 
1733
  ;;
 
1734
esac
1153
1735
if test "$target_bigendian" = "yes" ; then
1154
1736
  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1155
1737
  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1170
1752
  echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1171
1753
  echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1172
1754
fi
 
1755
list=""
 
1756
if test ! -z "$gdb_xml_files" ; then
 
1757
  for x in $gdb_xml_files; do
 
1758
    list="$list $source_path/gdb-xml/$x"
 
1759
  done
 
1760
fi
 
1761
echo "TARGET_XML_FILES=$list" >> $config_mak
1173
1762
 
1174
 
if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64"  -o "$target_cpu" = "sparc32plus" -o "$target_cpu" = "m68k" -o "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" -o "$target_cpu" = "mipsn32" -o "$target_cpu" = "mipsn32el" -o "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el"; then
 
1763
if test "$target_cpu" = "arm" \
 
1764
     -o "$target_cpu" = "armeb" \
 
1765
     -o "$target_cpu" = "m68k" \
 
1766
     -o "$target_cpu" = "mips" \
 
1767
     -o "$target_cpu" = "mipsel" \
 
1768
     -o "$target_cpu" = "mipsn32" \
 
1769
     -o "$target_cpu" = "mipsn32el" \
 
1770
     -o "$target_cpu" = "mips64" \
 
1771
     -o "$target_cpu" = "mips64el" \
 
1772
     -o "$target_cpu" = "ppc" \
 
1773
     -o "$target_cpu" = "ppc64" \
 
1774
     -o "$target_cpu" = "ppc64abi32" \
 
1775
     -o "$target_cpu" = "ppcemb" \
 
1776
     -o "$target_cpu" = "sparc" \
 
1777
     -o "$target_cpu" = "sparc64" \
 
1778
     -o "$target_cpu" = "sparc32plus"; then
1175
1779
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1176
1780
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1177
1781
fi
1179
1783
  echo "TARGET_HAS_BFLT=yes" >> $config_mak
1180
1784
  echo "#define TARGET_HAS_BFLT 1" >> $config_h
1181
1785
fi
 
1786
if test "$target_user_only" = "yes" \
 
1787
        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
 
1788
  echo "#define USE_NPTL 1" >> $config_h
 
1789
fi
1182
1790
# 32 bit ELF loader in addition to native 64 bit loader?
1183
1791
if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1184
1792
  echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1185
1793
  echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1186
1794
fi
 
1795
if test "$target_bsd_user" = "yes" ; then
 
1796
  echo "CONFIG_BSD_USER=yes" >> $config_mak
 
1797
  echo "#define CONFIG_BSD_USER 1" >> $config_h
 
1798
fi
1187
1799
 
1188
1800
test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1189
1801
 
1194
1806
    DIRS="tests tests/cris slirp audio"
1195
1807
    FILES="Makefile tests/Makefile"
1196
1808
    FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
 
1809
    FILES="$FILES tests/test-mmap.c"
1197
1810
    for dir in $DIRS ; do
1198
1811
            mkdir -p $dir
1199
1812
    done
1203
1816
        ln -s $source_path/$f $f
1204
1817
    done
1205
1818
fi
1206
 
 
1207
 
rm -f $TMPO $TMPC $TMPE $TMPS