Statistics
| Branch: | Revision:

root / configure @ b5dc7732

History | View | Annotate | Download (38.3 kB)

1
#!/bin/sh
2
#
3
# qemu configure script (c) 2003 Fabrice Bellard
4
#
5
# set temporary file name
6
if test ! -z "$TMPDIR" ; then
7
    TMPDIR1="${TMPDIR}"
8
elif test ! -z "$TEMPDIR" ; then
9
    TMPDIR1="${TEMPDIR}"
10
else
11
    TMPDIR1="/tmp"
12
fi
13

    
14
TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15
TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16
TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17
TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
18

    
19
# default parameters
20
prefix=""
21
interp_prefix="/usr/gnemul/qemu-%M"
22
static="no"
23
cross_prefix=""
24
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"
27
audio_drv_list=""
28
audio_card_list=""
29
host_cc="gcc"
30
ar="ar"
31
make="make"
32
install="install"
33
strip="strip"
34
cpu=`uname -m`
35
target_list=""
36
case "$cpu" in
37
  i386|i486|i586|i686|i86pc|BePC)
38
    cpu="i386"
39
  ;;
40
  x86_64|amd64)
41
    cpu="x86_64"
42
  ;;
43
  alpha)
44
    cpu="alpha"
45
  ;;
46
  armv*b)
47
    cpu="armv4b"
48
  ;;
49
  armv*l)
50
    cpu="armv4l"
51
  ;;
52
  cris)
53
    cpu="cris"
54
  ;;
55
  parisc|parisc64)
56
    cpu="hppa"
57
  ;;
58
  ia64)
59
    cpu="ia64"
60
  ;;
61
  m68k)
62
    cpu="m68k"
63
  ;;
64
  mips)
65
    cpu="mips"
66
  ;;
67
  mips64)
68
    cpu="mips64"
69
  ;;
70
  "Power Macintosh"|ppc|ppc64)
71
    cpu="powerpc"
72
  ;;
73
  s390*)
74
    cpu="s390"
75
  ;;
76
  sparc|sun4[cdmuv])
77
    cpu="sparc"
78
  ;;
79
  sparc64)
80
    cpu="sparc64"
81
  ;;
82
  *)
83
    cpu="unknown"
84
  ;;
85
esac
86
gprof="no"
87
bigendian="no"
88
mingw32="no"
89
EXESUF=""
90
gdbstub="yes"
91
slirp="yes"
92
fmod_lib=""
93
fmod_inc=""
94
vnc_tls="yes"
95
bsd="no"
96
linux="no"
97
kqemu="no"
98
profiler="no"
99
cocoa="no"
100
check_gfx="yes"
101
check_gcc="yes"
102
softmmu="yes"
103
linux_user="no"
104
darwin_user="no"
105
build_docs="no"
106
uname_release=""
107
curses="yes"
108
nptl="yes"
109
mixemu="no"
110

    
111
# OS specific
112
targetos=`uname -s`
113
case $targetos in
114
CYGWIN*)
115
mingw32="yes"
116
OS_CFLAGS="-mno-cygwin"
117
if [ "$cpu" = "i386" ] ; then
118
    kqemu="yes"
119
fi
120
;;
121
MINGW32*)
122
mingw32="yes"
123
if [ "$cpu" = "i386" ] ; then
124
    kqemu="yes"
125
fi
126
;;
127
GNU/kFreeBSD)
128
audio_drv_list="oss"
129
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
130
    kqemu="yes"
131
fi
132
;;
133
FreeBSD)
134
bsd="yes"
135
audio_drv_list="oss"
136
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
137
    kqemu="yes"
138
fi
139
;;
140
NetBSD)
141
bsd="yes"
142
audio_drv_list="oss"
143
;;
144
OpenBSD)
145
bsd="yes"
146
audio_drv_list="oss"
147
;;
148
Darwin)
149
bsd="yes"
150
darwin="yes"
151
darwin_user="yes"
152
cocoa="yes"
153
audio_drv_list="coreaudio"
154
OS_CFLAGS="-mdynamic-no-pic"
155
OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
156
;;
157
SunOS)
158
    solaris="yes"
159
    make="gmake"
160
    install="ginstall"
161
    needs_libsunmath="no"
162
    solarisrev=`uname -r | cut -f2 -d.`
163
    # have to select again, because `uname -m` returns i86pc
164
    # even on an x86_64 box.
165
    solariscpu=`isainfo -k`
166
    if test "${solariscpu}" = "amd64" ; then
167
        cpu="x86_64"
168
    fi
169
    if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
170
        if test "$solarisrev" -le 9 ; then
171
            if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
172
                needs_libsunmath="yes"
173
            else
174
                echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
175
                echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
176
                echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
177
                echo "Studio 11 can be downloaded from www.sun.com."
178
                exit 1
179
            fi
180
        fi
181
        if test "$solarisrev" -ge 9 ; then
182
            kqemu="yes"
183
        fi
184
    fi
185
    if test -f /usr/include/sys/soundcard.h ; then
186
        audio_drv_list="oss"
187
    fi
188
;;
189
*)
190
audio_drv_list="oss"
191
linux="yes"
192
linux_user="yes"
193
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
194
    kqemu="yes"
195
fi
196
;;
197
esac
198

    
199
if [ "$bsd" = "yes" ] ; then
200
  if [ "$darwin" != "yes" ] ; then
201
    make="gmake"
202
  fi
203
fi
204

    
205
# find source path
206
source_path=`dirname "$0"`
207
source_path_used="no"
208
workdir=`pwd`
209
if [ -z "$source_path" ]; then
210
    source_path=$workdir
211
else
212
    source_path=`cd "$source_path"; pwd`
