Statistics
| Branch: | Revision:

root / configure @ 65ce8c2f

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

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

    
143
if [ "$bsd" = "yes" ] ; then
144
  if [ "$darwin" != "yes" ] ; then
145
    make="gmake"
146
  fi
147
fi
148

    
149
if [ "$solaris" = "yes" ] ; then
150
    make="gmake"
151
    install="ginstall"
152
    solarisrev=`uname -r | cut -f2 -d.`
153
fi
154

    
155
# find source path
156
source_path=`dirname "$0"`
157
if [ -z "$source_path" ]; then
158
    source_path=`pwd`
159
else
160
    source_path=`cd "$source_path"; pwd`
161
fi
162
if test "$source_path" = `pwd` ; then
163
    source_path_used="no"
164
else
165
    source_path_used="yes"
166
fi
167

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

    
249
# Checking for CFLAGS
250
if test -z "$CFLAGS"; then
251
    CFLAGS="-O2"
252
fi
253

    
254
if test x"$show_help" = x"yes" ; then
255
cat << EOF
256

    
257
Usage: configure [options]
258
Options: [defaults in brackets after descriptions]
259

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

    
300
cc="${cross_prefix}${cc}"
301
ar="${cross_prefix}${ar}"
302
strip="${cross_prefix}${strip}"
303

    
304
# check that the C compiler works.
305
cat > $TMPC <<EOF
306
int main(void) {}
307
EOF
308

    
309
if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
310
  : C compiler works ok
311
else
312
    echo "ERROR: \"$cc\" either does not exist or does not work"
313
    exit 1
314
fi
315

    
316
if test "$mingw32" = "yes" ; then
317
    linux="no"
318
    EXESUF=".exe"
319
    oss="no"
320
    if [ "$cpu" = "i386" ] ; then
321
        kqemu="yes"
322
    fi
323
fi
324

    
325
#
326
# Solaris specific configure tool chain decisions
327
#
328
if test "$solaris" = "yes" ; then
329
  #
330
  # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
331
  # override the check with --disable-gcc-check
332
  # 
333
  if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
334
    solgcc=`which $cc`
335
    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
336
      echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
337
      echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
338
      echo "or get the latest patch from SunSolve for gcc"
339
      exit 1
340
    fi
341
  fi
342
  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
343
  if test -z "$solinst" ; then
344
    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
345
    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
346
    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
347
    exit 1
348
  fi
349
  if test "$solinst" = "/usr/sbin/install" ; then
350
    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
351
    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
352
    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
353
    exit 1
354
  fi
355
  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
356
  if test -z "$sol_ar" ; then
357
    echo "Error: No path includes ar"
358
    if test -f /usr/ccs/bin/ar ; then
359
      echo "Add /usr/ccs/bin to your path and rerun configure"
360
    fi
361
    exit 1
362
  fi
363
fi 
364

    
365

    
366
if test -z "$target_list" ; then
367
# these targets are portable
368
    if [ "$softmmu" = "yes" ] ; then
369
        target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
370
    fi
371
# the following are Linux specific
372
    if [ "$user" = "yes" ] ; then
373
        target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list"
374
    fi
375
else
376
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
377
fi
378
if test -z "$target_list" ; then
379
    echo "No targets enabled"
380
    exit 1
381
fi
382

    
383
if test -z "$cross_prefix" ; then
384

    
385
# ---
386
# big/little endian test
387
cat > $TMPC << EOF
388
#include <inttypes.h>
389
int main(int argc, char ** argv){
390
        volatile uint32_t i=0x01234567;
391
        return (*((uint8_t*)(&i))) == 0x67;
392
}
393
EOF
394

    
395
if $cc -o $TMPE $TMPC 2>/dev/null ; then
396
$TMPE && bigendian="yes"
397
else
398
echo big/little test failed
399
fi
400

    
401
else
402

    
403
# if cross compiling, cannot launch a program, so make a static guess
404
if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
405
    bigendian="yes"
406
fi
407

    
408
fi
409

    
410
# host long bits test
411
hostlongbits="32"
412
if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
413
    hostlongbits="64"
414
fi
415

    
416
# check gcc options support
417
cat > $TMPC <<EOF
418
int main(void) {
419
}
420
EOF
421

    
422
have_gcc3_options="no"
423
if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
424
   have_gcc3_options="yes"
425
fi
426

    
427
# Check for gcc4, error if pre-gcc4 
428
if test "$check_gcc" = "yes" ; then
429
    cat > $TMPC <<EOF
430
#if __GNUC__ < 4
431
#error gcc3
432
#endif
433
int main(){return 0;}
434
EOF
435
    if $cc -o $TMPO $TMPC 2>/dev/null ; then
