Statistics
| Branch: | Revision:

root / configure @ 831b7825

History | View | Annotate | Download (26.8 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 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
27
host_cc="gcc"
28
ar="ar"
29
make="make"
30
install="install"
31
strip="strip"
32
cpu=`uname -m`
33
target_list=""
34
case "$cpu" in
35
  i386|i486|i586|i686|i86pc|BePC)
36
    cpu="i386"
37
  ;;
38
  armv*b)
39
    cpu="armv4b"
40
  ;;
41
  armv*l)
42
    cpu="armv4l"
43
  ;;
44
  alpha)
45
    cpu="alpha"
46
  ;;
47
  "Power Macintosh"|ppc|ppc64)
48
    cpu="powerpc"
49
  ;;
50
  mips)
51
    cpu="mips"
52
  ;;
53
  s390)
54
    cpu="s390"
55
  ;;
56
  sparc|sun4[muv])
57
    cpu="sparc"
58
  ;;
59
  sparc64)
60
    cpu="sparc64"
61
  ;;
62
  ia64)
63
    cpu="ia64"
64
  ;;
65
  m68k)
66
    cpu="m68k"
67
  ;;
68
  x86_64|amd64)
69
    cpu="x86_64"
70
  ;;
71
  *)
72
    cpu="unknown"
73
  ;;
74
esac
75
gprof="no"
76
bigendian="no"
77
mingw32="no"
78
EXESUF=""
79
gdbstub="yes"
80
slirp="yes"
81
adlib="no"
82
oss="no"
83
dsound="no"
84
coreaudio="no"
85
alsa="no"
86
fmod="no"
87
fmod_lib=""
88
fmod_inc=""
89
bsd="no"
90
linux="no"
91
kqemu="no"
92
profiler="no"
93
cocoa="no"
94
check_gfx="yes"
95
check_gcc="yes"
96
softmmu="yes"
97
linux_user="no"
98
darwin_user="no"
99
build_docs="no"
100
uname_release=""
101

    
102
# OS specific
103
targetos=`uname -s`
104
case $targetos in
105
CYGWIN*)
106
mingw32="yes"
107
OS_CFLAGS="-mno-cygwin"
108
;;
109
MINGW32*)
110
mingw32="yes"
111
;;
112
FreeBSD)
113
bsd="yes"
114
oss="yes"
115
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
116
    kqemu="yes"
117
fi
118
;;
119
NetBSD)
120
bsd="yes"
121
oss="yes"
122
;;
123
OpenBSD)
124
bsd="yes"
125
oss="yes"
126
;;
127
Darwin)
128
bsd="yes"
129
darwin="yes"
130
darwin_user="yes"
131
OS_CFLAGS="-mdynamic-no-pic"
132
;;
133
SunOS)
134
solaris="yes"
135
;;
136
*)
137
oss="yes"
138
linux="yes"
139
linux_user="yes"
140
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
141
    kqemu="yes"
142
fi
143
;;
144
esac
145

    
146
if [ "$bsd" = "yes" ] ; then
147
  if [ "$darwin" != "yes" ] ; then
148
    make="gmake"
149
  fi
150
fi
151

    
152
if [ "$solaris" = "yes" ] ; then
153
    make="gmake"
154
    install="ginstall"
155
    solarisrev=`uname -r | cut -f2 -d.`
156
    if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
157
        if test "$solarisrev" -gt 10 ; then
158
            kqemu="yes"
159
        fi
160
    fi
161
fi
162

    
163
# find source path
164
source_path=`dirname "$0"`
165
if [ -z "$source_path" ]; then
166
    source_path=`pwd`
167
else
168
    source_path=`cd "$source_path"; pwd`
169
fi
170
if test "$source_path" = `pwd` ; then
171
    source_path_used="no"
172
else
173
    source_path_used="yes"
174
fi
175

    
176
for opt do
177
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
178
  case "$opt" in
179
  --help|-h) show_help=yes
180
  ;;
181
  --prefix=*) prefix="$optarg"
182
  ;;
183
  --interp-prefix=*) interp_prefix="$optarg"
184
  ;;
185
  --source-path=*) source_path="$optarg"