213
fi
214
[ -f "$workdir/vl.c" ] || source_path_used="yes"
215

    
216
werror="no"
217
# generate compile errors on warnings for development builds
218
#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
219
#werror="yes";
220
#fi
221

    
222
for opt do
223
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
224
  case "$opt" in
225
  --help|-h) show_help=yes
226
  ;;
227
  --prefix=*) prefix="$optarg"
228
  ;;
229
  --interp-prefix=*) interp_prefix="$optarg"
230
  ;;
231
  --source-path=*) source_path="$optarg"
232
  source_path_used="yes"
233
  ;;
234
  --cross-prefix=*) cross_prefix="$optarg"
235
  ;;
236
  --cc=*) cc="$optarg"
237
  gcc3_search="no"
238
  ;;
239
  --host-cc=*) host_cc="$optarg"
240
  ;;
241
  --make=*) make="$optarg"
242
  ;;
243
  --install=*) install="$optarg"
244
  ;;
245
  --extra-cflags=*) CFLAGS="$optarg"
246
  ;;
247
  --extra-ldflags=*) LDFLAGS="$optarg"
248
  ;;
249
  --cpu=*) cpu="$optarg"
250
  ;;
251
  --target-list=*) target_list="$optarg"
252
  ;;
253
  --enable-gprof) gprof="yes"
254
  ;;
255
  --static) static="yes"
256
  ;;
257
  --disable-sdl) sdl="no"
258
  ;;
259
  --fmod-lib=*) fmod_lib="$optarg"
260
  ;;
261
  --audio-card-list=*) audio_card_list="$optarg"
262
  ;;
263
  --audio-drv-list=*) audio_drv_list="$optarg"
264
  ;;
265
  --fmod-inc=*) fmod_inc="$optarg"
266
  ;;
267
  --disable-vnc-tls) vnc_tls="no"
268
  ;;
269
  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
270
  ;;
271
  --disable-slirp) slirp="no"
272
  ;;
273
  --disable-kqemu) kqemu="no"
274
  ;;
275
  --disable-brlapi) brlapi="no"
276
  ;;
277
  --enable-profiler) profiler="yes"
278
  ;;
279
  --enable-cocoa) cocoa="yes" ; sdl="no" ;
280
  ;;
281
  --disable-gfx-check) check_gfx="no"
282
  ;;
283
  --disable-gcc-check) check_gcc="no"
284
  ;;
285
  --disable-system) softmmu="no"
286
  ;;
287
  --enable-system) softmmu="yes"
288
  ;;
289
  --disable-linux-user) linux_user="no"
290
  ;;
291
  --enable-linux-user) linux_user="yes"
292
  ;;
293
  --disable-darwin-user) darwin_user="no"
294
  ;;
295
  --enable-darwin-user) darwin_user="yes"
296
  ;;
297
  --enable-uname-release=*) uname_release="$optarg"
298
  ;;
299
  --sparc_cpu=*)
300
      sparc_cpu="$optarg"
301
      case $sparc_cpu in
302
        v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
303
                 target_cpu="sparc"; cpu="sparc" ;;
304
        v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
305
                 target_cpu="sparc"; cpu="sparc" ;;
306
        v9)    SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
307
                 target_cpu="sparc64"; cpu="sparc64" ;;
308
        *)     echo "undefined SPARC architecture. Exiting";exit 1;;
309
      esac
310
  ;;
311
  --enable-werror) werror="yes"
312
  ;;
313
  --disable-werror) werror="no"
314
  ;;
315
  --disable-curses) curses="no"
316
  ;;
317
  --disable-nptl) nptl="no"
318
  ;;
319
  --enable-mixemu) mixemu="yes"
320
  ;;
321
  *) echo "ERROR: unknown option $opt"; show_help="yes"
322
  ;;
323
  esac
324
done
325

    
326
if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
327
    AIOLIBS=
328
else
329
    # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
330
    AIOLIBS="-lrt -lpthread"
331
fi
332

    
333
# default flags for all hosts
334
CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
335
LDFLAGS="$LDFLAGS -g"
336
if test "$werror" = "yes" ; then
337
CFLAGS="$CFLAGS -Werror"
338
fi
339

    
340
#
341
# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
342
# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
343
#
344
case "$cpu" in
345
    sparc) if test -z "$sparc_cpu" ; then
346
               ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
347
               ARCH_LDFLAGS="-m32"
348
           else
349
               ARCH_CFLAGS="${SP_CFLAGS}"
350
               ARCH_LDFLAGS="${SP_LDFLAGS}"
351
           fi
352
           ;;
353
    sparc64) if test -z "$sparc_cpu" ; then
354
               ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
355
               ARCH_LDFLAGS="-m64"
356
           else
357
               ARCH_CFLAGS="${SP_CFLAGS}"
358
               ARCH_LDFLAGS="${SP_LDFLAGS}"
359
           fi
360
           ;;
361
    s390)
362
           ARCH_CFLAGS="-march=z900"
363
           ;;
364
    i386)
365
           ARCH_CFLAGS="-m32"
366
           ARCH_LDFLAGS="-m32"
367
           ;;
368
    x86_64)
369
           ARCH_CFLAGS="-m64"
370
           ARCH_LDFLAGS="-m64"
371
           ;;
