📄 configure
字号:
#!/bin/sh## qemu configure script (c) 2003 Fabrice Bellard## set temporary file nameif test ! -z "$TMPDIR" ; then TMPDIR1="${TMPDIR}"elif test ! -z "$TEMPDIR" ; then TMPDIR1="${TEMPDIR}"else TMPDIR1="/tmp"fiTMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"# default parametersprefix=""interp_prefix="/usr/gnemul/qemu-%M"static="no"cross_prefix=""cc="gcc"gcc3_search="yes"gcc3_list="gcc-3.4 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"host_cc="gcc"ar="ar"make="make"install="install"strip="strip"cpu=`uname -m`target_list=""case "$cpu" in i386|i486|i586|i686|i86pc|BePC) cpu="i386" ;; armv*b) cpu="armv4b" ;; armv*l) cpu="armv4l" ;; alpha) cpu="alpha" ;; "Power Macintosh"|ppc|ppc64) cpu="powerpc" ;; mips) cpu="mips" ;; s390) cpu="s390" ;; sparc|sun4[muv]) cpu="sparc" ;; sparc64) cpu="sparc64" ;; ia64) cpu="ia64" ;; m68k) cpu="m68k" ;; x86_64|amd64) cpu="x86_64" ;; *) cpu="unknown" ;;esacgprof="no"bigendian="no"mingw32="no"EXESUF=""gdbstub="yes"slirp="yes"adlib="no"oss="no"dsound="no"coreaudio="no"alsa="no"fmod="no"fmod_lib=""fmod_inc=""bsd="no"linux="no"kqemu="no"profiler="no"cocoa="no"check_gfx="yes"check_gcc="yes"softmmu="yes"linux_user="no"darwin_user="no"build_docs="no"uname_release=""# OS specifictargetos=`uname -s`case $targetos inCYGWIN*)mingw32="yes"OS_CFLAGS="-mno-cygwin";;MINGW32*)mingw32="yes";;FreeBSD)bsd="yes"oss="yes"if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then kqemu="yes"fi;;NetBSD)bsd="yes"oss="yes";;OpenBSD)bsd="yes"oss="yes";;Darwin)bsd="yes"darwin="yes"darwin_user="yes"cocoa="yes"coreaudio="yes"OS_CFLAGS="-mdynamic-no-pic";;SunOS)solaris="yes";;*)oss="yes"linux="yes"linux_user="yes"if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then kqemu="yes"fi;;esacif [ "$bsd" = "yes" ] ; then if [ "$darwin" != "yes" ] ; then make="gmake" fifiif [ "$solaris" = "yes" ] ; then make="gmake" install="ginstall" solarisrev=`uname -r | cut -f2 -d.` if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then if test "$solarisrev" -gt 10 ; then kqemu="yes" fi fifi# find source pathsource_path=`dirname "$0"`if [ -z "$source_path" ]; then source_path=`pwd`else source_path=`cd "$source_path"; pwd`fiif test "$source_path" = `pwd` ; then source_path_used="no"else source_path_used="yes"fifor opt do optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` case "$opt" in --help|-h) show_help=yes ;; --prefix=*) prefix="$optarg" ;; --interp-prefix=*) interp_prefix="$optarg" ;; --source-path=*) source_path="$optarg" source_path_used="yes" ;; --cross-prefix=*) cross_prefix="$optarg" ;; --cc=*) cc="$optarg" gcc3_search="no" ;; --host-cc=*) host_cc="$optarg" ;; --make=*) make="$optarg" ;; --install=*) install="$optarg" ;; --extra-cflags=*) CFLAGS="$optarg" ;; --extra-ldflags=*) LDFLAGS="$optarg" ;; --cpu=*) cpu="$optarg" ;; --target-list=*) target_list="$optarg" ;; --enable-gprof) gprof="yes" ;; --static) static="yes" ;; --disable-sdl) sdl="no" ;; --enable-coreaudio) coreaudio="yes" ;; --enable-alsa) alsa="yes" ;; --enable-dsound) dsound="yes" ;; --enable-fmod) fmod="yes" ;; --fmod-lib=*) fmod_lib="$optarg" ;; --fmod-inc=*) fmod_inc="$optarg" ;; --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no" ;; --disable-slirp) slirp="no" ;; --enable-adlib) adlib="yes" ;; --disable-kqemu) kqemu="no" ;; --enable-profiler) profiler="yes" ;; --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no" ;; --disable-gfx-check) check_gfx="no" ;; --disable-gcc-check) check_gcc="no" ;; --disable-system) softmmu="no" ;; --enable-system) softmmu="yes" ;; --disable-linux-user) linux_user="no" ;; --enable-linux-user) linux_user="yes" ;; --disable-darwin-user) darwin_user="no" ;; --enable-darwin-user) darwin_user="yes" ;; --enable-uname-release=*) uname_release="$optarg" ;; esacdone# default flags for all hostsCFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"LDFLAGS="$LDFLAGS -g"if test x"$show_help" = x"yes" ; thencat << EOFUsage: configure [options]Options: [defaults in brackets after descriptions]EOFecho "Standard options:"echo " --help print this message"echo " --prefix=PREFIX install in PREFIX [$prefix]"echo " --interp-prefix=PREFIX where to find shared libraries, etc."echo " use %M for cpu name [$interp_prefix]"echo " --target-list=LIST set target list [$target_list]"echo ""echo "kqemu kernel acceleration support:"echo " --disable-kqemu disable kqemu support"echo ""echo "Advanced options (experts only):"echo " --source-path=PATH path of source code [$source_path]"echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"echo " --cc=CC use C compiler CC [$cc]"echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."echo " --make=MAKE use specified make [$make]"echo " --install=INSTALL use specified install [$install]"echo " --static enable static build [$static]"echo " --enable-cocoa enable COCOA (Mac OS X only)"echo " --enable-mingw32 enable Win32 cross compilation with mingw32"echo " --enable-adlib enable Adlib emulation"echo " --enable-coreaudio enable Coreaudio audio driver"echo " --enable-alsa enable ALSA audio driver"echo " --enable-fmod enable FMOD audio driver"echo " --enabled-dsound enable DirectSound audio driver"echo " --enable-system enable all system emulation targets"echo " --disable-system disable all system emulation targets"echo " --enable-linux-user enable all linux usermode emulation targets"echo " --disable-linux-user disable all linux usermode emulation targets"echo " --enable-darwin-user enable all darwin usermode emulation targets"echo " --disable-darwin-user disable all darwin usermode emulation targets"echo " --fmod-lib path to FMOD library"echo " --fmod-inc path to FMOD includes"echo " --enable-uname-release=R Return R for uname -r in usermode emulation"echo ""echo "NOTE: The object files are built at the place where configure is launched"exit 1ficc="${cross_prefix}${cc}"ar="${cross_prefix}${ar}"strip="${cross_prefix}${strip}"# check that the C compiler works.cat > $TMPC <<EOFint main(void) {}EOFif $cc -c -o $TMPO $TMPC 2>/dev/null ; then : C compiler works okelse echo "ERROR: \"$cc\" either does not exist or does not work" exit 1fiif test "$mingw32" = "yes" ; then linux="no" EXESUF=".exe" oss="no" if [ "$cpu" = "i386" ] ; then kqemu="yes" fifi# Check for gcc4, error if pre-gcc4 if test "$check_gcc" = "yes" ; then cat > $TMPC <<EOF#if __GNUC__ < 4#error gcc3#endifint main(){return 0;}EOF check_cc() { which "$1" >&/dev/null return $? } if "$cc" -o $TMPE $TMPC 2>/dev/null ; then echo "WARNING: \"$cc\" looks like gcc 4.x" found_compat_cc="no" if test "$gcc3_search" = "yes" ; then echo "Looking for gcc 3.x" for compat_cc in $gcc3_list ; do if check_cc "$compat_cc" ; then echo "Found \"$compat_cc\"" cc="$compat_cc" found_compat_cc="yes" break fi done if test "$found_compat_cc" = "no" ; then echo "gcc 3.x not found!" fi fi if test "$found_compat_cc" = "no" ; then echo "QEMU is known to have problems when compiled with gcc 4.x" echo "It is recommended that you use gcc 3.x to build QEMU" echo "To use this compiler anyway, configure with --disable-gcc-check" exit 1; fi fifi## Solaris specific configure tool chain decisions#if test "$solaris" = "yes" ; then # # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly # override the check with --disable-gcc-check # if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then solgcc=`which $cc` if test "$solgcc" = "/usr/sfw/bin/gcc" ; then echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly." echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3" echo "or get the latest patch from SunSolve for gcc" exit 1 fi fi solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"` if test -z "$solinst" ; then echo "Solaris install program not found. Use --install=/usr/ucb/install or" echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" exit 1 fi if test "$solinst" = "/usr/sbin/install" ; then echo "Error: Solaris /usr/sbin/install is not an appropriate install program." echo "try ginstall from the GNU fileutils available from www.blastwave.org" echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" exit 1 fi sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"` if test -z "$sol_ar" ; then echo "Error: No path includes ar" if test -f /usr/ccs/bin/ar ; then echo "Add /usr/ccs/bin to your path and rerun configure" fi exit 1 fifi if test -z "$target_list" ; then# these targets are portable if [ "$softmmu" = "yes" ] ; then target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu" fi# the following are Linux specific if [ "$linux_user" = "yes" ] ; then target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user ppc-linux-user mips-linux-user mipsel-linux-user m68k-linux-user $target_list" fi# the following are Darwin specific if [ "$darwin_user" = "yes" ] ; then target_list="i386-darwin-user ppc-darwin-user $target_list" fielse target_list=`echo "$target_list" | sed -e 's/,/ /g'`fiif test -z "$target_list" ; then echo "No targets enabled" exit 1fiif test -z "$cross_prefix" ; then# ---# big/little endian testcat > $TMPC << EOF#include <inttypes.h>int main(int argc, char ** argv){ volatile uint32_t i=0x01234567; return (*((uint8_t*)(&i))) == 0x67;}EOFif $cc -o $TMPE $TMPC 2>/dev/null ; then$TMPE && bigendian="yes"elseecho big/little test failedfielse# if cross compiling, cannot launch a program, so make a static guessif test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then bigendian="yes"fifi# host long bits testhostlongbits="32"if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then hostlongbits="64"fi# check gcc options supportcat > $TMPC <<EOFint main(void) {}EOFhave_gcc3_options="no"if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then have_gcc3_options="yes"fi########################################### SDL probesdl_too_old=noif test -z "$sdl" ; thensdl_config="sdl-config"sdl=nosdl_static=noif test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then# win32 cross compilation case sdl_config="i386-mingw32msvc-sdl-config" sdl=yeselse# normal SDL probecat > $TMPC << EOF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -