xref: /openbmc/qemu/configure (revision 1d14ffa9)
17d13299dSbellard#!/bin/sh
27d13299dSbellard#
33ef693a0Sbellard# qemu configure script (c) 2003 Fabrice Bellard
47d13299dSbellard#
57d13299dSbellard# set temporary file name
67d13299dSbellardif test ! -z "$TMPDIR" ; then
77d13299dSbellard    TMPDIR1="${TMPDIR}"
87d13299dSbellardelif test ! -z "$TEMPDIR" ; then
97d13299dSbellard    TMPDIR1="${TEMPDIR}"
107d13299dSbellardelse
117d13299dSbellard    TMPDIR1="/tmp"
127d13299dSbellardfi
137d13299dSbellard
143ef693a0SbellardTMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
153ef693a0SbellardTMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
163ef693a0SbellardTMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
173ef693a0SbellardTMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
187d13299dSbellard
197d13299dSbellard# default parameters
2011d9f695Sbellardprefix=""
211e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M"
2243ce4dfeSbellardstatic="no"
237d13299dSbellardcross_prefix=""
247d13299dSbellardcc="gcc"
257d13299dSbellardhost_cc="gcc"
267d13299dSbellardar="ar"
277d13299dSbellardmake="make"
287d13299dSbellardstrip="strip"
297d13299dSbellardcpu=`uname -m`
305327cf48Sbellardtarget_list=""
317d13299dSbellardcase "$cpu" in
327d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
3397a847bcSbellard    cpu="i386"
347d13299dSbellard  ;;
35ba68055eSbellard  armv*b)
36808c4954Sbellard    cpu="armv4b"
37808c4954Sbellard  ;;
38ba68055eSbellard  armv*l)
397d13299dSbellard    cpu="armv4l"
407d13299dSbellard  ;;
417d13299dSbellard  alpha)
427d13299dSbellard    cpu="alpha"
437d13299dSbellard  ;;
44295defa5Sbellard  "Power Macintosh"|ppc|ppc64)
457d13299dSbellard    cpu="powerpc"
467d13299dSbellard  ;;
477d13299dSbellard  mips)
487d13299dSbellard    cpu="mips"
497d13299dSbellard  ;;
50fb3e5849Sbellard  s390)
51fb3e5849Sbellard    cpu="s390"
52fb3e5849Sbellard  ;;
53ae228531Sbellard  sparc)
54ae228531Sbellard    cpu="sparc"
55ae228531Sbellard  ;;
56ae228531Sbellard  sparc64)
57ae228531Sbellard    cpu="sparc64"
58ae228531Sbellard  ;;
59a8baa8c5Sbellard  ia64)
60a8baa8c5Sbellard    cpu="ia64"
61a8baa8c5Sbellard  ;;
6238e584a0Sbellard  m68k)
6338e584a0Sbellard    cpu="m68k"
6438e584a0Sbellard  ;;
65bc51c5c9Sbellard  x86_64|amd64)
660b0babc6Sbellard    cpu="x86_64"
67bc51c5c9Sbellard  ;;
687d13299dSbellard  *)
697d13299dSbellard    cpu="unknown"
707d13299dSbellard  ;;
717d13299dSbellardesac
727d13299dSbellardgprof="no"
737d13299dSbellardbigendian="no"
7467b915a5Sbellardmingw32="no"
7567b915a5SbellardEXESUF=""
7667b915a5Sbellardgdbstub="yes"
77443f1376Sbellardslirp="yes"
78fb065187Sbellardadlib="no"
79fb065187Sbellardoss="no"
80*1d14ffa9Sbellarddsound="no"
81*1d14ffa9Sbellardcoreaudio="no"
82*1d14ffa9Sbellardalsa="no"
83102a52e4Sbellardfmod="no"
84102a52e4Sbellardfmod_lib=""
85102a52e4Sbellardfmod_inc=""
865327cf48Sbellardlinux="no"
87c9ec1fe4Sbellardkqemu="no"
88c9ec1fe4Sbellardkernel_path=""
895b0753e0Sbellardcocoa="no"
9097ccc689Sbellardcheck_gfx="yes"
917d13299dSbellard
927d13299dSbellard# OS specific
937d13299dSbellardtargetos=`uname -s`
947d13299dSbellardcase $targetos in
95c326e0afSbellardCYGWIN*)
96c326e0afSbellardmingw32="yes"
97c326e0afSbellardCFLAGS="-O2 -mno-cygwin"
98c326e0afSbellard;;
9967b915a5SbellardMINGW32*)
10067b915a5Sbellardmingw32="yes"
10167b915a5Sbellard;;
1027d3505c5SbellardFreeBSD)
1037d3505c5Sbellardbsd="yes"
104fb065187Sbellardoss="yes"
105e99f9060Sbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
10607f4ddbfSbellard    kqemu="yes"
10707f4ddbfSbellardfi
1087d3505c5Sbellard;;
1097d3505c5SbellardNetBSD)
1107d3505c5Sbellardbsd="yes"
111fb065187Sbellardoss="yes"
1127d3505c5Sbellard;;
1137d3505c5SbellardOpenBSD)
1147d3505c5Sbellardbsd="yes"
115fb065187Sbellardoss="yes"
1167d3505c5Sbellard;;
11783fb7adfSbellardDarwin)
11883fb7adfSbellardbsd="yes"
11983fb7adfSbellarddarwin="yes"
12083fb7adfSbellard;;
121fb065187Sbellard*)
122fb065187Sbellardoss="yes"
1235327cf48Sbellardlinux="yes"
12407f4ddbfSbellardif [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
125c9ec1fe4Sbellard    kqemu="yes"
126c9ec1fe4Sbellardfi
127fb065187Sbellard;;
1287d13299dSbellardesac
1297d13299dSbellard
1307d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
13183fb7adfSbellard  if [ ! "$darwin" = "yes" ] ; then
1327d3505c5Sbellard    make="gmake"
13383fb7adfSbellard  fi
1347d3505c5Sbellardfi
1357d3505c5Sbellard
1367d13299dSbellard# find source path
1377d13299dSbellard# XXX: we assume an absolute path is given when launching configure,
1387d13299dSbellard# except in './configure' case.
1397d13299dSbellardsource_path=${0%configure}
1407d13299dSbellardsource_path=${source_path%/}
1417d13299dSbellardsource_path_used="yes"
1427d13299dSbellardif test -z "$source_path" -o "$source_path" = "." ; then
1437d13299dSbellard    source_path=`pwd`
1447d13299dSbellard    source_path_used="no"
1457d13299dSbellardfi
1467d13299dSbellard
1477d13299dSbellardfor opt do
1487d13299dSbellard  case "$opt" in
1497d13299dSbellard  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
1507d13299dSbellard  ;;
15132ce6337Sbellard  --interp-prefix=*) interp_prefix=`echo $opt | cut -d '=' -f 2`
15232ce6337Sbellard  ;;
1537d13299dSbellard  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
1547d13299dSbellard  ;;
1557d13299dSbellard  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
1567d13299dSbellard  ;;
1577d13299dSbellard  --cc=*) cc=`echo $opt | cut -d '=' -f 2`
1587d13299dSbellard  ;;
15983469015Sbellard  --host-cc=*) host_cc=`echo $opt | cut -d '=' -f 2`
16083469015Sbellard  ;;
1617d13299dSbellard  --make=*) make=`echo $opt | cut -d '=' -f 2`
1627d13299dSbellard  ;;
1637d13299dSbellard  --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
1647d13299dSbellard  ;;
1657d13299dSbellard  --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
1667d13299dSbellard  ;;
1677d13299dSbellard  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
1687d13299dSbellard  ;;
16997a847bcSbellard  --target-list=*) target_list=${opt#--target-list=}
170de83cd02Sbellard  ;;
1717d13299dSbellard  --enable-gprof) gprof="yes"
1727d13299dSbellard  ;;
17343ce4dfeSbellard  --static) static="yes"
17443ce4dfeSbellard  ;;
17597a847bcSbellard  --disable-sdl) sdl="no"
17697a847bcSbellard  ;;
177*1d14ffa9Sbellard  --enable-coreaudio) coreaudio="yes"
178*1d14ffa9Sbellard  ;;
179*1d14ffa9Sbellard  --enable-alsa) alsa="yes"
180*1d14ffa9Sbellard  ;;
181*1d14ffa9Sbellard  --enable-dsound) dsound="yes"
182*1d14ffa9Sbellard  ;;
183102a52e4Sbellard  --enable-fmod) fmod="yes"
184102a52e4Sbellard  ;;
185102a52e4Sbellard  --fmod-lib=*) fmod_lib=${opt#--fmod-lib=}
186102a52e4Sbellard  ;;
187102a52e4Sbellard  --fmod-inc=*) fmod_inc=${opt#--fmod-inc=}
188102a52e4Sbellard  ;;
18967b915a5Sbellard  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
19067b915a5Sbellard  ;;
191443f1376Sbellard  --disable-slirp) slirp="no"
192c20709aaSbellard  ;;
193fb065187Sbellard  --enable-adlib) adlib="yes"
194fb065187Sbellard  ;;
195c9ec1fe4Sbellard  --disable-kqemu) kqemu="no"
196c9ec1fe4Sbellard  ;;
197c9ec1fe4Sbellard  --kernel-path=*) kernel_path=${opt#--kernel-path=}
198c9ec1fe4Sbellard  ;;
199*1d14ffa9Sbellard  --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
2005b0753e0Sbellard  ;;
20197ccc689Sbellard  --disable-gfx-check) check_gfx="no"
20297ccc689Sbellard  ;;
2037d13299dSbellard  esac
2047d13299dSbellarddone
2057d13299dSbellard
2067d13299dSbellard# Checking for CFLAGS
2077d13299dSbellardif test -z "$CFLAGS"; then
2087d13299dSbellard    CFLAGS="-O2"
2097d13299dSbellardfi
2107d13299dSbellard
2117d13299dSbellardcc="${cross_prefix}${cc}"
2127d13299dSbellardar="${cross_prefix}${ar}"
2137d13299dSbellardstrip="${cross_prefix}${strip}"
2147d13299dSbellard
21567b915a5Sbellardif test "$mingw32" = "yes" ; then
2165327cf48Sbellard    linux="no"
21767b915a5Sbellard    EXESUF=".exe"
21867b915a5Sbellard    gdbstub="no"
2199f059ecaSbellard    oss="no"
22007f4ddbfSbellard    if [ "$cpu" = "i386" ] ; then
22107f4ddbfSbellard        kqemu="yes"
22207f4ddbfSbellard    fi
22367b915a5Sbellardfi
22467b915a5Sbellard
2255327cf48Sbellardif test -z "$target_list" ; then
2265327cf48Sbellard# these targets are portable
227d3258560Sbellard    target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu"
2285327cf48Sbellard# the following are Linux specific
2295327cf48Sbellard    if [ "$linux" = "yes" ] ; then
230a20b5524Sbellard        target_list="i386-user arm-user armeb-user sparc-user ppc-user $target_list"
2315327cf48Sbellard    fi
2326e20a45fSbellardelse
2336e20a45fSbellard    target_list=$(echo "$target_list" | sed -e 's/,/ /g')
2345327cf48Sbellardfi
2355327cf48Sbellard
2367d13299dSbellardif test -z "$cross_prefix" ; then
2377d13299dSbellard
2387d13299dSbellard# ---
2397d13299dSbellard# big/little endian test
2407d13299dSbellardcat > $TMPC << EOF
2417d13299dSbellard#include <inttypes.h>
2427d13299dSbellardint main(int argc, char ** argv){
2437d13299dSbellard        volatile uint32_t i=0x01234567;
2447d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
2457d13299dSbellard}
2467d13299dSbellardEOF
2477d13299dSbellard
2487d13299dSbellardif $cc -o $TMPE $TMPC 2>/dev/null ; then
2497d13299dSbellard$TMPE && bigendian="yes"
2507d13299dSbellardelse
2517d13299dSbellardecho big/little test failed
2527d13299dSbellardfi
2537d13299dSbellard
2547d13299dSbellardelse
2557d13299dSbellard
2567d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
257808c4954Sbellardif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
2587d13299dSbellard    bigendian="yes"
2597d13299dSbellardfi
2607d13299dSbellard
2617d13299dSbellardfi
2627d13299dSbellard
263b6853697Sbellard# host long bits test
264b6853697Sbellardhostlongbits="32"
265b6853697Sbellardif test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
266b6853697Sbellard    hostlongbits="64"
267b6853697Sbellardfi
268b6853697Sbellard
269e8cd23deSbellard# check gcc options support
27004369ff2Sbellardcat > $TMPC <<EOF
27104369ff2Sbellardint main(void) {
27204369ff2Sbellard}
27304369ff2SbellardEOF
27404369ff2Sbellard
275e8cd23deSbellardhave_gcc3_options="no"
276e8cd23deSbellardif $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
277e8cd23deSbellard   have_gcc3_options="yes"
27804369ff2Sbellardfi
279ca735206Sbellard
28011d9f695Sbellard##########################################
28111d9f695Sbellard# SDL probe
28211d9f695Sbellard
28311d9f695Sbellardsdl_too_old=no
28411d9f695Sbellard
28511d9f695Sbellardif test -z "$sdl" ; then
28611d9f695Sbellard
287a6e022adSbellardsdl_config="sdl-config"
288a6e022adSbellardsdl=no
2897c1f25b4Sbellardsdl_static=no
290a6e022adSbellard
291a6e022adSbellardif test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
292a6e022adSbellard# win32 cross compilation case
293a6e022adSbellard    sdl_config="i386-mingw32msvc-sdl-config"
294a6e022adSbellard    sdl=yes
295a6e022adSbellardelse
296a6e022adSbellard# normal SDL probe
29711d9f695Sbellardcat > $TMPC << EOF
29811d9f695Sbellard#include <SDL.h>
29911d9f695Sbellard#undef main /* We don't want SDL to override our main() */
30011d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
30111d9f695SbellardEOF
30211d9f695Sbellard
303a6e022adSbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
304a6e022adSbellard_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
30511d9f695Sbellardif test "$_sdlversion" -lt 121 ; then
30611d9f695Sbellardsdl_too_old=yes
30711d9f695Sbellardelse
30811d9f695Sbellardsdl=yes
30911d9f695Sbellardfi
3107c1f25b4Sbellard
3117c1f25b4Sbellard# static link with sdl ?
3127c1f25b4Sbellardif test "$sdl" = "yes" ; then
3137c1f25b4Sbellardaa="no"
3147c1f25b4Sbellard`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
3157c1f25b4Sbellardsdl_static_libs=`$sdl_config --static-libs`
3167c1f25b4Sbellardif [ "$aa" = "yes" ] ; then
317d8d8aa4eSbellard  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
31811d9f695Sbellardfi
31911d9f695Sbellard
3207c1f25b4Sbellardif $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
3217c1f25b4Sbellard  sdl_static=yes
3227c1f25b4Sbellardfi
3237c1f25b4Sbellard
3247c1f25b4Sbellardfi # static link
3257c1f25b4Sbellard
3267c1f25b4Sbellardfi # sdl compile test
3277c1f25b4Sbellard
328a6e022adSbellardfi # cross compilation
329a6e022adSbellardfi # -z $sdl
33011d9f695Sbellard
3317d13299dSbellardif test x"$1" = x"-h" -o x"$1" = x"--help" ; then
3327d13299dSbellardcat << EOF
3337d13299dSbellard
3347d13299dSbellardUsage: configure [options]
3357d13299dSbellardOptions: [defaults in brackets after descriptions]
3367d13299dSbellard
3377d13299dSbellardEOF
3387d13299dSbellardecho "Standard options:"
3397d13299dSbellardecho "  --help                   print this message"
3407d13299dSbellardecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
3411e43adfcSbellardecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
3421e43adfcSbellardecho "                           use %M for cpu name [$interp_prefix]"
34397a847bcSbellardecho "  --target-list=LIST       set target list [$target_list]"
3447d13299dSbellardecho ""
345c9ec1fe4Sbellardecho "kqemu kernel acceleration support:"
346c9ec1fe4Sbellardecho "  --disable-kqemu          disable kqemu build"
347c9ec1fe4Sbellardecho "  --kernel-path=PATH       set the kernel path (configure probes it)"
348c9ec1fe4Sbellardecho ""
3497d13299dSbellardecho "Advanced options (experts only):"
3507d13299dSbellardecho "  --source-path=PATH       path of source code [$source_path]"
3517d13299dSbellardecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
3527d13299dSbellardecho "  --cc=CC                  use C compiler CC [$cc]"
35383469015Sbellardecho "  --host-cc=CC             use C compiler CC [$cc] for dyngen etc."
3547d13299dSbellardecho "  --make=MAKE              use specified make [$make]"
35543ce4dfeSbellardecho "  --static                 enable static build [$static]"
35667b915a5Sbellardecho "  --enable-mingw32         enable Win32 cross compilation with mingw32"
357d37282adSbellardecho "  --enable-adlib           enable Adlib emulation"
358*1d14ffa9Sbellardecho "  --enable-coreaudio       enable Coreaudio audio driver"
359*1d14ffa9Sbellardecho "  --enable-alsa            enable ALSA audio driver"
360*1d14ffa9Sbellardecho "  --enable-fmod            enable FMOD audio driver"
361*1d14ffa9Sbellardecho "  --enabled-dsound         enable DirectSound audio driver"
362102a52e4Sbellardecho "  --fmod-lib               path to FMOD library"
363102a52e4Sbellardecho "  --fmod-inc               path to FMOD includes"
3647d13299dSbellardecho ""
3657d13299dSbellardecho "NOTE: The object files are build at the place where configure is launched"
3667d13299dSbellardexit 1
3677d13299dSbellardfi
3687d13299dSbellard
36911d9f695Sbellardif test "$mingw32" = "yes" ; then
37011d9f695Sbellardif test -z "$prefix" ; then
37111d9f695Sbellard    prefix="/c/Program Files/Qemu"
37211d9f695Sbellardfi
37311d9f695Sbellardmandir="$prefix"
3747efa4387Sbellarddatadir="$prefix"
3751f50f8d1Sbellarddocdir="$prefix"
37611d9f695Sbellardbindir="$prefix"
37711d9f695Sbellardelse
37811d9f695Sbellardif test -z "$prefix" ; then
37911d9f695Sbellard    prefix="/usr/local"
38011d9f695Sbellardfi
3815a67135aSbellardmandir="$prefix/share/man"
3827efa4387Sbellarddatadir="$prefix/share/qemu"
3831f50f8d1Sbellarddocdir="$prefix/share/doc/qemu"
38411d9f695Sbellardbindir="$prefix/bin"
38511d9f695Sbellardfi
3865a67135aSbellard
38707f4ddbfSbellard# kqemu support
388c9ec1fe4Sbellardif test $kqemu = "yes" ; then
389441c72baSbellard    # test if the source code is installed
390441c72baSbellard    if test '!' -f "kqemu/Makefile" ; then
391441c72baSbellard        kqemu="no"
392441c72baSbellard    fi
393441c72baSbellardfi
394441c72baSbellard
39507f4ddbfSbellard# Linux specific kqemu configuration
39607f4ddbfSbellardif test $kqemu = "yes" -a $linux = "yes" ; then
397c9ec1fe4Sbellard# find the kernel path
398c9ec1fe4Sbellardif test -z "$kernel_path" ; then
399c9ec1fe4Sbellardkernel_version=`uname -r`
400c9ec1fe4Sbellardkernel_path="/lib/modules/$kernel_version/build"
401c9ec1fe4Sbellardif test '!' -d "$kernel_path/include" ; then
402c9ec1fe4Sbellard    kernel_path="/usr/src/linux"
403c9ec1fe4Sbellard    if test '!' -d "$kernel_path/include" ; then
404c9ec1fe4Sbellard        echo "Could not find kernel includes in /lib/modules or /usr/src/linux - cannot build the kqemu module"
405c9ec1fe4Sbellard        kqemu="no"
406c9ec1fe4Sbellard    fi
407c9ec1fe4Sbellardfi
408c9ec1fe4Sbellardfi
409c9ec1fe4Sbellard
410c9ec1fe4Sbellardif test $kqemu = "yes" ; then
411c9ec1fe4Sbellard
412c9ec1fe4Sbellard# test that the kernel config is present
413c9ec1fe4Sbellardif test '!' -f "$kernel_path/Makefile" ; then
414f94daeddSbellard    echo "No Makefile file present in $kernel_path - kqemu cannot be built"
415c9ec1fe4Sbellard    kqemu="no"
416c9ec1fe4Sbellardfi
417c9ec1fe4Sbellard
418c9ec1fe4Sbellard# find build system (2.6 or legacy)
419c9ec1fe4Sbellardkbuild26="yes"
420c9ec1fe4Sbellardif grep -q "PATCHLEVEL = 4" $kernel_path/Makefile ; then
421c9ec1fe4Sbellardkbuild26="no"
422c9ec1fe4Sbellardfi
423c9ec1fe4Sbellard
424c9ec1fe4Sbellardfi # kqemu
425c9ec1fe4Sbellard
42607f4ddbfSbellardfi # kqemu and linux
427c9ec1fe4Sbellard
428c9ec1fe4Sbellard
4297d13299dSbellardecho "Install prefix    $prefix"
4307efa4387Sbellardecho "BIOS directory    $datadir"
43111d9f695Sbellardecho "binary directory  $bindir"
43211d9f695Sbellardif test "$mingw32" = "no" ; then
43311d9f695Sbellardecho "Manual directory  $mandir"
43443ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
43511d9f695Sbellardfi
4365a67135aSbellardecho "Source path       $source_path"
4377d13299dSbellardecho "C compiler        $cc"
43883469015Sbellardecho "Host C compiler   $host_cc"
4397d13299dSbellardecho "make              $make"
440a98fd896Sbellardecho "host CPU          $cpu"
441de83cd02Sbellardecho "host big endian   $bigendian"
44297a847bcSbellardecho "target list       $target_list"
4437d13299dSbellardecho "gprof enabled     $gprof"
44443ce4dfeSbellardecho "static build      $static"
4455b0753e0Sbellardif test "$darwin" = "yes" ; then
4465b0753e0Sbellard    echo "Cocoa support     $cocoa"
4475b0753e0Sbellardfi
44897a847bcSbellardecho "SDL support       $sdl"
449e4afee97Sbellardif test "$sdl" != "no" ; then
4507c1f25b4Sbellard    echo "SDL static link   $sdl_static"
451e4afee97Sbellardfi
45267b915a5Sbellardecho "mingw32 support   $mingw32"
453fb065187Sbellardecho "Adlib support     $adlib"
454*1d14ffa9Sbellardecho "CoreAudio support $coreaudio"
455*1d14ffa9Sbellardecho "ALSA support      $alsa"
456*1d14ffa9Sbellardecho "DSound support    $dsound"
457102a52e4Sbellardecho -n "FMOD support      $fmod"
458*1d14ffa9Sbellardif test "$fmod" = "yes"; then
459*1d14ffa9Sbellard    if test -z $fmod_lib || test -z $fmod_inc; then
460*1d14ffa9Sbellard        echo
461*1d14ffa9Sbellard        echo "Error: You must specify path to FMOD library and headers"
462*1d14ffa9Sbellard        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
463*1d14ffa9Sbellard        echo
464*1d14ffa9Sbellard        exit 1
465*1d14ffa9Sbellard    fi
466102a52e4Sbellard    echo -n " (lib='$fmod_lib' include='$fmod_inc')"
467102a52e4Sbellardfi
468102a52e4Sbellardecho ""
46907f4ddbfSbellardecho "kqemu support     $kqemu"
47007f4ddbfSbellardif test $kqemu = "yes" -a $linux = "yes" ; then
471c9ec1fe4Sbellardecho ""
47207f4ddbfSbellardecho "KQEMU Linux module configuration:"
473c9ec1fe4Sbellardecho "kernel sources    $kernel_path"
474c9ec1fe4Sbellardecho -n "kbuild type       "
475c9ec1fe4Sbellardif test $kbuild26 = "yes"; then
476c9ec1fe4Sbellardecho "2.6"
477c9ec1fe4Sbellardelse
478c9ec1fe4Sbellardecho "2.4"
479c9ec1fe4Sbellardfi
480c9ec1fe4Sbellardfi
48167b915a5Sbellard
48297a847bcSbellardif test $sdl_too_old = "yes"; then
48324b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
484e8cd23deSbellardfi
48524b55b96Sbellard#if test "$sdl_static" = "no"; then
48624b55b96Sbellard#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
48724b55b96Sbellard#fi
48897a847bcSbellard
48997a847bcSbellardconfig_mak="config-host.mak"
49097a847bcSbellardconfig_h="config-host.h"
49197a847bcSbellard
4927c1f25b4Sbellard#echo "Creating $config_mak and $config_h"
49397a847bcSbellard
49497a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
49597a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
49697a847bcSbellard
49797a847bcSbellardecho "prefix=$prefix" >> $config_mak
49811d9f695Sbellardecho "bindir=$bindir" >> $config_mak
4995a67135aSbellardecho "mandir=$mandir" >> $config_mak
5007efa4387Sbellardecho "datadir=$datadir" >> $config_mak
5011f50f8d1Sbellardecho "docdir=$docdir" >> $config_mak
5027efa4387Sbellardecho "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
50397a847bcSbellardecho "MAKE=$make" >> $config_mak
50497a847bcSbellardecho "CC=$cc" >> $config_mak
50597a847bcSbellardif test "$have_gcc3_options" = "yes" ; then
50697a847bcSbellard  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
50797a847bcSbellardfi
50897a847bcSbellardecho "HOST_CC=$host_cc" >> $config_mak
50997a847bcSbellardecho "AR=$ar" >> $config_mak
51097a847bcSbellardecho "STRIP=$strip -s -R .comment -R .note" >> $config_mak
51197a847bcSbellardecho "CFLAGS=$CFLAGS" >> $config_mak
51297a847bcSbellardecho "LDFLAGS=$LDFLAGS" >> $config_mak
51367b915a5Sbellardecho "EXESUF=$EXESUF" >> $config_mak
51497a847bcSbellardif test "$cpu" = "i386" ; then
51597a847bcSbellard  echo "ARCH=i386" >> $config_mak
51697a847bcSbellard  echo "#define HOST_I386 1" >> $config_h
5170b0babc6Sbellardelif test "$cpu" = "x86_64" ; then
5180b0babc6Sbellard  echo "ARCH=x86_64" >> $config_mak
5190b0babc6Sbellard  echo "#define HOST_X86_64 1" >> $config_h
520808c4954Sbellardelif test "$cpu" = "armv4b" ; then
521808c4954Sbellard  echo "ARCH=arm" >> $config_mak
522808c4954Sbellard  echo "#define HOST_ARM 1" >> $config_h
5237d13299dSbellardelif test "$cpu" = "armv4l" ; then
52497a847bcSbellard  echo "ARCH=arm" >> $config_mak
52597a847bcSbellard  echo "#define HOST_ARM 1" >> $config_h
5267d13299dSbellardelif test "$cpu" = "powerpc" ; then
52797a847bcSbellard  echo "ARCH=ppc" >> $config_mak
52897a847bcSbellard  echo "#define HOST_PPC 1" >> $config_h
5297d13299dSbellardelif test "$cpu" = "mips" ; then
53097a847bcSbellard  echo "ARCH=mips" >> $config_mak
53197a847bcSbellard  echo "#define HOST_MIPS 1" >> $config_h
532fb3e5849Sbellardelif test "$cpu" = "s390" ; then
53397a847bcSbellard  echo "ARCH=s390" >> $config_mak
53497a847bcSbellard  echo "#define HOST_S390 1" >> $config_h
535295defa5Sbellardelif test "$cpu" = "alpha" ; then
53697a847bcSbellard  echo "ARCH=alpha" >> $config_mak
53797a847bcSbellard  echo "#define HOST_ALPHA 1" >> $config_h
538ae228531Sbellardelif test "$cpu" = "sparc" ; then
53997a847bcSbellard  echo "ARCH=sparc" >> $config_mak
54097a847bcSbellard  echo "#define HOST_SPARC 1" >> $config_h
541ae228531Sbellardelif test "$cpu" = "sparc64" ; then
54297a847bcSbellard  echo "ARCH=sparc64" >> $config_mak
54397a847bcSbellard  echo "#define HOST_SPARC64 1" >> $config_h
544a8baa8c5Sbellardelif test "$cpu" = "ia64" ; then
54597a847bcSbellard  echo "ARCH=ia64" >> $config_mak
54697a847bcSbellard  echo "#define HOST_IA64 1" >> $config_h
54738e584a0Sbellardelif test "$cpu" = "m68k" ; then
54838ca2abcSbellard  echo "ARCH=m68k" >> $config_mak
54938ca2abcSbellard  echo "#define HOST_M68K 1" >> $config_h
5507d13299dSbellardelse
5517d13299dSbellard  echo "Unsupported CPU"
5527d13299dSbellard  exit 1
5537d13299dSbellardfi
5547d13299dSbellardif test "$bigendian" = "yes" ; then
55597a847bcSbellard  echo "WORDS_BIGENDIAN=yes" >> $config_mak
55697a847bcSbellard  echo "#define WORDS_BIGENDIAN 1" >> $config_h
55797a847bcSbellardfi
558b6853697Sbellardecho "#define HOST_LONG_BITS $hostlongbits" >> $config_h
55967b915a5Sbellardif test "$mingw32" = "yes" ; then
56067b915a5Sbellard  echo "CONFIG_WIN32=yes" >> $config_mak
56111d9f695Sbellard  echo "#define CONFIG_WIN32 1" >> $config_h
5627d3505c5Sbellardelif test -f "/usr/include/byteswap.h" ; then
56397a847bcSbellard  echo "#define HAVE_BYTESWAP_H 1" >> $config_h
56467b915a5Sbellardfi
56583fb7adfSbellardif test "$darwin" = "yes" ; then
56683fb7adfSbellard  echo "CONFIG_DARWIN=yes" >> $config_mak
56783fb7adfSbellard  echo "#define CONFIG_DARWIN 1" >> $config_h
56883fb7adfSbellardfi
56967b915a5Sbellardif test "$gdbstub" = "yes" ; then
57067b915a5Sbellard  echo "CONFIG_GDBSTUB=yes" >> $config_mak
57167b915a5Sbellard  echo "#define CONFIG_GDBSTUB 1" >> $config_h
57267b915a5Sbellardfi
57397a847bcSbellardif test "$gprof" = "yes" ; then
57497a847bcSbellard  echo "TARGET_GPROF=yes" >> $config_mak
57597a847bcSbellard  echo "#define HAVE_GPROF 1" >> $config_h
57697a847bcSbellardfi
57797a847bcSbellardif test "$static" = "yes" ; then
57897a847bcSbellard  echo "CONFIG_STATIC=yes" >> $config_mak
57950863472Sbellard  echo "#define CONFIG_STATIC 1" >> $config_h
58097a847bcSbellardfi
581c20709aaSbellardif test "$slirp" = "yes" ; then
582c20709aaSbellard  echo "CONFIG_SLIRP=yes" >> $config_mak
583c20709aaSbellard  echo "#define CONFIG_SLIRP 1" >> $config_h
584c20709aaSbellardfi
585fb065187Sbellardif test "$adlib" = "yes" ; then
586fb065187Sbellard  echo "CONFIG_ADLIB=yes" >> $config_mak
587fb065187Sbellard  echo "#define CONFIG_ADLIB 1" >> $config_h
588fb065187Sbellardfi
589fb065187Sbellardif test "$oss" = "yes" ; then
590fb065187Sbellard  echo "CONFIG_OSS=yes" >> $config_mak
591fb065187Sbellard  echo "#define CONFIG_OSS 1" >> $config_h
592fb065187Sbellardfi
593*1d14ffa9Sbellardif test "$coreaudio" = "yes" ; then
594*1d14ffa9Sbellard  echo "CONFIG_COREAUDIO=yes" >> $config_mak
595*1d14ffa9Sbellard  echo "#define CONFIG_COREAUDIO 1" >> $config_h
596*1d14ffa9Sbellardfi
597*1d14ffa9Sbellardif test "$alsa" = "yes" ; then
598*1d14ffa9Sbellard  echo "CONFIG_ALSA=yes" >> $config_mak
599*1d14ffa9Sbellard  echo "#define CONFIG_ALSA 1" >> $config_h
600*1d14ffa9Sbellardfi
601*1d14ffa9Sbellardif test "$dsound" = "yes" ; then
602*1d14ffa9Sbellard  echo "CONFIG_DSOUND=yes" >> $config_mak
603*1d14ffa9Sbellard  echo "#define CONFIG_DSOUND 1" >> $config_h
604*1d14ffa9Sbellardfi
605102a52e4Sbellardif test "$fmod" = "yes" ; then
606102a52e4Sbellard  echo "CONFIG_FMOD=yes" >> $config_mak
607102a52e4Sbellard  echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
608102a52e4Sbellard  echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
609102a52e4Sbellard  echo "#define CONFIG_FMOD 1" >> $config_h
610102a52e4Sbellardfi
61197a847bcSbellardecho -n "VERSION=" >>$config_mak
61297a847bcSbellardhead $source_path/VERSION >>$config_mak
61397a847bcSbellardecho "" >>$config_mak
61497a847bcSbellardecho -n "#define QEMU_VERSION \"" >> $config_h
61597a847bcSbellardhead $source_path/VERSION >> $config_h
61697a847bcSbellardecho "\"" >> $config_h
61797a847bcSbellard
618c9ec1fe4Sbellardif test $kqemu = "yes" ; then
619c9ec1fe4Sbellard  echo "CONFIG_KQEMU=yes" >> $config_mak
6201026f133Sbellard  if test $linux = "yes" ; then
621c9ec1fe4Sbellard    echo "KERNEL_PATH=$kernel_path" >> $config_mak
622c9ec1fe4Sbellard    if test $kbuild26 = "yes" ; then
623c9ec1fe4Sbellard      echo "CONFIG_KBUILD26=yes" >> $config_mak
624c9ec1fe4Sbellard    fi
625c9ec1fe4Sbellard  fi
6261026f133Sbellardfi
62797a847bcSbellardecho "SRC_PATH=$source_path" >> $config_mak
62897a847bcSbellardecho "TARGET_DIRS=$target_list" >> $config_mak
62997a847bcSbellard
63083fb7adfSbellard# XXX: suppress that
6317d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
63243003046Sbellard  echo "#define O_LARGEFILE 0" >> $config_h
63343003046Sbellard  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
6347d3505c5Sbellard  echo "#define _BSD 1" >> $config_h
6357d3505c5Sbellardfi
6367d3505c5Sbellard
63797a847bcSbellardfor target in $target_list; do
63897a847bcSbellard
63997a847bcSbellardtarget_dir="$target"
64097a847bcSbellardconfig_mak=$target_dir/config.mak
64197a847bcSbellardconfig_h=$target_dir/config.h
64297a847bcSbellardtarget_cpu=`echo $target | cut -d '-' -f 1`
64397a847bcSbellardtarget_bigendian="no"
644808c4954Sbellard[ "$target_cpu" = "armeb" ] && target_bigendian=yes
6451e43adfcSbellard[ "$target_cpu" = "sparc" ] && target_bigendian=yes
64664b3ab24Sbellard[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
64767867308Sbellard[ "$target_cpu" = "ppc" ] && target_bigendian=yes
648a2458627Sbellard[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
649d3258560Sbellard[ "$target_cpu" = "mips" ] && target_bigendian=yes
65097a847bcSbellardtarget_softmmu="no"
65197a847bcSbellardif expr $target : '.*-softmmu' > /dev/null ; then
65297a847bcSbellard  target_softmmu="yes"
6537d13299dSbellardfi
654997344f3Sbellardtarget_user_only="no"
655997344f3Sbellardif expr $target : '.*-user' > /dev/null ; then
656997344f3Sbellard  target_user_only="yes"
657997344f3Sbellardfi
658de83cd02Sbellard
65997ccc689Sbellardif test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
66097ccc689Sbellard        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
66197ccc689Sbellard    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
66297ccc689Sbellard    echo "To build QEMU with graphical output configure with --disable-gfx-check"
66397ccc689Sbellard    echo "Note that this will disable all output from the virtual graphics card."
66497ccc689Sbellard    exit 1;
66597ccc689Sbellardfi
66697ccc689Sbellard
6677c1f25b4Sbellard#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
66897a847bcSbellard
66997a847bcSbellardmkdir -p $target_dir
670158142c2Sbellardmkdir -p $target_dir/fpu
671808c4954Sbellardif test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
67269de927cSbellard  mkdir -p $target_dir/nwfpe
67369de927cSbellardfi
674a7e61ed4Sbellardif test "$target_user_only" = "no" ; then
675a7e61ed4Sbellard  mkdir -p $target_dir/slirp
676a7e61ed4Sbellardfi
67769de927cSbellard
67897a847bcSbellardln -sf $source_path/Makefile.target $target_dir/Makefile
67997a847bcSbellard
68097a847bcSbellardecho "# Automatically generated by configure - do not modify" > $config_mak
68197a847bcSbellardecho "/* Automatically generated by configure - do not modify */" > $config_h
68297a847bcSbellard
68397a847bcSbellard
68497a847bcSbellardecho "include ../config-host.mak" >> $config_mak
68597a847bcSbellardecho "#include \"../config-host.h\"" >> $config_h
6861e43adfcSbellard
6871e43adfcSbellardinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
6881e43adfcSbellardecho "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
68997a847bcSbellard
69097a847bcSbellardif test "$target_cpu" = "i386" ; then
69197a847bcSbellard  echo "TARGET_ARCH=i386" >> $config_mak
69297a847bcSbellard  echo "#define TARGET_ARCH \"i386\"" >> $config_h
69397a847bcSbellard  echo "#define TARGET_I386 1" >> $config_h
69407f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
695824d560fSbellard    echo "#define USE_KQEMU 1" >> $config_h
696824d560fSbellard  fi
697808c4954Sbellardelif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
69897a847bcSbellard  echo "TARGET_ARCH=arm" >> $config_mak
69997a847bcSbellard  echo "#define TARGET_ARCH \"arm\"" >> $config_h
70097a847bcSbellard  echo "#define TARGET_ARM 1" >> $config_h
7011e43adfcSbellardelif test "$target_cpu" = "sparc" ; then
7021e43adfcSbellard  echo "TARGET_ARCH=sparc" >> $config_mak
7031e43adfcSbellard  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
7041e43adfcSbellard  echo "#define TARGET_SPARC 1" >> $config_h
70564b3ab24Sbellardelif test "$target_cpu" = "sparc64" ; then
70664b3ab24Sbellard  echo "TARGET_ARCH=sparc64" >> $config_mak
70764b3ab24Sbellard  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
70864b3ab24Sbellard  echo "#define TARGET_SPARC 1" >> $config_h
70964b3ab24Sbellard  echo "#define TARGET_SPARC64 1" >> $config_h
71067867308Sbellardelif test "$target_cpu" = "ppc" ; then
71167867308Sbellard  echo "TARGET_ARCH=ppc" >> $config_mak
71267867308Sbellard  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
71367867308Sbellard  echo "#define TARGET_PPC 1" >> $config_h
714a2458627Sbellardelif test "$target_cpu" = "ppc64" ; then
715a2458627Sbellard  echo "TARGET_ARCH=ppc64" >> $config_mak
716a2458627Sbellard  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
717a2458627Sbellard  echo "#define TARGET_PPC 1" >> $config_h
718a2458627Sbellard  echo "#define TARGET_PPC64 1" >> $config_h
7190b0babc6Sbellardelif test "$target_cpu" = "x86_64" ; then
7200b0babc6Sbellard  echo "TARGET_ARCH=x86_64" >> $config_mak
7210b0babc6Sbellard  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
7220b0babc6Sbellard  echo "#define TARGET_I386 1" >> $config_h
7230b0babc6Sbellard  echo "#define TARGET_X86_64 1" >> $config_h
72407f4ddbfSbellard  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
72507f4ddbfSbellard    echo "#define USE_KQEMU 1" >> $config_h
72607f4ddbfSbellard  fi
727d3258560Sbellardelif test "$target_cpu" = "mips" ; then
728d3258560Sbellard  echo "TARGET_ARCH=mips" >> $config_mak
729d3258560Sbellard  echo "#define TARGET_ARCH \"mips\"" >> $config_h
730d3258560Sbellard  echo "#define TARGET_MIPS 1" >> $config_h
731de83cd02Sbellardelse
732de83cd02Sbellard  echo "Unsupported target CPU"
733de83cd02Sbellard  exit 1
734de83cd02Sbellardfi
735de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
73697a847bcSbellard  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
73797a847bcSbellard  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
73897a847bcSbellardfi
73997a847bcSbellardif test "$target_softmmu" = "yes" ; then
74097a847bcSbellard  echo "CONFIG_SOFTMMU=yes" >> $config_mak
74197a847bcSbellard  echo "#define CONFIG_SOFTMMU 1" >> $config_h
742de83cd02Sbellardfi
743997344f3Sbellardif test "$target_user_only" = "yes" ; then
744997344f3Sbellard  echo "CONFIG_USER_ONLY=yes" >> $config_mak
745997344f3Sbellard  echo "#define CONFIG_USER_ONLY 1" >> $config_h
746997344f3Sbellardfi
747de83cd02Sbellard
748158142c2Sbellardif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
749158142c2Sbellard  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
750158142c2Sbellard  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
751158142c2Sbellardfi
7527c1f25b4Sbellard# sdl defines
7537c1f25b4Sbellard
7547c1f25b4Sbellardif test "$target_user_only" = "no"; then
7557c1f25b4Sbellard    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
756dbb2c921Sbellard        sdl1=$sdl_static
7577c1f25b4Sbellard    else
758dbb2c921Sbellard        sdl1=$sdl
759dbb2c921Sbellard    fi
760dbb2c921Sbellard    if test "$sdl1" = "yes" ; then
7617c1f25b4Sbellard        echo "#define CONFIG_SDL 1" >> $config_h
7627c1f25b4Sbellard        echo "CONFIG_SDL=yes" >> $config_mak
763dbb2c921Sbellard        if test "$target_softmmu" = "no" -o "$static" = "yes"; then
764dbb2c921Sbellard            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
765dbb2c921Sbellard        else
7667c1f25b4Sbellard            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
7677c1f25b4Sbellard        fi
7687c1f25b4Sbellard        echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
7697c1f25b4Sbellard        if [ "${aa}" = "yes" ] ; then
7707c1f25b4Sbellard            echo -n " `aalib-config --cflags`" >> $config_mak ;
7717c1f25b4Sbellard        fi
7727c1f25b4Sbellard        echo "" >> $config_mak
7737c1f25b4Sbellard    fi
774dbb2c921Sbellardfi
7757c1f25b4Sbellard
7765b0753e0Sbellardif test "$cocoa" = "yes" ; then
7775b0753e0Sbellard    echo "#define CONFIG_COCOA 1" >> $config_h
7785b0753e0Sbellard    echo "CONFIG_COCOA=yes" >> $config_mak
7795b0753e0Sbellardfi
7805b0753e0Sbellard
78197a847bcSbellarddone # for target in $targets
7827d13299dSbellard
7837d13299dSbellard# build tree in object directory if source path is different from current one
7847d13299dSbellardif test "$source_path_used" = "yes" ; then
7857d13299dSbellard    DIRS="tests"
7867d13299dSbellard    FILES="Makefile tests/Makefile"
7877d13299dSbellard    for dir in $DIRS ; do
7887d13299dSbellard            mkdir -p $dir
7897d13299dSbellard    done
7907d13299dSbellard    for f in $FILES ; do
7917d13299dSbellard        ln -sf $source_path/$f $f
7927d13299dSbellard    done
7937d13299dSbellardfi
7947d13299dSbellard
79597a847bcSbellardrm -f $TMPO $TMPC $TMPE $TMPS
796