]> Git Repo - qemu.git/blob - configure
Fix Makefile weirdness.
[qemu.git] / configure
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 user="no"
98 build_docs="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   gcc3_search="no"
184   ;;
185   --host-cc=*) host_cc="$optarg"
186   ;;
187   --make=*) make="$optarg"
188   ;;
189   --install=*) install="$optarg"
190   ;;
191   --extra-cflags=*) CFLAGS="$optarg"
192   ;;
193   --extra-ldflags=*) LDFLAGS="$optarg"
194   ;;
195   --cpu=*) cpu="$optarg"
196   ;;
197   --target-list=*) target_list="$optarg"
198   ;;
199   --enable-gprof) gprof="yes"
200   ;;
201   --static) static="yes"
202   ;;
203   --disable-sdl) sdl="no"
204   ;;
205   --enable-coreaudio) coreaudio="yes"
206   ;;
207   --enable-alsa) alsa="yes"
208   ;;
209   --enable-dsound) dsound="yes"
210   ;;
211   --enable-fmod) fmod="yes"
212   ;;
213   --fmod-lib=*) fmod_lib="$optarg"
214   ;;
215   --fmod-inc=*) fmod_inc="$optarg"
216   ;;
217   --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no"
218   ;;
219   --disable-slirp) slirp="no"
220   ;;
221   --enable-adlib) adlib="yes"
222   ;;
223   --disable-kqemu) kqemu="no"
224   ;;
225   --enable-profiler) profiler="yes"
226   ;;
227   --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
228   ;;
229   --disable-gfx-check) check_gfx="no"
230   ;;
231   --disable-gcc-check) check_gcc="no"
232   ;;
233   --disable-system) softmmu="no"
234   ;;
235   --enable-system) softmmu="yes"
236   ;;
237   --disable-user) user="no"
238   ;;
239   --enable-user) user="yes"
240   ;;
241   --enable-uname-release=*) uname_release="$optarg"
242   ;;
243   esac
244 done
245
246 if test x"$show_help" = x"yes" ; then
247 cat << EOF
248
249 Usage: configure [options]
250 Options: [defaults in brackets after descriptions]
251
252 EOF
253 echo "Standard options:"
254 echo "  --help                   print this message"
255 echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
256 echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
257 echo "                           use %M for cpu name [$interp_prefix]"
258 echo "  --target-list=LIST       set target list [$target_list]"
259 echo ""
260 echo "kqemu kernel acceleration support:"
261 echo "  --disable-kqemu          disable kqemu support"
262 echo ""
263 echo "Advanced options (experts only):"
264 echo "  --source-path=PATH       path of source code [$source_path]"
265 echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
266 echo "  --cc=CC                  use C compiler CC [$cc]"
267 echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
268 echo "  --make=MAKE              use specified make [$make]"
269 echo "  --install=INSTALL        use specified install [$install]"
270 echo "  --static                 enable static build [$static]"
271 echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
272 echo "  --enable-mingw32         enable Win32 cross compilation with mingw32"
273 echo "  --enable-adlib           enable Adlib emulation"
274 echo "  --enable-coreaudio       enable Coreaudio audio driver"
275 echo "  --enable-alsa            enable ALSA audio driver"
276 echo "  --enable-fmod            enable FMOD audio driver"
277 echo "  --enabled-dsound         enable DirectSound audio driver"
278 echo "  --enable-system          enable all system emulation targets"
279 echo "  --disable-system         disable all system emulation targets"
280 echo "  --enable-user            enable all linux usermode emulation targets"
281 echo "  --disable-user           disable all linux usermode emulation targets"
282 echo "  --fmod-lib               path to FMOD library"
283 echo "  --fmod-inc               path to FMOD includes"
284 echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
285 echo ""
286 echo "NOTE: The object files are built at the place where configure is launched"
287 exit 1
288 fi
289
290 cc="${cross_prefix}${cc}"
291 ar="${cross_prefix}${ar}"
292 strip="${cross_prefix}${strip}"
293
294 # check that the C compiler works.
295 cat > $TMPC <<EOF
296 int main(void) {}
297 EOF
298
299 if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
300   : C compiler works ok
301 else
302     echo "ERROR: \"$cc\" either does not exist or does not work"
303     exit 1
304 fi
305
306 if test "$mingw32" = "yes" ; then
307     linux="no"
308     EXESUF=".exe"
309     oss="no"
310     if [ "$cpu" = "i386" ] ; then
311         kqemu="yes"
312     fi
313 fi
314
315 # Check for gcc4, error if pre-gcc4 
316 if test "$check_gcc" = "yes" ; then
317     cat > $TMPC <<EOF
318 #if __GNUC__ < 4
319 #error gcc3
320 #endif
321 int main(){return 0;}
322 EOF
323     check_cc() {
324         which "$1" >&/dev/null
325         return $?
326     }
327
328     if "$cc" -o $TMPE $TMPC 2>/dev/null ; then
329         echo "WARNING: \"$cc\" looks like gcc 4.x"
330         found_compat_cc="no"
331         if test "$gcc3_search" = "yes" ; then
332             echo "Looking for gcc 3.x"
333             for compat_cc in $gcc3_list ; do
334                 if check_cc "$compat_cc" ; then
335                     echo "Found \"$compat_cc\""
336                     cc="$compat_cc"
337                     found_compat_cc="yes"
338                     break
339                 fi
340             done
341             if test "$found_compat_cc" = "no" ; then
342                 echo "gcc 3.x not found!"
343             fi
344         fi
345         if test "$found_compat_cc" = "no" ; then
346             echo "QEMU is known to have problems when compiled with gcc 4.x"
347             echo "It is recommended that you use gcc 3.x to build QEMU"
348             echo "To use this compiler anyway, configure with --disable-gcc-check"
349             exit 1;
350         fi
351     fi
352 fi
353
354 #
355 # Solaris specific configure tool chain decisions
356 #
357 if test "$solaris" = "yes" ; then
358   #
359   # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
360   # override the check with --disable-gcc-check
361   # 
362   if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
363     solgcc=`which $cc`
364     if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
365       echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
366       echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
367       echo "or get the latest patch from SunSolve for gcc"
368       exit 1
369     fi
370   fi
371   solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
372   if test -z "$solinst" ; then
373     echo "Solaris install program not found. Use --install=/usr/ucb/install or"
374     echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
375     echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
376     exit 1
377   fi
378   if test "$solinst" = "/usr/sbin/install" ; then
379     echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
380     echo "try ginstall from the GNU fileutils available from www.blastwave.org"
381     echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
382     exit 1
383   fi
384   sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
385   if test -z "$sol_ar" ; then
386     echo "Error: No path includes ar"
387     if test -f /usr/ccs/bin/ar ; then
388       echo "Add /usr/ccs/bin to your path and rerun configure"
389     fi
390     exit 1
391   fi
392 fi 
393
394
395 if test -z "$target_list" ; then
396 # these targets are portable
397     if [ "$softmmu" = "yes" ] ; then
398         target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
399     fi
400 # the following are Linux specific
401     if [ "$user" = "yes" ] ; then
402         target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user m68k-user $target_list"
403     fi
404 else
405     target_list=`echo "$target_list" | sed -e 's/,/ /g'`
406 fi
407 if test -z "$target_list" ; then
408     echo "No targets enabled"
409     exit 1
410 fi
411
412 if test -z "$cross_prefix" ; then
413
414 # ---
415 # big/little endian test
416 cat > $TMPC << EOF
417 #include <inttypes.h>
418 int main(int argc, char ** argv){
419         volatile uint32_t i=0x01234567;
420         return (*((uint8_t*)(&i))) == 0x67;
421 }
422 EOF
423
424 if $cc -o $TMPE $TMPC 2>/dev/null ; then
425 $TMPE && bigendian="yes"
426 else
427 echo big/little test failed
428 fi
429
430 else
431
432 # if cross compiling, cannot launch a program, so make a static guess
433 if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
434     bigendian="yes"
435 fi
436
437 fi
438
439 # host long bits test
440 hostlongbits="32"
441 if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
442     hostlongbits="64"
443 fi
444
445 # check gcc options support
446 cat > $TMPC <<EOF
447 int main(void) {
448 }
449 EOF
450
451 have_gcc3_options="no"
452 if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
453    have_gcc3_options="yes"
454 fi
455
456 ##########################################
457 # SDL probe
458
459 sdl_too_old=no
460
461 if test -z "$sdl" ; then
462
463 sdl_config="sdl-config"
464 sdl=no
465 sdl_static=no
466
467 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
468 # win32 cross compilation case
469     sdl_config="i386-mingw32msvc-sdl-config"
470     sdl=yes
471 else
472 # normal SDL probe
473 cat > $TMPC << EOF
474 #include <SDL.h>
475 #undef main /* We don't want SDL to override our main() */
476 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
477 EOF
478
479 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
480 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
481 if test "$_sdlversion" -lt 121 ; then
482 sdl_too_old=yes
483 else
484 sdl=yes
485 fi
486
487 # static link with sdl ?
488 if test "$sdl" = "yes" ; then
489 aa="no"
490 `$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
491 sdl_static_libs=`$sdl_config --static-libs`
492 if [ "$aa" = "yes" ] ; then
493   sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
494 fi
495
496 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
497   sdl_static=yes
498 fi
499
500 fi # static link
501
502 fi # sdl compile test
503
504 fi # cross compilation
505 fi # -z $sdl
506
507 # Check if tools are available to build documentation.
508 if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
509   build_docs="yes"
510 fi
511
512 if test "$mingw32" = "yes" ; then
513 if test -z "$prefix" ; then
514     prefix="/c/Program Files/Qemu"
515 fi
516 mandir="$prefix"
517 datadir="$prefix"
518 docdir="$prefix"
519 bindir="$prefix"
520 else
521 if test -z "$prefix" ; then
522     prefix="/usr/local"
523 fi
524 mandir="$prefix/share/man"
525 datadir="$prefix/share/qemu"
526 docdir="$prefix/share/doc/qemu"
527 bindir="$prefix/bin"
528 fi
529
530 echo "Install prefix    $prefix"
531 echo "BIOS directory    $datadir"
532 echo "binary directory  $bindir"
533 if test "$mingw32" = "no" ; then
534 echo "Manual directory  $mandir"
535 echo "ELF interp prefix $interp_prefix"
536 fi
537 echo "Source path       $source_path"
538 echo "C compiler        $cc"
539 echo "Host C compiler   $host_cc"
540 echo "make              $make"
541 echo "install           $install"
542 echo "host CPU          $cpu"
543 echo "host big endian   $bigendian"
544 echo "target list       $target_list"
545 echo "gprof enabled     $gprof"
546 echo "profiler          $profiler"
547 echo "static build      $static"
548 if test "$darwin" = "yes" ; then
549     echo "Cocoa support     $cocoa"
550 fi
551 echo "SDL support       $sdl"
552 if test "$sdl" != "no" ; then
553     echo "SDL static link   $sdl_static"
554 fi
555 echo "mingw32 support   $mingw32"
556 echo "Adlib support     $adlib"
557 echo "CoreAudio support $coreaudio"
558 echo "ALSA support      $alsa"
559 echo "DSound support    $dsound"
560 if test "$fmod" = "yes"; then
561     if test -z $fmod_lib || test -z $fmod_inc; then
562         echo
563         echo "Error: You must specify path to FMOD library and headers"
564         echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
565         echo
566         exit 1
567     fi
568     fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
569 else
570     fmod_support=""
571 fi
572 echo "FMOD support      $fmod $fmod_support"
573 echo "kqemu support     $kqemu"
574 echo "Documentation     $build_docs"
575 [ ! -z "$uname_release" ] && \
576 echo "uname -r          $uname_release"
577
578 if test $sdl_too_old = "yes"; then
579 echo "-> Your SDL version is too old - please upgrade to have SDL support"
580 fi
581 #if test "$sdl_static" = "no"; then
582 #  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
583 #fi
584 config_mak="config-host.mak"
585 config_h="config-host.h"
586
587 #echo "Creating $config_mak and $config_h"
588
589 echo "# Automatically generated by configure - do not modify" > $config_mak
590 echo "# Configured with: $0 $@" >> $config_mak
591 echo "/* Automatically generated by configure - do not modify */" > $config_h
592
593 echo "prefix=$prefix" >> $config_mak
594 echo "bindir=$bindir" >> $config_mak
595 echo "mandir=$mandir" >> $config_mak
596 echo "datadir=$datadir" >> $config_mak
597 echo "docdir=$docdir" >> $config_mak
598 echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
599 echo "MAKE=$make" >> $config_mak
600 echo "INSTALL=$install" >> $config_mak
601 echo "CC=$cc" >> $config_mak
602 if test "$have_gcc3_options" = "yes" ; then
603   echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
604 fi
605 echo "HOST_CC=$host_cc" >> $config_mak
606 echo "AR=$ar" >> $config_mak
607 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
608 echo "CFLAGS=$CFLAGS" >> $config_mak
609 echo "LDFLAGS=$LDFLAGS" >> $config_mak
610 echo "EXESUF=$EXESUF" >> $config_mak
611 if test "$cpu" = "i386" ; then
612   echo "ARCH=i386" >> $config_mak
613   echo "#define HOST_I386 1" >> $config_h
614 elif test "$cpu" = "x86_64" ; then
615   echo "ARCH=x86_64" >> $config_mak
616   echo "#define HOST_X86_64 1" >> $config_h
617 elif test "$cpu" = "armv4b" ; then
618   echo "ARCH=arm" >> $config_mak
619   echo "#define HOST_ARM 1" >> $config_h
620 elif test "$cpu" = "armv4l" ; then
621   echo "ARCH=arm" >> $config_mak
622   echo "#define HOST_ARM 1" >> $config_h
623 elif test "$cpu" = "powerpc" ; then
624   echo "ARCH=ppc" >> $config_mak
625   echo "#define HOST_PPC 1" >> $config_h
626 elif test "$cpu" = "mips" ; then
627   echo "ARCH=mips" >> $config_mak
628   echo "#define HOST_MIPS 1" >> $config_h
629 elif test "$cpu" = "s390" ; then
630   echo "ARCH=s390" >> $config_mak
631   echo "#define HOST_S390 1" >> $config_h
632 elif test "$cpu" = "alpha" ; then
633   echo "ARCH=alpha" >> $config_mak
634   echo "#define HOST_ALPHA 1" >> $config_h
635 elif test "$cpu" = "sparc" ; then
636   echo "ARCH=sparc" >> $config_mak
637   echo "#define HOST_SPARC 1" >> $config_h
638 elif test "$cpu" = "sparc64" ; then
639   echo "ARCH=sparc64" >> $config_mak
640   echo "#define HOST_SPARC64 1" >> $config_h
641 elif test "$cpu" = "ia64" ; then
642   echo "ARCH=ia64" >> $config_mak
643   echo "#define HOST_IA64 1" >> $config_h
644 elif test "$cpu" = "m68k" ; then
645   echo "ARCH=m68k" >> $config_mak
646   echo "#define HOST_M68K 1" >> $config_h
647 else
648   echo "Unsupported CPU"
649   exit 1
650 fi
651 if test "$bigendian" = "yes" ; then
652   echo "WORDS_BIGENDIAN=yes" >> $config_mak
653   echo "#define WORDS_BIGENDIAN 1" >> $config_h
654 fi
655 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
656 if test "$mingw32" = "yes" ; then
657   echo "CONFIG_WIN32=yes" >> $config_mak
658   echo "#define CONFIG_WIN32 1" >> $config_h
659 elif test -f "/usr/include/byteswap.h" ; then
660   echo "#define HAVE_BYTESWAP_H 1" >> $config_h
661 fi
662 if test "$darwin" = "yes" ; then
663   echo "CONFIG_DARWIN=yes" >> $config_mak
664   echo "#define CONFIG_DARWIN 1" >> $config_h
665 fi
666 if test "$solaris" = "yes" ; then
667   echo "CONFIG_SOLARIS=yes" >> $config_mak
668   echo "#define HOST_SOLARIS $solarisrev" >> $config_h
669 fi
670 if test "$gdbstub" = "yes" ; then
671   echo "CONFIG_GDBSTUB=yes" >> $config_mak
672   echo "#define CONFIG_GDBSTUB 1" >> $config_h
673 fi
674 if test "$gprof" = "yes" ; then
675   echo "TARGET_GPROF=yes" >> $config_mak
676   echo "#define HAVE_GPROF 1" >> $config_h
677 fi
678 if test "$static" = "yes" ; then
679   echo "CONFIG_STATIC=yes" >> $config_mak
680   echo "#define CONFIG_STATIC 1" >> $config_h
681 fi
682 if test $profiler = "yes" ; then
683   echo "#define CONFIG_PROFILER 1" >> $config_h
684 fi
685 if test "$slirp" = "yes" ; then
686   echo "CONFIG_SLIRP=yes" >> $config_mak
687   echo "#define CONFIG_SLIRP 1" >> $config_h
688 fi
689 if test "$adlib" = "yes" ; then
690   echo "CONFIG_ADLIB=yes" >> $config_mak
691   echo "#define CONFIG_ADLIB 1" >> $config_h
692 fi
693 if test "$oss" = "yes" ; then
694   echo "CONFIG_OSS=yes" >> $config_mak
695   echo "#define CONFIG_OSS 1" >> $config_h
696 fi
697 if test "$coreaudio" = "yes" ; then
698   echo "CONFIG_COREAUDIO=yes" >> $config_mak
699   echo "#define CONFIG_COREAUDIO 1" >> $config_h
700 fi
701 if test "$alsa" = "yes" ; then
702   echo "CONFIG_ALSA=yes" >> $config_mak
703   echo "#define CONFIG_ALSA 1" >> $config_h
704 fi
705 if test "$dsound" = "yes" ; then
706   echo "CONFIG_DSOUND=yes" >> $config_mak
707   echo "#define CONFIG_DSOUND 1" >> $config_h
708 fi
709 if test "$fmod" = "yes" ; then
710   echo "CONFIG_FMOD=yes" >> $config_mak
711   echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
712   echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
713   echo "#define CONFIG_FMOD 1" >> $config_h
714 fi
715 qemu_version=`head $source_path/VERSION`
716 echo "VERSION=$qemu_version" >>$config_mak
717 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
718
719 echo "SRC_PATH=$source_path" >> $config_mak
720 if [ "$source_path_used" = "yes" ]; then
721   echo "VPATH=$source_path" >> $config_mak
722 fi
723 echo "TARGET_DIRS=$target_list" >> $config_mak
724 if [ "$build_docs" = "yes" ] ; then
725   echo "BUILD_DOCS=yes" >> $config_mak
726 fi
727
728 # XXX: suppress that
729 if [ "$bsd" = "yes" ] ; then
730   echo "#define O_LARGEFILE 0" >> $config_h
731   echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
732   echo "#define _BSD 1" >> $config_h
733 fi
734
735 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
736
737 for target in $target_list; do
738 target_dir="$target"
739 config_mak=$target_dir/config.mak
740 config_h=$target_dir/config.h
741 target_cpu=`echo $target | cut -d '-' -f 1`
742 target_bigendian="no"
743 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
744 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
745 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
746 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
747 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
748 [ "$target_cpu" = "mips" ] && target_bigendian=yes
749 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
750 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
751 target_softmmu="no"
752 if expr $target : '.*-softmmu' > /dev/null ; then
753   target_softmmu="yes"
754 fi
755 target_user_only="no"
756 if expr $target : '.*-user' > /dev/null ; then
757   target_user_only="yes"
758 fi
759
760 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
761         -a "$sdl" = "no" -a "$cocoa" = "no" ; then
762     echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
763     echo "To build QEMU without graphical output configure with --disable-gfx-check"
764     echo "Note that this will disable all output from the virtual graphics card."
765     exit 1;
766 fi
767
768 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
769
770 mkdir -p $target_dir
771 mkdir -p $target_dir/fpu
772 if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
773   mkdir -p $target_dir/nwfpe
774 fi
775 if test "$target_user_only" = "no" ; then
776   mkdir -p $target_dir/slirp
777 fi
778
779 #
780 # don't use ln -sf as not all "ln -sf" over write the file/link
781 #
782 rm -f $target_dir/Makefile
783 ln -s $source_path/Makefile.target $target_dir/Makefile
784
785
786 echo "# Automatically generated by configure - do not modify" > $config_mak
787 echo "/* Automatically generated by configure - do not modify */" > $config_h
788
789
790 echo "include ../config-host.mak" >> $config_mak
791 echo "#include \"../config-host.h\"" >> $config_h
792
793 bflt="no"
794 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
795 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
796
797 if test "$target_cpu" = "i386" ; then
798   echo "TARGET_ARCH=i386" >> $config_mak
799   echo "#define TARGET_ARCH \"i386\"" >> $config_h
800   echo "#define TARGET_I386 1" >> $config_h
801   if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
802     echo "#define USE_KQEMU 1" >> $config_h
803   fi
804 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
805   echo "TARGET_ARCH=arm" >> $config_mak
806   echo "#define TARGET_ARCH \"arm\"" >> $config_h
807   echo "#define TARGET_ARM 1" >> $config_h
808   bflt="yes"
809 elif test "$target_cpu" = "sparc" ; then
810   echo "TARGET_ARCH=sparc" >> $config_mak
811   echo "#define TARGET_ARCH \"sparc\"" >> $config_h
812   echo "#define TARGET_SPARC 1" >> $config_h
813 elif test "$target_cpu" = "sparc64" ; then
814   echo "TARGET_ARCH=sparc64" >> $config_mak
815   echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
816   echo "#define TARGET_SPARC 1" >> $config_h
817   echo "#define TARGET_SPARC64 1" >> $config_h
818 elif test "$target_cpu" = "ppc" ; then
819   echo "TARGET_ARCH=ppc" >> $config_mak
820   echo "#define TARGET_ARCH \"ppc\"" >> $config_h
821   echo "#define TARGET_PPC 1" >> $config_h
822 elif test "$target_cpu" = "ppc64" ; then
823   echo "TARGET_ARCH=ppc64" >> $config_mak
824   echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
825   echo "#define TARGET_PPC 1" >> $config_h
826   echo "#define TARGET_PPC64 1" >> $config_h
827 elif test "$target_cpu" = "x86_64" ; then
828   echo "TARGET_ARCH=x86_64" >> $config_mak
829   echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
830   echo "#define TARGET_I386 1" >> $config_h
831   echo "#define TARGET_X86_64 1" >> $config_h
832   if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
833     echo "#define USE_KQEMU 1" >> $config_h
834   fi
835 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
836   echo "TARGET_ARCH=mips" >> $config_mak
837   echo "#define TARGET_ARCH \"mips\"" >> $config_h
838   echo "#define TARGET_MIPS 1" >> $config_h
839   echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
840   echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
841 elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
842   echo "TARGET_ARCH=sh4" >> $config_mak
843   echo "#define TARGET_ARCH \"sh4\"" >> $config_h
844   echo "#define TARGET_SH4 1" >> $config_h
845   bflt="yes"
846 elif test "$target_cpu" = "m68k" ; then
847   echo "TARGET_ARCH=m68k" >> $config_mak
848   echo "#define TARGET_ARCH \"m68k\"" >> $config_h
849   echo "#define TARGET_M68K 1" >> $config_h
850   bflt="yes"
851 else
852   echo "Unsupported target CPU"
853   exit 1
854 fi
855 if test "$target_bigendian" = "yes" ; then
856   echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
857   echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
858 fi
859 if test "$target_softmmu" = "yes" ; then
860   echo "CONFIG_SOFTMMU=yes" >> $config_mak
861   echo "#define CONFIG_SOFTMMU 1" >> $config_h
862 fi
863 if test "$target_user_only" = "yes" ; then
864   echo "CONFIG_USER_ONLY=yes" >> $config_mak
865   echo "#define CONFIG_USER_ONLY 1" >> $config_h
866 fi
867
868 if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
869   echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
870   echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
871 fi
872 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
873   echo "TARGET_HAS_BFLT=yes" >> $config_mak
874   echo "#define TARGET_HAS_BFLT 1" >> $config_h
875 fi
876 # sdl defines
877
878 if test "$target_user_only" = "no"; then
879     if test "$target_softmmu" = "no" -o "$static" = "yes"; then
880         sdl1=$sdl_static
881     else
882         sdl1=$sdl
883     fi
884     if test "$sdl1" = "yes" ; then
885         echo "#define CONFIG_SDL 1" >> $config_h
886         echo "CONFIG_SDL=yes" >> $config_mak
887         if test "$target_softmmu" = "no" -o "$static" = "yes"; then
888             echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
889         else
890             echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
891         fi
892         if [ "${aa}" = "yes" ] ; then
893             echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
894         else
895             echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
896         fi
897     fi
898 fi
899
900 if test "$cocoa" = "yes" ; then
901     echo "#define CONFIG_COCOA 1" >> $config_h
902     echo "CONFIG_COCOA=yes" >> $config_mak
903 fi
904
905 done # for target in $targets
906
907 # build tree in object directory if source path is different from current one
908 if test "$source_path_used" = "yes" ; then
909     DIRS="tests"
910     FILES="Makefile tests/Makefile"
911     for dir in $DIRS ; do
912             mkdir -p $dir
913     done
914     # remove the link and recreate it, as not all "ln -sf" overwrite the link
915     for f in $FILES ; do
916         rm -f $f
917         ln -s $source_path/$f $f
918     done
919 fi
920
921 rm -f $TMPO $TMPC $TMPE $TMPS
This page took 0.075156 seconds and 4 git commands to generate.