372
esac
373

    
374
if test x"$show_help" = x"yes" ; then
375
cat << EOF
376

    
377
Usage: configure [options]
378
Options: [defaults in brackets after descriptions]
379

    
380
EOF
381
echo "Standard options:"
382
echo "  --help                   print this message"
383
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
384
echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
385
echo "                           use %M for cpu name [$interp_prefix]"
386
echo "  --target-list=LIST       set target list [$target_list]"
387
echo ""
388
echo "kqemu kernel acceleration support:"
389
echo "  --disable-kqemu          disable kqemu support"
390
echo ""
391
echo "Advanced options (experts only):"
392
echo "  --source-path=PATH       path of source code [$source_path]"
393
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
394
echo "  --cc=CC                  use C compiler CC [$cc]"
395
echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
396
echo "  --make=MAKE              use specified make [$make]"
397
echo "  --install=INSTALL        use specified install [$install]"
398
echo "  --static                 enable static build [$static]"
399
echo "  --disable-werror         disable compilation abort on warning"
400
echo "  --disable-sdl            disable SDL"
401
echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
402
echo "  --enable-mingw32         enable Win32 cross compilation with mingw32"
403
echo "  --audio-drv-list         set audio drivers list"
404
echo "  --audio-card-list        set list of additional emulated audio cards"
405
echo "  --enable-mixemu          enable mixer emulation"
406
echo "  --disable-brlapi         disable BrlAPI"
407
echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
408
echo "  --disable-curses         disable curses output"
409
echo "  --disable-nptl           disable usermode NPTL support"
410
echo "  --enable-system          enable all system emulation targets"
411
echo "  --disable-system         disable all system emulation targets"
412
echo "  --enable-linux-user      enable all linux usermode emulation targets"
413
echo "  --disable-linux-user     disable all linux usermode emulation targets"
414
echo "  --enable-darwin-user     enable all darwin usermode emulation targets"
415
echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
416
echo "  --fmod-lib               path to FMOD library"
417
echo "  --fmod-inc               path to FMOD includes"
418
echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
419
echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
420
echo ""
421
echo "NOTE: The object files are built at the place where configure is launched"
422
exit 1
423
fi
424

    
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 $ARCH_CFLAGS -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
if test "$mingw32" = "yes" ; then
442
    linux="no"
443
    EXESUF=".exe"
444
    oss="no"
445
fi
446

    
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" $ARCH_CFLAGS -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
479
fi
480

    
481
#
482
# Solaris specific configure tool chain decisions
483
#
484
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
  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
499
  if test -z "$solinst" ; then
500
    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
501
    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
502
    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
503
    exit 1
504
  fi
505
  if test "$solinst" = "/usr/sbin/install" ; then
506
    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
507
    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
508
    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
509
    exit 1
510
  fi
511
  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
512
  if test -z "$sol_ar" ; then
513
    echo "Error: No path includes ar"
514
    if test -f /usr/ccs/bin/ar ; then
515
      echo "Add /usr/ccs/bin to your path and rerun configure"
516
    fi
517
    exit 1
518
  fi
519
fi
520

    
521

    
522
if test -z "$target_list" ; then
523
# these targets are portable
524
    if [ "$softmmu" = "yes" ] ; then
525
        target_list="\
526
i386-softmmu \
527
x86_64-softmmu \
528
arm-softmmu \
529
cris-softmmu \
530
m68k-softmmu \
531
mips-softmmu \
532
mipsel-softmmu \
533
mips64-softmmu \
534
mips64el-softmmu \
535
ppc-softmmu \
536
ppcemb-softmmu \
537
ppc64-softmmu \
538
sh4-softmmu \
539
sh4eb-softmmu \
540
sparc-softmmu \
541
"
542
    fi
543
# the following are Linux specific
544
    if [ "$linux_user" = "yes" ] ; then
545
        target_list="${target_list}\
546
i386-linux-user \
547
x86_64-linux-user \
548
alpha-linux-user \
549
arm-linux-user \
550
armeb-linux-user \
551
cris-linux-user \
552
m68k-linux-user \
553
mips-linux-user \
554
mipsel-linux-user \
555
ppc-linux-user \
556
ppc64-linux-user \
557
ppc64abi32-linux-user \
558
sh4-linux-user \
559
sh4eb-linux-user \
560
sparc-linux-user \
561
sparc64-linux-user \
562
sparc32plus-linux-user \
563
"
564
    fi
565
# the following are Darwin specific
566
    if [ "$darwin_user" = "yes" ] ; then
567
        target_list="$target_list i386-darwin-user ppc-darwin-user"
568
    fi
569
else
570
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
571
fi
572
if test -z "$target_list" ; then
573
    echo "No targets enabled"
574
    exit 1
575
fi
576

    
577
if test -z "$cross_prefix" ; then
578

    
579
# ---
580
# big/little endian test
581
cat > $TMPC << EOF
582
#include <inttypes.h>
583
int main(int argc, char ** argv){
584
        volatile uint32_t i=0x01234567;
585
        return (*((uint8_t*)(&i))) == 0x67;
586
}
587
EOF
588

    
589
if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
590
$TMPE && bigendian="yes"
591
else
592
echo big/little test failed
593
fi
594

    
595
else
596

    
597
# if cross compiling, cannot launch a program, so make a static guess
598
if test "$cpu" = "armv4b" \
599
     -o "$cpu" = "hppa" \
600
     -o "$cpu" = "m68k" \
601
     -o "$cpu" = "mips" \
602
     -o "$cpu" = "mips64" \
603
     -o "$cpu" = "powerpc" \
604
     -o "$cpu" = "s390" \
605
     -o "$cpu" = "sparc" \
606
     -o "$cpu" = "sparc64"; then
607
    bigendian="yes"
608
fi
609

    
610
fi
611

    
612
# host long bits test
613
hostlongbits="32"
614
if test "$cpu" = "x86_64" \
615
     -o "$cpu" = "alpha" \
616
     -o "$cpu" = "ia64" \
617
     -o "$cpu" = "sparc64"; then
