Statistics
| Branch: | Revision:

root / configure @ 6f15b608

History | View | Annotate | Download (24.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
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
cocoa="no"
92
check_gfx="yes"
93
check_gcc="yes"
94
softmmu="yes"
95
user="no"
96
build_docs="no"
97
uname_release=""
98

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

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

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

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

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

    
243
# Checking for CFLAGS
244
if test -z "$CFLAGS"; then
245
    CFLAGS="-O2"
246
fi
247

    
248
if test x"$show_help" = x"yes" ; then
249
cat << EOF
250

    
251
Usage: configure [options]
252
Options: [defaults in brackets after descriptions]
253

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

    
292
cc="${cross_prefix}${cc}"
293
ar="${cross_prefix}${ar}"
294
strip="${cross_prefix}${strip}"
295

    
296
# check that the C compiler works.
297
cat > $TMPC <<EOF
298
int main(void) {}
299
EOF
300

    
301
if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
302
  : C compiler works ok
303
else
304
    echo "ERROR: \"$cc\" either does not exist or does not work"
305
    exit 1
306
fi
307

    
308
if test "$mingw32" = "yes" ; then
309
    linux="no"
310
    EXESUF=".exe"
311
    oss="no"
312
    if [ "$cpu" = "i386" ] ; then
313
        kqemu="yes"
314
    fi
315
fi
316

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

    
357

    
358
if test -z "$target_list" ; then
359
# these targets are portable
360
    if [ "$softmmu" = "yes" ] ; then
361
        target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
362
    fi
363
# the following are Linux specific
364
    if [ "$user" = "yes" ] ; then
365
        target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list"
366
    fi
367
else
368
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
369
fi
370
if test -z "$target_list" ; then
371
    echo "No targets enabled"
372
    exit 1
373
fi
374

    
375
if test -z "$cross_prefix" ; then
376

    
377
# ---
378
# big/little endian test
379
cat > $TMPC << EOF
380
#include <inttypes.h>
381
int main(int argc, char ** argv){
382
        volatile uint32_t i=0x01234567;
383
        return (*((uint8_t*)(&i))) == 0x67;
384
}
385
EOF
386

    
387
if $cc -o $TMPE $TMPC 2>/dev/null ; then
388
$TMPE && bigendian="yes"
389
else
390
echo big/little test failed
391
fi
392

    
393
else
394

    
395
# if cross compiling, cannot launch a program, so make a static guess
396
if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
397
    bigendian="yes"
398
fi
399

    
400
fi
401

    
402
# host long bits test
403
hostlongbits="32"
404
if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
405
    hostlongbits="64"
406
fi
407

    
408
# check gcc options support
409
cat > $TMPC <<EOF
410
int main(void) {
411
}
412
EOF
413

    
414
have_gcc3_options="no"
415
if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
416
   have_gcc3_options="yes"
417
fi
418

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

    
436
##########################################
437
# SDL probe
438

    
439
sdl_too_old=no
440

    
441
if test -z "$sdl" ; then
442

    
443
sdl_config="sdl-config"
444
sdl=no
445
sdl_static=no
446

    
447
if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
448
# win32 cross compilation case
449
    sdl_config="i386-mingw32msvc-sdl-config"
450
    sdl=yes
451
else
452
# normal SDL probe
453
cat > $TMPC << EOF
454
#include <SDL.h>
455
#undef main /* We don't want SDL to override our main() */
456
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
457
EOF
458

    
459
if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
460
_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
461
if test "$_sdlversion" -lt 121 ; then
462
sdl_too_old=yes
463
else
464
sdl=yes
465
fi
466

    
467
# static link with sdl ?
468
if test "$sdl" = "yes" ; then
469
aa="no"
470
`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
471
sdl_static_libs=`$sdl_config --static-libs`
472
if [ "$aa" = "yes" ] ; then
473
  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
474
fi
475

    
476
if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
477
  sdl_static=yes
478
fi
479

    
480
fi # static link
481

    
482
fi # sdl compile test
483

    
484
fi # cross compilation
485
fi # -z $sdl
486

    
487
# Check if tools are available to build documentation.
488
if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
489
  build_docs="yes"
490
fi
491

    
492
if test "$mingw32" = "yes" ; then
493
if test -z "$prefix" ; then
494
    prefix="/c/Program Files/Qemu"
495
fi
496
mandir="$prefix"
497
datadir="$prefix"
498
docdir="$prefix"
499
bindir="$prefix"
500
else
501
if test -z "$prefix" ; then
502
    prefix="/usr/local"
503
fi
504
mandir="$prefix/share/man"
505
datadir="$prefix/share/qemu"
506
docdir="$prefix/share/doc/qemu"
507
bindir="$prefix/bin"
508
fi
509

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

    
558
if test $sdl_too_old = "yes"; then
559
echo "-> Your SDL version is too old - please upgrade to have SDL support"
560
fi
561
#if test "$sdl_static" = "no"; then
562
#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
563
#fi
564
config_mak="config-host.mak"
565
config_h="config-host.h"
566

    
567
#echo "Creating $config_mak and $config_h"
568

    
569
echo "# Automatically generated by configure - do not modify" > $config_mak
570
echo "# Configured with: $0 $@" >> $config_mak
571
echo "/* Automatically generated by configure - do not modify */" > $config_h
572

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

    
699
echo "SRC_PATH=$source_path" >> $config_mak
700
if [ "$source_path_used" = "yes" ]; then
701
  echo "VPATH=$source_path" >> $config_mak
702
fi
703
echo "TARGET_DIRS=$target_list" >> $config_mak
704
if [ "$build_docs" = "yes" ] ; then
705
  echo "BUILD_DOCS=yes" >> $config_mak
706
fi
707

    
708
# XXX: suppress that
709
if [ "$bsd" = "yes" ] ; then
710
  echo "#define O_LARGEFILE 0" >> $config_h
711
  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
712
  echo "#define _BSD 1" >> $config_h
713
fi
714

    
715
echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
716

    
717
for target in $target_list; do
718
target_dir="$target"
719
config_mak=$target_dir/config.mak
720
config_h=$target_dir/config.h
721
target_cpu=`echo $target | cut -d '-' -f 1`
722
target_bigendian="no"
723
[ "$target_cpu" = "armeb" ] && target_bigendian=yes
724
[ "$target_cpu" = "sparc" ] && target_bigendian=yes
725
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
726
[ "$target_cpu" = "ppc" ] && target_bigendian=yes
727
[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
728
[ "$target_cpu" = "mips" ] && target_bigendian=yes
729
[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
730
target_softmmu="no"
731
if expr $target : '.*-softmmu' > /dev/null ; then
732
  target_softmmu="yes"
733
fi
734
target_user_only="no"
735
if expr $target : '.*-user' > /dev/null ; then
736
  target_user_only="yes"
737
fi
738

    
739
if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
740
        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
741
    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
742
    echo "To build QEMU without graphical output configure with --disable-gfx-check"
743
    echo "Note that this will disable all output from the virtual graphics card."
744
    exit 1;
745
fi
746

    
747
#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
748

    
749
mkdir -p $target_dir
750
mkdir -p $target_dir/fpu
751
if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
752
  mkdir -p $target_dir/nwfpe
753
fi
754
if test "$target_user_only" = "no" ; then
755
  mkdir -p $target_dir/slirp
756
fi
757

    
758
#
759
# don't use ln -sf as not all "ln -sf" over write the file/link
760
#
761
rm -f $target_dir/Makefile
762
ln -s $source_path/Makefile.target $target_dir/Makefile
763

    
764

    
765
echo "# Automatically generated by configure - do not modify" > $config_mak
766
echo "/* Automatically generated by configure - do not modify */" > $config_h
767

    
768

    
769
echo "include ../config-host.mak" >> $config_mak
770
echo "#include \"../config-host.h\"" >> $config_h
771

    
772
bflt="no"
773
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
774
echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
775

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

    
842
if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64"; then
843
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
844
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
845
fi
846
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
847
  echo "TARGET_HAS_BFLT=yes" >> $config_mak
848
  echo "#define TARGET_HAS_BFLT 1" >> $config_h
849
fi
850
# sdl defines
851

    
852
if test "$target_user_only" = "no"; then
853
    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
854
        sdl1=$sdl_static
855
    else
856
        sdl1=$sdl
857
    fi
858
    if test "$sdl1" = "yes" ; then
859
        echo "#define CONFIG_SDL 1" >> $config_h
860
        echo "CONFIG_SDL=yes" >> $config_mak
861
        if test "$target_softmmu" = "no" -o "$static" = "yes"; then
862
            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
863
        else
864
            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
865
        fi
866
        if [ "${aa}" = "yes" ] ; then
867
            echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
868
        else
869
            echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
870
        fi
871
    fi
872
fi
873

    
874
if test "$cocoa" = "yes" ; then
875
    echo "#define CONFIG_COCOA 1" >> $config_h
876
    echo "CONFIG_COCOA=yes" >> $config_mak
877
fi
878

    
879
done # for target in $targets
880

    
881
# build tree in object directory if source path is different from current one
882
if test "$source_path_used" = "yes" ; then
883
    DIRS="tests"
884
    FILES="Makefile tests/Makefile"
885
    for dir in $DIRS ; do
886
            mkdir -p $dir
887
    done
888
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
889
    for f in $FILES ; do
890
        rm -f $f
891
        ln -s $source_path/$f $f
892
    done
893
fi
894

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