186
  source_path_used="yes"
187
  ;;
188
  --cross-prefix=*) cross_prefix="$optarg"
189
  ;;
190
  --cc=*) cc="$optarg"
191
  gcc3_search="no"
192
  ;;
193
  --host-cc=*) host_cc="$optarg"
194
  ;;
195
  --make=*) make="$optarg"
196
  ;;
197
  --install=*) install="$optarg"
198
  ;;
199
  --extra-cflags=*) CFLAGS="$optarg"
200
  ;;
201
  --extra-ldflags=*) LDFLAGS="$optarg"
202
  ;;
203
  --cpu=*) cpu="$optarg"
204
  ;;
205
  --target-list=*) target_list="$optarg"
206
  ;;
207
  --enable-gprof) gprof="yes"
208
  ;;
209
  --static) static="yes"
210
  ;;
211
  --disable-sdl) sdl="no"
212
  ;;
213
  --enable-coreaudio) coreaudio="yes"
214
  ;;
215
  --enable-alsa) alsa="yes"
216
  ;;
217
  --enable-dsound) dsound="yes"
218
  ;;
219
  --enable-fmod) fmod="yes"
220
  ;;
221
  --fmod-lib=*) fmod_lib="$optarg"
222
  ;;
223
  --fmod-inc=*) fmod_inc="$optarg"
224
  ;;
225
  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no"
226
  ;;
227
  --disable-slirp) slirp="no"
228
  ;;
229
  --enable-adlib) adlib="yes"
230
  ;;
231
  --disable-kqemu) kqemu="no"
232
  ;;
233
  --enable-profiler) profiler="yes"
234
  ;;
235
  --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
236
  ;;
237
  --disable-gfx-check) check_gfx="no"
238
  ;;
239
  --disable-gcc-check) check_gcc="no"
240
  ;;
241
  --disable-system) softmmu="no"
242
  ;;
243
  --enable-system) softmmu="yes"
244
  ;;
245
  --disable-linux-user) linux_user="no"
246
  ;;
247
  --enable-linux-user) linux_user="yes"
248
  ;;
249
  --disable-darwin-user) darwin_user="no"
250
  ;;
251
  --enable-darwin-user) darwin_user="yes"
252
  ;;
253
  --enable-uname-release=*) uname_release="$optarg"
254
  ;;
255
  esac
256
done
257

    
258
# default flags for all hosts
259
CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
260
LDFLAGS="$LDFLAGS -g"
261

    
262
if test x"$show_help" = x"yes" ; then
263
cat << EOF
264

    
265
Usage: configure [options]
266
Options: [defaults in brackets after descriptions]
267

    
268
EOF
269
echo "Standard options:"
270
echo "  --help                   print this message"
271
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
272
echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
273
echo "                           use %M for cpu name [$interp_prefix]"
274
echo "  --target-list=LIST       set target list [$target_list]"
275
echo ""
276
echo "kqemu kernel acceleration support:"
277
echo "  --disable-kqemu          disable kqemu support"
278
echo ""
279
echo "Advanced options (experts only):"
280
echo "  --source-path=PATH       path of source code [$source_path]"
281
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
282
echo "  --cc=CC                  use C compiler CC [$cc]"
283
echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
284
echo "  --make=MAKE              use specified make [$make]"
285
echo "  --install=INSTALL        use specified install [$install]"
286
echo "  --static                 enable static build [$static]"
287
echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
288
echo "  --enable-mingw32         enable Win32 cross compilation with mingw32"
289
echo "  --enable-adlib           enable Adlib emulation"
290
echo "  --enable-coreaudio       enable Coreaudio audio driver"
291
echo "  --enable-alsa            enable ALSA audio driver"
292
echo "  --enable-fmod            enable FMOD audio driver"
293
echo "  --enabled-dsound         enable DirectSound audio driver"
294
echo "  --enable-system          enable all system emulation targets"
295
echo "  --disable-system         disable all system emulation targets"
296
echo "  --enable-linux-user      enable all linux usermode emulation targets"
297
echo "  --disable-linux-user     disable all linux usermode emulation targets"
298
echo "  --enable-darwin-user     enable all darwin usermode emulation targets"
299
echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
300
echo "  --fmod-lib               path to FMOD library"
301
echo "  --fmod-inc               path to FMOD includes"
302
echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
303
echo ""
304
echo "NOTE: The object files are built at the place where configure is launched"
305
exit 1
306
fi
307

    
308
cc="${cross_prefix}${cc}"
309
ar="${cross_prefix}${ar}"
310
strip="${cross_prefix}${strip}"
311

    
312
# check that the C compiler works.
313
cat > $TMPC <<EOF
314
int main(void) {}
315
EOF
316

    
317
if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
318
  : C compiler works ok