618
    hostlongbits="64"
619
fi
620

    
621
# check gcc options support
622
cat > $TMPC <<EOF
623
int main(void) {
624
}
625
EOF
626

    
627
# Check host NPTL support
628
cat > $TMPC <<EOF
629
#include <sched.h>
630
#include <linux/futex.h>
631
void foo()
632
{
633
#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
634
#error bork
635
#endif
636
}
637
EOF
638

    
639
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
640
  :
641
else
642
   nptl="no"
643
fi
644

    
645
##########################################
646
# SDL probe
647

    
648
sdl_too_old=no
649

    
650
if test -z "$sdl" ; then
651
    sdl_config="sdl-config"
652
    sdl=no
653
    sdl_static=no
654

    
655
    if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
656
    # win32 cross compilation case
657
        sdl_config="i386-mingw32msvc-sdl-config"
658
        sdl=yes
659
    else
660
        # normal SDL probe
661
cat > $TMPC << EOF
662
#include <SDL.h>
663
#undef main /* We don't want SDL to override our main() */
664
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
665
EOF
666
        if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
667
            _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
668
            if test "$_sdlversion" -lt 121 ; then
669
                sdl_too_old=yes
670
            else
671
                if test "$cocoa" = "no" ; then
672
                    sdl=yes
673
                fi
674
            fi
675

    
676
            # static link with sdl ?
677
            if test "$sdl" = "yes" ; then
678
                aa="no"