436
        echo "ERROR: \"$cc\" looks like gcc 4.x"
437
        echo "QEMU is known to have problems when compiled with gcc 4.x"
438
        echo "It is recommended that you use gcc 3.x to build QEMU"
439
        echo "To use this compiler anyway, configure with --disable-gcc-check"
440
        exit 1;
441
    fi
442
fi
443

    
444
##########################################
445
# SDL probe
446

    
447
sdl_too_old=no
448

    
449
if test -z "$sdl" ; then
450

    
451
sdl_config="sdl-config"
452
sdl=no
453
sdl_static=no
454

    
455
if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
456
# win32 cross compilation case
457
    sdl_config="i386-mingw32msvc-sdl-config"
458
    sdl=yes
459
else
460
# normal SDL probe
461
cat > $TMPC << EOF
462
#include <SDL.h>
463
#undef main /* We don't want SDL to override our main() */
464
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
465
EOF
466

    
467
if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
468
_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
469
if test "$_sdlversion" -lt 121 ; then
470
sdl_too_old=yes
471
else
472
sdl=yes
473
fi
474

    
475
# static link with sdl ?
476
if test "$sdl" = "yes" ; then
477
aa="no"
478
`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
479
sdl_static_libs=`$sdl_config --static-libs`
480
if [ "$aa" = "yes" ] ; then
481
  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
482
fi
483

    
484
if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
485
  sdl_static=yes
486
fi
487

    
488
fi # static link
489

    
490
fi # sdl compile test
491

    
492
fi # cross compilation
493
fi # -z $sdl
494

    
495
# Check if tools are available to build documentation.
496
if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
497
  build_docs="yes"
498
fi
499

    
500
if test "$mingw32" = "yes" ; then
501
if test -z "$prefix" ; then
502
    prefix="/c/Program Files/Qemu"
503
fi
504
mandir="$prefix"
505
datadir="$prefix"
506
docdir="$prefix"
507
bindir="$prefix"
508
else
509
if test -z "$prefix" ; then
510
    prefix="/usr/local"
511
fi
512
mandir="$prefix/share/man"
513
datadir="$prefix/share/qemu"
514
docdir="$prefix/share/doc/qemu"
515
bindir="$prefix/bin"
516
fi
517

    
518
echo "Install prefix    $prefix"
519
echo "BIOS directory    $datadir"
520
echo "binary directory  $bindir"
521
if test "$mingw32" = "no" ; then
522
echo "Manual directory  $mandir"
523
echo "ELF interp prefix $interp_prefix"
524
fi
525
echo "Source path       $source_path"
526
echo "C compiler        $cc"
527
echo "Host C compiler   $host_cc"
528
echo "make              $make"
529
echo "install           $install"
530
echo "host CPU          $cpu"
531
echo "host big endian   $bigendian"
532
echo "target list       $target_list"
533
echo "gprof enabled     $gprof"
534
echo "profiler          $profiler"
535
echo "static build      $static"
536
if test "$darwin" = "yes" ; then
537
    echo "Cocoa support     $cocoa"
538
fi
539
echo "SDL support       $sdl"
540
if test "$sdl" != "no" ; then
541
    echo "SDL static link   $sdl_static"
542
fi
543
echo "mingw32 support   $mingw32"
544
echo "Adlib support     $adlib"
545
echo "CoreAudio support $coreaudio"
546
echo "ALSA support      $alsa"
547
echo "DSound support    $dsound"
548
if test "$fmod" = "yes"; then
549
    if test -z $fmod_lib || test -z $fmod_inc; then
550
        echo
551
        echo "Error: You must specify path to FMOD library and headers"
552
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
553
        echo
554
        exit 1
555
    fi
556
    fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
557
else
558
    fmod_support=""
559
fi
560
echo "FMOD support      $fmod $fmod_support"
561
echo "kqemu support     $kqemu"
562
echo "Documentation     $build_docs"
563
[ ! -z "$uname_release" ] && \
564
echo "uname -r          $uname_release"
565

    
566
if test $sdl_too_old = "yes"; then
567
echo "-> Your SDL version is too old - please upgrade to have SDL support"
568
fi
569
#if test "$sdl_static" = "no"; then
570
#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
571
#fi
572
config_mak="config-host.mak"
573
config_h="config-host.h"
574

    
575
#echo "Creating $config_mak and $config_h"
576

    
577
echo "# Automatically generated by configure - do not modify" > $config_mak
578
echo "# Configured with: $0 $@" >> $config_mak
579
echo "/* Automatically generated by configure - do not modify */" > $config_h
580

    
581
echo "prefix=$prefix" >> $config_mak
582
echo "bindir=$bindir" >> $config_mak
583
echo "mandir=$mandir" >> $config_mak
584
echo "datadir=$datadir" >> $config_mak
585
echo "docdir=$docdir" >> $config_mak
586
echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
587
echo "MAKE=$make" >> $config_mak
588
echo "INSTALL=$install" >> $config_mak
589
echo "CC=$cc" >> $config_mak
590
if test "$have_gcc3_options" = "yes" ; then
591
  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
592
fi
593
echo "HOST_CC=$host_cc" >> $config_mak
594
echo "AR=$ar" >> $config_mak
595
echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
596
echo "CFLAGS=$CFLAGS" >> $config_mak
597
echo "LDFLAGS=$LDFLAGS" >> $config_mak
598
echo "EXESUF=$EXESUF" >> $config_mak
599
if test "$cpu" = "i386" ; then
600
  echo "ARCH=i386" >> $config_mak
601
  echo "#define HOST_I386 1" >> $config_h
602
elif test "$cpu" = "x86_64" ; then
603
  echo "ARCH=x86_64" >> $config_mak
604
  echo "#define HOST_X86_64 1" >> $config_h
605
elif test "$cpu" = "armv4b" ; then
606
  echo "ARCH=arm" >> $config_mak
607
  echo "#define HOST_ARM 1" >> $config_h
608
elif test "$cpu" = "armv4l" ; then
609
  echo "ARCH=arm" >> $config_mak
610
  echo "#define HOST_ARM 1" >> $config_h
611
elif test "$cpu" = "powerpc" ; then
612
  echo "ARCH=ppc" >> $config_mak
613
  echo "#define HOST_PPC 1" >> $config_h
614
elif test "$cpu" = "mips" ; then
615
  echo "ARCH=mips" >> $config_mak
616
  echo "#define HOST_MIPS 1" >> $config_h
617
elif test "$cpu" = "s390" ; then
618
  echo "ARCH=s390" >> $config_mak
619
  echo "#define HOST_S390 1" >> $config_h
620
elif test "$cpu" = "alpha" ; then
621
  echo "ARCH=alpha" >> $config_mak
622
  echo "#define HOST_ALPHA 1" >> $config_h
623
elif test "$cpu" = "sparc" ; then
624
  echo "ARCH=sparc" >> $config_mak
625
  echo "#define HOST_SPARC 1" >> $config_h
626
elif test "$cpu" = "sparc64" ; then
627
  echo "ARCH=sparc64" >> $config_mak
628
  echo "#define HOST_SPARC64 1" >> $config_h
629
elif test "$cpu" = "ia64" ; then
630
  echo "ARCH=ia64" >> $config_mak
631
  echo "#define HOST_IA64 1" >> $config_h
632
elif test "$cpu" = "m68k" ; then
633
  echo "ARCH=m68k" >> $config_mak
634
  echo "#define HOST_M68K 1" >> $config_h
635
else
636
  echo "Unsupported CPU"
637
  exit 1
638
fi
639
if test "$bigendian" = "yes" ; then
640
  echo "WORDS_BIGENDIAN=yes" >> $config_mak
641
  echo "#define WORDS_BIGENDIAN 1" >> $config_h
642
fi
643
echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
644
if test "$mingw32" = "yes" ; then
645
  echo "CONFIG_WIN32=yes" >> $config_mak
646
  echo "#define CONFIG_WIN32 1" >> $config_h
647
elif test -f "/usr/include/byteswap.h" ; then
648
  echo "#define HAVE_BYTESWAP_H 1" >> $config_h
649
fi
650
if test "$darwin" = "yes" ; then
651
  echo "CONFIG_DARWIN=yes" >> $config_mak
652
  echo "#define CONFIG_DARWIN 1" >> $config_h
653
fi
654
if test "$solaris" = "yes" ; then
655
  echo "CONFIG_SOLARIS=yes" >> $config_mak
656
  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
657
fi
658
if test "$gdbstub" = "yes" ; then
659
  echo "CONFIG_GDBSTUB=yes" >> $config_mak
660
  echo "#define CONFIG_GDBSTUB 1" >> $config_h
661
fi
662
if test "$gprof" = "yes" ; then
663
  echo "TARGET_GPROF=yes" >> $config_mak
664
  echo "#define HAVE_GPROF 1" >> $config_h
665
fi
666
if test "$static" = "yes" ; then
667
  echo "CONFIG_STATIC=yes" >> $config_mak
668
  echo "#define CONFIG_STATIC 1" >> $config_h
669
fi
670
if test $profiler = "yes" ; then
671
  echo "#define CONFIG_PROFILER 1" >> $config_h
672
fi
673
if test "$slirp" = "yes" ; then
674
  echo "CONFIG_SLIRP=yes" >> $config_mak
675
  echo "#define CONFIG_SLIRP 1" >> $config_h
676
fi
677
if test "$adlib" = "yes" ; then
678
  echo "CONFIG_ADLIB=yes" >> $config_mak
679
  echo "#define CONFIG_ADLIB 1" >> $config_h
680
fi
681
if test "$oss" = "yes" ; then
682
  echo "CONFIG_OSS=yes" >> $config_mak
683
  echo "#define CONFIG_OSS 1" >> $config_h
684
fi
685
if test "$coreaudio" = "yes" ; then
686
  echo "CONFIG_COREAUDIO=yes" >> $config_mak
687
  echo "#define CONFIG_COREAUDIO 1" >> $config_h
688
fi
689
if test "$alsa" = "yes" ; then
690
  echo "CONFIG_ALSA=yes" >> $config_mak
691
  echo "#define CONFIG_ALSA 1" >> $config_h
692
fi
693
if test "$dsound" = "yes" ; then
694
  echo "CONFIG_DSOUND=yes" >> $config_mak
695
  echo "#define CONFIG_DSOUND 1" >> $config_h
696
fi
697
if test "$fmod" = "yes" ; then
698
  echo "CONFIG_FMOD=yes" >> $config_mak
699
  echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
700
  echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
701
  echo "#define CONFIG_FMOD 1" >> $config_h
702
fi
703
qemu_version=`head $source_path/VERSION`
704
echo "VERSION=$qemu_version" >>$config_mak
705
echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
706

    
707
echo "SRC_PATH=$source_path" >> $config_mak
708
if [ "$source_path_used" = "yes" ]; then
709
  echo "VPATH=$source_path" >> $config_mak
710
fi
711
echo "TARGET_DIRS=$target_list" >> $config_mak
712
if [ "$build_docs" = "yes" ] ; then
713
  echo "BUILD_DOCS=yes" >> $config_mak
714
fi
715
if [ "$build_acpi_tables" = "yes" ] ; then
716
  echo "BUILD_ACPI_TABLES=yes" >> $config_mak
717
fi
718

    
719
# XXX: suppress that
720
if [ "$bsd" = "yes" ] ; then
721
  echo "#define O_LARGEFILE 0" >> $config_h
722
  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
723
  echo "#define _BSD 1" >> $config_h
724
fi
725

    
726
echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
727

    
728
for target in $target_list; do
729
target_dir="$target"
730
config_mak=$target_dir/config.mak
731
config_h=$target_dir/config.h
732
target_cpu=`echo $target | cut -d '-' -f 1`
733
target_bigendian="no"
734
[ "$target_cpu" = "armeb" ] && target_bigendian=yes
735
[ "$target_cpu" = "sparc" ] && target_bigendian=yes
736
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
737
[ "$target_cpu" = "ppc" ] && target_bigendian=yes
738
[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
739
[ "$target_cpu" = "mips" ] && target_bigendian=yes
740
[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
741
target_softmmu="no"
742
if expr $target : '.*-softmmu' > /dev/null ; then
743
  target_softmmu="yes"
744
fi
745
target_user_only="no"
746
if expr $target : '.*-user' > /dev/null ; then
747
  target_user_only="yes"
748
fi
749

    
750
if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
751
        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
752
    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
753
    echo "To build QEMU without graphical output configure with --disable-gfx-check"
754
    echo "Note that this will disable all output from the virtual graphics card."
755
    exit 1;
756
fi
757

    
758
#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
759

    
760
mkdir -p $target_dir
761
mkdir -p $target_dir/fpu
762
if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
763
  mkdir -p $target_dir/nwfpe
764
fi
765
if test "$target_user_only" = "no" ; then
766
  mkdir -p $target_dir/slirp
767
fi
768

    
769
#
770
# don't use ln -sf as not all "ln -sf" over write the file/link
771
#
772
rm -f $target_dir/Makefile
773
ln -s $source_path/Makefile.target $target_dir/Makefile
774

    
775

    
776
echo "# Automatically generated by configure - do not modify" > $config_mak
777
echo "/* Automatically generated by configure - do not modify */" > $config_h
778

    
779

    
780
echo "include ../config-host.mak" >> $config_mak
781
echo "#include \"../config-host.h\"" >> $config_h
782

    
783
bflt="no"
784
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
785
echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
786

    
787
if test "$target_cpu" = "i386" ; then
788
  echo "TARGET_ARCH=i386" >> $config_mak
789
  echo "#define TARGET_ARCH \"i386\"" >> $config_h
790
  echo "#define TARGET_I386 1" >> $config_h
791
  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
792
    echo "#define USE_KQEMU 1" >> $config_h
793
  fi
794
elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
795
  echo "TARGET_ARCH=arm" >> $config_mak
796
  echo "#define TARGET_ARCH \"arm\"" >> $config_h
797
  echo "#define TARGET_ARM 1" >> $config_h
798
  bflt="yes"
799
elif test "$target_cpu" = "sparc" ; then
800
  echo "TARGET_ARCH=sparc" >> $config_mak
801
  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
802
  echo "#define TARGET_SPARC 1" >> $config_h
803
elif test "$target_cpu" = "sparc64" ; then
804
  echo "TARGET_ARCH=sparc64" >> $config_mak
805
  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
806
  echo "#define TARGET_SPARC 1" >> $config_h
807
  echo "#define TARGET_SPARC64 1" >> $config_h
808
elif test "$target_cpu" = "ppc" ; then
809
  echo "TARGET_ARCH=ppc" >> $config_mak
810
  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
811
  echo "#define TARGET_PPC 1" >> $config_h
812
elif test "$target_cpu" = "ppc64" ; then
813
  echo "TARGET_ARCH=ppc64" >> $config_mak
814
  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
815
  echo "#define TARGET_PPC 1" >> $config_h
816
  echo "#define TARGET_PPC64 1" >> $config_h
817
elif test "$target_cpu" = "x86_64" ; then
818
  echo "TARGET_ARCH=x86_64" >> $config_mak
819
  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
820
  echo "#define TARGET_I386 1" >> $config_h
821
  echo "#define TARGET_X86_64 1" >> $config_h
822
  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
823
    echo "#define USE_KQEMU 1" >> $config_h
824
  fi
825
elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
826
  echo "TARGET_ARCH=mips" >> $config_mak
827
  echo "#define TARGET_ARCH \"mips\"" >> $config_h
828
  echo "#define TARGET_MIPS 1" >> $config_h
829
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
830
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
831
elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
832
  echo "TARGET_ARCH=sh4" >> $config_mak
833
  echo "#define TARGET_ARCH \"sh4\"" >> $config_h
834
  echo "#define TARGET_SH4 1" >> $config_h
835
  bflt="yes"
836
else
837
  echo "Unsupported target CPU"
838
  exit 1
839
fi
840
if test "$target_bigendian" = "yes" ; then
841
  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
842
  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
843
fi
844
if test "$target_softmmu" = "yes" ; then
845
  echo "CONFIG_SOFTMMU=yes" >> $config_mak
846
  echo "#define CONFIG_SOFTMMU 1" >> $config_h
847
fi
848
if test "$target_user_only" = "yes" ; then
849
  echo "CONFIG_USER_ONLY=yes" >> $config_mak
850
  echo "#define CONFIG_USER_ONLY 1" >> $config_h
851
fi
852

    
853
if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64"; then
854
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
855
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
856
fi
857
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
858
  echo "TARGET_HAS_BFLT=yes" >> $config_mak
859
  echo "#define TARGET_HAS_BFLT 1" >> $config_h
860
fi
861
# sdl defines
862

    
863
if test "$target_user_only" = "no"; then
864
    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
865
        sdl1=$sdl_static
866
    else
867
        sdl1=$sdl
868
    fi
869
    if test "$sdl1" = "yes" ; then
870
        echo "#define CONFIG_SDL 1" >> $config_h
871
        echo "CONFIG_SDL=yes" >> $config_mak
872
        if test "$target_softmmu" = "no" -o "$static" = "yes"; then
873
            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
874
        else
875
            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
876
        fi
877
        if [ "${aa}" = "yes" ] ; then
878
            echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
879
        else
880
            echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
881
        fi
882
    fi
883
fi
884

    
885
if test "$cocoa" = "yes" ; then
886
    echo "#define CONFIG_COCOA 1" >> $config_h
887
    echo "CONFIG_COCOA=yes" >> $config_mak
888
fi
889

    
890
done # for target in $targets
891

    
892
# build tree in object directory if source path is different from current one
893
if test "$source_path_used" = "yes" ; then
894
    DIRS="tests"
895
    FILES="Makefile tests/Makefile"
896
    for dir in $DIRS ; do
897
            mkdir -p $dir
898
    done
899
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
900
    for f in $FILES ; do
901
        rm -f $f
902
        ln -s $source_path/$f $f
903
    done
904
fi
905

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