319
else
320
    echo "ERROR: \"$cc\" either does not exist or does not work"
321
    exit 1
322
fi
323

    
324
if test "$mingw32" = "yes" ; then
325
    linux="no"
326
    EXESUF=".exe"
327
    oss="no"
328
    if [ "$cpu" = "i386" ] ; then
329
        kqemu="yes"
330
    fi
331
fi
332

    
333
# Check for gcc4, error if pre-gcc4 
334
if test "$check_gcc" = "yes" ; then
335
    cat > $TMPC <<EOF
336
#if __GNUC__ < 4
337
#error gcc3
338
#endif
339
int main(){return 0;}
340
EOF
341
    check_cc() {
342
	which "$1" >&/dev/null
343
	return $?
344
    }
345

    
346
    if "$cc" -o $TMPE $TMPC 2>/dev/null ; then
347
	echo "WARNING: \"$cc\" looks like gcc 4.x"
348
	found_compat_cc="no"
349
	if test "$gcc3_search" = "yes" ; then
350
	    echo "Looking for gcc 3.x"
351
	    for compat_cc in $gcc3_list ; do
352
		if check_cc "$compat_cc" ; then
353
		    echo "Found \"$compat_cc\""
354
		    cc="$compat_cc"
355
		    found_compat_cc="yes"
356
		    break
357
		fi
358
	    done
359
	    if test "$found_compat_cc" = "no" ; then
360
		echo "gcc 3.x not found!"
361
	    fi
362
	fi
363
	if test "$found_compat_cc" = "no" ; then
364
	    echo "QEMU is known to have problems when compiled with gcc 4.x"
365
	    echo "It is recommended that you use gcc 3.x to build QEMU"
366
	    echo "To use this compiler anyway, configure with --disable-gcc-check"
367
	    exit 1;
368
	fi
369
    fi
370
fi
371

    
372
#
373
# Solaris specific configure tool chain decisions
374
#
375
if test "$solaris" = "yes" ; then
376
  #
377
  # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
378
  # override the check with --disable-gcc-check
379
  # 
380
  if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
381
    solgcc=`which $cc`
382
    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
383
      echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
384
      echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
385
      echo "or get the latest patch from SunSolve for gcc"
386
      exit 1
387
    fi
388
  fi
389
  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
390
  if test -z "$solinst" ; then
391
    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
392
    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
393
    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
394
    exit 1
395
  fi
396
  if test "$solinst" = "/usr/sbin/install" ; then
397
    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
398
    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
399
    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
400
    exit 1
401
  fi
402
  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
403
  if test -z "$sol_ar" ; then
404
    echo "Error: No path includes ar"
405
    if test -f /usr/ccs/bin/ar ; then
406
      echo "Add /usr/ccs/bin to your path and rerun configure"
407
    fi
408
    exit 1
409
  fi
410
fi 
411

    
412

    
413
if test -z "$target_list" ; then
414
# these targets are portable
415
    if [ "$softmmu" = "yes" ] ; then
416
        target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
417
    fi
418
# the following are Linux specific
419
    if [ "$linux_user" = "yes" ] ; then
420
        target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user ppc-linux-user mips-linux-user mipsel-linux-user m68k-linux-user $target_list"
421
    fi
422
# the following are Darwin specific
423
    if [ "$darwin_user" = "yes" ] ; then
424
        target_list="i386-darwin-user ppc-darwin-user $target_list"
425
    fi
426
else
427
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
428
fi
429
if test -z "$target_list" ; then
430
    echo "No targets enabled"