679
                `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
680
                sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
681
                if [ "$aa" = "yes" ] ; then
682
                    sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
683
                fi
684

    
685
                if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
686
                    sdl_static=yes
687
                fi
688
            fi # static link
689
        fi # sdl compile test
690
    fi # cross compilation
691
else
692
    # Make sure to disable cocoa if sdl was set
693
    if test "$sdl" = "yes" ; then
694
       cocoa="no"
695
       audio_drv_list="echo $audio_drv_list | sed s,coreaudio,,g"
696
    fi
697
fi # -z $sdl
698

    
699
##########################################
700
# VNC TLS detection
701
if test "$vnc_tls" = "yes" ; then
702
  `pkg-config gnutls` || vnc_tls="no"
703
fi
704
if test "$vnc_tls" = "yes" ; then
705
  vnc_tls_cflags=`pkg-config --cflags gnutls`
706
  vnc_tls_libs=`pkg-config --libs gnutls`
707
fi
708

    
709
##########################################
710
# alsa sound support libraries
711

    
712
if test "$alsa" = "yes" ; then
713
  cat > $TMPC << EOF
714
#include <alsa/asoundlib.h>
715
int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
716
EOF
717
  if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lasound 2> /dev/null ; then
718
    :
719
  else
720
    echo
721
    echo "Error: Could not find alsa"
722
    echo "Make sure to have the alsa libs and headers installed."
723
    echo
724
    exit 1
725
  fi
726
fi
727

    
728
##########################################
729
# BrlAPI probe
730

    
731
if test -z "$brlapi" ; then
732
    brlapi=no
733
cat > $TMPC << EOF
734
#include <brlapi.h>
735
int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
736
EOF
737
    if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then
738
	    brlapi=yes
739
    fi # brlapi compile test
740
fi # -z $brlapi
741

    
742
##########################################
743
# curses probe
744

    
745
if test "$curses" = "yes" ; then
746
  curses=no
747
  cat > $TMPC << EOF
748
#include <curses.h>
749
int main(void) { return curses_version(); }
750
EOF
751
  if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then
752
    curses=yes
753
  fi
754
fi # test "$curses"
755

    
756
# Check if tools are available to build documentation.
757
if [ -x "`which texi2html 2>/dev/null`" ] && \
758
   [ -x "`which pod2man 2>/dev/null`" ]; then
759
  build_docs="yes"
760
fi
761

    
762
if test "$mingw32" = "yes" ; then
763
  if test -z "$prefix" ; then
764
      prefix="/c/Program Files/Qemu"
765
  fi
766
  mansuffix=""
767
  datasuffix=""
768
  docsuffix=""
769
  binsuffix=""
770
else
771
  if test -z "$prefix" ; then
772
      prefix="/usr/local"
773
  fi
774
  mansuffix="/share/man"
775
  datasuffix="/share/qemu"
776
  docsuffix="/share/doc/qemu"
777
  binsuffix="/bin"
778
fi
779

    
780
echo "Install prefix    $prefix"
781
echo "BIOS directory    $prefix$datasuffix"
782
echo "binary directory  $prefix$binsuffix"
783
if test "$mingw32" = "no" ; then
784
echo "Manual directory  $prefix$mansuffix"
785
echo "ELF interp prefix $interp_prefix"
786
fi
787
echo "Source path       $source_path"
788
echo "C compiler        $cc"
789
echo "Host C compiler   $host_cc"
790
echo "ARCH_CFLAGS       $ARCH_CFLAGS"
791
echo "make              $make"
792
echo "install           $install"
793
echo "host CPU          $cpu"
794
echo "host big endian   $bigendian"
795
echo "target list       $target_list"
796
echo "gprof enabled     $gprof"
797
echo "profiler          $profiler"
798
echo "static build      $static"
799
echo "-Werror enabled   $werror"
800
if test "$darwin" = "yes" ; then
801
    echo "Cocoa support     $cocoa"
802
fi
803
echo "SDL support       $sdl"
804
if test "$sdl" != "no" ; then
805
    echo "SDL static link   $sdl_static"
806
fi
807
echo "curses support    $curses"
808
echo "mingw32 support   $mingw32"
809
echo "Audio drivers     $audio_drv_list"
810
echo "Extra audio cards $audio_card_list"
811
echo "Mixer emulation   $mixemu"
812
if test "$fmod" = "yes"; then
813
    if test -z $fmod_lib || test -z $fmod_inc; then
814
        echo
815
        echo "Error: You must specify path to FMOD library and headers"
816
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
817
        echo
818
        exit 1
819
    fi
820
    fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
821
else
822
    fmod_support=""
823
fi
824
echo "FMOD support      $fmod $fmod_support"
825
echo "OSS support       $oss"
826
echo "VNC TLS support   $vnc_tls"
827
if test "$vnc_tls" = "yes" ; then
828
    echo "    TLS CFLAGS    $vnc_tls_cflags"
829
    echo "    TLS LIBS      $vnc_tls_libs"
830
fi
831
if test -n "$sparc_cpu"; then
832
    echo "Target Sparc Arch $sparc_cpu"
833
fi
834
echo "kqemu support     $kqemu"
835
echo "brlapi support    $brlapi"
836
echo "Documentation     $build_docs"
837
[ ! -z "$uname_release" ] && \
838
echo "uname -r          $uname_release"
839
echo "NPTL support      $nptl"
840

    
841
if test $sdl_too_old = "yes"; then
842
echo "-> Your SDL version is too old - please upgrade to have SDL support"
843
fi
844
if [ -s /tmp/qemu-$$-sdl-config.log ]; then
845
  echo "The error log from compiling the libSDL test is: "
846
  cat /tmp/qemu-$$-sdl-config.log
847
fi
848
rm -f /tmp/qemu-$$-sdl-config.log
849
#if test "$sdl_static" = "no"; then
850
#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
851
#fi
852
config_mak="config-host.mak"
853
config_h="config-host.h"
854

    
855
#echo "Creating $config_mak and $config_h"
856

    
857
test -f $config_h && mv $config_h ${config_h}~
858

    
859
echo "# Automatically generated by configure - do not modify" > $config_mak
860
echo "# Configured with: $0 $@" >> $config_mak
861
echo "/* Automatically generated by configure - do not modify */" > $config_h
862

    
863
echo "prefix=$prefix" >> $config_mak
864
echo "bindir=\${prefix}$binsuffix" >> $config_mak
865
echo "mandir=\${prefix}$mansuffix" >> $config_mak
866
echo "datadir=\${prefix}$datasuffix" >> $config_mak
867
echo "docdir=\${prefix}$docsuffix" >> $config_mak
868
echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
869
echo "MAKE=$make" >> $config_mak
870
echo "INSTALL=$install" >> $config_mak
871
echo "CC=$cc" >> $config_mak
872
echo "HOST_CC=$host_cc" >> $config_mak
873
echo "AR=$ar" >> $config_mak
874
echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
875
# XXX: only use CFLAGS and LDFLAGS ?  
876
# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
877
# compilation of dyngen tool (useful for win32 build on Linux host)
878
echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
879
echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
880
echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
881
echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
882
echo "CFLAGS=$CFLAGS" >> $config_mak
883
echo "LDFLAGS=$LDFLAGS" >> $config_mak
884
echo "EXESUF=$EXESUF" >> $config_mak
885
echo "AIOLIBS=$AIOLIBS" >> $config_mak
886
case "$cpu" in
887
  i386)
888
    echo "ARCH=i386" >> $config_mak
889
    echo "#define HOST_I386 1" >> $config_h
890
  ;;
891
  x86_64)
892
    echo "ARCH=x86_64" >> $config_mak
893
    echo "#define HOST_X86_64 1" >> $config_h
894
  ;;
895
  alpha)
896
    echo "ARCH=alpha" >> $config_mak
897
    echo "#define HOST_ALPHA 1" >> $config_h
898
  ;;
899
  armv4b)
900
    echo "ARCH=arm" >> $config_mak
901
    echo "#define HOST_ARM 1" >> $config_h
902
  ;;
903
  armv4l)
904
    echo "ARCH=arm" >> $config_mak
905
    echo "#define HOST_ARM 1" >> $config_h
906
  ;;
907
  cris)
908
    echo "ARCH=cris" >> $config_mak
909
    echo "#define HOST_CRIS 1" >> $config_h
910
  ;;
911
  hppa)
912
    echo "ARCH=hppa" >> $config_mak
913
    echo "#define HOST_HPPA 1" >> $config_h
914
  ;;
915
  ia64)
916
    echo "ARCH=ia64" >> $config_mak
917
    echo "#define HOST_IA64 1" >> $config_h
918
  ;;
919
  m68k)
920
    echo "ARCH=m68k" >> $config_mak
921
    echo "#define HOST_M68K 1" >> $config_h
922
  ;;
923
  mips)
924
    echo "ARCH=mips" >> $config_mak
925
    echo "#define HOST_MIPS 1" >> $config_h
926
  ;;
927
  mips64)
928
    echo "ARCH=mips64" >> $config_mak
929
    echo "#define HOST_MIPS64 1" >> $config_h
930
  ;;
931
  powerpc)
932
    echo "ARCH=ppc" >> $config_mak
933
    echo "#define HOST_PPC 1" >> $config_h
934
  ;;
935
  s390)
936
    echo "ARCH=s390" >> $config_mak
937
    echo "#define HOST_S390 1" >> $config_h
938
  ;;
939
  sparc)
940
    echo "ARCH=sparc" >> $config_mak
941
    echo "#define HOST_SPARC 1" >> $config_h
942
  ;;
943
  sparc64)
944
    echo "ARCH=sparc64" >> $config_mak
945
    echo "#define HOST_SPARC64 1" >> $config_h
946
  ;;
947
  *)
948
    echo "Unsupported CPU = $cpu"
949
    exit 1
950
  ;;
951
esac
952
if test "$bigendian" = "yes" ; then
953
  echo "WORDS_BIGENDIAN=yes" >> $config_mak
954
  echo "#define WORDS_BIGENDIAN 1" >> $config_h
955
fi
956
echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
957
if test "$mingw32" = "yes" ; then
958
  echo "CONFIG_WIN32=yes" >> $config_mak
959
  echo "#define CONFIG_WIN32 1" >> $config_h
960
else
961
  cat > $TMPC << EOF
962
#include <byteswap.h>
963
int main(void) { return bswap_32(0); }
964
EOF
965
  if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
966
    echo "#define HAVE_BYTESWAP_H 1" >> $config_h
967
  fi
968
fi
969
if test "$darwin" = "yes" ; then
970
  echo "CONFIG_DARWIN=yes" >> $config_mak
971
  echo "#define CONFIG_DARWIN 1" >> $config_h
972
fi
973
if test "$solaris" = "yes" ; then
974
  echo "CONFIG_SOLARIS=yes" >> $config_mak
975
  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
976
  if test "$needs_libsunmath" = "yes" ; then
977
    echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
978
    echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
979
  fi
980
fi
981
if test -n "$sparc_cpu"; then
982
  echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
983
  echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
984
fi
985
if test "$gdbstub" = "yes" ; then
986
  echo "CONFIG_GDBSTUB=yes" >> $config_mak
987
  echo "#define CONFIG_GDBSTUB 1" >> $config_h
988
fi
989
if test "$gprof" = "yes" ; then
990
  echo "TARGET_GPROF=yes" >> $config_mak
991
  echo "#define HAVE_GPROF 1" >> $config_h
992
fi
993
if test "$static" = "yes" ; then
994
  echo "CONFIG_STATIC=yes" >> $config_mak
995
  echo "#define CONFIG_STATIC 1" >> $config_h
996
fi
997
if test $profiler = "yes" ; then
998
  echo "#define CONFIG_PROFILER 1" >> $config_h
999
fi
1000
if test "$slirp" = "yes" ; then
1001
  echo "CONFIG_SLIRP=yes" >> $config_mak
1002
  echo "#define CONFIG_SLIRP 1" >> $config_h
1003
fi
1004
for card in $audio_card_list; do
1005
    def=CONFIG_`echo $card | tr [:lower:] [:upper:]`
1006
    echo "$def=yes" >> $config_mak
1007
    echo "#define $def 1" >> $config_h
1008
done
1009
echo "#define AUDIO_DRIVERS \\" >> $config_h
1010
for drv in $audio_drv_list; do
1011
    echo "    &${drv}_audio_driver, \\" >>$config_h
1012
    def=CONFIG_`echo $drv | tr [:lower:] [:upper:]`
1013
    echo "$def=yes" >> $config_mak
1014
    if test "$drv" == "fmod"; then
1015
        echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1016
        echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1017
    fi
1018
done
1019
echo "" >>$config_h
1020
if test "$mixemu" = "yes" ; then
1021
  echo "CONFIG_MIXEMU=yes" >> $config_mak
1022
  echo "#define CONFIG_MIXEMU 1" >> $config_h
1023
fi
1024
if test "$vnc_tls" = "yes" ; then
1025
  echo "CONFIG_VNC_TLS=yes" >> $config_mak
1026
  echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1027
  echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1028
  echo "#define CONFIG_VNC_TLS 1" >> $config_h
1029
fi
1030
qemu_version=`head $source_path/VERSION`
1031
echo "VERSION=$qemu_version" >>$config_mak
1032
echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1033

    
1034
echo "SRC_PATH=$source_path" >> $config_mak
1035
if [ "$source_path_used" = "yes" ]; then
1036
  echo "VPATH=$source_path" >> $config_mak
1037
fi
1038
echo "TARGET_DIRS=$target_list" >> $config_mak
1039
if [ "$build_docs" = "yes" ] ; then
1040
  echo "BUILD_DOCS=yes" >> $config_mak
1041
fi
1042
if test "$static" = "yes"; then
1043
  sdl1=$sdl_static
1044
else
1045
  sdl1=$sdl
1046
fi
1047
if test "$sdl1" = "yes" ; then
1048
  echo "#define CONFIG_SDL 1" >> $config_h
1049
  echo "CONFIG_SDL=yes" >> $config_mak
1050
  if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1051
    echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1052
  else
1053
    echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1054
  fi
1055
  if [ "${aa}" = "yes" ] ; then
1056
    echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1057
  else
1058
    echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1059
  fi
1060
fi
1061
if test "$cocoa" = "yes" ; then
1062
  echo "#define CONFIG_COCOA 1" >> $config_h
1063
  echo "CONFIG_COCOA=yes" >> $config_mak
1064
fi
1065
if test "$curses" = "yes" ; then
1066
  echo "#define CONFIG_CURSES 1" >> $config_h
1067
  echo "CONFIG_CURSES=yes" >> $config_mak
1068
  echo "CURSES_LIBS=-lcurses" >> $config_mak
1069
fi
1070
if test "$brlapi" = "yes" ; then
1071
  echo "CONFIG_BRLAPI=yes" >> $config_mak
1072
  echo "#define CONFIG_BRLAPI 1" >> $config_h
1073
  echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1074
fi
1075

    
1076
# XXX: suppress that
1077
if [ "$bsd" = "yes" ] ; then
1078
  echo "#define O_LARGEFILE 0" >> $config_h
1079
  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1080
  echo "#define _BSD 1" >> $config_h
1081
fi
1082

    
1083
echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1084

    
1085
tools=
1086
if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1087
  tools="qemu-img\$(EXESUF) $tools"
1088
  if [ "$linux" = "yes" ] ; then
1089
      tools="qemu-nbd\$(EXESUF) $tools"
1090
  fi
1091
fi
1092
echo "TOOLS=$tools" >> $config_mak
1093

    
1094
test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1095

    
1096
for target in $target_list; do
1097
target_dir="$target"
1098
config_mak=$target_dir/config.mak
1099
config_h=$target_dir/config.h
1100
target_cpu=`echo $target | cut -d '-' -f 1`
1101
target_bigendian="no"
1102
[ "$target_cpu" = "armeb" ] && target_bigendian=yes
1103
[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1104
[ "$target_cpu" = "mips" ] && target_bigendian=yes
1105
[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1106
[ "$target_cpu" = "mips64" ] && target_bigendian=yes
1107
[ "$target_cpu" = "ppc" ] && target_bigendian=yes
1108
[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1109
[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1110
[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1111
[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1112
[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1113
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1114
[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1115
target_softmmu="no"
1116
target_user_only="no"
1117
target_linux_user="no"
1118
target_darwin_user="no"
1119
case "$target" in
1120
  ${target_cpu}-softmmu)
1121
    target_softmmu="yes"
1122
    ;;
1123
  ${target_cpu}-linux-user)
1124
    target_user_only="yes"
1125
    target_linux_user="yes"
1126
    ;;
1127
  ${target_cpu}-darwin-user)
1128
    target_user_only="yes"
1129
    target_darwin_user="yes"
1130
    ;;
1131
  *)
1132
    echo "ERROR: Target '$target' not recognised"
1133
    exit 1
1134
    ;;
1135
esac
1136

    
1137
if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1138
        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1139
    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1140
    echo "To build QEMU without graphical output configure with --disable-gfx-check"
1141
    echo "Note that this will disable all output from the virtual graphics card"
1142
    echo "except through VNC or curses."
1143
    exit 1;
1144
fi
1145

    
1146
#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1147

    
1148
test -f $config_h && mv $config_h ${config_h}~
1149

    
1150
mkdir -p $target_dir
1151
mkdir -p $target_dir/fpu
1152
mkdir -p $target_dir/tcg
1153
if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
1154
  mkdir -p $target_dir/nwfpe
1155
fi
1156

    
1157
#
1158
# don't use ln -sf as not all "ln -sf" over write the file/link
1159
#
1160
rm -f $target_dir/Makefile
1161
ln -s $source_path/Makefile.target $target_dir/Makefile
1162

    
1163

    
1164
echo "# Automatically generated by configure - do not modify" > $config_mak
1165
echo "/* Automatically generated by configure - do not modify */" > $config_h
1166

    
1167

    
1168
echo "include ../config-host.mak" >> $config_mak
1169
echo "#include \"../config-host.h\"" >> $config_h
1170

    
1171
bflt="no"
1172
elfload32="no"
1173
target_nptl="no"
1174
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1175
echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1176

    
1177
case "$target_cpu" in
1178
  i386)
1179
    echo "TARGET_ARCH=i386" >> $config_mak
1180
    echo "#define TARGET_ARCH \"i386\"" >> $config_h
1181
    echo "#define TARGET_I386 1" >> $config_h
1182
    if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1183
    then
1184
      echo "#define USE_KQEMU 1" >> $config_h
1185
    fi
1186
    gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
1187
    if test -n "$gcc3minver" && test $gcc3minver -gt 3
1188
    then
1189
      echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1190
    else
1191
      echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1192
    fi
1193
  ;;
1194
  x86_64)
1195
    echo "TARGET_ARCH=x86_64" >> $config_mak
1196
    echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1197
    echo "#define TARGET_I386 1" >> $config_h
1198
    echo "#define TARGET_X86_64 1" >> $config_h
1199
    if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1200
    then
1201
      echo "#define USE_KQEMU 1" >> $config_h
1202
    fi
1203
  ;;
1204
  alpha)
1205
    echo "TARGET_ARCH=alpha" >> $config_mak
1206
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1207
    echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1208
    echo "#define TARGET_ALPHA 1" >> $config_h
1209
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1210
  ;;
1211
  arm|armeb)
1212
    echo "TARGET_ARCH=arm" >> $config_mak
1213
    echo "#define TARGET_ARCH \"arm\"" >> $config_h
1214
    echo "#define TARGET_ARM 1" >> $config_h
1215
    bflt="yes"
1216
    target_nptl="yes"
1217
  ;;
1218
  cris)
1219
    echo "TARGET_ARCH=cris" >> $config_mak
1220
    echo "#define TARGET_ARCH \"cris\"" >> $config_h
1221
    echo "#define TARGET_CRIS 1" >> $config_h
1222
  ;;
1223
  m68k)
1224
    echo "TARGET_ARCH=m68k" >> $config_mak
1225
    echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1226
    echo "#define TARGET_M68K 1" >> $config_h
1227
    bflt="yes"
1228
  ;;
1229
  mips|mipsel)
1230
    echo "TARGET_ARCH=mips" >> $config_mak
1231
    echo "#define TARGET_ARCH \"mips\"" >> $config_h
1232
    echo "#define TARGET_MIPS 1" >> $config_h
1233
    echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1234
  ;;
1235
  mipsn32|mipsn32el)
1236
    echo "TARGET_ARCH=mipsn32" >> $config_mak
1237
    echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1238
    echo "#define TARGET_MIPS 1" >> $config_h
1239
    echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1240
  ;;
1241
  mips64|mips64el)
1242
    echo "TARGET_ARCH=mips64" >> $config_mak
1243
    echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1244
    echo "#define TARGET_MIPS 1" >> $config_h
1245
    echo "#define TARGET_MIPS64 1" >> $config_h
1246
    echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1247
  ;;
1248
  ppc)
1249
    echo "TARGET_ARCH=ppc" >> $config_mak
1250
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1251
    echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1252
    echo "#define TARGET_PPC 1" >> $config_h
1253
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1254
  ;;
1255
  ppcemb)
1256
    echo "TARGET_ARCH=ppcemb" >> $config_mak
1257
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
1258
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1259
    echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1260
    echo "#define TARGET_PPC 1" >> $config_h
1261
    echo "#define TARGET_PPCEMB 1" >> $config_h
1262
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1263
  ;;
1264
  ppc64)
1265
    echo "TARGET_ARCH=ppc64" >> $config_mak
1266
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
1267
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1268
    echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1269
    echo "#define TARGET_PPC 1" >> $config_h
1270
    echo "#define TARGET_PPC64 1" >> $config_h
1271
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1272
  ;;
1273
  ppc64abi32)
1274
    echo "TARGET_ARCH=ppc64" >> $config_mak
1275
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
1276
    echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1277
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1278
    echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1279
    echo "#define TARGET_PPC 1" >> $config_h
1280
    echo "#define TARGET_PPC64 1" >> $config_h
1281
    echo "#define TARGET_ABI32 1" >> $config_h
1282
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1283
  ;;
1284
  sh4|sh4eb)
1285
    echo "TARGET_ARCH=sh4" >> $config_mak
1286
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1287
    echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1288
    echo "#define TARGET_SH4 1" >> $config_h
1289
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1290
    bflt="yes"
1291
  ;;
1292
  sparc)
1293
    echo "TARGET_ARCH=sparc" >> $config_mak
1294
    echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1295
    echo "#define TARGET_SPARC 1" >> $config_h
1296
  ;;
1297
  sparc64)
1298
    echo "TARGET_ARCH=sparc64" >> $config_mak
1299
    echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1300
    echo "#define TARGET_SPARC 1" >> $config_h
1301
    echo "#define TARGET_SPARC64 1" >> $config_h
1302
    elfload32="yes"
1303
  ;;
1304
  sparc32plus)
1305
    echo "TARGET_ARCH=sparc64" >> $config_mak
1306
    echo "TARGET_ABI_DIR=sparc" >> $config_mak
1307
    echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1308
    echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1309
    echo "#define TARGET_SPARC 1" >> $config_h
1310
    echo "#define TARGET_SPARC64 1" >> $config_h
1311
    echo "#define TARGET_ABI32 1" >> $config_h
1312
  ;;
1313
  *)
1314
    echo "Unsupported target CPU"
1315
    exit 1
1316
  ;;
1317
esac
1318
if test "$target_bigendian" = "yes" ; then
1319
  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1320
  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1321
fi
1322
if test "$target_softmmu" = "yes" ; then
1323
  echo "CONFIG_SOFTMMU=yes" >> $config_mak
1324
  echo "#define CONFIG_SOFTMMU 1" >> $config_h
1325
fi
1326
if test "$target_user_only" = "yes" ; then
1327
  echo "CONFIG_USER_ONLY=yes" >> $config_mak
1328
  echo "#define CONFIG_USER_ONLY 1" >> $config_h
1329
fi
1330
if test "$target_linux_user" = "yes" ; then
1331
  echo "CONFIG_LINUX_USER=yes" >> $config_mak
1332
  echo "#define CONFIG_LINUX_USER 1" >> $config_h
1333
fi
1334
if test "$target_darwin_user" = "yes" ; then
1335
  echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1336
  echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1337
fi
1338

    
1339
if test "$target_cpu" = "arm" \
1340
     -o "$target_cpu" = "armeb" \
1341
     -o "$target_cpu" = "m68k" \
1342
     -o "$target_cpu" = "mips" \
1343
     -o "$target_cpu" = "mipsel" \
1344
     -o "$target_cpu" = "mipsn32" \
1345
     -o "$target_cpu" = "mipsn32el" \
1346
     -o "$target_cpu" = "mips64" \
1347
     -o "$target_cpu" = "mips64el" \
1348
     -o "$target_cpu" = "sparc" \
1349
     -o "$target_cpu" = "sparc64" \
1350
     -o "$target_cpu" = "sparc32plus"; then
1351
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1352
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1353
fi
1354
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1355
  echo "TARGET_HAS_BFLT=yes" >> $config_mak
1356
  echo "#define TARGET_HAS_BFLT 1" >> $config_h
1357
fi
1358
if test "$target_user_only" = "yes" \
1359
        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1360
  echo "#define USE_NPTL 1" >> $config_h
1361
fi
1362
# 32 bit ELF loader in addition to native 64 bit loader?
1363
if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1364
  echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1365
  echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1366
fi
1367

    
1368
test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1369

    
1370
done # for target in $targets
1371

    
1372
# build tree in object directory if source path is different from current one
1373
if test "$source_path_used" = "yes" ; then
1374
    DIRS="tests tests/cris slirp audio"
1375
    FILES="Makefile tests/Makefile"
1376
    FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1377
    FILES="$FILES tests/test-mmap.c"
1378
    for dir in $DIRS ; do
1379
            mkdir -p $dir
1380
    done
1381
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
1382
    for f in $FILES ; do
1383
        rm -f $f
1384
        ln -s $source_path/$f $f
1385
    done
1386
fi
1387

    
1388
rm -f $TMPO $TMPC $TMPE $TMPS