431
    exit 1
432
fi
433

    
434
if test -z "$cross_prefix" ; then
435

    
436
# ---
437
# big/little endian test
438
cat > $TMPC << EOF
439
#include <inttypes.h>
440
int main(int argc, char ** argv){
441
        volatile uint32_t i=0x01234567;
442
        return (*((uint8_t*)(&i))) == 0x67;
443
}
444
EOF
445

    
446
if $cc -o $TMPE $TMPC 2>/dev/null ; then
447
$TMPE && bigendian="yes"
448
else
449
echo big/little test failed
450
fi
451

    
452
else
453

    
454
# if cross compiling, cannot launch a program, so make a static guess
455
if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
456
    bigendian="yes"
457
fi
458

    
459
fi
460

    
461
# host long bits test
462
hostlongbits="32"
463
if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
464
    hostlongbits="64"
465
fi
466

    
467
# check gcc options support
468
cat > $TMPC <<EOF
469
int main(void) {
470
}
471
EOF
472

    
473
have_gcc3_options="no"
474
if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
475
   have_gcc3_options="yes"
476
fi
477

    
478
##########################################
479
# SDL probe
480

    
481
sdl_too_old=no
482

    
483
if test -z "$sdl" ; then
484

    
485
sdl_config="sdl-config"
486
sdl=no
487
sdl_static=no
488

    
489
if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
490
# win32 cross compilation case
491
    sdl_config="i386-mingw32msvc-sdl-config"
492
    sdl=yes
493
else
494
# normal SDL probe
495
cat > $TMPC << EOF
496
#include <SDL.h>
497
#undef main /* We don't want SDL to override our main() */
498
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
499
EOF
500

    
501
if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
502
_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
503
if test "$_sdlversion" -lt 121 ; then
504
sdl_too_old=yes
505
else
506
sdl=yes
507
fi
508

    
509
# static link with sdl ?
510
if test "$sdl" = "yes" ; then
511
aa="no"
512
`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
513
sdl_static_libs=`$sdl_config --static-libs`
514
if [ "$aa" = "yes" ] ; then
515
  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
516
fi
517

    
518
if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
519
  sdl_static=yes
520
fi
521

    
522
fi # static link
523

    
524
fi # sdl compile test
525

    
526
fi # cross compilation
527
fi # -z $sdl
528

    
529
##########################################
530
# alsa sound support libraries
531

    
532
if test "$alsa" = "yes" ; then
533
  cat > $TMPC << EOF
534
#include <alsa/asoundlib.h>
535
int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
536
EOF
537
  if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
538
    :
539
  else
540
    echo
541
    echo "Error: Could not find alsa"
542
    echo "Make sure to have the alsa libs and headers installed."
543
    echo
544
    exit 1
545
  fi
546
fi
547

    
548
# Check if tools are available to build documentation.
549
if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
550
  build_docs="yes"
551
fi
552

    
553
if test "$mingw32" = "yes" ; then
554
if test -z "$prefix" ; then
555
    prefix="/c/Program Files/Qemu"
556
fi
557
mandir="$prefix"
558
datadir="$prefix"
559
docdir="$prefix"
560
bindir="$prefix"
561
else
562
if test -z "$prefix" ; then
563
    prefix="/usr/local"
564
fi
565
mandir="$prefix/share/man"
566
datadir="$prefix/share/qemu"
567
docdir="$prefix/share/doc/qemu"
568
bindir="$prefix/bin"
569
fi
570

    
571
echo "Install prefix    $prefix"
572
echo "BIOS directory    $datadir"
573
echo "binary directory  $bindir"
574
if test "$mingw32" = "no" ; then
575
echo "Manual directory  $mandir"
576
echo "ELF interp prefix $interp_prefix"
577
fi
578
echo "Source path       $source_path"
579
echo "C compiler        $cc"
580
echo "Host C compiler   $host_cc"
581
echo "make              $make"
582
echo "install           $install"
583
echo "host CPU          $cpu"
584
echo "host big endian   $bigendian"
585
echo "target list       $target_list"
586
echo "gprof enabled     $gprof"
587
echo "profiler          $profiler"
588
echo "static build      $static"
589
if test "$darwin" = "yes" ; then
590
    echo "Cocoa support     $cocoa"
591
fi
592
echo "SDL support       $sdl"
593
if test "$sdl" != "no" ; then
594
    echo "SDL static link   $sdl_static"
595
fi
596
echo "mingw32 support   $mingw32"
597
echo "Adlib support     $adlib"
598
echo "CoreAudio support $coreaudio"
599
echo "ALSA support      $alsa"
600
echo "DSound support    $dsound"
601
if test "$fmod" = "yes"; then
602
    if test -z $fmod_lib || test -z $fmod_inc; then
603
        echo
604
        echo "Error: You must specify path to FMOD library and headers"
605
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
606
        echo
607
        exit 1
608
    fi
609
    fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
610
else
611
    fmod_support=""
612
fi
613
echo "FMOD support      $fmod $fmod_support"
614
echo "kqemu support     $kqemu"
615
echo "Documentation     $build_docs"
616
[ ! -z "$uname_release" ] && \
617
echo "uname -r          $uname_release"
618

    
619
if test $sdl_too_old = "yes"; then
620
echo "-> Your SDL version is too old - please upgrade to have SDL support"
621
fi
622
#if test "$sdl_static" = "no"; then
623
#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
624
#fi
625
config_mak="config-host.mak"
626
config_h="config-host.h"
627

    
628
#echo "Creating $config_mak and $config_h"
629

    
630
echo "# Automatically generated by configure - do not modify" > $config_mak
631
echo "# Configured with: $0 $@" >> $config_mak
632
echo "/* Automatically generated by configure - do not modify */" > $config_h
633

    
634
echo "prefix=$prefix" >> $config_mak
635
echo "bindir=$bindir" >> $config_mak
636
echo "mandir=$mandir" >> $config_mak
637
echo "datadir=$datadir" >> $config_mak
638
echo "docdir=$docdir" >> $config_mak
639
echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
640
echo "MAKE=$make" >> $config_mak
641
echo "INSTALL=$install" >> $config_mak
642
echo "CC=$cc" >> $config_mak
643
if test "$have_gcc3_options" = "yes" ; then
644
  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
645
fi
646
echo "HOST_CC=$host_cc" >> $config_mak
647
echo "AR=$ar" >> $config_mak
648
echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
649
echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
650
echo "CFLAGS=$CFLAGS" >> $config_mak
651
echo "LDFLAGS=$LDFLAGS" >> $config_mak
652
echo "EXESUF=$EXESUF" >> $config_mak
653
if test "$cpu" = "i386" ; then
654
  echo "ARCH=i386" >> $config_mak
655
  echo "#define HOST_I386 1" >> $config_h
656
elif test "$cpu" = "x86_64" ; then
657
  echo "ARCH=x86_64" >> $config_mak
658
  echo "#define HOST_X86_64 1" >> $config_h
659
elif test "$cpu" = "armv4b" ; then
660
  echo "ARCH=arm" >> $config_mak
661
  echo "#define HOST_ARM 1" >> $config_h
662
elif test "$cpu" = "armv4l" ; then
663
  echo "ARCH=arm" >> $config_mak
664
  echo "#define HOST_ARM 1" >> $config_h
665
elif test "$cpu" = "powerpc" ; then
666
  echo "ARCH=ppc" >> $config_mak
667
  echo "#define HOST_PPC 1" >> $config_h
668
elif test "$cpu" = "mips" ; then
669
  echo "ARCH=mips" >> $config_mak
670
  echo "#define HOST_MIPS 1" >> $config_h
671
elif test "$cpu" = "s390" ; then
672
  echo "ARCH=s390" >> $config_mak
673
  echo "#define HOST_S390 1" >> $config_h
674
elif test "$cpu" = "alpha" ; then
675
  echo "ARCH=alpha" >> $config_mak
676
  echo "#define HOST_ALPHA 1" >> $config_h
677
elif test "$cpu" = "sparc" ; then
678
  echo "ARCH=sparc" >> $config_mak
679
  echo "#define HOST_SPARC 1" >> $config_h
680
elif test "$cpu" = "sparc64" ; then
681
  echo "ARCH=sparc64" >> $config_mak
682
  echo "#define HOST_SPARC64 1" >> $config_h
683
elif test "$cpu" = "ia64" ; then
684
  echo "ARCH=ia64" >> $config_mak
685
  echo "#define HOST_IA64 1" >> $config_h
686
elif test "$cpu" = "m68k" ; then
687
  echo "ARCH=m68k" >> $config_mak
688
  echo "#define HOST_M68K 1" >> $config_h
689
else
690
  echo "Unsupported CPU"
691
  exit 1
692
fi
693
if test "$bigendian" = "yes" ; then
694
  echo "WORDS_BIGENDIAN=yes" >> $config_mak
695
  echo "#define WORDS_BIGENDIAN 1" >> $config_h
696
fi
697
echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
698
if test "$mingw32" = "yes" ; then
699
  echo "CONFIG_WIN32=yes" >> $config_mak
700
  echo "#define CONFIG_WIN32 1" >> $config_h
701
elif test -f "/usr/include/byteswap.h" ; then
702
  echo "#define HAVE_BYTESWAP_H 1" >> $config_h
703
fi
704
if test "$darwin" = "yes" ; then
705
  echo "CONFIG_DARWIN=yes" >> $config_mak
706
  echo "#define CONFIG_DARWIN 1" >> $config_h
707
fi
708
if test "$solaris" = "yes" ; then
709
  echo "CONFIG_SOLARIS=yes" >> $config_mak
710
  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
711
fi
712
if test "$gdbstub" = "yes" ; then
713
  echo "CONFIG_GDBSTUB=yes" >> $config_mak
714
  echo "#define CONFIG_GDBSTUB 1" >> $config_h
715
fi
716
if test "$gprof" = "yes" ; then
717
  echo "TARGET_GPROF=yes" >> $config_mak
718
  echo "#define HAVE_GPROF 1" >> $config_h
719
fi
720
if test "$static" = "yes" ; then
721
  echo "CONFIG_STATIC=yes" >> $config_mak
722
  echo "#define CONFIG_STATIC 1" >> $config_h
723
fi
724
if test $profiler = "yes" ; then
725
  echo "#define CONFIG_PROFILER 1" >> $config_h
726
fi
727
if test "$slirp" = "yes" ; then
728
  echo "CONFIG_SLIRP=yes" >> $config_mak
729
  echo "#define CONFIG_SLIRP 1" >> $config_h
730
fi
731
if test "$adlib" = "yes" ; then
732
  echo "CONFIG_ADLIB=yes" >> $config_mak
733
  echo "#define CONFIG_ADLIB 1" >> $config_h
734
fi
735
if test "$oss" = "yes" ; then
736
  echo "CONFIG_OSS=yes" >> $config_mak
737
  echo "#define CONFIG_OSS 1" >> $config_h
738
fi
739
if test "$coreaudio" = "yes" ; then
740
  echo "CONFIG_COREAUDIO=yes" >> $config_mak
741
  echo "#define CONFIG_COREAUDIO 1" >> $config_h
742
fi
743
if test "$alsa" = "yes" ; then
744
  echo "CONFIG_ALSA=yes" >> $config_mak
745
  echo "#define CONFIG_ALSA 1" >> $config_h
746
fi
747
if test "$dsound" = "yes" ; then
748
  echo "CONFIG_DSOUND=yes" >> $config_mak
749
  echo "#define CONFIG_DSOUND 1" >> $config_h
750
fi
751
if test "$fmod" = "yes" ; then
752
  echo "CONFIG_FMOD=yes" >> $config_mak
753
  echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
754
  echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
755
  echo "#define CONFIG_FMOD 1" >> $config_h
756
fi
757
qemu_version=`head $source_path/VERSION`
758
echo "VERSION=$qemu_version" >>$config_mak
759
echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
760

    
761
echo "SRC_PATH=$source_path" >> $config_mak
762
if [ "$source_path_used" = "yes" ]; then
763
  echo "VPATH=$source_path" >> $config_mak
764
fi
765
echo "TARGET_DIRS=$target_list" >> $config_mak
766
if [ "$build_docs" = "yes" ] ; then
767
  echo "BUILD_DOCS=yes" >> $config_mak
768
fi
769

    
770
# XXX: suppress that
771
if [ "$bsd" = "yes" ] ; then
772
  echo "#define O_LARGEFILE 0" >> $config_h
773
  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
774
  echo "#define _BSD 1" >> $config_h
775
fi
776

    
777
echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
778

    
779
for target in $target_list; do
780
target_dir="$target"
781
config_mak=$target_dir/config.mak
782
config_h=$target_dir/config.h
783
target_cpu=`echo $target | cut -d '-' -f 1`
784
target_bigendian="no"
785
[ "$target_cpu" = "armeb" ] && target_bigendian=yes
786
[ "$target_cpu" = "sparc" ] && target_bigendian=yes
787
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
788
[ "$target_cpu" = "ppc" ] && target_bigendian=yes
789
[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
790
[ "$target_cpu" = "mips" ] && target_bigendian=yes
791
[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
792
[ "$target_cpu" = "m68k" ] && target_bigendian=yes
793
target_softmmu="no"
794
if expr $target : '.*-softmmu' > /dev/null ; then
795
  target_softmmu="yes"
796
fi
797
target_user_only="no"
798
if expr $target : '.*-user' > /dev/null ; then
799
  target_user_only="yes"
800
fi
801

    
802
target_linux_user="no"
803
if expr $target : '.*-linux-user' > /dev/null ; then
804
  target_linux_user="yes"
805
fi
806

    
807
target_darwin_user="no"
808
if expr $target : '.*-darwin-user' > /dev/null ; then
809
  target_darwin_user="yes"
810
fi
811

    
812
if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
813
        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
814
    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
815
    echo "To build QEMU without graphical output configure with --disable-gfx-check"
816
    echo "Note that this will disable all output from the virtual graphics card."
817
    exit 1;
818
fi
819

    
820
#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
821

    
822
mkdir -p $target_dir
823
mkdir -p $target_dir/fpu
824
if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
825
  mkdir -p $target_dir/nwfpe
826
fi
827
if test "$target_user_only" = "no" ; then
828
  mkdir -p $target_dir/slirp
829
fi
830

    
831
#
832
# don't use ln -sf as not all "ln -sf" over write the file/link
833
#
834
rm -f $target_dir/Makefile
835
ln -s $source_path/Makefile.target $target_dir/Makefile
836

    
837

    
838
echo "# Automatically generated by configure - do not modify" > $config_mak
839
echo "/* Automatically generated by configure - do not modify */" > $config_h
840

    
841

    
842
echo "include ../config-host.mak" >> $config_mak
843
echo "#include \"../config-host.h\"" >> $config_h
844

    
845
bflt="no"
846
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
847
echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
848

    
849
if test "$target_cpu" = "i386" ; then
850
  echo "TARGET_ARCH=i386" >> $config_mak
851
  echo "#define TARGET_ARCH \"i386\"" >> $config_h
852
  echo "#define TARGET_I386 1" >> $config_h
853
  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
854
    echo "#define USE_KQEMU 1" >> $config_h
855
  fi
856
elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
857
  echo "TARGET_ARCH=arm" >> $config_mak
858
  echo "#define TARGET_ARCH \"arm\"" >> $config_h
859
  echo "#define TARGET_ARM 1" >> $config_h
860
  bflt="yes"
861
elif test "$target_cpu" = "sparc" ; then
862
  echo "TARGET_ARCH=sparc" >> $config_mak
863
  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
864
  echo "#define TARGET_SPARC 1" >> $config_h
865
elif test "$target_cpu" = "sparc64" ; then
866
  echo "TARGET_ARCH=sparc64" >> $config_mak
867
  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
868
  echo "#define TARGET_SPARC 1" >> $config_h
869
  echo "#define TARGET_SPARC64 1" >> $config_h
870
elif test "$target_cpu" = "ppc" ; then
871
  echo "TARGET_ARCH=ppc" >> $config_mak
872
  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
873
  echo "#define TARGET_PPC 1" >> $config_h
874
elif test "$target_cpu" = "ppc64" ; then
875
  echo "TARGET_ARCH=ppc64" >> $config_mak
876
  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
877
  echo "#define TARGET_PPC 1" >> $config_h
878
  echo "#define TARGET_PPC64 1" >> $config_h
879
elif test "$target_cpu" = "x86_64" ; then
880
  echo "TARGET_ARCH=x86_64" >> $config_mak
881
  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
882
  echo "#define TARGET_I386 1" >> $config_h
883
  echo "#define TARGET_X86_64 1" >> $config_h
884
  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
885
    echo "#define USE_KQEMU 1" >> $config_h
886
  fi
887
elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
888
  echo "TARGET_ARCH=mips" >> $config_mak
889
  echo "#define TARGET_ARCH \"mips\"" >> $config_h
890
  echo "#define TARGET_MIPS 1" >> $config_h
891
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
892
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
893
elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
894
  echo "TARGET_ARCH=sh4" >> $config_mak
895
  echo "#define TARGET_ARCH \"sh4\"" >> $config_h
896
  echo "#define TARGET_SH4 1" >> $config_h
897
  bflt="yes"
898
elif test "$target_cpu" = "m68k" ; then
899
  echo "TARGET_ARCH=m68k" >> $config_mak
900
  echo "#define TARGET_ARCH \"m68k\"" >> $config_h
901
  echo "#define TARGET_M68K 1" >> $config_h
902
  bflt="yes"
903
else
904
  echo "Unsupported target CPU"
905
  exit 1
906
fi
907
if test "$target_bigendian" = "yes" ; then
908
  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
909
  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
910
fi
911
if test "$target_softmmu" = "yes" ; then
912
  echo "CONFIG_SOFTMMU=yes" >> $config_mak
913
  echo "#define CONFIG_SOFTMMU 1" >> $config_h
914
fi
915
if test "$target_user_only" = "yes" ; then
916
  echo "CONFIG_USER_ONLY=yes" >> $config_mak
917
  echo "#define CONFIG_USER_ONLY 1" >> $config_h
918
fi
919
if test "$target_linux_user" = "yes" ; then
920
  echo "CONFIG_LINUX_USER=yes" >> $config_mak
921
  echo "#define CONFIG_LINUX_USER 1" >> $config_h
922
fi
923
if test "$target_darwin_user" = "yes" ; then
924
  echo "CONFIG_DARWIN_USER=yes" >> $config_mak
925
  echo "#define CONFIG_DARWIN_USER 1" >> $config_h
926
fi
927

    
928
if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
929
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
930
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
931
fi
932
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
933
  echo "TARGET_HAS_BFLT=yes" >> $config_mak
934
  echo "#define TARGET_HAS_BFLT 1" >> $config_h
935
fi
936
# sdl defines
937

    
938
if test "$target_user_only" = "no"; then
939
    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
940
        sdl1=$sdl_static
941
    else
942
        sdl1=$sdl
943
    fi
944
    if test "$sdl1" = "yes" ; then
945
        echo "#define CONFIG_SDL 1" >> $config_h
946
        echo "CONFIG_SDL=yes" >> $config_mak
947
        if test "$target_softmmu" = "no" -o "$static" = "yes"; then
948
            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
949
        else
950
            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
951
        fi
952
        if [ "${aa}" = "yes" ] ; then
953
            echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
954
        else
955
            echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
956
        fi
957
    fi
958
fi
959

    
960
if test "$cocoa" = "yes" ; then
961
    echo "#define CONFIG_COCOA 1" >> $config_h
962
    echo "CONFIG_COCOA=yes" >> $config_mak
963
fi
964

    
965
done # for target in $targets
966

    
967
# build tree in object directory if source path is different from current one
968
if test "$source_path_used" = "yes" ; then
969
    DIRS="tests"
970
    FILES="Makefile tests/Makefile"
971
    for dir in $DIRS ; do
972
            mkdir -p $dir
973
    done
974
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
975
    for f in $FILES ; do
976
        rm -f $f
977
        ln -s $source_path/$f $f
978
    done
979
fi
980

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