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" 16a91b857cSmalcTMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe" 177d13299dSbellard 180ba8681eSLoïc Minier# NB: do not call "exit" in the trap handler; this is buggy with some shells; 190ba8681eSLoïc Minier# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org> 200ba8681eSLoïc Miniertrap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM 21da1d85e3SGerd Hoffmannrm -f config.log 229ac81bbbSmalc 23b48e3611SPeter Maydell# Print a helpful header at the top of config.log 24b48e3611SPeter Maydellecho "# QEMU configure log $(date)" >> config.log 25979ae168SPeter Maydellprintf "# Configured with:" >> config.log 26979ae168SPeter Maydellprintf " '%s'" "$0" "$@" >> config.log 27979ae168SPeter Maydellecho >> config.log 28b48e3611SPeter Maydellecho "#" >> config.log 29b48e3611SPeter Maydell 308dc38a78SPeter Maydelldo_cc() { 318dc38a78SPeter Maydell # Run the compiler, capturing its output to the log. 328dc38a78SPeter Maydell echo $cc "$@" >> config.log 338dc38a78SPeter Maydell $cc "$@" >> config.log 2>&1 || return $? 348dc38a78SPeter Maydell # Test passed. If this is an --enable-werror build, rerun 358dc38a78SPeter Maydell # the test with -Werror and bail out if it fails. This 368dc38a78SPeter Maydell # makes warning-generating-errors in configure test code 378dc38a78SPeter Maydell # obvious to developers. 388dc38a78SPeter Maydell if test "$werror" != "yes"; then 398dc38a78SPeter Maydell return 0 408dc38a78SPeter Maydell fi 418dc38a78SPeter Maydell # Don't bother rerunning the compile if we were already using -Werror 428dc38a78SPeter Maydell case "$*" in 438dc38a78SPeter Maydell *-Werror*) 448dc38a78SPeter Maydell return 0 458dc38a78SPeter Maydell ;; 468dc38a78SPeter Maydell esac 478dc38a78SPeter Maydell echo $cc -Werror "$@" >> config.log 488dc38a78SPeter Maydell $cc -Werror "$@" >> config.log 2>&1 && return $? 498dc38a78SPeter Maydell echo "ERROR: configure test passed without -Werror but failed with -Werror." 508dc38a78SPeter Maydell echo "This is probably a bug in the configure script. The failing command" 518dc38a78SPeter Maydell echo "will be at the bottom of config.log." 528dc38a78SPeter Maydell echo "You can run configure with --disable-werror to bypass this check." 538dc38a78SPeter Maydell exit 1 548dc38a78SPeter Maydell} 558dc38a78SPeter Maydell 5652166aa0SJuan Quintelacompile_object() { 578dc38a78SPeter Maydell do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC 5852166aa0SJuan Quintela} 5952166aa0SJuan Quintela 6052166aa0SJuan Quintelacompile_prog() { 6152166aa0SJuan Quintela local_cflags="$1" 6252166aa0SJuan Quintela local_ldflags="$2" 638dc38a78SPeter Maydell do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags 6452166aa0SJuan Quintela} 6552166aa0SJuan Quintela 6611568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 6711568d6dSPaolo Bonzinisymlink() { 6872b8b5a1SStefan Weil rm -rf "$2" 69ec5b06d7SAnthony Liguori mkdir -p "$(dirname "$2")" 7072b8b5a1SStefan Weil ln -s "$1" "$2" 7111568d6dSPaolo Bonzini} 7211568d6dSPaolo Bonzini 730dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 740dba6195SLoïc Minier# executable or a builtin) 750dba6195SLoïc Minierhas() { 760dba6195SLoïc Minier type "$1" >/dev/null 2>&1 770dba6195SLoïc Minier} 780dba6195SLoïc Minier 790dba6195SLoïc Minier# search for an executable in PATH 800dba6195SLoïc Minierpath_of() { 810dba6195SLoïc Minier local_command="$1" 820dba6195SLoïc Minier local_ifs="$IFS" 830dba6195SLoïc Minier local_dir="" 840dba6195SLoïc Minier 850dba6195SLoïc Minier # pathname has a dir component? 860dba6195SLoïc Minier if [ "${local_command#*/}" != "$local_command" ]; then 870dba6195SLoïc Minier if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 880dba6195SLoïc Minier echo "$local_command" 890dba6195SLoïc Minier return 0 900dba6195SLoïc Minier fi 910dba6195SLoïc Minier fi 920dba6195SLoïc Minier if [ -z "$local_command" ]; then 930dba6195SLoïc Minier return 1 940dba6195SLoïc Minier fi 950dba6195SLoïc Minier 960dba6195SLoïc Minier IFS=: 970dba6195SLoïc Minier for local_dir in $PATH; do 980dba6195SLoïc Minier if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 990dba6195SLoïc Minier echo "$local_dir/$local_command" 1000dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 1010dba6195SLoïc Minier return 0 1020dba6195SLoïc Minier fi 1030dba6195SLoïc Minier done 1040dba6195SLoïc Minier # not found 1050dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 1060dba6195SLoïc Minier return 1 1070dba6195SLoïc Minier} 1080dba6195SLoïc Minier 1097d13299dSbellard# default parameters 110ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"` 1112ff6b91eSJuan Quintelacpu="" 1121e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 11343ce4dfeSbellardstatic="no" 1147d13299dSbellardcross_prefix="" 1150c58ac1cSmalcaudio_drv_list="" 11661dc008fSAnthony Liguoriaudio_card_list="ac97 es1370 sb16 hda" 11761dc008fSAnthony Liguoriaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda" 118eb852011SMarkus Armbrusterblock_drv_whitelist="" 119e49d021eSPeter Maydellhost_cc="cc" 12073da375eSJuan Quintelalibs_softmmu="" 1213e2e0e6bSJuan Quintelalibs_tools="" 12267f86e8eSJuan Quintelaaudio_pt_int="" 123d5631638Smalcaudio_win_int="" 1242b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc 125957f1f99SMichael Rothlibs_qga="" 1265bc62e01SGerd Hoffmanndebug_info="yes" 127ac0df51dSaliguori 128afb63ebdSStefan Weil# Don't accept a target_list environment variable. 129afb63ebdSStefan Weilunset target_list 130377529c0SPaolo Bonzini 131377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 132377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 133377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 134377529c0SPaolo Bonzini# unless --disable-foo is given 135377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 136377529c0SPaolo Bonzini# feature will searched for, 137377529c0SPaolo Bonzini# if not found, configure exits with error 138377529c0SPaolo Bonzini# 139377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 140377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 141377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 142377529c0SPaolo Bonzini 143377529c0SPaolo Bonzinibluez="" 144377529c0SPaolo Bonzinibrlapi="" 145377529c0SPaolo Bonzinicurl="" 146377529c0SPaolo Bonzinicurses="" 147377529c0SPaolo Bonzinidocs="" 148377529c0SPaolo Bonzinifdt="" 149377529c0SPaolo Bonzininptl="" 150e2134eb9SGerd Hoffmannpixman="" 151377529c0SPaolo Bonzinisdl="" 152983eef5aSMeador Ingevirtfs="" 153821601eaSJes Sorensenvnc="yes" 154377529c0SPaolo Bonzinisparse="no" 155377529c0SPaolo Bonziniuuid="" 156377529c0SPaolo Bonzinivde="" 157377529c0SPaolo Bonzinivnc_tls="" 158377529c0SPaolo Bonzinivnc_sasl="" 159377529c0SPaolo Bonzinivnc_jpeg="" 160377529c0SPaolo Bonzinivnc_png="" 161377529c0SPaolo Bonzinixen="" 162d5b93ddfSAnthony PERARDxen_ctrl_version="" 163eb6fda0fSAnthony PERARDxen_pci_passthrough="" 164377529c0SPaolo Bonzinilinux_aio="" 16547e98658SCorey Bryantcap_ng="" 166377529c0SPaolo Bonziniattr="" 1674f26f2b6SAvi Kivitylibattr="" 168377529c0SPaolo Bonzinixfs="" 169377529c0SPaolo Bonzini 170d41a75a2SBradvhost_net="no" 171d41a75a2SBradkvm="no" 172377529c0SPaolo Bonzinigprof="no" 173377529c0SPaolo Bonzinidebug_tcg="no" 174377529c0SPaolo Bonzinidebug="no" 175377529c0SPaolo Bonzinistrip_opt="yes" 1769195b2c2SStefan Weiltcg_interpreter="no" 177377529c0SPaolo Bonzinibigendian="no" 178377529c0SPaolo Bonzinimingw32="no" 179377529c0SPaolo BonziniEXESUF="" 180377529c0SPaolo Bonziniprefix="/usr/local" 181377529c0SPaolo Bonzinimandir="\${prefix}/share/man" 182528ae5b8SEduardo Habkostdatadir="\${prefix}/share" 183850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu" 184377529c0SPaolo Bonzinibindir="\${prefix}/bin" 1853aa5d2beSAlon Levylibdir="\${prefix}/lib" 1868bf188aaSMichael Tokarevlibexecdir="\${prefix}/libexec" 1870f94d6daSAlon Levyincludedir="\${prefix}/include" 188377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc" 189785c23aeSLuiz Capitulinolocal_statedir="\${prefix}/var" 190377529c0SPaolo Bonziniconfsuffix="/qemu" 191377529c0SPaolo Bonzinislirp="yes" 192377529c0SPaolo Bonzinifmod_lib="" 193377529c0SPaolo Bonzinifmod_inc="" 194377529c0SPaolo Bonzinioss_lib="" 195377529c0SPaolo Bonzinibsd="no" 196377529c0SPaolo Bonzinilinux="no" 197377529c0SPaolo Bonzinisolaris="no" 198377529c0SPaolo Bonziniprofiler="no" 199377529c0SPaolo Bonzinicocoa="no" 200377529c0SPaolo Bonzinisoftmmu="yes" 201377529c0SPaolo Bonzinilinux_user="no" 202377529c0SPaolo Bonzinibsd_user="no" 20330163d89SPeter Maydellguest_base="yes" 204377529c0SPaolo Bonziniuname_release="" 205377529c0SPaolo Bonzinimixemu="no" 206377529c0SPaolo Bonziniaix="no" 207377529c0SPaolo Bonziniblobs="yes" 208377529c0SPaolo Bonzinipkgversion="" 20940d6444eSAvi Kivitypie="" 210377529c0SPaolo Bonzinizero_malloc="" 211377529c0SPaolo Bonzinitrace_backend="nop" 212377529c0SPaolo Bonzinitrace_file="trace" 213377529c0SPaolo Bonzinispice="" 214377529c0SPaolo Bonzinirbd="" 21536707144SAlon Levysmartcard="" 216111a38b0SRobert Relyeasmartcard_nss="" 21769354a83SHans de Goedeusb_redir="" 218430a3c18SMichael Walleopengl="" 2191ece9905SAlon Levyzlib="yes" 220d138cee9SMichael Rothguest_agent="yes" 2214b1c11fdSDaniel P. Berrangewant_tools="yes" 222c589b249SRonnie Sahlberglibiscsi="" 223519175a2SAlex Barcelocoroutine="" 224f794573eSEduardo Otuboseccomp="" 225eb100396SBharata B Raoglusterfs="" 226377529c0SPaolo Bonzini 227ac0df51dSaliguori# parse CC options first 228ac0df51dSaliguorifor opt do 229ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 230ac0df51dSaliguori case "$opt" in 231ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 232ac0df51dSaliguori ;; 2333d8df640SPaolo Bonzini --cc=*) CC="$optarg" 234ac0df51dSaliguori ;; 235ca4deeb1SPaolo Bonzini --source-path=*) source_path="$optarg" 236ca4deeb1SPaolo Bonzini ;; 2372ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 2382ff6b91eSJuan Quintela ;; 239a558ee17SJuan Quintela --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" 240e2a2ed06SJuan Quintela ;; 241e2a2ed06SJuan Quintela --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" 242e2a2ed06SJuan Quintela ;; 2435bc62e01SGerd Hoffmann --enable-debug-info) debug_info="yes" 2445bc62e01SGerd Hoffmann ;; 2455bc62e01SGerd Hoffmann --disable-debug-info) debug_info="no" 2465bc62e01SGerd Hoffmann ;; 247ac0df51dSaliguori esac 248ac0df51dSaliguoridone 249ac0df51dSaliguori# OS specific 250ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 25193148aa5SStefan Weil# we can eliminate its usage altogether. 252ac0df51dSaliguori 253e49d021eSPeter Maydell# Preferred compiler: 254e49d021eSPeter Maydell# ${CC} (if set) 255e49d021eSPeter Maydell# ${cross_prefix}gcc (if cross-prefix specified) 256e49d021eSPeter Maydell# system compiler 257e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then 258e49d021eSPeter Maydell cc="$host_cc" 259e49d021eSPeter Maydellelse 260b3198cc2SStuart Yoder cc="${CC-${cross_prefix}gcc}" 261e49d021eSPeter Maydellfi 262e49d021eSPeter Maydell 263b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}" 264b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}" 265b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}" 2663f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}" 267b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}" 268b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}" 26917884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" 27017884d7bSSergei Trofimovichquery_pkg_config() { 27117884d7bSSergei Trofimovich "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" 27217884d7bSSergei Trofimovich} 27317884d7bSSergei Trofimovichpkg_config=query_pkg_config 274b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}" 275ac0df51dSaliguori 276be17dc90SMichael S. Tsirkin# default flags for all hosts 277be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" 278f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 279be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 280be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 2816b4c305cSPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include" 2825bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then 2835bc62e01SGerd Hoffmann CFLAGS="-g $CFLAGS" 284be17dc90SMichael S. Tsirkin LDFLAGS="-g $LDFLAGS" 2855bc62e01SGerd Hoffmannfi 286be17dc90SMichael S. Tsirkin 287ca4deeb1SPaolo Bonzini# make source path absolute 288ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd` 289ca4deeb1SPaolo Bonzini 290ac0df51dSaliguoricheck_define() { 291ac0df51dSaliguoricat > $TMPC <<EOF 292ac0df51dSaliguori#if !defined($1) 293fd786e1aSPeter Maydell#error $1 not defined 294ac0df51dSaliguori#endif 295ac0df51dSaliguoriint main(void) { return 0; } 296ac0df51dSaliguoriEOF 29752166aa0SJuan Quintela compile_object 298ac0df51dSaliguori} 299ac0df51dSaliguori 300bbea4050SPeter Maydellif check_define __linux__ ; then 301bbea4050SPeter Maydell targetos="Linux" 302bbea4050SPeter Maydellelif check_define _WIN32 ; then 303bbea4050SPeter Maydell targetos='MINGW32' 304bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then 305bbea4050SPeter Maydell targetos='OpenBSD' 306bbea4050SPeter Maydellelif check_define __sun__ ; then 307bbea4050SPeter Maydell targetos='SunOS' 308bbea4050SPeter Maydellelif check_define __HAIKU__ ; then 309bbea4050SPeter Maydell targetos='Haiku' 310bbea4050SPeter Maydellelse 311bbea4050SPeter Maydell targetos=`uname -s` 312bbea4050SPeter Maydellfi 313bbea4050SPeter Maydell 314bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use. 315bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're 316bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify 317bbea4050SPeter Maydell# the correct CPU with the --cpu option. 318bbea4050SPeter Maydellcase $targetos in 319bbea4050SPeter MaydellDarwin) 320bbea4050SPeter Maydell # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can 321bbea4050SPeter Maydell # run 64-bit userspace code. 322bbea4050SPeter Maydell # If the user didn't specify a CPU explicitly and the kernel says this is 323bbea4050SPeter Maydell # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code. 324bbea4050SPeter Maydell if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then 325bbea4050SPeter Maydell cpu="x86_64" 326bbea4050SPeter Maydell fi 327bbea4050SPeter Maydell ;; 328bbea4050SPeter MaydellSunOS) 329bbea4050SPeter Maydell # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo 330bbea4050SPeter Maydell if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then 331bbea4050SPeter Maydell cpu="x86_64" 332bbea4050SPeter Maydell fi 333bbea4050SPeter Maydellesac 334bbea4050SPeter Maydell 3352ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 3362ff6b91eSJuan Quintela # command line argument 3372ff6b91eSJuan Quintela : 3382ff6b91eSJuan Quintelaelif check_define __i386__ ; then 339ac0df51dSaliguori cpu="i386" 340ac0df51dSaliguorielif check_define __x86_64__ ; then 341ac0df51dSaliguori cpu="x86_64" 3423aa9bd6cSblueswir1elif check_define __sparc__ ; then 3433aa9bd6cSblueswir1 if check_define __arch64__ ; then 3443aa9bd6cSblueswir1 cpu="sparc64" 3453aa9bd6cSblueswir1 else 3463aa9bd6cSblueswir1 cpu="sparc" 3473aa9bd6cSblueswir1 fi 348fdf7ed96Smalcelif check_define _ARCH_PPC ; then 349fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 350fdf7ed96Smalc cpu="ppc64" 351ac0df51dSaliguori else 352fdf7ed96Smalc cpu="ppc" 353fdf7ed96Smalc fi 354afa05235SAurelien Jarnoelif check_define __mips__ ; then 355afa05235SAurelien Jarno cpu="mips" 356477ba620SAurelien Jarnoelif check_define __ia64__ ; then 357477ba620SAurelien Jarno cpu="ia64" 358d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 359d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 360d66ed0eaSAurelien Jarno cpu="s390x" 361d66ed0eaSAurelien Jarno else 362d66ed0eaSAurelien Jarno cpu="s390" 363d66ed0eaSAurelien Jarno fi 36421d89f84SPeter Maydellelif check_define __arm__ ; then 36521d89f84SPeter Maydell cpu="arm" 366f28ffed5SBradelif check_define __hppa__ ; then 367f28ffed5SBrad cpu="hppa" 368fdf7ed96Smalcelse 369fdf7ed96Smalc cpu=`uname -m` 370ac0df51dSaliguorifi 371ac0df51dSaliguori 372359bc95dSPeter MaydellARCH= 373359bc95dSPeter Maydell# Normalise host CPU name and set ARCH. 374359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests. 3757d13299dSbellardcase "$cpu" in 376359bc95dSPeter Maydell ia64|ppc|ppc64|s390|s390x|sparc64) 377ea8f20f8SJuan Quintela cpu="$cpu" 378ea8f20f8SJuan Quintela ;; 3797d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 38097a847bcSbellard cpu="i386" 3817d13299dSbellard ;; 382aaa5fa14Saurel32 x86_64|amd64) 383aaa5fa14Saurel32 cpu="x86_64" 384aaa5fa14Saurel32 ;; 38521d89f84SPeter Maydell armv*b|armv*l|arm) 38621d89f84SPeter Maydell cpu="arm" 3877d13299dSbellard ;; 388f28ffed5SBrad hppa|parisc|parisc64) 389f54b3f92Saurel32 cpu="hppa" 390f54b3f92Saurel32 ;; 391afa05235SAurelien Jarno mips*) 392afa05235SAurelien Jarno cpu="mips" 393afa05235SAurelien Jarno ;; 3943142255cSblueswir1 sparc|sun4[cdmuv]) 395ae228531Sbellard cpu="sparc" 396ae228531Sbellard ;; 3977d13299dSbellard *) 398359bc95dSPeter Maydell # This will result in either an error or falling back to TCI later 399359bc95dSPeter Maydell ARCH=unknown 4007d13299dSbellard ;; 4017d13299dSbellardesac 402359bc95dSPeter Maydellif test -z "$ARCH"; then 403359bc95dSPeter Maydell ARCH="$cpu" 404359bc95dSPeter Maydellfi 405e2d52ad3SJuan Quintela 4067d13299dSbellard# OS specific 4070dbfc675SJuan Quintela 4087d13299dSbellardcase $targetos in 409c326e0afSbellardCYGWIN*) 410c326e0afSbellard mingw32="yes" 411a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 412d5631638Smalc audio_possible_drivers="winwave sdl" 413d5631638Smalc audio_drv_list="winwave" 414c326e0afSbellard;; 41567b915a5SbellardMINGW32*) 41667b915a5Sbellard mingw32="yes" 417d5631638Smalc audio_possible_drivers="winwave dsound sdl fmod" 418d5631638Smalc audio_drv_list="winwave" 41967b915a5Sbellard;; 4205c40d2bdSthsGNU/kFreeBSD) 421a167ba50SAurelien Jarno bsd="yes" 4220c58ac1cSmalc audio_drv_list="oss" 423f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 4245c40d2bdSths;; 4257d3505c5SbellardFreeBSD) 4267d3505c5Sbellard bsd="yes" 4270db4a067SPaolo Bonzini make="${MAKE-gmake}" 4280c58ac1cSmalc audio_drv_list="oss" 429f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 430f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 431f01576f1SJuergen Lock LIBS="-lutil $LIBS" 4327d3505c5Sbellard;; 433c5e97233Sblueswir1DragonFly) 434c5e97233Sblueswir1 bsd="yes" 4350db4a067SPaolo Bonzini make="${MAKE-gmake}" 436c5e97233Sblueswir1 audio_drv_list="oss" 437c5e97233Sblueswir1 audio_possible_drivers="oss sdl esd pa" 438c5e97233Sblueswir1;; 4397d3505c5SbellardNetBSD) 4407d3505c5Sbellard bsd="yes" 4410db4a067SPaolo Bonzini make="${MAKE-gmake}" 4420c58ac1cSmalc audio_drv_list="oss" 443c2de5c91Smalc audio_possible_drivers="oss sdl esd" 4448ef92a88Sblueswir1 oss_lib="-lossaudio" 4457d3505c5Sbellard;; 4467d3505c5SbellardOpenBSD) 4477d3505c5Sbellard bsd="yes" 4480db4a067SPaolo Bonzini make="${MAKE-gmake}" 4490c58ac1cSmalc audio_drv_list="oss" 450c2de5c91Smalc audio_possible_drivers="oss sdl esd" 4512f6a1ab0Sblueswir1 oss_lib="-lossaudio" 4527d3505c5Sbellard;; 45383fb7adfSbellardDarwin) 45483fb7adfSbellard bsd="yes" 45583fb7adfSbellard darwin="yes" 4561b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 457a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 4580c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 4591b0f9cc2Saliguori else 460a558ee17SJuan Quintela QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS" 4611b0f9cc2Saliguori fi 462fd677642Sths cocoa="yes" 4630c58ac1cSmalc audio_drv_list="coreaudio" 464c2de5c91Smalc audio_possible_drivers="coreaudio sdl fmod" 4650c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 4667973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 467a0b7cf6bSPeter Maydell # Disable attempts to use ObjectiveC features in os/object.h since they 468a0b7cf6bSPeter Maydell # won't work when we're compiling with gcc as a C compiler. 469a0b7cf6bSPeter Maydell QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" 47083fb7adfSbellard;; 471ec530c81SbellardSunOS) 472ec530c81Sbellard solaris="yes" 4730db4a067SPaolo Bonzini make="${MAKE-gmake}" 4740db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 475fa58948dSBlue Swirl ld="gld" 476e2d8830eSBrad smbd="${SMBD-/usr/sfw/sbin/smbd}" 4770475a5caSths needs_libsunmath="no" 478c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 479c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 4800475a5caSths if test "$solarisrev" -le 9 ; then 4810475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 4820475a5caSths needs_libsunmath="yes" 483f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 484f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 485f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 4860475a5caSths else 4870475a5caSths echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" 4880475a5caSths echo "libsunmath from the Sun Studio compilers tools, due to a lack of" 4890475a5caSths echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" 4900475a5caSths echo "Studio 11 can be downloaded from www.sun.com." 4910475a5caSths exit 1 4920475a5caSths fi 4930475a5caSths fi 49486b2bd93Sths fi 4956b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 4960c58ac1cSmalc audio_drv_list="oss" 4976b4d2ba1Sths fi 498c2de5c91Smalc audio_possible_drivers="oss sdl" 499d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 500d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 501d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 502d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 503a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 504560d375fSAndreas Färber solarisnetlibs="-lsocket -lnsl -lresolv" 505560d375fSAndreas Färber LIBS="$solarisnetlibs $LIBS" 506560d375fSAndreas Färber libs_qga="$solarisnetlibs $libs_qga" 507ec530c81Sbellard;; 508b29fe3edSmalcAIX) 509b29fe3edSmalc aix="yes" 5100db4a067SPaolo Bonzini make="${MAKE-gmake}" 511b29fe3edSmalc;; 512179cf400SAndreas FärberHaiku) 513179cf400SAndreas Färber haiku="yes" 514179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 515179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 516179cf400SAndreas Färber;; 517fb065187Sbellard*) 5180c58ac1cSmalc audio_drv_list="oss" 519b8e59f18Smalc audio_possible_drivers="oss alsa sdl esd pa" 5205327cf48Sbellard linux="yes" 521831b7825Sths linux_user="yes" 52268063649Sblueswir1 usb="linux" 523af2be207SJan Kiszka kvm="yes" 524af2be207SJan Kiszka vhost_net="yes" 52507f4ddbfSbellard if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 526c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 527c9ec1fe4Sbellard fi 528fb065187Sbellard;; 5297d13299dSbellardesac 5307d13299dSbellard 5317d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 532b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 53368063649Sblueswir1 usb="bsd" 53484778508Sblueswir1 bsd_user="yes" 5357d3505c5Sbellard fi 53608de3949SAndreas Färberfi 5377d3505c5Sbellard 5380db4a067SPaolo Bonzini: ${make=${MAKE-make}} 5390db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 540c886edfbSBlue Swirl: ${python=${PYTHON-python}} 541e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}} 5420db4a067SPaolo Bonzini 5433c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC 5443c4a4d0dSPeter Maydellif has clang; then 5453c4a4d0dSPeter Maydell objcc=clang 5463c4a4d0dSPeter Maydellelse 5473c4a4d0dSPeter Maydell objcc="$cc" 5483c4a4d0dSPeter Maydellfi 5493c4a4d0dSPeter Maydell 5503457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 5513457a3f8SJuan Quintela EXESUF=".exe" 552a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 553e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 554e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 555f7cf5d5bSStefan Weil LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" 556f7cf5d5bSStefan Weilcat > $TMPC << EOF 557f7cf5d5bSStefan Weilint main(void) { return 0; } 558f7cf5d5bSStefan WeilEOF 559f7cf5d5bSStefan Weil if compile_prog "" "-liberty" ; then 560f7cf5d5bSStefan Weil LIBS="-liberty $LIBS" 561f7cf5d5bSStefan Weil fi 562c5ec15eaSStefan Weil prefix="c:/Program Files/QEMU" 563683035deSPaolo Bonzini mandir="\${prefix}" 564528ae5b8SEduardo Habkost datadir="\${prefix}" 565850da188SEduardo Habkost qemu_docdir="\${prefix}" 566683035deSPaolo Bonzini bindir="\${prefix}" 567683035deSPaolo Bonzini sysconfdir="\${prefix}" 568785c23aeSLuiz Capitulino local_statedir="\${prefix}" 569683035deSPaolo Bonzini confsuffix="" 570368542b8SStefan Hajnoczi libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga" 5713457a3f8SJuan Quintelafi 5723457a3f8SJuan Quintela 573487fefdbSAnthony Liguoriwerror="" 57485aa5189Sbellard 5757d13299dSbellardfor opt do 576a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 5777d13299dSbellard case "$opt" in 5782efc3265Sbellard --help|-h) show_help=yes 5792efc3265Sbellard ;; 58099123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 58199123e13SMike Frysinger ;; 582b1a550a0Spbrook --prefix=*) prefix="$optarg" 5837d13299dSbellard ;; 584b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 58532ce6337Sbellard ;; 586ca4deeb1SPaolo Bonzini --source-path=*) 5877d13299dSbellard ;; 588ac0df51dSaliguori --cross-prefix=*) 5897d13299dSbellard ;; 590ac0df51dSaliguori --cc=*) 5917d13299dSbellard ;; 592b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 59383469015Sbellard ;; 5943c4a4d0dSPeter Maydell --objcc=*) objcc="$optarg" 5953c4a4d0dSPeter Maydell ;; 596b1a550a0Spbrook --make=*) make="$optarg" 5977d13299dSbellard ;; 5986a882643Spbrook --install=*) install="$optarg" 5996a882643Spbrook ;; 600c886edfbSBlue Swirl --python=*) python="$optarg" 601c886edfbSBlue Swirl ;; 602e2d8830eSBrad --smbd=*) smbd="$optarg" 603e2d8830eSBrad ;; 604e2a2ed06SJuan Quintela --extra-cflags=*) 6057d13299dSbellard ;; 606e2a2ed06SJuan Quintela --extra-ldflags=*) 6077d13299dSbellard ;; 6085bc62e01SGerd Hoffmann --enable-debug-info) 6095bc62e01SGerd Hoffmann ;; 6105bc62e01SGerd Hoffmann --disable-debug-info) 6115bc62e01SGerd Hoffmann ;; 6122ff6b91eSJuan Quintela --cpu=*) 6137d13299dSbellard ;; 614b1a550a0Spbrook --target-list=*) target_list="$optarg" 615de83cd02Sbellard ;; 61674242e0fSPaolo Bonzini --enable-trace-backend=*) trace_backend="$optarg" 61794a420b1SStefan Hajnoczi ;; 61874242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 6199410b56cSPrerna Saxena ;; 6207d13299dSbellard --enable-gprof) gprof="yes" 6217d13299dSbellard ;; 62279427693SLoïc Minier --static) 62379427693SLoïc Minier static="yes" 62479427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 62517884d7bSSergei Trofimovich QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS" 62643ce4dfeSbellard ;; 6270b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 6280b24e75fSPaolo Bonzini ;; 6290b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 6300b24e75fSPaolo Bonzini ;; 6313aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 6323aa5d2beSAlon Levy ;; 6338bf188aaSMichael Tokarev --libexecdir=*) libexecdir="$optarg" 6348bf188aaSMichael Tokarev ;; 6350f94d6daSAlon Levy --includedir=*) includedir="$optarg" 6360f94d6daSAlon Levy ;; 637528ae5b8SEduardo Habkost --datadir=*) datadir="$optarg" 6380b24e75fSPaolo Bonzini ;; 639023d3d67SEduardo Habkost --with-confsuffix=*) confsuffix="$optarg" 640023d3d67SEduardo Habkost ;; 641850da188SEduardo Habkost --docdir=*) qemu_docdir="$optarg" 6420b24e75fSPaolo Bonzini ;; 643ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 64407381cc1SAnthony Liguori ;; 645785c23aeSLuiz Capitulino --localstatedir=*) local_statedir="$optarg" 646785c23aeSLuiz Capitulino ;; 647785c23aeSLuiz Capitulino --sbindir=*|--sharedstatedir=*|\ 648023ddd74SMax Filippov --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\ 649023ddd74SMax Filippov --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*) 650023ddd74SMax Filippov # These switches are silently ignored, for compatibility with 651023ddd74SMax Filippov # autoconf-generated configure scripts. This allows QEMU's 652023ddd74SMax Filippov # configure to be used by RPM and similar macros that set 653023ddd74SMax Filippov # lots of directory switches by default. 654023ddd74SMax Filippov ;; 655e2134eb9SGerd Hoffmann --with-system-pixman) pixman="system" 656e2134eb9SGerd Hoffmann ;; 657e2134eb9SGerd Hoffmann --without-system-pixman) pixman="internal" 658e2134eb9SGerd Hoffmann ;; 65974880fe2SRobert Schiele --without-pixman) pixman="none" 66074880fe2SRobert Schiele ;; 66197a847bcSbellard --disable-sdl) sdl="no" 66297a847bcSbellard ;; 663c4198157SJuan Quintela --enable-sdl) sdl="yes" 664c4198157SJuan Quintela ;; 665983eef5aSMeador Inge --disable-virtfs) virtfs="no" 666983eef5aSMeador Inge ;; 667983eef5aSMeador Inge --enable-virtfs) virtfs="yes" 668983eef5aSMeador Inge ;; 669821601eaSJes Sorensen --disable-vnc) vnc="no" 670821601eaSJes Sorensen ;; 671821601eaSJes Sorensen --enable-vnc) vnc="yes" 672821601eaSJes Sorensen ;; 673b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 674102a52e4Sbellard ;; 675c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 676c2de5c91Smalc ;; 6772f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 6782f6a1ab0Sblueswir1 ;; 6792fa7d3bfSmalc --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` 6800c58ac1cSmalc ;; 6810c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 6820c58ac1cSmalc ;; 683eb852011SMarkus Armbruster --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 684eb852011SMarkus Armbruster ;; 685f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 686f8393946Saurel32 ;; 687f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 688f8393946Saurel32 ;; 689f3d08ee6SPaul Brook --enable-debug) 690f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 691f3d08ee6SPaul Brook debug_tcg="yes" 692f3d08ee6SPaul Brook debug="yes" 693f3d08ee6SPaul Brook strip_opt="no" 694f3d08ee6SPaul Brook ;; 69503b4fe7dSaliguori --enable-sparse) sparse="yes" 69603b4fe7dSaliguori ;; 69703b4fe7dSaliguori --disable-sparse) sparse="no" 69803b4fe7dSaliguori ;; 6991625af87Saliguori --disable-strip) strip_opt="no" 7001625af87Saliguori ;; 7018d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 7028d5d2d4cSths ;; 7031be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 7041be10ad2SJuan Quintela ;; 7052f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 7062f9606b3Saliguori ;; 707ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 708ea784e3bSJuan Quintela ;; 7092f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 7102f6f5c7aSCorentin Chary ;; 7112f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 7122f6f5c7aSCorentin Chary ;; 713efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 714efe556adSCorentin Chary ;; 715efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 716efe556adSCorentin Chary ;; 717443f1376Sbellard --disable-slirp) slirp="no" 718c20709aaSbellard ;; 719ee682d27SStefan Weil --disable-uuid) uuid="no" 720ee682d27SStefan Weil ;; 721ee682d27SStefan Weil --enable-uuid) uuid="yes" 722ee682d27SStefan Weil ;; 723e0e6c8c0Saliguori --disable-vde) vde="no" 7248a16d273Sths ;; 725dfb278bdSJuan Quintela --enable-vde) vde="yes" 726dfb278bdSJuan Quintela ;; 727e37630caSaliguori --disable-xen) xen="no" 728e37630caSaliguori ;; 729fc321b4bSJuan Quintela --enable-xen) xen="yes" 730fc321b4bSJuan Quintela ;; 731eb6fda0fSAnthony PERARD --disable-xen-pci-passthrough) xen_pci_passthrough="no" 732eb6fda0fSAnthony PERARD ;; 733eb6fda0fSAnthony PERARD --enable-xen-pci-passthrough) xen_pci_passthrough="yes" 734eb6fda0fSAnthony PERARD ;; 7352e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 7362e4d9fb1Saurel32 ;; 7374ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 7384ffcedb6SJuan Quintela ;; 739fb599c9aSbalrog --disable-bluez) bluez="no" 740fb599c9aSbalrog ;; 741a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 742a20a6f46SJuan Quintela ;; 7437ba1e619Saliguori --disable-kvm) kvm="no" 7447ba1e619Saliguori ;; 745b31a0277SJuan Quintela --enable-kvm) kvm="yes" 746b31a0277SJuan Quintela ;; 7479195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 7489195b2c2SStefan Weil ;; 7499195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 7509195b2c2SStefan Weil ;; 75147e98658SCorey Bryant --disable-cap-ng) cap_ng="no" 75247e98658SCorey Bryant ;; 75347e98658SCorey Bryant --enable-cap-ng) cap_ng="yes" 75447e98658SCorey Bryant ;; 755cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 756cd4ec0b4SGerd Hoffmann ;; 757cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 758cd4ec0b4SGerd Hoffmann ;; 759c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 760c589b249SRonnie Sahlberg ;; 761c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 762c589b249SRonnie Sahlberg ;; 76305c2a3e7Sbellard --enable-profiler) profiler="yes" 76405c2a3e7Sbellard ;; 76514821030SPavel Borzenkov --disable-cocoa) cocoa="no" 76614821030SPavel Borzenkov ;; 767c2de5c91Smalc --enable-cocoa) 768c2de5c91Smalc cocoa="yes" ; 769c2de5c91Smalc sdl="no" ; 770c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 7715b0753e0Sbellard ;; 772cad25d69Spbrook --disable-system) softmmu="no" 7730a8e90f4Spbrook ;; 774cad25d69Spbrook --enable-system) softmmu="yes" 7750a8e90f4Spbrook ;; 7760953a80fSZachary Amsden --disable-user) 7770953a80fSZachary Amsden linux_user="no" ; 7780953a80fSZachary Amsden bsd_user="no" ; 7790953a80fSZachary Amsden ;; 7800953a80fSZachary Amsden --enable-user) ;; 781831b7825Sths --disable-linux-user) linux_user="no" 7820a8e90f4Spbrook ;; 783831b7825Sths --enable-linux-user) linux_user="yes" 784831b7825Sths ;; 78584778508Sblueswir1 --disable-bsd-user) bsd_user="no" 78684778508Sblueswir1 ;; 78784778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 78884778508Sblueswir1 ;; 789379f6698SPaul Brook --enable-guest-base) guest_base="yes" 790379f6698SPaul Brook ;; 791379f6698SPaul Brook --disable-guest-base) guest_base="no" 792379f6698SPaul Brook ;; 79340d6444eSAvi Kivity --enable-pie) pie="yes" 79434005a00SKirill A. Shutemov ;; 79540d6444eSAvi Kivity --disable-pie) pie="no" 79634005a00SKirill A. Shutemov ;; 797c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 798c5937220Spbrook ;; 79985aa5189Sbellard --enable-werror) werror="yes" 80085aa5189Sbellard ;; 80185aa5189Sbellard --disable-werror) werror="no" 80285aa5189Sbellard ;; 8034d3b6f6eSbalrog --disable-curses) curses="no" 8044d3b6f6eSbalrog ;; 805c584a6d0SJuan Quintela --enable-curses) curses="yes" 806c584a6d0SJuan Quintela ;; 807769ce76dSAlexander Graf --disable-curl) curl="no" 808769ce76dSAlexander Graf ;; 809788c8196SJuan Quintela --enable-curl) curl="yes" 810788c8196SJuan Quintela ;; 8112df87df7SJuan Quintela --disable-fdt) fdt="no" 8122df87df7SJuan Quintela ;; 8132df87df7SJuan Quintela --enable-fdt) fdt="yes" 8142df87df7SJuan Quintela ;; 815bd0c5661Spbrook --disable-nptl) nptl="no" 816bd0c5661Spbrook ;; 817b0a47e79SJuan Quintela --enable-nptl) nptl="yes" 818b0a47e79SJuan Quintela ;; 8198ff9cbf7Smalc --enable-mixemu) mixemu="yes" 8208ff9cbf7Smalc ;; 8215c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 8225c6c3a6cSChristoph Hellwig ;; 8235c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 8245c6c3a6cSChristoph Hellwig ;; 825758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 826758e8e38SVenkateswararao Jujjuri (JV) ;; 827758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 828758e8e38SVenkateswararao Jujjuri (JV) ;; 82977755340Sths --disable-blobs) blobs="no" 83077755340Sths ;; 8314a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 8324a19f1ecSpbrook ;; 833519175a2SAlex Barcelo --with-coroutine=*) coroutine="$optarg" 834519175a2SAlex Barcelo ;; 835a25dba17SJuan Quintela --disable-docs) docs="no" 83670ec5dc0SAnthony Liguori ;; 837a25dba17SJuan Quintela --enable-docs) docs="yes" 83883a3ab8bSJuan Quintela ;; 839d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 840d5970055SMichael S. Tsirkin ;; 841d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 842d5970055SMichael S. Tsirkin ;; 84320ff075bSMichael Walle --disable-opengl) opengl="no" 84420ff075bSMichael Walle ;; 84520ff075bSMichael Walle --enable-opengl) opengl="yes" 84620ff075bSMichael Walle ;; 847f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 848f27aaf4bSChristian Brunner ;; 849f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 850f27aaf4bSChristian Brunner ;; 8518c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 8528c84cf11SSergei Trofimovich ;; 8538c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 8548c84cf11SSergei Trofimovich ;; 85536707144SAlon Levy --disable-smartcard) smartcard="no" 85636707144SAlon Levy ;; 85736707144SAlon Levy --enable-smartcard) smartcard="yes" 85836707144SAlon Levy ;; 859111a38b0SRobert Relyea --disable-smartcard-nss) smartcard_nss="no" 860111a38b0SRobert Relyea ;; 861111a38b0SRobert Relyea --enable-smartcard-nss) smartcard_nss="yes" 862111a38b0SRobert Relyea ;; 86369354a83SHans de Goede --disable-usb-redir) usb_redir="no" 86469354a83SHans de Goede ;; 86569354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 86669354a83SHans de Goede ;; 8671ece9905SAlon Levy --disable-zlib-test) zlib="no" 8681ece9905SAlon Levy ;; 869d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 870d138cee9SMichael Roth ;; 871d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 872d138cee9SMichael Roth ;; 8734b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 8744b1c11fdSDaniel P. Berrange ;; 8754b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 8764b1c11fdSDaniel P. Berrange ;; 877f794573eSEduardo Otubo --enable-seccomp) seccomp="yes" 878f794573eSEduardo Otubo ;; 879f794573eSEduardo Otubo --disable-seccomp) seccomp="no" 880f794573eSEduardo Otubo ;; 881eb100396SBharata B Rao --disable-glusterfs) glusterfs="no" 882eb100396SBharata B Rao ;; 883eb100396SBharata B Rao --enable-glusterfs) glusterfs="yes" 884eb100396SBharata B Rao ;; 8857f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 8867f1559c6Sbalrog ;; 8877d13299dSbellard esac 8887d13299dSbellarddone 8897d13299dSbellard 89040293e58Sbellardcase "$cpu" in 8919b9c37c3SRichard Henderson sparc) 8920c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 8939b9c37c3SRichard Henderson QEMU_CFLAGS="-m32 -mcpu=ultrasparc $QEMU_CFLAGS" 8943142255cSblueswir1 ;; 895ed968ff1SJuan Quintela sparc64) 8960c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 8979b9c37c3SRichard Henderson QEMU_CFLAGS="-m64 -mcpu=ultrasparc $QEMU_CFLAGS" 8983142255cSblueswir1 ;; 89976d83bdeSths s390) 90028d7cc49SRichard Henderson QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS" 90128d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 90228d7cc49SRichard Henderson ;; 90328d7cc49SRichard Henderson s390x) 90428d7cc49SRichard Henderson QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS" 90528d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 90676d83bdeSths ;; 90740293e58Sbellard i386) 908a558ee17SJuan Quintela QEMU_CFLAGS="-m32 $QEMU_CFLAGS" 9090c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 9102b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 91140293e58Sbellard ;; 91240293e58Sbellard x86_64) 913a558ee17SJuan Quintela QEMU_CFLAGS="-m64 $QEMU_CFLAGS" 9140c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 9152b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 916379f6698SPaul Brook ;; 91730163d89SPeter Maydell # No special flags required for other host CPUs 9183142255cSblueswir1esac 9193142255cSblueswir1 92060e0df25SPeter Maydelldefault_target_list="" 92160e0df25SPeter Maydell 92260e0df25SPeter Maydell# these targets are portable 92360e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then 92460e0df25SPeter Maydell default_target_list="\ 92560e0df25SPeter Maydelli386-softmmu \ 92660e0df25SPeter Maydellx86_64-softmmu \ 92727cdad67SRichard Hendersonalpha-softmmu \ 92860e0df25SPeter Maydellarm-softmmu \ 92960e0df25SPeter Maydellcris-softmmu \ 93060e0df25SPeter Maydelllm32-softmmu \ 93160e0df25SPeter Maydellm68k-softmmu \ 93260e0df25SPeter Maydellmicroblaze-softmmu \ 93360e0df25SPeter Maydellmicroblazeel-softmmu \ 93460e0df25SPeter Maydellmips-softmmu \ 93560e0df25SPeter Maydellmipsel-softmmu \ 93660e0df25SPeter Maydellmips64-softmmu \ 93760e0df25SPeter Maydellmips64el-softmmu \ 938e67db06eSJia Liuor32-softmmu \ 93960e0df25SPeter Maydellppc-softmmu \ 94060e0df25SPeter Maydellppcemb-softmmu \ 94160e0df25SPeter Maydellppc64-softmmu \ 94260e0df25SPeter Maydellsh4-softmmu \ 94360e0df25SPeter Maydellsh4eb-softmmu \ 94460e0df25SPeter Maydellsparc-softmmu \ 94560e0df25SPeter Maydellsparc64-softmmu \ 9460f3301d4SAlexander Grafs390x-softmmu \ 947cfa550c6SMax Filippovxtensa-softmmu \ 948cfa550c6SMax Filippovxtensaeb-softmmu \ 9494f23a1e6SGuan Xuetaounicore32-softmmu \ 95060e0df25SPeter Maydell" 95160e0df25SPeter Maydellfi 95260e0df25SPeter Maydell# the following are Linux specific 95360e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then 95460e0df25SPeter Maydell default_target_list="${default_target_list}\ 95560e0df25SPeter Maydelli386-linux-user \ 95660e0df25SPeter Maydellx86_64-linux-user \ 95760e0df25SPeter Maydellalpha-linux-user \ 95860e0df25SPeter Maydellarm-linux-user \ 95960e0df25SPeter Maydellarmeb-linux-user \ 96060e0df25SPeter Maydellcris-linux-user \ 96160e0df25SPeter Maydellm68k-linux-user \ 96260e0df25SPeter Maydellmicroblaze-linux-user \ 96360e0df25SPeter Maydellmicroblazeel-linux-user \ 96460e0df25SPeter Maydellmips-linux-user \ 96560e0df25SPeter Maydellmipsel-linux-user \ 966d962783eSJia Liuor32-linux-user \ 96760e0df25SPeter Maydellppc-linux-user \ 96860e0df25SPeter Maydellppc64-linux-user \ 96960e0df25SPeter Maydellppc64abi32-linux-user \ 97060e0df25SPeter Maydellsh4-linux-user \ 97160e0df25SPeter Maydellsh4eb-linux-user \ 97260e0df25SPeter Maydellsparc-linux-user \ 97360e0df25SPeter Maydellsparc64-linux-user \ 97460e0df25SPeter Maydellsparc32plus-linux-user \ 97560e0df25SPeter Maydellunicore32-linux-user \ 9760f3301d4SAlexander Grafs390x-linux-user \ 97760e0df25SPeter Maydell" 97860e0df25SPeter Maydellfi 97960e0df25SPeter Maydell# the following are BSD specific 98060e0df25SPeter Maydellif [ "$bsd_user" = "yes" ] ; then 98160e0df25SPeter Maydell default_target_list="${default_target_list}\ 98260e0df25SPeter Maydelli386-bsd-user \ 98360e0df25SPeter Maydellx86_64-bsd-user \ 98460e0df25SPeter Maydellsparc-bsd-user \ 98560e0df25SPeter Maydellsparc64-bsd-user \ 98660e0df25SPeter Maydell" 98760e0df25SPeter Maydellfi 98860e0df25SPeter Maydell 989af5db58eSpbrookif test x"$show_help" = x"yes" ; then 990af5db58eSpbrookcat << EOF 991af5db58eSpbrook 992af5db58eSpbrookUsage: configure [options] 993af5db58eSpbrookOptions: [defaults in brackets after descriptions] 994af5db58eSpbrook 995af5db58eSpbrookEOF 996af5db58eSpbrookecho "Standard options:" 997af5db58eSpbrookecho " --help print this message" 998af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 999af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 1000af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 100160e0df25SPeter Maydellecho " --target-list=LIST set target list (default: build everything)" 100260e0df25SPeter Maydellecho "Available targets: $default_target_list" | \ 100360e0df25SPeter Maydell fold -s -w 53 | sed -e 's/^/ /' 1004af5db58eSpbrookecho "" 1005af5db58eSpbrookecho "Advanced options (experts only):" 1006af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 1007af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 1008af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 10090bfe8cc0SPaolo Bonziniecho " --host-cc=CC use C compiler CC [$host_cc] for code run at" 10100bfe8cc0SPaolo Bonziniecho " build time" 10113c4a4d0dSPeter Maydellecho " --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]" 1012a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 1013e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 1014af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 10156a882643Spbrookecho " --install=INSTALL use specified install [$install]" 1016c886edfbSBlue Swirlecho " --python=PYTHON use specified python [$python]" 1017e2d8830eSBradecho " --smbd=SMBD use specified smbd [$smbd]" 1018af5db58eSpbrookecho " --static enable static build [$static]" 10190b24e75fSPaolo Bonziniecho " --mandir=PATH install man pages in PATH" 1020023d3d67SEduardo Habkostecho " --datadir=PATH install firmware in PATH$confsuffix" 1021023d3d67SEduardo Habkostecho " --docdir=PATH install documentation in PATH$confsuffix" 10220b24e75fSPaolo Bonziniecho " --bindir=PATH install binaries in PATH" 1023023d3d67SEduardo Habkostecho " --sysconfdir=PATH install config in PATH$confsuffix" 1024785c23aeSLuiz Capitulinoecho " --localstatedir=PATH install local state in PATH" 10252ae4748fSStefan Weilecho " --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]" 1026f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 1027f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 102809695a4aSStefan Weilecho " --enable-debug enable common debug build options" 1029890b1658Saliguoriecho " --enable-sparse enable sparse checker" 1030890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 10311625af87Saliguoriecho " --disable-strip disable stripping binaries" 103285aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 1033fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 1034c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 1035983eef5aSMeador Ingeecho " --disable-virtfs disable VirtFS" 1036983eef5aSMeador Ingeecho " --enable-virtfs enable VirtFS" 1037821601eaSJes Sorensenecho " --disable-vnc disable VNC" 1038821601eaSJes Sorensenecho " --enable-vnc enable VNC" 103914821030SPavel Borzenkovecho " --disable-cocoa disable Cocoa (Mac OS X only)" 104014821030SPavel Borzenkovecho " --enable-cocoa enable Cocoa (default on Mac OS X)" 1041c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 1042c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 10434c9b53e3Smalcecho " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" 10444c9b53e3Smalcecho " Available cards: $audio_possible_cards" 1045eb852011SMarkus Armbrusterecho " --block-drv-whitelist=L set block driver whitelist" 1046eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 10478ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 1048e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 1049fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 1050eb6fda0fSAnthony PERARDecho " --disable-xen-pci-passthrough" 1051eb6fda0fSAnthony PERARDecho " --enable-xen-pci-passthrough" 10522e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 10534ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 10548d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 10551be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 10562f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 1057ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 10582f6f5c7aSCorentin Charyecho " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" 10592f6f5c7aSCorentin Charyecho " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" 106096763cf9SCorentin Charyecho " --disable-vnc-png disable PNG compression for VNC server (default)" 1061efe556adSCorentin Charyecho " --enable-vnc-png enable PNG compression for VNC server" 1062af896aaaSpbrookecho " --disable-curses disable curses output" 1063c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 1064769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 1065788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 10662df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 10672df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 1068fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 1069a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 10706093d3d4SPeter Maydellecho " --disable-slirp disable SLIRP userspace network connectivity" 10717ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 1072b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 10739195b2c2SStefan Weilecho " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)" 1074bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 1075e5934d33SAndre Przywaraecho " --enable-nptl enable usermode NPTL support" 1076af5db58eSpbrookecho " --enable-system enable all system emulation targets" 1077af5db58eSpbrookecho " --disable-system disable all system emulation targets" 10780953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 10790953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 1080831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 1081831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 108284778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 108384778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 1084379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 1085379f6698SPaul Brookecho " emulation targets" 1086379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 108740d6444eSAvi Kivityecho " --enable-pie build Position Independent Executables" 108840d6444eSAvi Kivityecho " --disable-pie do not build Position Independent Executables" 1089af5db58eSpbrookecho " --fmod-lib path to FMOD library" 1090af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 10912f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 1092c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 1093235e510cS陳韋任echo " --cpu=CPU Build for host CPU [$cpu]" 10943142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 1095ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 1096ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 1097e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 1098dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 10995c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 11005c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 110147e98658SCorey Bryantecho " --disable-cap-ng disable libcap-ng support" 110247e98658SCorey Bryantecho " --enable-cap-ng enable libcap-ng support" 1103758e8e38SVenkateswararao Jujjuri (JV)echo " --disable-attr disables attr and xattr support" 1104758e8e38SVenkateswararao Jujjuri (JV)echo " --enable-attr enable attr and xattr support" 110577755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 1106d2807bc9SDirk Ullrichecho " --enable-docs enable documentation build" 1107d2807bc9SDirk Ullrichecho " --disable-docs disable documentation build" 1108d5970055SMichael S. Tsirkinecho " --disable-vhost-net disable vhost-net acceleration support" 1109d5970055SMichael S. Tsirkinecho " --enable-vhost-net enable vhost-net acceleration support" 1110320fba2aSFabien Chouteauecho " --enable-trace-backend=B Set trace backend" 1111650ab98dSLluís Vilanovaecho " Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends) 111274242e0fSPaolo Bonziniecho " --with-trace-file=NAME Full PATH,NAME of file to store traces" 11139410b56cSPrerna Saxenaecho " Default:trace-<pid>" 1114cd4ec0b4SGerd Hoffmannecho " --disable-spice disable spice" 1115cd4ec0b4SGerd Hoffmannecho " --enable-spice enable spice" 1116f27aaf4bSChristian Brunnerecho " --enable-rbd enable building the rados block device (rbd)" 1117c589b249SRonnie Sahlbergecho " --disable-libiscsi disable iscsi support" 1118c589b249SRonnie Sahlbergecho " --enable-libiscsi enable iscsi support" 111936707144SAlon Levyecho " --disable-smartcard disable smartcard support" 112036707144SAlon Levyecho " --enable-smartcard enable smartcard support" 1121111a38b0SRobert Relyeaecho " --disable-smartcard-nss disable smartcard nss support" 1122111a38b0SRobert Relyeaecho " --enable-smartcard-nss enable smartcard nss support" 112369354a83SHans de Goedeecho " --disable-usb-redir disable usb network redirection support" 112469354a83SHans de Goedeecho " --enable-usb-redir enable usb network redirection support" 1125d138cee9SMichael Rothecho " --disable-guest-agent disable building of the QEMU Guest Agent" 1126d138cee9SMichael Rothecho " --enable-guest-agent enable building of the QEMU Guest Agent" 1127f794573eSEduardo Otuboecho " --disable-seccomp disable seccomp support" 1128f794573eSEduardo Otuboecho " --enable-seccomp enables seccomp support" 1129519175a2SAlex Barceloecho " --with-coroutine=BACKEND coroutine backend. Supported options:" 1130fe91bfa8SAlex Barceloecho " gthread, ucontext, sigaltstack, windows" 1131eb100396SBharata B Raoecho " --enable-glusterfs enable GlusterFS backend" 1132eb100396SBharata B Raoecho " --disable-glusterfs disable GlusterFS backend" 1133af5db58eSpbrookecho "" 11345bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 1135af5db58eSpbrookexit 1 1136af5db58eSpbrookfi 1137af5db58eSpbrook 1138359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just 1139359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported. 1140359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then 1141359bc95dSPeter Maydell if test "$tcg_interpreter" = "yes" ; then 1142359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 1143359bc95dSPeter Maydell ARCH=tci 1144359bc95dSPeter Maydell else 1145359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 1146359bc95dSPeter Maydell exit 1 1147359bc95dSPeter Maydell fi 1148359bc95dSPeter Maydellfi 1149359bc95dSPeter Maydell 11508d05095cSPaolo Bonzini# check that the C compiler works. 11518d05095cSPaolo Bonzinicat > $TMPC <<EOF 115275cafad7SStefan Weilint main(void) { return 0; } 11538d05095cSPaolo BonziniEOF 11548d05095cSPaolo Bonzini 11558d05095cSPaolo Bonziniif compile_object ; then 11568d05095cSPaolo Bonzini : C compiler works ok 11578d05095cSPaolo Bonzinielse 11588d05095cSPaolo Bonzini echo "ERROR: \"$cc\" either does not exist or does not work" 11598d05095cSPaolo Bonzini exit 1 11608d05095cSPaolo Bonzinifi 11618d05095cSPaolo Bonzini 1162417c9d72SAlexander Graf# Consult white-list to determine whether to enable werror 1163417c9d72SAlexander Graf# by default. Only enable by default for git builds 1164417c9d72SAlexander Grafz_version=`cut -f3 -d. $source_path/VERSION` 1165417c9d72SAlexander Graf 1166417c9d72SAlexander Grafif test -z "$werror" ; then 1167417c9d72SAlexander Graf if test "$z_version" = "50" -a \ 1168417c9d72SAlexander Graf "$linux" = "yes" ; then 1169417c9d72SAlexander Graf werror="yes" 1170417c9d72SAlexander Graf else 1171417c9d72SAlexander Graf werror="no" 1172417c9d72SAlexander Graf fi 1173417c9d72SAlexander Graffi 1174417c9d72SAlexander Graf 11758d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 11768d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 11778d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 1178f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags" 1179c1556a81SPeter Maydellgcc_flags="-Wno-initializer-overrides $gcc_flags" 11806ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would 11816ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due 11826ca026cbSPeter Maydell# to -Werror this would just silently disable some features, 11836ca026cbSPeter Maydell# so it's too error prone. 11848d05095cSPaolo Bonzinicat > $TMPC << EOF 11858d05095cSPaolo Bonziniint main(void) { return 0; } 11868d05095cSPaolo BonziniEOF 11878d05095cSPaolo Bonzinifor flag in $gcc_flags; do 1188a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 1189a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 1190a1d29d6cSPeter Maydell # warning options). 1191a1d29d6cSPeter Maydell optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')" 1192a1d29d6cSPeter Maydell if compile_prog "-Werror $optflag" "" ; then 11938d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 11948d05095cSPaolo Bonzini fi 11958d05095cSPaolo Bonzinidone 11968d05095cSPaolo Bonzini 1197cbdd1999SPaolo Bonzini# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and 1198cbdd1999SPaolo Bonzini# large functions that use global variables. The bug is in all releases of 1199cbdd1999SPaolo Bonzini# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in 1200cbdd1999SPaolo Bonzini# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013. 1201cbdd1999SPaolo Bonzinicat > $TMPC << EOF 1202cbdd1999SPaolo Bonzini#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2)) 1203cbdd1999SPaolo Bonziniint main(void) { return 0; } 1204cbdd1999SPaolo Bonzini#else 1205cbdd1999SPaolo Bonzini#error No bug in this compiler. 1206cbdd1999SPaolo Bonzini#endif 1207cbdd1999SPaolo BonziniEOF 1208cbdd1999SPaolo Bonziniif compile_prog "-Werror -fno-gcse" "" ; then 1209cbdd1999SPaolo Bonzini TRANSLATE_OPT_CFLAGS=-fno-gcse 1210cbdd1999SPaolo Bonzinifi 1211cbdd1999SPaolo Bonzini 121240d6444eSAvi Kivityif test "$static" = "yes" ; then 121340d6444eSAvi Kivity if test "$pie" = "yes" ; then 121440d6444eSAvi Kivity echo "static and pie are mutually incompatible" 121540d6444eSAvi Kivity exit 1 121640d6444eSAvi Kivity else 121740d6444eSAvi Kivity pie="no" 121840d6444eSAvi Kivity fi 121940d6444eSAvi Kivityfi 122040d6444eSAvi Kivity 122140d6444eSAvi Kivityif test "$pie" = ""; then 122240d6444eSAvi Kivity case "$cpu-$targetos" in 1223f9db31a2SBrad i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD) 122440d6444eSAvi Kivity ;; 122540d6444eSAvi Kivity *) 122640d6444eSAvi Kivity pie="no" 122740d6444eSAvi Kivity ;; 122840d6444eSAvi Kivity esac 122940d6444eSAvi Kivityfi 123040d6444eSAvi Kivity 123140d6444eSAvi Kivityif test "$pie" != "no" ; then 123240d6444eSAvi Kivity cat > $TMPC << EOF 123321d4a791SAvi Kivity 123421d4a791SAvi Kivity#ifdef __linux__ 123521d4a791SAvi Kivity# define THREAD __thread 123621d4a791SAvi Kivity#else 123721d4a791SAvi Kivity# define THREAD 123821d4a791SAvi Kivity#endif 123921d4a791SAvi Kivity 124021d4a791SAvi Kivitystatic THREAD int tls_var; 124121d4a791SAvi Kivity 124221d4a791SAvi Kivityint main(void) { return tls_var; } 124321d4a791SAvi Kivity 124440d6444eSAvi KivityEOF 124540d6444eSAvi Kivity if compile_prog "-fPIE -DPIE" "-pie"; then 124640d6444eSAvi Kivity QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" 124740d6444eSAvi Kivity LDFLAGS="-pie $LDFLAGS" 124840d6444eSAvi Kivity pie="yes" 124940d6444eSAvi Kivity if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 125040d6444eSAvi Kivity LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" 125140d6444eSAvi Kivity fi 125240d6444eSAvi Kivity else 125340d6444eSAvi Kivity if test "$pie" = "yes"; then 125440d6444eSAvi Kivity echo "PIE not available due to missing toolchain support" 125540d6444eSAvi Kivity exit 1 125640d6444eSAvi Kivity else 125740d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 125840d6444eSAvi Kivity pie="no" 125940d6444eSAvi Kivity fi 126040d6444eSAvi Kivity fi 126140d6444eSAvi Kivityfi 126240d6444eSAvi Kivity 1263ec530c81Sbellard# 1264ec530c81Sbellard# Solaris specific configure tool chain decisions 1265ec530c81Sbellard# 1266ec530c81Sbellardif test "$solaris" = "yes" ; then 12676792aa11SLoïc Minier if has $install; then 12686792aa11SLoïc Minier : 12696792aa11SLoïc Minier else 1270ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 1271ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 1272ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 1273ec530c81Sbellard exit 1 1274ec530c81Sbellard fi 12756792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 1276ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 1277ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 1278ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 1279ec530c81Sbellard exit 1 1280ec530c81Sbellard fi 12816792aa11SLoïc Minier if has ar; then 12826792aa11SLoïc Minier : 12836792aa11SLoïc Minier else 1284ec530c81Sbellard echo "Error: No path includes ar" 1285ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 1286ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 1287ec530c81Sbellard fi 1288ec530c81Sbellard exit 1 1289ec530c81Sbellard fi 1290ec530c81Sbellardfi 1291ec530c81Sbellard 12927a3fc891SSebastian Herbsztif ! has $python; then 1293c886edfbSBlue Swirl echo "Python not found. Use --python=/path/to/python" 1294c886edfbSBlue Swirl exit 1 1295c886edfbSBlue Swirlfi 1296c886edfbSBlue Swirl 12976ccea1e4SPeter Maydell# Note that if the Python conditional here evaluates True we will exit 12986ccea1e4SPeter Maydell# with status 1 which is a shell 'false' value. 1299e120d449SStefan Hajnocziif ! "$python" -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then 1300e120d449SStefan Hajnoczi echo "Cannot use '$python', Python 2.4 or later is required." 1301e120d449SStefan Hajnoczi echo "Note that Python 3 or later is not yet supported." 1302e120d449SStefan Hajnoczi echo "Use --python=/path/to/python to specify a supported Python." 13036ccea1e4SPeter Maydell exit 1 13046ccea1e4SPeter Maydellfi 13056ccea1e4SPeter Maydell 1306afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 1307121afa9eSAnthony Liguori target_list="$default_target_list" 1308121afa9eSAnthony Liguorielse 1309121afa9eSAnthony Liguori target_list=`echo "$target_list" | sed -e 's/,/ /g'` 13105327cf48Sbellardfi 1311f55fe278SPaolo Bonzini# see if system emulation was really requested 1312f55fe278SPaolo Bonzinicase " $target_list " in 1313f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1314f55fe278SPaolo Bonzini ;; 1315f55fe278SPaolo Bonzini *) softmmu=no 1316f55fe278SPaolo Bonzini ;; 1317f55fe278SPaolo Bonziniesac 13185327cf48Sbellard 1319249247c9SJuan Quintelafeature_not_found() { 1320249247c9SJuan Quintela feature=$1 1321249247c9SJuan Quintela 1322249247c9SJuan Quintela echo "ERROR" 1323249247c9SJuan Quintela echo "ERROR: User requested feature $feature" 13249332f6a2SSebastian Herbszt echo "ERROR: configure was not able to find it" 1325249247c9SJuan Quintela echo "ERROR" 1326249247c9SJuan Quintela exit 1; 1327249247c9SJuan Quintela} 1328249247c9SJuan Quintela 13297d13299dSbellardif test -z "$cross_prefix" ; then 13307d13299dSbellard 13317d13299dSbellard# --- 13327d13299dSbellard# big/little endian test 13337d13299dSbellardcat > $TMPC << EOF 13347d13299dSbellard#include <inttypes.h> 1335abab1a0fSStefan Weilint main(void) { 13367d13299dSbellard volatile uint32_t i=0x01234567; 13377d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 13387d13299dSbellard} 13397d13299dSbellardEOF 13407d13299dSbellard 134152166aa0SJuan Quintelaif compile_prog "" "" ; then 13427d13299dSbellard$TMPE && bigendian="yes" 13437d13299dSbellardelse 13447d13299dSbellardecho big/little test failed 13457d13299dSbellardfi 13467d13299dSbellard 13477d13299dSbellardelse 13487d13299dSbellard 13497d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 1350ea8f20f8SJuan Quintelacase "$cpu" in 135121d89f84SPeter Maydell arm) 135221d89f84SPeter Maydell # ARM can be either way; ask the compiler which one we are 135321d89f84SPeter Maydell if check_define __ARMEB__; then 135421d89f84SPeter Maydell bigendian=yes 135521d89f84SPeter Maydell fi 135621d89f84SPeter Maydell ;; 135721d89f84SPeter Maydell hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 1358ea8f20f8SJuan Quintela bigendian=yes 1359ea8f20f8SJuan Quintela ;; 1360ea8f20f8SJuan Quintelaesac 13617d13299dSbellard 13627d13299dSbellardfi 13637d13299dSbellard 1364b0a47e79SJuan Quintela########################################## 1365779ab5e3SStefan Weil# pkg-config probe 1366779ab5e3SStefan Weil 1367779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then 1368779ab5e3SStefan Weil echo "Error: pkg-config binary '$pkg_config_exe' not found" 1369779ab5e3SStefan Weil exit 1 1370779ab5e3SStefan Weilfi 1371779ab5e3SStefan Weil 1372779ab5e3SStefan Weil########################################## 1373b0a47e79SJuan Quintela# NPTL probe 1374b0a47e79SJuan Quintela 1375b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then 1376bd0c5661Spbrook cat > $TMPC <<EOF 1377bd0c5661Spbrook#include <sched.h> 137830813ceaSpbrook#include <linux/futex.h> 1379182eacc0SStefan Weilint main(void) { 1380bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1381bd0c5661Spbrook#error bork 1382bd0c5661Spbrook#endif 1383182eacc0SStefan Weil return 0; 1384bd0c5661Spbrook} 1385bd0c5661SpbrookEOF 1386bd0c5661Spbrook 138752166aa0SJuan Quintela if compile_object ; then 1388b0a47e79SJuan Quintela nptl=yes 1389bd0c5661Spbrook else 1390b0a47e79SJuan Quintela if test "$nptl" = "yes" ; then 1391b0a47e79SJuan Quintela feature_not_found "nptl" 1392b0a47e79SJuan Quintela fi 1393b0a47e79SJuan Quintela nptl=no 1394b0a47e79SJuan Quintela fi 1395bd0c5661Spbrookfi 1396bd0c5661Spbrook 139711d9f695Sbellard########################################## 1398ac62922eSbalrog# zlib check 1399ac62922eSbalrog 14001ece9905SAlon Levyif test "$zlib" != "no" ; then 1401ac62922eSbalrog cat > $TMPC << EOF 1402ac62922eSbalrog#include <zlib.h> 1403ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1404ac62922eSbalrogEOF 140552166aa0SJuan Quintela if compile_prog "" "-lz" ; then 1406ac62922eSbalrog : 1407ac62922eSbalrog else 1408ac62922eSbalrog echo 1409ac62922eSbalrog echo "Error: zlib check failed" 1410ac62922eSbalrog echo "Make sure to have the zlib libs and headers installed." 1411ac62922eSbalrog echo 1412ac62922eSbalrog exit 1 1413ac62922eSbalrog fi 14141ece9905SAlon Levyfi 1415ac62922eSbalrog 1416ac62922eSbalrog########################################## 1417f794573eSEduardo Otubo# libseccomp check 1418f794573eSEduardo Otubo 1419f794573eSEduardo Otuboif test "$seccomp" != "no" ; then 14202c5c4451SBlue Swirl if $pkg_config --atleast-version=1.0.0 libseccomp --modversion >/dev/null 2>&1; then 1421f794573eSEduardo Otubo LIBS=`$pkg_config --libs libseccomp` 1422f794573eSEduardo Otubo seccomp="yes" 1423f794573eSEduardo Otubo else 1424f794573eSEduardo Otubo if test "$seccomp" = "yes"; then 1425f794573eSEduardo Otubo feature_not_found "libseccomp" 1426f794573eSEduardo Otubo fi 1427e84d5956SYann E. MORIN seccomp="no" 1428f794573eSEduardo Otubo fi 1429f794573eSEduardo Otubofi 1430f794573eSEduardo Otubo########################################## 1431e37630caSaliguori# xen probe 1432e37630caSaliguori 1433fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1434b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1435d5b93ddfSAnthony PERARD 143650ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 143750ced5b3SStefan Weil # If no, we are done and there is no Xen support. 143850ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 143950ced5b3SStefan Weil 144050ced5b3SStefan Weil # Xen (any) 144150ced5b3SStefan Weil cat > $TMPC <<EOF 144250ced5b3SStefan Weil#include <xenctrl.h> 144350ced5b3SStefan Weilint main(void) { 144450ced5b3SStefan Weil return 0; 144550ced5b3SStefan Weil} 144650ced5b3SStefan WeilEOF 144750ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 144850ced5b3SStefan Weil # Xen not found 144950ced5b3SStefan Weil if test "$xen" = "yes" ; then 145050ced5b3SStefan Weil feature_not_found "xen" 145150ced5b3SStefan Weil fi 145250ced5b3SStefan Weil xen=no 145350ced5b3SStefan Weil 1454d5b93ddfSAnthony PERARD # Xen unstable 145569deef08SPeter Maydell elif 145669deef08SPeter Maydell cat > $TMPC <<EOF && 1457e37630caSaliguori#include <xenctrl.h> 1458e108a3c1SAnthony PERARD#include <xenstore.h> 1459d5b93ddfSAnthony PERARD#include <stdint.h> 1460d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1461d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1462d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1463d5b93ddfSAnthony PERARD#endif 1464d5b93ddfSAnthony PERARDint main(void) { 1465d5b93ddfSAnthony PERARD xc_interface *xc; 1466d5b93ddfSAnthony PERARD xs_daemon_open(); 1467d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 1468d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1469d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 1470b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 14718688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 14728688e065SStefano Stabellini return 0; 14738688e065SStefano Stabellini} 14748688e065SStefano StabelliniEOF 14758688e065SStefano Stabellini compile_prog "" "$xen_libs" 147669deef08SPeter Maydell then 14778688e065SStefano Stabellini xen_ctrl_version=420 14788688e065SStefano Stabellini xen=yes 14798688e065SStefano Stabellini 148069deef08SPeter Maydell elif 148169deef08SPeter Maydell cat > $TMPC <<EOF && 14828688e065SStefano Stabellini#include <xenctrl.h> 14838688e065SStefano Stabellini#include <xs.h> 14848688e065SStefano Stabellini#include <stdint.h> 14858688e065SStefano Stabellini#include <xen/hvm/hvm_info_table.h> 14868688e065SStefano Stabellini#if !defined(HVM_MAX_VCPUS) 14878688e065SStefano Stabellini# error HVM_MAX_VCPUS not defined 14888688e065SStefano Stabellini#endif 14898688e065SStefano Stabelliniint main(void) { 14908688e065SStefano Stabellini xs_daemon_open(); 14919b4c0b56SPeter Maydell xc_interface_open(0, 0, 0); 14928688e065SStefano Stabellini xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 14938688e065SStefano Stabellini xc_gnttab_open(NULL, 0); 14948688e065SStefano Stabellini xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 1495d5b93ddfSAnthony PERARD return 0; 1496d5b93ddfSAnthony PERARD} 1497e37630caSaliguoriEOF 149850ced5b3SStefan Weil compile_prog "" "$xen_libs" 149969deef08SPeter Maydell then 1500d5b93ddfSAnthony PERARD xen_ctrl_version=410 1501fc321b4bSJuan Quintela xen=yes 1502d5b93ddfSAnthony PERARD 1503d5b93ddfSAnthony PERARD # Xen 4.0.0 150469deef08SPeter Maydell elif 150569deef08SPeter Maydell cat > $TMPC <<EOF && 1506d5b93ddfSAnthony PERARD#include <xenctrl.h> 1507d5b93ddfSAnthony PERARD#include <xs.h> 1508d5b93ddfSAnthony PERARD#include <stdint.h> 1509d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1510d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1511d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1512d5b93ddfSAnthony PERARD#endif 1513d5b93ddfSAnthony PERARDint main(void) { 1514b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1515b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1516b87de24eSAnthony PERARD }; 1517d5b93ddfSAnthony PERARD xs_daemon_open(); 1518d5b93ddfSAnthony PERARD xc_interface_open(); 1519d5b93ddfSAnthony PERARD xc_gnttab_open(); 1520d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1521b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1522d5b93ddfSAnthony PERARD return 0; 1523d5b93ddfSAnthony PERARD} 1524d5b93ddfSAnthony PERARDEOF 1525d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 152669deef08SPeter Maydell then 1527d5b93ddfSAnthony PERARD xen_ctrl_version=400 1528d5b93ddfSAnthony PERARD xen=yes 1529d5b93ddfSAnthony PERARD 1530b87de24eSAnthony PERARD # Xen 3.4.0 153169deef08SPeter Maydell elif 153269deef08SPeter Maydell cat > $TMPC <<EOF && 1533b87de24eSAnthony PERARD#include <xenctrl.h> 1534b87de24eSAnthony PERARD#include <xs.h> 1535b87de24eSAnthony PERARDint main(void) { 1536b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1537b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1538b87de24eSAnthony PERARD }; 1539b87de24eSAnthony PERARD xs_daemon_open(); 1540b87de24eSAnthony PERARD xc_interface_open(); 1541b87de24eSAnthony PERARD xc_gnttab_open(); 1542b87de24eSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1543b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1544b87de24eSAnthony PERARD return 0; 1545b87de24eSAnthony PERARD} 1546b87de24eSAnthony PERARDEOF 1547b87de24eSAnthony PERARD compile_prog "" "$xen_libs" 154869deef08SPeter Maydell then 1549b87de24eSAnthony PERARD xen_ctrl_version=340 1550b87de24eSAnthony PERARD xen=yes 1551b87de24eSAnthony PERARD 1552b87de24eSAnthony PERARD # Xen 3.3.0 155369deef08SPeter Maydell elif 155469deef08SPeter Maydell cat > $TMPC <<EOF && 1555d5b93ddfSAnthony PERARD#include <xenctrl.h> 1556d5b93ddfSAnthony PERARD#include <xs.h> 1557d5b93ddfSAnthony PERARDint main(void) { 1558d5b93ddfSAnthony PERARD xs_daemon_open(); 1559d5b93ddfSAnthony PERARD xc_interface_open(); 1560d5b93ddfSAnthony PERARD xc_gnttab_open(); 1561d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1562d5b93ddfSAnthony PERARD return 0; 1563d5b93ddfSAnthony PERARD} 1564d5b93ddfSAnthony PERARDEOF 1565d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 156669deef08SPeter Maydell then 1567d5b93ddfSAnthony PERARD xen_ctrl_version=330 1568d5b93ddfSAnthony PERARD xen=yes 1569d5b93ddfSAnthony PERARD 157050ced5b3SStefan Weil # Xen version unsupported 1571e37630caSaliguori else 1572fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 157350ced5b3SStefan Weil feature_not_found "xen (unsupported version)" 1574fc321b4bSJuan Quintela fi 1575fc321b4bSJuan Quintela xen=no 1576e37630caSaliguori fi 1577d5b93ddfSAnthony PERARD 1578d5b93ddfSAnthony PERARD if test "$xen" = yes; then 1579d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 1580d5b93ddfSAnthony PERARD fi 1581e37630caSaliguorifi 1582e37630caSaliguori 1583eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then 1584eb6fda0fSAnthony PERARD if test "$xen" = "yes" && test "$linux" = "yes" && 1585eb6fda0fSAnthony PERARD test "$xen_ctrl_version" -ge 340; then 1586eb6fda0fSAnthony PERARD xen_pci_passthrough=yes 1587eb6fda0fSAnthony PERARD else 1588eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = "yes"; then 1589eb6fda0fSAnthony PERARD echo "ERROR" 1590eb6fda0fSAnthony PERARD echo "ERROR: User requested feature Xen PCI Passthrough" 1591eb6fda0fSAnthony PERARD echo "ERROR: but this feature require /sys from Linux" 1592eb6fda0fSAnthony PERARD if test "$xen_ctrl_version" -lt 340; then 1593eb6fda0fSAnthony PERARD echo "ERROR: This feature does not work with Xen 3.3" 1594eb6fda0fSAnthony PERARD fi 1595eb6fda0fSAnthony PERARD echo "ERROR" 1596eb6fda0fSAnthony PERARD exit 1; 1597eb6fda0fSAnthony PERARD fi 1598eb6fda0fSAnthony PERARD xen_pci_passthrough=no 1599eb6fda0fSAnthony PERARD fi 1600eb6fda0fSAnthony PERARDfi 1601eb6fda0fSAnthony PERARD 1602e37630caSaliguori########################################## 160344dc0ca3SAlon Levy# libtool probe 160444dc0ca3SAlon Levy 16053f534581SBradif ! has $libtool; then 160644dc0ca3SAlon Levy libtool= 160744dc0ca3SAlon Levyfi 160844dc0ca3SAlon Levy 160944dc0ca3SAlon Levy########################################## 1610dfffc653SJuan Quintela# Sparse probe 1611dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 16120dba6195SLoïc Minier if has cgcc; then 1613dfffc653SJuan Quintela sparse=yes 1614dfffc653SJuan Quintela else 1615dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 1616dfffc653SJuan Quintela feature_not_found "sparse" 1617dfffc653SJuan Quintela fi 1618dfffc653SJuan Quintela sparse=no 1619dfffc653SJuan Quintela fi 1620dfffc653SJuan Quintelafi 1621dfffc653SJuan Quintela 1622dfffc653SJuan Quintela########################################## 162311d9f695Sbellard# SDL probe 162411d9f695Sbellard 16253ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 16263ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 16273ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then 16283ec87ffeSPaolo Bonzini sdl_config=sdl-config 16293ec87ffeSPaolo Bonzinifi 16303ec87ffeSPaolo Bonzini 16313ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then 1632a8bd70adSPaolo Bonzini sdlconfig="$pkg_config sdl" 1633fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 16343ec87ffeSPaolo Bonzinielif has ${sdl_config}; then 16353ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 16369316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1637a0dfd8a4SLoïc Minierelse 1638a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 1639a0dfd8a4SLoïc Minier feature_not_found "sdl" 1640a0dfd8a4SLoïc Minier fi 1641a0dfd8a4SLoïc Minier sdl=no 16429316f803SPaolo Bonzinifi 164329e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 16443ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 16453ec87ffeSPaolo Bonzinifi 164611d9f695Sbellard 16479316f803SPaolo Bonzinisdl_too_old=no 1648c4198157SJuan Quintelaif test "$sdl" != "no" ; then 164911d9f695Sbellard cat > $TMPC << EOF 165011d9f695Sbellard#include <SDL.h> 165111d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 165211d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 165311d9f695SbellardEOF 16549316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 165574f42e18STeLeMan if test "$static" = "yes" ; then 165674f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 165774f42e18STeLeMan else 16589316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 165974f42e18STeLeMan fi 166052166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 166111d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 166211d9f695Sbellard sdl_too_old=yes 166311d9f695Sbellard else 1664fd677642Sths if test "$cocoa" = "no" ; then 166511d9f695Sbellard sdl=yes 166611d9f695Sbellard fi 1667fd677642Sths fi 16687c1f25b4Sbellard 166967c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 16701ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 167167c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 1672f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 1673f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 167411d9f695Sbellard fi 167552166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 16761ac88f28SJuan Quintela : 16771ac88f28SJuan Quintela else 16781ac88f28SJuan Quintela sdl=no 16797c1f25b4Sbellard fi 16807c1f25b4Sbellard fi # static link 1681c4198157SJuan Quintela else # sdl not found 1682c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1683c4198157SJuan Quintela feature_not_found "sdl" 1684c4198157SJuan Quintela fi 1685c4198157SJuan Quintela sdl=no 16867c1f25b4Sbellard fi # sdl compile test 1687fd677642Sthsfi 168811d9f695Sbellard 16895368a422Saliguoriif test "$sdl" = "yes" ; then 16905368a422Saliguori cat > $TMPC <<EOF 16915368a422Saliguori#include <SDL.h> 16925368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 16935368a422Saliguori#include <X11/XKBlib.h> 16945368a422Saliguori#else 16955368a422Saliguori#error No x11 support 16965368a422Saliguori#endif 16975368a422Saliguoriint main(void) { return 0; } 16985368a422SaliguoriEOF 169952166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1700681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 17015368a422Saliguori fi 17020705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 17035368a422Saliguorifi 17045368a422Saliguori 17058f28f3fbSths########################################## 17068d5d2d4cSths# VNC TLS detection 1707821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then 1708ae6b5e5aSaliguori cat > $TMPC <<EOF 1709ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1710ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1711ae6b5e5aSaliguoriEOF 1712a8bd70adSPaolo Bonzini vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` 1713a8bd70adSPaolo Bonzini vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` 171452166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 17151be10ad2SJuan Quintela vnc_tls=yes 1716a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1717ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags" 1718ae6b5e5aSaliguori else 17191be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 17201be10ad2SJuan Quintela feature_not_found "vnc-tls" 17211be10ad2SJuan Quintela fi 17221be10ad2SJuan Quintela vnc_tls=no 17238d5d2d4cSths fi 17248d5d2d4cSthsfi 17258d5d2d4cSths 17268d5d2d4cSths########################################## 17272f9606b3Saliguori# VNC SASL detection 1728821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then 17292f9606b3Saliguori cat > $TMPC <<EOF 17302f9606b3Saliguori#include <sasl/sasl.h> 17312f9606b3Saliguori#include <stdio.h> 17322f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 17332f9606b3SaliguoriEOF 17342f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 17352f9606b3Saliguori vnc_sasl_cflags="" 17362f9606b3Saliguori vnc_sasl_libs="-lsasl2" 173752166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1738ea784e3bSJuan Quintela vnc_sasl=yes 1739fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 1740ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags" 17412f9606b3Saliguori else 1742ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1743ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1744ea784e3bSJuan Quintela fi 1745ea784e3bSJuan Quintela vnc_sasl=no 17462f9606b3Saliguori fi 17472f9606b3Saliguorifi 17482f9606b3Saliguori 17492f9606b3Saliguori########################################## 17502f6f5c7aSCorentin Chary# VNC JPEG detection 1751821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then 17522f6f5c7aSCorentin Charycat > $TMPC <<EOF 17532f6f5c7aSCorentin Chary#include <stdio.h> 17542f6f5c7aSCorentin Chary#include <jpeglib.h> 17552f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 17562f6f5c7aSCorentin CharyEOF 17572f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 17582f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 17592f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 17602f6f5c7aSCorentin Chary vnc_jpeg=yes 17612f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 1762ca273d58SPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags" 17632f6f5c7aSCorentin Chary else 17642f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 17652f6f5c7aSCorentin Chary feature_not_found "vnc-jpeg" 17662f6f5c7aSCorentin Chary fi 17672f6f5c7aSCorentin Chary vnc_jpeg=no 17682f6f5c7aSCorentin Chary fi 17692f6f5c7aSCorentin Charyfi 17702f6f5c7aSCorentin Chary 17712f6f5c7aSCorentin Chary########################################## 1772efe556adSCorentin Chary# VNC PNG detection 1773821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then 1774efe556adSCorentin Charycat > $TMPC <<EOF 1775efe556adSCorentin Chary//#include <stdio.h> 1776efe556adSCorentin Chary#include <png.h> 1777832ce9c2SScott Wood#include <stddef.h> 1778efe556adSCorentin Charyint main(void) { 1779efe556adSCorentin Chary png_structp png_ptr; 1780efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 17817edc3fedSPeter Maydell return png_ptr != 0; 1782efe556adSCorentin Chary} 1783efe556adSCorentin CharyEOF 17849af8025eSBrad if $pkg_config libpng --modversion >/dev/null 2>&1; then 17859af8025eSBrad vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null` 17869af8025eSBrad vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null` 17879af8025eSBrad else 1788efe556adSCorentin Chary vnc_png_cflags="" 1789efe556adSCorentin Chary vnc_png_libs="-lpng" 17909af8025eSBrad fi 1791efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 1792efe556adSCorentin Chary vnc_png=yes 1793efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 17949af8025eSBrad QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" 1795efe556adSCorentin Chary else 1796efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 1797efe556adSCorentin Chary feature_not_found "vnc-png" 1798efe556adSCorentin Chary fi 1799efe556adSCorentin Chary vnc_png=no 1800efe556adSCorentin Chary fi 1801efe556adSCorentin Charyfi 1802efe556adSCorentin Chary 1803efe556adSCorentin Chary########################################## 180476655d6dSaliguori# fnmatch() probe, used for ACL routines 180576655d6dSaliguorifnmatch="no" 180676655d6dSaliguoricat > $TMPC << EOF 180776655d6dSaliguori#include <fnmatch.h> 180876655d6dSaliguoriint main(void) 180976655d6dSaliguori{ 181076655d6dSaliguori fnmatch("foo", "foo", 0); 181176655d6dSaliguori return 0; 181276655d6dSaliguori} 181376655d6dSaliguoriEOF 181452166aa0SJuan Quintelaif compile_prog "" "" ; then 181576655d6dSaliguori fnmatch="yes" 181676655d6dSaliguorifi 181776655d6dSaliguori 181876655d6dSaliguori########################################## 1819ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 1820ee682d27SStefan Weilif test "$uuid" != "no" ; then 1821ee682d27SStefan Weil uuid_libs="-luuid" 1822ee682d27SStefan Weil cat > $TMPC << EOF 1823ee682d27SStefan Weil#include <uuid/uuid.h> 1824ee682d27SStefan Weilint main(void) 1825ee682d27SStefan Weil{ 1826ee682d27SStefan Weil uuid_t my_uuid; 1827ee682d27SStefan Weil uuid_generate(my_uuid); 1828ee682d27SStefan Weil return 0; 1829ee682d27SStefan Weil} 1830ee682d27SStefan WeilEOF 1831ee682d27SStefan Weil if compile_prog "" "$uuid_libs" ; then 1832ee682d27SStefan Weil uuid="yes" 1833ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1834ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1835ee682d27SStefan Weil else 1836ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1837ee682d27SStefan Weil feature_not_found "uuid" 1838ee682d27SStefan Weil fi 1839ee682d27SStefan Weil uuid=no 1840ee682d27SStefan Weil fi 1841ee682d27SStefan Weilfi 1842ee682d27SStefan Weil 1843ee682d27SStefan Weil########################################## 1844dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix 1845dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 1846dce512deSChristoph Hellwig cat > $TMPC << EOF 1847ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 1848dce512deSChristoph Hellwig#include <xfs/xfs.h> 1849dce512deSChristoph Hellwigint main(void) 1850dce512deSChristoph Hellwig{ 1851dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 1852dce512deSChristoph Hellwig return 0; 1853dce512deSChristoph Hellwig} 1854dce512deSChristoph HellwigEOF 1855dce512deSChristoph Hellwig if compile_prog "" "" ; then 1856dce512deSChristoph Hellwig xfs="yes" 1857dce512deSChristoph Hellwig else 1858dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 1859dce512deSChristoph Hellwig feature_not_found "xfs" 1860dce512deSChristoph Hellwig fi 1861dce512deSChristoph Hellwig xfs=no 1862dce512deSChristoph Hellwig fi 1863dce512deSChristoph Hellwigfi 1864dce512deSChristoph Hellwig 1865dce512deSChristoph Hellwig########################################## 18668a16d273Sths# vde libraries probe 1867dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 18684baae0acSJuan Quintela vde_libs="-lvdeplug" 18698a16d273Sths cat > $TMPC << EOF 18708a16d273Sths#include <libvdeplug.h> 18714a7f0e06Spbrookint main(void) 18724a7f0e06Spbrook{ 18734a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 1874fea08e08SPeter Maydell char s[] = ""; 1875fea08e08SPeter Maydell vde_open(s, s, &a); 18764a7f0e06Spbrook return 0; 18774a7f0e06Spbrook} 18788a16d273SthsEOF 187952166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 18804baae0acSJuan Quintela vde=yes 18818e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 18828e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 1883dfb278bdSJuan Quintela else 1884dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 1885dfb278bdSJuan Quintela feature_not_found "vde" 1886dfb278bdSJuan Quintela fi 1887dfb278bdSJuan Quintela vde=no 18888a16d273Sths fi 18898a16d273Sthsfi 18908a16d273Sths 18918a16d273Sths########################################## 189247e98658SCorey Bryant# libcap-ng library probe 189347e98658SCorey Bryantif test "$cap_ng" != "no" ; then 189447e98658SCorey Bryant cap_libs="-lcap-ng" 189547e98658SCorey Bryant cat > $TMPC << EOF 189647e98658SCorey Bryant#include <cap-ng.h> 189747e98658SCorey Bryantint main(void) 189847e98658SCorey Bryant{ 189947e98658SCorey Bryant capng_capability_to_name(CAPNG_EFFECTIVE); 190047e98658SCorey Bryant return 0; 190147e98658SCorey Bryant} 190247e98658SCorey BryantEOF 190347e98658SCorey Bryant if compile_prog "" "$cap_libs" ; then 190447e98658SCorey Bryant cap_ng=yes 190547e98658SCorey Bryant libs_tools="$cap_libs $libs_tools" 190647e98658SCorey Bryant else 190747e98658SCorey Bryant if test "$cap_ng" = "yes" ; then 190847e98658SCorey Bryant feature_not_found "cap_ng" 190947e98658SCorey Bryant fi 191047e98658SCorey Bryant cap_ng=no 191147e98658SCorey Bryant fi 191247e98658SCorey Bryantfi 191347e98658SCorey Bryant 191447e98658SCorey Bryant########################################## 1915c2de5c91Smalc# Sound support libraries probe 19168f28f3fbSths 1917c2de5c91Smalcaudio_drv_probe() 1918c2de5c91Smalc{ 1919c2de5c91Smalc drv=$1 1920c2de5c91Smalc hdr=$2 1921c2de5c91Smalc lib=$3 1922c2de5c91Smalc exp=$4 1923c2de5c91Smalc cfl=$5 19248f28f3fbSths cat > $TMPC << EOF 1925c2de5c91Smalc#include <$hdr> 1926c2de5c91Smalcint main(void) { $exp } 19278f28f3fbSthsEOF 192852166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 19298f28f3fbSths : 19308f28f3fbSths else 19318f28f3fbSths echo 1932c2de5c91Smalc echo "Error: $drv check failed" 1933c2de5c91Smalc echo "Make sure to have the $drv libs and headers installed." 19348f28f3fbSths echo 19358f28f3fbSths exit 1 19368f28f3fbSths fi 1937c2de5c91Smalc} 1938c2de5c91Smalc 19392fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 1940c2de5c91Smalcfor drv in $audio_drv_list; do 1941c2de5c91Smalc case $drv in 1942c2de5c91Smalc alsa) 1943c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 1944e35bcb0cSStefan Weil "return snd_pcm_close((snd_pcm_t *)0);" 1945a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 1946c2de5c91Smalc ;; 1947c2de5c91Smalc 1948c2de5c91Smalc fmod) 1949c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 1950c2de5c91Smalc echo 1951c2de5c91Smalc echo "Error: You must specify path to FMOD library and headers" 1952c2de5c91Smalc echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 1953c2de5c91Smalc echo 1954c2de5c91Smalc exit 1 19558f28f3fbSths fi 1956c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 1957a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 1958c2de5c91Smalc ;; 1959c2de5c91Smalc 1960c2de5c91Smalc esd) 1961c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 1962a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 196367f86e8eSJuan Quintela audio_pt_int="yes" 1964c2de5c91Smalc ;; 1965b8e59f18Smalc 1966b8e59f18Smalc pa) 1967a394aed2SMarc-André Lureau audio_drv_probe $drv pulse/mainloop.h "-lpulse" \ 1968a394aed2SMarc-André Lureau "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;" 1969a394aed2SMarc-André Lureau libs_softmmu="-lpulse $libs_softmmu" 197067f86e8eSJuan Quintela audio_pt_int="yes" 1971b8e59f18Smalc ;; 1972b8e59f18Smalc 1973997e690aSJuan Quintela coreaudio) 1974997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 1975997e690aSJuan Quintela ;; 1976997e690aSJuan Quintela 1977a4bf6780SJuan Quintela dsound) 1978a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 1979d5631638Smalc audio_win_int="yes" 1980a4bf6780SJuan Quintela ;; 1981a4bf6780SJuan Quintela 1982a4bf6780SJuan Quintela oss) 1983a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 1984a4bf6780SJuan Quintela ;; 1985a4bf6780SJuan Quintela 1986a4bf6780SJuan Quintela sdl|wav) 19872f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 19882f6a1ab0Sblueswir1 ;; 19892f6a1ab0Sblueswir1 1990d5631638Smalc winwave) 1991d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 1992d5631638Smalc audio_win_int="yes" 1993d5631638Smalc ;; 1994d5631638Smalc 1995e4c63a6aSmalc *) 19961c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 1997e4c63a6aSmalc echo 1998e4c63a6aSmalc echo "Error: Unknown driver '$drv' selected" 1999e4c63a6aSmalc echo "Possible drivers are: $audio_possible_drivers" 2000e4c63a6aSmalc echo 2001e4c63a6aSmalc exit 1 2002e4c63a6aSmalc } 2003e4c63a6aSmalc ;; 2004c2de5c91Smalc esac 2005c2de5c91Smalcdone 20068f28f3fbSths 20074d3b6f6eSbalrog########################################## 20082e4d9fb1Saurel32# BrlAPI probe 20092e4d9fb1Saurel32 20104ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 2011eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 20122e4d9fb1Saurel32 cat > $TMPC << EOF 20132e4d9fb1Saurel32#include <brlapi.h> 2014832ce9c2SScott Wood#include <stddef.h> 20152e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 20162e4d9fb1Saurel32EOF 201752166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 20182e4d9fb1Saurel32 brlapi=yes 2019264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 20204ffcedb6SJuan Quintela else 20214ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 20224ffcedb6SJuan Quintela feature_not_found "brlapi" 20234ffcedb6SJuan Quintela fi 20244ffcedb6SJuan Quintela brlapi=no 2025eb82284fSJuan Quintela fi 2026eb82284fSJuan Quintelafi 20272e4d9fb1Saurel32 20282e4d9fb1Saurel32########################################## 20294d3b6f6eSbalrog# curses probe 2030e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then 2031e095e2f3SStefan Weil curses_list="-lpdcurses" 2032e095e2f3SStefan Weilelse 20334f78ef9aSJuan Quintela curses_list="-lncurses -lcurses" 2034e095e2f3SStefan Weilfi 20354d3b6f6eSbalrog 2036c584a6d0SJuan Quintelaif test "$curses" != "no" ; then 2037c584a6d0SJuan Quintela curses_found=no 20384d3b6f6eSbalrog cat > $TMPC << EOF 20394d3b6f6eSbalrog#include <curses.h> 2040ef9a2524SStefan Weilint main(void) { 2041ef9a2524SStefan Weil const char *s = curses_version(); 2042ef9a2524SStefan Weil resize_term(0, 0); 2043ef9a2524SStefan Weil return s != 0; 2044ef9a2524SStefan Weil} 20454d3b6f6eSbalrogEOF 20464f78ef9aSJuan Quintela for curses_lib in $curses_list; do 20474f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 2048c584a6d0SJuan Quintela curses_found=yes 20494f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 20504f78ef9aSJuan Quintela break 20514d3b6f6eSbalrog fi 20524f78ef9aSJuan Quintela done 2053c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 2054c584a6d0SJuan Quintela curses=yes 2055c584a6d0SJuan Quintela else 2056c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 2057c584a6d0SJuan Quintela feature_not_found "curses" 2058c584a6d0SJuan Quintela fi 2059c584a6d0SJuan Quintela curses=no 2060c584a6d0SJuan Quintela fi 20614f78ef9aSJuan Quintelafi 20624d3b6f6eSbalrog 2063414f0dabSblueswir1########################################## 2064769ce76dSAlexander Graf# curl probe 2065769ce76dSAlexander Graf 2066a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then 2067a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 20684e2b0658SPaolo Bonzinielse 20694e2b0658SPaolo Bonzini curlconfig=curl-config 20704e2b0658SPaolo Bonzinifi 20714e2b0658SPaolo Bonzini 2072788c8196SJuan Quintelaif test "$curl" != "no" ; then 2073769ce76dSAlexander Graf cat > $TMPC << EOF 2074769ce76dSAlexander Graf#include <curl/curl.h> 20750b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 2076769ce76dSAlexander GrafEOF 20774e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 20784e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 2079b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 2080769ce76dSAlexander Graf curl=yes 2081f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 2082f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 2083788c8196SJuan Quintela else 2084788c8196SJuan Quintela if test "$curl" = "yes" ; then 2085788c8196SJuan Quintela feature_not_found "curl" 2086788c8196SJuan Quintela fi 2087788c8196SJuan Quintela curl=no 2088769ce76dSAlexander Graf fi 2089769ce76dSAlexander Graffi # test "$curl" 2090769ce76dSAlexander Graf 2091769ce76dSAlexander Graf########################################## 2092fb599c9aSbalrog# bluez support probe 2093a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 2094e820e3f4Sbalrog cat > $TMPC << EOF 2095e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 2096e820e3f4Sbalrogint main(void) { return bt_error(0); } 2097e820e3f4SbalrogEOF 2098a8bd70adSPaolo Bonzini bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` 2099a8bd70adSPaolo Bonzini bluez_libs=`$pkg_config --libs bluez 2> /dev/null` 210052166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 2101a20a6f46SJuan Quintela bluez=yes 2102e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 2103e820e3f4Sbalrog else 2104a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 2105a20a6f46SJuan Quintela feature_not_found "bluez" 2106a20a6f46SJuan Quintela fi 2107e820e3f4Sbalrog bluez="no" 2108e820e3f4Sbalrog fi 2109fb599c9aSbalrogfi 2110fb599c9aSbalrog 2111fb599c9aSbalrog########################################## 2112e18df141SAnthony Liguori# glib support probe 2113a52d28afSPaolo Bonzini 2114a52d28afSPaolo Bonziniif test "$mingw32" = yes; then 2115a52d28afSPaolo Bonzini # g_poll is required in order to integrate with the glib main loop. 2116a52d28afSPaolo Bonzini glib_req_ver=2.20 2117a52d28afSPaolo Bonzinielse 2118a52d28afSPaolo Bonzini glib_req_ver=2.12 2119a52d28afSPaolo Bonzinifi 2120a52d28afSPaolo Bonziniif $pkg_config --atleast-version=$glib_req_ver gthread-2.0 > /dev/null 2>&1 2121a52d28afSPaolo Bonzinithen 21224b76a481SStefan Hajnoczi glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null` 21234b76a481SStefan Hajnoczi glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null` 212414015304SAnthony Liguori LIBS="$glib_libs $LIBS" 2125957f1f99SMichael Roth libs_qga="$glib_libs $libs_qga" 2126e18df141SAnthony Liguorielse 2127a52d28afSPaolo Bonzini echo "glib-$glib_req_ver required to compile QEMU" 2128e18df141SAnthony Liguori exit 1 2129e18df141SAnthony Liguorifi 2130e18df141SAnthony Liguori 2131e18df141SAnthony Liguori########################################## 2132e2134eb9SGerd Hoffmann# pixman support probe 2133e2134eb9SGerd Hoffmann 2134e2134eb9SGerd Hoffmannif test "$pixman" = ""; then 213574880fe2SRobert Schiele if test "$want_tools" = "no" -a "$softmmu" = "no"; then 213674880fe2SRobert Schiele pixman="none" 213774880fe2SRobert Schiele elif $pkg_config pixman-1 > /dev/null 2>&1; then 2138e2134eb9SGerd Hoffmann pixman="system" 2139e2134eb9SGerd Hoffmann else 2140e2134eb9SGerd Hoffmann pixman="internal" 2141e2134eb9SGerd Hoffmann fi 2142e2134eb9SGerd Hoffmannfi 214374880fe2SRobert Schieleif test "$pixman" = "none"; then 214474880fe2SRobert Schiele if test "$want_tools" != "no" -o "$softmmu" != "no"; then 214574880fe2SRobert Schiele echo "ERROR: pixman disabled but system emulation or tools build" 214674880fe2SRobert Schiele echo " enabled. You can turn off pixman only if you also" 214774880fe2SRobert Schiele echo " disable all system emulation targets and the tools" 214874880fe2SRobert Schiele echo " build with '--disable-tools --disable-system'." 214974880fe2SRobert Schiele exit 1 215074880fe2SRobert Schiele fi 215174880fe2SRobert Schiele pixman_cflags= 215274880fe2SRobert Schiele pixman_libs= 215374880fe2SRobert Schieleelif test "$pixman" = "system"; then 2154e2134eb9SGerd Hoffmann pixman_cflags=`$pkg_config --cflags pixman-1 2>/dev/null` 2155e2134eb9SGerd Hoffmann pixman_libs=`$pkg_config --libs pixman-1 2>/dev/null` 2156e2134eb9SGerd Hoffmannelse 2157e2134eb9SGerd Hoffmann if test ! -d ${source_path}/pixman/pixman; then 2158cb1d40d7SGerd Hoffmann echo "ERROR: pixman not present. Your options:" 2159eac29d87SStefan Weil echo " (1) Preferred: Install the pixman devel package (any recent" 2160e2134eb9SGerd Hoffmann echo " distro should have packages as Xorg needs pixman too)." 2161e2134eb9SGerd Hoffmann echo " (2) Fetch the pixman submodule, using:" 2162e2134eb9SGerd Hoffmann echo " git submodule update --init pixman" 2163e2134eb9SGerd Hoffmann exit 1 2164e2134eb9SGerd Hoffmann fi 21655ca9388aSGerd Hoffmann mkdir -p pixman/pixman 21665ca9388aSGerd Hoffmann pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman" 21675ca9388aSGerd Hoffmann pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1" 2168e2134eb9SGerd Hoffmannfi 2169e2134eb9SGerd Hoffmann 2170e2134eb9SGerd Hoffmann########################################## 217117bff52bSM. Mohan Kumar# libcap probe 217217bff52bSM. Mohan Kumar 217317bff52bSM. Mohan Kumarif test "$cap" != "no" ; then 217417bff52bSM. Mohan Kumar cat > $TMPC <<EOF 217517bff52bSM. Mohan Kumar#include <stdio.h> 217617bff52bSM. Mohan Kumar#include <sys/capability.h> 2177cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; } 217817bff52bSM. Mohan KumarEOF 217917bff52bSM. Mohan Kumar if compile_prog "" "-lcap" ; then 218017bff52bSM. Mohan Kumar cap=yes 218117bff52bSM. Mohan Kumar else 218217bff52bSM. Mohan Kumar cap=no 218317bff52bSM. Mohan Kumar fi 218417bff52bSM. Mohan Kumarfi 218517bff52bSM. Mohan Kumar 218617bff52bSM. Mohan Kumar########################################## 2187e5d355d1Saliguori# pthread probe 21884b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 21893c529d93Saliguori 2190e5d355d1Saliguoripthread=no 2191414f0dabSblueswir1cat > $TMPC << EOF 21923c529d93Saliguori#include <pthread.h> 21937a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 21947a42bbe4SStefan Weilint main(void) { 21957a42bbe4SStefan Weil pthread_t thread; 21967a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 21977a42bbe4SStefan Weil return 0; 21987a42bbe4SStefan Weil} 2199414f0dabSblueswir1EOF 2200bd00d539SAndreas Färberif compile_prog "" "" ; then 2201bd00d539SAndreas Färber pthread=yes 2202bd00d539SAndreas Färberelse 2203de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 220452166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 2205e5d355d1Saliguori pthread=yes 2206e3c56761SPeter Portante found=no 2207e3c56761SPeter Portante for lib_entry in $LIBS; do 2208e3c56761SPeter Portante if test "$lib_entry" = "$pthread_lib"; then 2209e3c56761SPeter Portante found=yes 2210e3c56761SPeter Portante break 2211e3c56761SPeter Portante fi 2212e3c56761SPeter Portante done 2213e3c56761SPeter Portante if test "$found" = "no"; then 22145572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 2215e3c56761SPeter Portante fi 2216de65fe0fSSebastian Herbszt break 2217414f0dabSblueswir1 fi 2218de65fe0fSSebastian Herbszt done 2219bd00d539SAndreas Färberfi 2220414f0dabSblueswir1 22214617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 22224dd75c70SChristoph Hellwig echo 22234dd75c70SChristoph Hellwig echo "Error: pthread check failed" 22244dd75c70SChristoph Hellwig echo "Make sure to have the pthread libs and headers installed." 22254dd75c70SChristoph Hellwig echo 22264dd75c70SChristoph Hellwig exit 1 2227e5d355d1Saliguorifi 2228e5d355d1Saliguori 2229bf9298b9Saliguori########################################## 2230f27aaf4bSChristian Brunner# rbd probe 2231f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 2232f27aaf4bSChristian Brunner cat > $TMPC <<EOF 2233f27aaf4bSChristian Brunner#include <stdio.h> 2234ad32e9c0SJosh Durgin#include <rbd/librbd.h> 2235f27aaf4bSChristian Brunnerint main(void) { 2236ad32e9c0SJosh Durgin rados_t cluster; 2237ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 2238f27aaf4bSChristian Brunner return 0; 2239f27aaf4bSChristian Brunner} 2240f27aaf4bSChristian BrunnerEOF 2241ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 2242f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 2243f27aaf4bSChristian Brunner rbd=yes 2244f27aaf4bSChristian Brunner libs_tools="$rbd_libs $libs_tools" 2245f27aaf4bSChristian Brunner libs_softmmu="$rbd_libs $libs_softmmu" 2246f27aaf4bSChristian Brunner else 2247f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 2248f27aaf4bSChristian Brunner feature_not_found "rados block device" 2249f27aaf4bSChristian Brunner fi 2250f27aaf4bSChristian Brunner rbd=no 2251f27aaf4bSChristian Brunner fi 2252f27aaf4bSChristian Brunnerfi 2253f27aaf4bSChristian Brunner 2254f27aaf4bSChristian Brunner########################################## 22555c6c3a6cSChristoph Hellwig# linux-aio probe 22565c6c3a6cSChristoph Hellwig 22575c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 22585c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 22595c6c3a6cSChristoph Hellwig#include <libaio.h> 22605c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 2261832ce9c2SScott Wood#include <stddef.h> 22625c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 22635c6c3a6cSChristoph HellwigEOF 22645c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 22655c6c3a6cSChristoph Hellwig linux_aio=yes 2266048d179fSPaul Brook libs_softmmu="$libs_softmmu -laio" 2267048d179fSPaul Brook libs_tools="$libs_tools -laio" 22685c6c3a6cSChristoph Hellwig else 22695c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 22705c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 22715c6c3a6cSChristoph Hellwig fi 22723cfcae3cSLuiz Capitulino linux_aio=no 22735c6c3a6cSChristoph Hellwig fi 22745c6c3a6cSChristoph Hellwigfi 22755c6c3a6cSChristoph Hellwig 22765c6c3a6cSChristoph Hellwig########################################## 2277758e8e38SVenkateswararao Jujjuri (JV)# attr probe 2278758e8e38SVenkateswararao Jujjuri (JV) 2279758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 2280758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 2281758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 2282758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 2283f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 2284f2338fb4SPavel Borzenkov#include <attr/xattr.h> 2285f2338fb4SPavel Borzenkov#else 22864f26f2b6SAvi Kivity#include <sys/xattr.h> 2287f2338fb4SPavel Borzenkov#endif 2288758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 2289758e8e38SVenkateswararao Jujjuri (JV)EOF 22904f26f2b6SAvi Kivity if compile_prog "" "" ; then 22914f26f2b6SAvi Kivity attr=yes 22924f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 2293f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 2294758e8e38SVenkateswararao Jujjuri (JV) attr=yes 2295758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 22964f26f2b6SAvi Kivity libattr=yes 2297758e8e38SVenkateswararao Jujjuri (JV) else 2298758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 2299758e8e38SVenkateswararao Jujjuri (JV) feature_not_found "ATTR" 2300758e8e38SVenkateswararao Jujjuri (JV) fi 2301758e8e38SVenkateswararao Jujjuri (JV) attr=no 2302758e8e38SVenkateswararao Jujjuri (JV) fi 2303758e8e38SVenkateswararao Jujjuri (JV)fi 2304758e8e38SVenkateswararao Jujjuri (JV) 2305758e8e38SVenkateswararao Jujjuri (JV)########################################## 2306bf9298b9Saliguori# iovec probe 2307bf9298b9Saliguoricat > $TMPC <<EOF 2308db34f0b3Sblueswir1#include <sys/types.h> 2309bf9298b9Saliguori#include <sys/uio.h> 2310db34f0b3Sblueswir1#include <unistd.h> 2311f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 2312bf9298b9SaliguoriEOF 2313bf9298b9Saliguoriiovec=no 231452166aa0SJuan Quintelaif compile_prog "" "" ; then 2315bf9298b9Saliguori iovec=yes 2316bf9298b9Saliguorifi 2317bf9298b9Saliguori 2318f652e6afSaurel32########################################## 2319ceb42de8Saliguori# preadv probe 2320ceb42de8Saliguoricat > $TMPC <<EOF 2321ceb42de8Saliguori#include <sys/types.h> 2322ceb42de8Saliguori#include <sys/uio.h> 2323ceb42de8Saliguori#include <unistd.h> 2324c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); } 2325ceb42de8SaliguoriEOF 2326ceb42de8Saliguoripreadv=no 232752166aa0SJuan Quintelaif compile_prog "" "" ; then 2328ceb42de8Saliguori preadv=yes 2329ceb42de8Saliguorifi 2330ceb42de8Saliguori 2331ceb42de8Saliguori########################################## 2332f652e6afSaurel32# fdt probe 23332df87df7SJuan Quintelaif test "$fdt" != "no" ; then 2334b41af4baSJuan Quintela fdt_libs="-lfdt" 2335f652e6afSaurel32 cat > $TMPC << EOF 2336f652e6afSaurel32int main(void) { return 0; } 2337f652e6afSaurel32EOF 233852166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 2339f652e6afSaurel32 fdt=yes 23402df87df7SJuan Quintela else 23412df87df7SJuan Quintela if test "$fdt" = "yes" ; then 23422df87df7SJuan Quintela feature_not_found "fdt" 23432df87df7SJuan Quintela fi 2344de3a354aSMichael Walle fdt_libs= 23452df87df7SJuan Quintela fdt=no 2346f652e6afSaurel32 fi 2347f652e6afSaurel32fi 2348f652e6afSaurel32 234920ff075bSMichael Walle########################################## 235020ff075bSMichael Walle# opengl probe, used by milkymist-tmu2 235120ff075bSMichael Walleif test "$opengl" != "no" ; then 235220ff075bSMichael Walle opengl_libs="-lGL" 235320ff075bSMichael Walle cat > $TMPC << EOF 235420ff075bSMichael Walle#include <X11/Xlib.h> 235520ff075bSMichael Walle#include <GL/gl.h> 235620ff075bSMichael Walle#include <GL/glx.h> 235784972cbbSStefan Weilint main(void) { return GL_VERSION != 0; } 235820ff075bSMichael WalleEOF 235920ff075bSMichael Walle if compile_prog "" "-lGL" ; then 236020ff075bSMichael Walle opengl=yes 236120ff075bSMichael Walle else 236220ff075bSMichael Walle if test "$opengl" = "yes" ; then 236320ff075bSMichael Walle feature_not_found "opengl" 236420ff075bSMichael Walle fi 2365de3a354aSMichael Walle opengl_libs= 236620ff075bSMichael Walle opengl=no 236720ff075bSMichael Walle fi 236820ff075bSMichael Wallefi 236920ff075bSMichael Walle 2370eb100396SBharata B Rao########################################## 2371eb100396SBharata B Rao# glusterfs probe 2372eb100396SBharata B Raoif test "$glusterfs" != "no" ; then 2373eb100396SBharata B Rao cat > $TMPC <<EOF 2374eb100396SBharata B Rao#include <glusterfs/api/glfs.h> 2375eb100396SBharata B Raoint main(void) { 2376eb100396SBharata B Rao (void) glfs_new("volume"); 2377eb100396SBharata B Rao return 0; 2378eb100396SBharata B Rao} 2379eb100396SBharata B RaoEOF 2380eb100396SBharata B Rao glusterfs_libs="-lgfapi -lgfrpc -lgfxdr" 2381eb100396SBharata B Rao if compile_prog "" "$glusterfs_libs" ; then 2382eb100396SBharata B Rao glusterfs=yes 2383eb100396SBharata B Rao libs_tools="$glusterfs_libs $libs_tools" 2384eb100396SBharata B Rao libs_softmmu="$glusterfs_libs $libs_softmmu" 2385eb100396SBharata B Rao else 2386eb100396SBharata B Rao if test "$glusterfs" = "yes" ; then 2387eb100396SBharata B Rao feature_not_found "GlusterFS backend support" 2388eb100396SBharata B Rao fi 2389eb100396SBharata B Rao glusterfs=no 2390eb100396SBharata B Rao fi 2391eb100396SBharata B Raofi 2392eb100396SBharata B Rao 23933b3f24adSaurel32# 23943b3f24adSaurel32# Check for xxxat() functions when we are building linux-user 23953b3f24adSaurel32# emulator. This is done because older glibc versions don't 23963b3f24adSaurel32# have syscall stubs for these implemented. 23973b3f24adSaurel32# 23983b3f24adSaurel32atfile=no 23993b3f24adSaurel32cat > $TMPC << EOF 24003b3f24adSaurel32#define _ATFILE_SOURCE 24013b3f24adSaurel32#include <sys/types.h> 24023b3f24adSaurel32#include <fcntl.h> 24033b3f24adSaurel32#include <unistd.h> 24043b3f24adSaurel32 24053b3f24adSaurel32int 24063b3f24adSaurel32main(void) 24073b3f24adSaurel32{ 24083b3f24adSaurel32 /* try to unlink nonexisting file */ 24093b3f24adSaurel32 return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); 24103b3f24adSaurel32} 24113b3f24adSaurel32EOF 241252166aa0SJuan Quintelaif compile_prog "" "" ; then 24133b3f24adSaurel32 atfile=yes 24143b3f24adSaurel32fi 24153b3f24adSaurel32 241639386ac7Saurel32# Check for inotify functions when we are building linux-user 24173b3f24adSaurel32# emulator. This is done because older glibc versions don't 24183b3f24adSaurel32# have syscall stubs for these implemented. In that case we 24193b3f24adSaurel32# don't provide them even if kernel supports them. 24203b3f24adSaurel32# 24213b3f24adSaurel32inotify=no 24223b3f24adSaurel32cat > $TMPC << EOF 24233b3f24adSaurel32#include <sys/inotify.h> 24243b3f24adSaurel32 24253b3f24adSaurel32int 24263b3f24adSaurel32main(void) 24273b3f24adSaurel32{ 24283b3f24adSaurel32 /* try to start inotify */ 24298690e420Saurel32 return inotify_init(); 24303b3f24adSaurel32} 24313b3f24adSaurel32EOF 243252166aa0SJuan Quintelaif compile_prog "" "" ; then 24333b3f24adSaurel32 inotify=yes 24343b3f24adSaurel32fi 24353b3f24adSaurel32 2436c05c7a73SRiku Voipioinotify1=no 2437c05c7a73SRiku Voipiocat > $TMPC << EOF 2438c05c7a73SRiku Voipio#include <sys/inotify.h> 2439c05c7a73SRiku Voipio 2440c05c7a73SRiku Voipioint 2441c05c7a73SRiku Voipiomain(void) 2442c05c7a73SRiku Voipio{ 2443c05c7a73SRiku Voipio /* try to start inotify */ 2444c05c7a73SRiku Voipio return inotify_init1(0); 2445c05c7a73SRiku Voipio} 2446c05c7a73SRiku VoipioEOF 2447c05c7a73SRiku Voipioif compile_prog "" "" ; then 2448c05c7a73SRiku Voipio inotify1=yes 2449c05c7a73SRiku Voipiofi 2450c05c7a73SRiku Voipio 2451ebc996f3SRiku Voipio# check if utimensat and futimens are supported 2452ebc996f3SRiku Voipioutimens=no 2453ebc996f3SRiku Voipiocat > $TMPC << EOF 2454ebc996f3SRiku Voipio#define _ATFILE_SOURCE 2455ebc996f3SRiku Voipio#include <stddef.h> 2456ebc996f3SRiku Voipio#include <fcntl.h> 24573014ee00SPeter Maydell#include <sys/stat.h> 2458ebc996f3SRiku Voipio 2459ebc996f3SRiku Voipioint main(void) 2460ebc996f3SRiku Voipio{ 2461ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 2462ebc996f3SRiku Voipio futimens(0, NULL); 2463ebc996f3SRiku Voipio return 0; 2464ebc996f3SRiku Voipio} 2465ebc996f3SRiku VoipioEOF 246652166aa0SJuan Quintelaif compile_prog "" "" ; then 2467ebc996f3SRiku Voipio utimens=yes 2468ebc996f3SRiku Voipiofi 2469ebc996f3SRiku Voipio 2470099d6b0fSRiku Voipio# check if pipe2 is there 2471099d6b0fSRiku Voipiopipe2=no 2472099d6b0fSRiku Voipiocat > $TMPC << EOF 2473099d6b0fSRiku Voipio#include <unistd.h> 2474099d6b0fSRiku Voipio#include <fcntl.h> 2475099d6b0fSRiku Voipio 2476099d6b0fSRiku Voipioint main(void) 2477099d6b0fSRiku Voipio{ 2478099d6b0fSRiku Voipio int pipefd[2]; 24799bca8162SBruce Rogers return pipe2(pipefd, O_CLOEXEC); 2480099d6b0fSRiku Voipio} 2481099d6b0fSRiku VoipioEOF 248252166aa0SJuan Quintelaif compile_prog "" "" ; then 2483099d6b0fSRiku Voipio pipe2=yes 2484099d6b0fSRiku Voipiofi 2485099d6b0fSRiku Voipio 248640ff6d7eSKevin Wolf# check if accept4 is there 248740ff6d7eSKevin Wolfaccept4=no 248840ff6d7eSKevin Wolfcat > $TMPC << EOF 248940ff6d7eSKevin Wolf#include <sys/socket.h> 249040ff6d7eSKevin Wolf#include <stddef.h> 249140ff6d7eSKevin Wolf 249240ff6d7eSKevin Wolfint main(void) 249340ff6d7eSKevin Wolf{ 249440ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 249540ff6d7eSKevin Wolf return 0; 249640ff6d7eSKevin Wolf} 249740ff6d7eSKevin WolfEOF 249840ff6d7eSKevin Wolfif compile_prog "" "" ; then 249940ff6d7eSKevin Wolf accept4=yes 250040ff6d7eSKevin Wolffi 250140ff6d7eSKevin Wolf 25023ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 25033ce34dfbSvibisreenivasansplice=no 25043ce34dfbSvibisreenivasancat > $TMPC << EOF 25053ce34dfbSvibisreenivasan#include <unistd.h> 25063ce34dfbSvibisreenivasan#include <fcntl.h> 25073ce34dfbSvibisreenivasan#include <limits.h> 25083ce34dfbSvibisreenivasan 25093ce34dfbSvibisreenivasanint main(void) 25103ce34dfbSvibisreenivasan{ 251166ea0f22SStefan Weil int len, fd = 0; 25123ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 25133ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 25143ce34dfbSvibisreenivasan return 0; 25153ce34dfbSvibisreenivasan} 25163ce34dfbSvibisreenivasanEOF 251752166aa0SJuan Quintelaif compile_prog "" "" ; then 25183ce34dfbSvibisreenivasan splice=yes 25193ce34dfbSvibisreenivasanfi 25203ce34dfbSvibisreenivasan 2521dcc38d1cSMarcelo Tosatti########################################## 2522dcc38d1cSMarcelo Tosatti# signalfd probe 2523dcc38d1cSMarcelo Tosattisignalfd="no" 2524dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 2525dcc38d1cSMarcelo Tosatti#include <unistd.h> 2526dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 2527dcc38d1cSMarcelo Tosatti#include <signal.h> 2528dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 2529dcc38d1cSMarcelo TosattiEOF 2530dcc38d1cSMarcelo Tosatti 2531dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 2532dcc38d1cSMarcelo Tosatti signalfd=yes 2533dcc38d1cSMarcelo Tosattifi 2534dcc38d1cSMarcelo Tosatti 2535c2882b96SRiku Voipio# check if eventfd is supported 2536c2882b96SRiku Voipioeventfd=no 2537c2882b96SRiku Voipiocat > $TMPC << EOF 2538c2882b96SRiku Voipio#include <sys/eventfd.h> 2539c2882b96SRiku Voipio 2540c2882b96SRiku Voipioint main(void) 2541c2882b96SRiku Voipio{ 254255cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 2543c2882b96SRiku Voipio} 2544c2882b96SRiku VoipioEOF 2545c2882b96SRiku Voipioif compile_prog "" "" ; then 2546c2882b96SRiku Voipio eventfd=yes 2547c2882b96SRiku Voipiofi 2548c2882b96SRiku Voipio 2549d0927938SUlrich Hecht# check for fallocate 2550d0927938SUlrich Hechtfallocate=no 2551d0927938SUlrich Hechtcat > $TMPC << EOF 2552d0927938SUlrich Hecht#include <fcntl.h> 2553d0927938SUlrich Hecht 2554d0927938SUlrich Hechtint main(void) 2555d0927938SUlrich Hecht{ 2556d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 2557d0927938SUlrich Hecht return 0; 2558d0927938SUlrich Hecht} 2559d0927938SUlrich HechtEOF 25608fb03151SPeter Maydellif compile_prog "" "" ; then 2561d0927938SUlrich Hecht fallocate=yes 2562d0927938SUlrich Hechtfi 2563d0927938SUlrich Hecht 2564c727f47dSPeter Maydell# check for sync_file_range 2565c727f47dSPeter Maydellsync_file_range=no 2566c727f47dSPeter Maydellcat > $TMPC << EOF 2567c727f47dSPeter Maydell#include <fcntl.h> 2568c727f47dSPeter Maydell 2569c727f47dSPeter Maydellint main(void) 2570c727f47dSPeter Maydell{ 2571c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 2572c727f47dSPeter Maydell return 0; 2573c727f47dSPeter Maydell} 2574c727f47dSPeter MaydellEOF 25758fb03151SPeter Maydellif compile_prog "" "" ; then 2576c727f47dSPeter Maydell sync_file_range=yes 2577c727f47dSPeter Maydellfi 2578c727f47dSPeter Maydell 2579dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 2580dace20dcSPeter Maydellfiemap=no 2581dace20dcSPeter Maydellcat > $TMPC << EOF 2582dace20dcSPeter Maydell#include <sys/ioctl.h> 2583dace20dcSPeter Maydell#include <linux/fs.h> 2584dace20dcSPeter Maydell#include <linux/fiemap.h> 2585dace20dcSPeter Maydell 2586dace20dcSPeter Maydellint main(void) 2587dace20dcSPeter Maydell{ 2588dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 2589dace20dcSPeter Maydell return 0; 2590dace20dcSPeter Maydell} 2591dace20dcSPeter MaydellEOF 25928fb03151SPeter Maydellif compile_prog "" "" ; then 2593dace20dcSPeter Maydell fiemap=yes 2594dace20dcSPeter Maydellfi 2595dace20dcSPeter Maydell 2596d0927938SUlrich Hecht# check for dup3 2597d0927938SUlrich Hechtdup3=no 2598d0927938SUlrich Hechtcat > $TMPC << EOF 2599d0927938SUlrich Hecht#include <unistd.h> 2600d0927938SUlrich Hecht 2601d0927938SUlrich Hechtint main(void) 2602d0927938SUlrich Hecht{ 2603d0927938SUlrich Hecht dup3(0, 0, 0); 2604d0927938SUlrich Hecht return 0; 2605d0927938SUlrich Hecht} 2606d0927938SUlrich HechtEOF 260778f5d726SJan Kiszkaif compile_prog "" "" ; then 2608d0927938SUlrich Hecht dup3=yes 2609d0927938SUlrich Hechtfi 2610d0927938SUlrich Hecht 26113b6edd16SPeter Maydell# check for epoll support 26123b6edd16SPeter Maydellepoll=no 26133b6edd16SPeter Maydellcat > $TMPC << EOF 26143b6edd16SPeter Maydell#include <sys/epoll.h> 26153b6edd16SPeter Maydell 26163b6edd16SPeter Maydellint main(void) 26173b6edd16SPeter Maydell{ 26183b6edd16SPeter Maydell epoll_create(0); 26193b6edd16SPeter Maydell return 0; 26203b6edd16SPeter Maydell} 26213b6edd16SPeter MaydellEOF 26228fb03151SPeter Maydellif compile_prog "" "" ; then 26233b6edd16SPeter Maydell epoll=yes 26243b6edd16SPeter Maydellfi 26253b6edd16SPeter Maydell 26263b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions 26273b6edd16SPeter Maydell# so we must check separately for their presence 26283b6edd16SPeter Maydellepoll_create1=no 26293b6edd16SPeter Maydellcat > $TMPC << EOF 26303b6edd16SPeter Maydell#include <sys/epoll.h> 26313b6edd16SPeter Maydell 26323b6edd16SPeter Maydellint main(void) 26333b6edd16SPeter Maydell{ 263419e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 263519e83f6bSPeter Maydell * a function being called. This is necessary so that on 263619e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 263719e83f6bSPeter Maydell * the library but not declared in the header file we will 263819e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 263919e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 264019e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 264119e83f6bSPeter Maydell */ 2642c075a723SBlue Swirl return (int)(uintptr_t)&epoll_create1; 26433b6edd16SPeter Maydell} 26443b6edd16SPeter MaydellEOF 26458fb03151SPeter Maydellif compile_prog "" "" ; then 26463b6edd16SPeter Maydell epoll_create1=yes 26473b6edd16SPeter Maydellfi 26483b6edd16SPeter Maydell 26493b6edd16SPeter Maydellepoll_pwait=no 26503b6edd16SPeter Maydellcat > $TMPC << EOF 26513b6edd16SPeter Maydell#include <sys/epoll.h> 26523b6edd16SPeter Maydell 26533b6edd16SPeter Maydellint main(void) 26543b6edd16SPeter Maydell{ 26553b6edd16SPeter Maydell epoll_pwait(0, 0, 0, 0, 0); 26563b6edd16SPeter Maydell return 0; 26573b6edd16SPeter Maydell} 26583b6edd16SPeter MaydellEOF 26598fb03151SPeter Maydellif compile_prog "" "" ; then 26603b6edd16SPeter Maydell epoll_pwait=yes 26613b6edd16SPeter Maydellfi 26623b6edd16SPeter Maydell 2663cc8ae6deSpbrook# Check if tools are available to build documentation. 2664a25dba17SJuan Quintelaif test "$docs" != "no" ; then 266501668d98SStefan Weil if has makeinfo && has pod2man; then 2666a25dba17SJuan Quintela docs=yes 266783a3ab8bSJuan Quintela else 2668a25dba17SJuan Quintela if test "$docs" = "yes" ; then 2669a25dba17SJuan Quintela feature_not_found "docs" 267083a3ab8bSJuan Quintela fi 2671a25dba17SJuan Quintela docs=no 267283a3ab8bSJuan Quintela fi 2673cc8ae6deSpbrookfi 2674cc8ae6deSpbrook 2675f514f41cSStefan Weil# Search for bswap_32 function 26766ae9a1f4SJuan Quintelabyteswap_h=no 26776ae9a1f4SJuan Quintelacat > $TMPC << EOF 26786ae9a1f4SJuan Quintela#include <byteswap.h> 26796ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 26806ae9a1f4SJuan QuintelaEOF 268152166aa0SJuan Quintelaif compile_prog "" "" ; then 26826ae9a1f4SJuan Quintela byteswap_h=yes 26836ae9a1f4SJuan Quintelafi 26846ae9a1f4SJuan Quintela 2685f514f41cSStefan Weil# Search for bswap_32 function 26866ae9a1f4SJuan Quintelabswap_h=no 26876ae9a1f4SJuan Quintelacat > $TMPC << EOF 26886ae9a1f4SJuan Quintela#include <sys/endian.h> 26896ae9a1f4SJuan Quintela#include <sys/types.h> 26906ae9a1f4SJuan Quintela#include <machine/bswap.h> 26916ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 26926ae9a1f4SJuan QuintelaEOF 269352166aa0SJuan Quintelaif compile_prog "" "" ; then 26946ae9a1f4SJuan Quintela bswap_h=yes 26956ae9a1f4SJuan Quintelafi 26966ae9a1f4SJuan Quintela 2697da93a1fdSaliguori########################################## 2698c589b249SRonnie Sahlberg# Do we have libiscsi 2699fa6acb0cSRonnie Sahlberg# We check for iscsi_unmap_sync() to make sure we have a 2700fa6acb0cSRonnie Sahlberg# recent enough version of libiscsi. 2701c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 2702c589b249SRonnie Sahlberg cat > $TMPC << EOF 2703fa6acb0cSRonnie Sahlberg#include <stdio.h> 2704c589b249SRonnie Sahlberg#include <iscsi/iscsi.h> 2705fa6acb0cSRonnie Sahlbergint main(void) { iscsi_unmap_sync(NULL,0,0,0,NULL,0); return 0; } 2706c589b249SRonnie SahlbergEOF 2707417c9d72SAlexander Graf if compile_prog "" "-liscsi" ; then 2708c589b249SRonnie Sahlberg libiscsi="yes" 2709c589b249SRonnie Sahlberg LIBS="$LIBS -liscsi" 2710c589b249SRonnie Sahlberg else 2711c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 2712c589b249SRonnie Sahlberg feature_not_found "libiscsi" 2713c589b249SRonnie Sahlberg fi 2714c589b249SRonnie Sahlberg libiscsi="no" 2715c589b249SRonnie Sahlberg fi 2716c589b249SRonnie Sahlbergfi 2717c589b249SRonnie Sahlberg 2718c589b249SRonnie Sahlberg 2719c589b249SRonnie Sahlberg########################################## 27208bacde8dSNatanael Copa# Do we need libm 27218bacde8dSNatanael Copacat > $TMPC << EOF 27228bacde8dSNatanael Copa#include <math.h> 27238bacde8dSNatanael Copaint main(void) { return isnan(sin(0.0)); } 27248bacde8dSNatanael CopaEOF 27258bacde8dSNatanael Copaif compile_prog "" "" ; then 27268bacde8dSNatanael Copa : 27278bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then 27288bacde8dSNatanael Copa LIBS="-lm $LIBS" 27298bacde8dSNatanael Copa libs_qga="-lm $libs_qga" 27308bacde8dSNatanael Copaelse 27318bacde8dSNatanael Copa echo 27328bacde8dSNatanael Copa echo "Error: libm check failed" 27338bacde8dSNatanael Copa echo 27348bacde8dSNatanael Copa exit 1 27358bacde8dSNatanael Copafi 27368bacde8dSNatanael Copa 27378bacde8dSNatanael Copa########################################## 2738da93a1fdSaliguori# Do we need librt 27398bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime 27408bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't 27418bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this 27428bacde8dSNatanael Copa# function in addition. 2743da93a1fdSaliguoricat > $TMPC <<EOF 2744da93a1fdSaliguori#include <signal.h> 2745da93a1fdSaliguori#include <time.h> 27468bacde8dSNatanael Copaint main(void) { 27478bacde8dSNatanael Copa timer_create(CLOCK_REALTIME, NULL, NULL); 27488bacde8dSNatanael Copa return clock_gettime(CLOCK_REALTIME, NULL); 27498bacde8dSNatanael Copa} 2750da93a1fdSaliguoriEOF 2751da93a1fdSaliguori 275252166aa0SJuan Quintelaif compile_prog "" "" ; then 275307ffa4bdSJuan Quintela : 27548bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result 27558bacde8dSNatanael Copaelif compile_prog "" "-lrt $pthread_lib" ; then 275607ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 27578bacde8dSNatanael Copa libs_qga="-lrt $libs_qga" 2758da93a1fdSaliguorifi 2759da93a1fdSaliguori 276031ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 2761179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 27626362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 27636362a53fSJuan Quintelafi 27646362a53fSJuan Quintela 2765de5071c5SBlue Swirl########################################## 2766cd4ec0b4SGerd Hoffmann# spice probe 2767cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 2768cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 2769cd4ec0b4SGerd Hoffmann#include <spice.h> 2770cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 2771cd4ec0b4SGerd HoffmannEOF 2772710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 2773710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 277467be6726SGerd Hoffmann if $pkg_config --atleast-version=0.12.0 spice-server >/dev/null 2>&1 && \ 277567be6726SGerd Hoffmann $pkg_config --atleast-version=0.12.2 spice-protocol > /dev/null 2>&1 && \ 2776cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 2777cd4ec0b4SGerd Hoffmann spice="yes" 2778cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 2779cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 27802e0e3c39SAlon Levy spice_protocol_version=$($pkg_config --modversion spice-protocol) 27812e0e3c39SAlon Levy spice_server_version=$($pkg_config --modversion spice-server) 2782cd4ec0b4SGerd Hoffmann else 2783cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 2784cd4ec0b4SGerd Hoffmann feature_not_found "spice" 2785cd4ec0b4SGerd Hoffmann fi 2786cd4ec0b4SGerd Hoffmann spice="no" 2787cd4ec0b4SGerd Hoffmann fi 2788cd4ec0b4SGerd Hoffmannfi 2789cd4ec0b4SGerd Hoffmann 2790111a38b0SRobert Relyea# check for libcacard for smartcard support 2791111a38b0SRobert Relyeaif test "$smartcard" != "no" ; then 2792111a38b0SRobert Relyea smartcard="yes" 2793111a38b0SRobert Relyea smartcard_cflags="" 2794111a38b0SRobert Relyea # TODO - what's the minimal nss version we support? 2795111a38b0SRobert Relyea if test "$smartcard_nss" != "no"; then 27965f01e06fSSergei Trofimovich cat > $TMPC << EOF 27975f01e06fSSergei Trofimovich#include <pk11pub.h> 27985f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; } 27995f01e06fSSergei TrofimovichEOF 28000b22ef0fSPeter Maydell smartcard_includes="-I\$(SRC_PATH)/libcacard" 28018c741c22SAlon Levy libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs" 28028c741c22SAlon Levy libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags" 28036ca026cbSPeter Maydell test_cflags="$libcacard_cflags" 28046ca026cbSPeter Maydell # The header files in nss < 3.13.3 have a bug which causes them to 28056ca026cbSPeter Maydell # emit a warning. If we're going to compile QEMU with -Werror, then 28066ca026cbSPeter Maydell # test that the headers don't have this bug. Otherwise we would pass 28076ca026cbSPeter Maydell # the configure test but fail to compile QEMU later. 28086ca026cbSPeter Maydell if test "$werror" = "yes"; then 28096ca026cbSPeter Maydell test_cflags="-Werror $test_cflags" 28106ca026cbSPeter Maydell fi 28115f01e06fSSergei Trofimovich if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \ 28126ca026cbSPeter Maydell compile_prog "$test_cflags" "$libcacard_libs"; then 28135f01e06fSSergei Trofimovich smartcard_nss="yes" 28140b22ef0fSPeter Maydell QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags" 28150b22ef0fSPeter Maydell QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes" 2816ad4cf3f6SPaul Brook libs_softmmu="$libcacard_libs $libs_softmmu" 2817111a38b0SRobert Relyea else 2818111a38b0SRobert Relyea if test "$smartcard_nss" = "yes"; then 2819111a38b0SRobert Relyea feature_not_found "nss" 2820111a38b0SRobert Relyea fi 2821111a38b0SRobert Relyea smartcard_nss="no" 2822111a38b0SRobert Relyea fi 2823111a38b0SRobert Relyea fi 2824111a38b0SRobert Relyeafi 2825111a38b0SRobert Relyeaif test "$smartcard" = "no" ; then 2826111a38b0SRobert Relyea smartcard_nss="no" 2827111a38b0SRobert Relyeafi 2828111a38b0SRobert Relyea 282969354a83SHans de Goede# check for usbredirparser for usb network redirection support 283069354a83SHans de Goedeif test "$usb_redir" != "no" ; then 2831c19a7981SHans de Goede if $pkg_config --atleast-version=0.5.3 libusbredirparser-0.5 >/dev/null 2>&1 ; then 283269354a83SHans de Goede usb_redir="yes" 28338b626aa7SHans de Goede usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5 2>/dev/null) 28348b626aa7SHans de Goede usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5 2>/dev/null) 283569354a83SHans de Goede QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags" 283656ab2ad1SAurelien Jarno libs_softmmu="$libs_softmmu $usb_redir_libs" 283769354a83SHans de Goede else 283869354a83SHans de Goede if test "$usb_redir" = "yes"; then 283969354a83SHans de Goede feature_not_found "usb-redir" 284069354a83SHans de Goede fi 284169354a83SHans de Goede usb_redir="no" 284269354a83SHans de Goede fi 284369354a83SHans de Goedefi 284469354a83SHans de Goede 2845cd4ec0b4SGerd Hoffmann########################################## 2846cd4ec0b4SGerd Hoffmann 2847747bbdf7SBlue Swirl########################################## 28485f6b9e8fSBlue Swirl# check if we have fdatasync 28495f6b9e8fSBlue Swirl 28505f6b9e8fSBlue Swirlfdatasync=no 28515f6b9e8fSBlue Swirlcat > $TMPC << EOF 28525f6b9e8fSBlue Swirl#include <unistd.h> 2853d1722a27SAlexandre Raymondint main(void) { 2854d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 2855d1722a27SAlexandre Raymondreturn fdatasync(0); 2856d1722a27SAlexandre Raymond#else 2857e172fe11SStefan Weil#error Not supported 2858d1722a27SAlexandre Raymond#endif 2859d1722a27SAlexandre Raymond} 28605f6b9e8fSBlue SwirlEOF 28615f6b9e8fSBlue Swirlif compile_prog "" "" ; then 28625f6b9e8fSBlue Swirl fdatasync=yes 28635f6b9e8fSBlue Swirlfi 28645f6b9e8fSBlue Swirl 286594a420b1SStefan Hajnoczi########################################## 2866e78815a5SAndreas Färber# check if we have madvise 2867e78815a5SAndreas Färber 2868e78815a5SAndreas Färbermadvise=no 2869e78815a5SAndreas Färbercat > $TMPC << EOF 2870e78815a5SAndreas Färber#include <sys/types.h> 2871e78815a5SAndreas Färber#include <sys/mman.h> 2872832ce9c2SScott Wood#include <stddef.h> 2873e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 2874e78815a5SAndreas FärberEOF 2875e78815a5SAndreas Färberif compile_prog "" "" ; then 2876e78815a5SAndreas Färber madvise=yes 2877e78815a5SAndreas Färberfi 2878e78815a5SAndreas Färber 2879e78815a5SAndreas Färber########################################## 2880e78815a5SAndreas Färber# check if we have posix_madvise 2881e78815a5SAndreas Färber 2882e78815a5SAndreas Färberposix_madvise=no 2883e78815a5SAndreas Färbercat > $TMPC << EOF 2884e78815a5SAndreas Färber#include <sys/mman.h> 2885832ce9c2SScott Wood#include <stddef.h> 2886e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 2887e78815a5SAndreas FärberEOF 2888e78815a5SAndreas Färberif compile_prog "" "" ; then 2889e78815a5SAndreas Färber posix_madvise=yes 2890e78815a5SAndreas Färberfi 2891e78815a5SAndreas Färber 2892e78815a5SAndreas Färber########################################## 28931e9737daSRichard Henderson# check if we have usable SIGEV_THREAD_ID 28941e9737daSRichard Henderson 28951e9737daSRichard Hendersonsigev_thread_id=no 28961e9737daSRichard Hendersoncat > $TMPC << EOF 28971e9737daSRichard Henderson#include <signal.h> 28981e9737daSRichard Hendersonint main(void) { 28991e9737daSRichard Henderson struct sigevent ev; 29001e9737daSRichard Henderson ev.sigev_notify = SIGEV_THREAD_ID; 29011e9737daSRichard Henderson ev._sigev_un._tid = 0; 29021e9737daSRichard Henderson asm volatile("" : : "g"(&ev)); 29031e9737daSRichard Henderson return 0; 29041e9737daSRichard Henderson} 29051e9737daSRichard HendersonEOF 29061e9737daSRichard Hendersonif compile_prog "" "" ; then 29071e9737daSRichard Henderson sigev_thread_id=yes 29081e9737daSRichard Hendersonfi 29091e9737daSRichard Henderson 29101e9737daSRichard Henderson########################################## 291194a420b1SStefan Hajnoczi# check if trace backend exists 291294a420b1SStefan Hajnoczi 2913650ab98dSLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend > /dev/null 2> /dev/null 291494a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 291594a420b1SStefan Hajnoczi echo 291694a420b1SStefan Hajnoczi echo "Error: invalid trace backend" 291794a420b1SStefan Hajnoczi echo "Please choose a supported trace backend." 291894a420b1SStefan Hajnoczi echo 291994a420b1SStefan Hajnoczi exit 1 292094a420b1SStefan Hajnoczifi 292194a420b1SStefan Hajnoczi 29227e24e92aSStefan Hajnoczi########################################## 29237e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 29247e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then 29257e24e92aSStefan Hajnoczi cat > $TMPC << EOF 29267e24e92aSStefan Hajnoczi#include <ust/tracepoint.h> 29277e24e92aSStefan Hajnoczi#include <ust/marker.h> 29287e24e92aSStefan Hajnocziint main(void) { return 0; } 29297e24e92aSStefan HajnocziEOF 29307e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 293194b4fefaSLluís Vilanova LIBS="-lust -lurcu-bp $LIBS" 2932c9a2e37cSLluís Vilanova libs_qga="-lust -lurcu-bp $libs_qga" 29337e24e92aSStefan Hajnoczi else 29347e24e92aSStefan Hajnoczi echo 29357e24e92aSStefan Hajnoczi echo "Error: Trace backend 'ust' missing libust header files" 29367e24e92aSStefan Hajnoczi echo 29377e24e92aSStefan Hajnoczi exit 1 29387e24e92aSStefan Hajnoczi fi 29397e24e92aSStefan Hajnoczifi 2940b3d08c02SDaniel P. Berrange 2941b3d08c02SDaniel P. Berrange########################################## 2942b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 2943b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then 2944b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 2945b3d08c02SDaniel P. Berrange echo 2946b3d08c02SDaniel P. Berrange echo "Error: dtrace command is not found in PATH $PATH" 2947b3d08c02SDaniel P. Berrange echo 2948b3d08c02SDaniel P. Berrange exit 1 2949b3d08c02SDaniel P. Berrange fi 2950c276b17dSDaniel P. Berrange trace_backend_stap="no" 2951c276b17dSDaniel P. Berrange if has 'stap' ; then 2952c276b17dSDaniel P. Berrange trace_backend_stap="yes" 2953c276b17dSDaniel P. Berrange fi 2954b3d08c02SDaniel P. Berrangefi 2955b3d08c02SDaniel P. Berrange 29567e24e92aSStefan Hajnoczi########################################## 2957023367e6SWolfgang Mauerer# __sync_fetch_and_and requires at least -march=i486. Many toolchains 2958023367e6SWolfgang Mauerer# use i686 as default anyway, but for those that don't, an explicit 2959023367e6SWolfgang Mauerer# specification is necessary 29601ba16968SStefan Weilif test "$vhost_net" = "yes" && test "$cpu" = "i386"; then 2961023367e6SWolfgang Mauerer cat > $TMPC << EOF 29627ace252aSStefan Weilstatic int sfaa(int *ptr) 2963023367e6SWolfgang Mauerer{ 2964023367e6SWolfgang Mauerer return __sync_fetch_and_and(ptr, 0); 2965023367e6SWolfgang Mauerer} 2966023367e6SWolfgang Mauerer 2967abab1a0fSStefan Weilint main(void) 2968023367e6SWolfgang Mauerer{ 2969023367e6SWolfgang Mauerer int val = 42; 2970023367e6SWolfgang Mauerer sfaa(&val); 2971023367e6SWolfgang Mauerer return val; 2972023367e6SWolfgang Mauerer} 2973023367e6SWolfgang MauererEOF 2974023367e6SWolfgang Mauerer if ! compile_prog "" "" ; then 2975caa50971SPeter Maydell QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 2976023367e6SWolfgang Mauerer fi 2977023367e6SWolfgang Mauererfi 2978023367e6SWolfgang Mauerer 2979023367e6SWolfgang Mauerer########################################## 2980519175a2SAlex Barcelo# check and set a backend for coroutine 2981d0e2fce5SAneesh Kumar K.V 2982519175a2SAlex Barcelo# default is ucontext, but always fallback to gthread 2983519175a2SAlex Barcelo# windows autodetected by make 2984519175a2SAlex Barceloif test "$coroutine" = "" -o "$coroutine" = "ucontext"; then 2985d0e2fce5SAneesh Kumar K.V if test "$darwin" != "yes"; then 2986d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 2987d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 2988cdf84806SPeter Maydell#ifdef __stub_makecontext 2989cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 2990cdf84806SPeter Maydell#endif 299175cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 2992d0e2fce5SAneesh Kumar K.VEOF 2993d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 2994519175a2SAlex Barcelo coroutine_backend=ucontext 2995519175a2SAlex Barcelo else 2996519175a2SAlex Barcelo coroutine_backend=gthread 2997d0e2fce5SAneesh Kumar K.V fi 2998519175a2SAlex Barcelo fi 2999519175a2SAlex Barceloelif test "$coroutine" = "gthread" ; then 3000519175a2SAlex Barcelo coroutine_backend=gthread 3001519175a2SAlex Barceloelif test "$coroutine" = "windows" ; then 3002519175a2SAlex Barcelo coroutine_backend=windows 3003fe91bfa8SAlex Barceloelif test "$coroutine" = "sigaltstack" ; then 3004fe91bfa8SAlex Barcelo coroutine_backend=sigaltstack 3005519175a2SAlex Barceloelse 3006519175a2SAlex Barcelo echo 3007519175a2SAlex Barcelo echo "Error: unknown coroutine backend $coroutine" 3008519175a2SAlex Barcelo echo 3009519175a2SAlex Barcelo exit 1 3010d0e2fce5SAneesh Kumar K.Vfi 3011d0e2fce5SAneesh Kumar K.V 3012d0e2fce5SAneesh Kumar K.V########################################## 3013d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 3014d2042378SAneesh Kumar K.V 30154e1797f9SStefan Weilopen_by_handle_at=no 3016d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 3017d2042378SAneesh Kumar K.V#include <fcntl.h> 3018acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH) 3019acc55ba8SStefan Weil# error missing definition 3020acc55ba8SStefan Weil#else 302175cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 3022acc55ba8SStefan Weil#endif 3023d2042378SAneesh Kumar K.VEOF 3024d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 3025d2042378SAneesh Kumar K.V open_by_handle_at=yes 3026d2042378SAneesh Kumar K.Vfi 3027d2042378SAneesh Kumar K.V 3028e06a765eSHarsh Prateek Bora######################################## 3029e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 3030e06a765eSHarsh Prateek Bora 3031e06a765eSHarsh Prateek Boralinux_magic_h=no 3032e06a765eSHarsh Prateek Boracat > $TMPC << EOF 3033e06a765eSHarsh Prateek Bora#include <linux/magic.h> 3034e06a765eSHarsh Prateek Boraint main(void) { 303575cafad7SStefan Weil return 0; 3036e06a765eSHarsh Prateek Bora} 3037e06a765eSHarsh Prateek BoraEOF 3038e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 3039e06a765eSHarsh Prateek Bora linux_magic_h=yes 3040e06a765eSHarsh Prateek Borafi 3041e06a765eSHarsh Prateek Bora 30428ab1bf12SLuiz Capitulino######################################## 304306d71fa1SPeter Maydell# check whether we can disable the -Wunused-but-set-variable 304406d71fa1SPeter Maydell# option with a pragma (this is needed to silence a warning in 304506d71fa1SPeter Maydell# some versions of the valgrind VALGRIND_STACK_DEREGISTER macro.) 304606d71fa1SPeter Maydell# This test has to be compiled with -Werror as otherwise an 304706d71fa1SPeter Maydell# unknown pragma is only a warning. 304806d71fa1SPeter Maydellpragma_disable_unused_but_set=no 304906d71fa1SPeter Maydellcat > $TMPC << EOF 305006d71fa1SPeter Maydell#pragma GCC diagnostic ignored "-Wunused-but-set-variable" 305106d71fa1SPeter Maydellint main(void) { 305206d71fa1SPeter Maydell return 0; 305306d71fa1SPeter Maydell} 305406d71fa1SPeter MaydellEOF 305506d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then 305606d71fa1SPeter Maydell pragma_disable_unused_but_set=yes 305706d71fa1SPeter Maydellfi 305806d71fa1SPeter Maydell 305906d71fa1SPeter Maydell######################################## 306062fe8331SChristian Borntraeger# check if we have valgrind/valgrind.h and valgrind/memcheck.h 30613f4349dcSKevin Wolf 30623f4349dcSKevin Wolfvalgrind_h=no 30633f4349dcSKevin Wolfcat > $TMPC << EOF 30643f4349dcSKevin Wolf#include <valgrind/valgrind.h> 306562fe8331SChristian Borntraeger#include <valgrind/memcheck.h> 30663f4349dcSKevin Wolfint main(void) { 30673f4349dcSKevin Wolf return 0; 30683f4349dcSKevin Wolf} 30693f4349dcSKevin WolfEOF 30703f4349dcSKevin Wolfif compile_prog "" "" ; then 30713f4349dcSKevin Wolf valgrind_h=yes 30723f4349dcSKevin Wolffi 30733f4349dcSKevin Wolf 30743f4349dcSKevin Wolf######################################## 30758ab1bf12SLuiz Capitulino# check if environ is declared 30768ab1bf12SLuiz Capitulino 30778ab1bf12SLuiz Capitulinohas_environ=no 30788ab1bf12SLuiz Capitulinocat > $TMPC << EOF 30798ab1bf12SLuiz Capitulino#include <unistd.h> 30808ab1bf12SLuiz Capitulinoint main(void) { 3081c075a723SBlue Swirl environ = 0; 30828ab1bf12SLuiz Capitulino return 0; 30838ab1bf12SLuiz Capitulino} 30848ab1bf12SLuiz CapitulinoEOF 30858ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then 30868ab1bf12SLuiz Capitulino has_environ=yes 30878ab1bf12SLuiz Capitulinofi 30888ab1bf12SLuiz Capitulino 3089*76a347e1SRichard Henderson######################################## 3090*76a347e1SRichard Henderson# check if cpuid.h is usable. 3091*76a347e1SRichard Henderson 3092*76a347e1SRichard Hendersoncpuid_h=no 3093*76a347e1SRichard Hendersoncat > $TMPC << EOF 3094*76a347e1SRichard Henderson#include <cpuid.h> 3095*76a347e1SRichard Hendersonint main(void) { 3096*76a347e1SRichard Henderson return 0; 3097*76a347e1SRichard Henderson} 3098*76a347e1SRichard HendersonEOF 3099*76a347e1SRichard Hendersonif compile_prog "" "" ; then 3100*76a347e1SRichard Henderson cpuid_h=yes 3101*76a347e1SRichard Hendersonfi 3102*76a347e1SRichard Henderson 3103*76a347e1SRichard Henderson 3104d2042378SAneesh Kumar K.V########################################## 3105e86ecd4bSJuan Quintela# End of CC checks 3106e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 3107e86ecd4bSJuan Quintela 3108e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then 31098be74dc0SAvi Kivity CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS" 3110e86ecd4bSJuan Quintelafi 3111a316e378SJuan Quintela 311220ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 311320ff6c80SAnthony Liguori# enable/disable 311420ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 311520ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 311620ff6c80SAnthony Liguori zero_malloc="no" 311720ff6c80SAnthony Liguori else 311820ff6c80SAnthony Liguori zero_malloc="yes" 311920ff6c80SAnthony Liguori fi 312020ff6c80SAnthony Liguorifi 312120ff6c80SAnthony Liguori 31226ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags 31236ca026cbSPeter Maydellif test "$werror" = "yes"; then 31246ca026cbSPeter Maydell QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 31256ca026cbSPeter Maydellfi 31266ca026cbSPeter Maydell 3127e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 3128e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 31291156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 3130e86ecd4bSJuan Quintela fi 3131e86ecd4bSJuan Quintelafi 3132e86ecd4bSJuan Quintela 313394dd53c5SGerd Hoffmann# test if pod2man has --utf8 option 313494dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then 313594dd53c5SGerd Hoffmann POD2MAN="pod2man --utf8" 313694dd53c5SGerd Hoffmannelse 313794dd53c5SGerd Hoffmann POD2MAN="pod2man" 313894dd53c5SGerd Hoffmannfi 313994dd53c5SGerd Hoffmann 3140952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 3141952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 3142952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 3143952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 3144952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 3145952afb71SBlue Swirl fi 3146952afb71SBlue Swirl done 3147952afb71SBlue Swirlfi 3148952afb71SBlue Swirl 314910ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix 3150528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix 31515a67135aSbellard 31524b1c11fdSDaniel P. Berrangetools="" 31534b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then 3154ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 31554b1c11fdSDaniel P. Berrange if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 31564b1c11fdSDaniel P. Berrange tools="qemu-nbd\$(EXESUF) $tools" 31574b1c11fdSDaniel P. Berrange fi 31584b1c11fdSDaniel P. Berrangefi 31594b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then 3160983eef5aSMeador Inge if test "$virtfs" != no ; then 3161be5ea8edSAnthony Liguori if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then 3162983eef5aSMeador Inge virtfs=yes 316317bff52bSM. Mohan Kumar tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" 3164983eef5aSMeador Inge else 3165983eef5aSMeador Inge if test "$virtfs" = yes; then 3166263ddcc8SHarsh Prateek Bora echo "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel" 3167263ddcc8SHarsh Prateek Bora exit 1 3168983eef5aSMeador Inge fi 316917500370SAndreas Färber virtfs=no 3170983eef5aSMeador Inge fi 317117bff52bSM. Mohan Kumar fi 3172ca35f780SPaolo Bonzini if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 3173d138cee9SMichael Roth if [ "$guest_agent" = "yes" ]; then 317448ff7a62SMichael Roth tools="qemu-ga\$(EXESUF) $tools" 3175d138cee9SMichael Roth fi 3176ca35f780SPaolo Bonzini fi 317700c705fbSPaolo Bonzini if test "$smartcard_nss" = "yes" ; then 317800c705fbSPaolo Bonzini tools="vscclient\$(EXESUF) $tools" 317900c705fbSPaolo Bonzini fi 31804b1c11fdSDaniel P. Berrangefi 3181ca35f780SPaolo Bonzini 3182ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 3183ca35f780SPaolo Bonziniroms= 3184ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 3185ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 3186ca35f780SPaolo Bonzini "$softmmu" = yes ; then 3187ca35f780SPaolo Bonzini roms="optionrom" 3188ca35f780SPaolo Bonzinifi 3189d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then 319039ac8455SDavid Gibson roms="$roms spapr-rtas" 319139ac8455SDavid Gibsonfi 3192ca35f780SPaolo Bonzini 31935ca9388aSGerd Hoffmann# add pixman flags after all config tests are done 31945ca9388aSGerd HoffmannQEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags" 31955ca9388aSGerd Hoffmannlibs_softmmu="$libs_softmmu $pixman_libs" 31965ca9388aSGerd Hoffmann 31977d13299dSbellardecho "Install prefix $prefix" 3198c00b2808SEduardo Habkostecho "BIOS directory `eval echo $qemu_datadir`" 3199f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 32003aa5d2beSAlon Levyecho "library directory `eval echo $libdir`" 32018bf188aaSMichael Tokarevecho "libexec directory `eval echo $libexecdir`" 32020f94d6daSAlon Levyecho "include directory `eval echo $includedir`" 32031c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 3204785c23aeSLuiz Capitulinoecho "local state directory `eval echo $local_statedir`" 320511d9f695Sbellardif test "$mingw32" = "no" ; then 3206f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 320743ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 320811d9f695Sbellardfi 32095a67135aSbellardecho "Source path $source_path" 32107d13299dSbellardecho "C compiler $cc" 321183469015Sbellardecho "Host C compiler $host_cc" 32123c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc" 32130c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 3214a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 32150c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 32167d13299dSbellardecho "make $make" 32176a882643Spbrookecho "install $install" 3218c886edfbSBlue Swirlecho "python $python" 3219e2d8830eSBradif test "$slirp" = "yes" ; then 3220e2d8830eSBrad echo "smbd $smbd" 3221e2d8830eSBradfi 3222a98fd896Sbellardecho "host CPU $cpu" 3223de83cd02Sbellardecho "host big endian $bigendian" 322497a847bcSbellardecho "target list $target_list" 3225ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 32267d13299dSbellardecho "gprof enabled $gprof" 322703b4fe7dSaliguoriecho "sparse enabled $sparse" 32281625af87Saliguoriecho "strip binaries $strip_opt" 322905c2a3e7Sbellardecho "profiler $profiler" 323043ce4dfeSbellardecho "static build $static" 323185aa5189Sbellardecho "-Werror enabled $werror" 32325b0753e0Sbellardif test "$darwin" = "yes" ; then 32335b0753e0Sbellard echo "Cocoa support $cocoa" 32345b0753e0Sbellardfi 3235e2134eb9SGerd Hoffmannecho "pixman $pixman" 323697a847bcSbellardecho "SDL support $sdl" 32374d3b6f6eSbalrogecho "curses support $curses" 3238769ce76dSAlexander Grafecho "curl support $curl" 323967b915a5Sbellardecho "mingw32 support $mingw32" 32400c58ac1cSmalcecho "Audio drivers $audio_drv_list" 32410c58ac1cSmalcecho "Extra audio cards $audio_card_list" 3242eb852011SMarkus Armbrusterecho "Block whitelist $block_drv_whitelist" 32438ff9cbf7Smalcecho "Mixer emulation $mixemu" 3244983eef5aSMeador Ingeecho "VirtFS support $virtfs" 3245821601eaSJes Sorensenecho "VNC support $vnc" 3246821601eaSJes Sorensenif test "$vnc" = "yes" ; then 32478d5d2d4cSths echo "VNC TLS support $vnc_tls" 32482f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 32492f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 3250efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 3251821601eaSJes Sorensenfi 32523142255cSblueswir1if test -n "$sparc_cpu"; then 32533142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 32543142255cSblueswir1fi 3255e37630caSaliguoriecho "xen support $xen" 32562e4d9fb1Saurel32echo "brlapi support $brlapi" 3257a20a6f46SJuan Quintelaecho "bluez support $bluez" 3258a25dba17SJuan Quintelaecho "Documentation $docs" 3259c5937220Spbrook[ ! -z "$uname_release" ] && \ 3260c5937220Spbrookecho "uname -r $uname_release" 3261bd0c5661Spbrookecho "NPTL support $nptl" 3262379f6698SPaul Brookecho "GUEST_BASE $guest_base" 326340d6444eSAvi Kivityecho "PIE $pie" 32648a16d273Sthsecho "vde support $vde" 32655c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 3266758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 326777755340Sthsecho "Install blobs $blobs" 3268b31a0277SJuan Quintelaecho "KVM support $kvm" 32699195b2c2SStefan Weilecho "TCG interpreter $tcg_interpreter" 3270f652e6afSaurel32echo "fdt support $fdt" 3271ceb42de8Saliguoriecho "preadv support $preadv" 32725f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 3273e78815a5SAndreas Färberecho "madvise $madvise" 3274e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 32751e9737daSRichard Hendersonecho "sigev_thread_id $sigev_thread_id" 3276ee682d27SStefan Weilecho "uuid support $uuid" 327747e98658SCorey Bryantecho "libcap-ng support $cap_ng" 3278d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 327994a420b1SStefan Hajnocziecho "Trace backend $trace_backend" 32809410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 32812e0e3c39SAlon Levyecho "spice support $spice ($spice_protocol_version/$spice_server_version)" 3282f27aaf4bSChristian Brunnerecho "rbd support $rbd" 3283dce512deSChristoph Hellwigecho "xfsctl support $xfs" 3284111a38b0SRobert Relyeaecho "nss used $smartcard_nss" 328569354a83SHans de Goedeecho "usb net redir $usb_redir" 328620ff075bSMichael Walleecho "OpenGL support $opengl" 3287c589b249SRonnie Sahlbergecho "libiscsi support $libiscsi" 3288d138cee9SMichael Rothecho "build guest agent $guest_agent" 3289f794573eSEduardo Otuboecho "seccomp support $seccomp" 3290519175a2SAlex Barceloecho "coroutine backend $coroutine_backend" 3291eb100396SBharata B Raoecho "GlusterFS support $glusterfs" 329267b915a5Sbellard 32931ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then 329424b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 3295e8cd23deSbellardfi 329697a847bcSbellard 329798ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 32984bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld" 329997a847bcSbellard 330098ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 330198ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 330298ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 330398ec69acSJuan Quintelaecho >> $config_host_mak 330498ec69acSJuan Quintela 3305e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 330699d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 330799d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 33083aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 33098bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak 33100f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak 331199d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 331299d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 331322d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak 33149afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak 33159afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak 3316785c23aeSLuiz Capitulinoecho "qemu_localstatedir=$local_statedir" >> $config_host_mak 3317f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak 3318804edf29SJuan Quintela 331998ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 3320f8393946Saurel32if test "$debug_tcg" = "yes" ; then 33212358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 3322f8393946Saurel32fi 3323f3d08ee6SPaul Brookif test "$debug" = "yes" ; then 33242358a494SJuan Quintela echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak 3325f3d08ee6SPaul Brookfi 33261625af87Saliguoriif test "$strip_opt" = "yes" ; then 332752ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 33281625af87Saliguorifi 33297d13299dSbellardif test "$bigendian" = "yes" ; then 3330e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 333197a847bcSbellardfi 333267b915a5Sbellardif test "$mingw32" = "yes" ; then 333398ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 33349fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 33359fe6de94SBlue Swirl version_major=${rc_version%%.*} 33369fe6de94SBlue Swirl rc_version=${rc_version#*.} 33379fe6de94SBlue Swirl version_minor=${rc_version%%.*} 33389fe6de94SBlue Swirl rc_version=${rc_version#*.} 33399fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 33409fe6de94SBlue Swirl version_micro=0 33419fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 33429fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 3343210fa556Spbrookelse 334435f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 3345210fa556Spbrookfi 3346128ab2ffSblueswir1 3347dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 3348dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 3349dffcb71cSMark McLoughlinfi 3350dffcb71cSMark McLoughlin 335183fb7adfSbellardif test "$darwin" = "yes" ; then 335298ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 335383fb7adfSbellardfi 3354b29fe3edSmalc 3355b29fe3edSmalcif test "$aix" = "yes" ; then 335698ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 3357b29fe3edSmalcfi 3358b29fe3edSmalc 3359ec530c81Sbellardif test "$solaris" = "yes" ; then 336098ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 33612358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 33620475a5caSths if test "$needs_libsunmath" = "yes" ; then 336375b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 33640475a5caSths fi 3365ec530c81Sbellardfi 3366179cf400SAndreas Färberif test "$haiku" = "yes" ; then 3367179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 3368179cf400SAndreas Färberfi 336997a847bcSbellardif test "$static" = "yes" ; then 337098ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 337197a847bcSbellardfi 33721ba16968SStefan Weilif test "$profiler" = "yes" ; then 33732358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 337405c2a3e7Sbellardfi 3375c20709aaSbellardif test "$slirp" = "yes" ; then 337698ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 3377e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 3378c20709aaSbellardfi 33798a16d273Sthsif test "$vde" = "yes" ; then 338098ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 33818a16d273Sthsfi 338247e98658SCorey Bryantif test "$cap_ng" = "yes" ; then 338347e98658SCorey Bryant echo "CONFIG_LIBCAP=y" >> $config_host_mak 338447e98658SCorey Bryantfi 33850c58ac1cSmalcfor card in $audio_card_list; do 3386bb55b712SStefan Weil def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'` 338798ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 33880c58ac1cSmalcdone 33892358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 33900c58ac1cSmalcfor drv in $audio_drv_list; do 3391bb55b712SStefan Weil def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'` 339298ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 3393923e4521Smalc if test "$drv" = "fmod"; then 33947aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 3395fb065187Sbellard fi 33960c58ac1cSmalcdone 339767f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 339867f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 339967f86e8eSJuan Quintelafi 3400d5631638Smalcif test "$audio_win_int" = "yes" ; then 3401d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 3402d5631638Smalcfi 3403eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak 34048ff9cbf7Smalcif test "$mixemu" = "yes" ; then 340598ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 34068ff9cbf7Smalcfi 3407821601eaSJes Sorensenif test "$vnc" = "yes" ; then 3408821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 3409821601eaSJes Sorensenfi 34108d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 341198ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 34128d5d2d4cSthsfi 34132f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 341498ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 34152f9606b3Saliguorifi 3416821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 34172f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 34182f6f5c7aSCorentin Charyfi 3419821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 3420efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 3421efe556adSCorentin Charyfi 342276655d6dSaliguoriif test "$fnmatch" = "yes" ; then 34232358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 342476655d6dSaliguorifi 3425ee682d27SStefan Weilif test "$uuid" = "yes" ; then 3426ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 3427ee682d27SStefan Weilfi 3428dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 3429dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 3430dce512deSChristoph Hellwigfi 3431b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 343298ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 34332358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 343498ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 343598ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 3436a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 343798ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 3438cc8ae6deSpbrookfi 34391ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 344098ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 34418ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 344249ecc3faSbellardfi 344349ecc3faSbellardif test "$cocoa" = "yes" ; then 344498ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 344549ecc3faSbellardfi 34464d3b6f6eSbalrogif test "$curses" = "yes" ; then 344798ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 3448ab4e5602SJan Kiszkafi 34493b3f24adSaurel32if test "$atfile" = "yes" ; then 34502358a494SJuan Quintela echo "CONFIG_ATFILE=y" >> $config_host_mak 34513b3f24adSaurel32fi 3452ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 34532358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 3454ebc996f3SRiku Voipiofi 3455099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 34562358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 3457099d6b0fSRiku Voipiofi 345840ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 345940ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 346040ff6d7eSKevin Wolffi 34613ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 34622358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 34633ce34dfbSvibisreenivasanfi 3464c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 3465c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 3466c2882b96SRiku Voipiofi 3467d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 3468d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 3469d0927938SUlrich Hechtfi 3470c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 3471c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 3472c727f47dSPeter Maydellfi 3473dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 3474dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 3475dace20dcSPeter Maydellfi 3476d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 3477d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 3478d0927938SUlrich Hechtfi 34793b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 34803b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 34813b6edd16SPeter Maydellfi 34823b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 34833b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 34843b6edd16SPeter Maydellfi 34853b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then 34863b6edd16SPeter Maydell echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak 34873b6edd16SPeter Maydellfi 34883b3f24adSaurel32if test "$inotify" = "yes" ; then 34892358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 34903b3f24adSaurel32fi 3491c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 3492c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 3493c05c7a73SRiku Voipiofi 34946ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 34956ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 34966ae9a1f4SJuan Quintelafi 34976ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 34986ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 34996ae9a1f4SJuan Quintelafi 3500769ce76dSAlexander Grafif test "$curl" = "yes" ; then 350198ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 3502b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 3503769ce76dSAlexander Graffi 35042e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 350598ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 35062e4d9fb1Saurel32fi 3507fb599c9aSbalrogif test "$bluez" = "yes" ; then 350898ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 3509ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 3510fb599c9aSbalrogfi 3511e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 3512e37630caSaliguoriif test "$xen" = "yes" ; then 35136dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 3514d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 3515e37630caSaliguorifi 35165c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 35175c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 35185c6c3a6cSChristoph Hellwigfi 3519758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 3520758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 3521758e8e38SVenkateswararao Jujjuri (JV)fi 35224f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 35234f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 35244f26f2b6SAvi Kivityfi 3525983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then 3526758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 3527758e8e38SVenkateswararao Jujjuri (JV)fi 352877755340Sthsif test "$blobs" = "yes" ; then 352998ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 353077755340Sthsfi 3531bf9298b9Saliguoriif test "$iovec" = "yes" ; then 35322358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 3533bf9298b9Saliguorifi 3534ceb42de8Saliguoriif test "$preadv" = "yes" ; then 35352358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 3536ceb42de8Saliguorifi 3537f652e6afSaurel32if test "$fdt" = "yes" ; then 35383f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 3539f652e6afSaurel32fi 3540dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 3541dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 3542dcc38d1cSMarcelo Tosattifi 35439195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 35449195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 35459195b2c2SStefan Weilfi 35465f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 35475f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 35485f6b9e8fSBlue Swirlfi 3549e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 3550e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 3551e78815a5SAndreas Färberfi 3552e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 3553e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 3554e78815a5SAndreas Färberfi 35551e9737daSRichard Hendersonif test "$sigev_thread_id" = "yes" ; then 35561e9737daSRichard Henderson echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak 35571e9737daSRichard Hendersonfi 355897a847bcSbellard 3559cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 3560cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 3561cd4ec0b4SGerd Hoffmannfi 3562cd4ec0b4SGerd Hoffmann 356336707144SAlon Levyif test "$smartcard" = "yes" ; then 356436707144SAlon Levy echo "CONFIG_SMARTCARD=y" >> $config_host_mak 356536707144SAlon Levyfi 356636707144SAlon Levy 3567111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 3568111a38b0SRobert Relyea echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak 3569ad4cf3f6SPaul Brook echo "libcacard_libs=$libcacard_libs" >> $config_host_mak 3570ad4cf3f6SPaul Brook echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak 3571111a38b0SRobert Relyeafi 3572111a38b0SRobert Relyea 357369354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 357469354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 357569354a83SHans de Goedefi 357669354a83SHans de Goede 357720ff075bSMichael Walleif test "$opengl" = "yes" ; then 357820ff075bSMichael Walle echo "CONFIG_OPENGL=y" >> $config_host_mak 357920ff075bSMichael Wallefi 358020ff075bSMichael Walle 3581c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 3582c589b249SRonnie Sahlberg echo "CONFIG_LIBISCSI=y" >> $config_host_mak 3583c589b249SRonnie Sahlbergfi 3584c589b249SRonnie Sahlberg 3585f794573eSEduardo Otuboif test "$seccomp" = "yes"; then 3586f794573eSEduardo Otubo echo "CONFIG_SECCOMP=y" >> $config_host_mak 3587f794573eSEduardo Otubofi 3588f794573eSEduardo Otubo 358983fb7adfSbellard# XXX: suppress that 35907d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 35912358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 35927d3505c5Sbellardfi 35937d3505c5Sbellard 35942358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 3595c5937220Spbrook 359620ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 359720ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 359820ff6c80SAnthony Liguorifi 3599f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 3600f27aaf4bSChristian Brunner echo "CONFIG_RBD=y" >> $config_host_mak 3601f27aaf4bSChristian Brunnerfi 360220ff6c80SAnthony Liguori 3603519175a2SAlex Barceloif test "$coroutine_backend" = "ucontext" ; then 3604d0e2fce5SAneesh Kumar K.V echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak 3605fe91bfa8SAlex Barceloelif test "$coroutine_backend" = "sigaltstack" ; then 3606fe91bfa8SAlex Barcelo echo "CONFIG_SIGALTSTACK_COROUTINE=y" >> $config_host_mak 3607d0e2fce5SAneesh Kumar K.Vfi 3608d0e2fce5SAneesh Kumar K.V 3609d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 3610d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 3611d2042378SAneesh Kumar K.Vfi 3612d2042378SAneesh Kumar K.V 3613e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 3614e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 3615e06a765eSHarsh Prateek Borafi 3616e06a765eSHarsh Prateek Bora 361706d71fa1SPeter Maydellif test "$pragma_disable_unused_but_set" = "yes" ; then 361806d71fa1SPeter Maydell echo "CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET=y" >> $config_host_mak 361906d71fa1SPeter Maydellfi 362006d71fa1SPeter Maydell 36213f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then 36223f4349dcSKevin Wolf echo "CONFIG_VALGRIND_H=y" >> $config_host_mak 36233f4349dcSKevin Wolffi 36243f4349dcSKevin Wolf 36258ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then 36268ab1bf12SLuiz Capitulino echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak 36278ab1bf12SLuiz Capitulinofi 36288ab1bf12SLuiz Capitulino 3629*76a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then 3630*76a347e1SRichard Henderson echo "CONFIG_CPUID_H=y" >> $config_host_mak 3631*76a347e1SRichard Hendersonfi 3632*76a347e1SRichard Henderson 3633eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then 3634eb100396SBharata B Rao echo "CONFIG_GLUSTERFS=y" >> $config_host_mak 3635eb100396SBharata B Raofi 3636eb100396SBharata B Rao 363768063649Sblueswir1# USB host support 363868063649Sblueswir1case "$usb" in 363968063649Sblueswir1linux) 364098ec69acSJuan Quintela echo "HOST_USB=linux" >> $config_host_mak 364168063649Sblueswir1;; 364268063649Sblueswir1bsd) 364398ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 364468063649Sblueswir1;; 364568063649Sblueswir1*) 364698ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 364768063649Sblueswir1;; 364868063649Sblueswir1esac 364968063649Sblueswir1 3650e4858974SLluís# use default implementation for tracing backend-specific routines 3651e4858974SLluístrace_default=yes 365294a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak 36536d8a764eSLluísif test "$trace_backend" = "nop"; then 36546d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 365522890ab5SPrerna Saxenafi 36569410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then 36576d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 3658e4858974SLluís trace_default=no 36596d8a764eSLluís # Set the appropriate trace file. 3660953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 36619410b56cSPrerna Saxenafi 36626d8a764eSLluísif test "$trace_backend" = "stderr"; then 36636d8a764eSLluís echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak 36649a82b6a5SLluís trace_default=no 36656d8a764eSLluísfi 36666d8a764eSLluísif test "$trace_backend" = "ust"; then 36676d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 36686d8a764eSLluísfi 36696d8a764eSLluísif test "$trace_backend" = "dtrace"; then 36706d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 36716d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 36726d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 36736d8a764eSLluís fi 3674c276b17dSDaniel P. Berrangefi 36759410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 3676e4858974SLluísif test "$trace_default" = "yes"; then 3677e4858974SLluís echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak 3678e4858974SLluísfi 36799410b56cSPrerna Saxena 368098ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 368198ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 3682804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 3683804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 36841901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak 36851901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak 36861901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak 3687c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 3688804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 36892b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 3690804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 36913c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak 3692804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 3693804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 3694804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 36959fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 369644dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak 3697e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 3698a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 3699f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 3700e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 3701e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 3702e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 3703e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 3704e39f0062SPaolo Bonzinifi 370542da6041SGerd Hoffmannif test "$cross_prefix" != ""; then 370642da6041SGerd Hoffmann echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak 370742da6041SGerd Hoffmannelse 370842da6041SGerd Hoffmann echo "AUTOCONF_HOST := " >> $config_host_mak 370942da6041SGerd Hoffmannfi 3710e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 3711a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak 3712a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak 371373da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 37143e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 3715804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 3716957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak 371794dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak 3718cbdd1999SPaolo Bonziniecho "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak 3719804edf29SJuan Quintela 37204bf6b55bSJuan Quintela# generate list of library paths for linker script 37214bf6b55bSJuan Quintela 37224bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} 37234bf6b55bSJuan Quintela 37244bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then 37254bf6b55bSJuan Quintela if cmp -s $config_host_ld ${config_host_ld}~ ; then 37264bf6b55bSJuan Quintela mv ${config_host_ld}~ $config_host_ld 37274bf6b55bSJuan Quintela else 37284bf6b55bSJuan Quintela rm ${config_host_ld}~ 37294bf6b55bSJuan Quintela fi 37304bf6b55bSJuan Quintelafi 37314bf6b55bSJuan Quintela 37326efd7517SPeter Maydell# use included Linux headers 37336efd7517SPeter Maydellif test "$linux" = "yes" ; then 3734a307beb6SAndreas Färber mkdir -p linux-headers 37356efd7517SPeter Maydell case "$cpu" in 37366efd7517SPeter Maydell i386|x86_64) 373708312a63SPeter Maydell linux_arch=x86 37386efd7517SPeter Maydell ;; 37396efd7517SPeter Maydell ppcemb|ppc|ppc64) 374008312a63SPeter Maydell linux_arch=powerpc 37416efd7517SPeter Maydell ;; 37426efd7517SPeter Maydell s390x) 374308312a63SPeter Maydell linux_arch=s390 374408312a63SPeter Maydell ;; 374508312a63SPeter Maydell *) 374608312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 374708312a63SPeter Maydell linux_arch="$cpu" 37486efd7517SPeter Maydell ;; 37496efd7517SPeter Maydell esac 375008312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 375108312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 375208312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 375308312a63SPeter Maydell fi 37546efd7517SPeter Maydellfi 37556efd7517SPeter Maydell 375697a847bcSbellardfor target in $target_list; do 375797a847bcSbellardtarget_dir="$target" 375825be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 3759600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1` 376097a847bcSbellardtarget_bigendian="no" 37611f3d3c8fSJuan Quintela 3762ea2d6a39SJuan Quintelacase "$target_arch2" in 3763e67db06eSJia Liu armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 3764ea2d6a39SJuan Quintela target_bigendian=yes 3765ea2d6a39SJuan Quintela ;; 3766ea2d6a39SJuan Quintelaesac 376797a847bcSbellardtarget_softmmu="no" 3768997344f3Sbellardtarget_user_only="no" 3769831b7825Sthstarget_linux_user="no" 377084778508Sblueswir1target_bsd_user="no" 37719e407a85Spbrookcase "$target" in 3772600309b6SBlue Swirl ${target_arch2}-softmmu) 37739e407a85Spbrook target_softmmu="yes" 37749e407a85Spbrook ;; 3775600309b6SBlue Swirl ${target_arch2}-linux-user) 37769c7a4202SBlue Swirl if test "$linux" != "yes" ; then 37779c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Linux host" 37789c7a4202SBlue Swirl exit 1 37799c7a4202SBlue Swirl fi 37809e407a85Spbrook target_user_only="yes" 37819e407a85Spbrook target_linux_user="yes" 37829e407a85Spbrook ;; 3783600309b6SBlue Swirl ${target_arch2}-bsd-user) 37849cf55765SBlue Swirl if test "$bsd" != "yes" ; then 37859c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a BSD host" 37869c7a4202SBlue Swirl exit 1 37879c7a4202SBlue Swirl fi 378884778508Sblueswir1 target_user_only="yes" 378984778508Sblueswir1 target_bsd_user="yes" 379084778508Sblueswir1 ;; 37919e407a85Spbrook *) 37929e407a85Spbrook echo "ERROR: Target '$target' not recognised" 37939e407a85Spbrook exit 1 37949e407a85Spbrook ;; 37959e407a85Spbrookesac 3796831b7825Sths 379797a847bcSbellardmkdir -p $target_dir 379825be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 379997a847bcSbellard 3800e5fe0c52Spbrookbflt="no" 3801bd0c5661Spbrooktarget_nptl="no" 3802600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` 380356aebc89Spbrookgdb_xml_files="" 3804c2e3dee6SLaurent Viviertarget_short_alignment=2 3805c2e3dee6SLaurent Viviertarget_int_alignment=4 3806c2e3dee6SLaurent Viviertarget_long_alignment=4 3807c2e3dee6SLaurent Viviertarget_llong_alignment=8 3808de3a354aSMichael Walletarget_libs_softmmu= 38097ba1e619Saliguori 3810938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2" 38116acff7daSJuan QuintelaTARGET_BASE_ARCH="" 3812e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 3813e73aae67SJuan Quintela 3814600309b6SBlue Swirlcase "$target_arch2" in 38152408a527Saurel32 i386) 38162408a527Saurel32 ;; 38172408a527Saurel32 x86_64) 38186acff7daSJuan Quintela TARGET_BASE_ARCH=i386 3819c2e3dee6SLaurent Vivier target_long_alignment=8 38202408a527Saurel32 ;; 38212408a527Saurel32 alpha) 3822c2e3dee6SLaurent Vivier target_long_alignment=8 3823a4b388ffSRichard Henderson target_nptl="yes" 38242408a527Saurel32 ;; 38252408a527Saurel32 arm|armeb) 3826b498c8a0SJuan Quintela TARGET_ARCH=arm 3827e5fe0c52Spbrook bflt="yes" 3828bd0c5661Spbrook target_nptl="yes" 382956aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 3830c2e3dee6SLaurent Vivier target_llong_alignment=4 3831412beee6SGrant Likely target_libs_softmmu="$fdt_libs" 38322408a527Saurel32 ;; 38332408a527Saurel32 cris) 3834253bd7f8Sedgar_igl target_nptl="yes" 38352408a527Saurel32 ;; 3836613a22c9SMichael Walle lm32) 3837de3a354aSMichael Walle target_libs_softmmu="$opengl_libs" 3838613a22c9SMichael Walle ;; 38392408a527Saurel32 m68k) 38400938cda5Saurel32 bflt="yes" 384156aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 3842c2e3dee6SLaurent Vivier target_int_alignment=2 3843c2e3dee6SLaurent Vivier target_long_alignment=2 3844c2e3dee6SLaurent Vivier target_llong_alignment=2 38452408a527Saurel32 ;; 3846877fdc12SEdgar E. Iglesias microblaze|microblazeel) 3847877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 384872b675caSEdgar E. Iglesias bflt="yes" 384972b675caSEdgar E. Iglesias target_nptl="yes" 3850de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 385172b675caSEdgar E. Iglesias ;; 38522408a527Saurel32 mips|mipsel) 3853b498c8a0SJuan Quintela TARGET_ARCH=mips 385425be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 3855f04dc72fSPaul Brook target_nptl="yes" 38562408a527Saurel32 ;; 38572408a527Saurel32 mipsn32|mipsn32el) 3858b498c8a0SJuan Quintela TARGET_ARCH=mipsn32 38596acff7daSJuan Quintela TARGET_BASE_ARCH=mips 386025be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 38612408a527Saurel32 ;; 38622408a527Saurel32 mips64|mips64el) 3863b498c8a0SJuan Quintela TARGET_ARCH=mips64 38646acff7daSJuan Quintela TARGET_BASE_ARCH=mips 386525be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 3866c2e3dee6SLaurent Vivier target_long_alignment=8 38672408a527Saurel32 ;; 3868e67db06eSJia Liu or32) 3869e67db06eSJia Liu TARGET_ARCH=openrisc 3870e67db06eSJia Liu TARGET_BASE_ARCH=openrisc 3871e67db06eSJia Liu ;; 38722408a527Saurel32 ppc) 3873c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 3874d6630708SNathan Froyd target_nptl="yes" 3875de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 38762408a527Saurel32 ;; 38772408a527Saurel32 ppcemb) 38786acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3879e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3880c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 3881d6630708SNathan Froyd target_nptl="yes" 3882de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 38832408a527Saurel32 ;; 38842408a527Saurel32 ppc64) 38856acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3886e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3887c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 3888c2e3dee6SLaurent Vivier target_long_alignment=8 3889de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 38902408a527Saurel32 ;; 38912408a527Saurel32 ppc64abi32) 3892b498c8a0SJuan Quintela TARGET_ARCH=ppc64 38936acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3894e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 389525be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 3896c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 3897de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 38982408a527Saurel32 ;; 38992408a527Saurel32 sh4|sh4eb) 3900b498c8a0SJuan Quintela TARGET_ARCH=sh4 39014dbed897Spbrook bflt="yes" 39020b6d3ae0Saurel32 target_nptl="yes" 39032408a527Saurel32 ;; 39042408a527Saurel32 sparc) 39052408a527Saurel32 ;; 39062408a527Saurel32 sparc64) 39076acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 3908c2e3dee6SLaurent Vivier target_long_alignment=8 39092408a527Saurel32 ;; 39102408a527Saurel32 sparc32plus) 3911b498c8a0SJuan Quintela TARGET_ARCH=sparc64 39126acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 3913e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 391425be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 39152408a527Saurel32 ;; 391624e804ecSAlexander Graf s390x) 3917bc434676SUlrich Hecht target_nptl="yes" 39187b3da903SAlexander Graf target_long_alignment=8 391924e804ecSAlexander Graf ;; 3920d2fbca94SGuan Xuetao unicore32) 3921d2fbca94SGuan Xuetao ;; 3922cfa550c6SMax Filippov xtensa|xtensaeb) 3923cfa550c6SMax Filippov TARGET_ARCH=xtensa 3924cfa550c6SMax Filippov ;; 39252408a527Saurel32 *) 3926de83cd02Sbellard echo "Unsupported target CPU" 3927de83cd02Sbellard exit 1 39282408a527Saurel32 ;; 39292408a527Saurel32esac 39305e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 39315e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then 39325e8861a0SPaolo Bonzini TARGET_BASE_ARCH=$TARGET_ARCH 39335e8861a0SPaolo Bonzinifi 39345e8861a0SPaolo Bonzini 39355e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile" 39365e8861a0SPaolo Bonzini 393799afc91dSDaniel P. Berrangeupper() { 393899afc91dSDaniel P. Berrange echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' 393999afc91dSDaniel P. Berrange} 394099afc91dSDaniel P. Berrange 394132761257SYeongkyoon Leecase "$cpu" in 3942ed224a56Smalc i386|x86_64|ppc) 394313586813SStefan Weil # The TCG interpreter currently does not support ld/st optimization. 394413586813SStefan Weil if test "$tcg_interpreter" = "no" ; then 394532761257SYeongkyoon Lee echo "CONFIG_QEMU_LDST_OPTIMIZATION=y" >> $config_target_mak 394613586813SStefan Weil fi 394732761257SYeongkyoon Lee ;; 394832761257SYeongkyoon Leeesac 394932761257SYeongkyoon Lee 3950c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak 3951c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak 3952c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak 3953c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak 395425be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak 395599afc91dSDaniel P. Berrangetarget_arch_name="`upper $TARGET_ARCH`" 395625be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 395725be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak 395899afc91dSDaniel P. Berrangeecho "TARGET_TYPE=TARGET_TYPE_`upper $target_arch2`" >> $config_target_mak 395925be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 3960e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 3961e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 3962e6e91b9cSJuan Quintelafi 396325be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 39641b0c87fcSJuan Quintelacase "$target_arch2" in 39651b0c87fcSJuan Quintela i386|x86_64) 39661b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 396725be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 3968eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = yes; then 3969eb6fda0fSAnthony PERARD echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" 3970eb6fda0fSAnthony PERARD fi 397159d21e53SAlexander Graf else 397259d21e53SAlexander Graf echo "CONFIG_NO_XEN=y" >> $config_target_mak 3973432d268cSJun Nakajima fi 397459d21e53SAlexander Graf ;; 397559d21e53SAlexander Graf *) 397659d21e53SAlexander Graf echo "CONFIG_NO_XEN=y" >> $config_target_mak 39771b0c87fcSJuan Quintelaesac 3978c59249f9SJuan Quintelacase "$target_arch2" in 39790e60a699SAlexander Graf i386|x86_64|ppcemb|ppc|ppc64|s390x) 3980c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 3981c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 3982c59249f9SJuan Quintela \( "$target_arch2" = "$cpu" -o \ 3983c59249f9SJuan Quintela \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 39845f114bc6SAlexander Graf \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ 3985adf82011SRené Rebe \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \ 3986adf82011SRené Rebe \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ 3987c59249f9SJuan Quintela \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ 3988c59249f9SJuan Quintela \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then 398925be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 39901ba16968SStefan Weil if test "$vhost_net" = "yes" ; then 3991d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 3992d5970055SMichael S. Tsirkin fi 3993c59249f9SJuan Quintela fi 3994c59249f9SJuan Quintelaesac 3995fae001f5SWen Congyangcase "$target_arch2" in 3996fae001f5SWen Congyang i386|x86_64) 3997fae001f5SWen Congyang echo "CONFIG_HAVE_GET_MEMORY_MAPPING=y" >> $config_target_mak 3998fae001f5SWen Congyangesac 39997f762366SBlue Swirlif test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then 40000a6b8ddeSAlexander Graf echo "CONFIG_PSERIES=y" >> $config_target_mak 40010a6b8ddeSAlexander Graffi 4002de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 400325be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 400497a847bcSbellardfi 400597a847bcSbellardif test "$target_softmmu" = "yes" ; then 400625be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 4007de3a354aSMichael Walle echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak 4008ad4cf3f6SPaul Brook if test "$smartcard_nss" = "yes" ; then 4009ad4cf3f6SPaul Brook echo "subdir-$target: subdir-libcacard" >> $config_host_mak 4010ad4cf3f6SPaul Brook fi 40119fecbed0SWen Congyang case "$target_arch2" in 40129fecbed0SWen Congyang i386|x86_64) 40139fecbed0SWen Congyang echo "CONFIG_HAVE_CORE_DUMP=y" >> $config_target_mak 40149fecbed0SWen Congyang esac 4015de83cd02Sbellardfi 4016997344f3Sbellardif test "$target_user_only" = "yes" ; then 401725be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 4018a2c80be9SStefan Weil echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 4019997344f3Sbellardfi 4020831b7825Sthsif test "$target_linux_user" = "yes" ; then 402125be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 4022831b7825Sthsfi 402356aebc89Spbrooklist="" 402456aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 402556aebc89Spbrook for x in $gdb_xml_files; do 402656aebc89Spbrook list="$list $source_path/gdb-xml/$x" 402756aebc89Spbrook done 402825be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 40293d0f1517SJuan Quintelafi 4030de83cd02Sbellard 4031e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 403225be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 4033e5fe0c52Spbrookfi 4034bd0c5661Spbrookif test "$target_user_only" = "yes" \ 4035bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 403625be210fSJuan Quintela echo "CONFIG_USE_NPTL=y" >> $config_target_mak 4037bd0c5661Spbrookfi 4038379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 403925be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 4040379f6698SPaul Brookfi 404184778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 404225be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 404384778508Sblueswir1fi 40445b0753e0Sbellard 40455a4d701aSJan Kiszka# the static way of configuring available audio cards requires this workaround 40465a4d701aSJan Kiszkaif test "$target_user_only" != "yes" && grep -q CONFIG_PCSPK $source_path/default-configs/$target.mak; then 40475a4d701aSJan Kiszka echo "CONFIG_PCSPK=y" >> $config_target_mak 40485a4d701aSJan Kiszkafi 40495a4d701aSJan Kiszka 40504afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 4051fa282484SJuan Quintela 40524afddb55SJuan Quintelacflags="" 4053f9728943SPaolo Bonziniincludes="" 4054fa282484SJuan Quintelaldflags="" 40559b8e111fSJuan Quintela 40569195b2c2SStefan Weilif test "$tcg_interpreter" = "yes"; then 40579195b2c2SStefan Weil includes="-I\$(SRC_PATH)/tcg/tci $includes" 40589195b2c2SStefan Weilelif test "$ARCH" = "sparc64" ; then 4059f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/sparc $includes" 406024e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then 4061f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/s390 $includes" 40625d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then 4063f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/i386 $includes" 406457ddfbf7SJuan Quintelaelse 4065f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes" 406657ddfbf7SJuan Quintelafi 4067f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes" 406857ddfbf7SJuan Quintela 40696efd7517SPeter Maydellif test "$linux" = "yes" ; then 40706efd7517SPeter Maydell includes="-I\$(SRC_PATH)/linux-headers $includes" 40716efd7517SPeter Maydellfi 40726efd7517SPeter Maydell 407364656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 407464656024SJuan Quintela case "$i" in 407564656024SJuan Quintela alpha) 407625be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 407776cad711SPaolo Bonzini echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak 407864656024SJuan Quintela ;; 407964656024SJuan Quintela arm) 408025be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 408176cad711SPaolo Bonzini echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak 408264656024SJuan Quintela ;; 408364656024SJuan Quintela cris) 408425be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 408576cad711SPaolo Bonzini echo "CONFIG_CRIS_DIS=y" >> config-all-disas.mak 408664656024SJuan Quintela ;; 408764656024SJuan Quintela hppa) 408825be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 408976cad711SPaolo Bonzini echo "CONFIG_HPPA_DIS=y" >> config-all-disas.mak 409064656024SJuan Quintela ;; 409164656024SJuan Quintela i386|x86_64) 409225be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 409376cad711SPaolo Bonzini echo "CONFIG_I386_DIS=y" >> config-all-disas.mak 409464656024SJuan Quintela ;; 4095903ec55cSAurelien Jarno ia64*) 4096903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $config_target_mak 409776cad711SPaolo Bonzini echo "CONFIG_IA64_DIS=y" >> config-all-disas.mak 4098903ec55cSAurelien Jarno ;; 409979368f49SMichael Walle lm32) 410079368f49SMichael Walle echo "CONFIG_LM32_DIS=y" >> $config_target_mak 410176cad711SPaolo Bonzini echo "CONFIG_LM32_DIS=y" >> config-all-disas.mak 410279368f49SMichael Walle ;; 410364656024SJuan Quintela m68k) 410425be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 410576cad711SPaolo Bonzini echo "CONFIG_M68K_DIS=y" >> config-all-disas.mak 410664656024SJuan Quintela ;; 4107877fdc12SEdgar E. Iglesias microblaze*) 410825be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 410976cad711SPaolo Bonzini echo "CONFIG_MICROBLAZE_DIS=y" >> config-all-disas.mak 411064656024SJuan Quintela ;; 411164656024SJuan Quintela mips*) 411225be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 411376cad711SPaolo Bonzini echo "CONFIG_MIPS_DIS=y" >> config-all-disas.mak 411464656024SJuan Quintela ;; 4115e67db06eSJia Liu or32) 4116e67db06eSJia Liu echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak 411776cad711SPaolo Bonzini echo "CONFIG_OPENRISC_DIS=y" >> config-all-disas.mak 4118e67db06eSJia Liu ;; 411964656024SJuan Quintela ppc*) 412025be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 412176cad711SPaolo Bonzini echo "CONFIG_PPC_DIS=y" >> config-all-disas.mak 412264656024SJuan Quintela ;; 412324e804ecSAlexander Graf s390*) 412425be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 412576cad711SPaolo Bonzini echo "CONFIG_S390_DIS=y" >> config-all-disas.mak 412664656024SJuan Quintela ;; 412764656024SJuan Quintela sh4) 412825be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 412976cad711SPaolo Bonzini echo "CONFIG_SH4_DIS=y" >> config-all-disas.mak 413064656024SJuan Quintela ;; 413164656024SJuan Quintela sparc*) 413225be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 413376cad711SPaolo Bonzini echo "CONFIG_SPARC_DIS=y" >> config-all-disas.mak 413464656024SJuan Quintela ;; 4135cfa550c6SMax Filippov xtensa*) 4136cfa550c6SMax Filippov echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak 413776cad711SPaolo Bonzini echo "CONFIG_XTENSA_DIS=y" >> config-all-disas.mak 4138cfa550c6SMax Filippov ;; 413964656024SJuan Quintela esac 414064656024SJuan Quinteladone 41419195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 41429195b2c2SStefan Weil echo "CONFIG_TCI_DIS=y" >> $config_target_mak 414376cad711SPaolo Bonzini echo "CONFIG_TCI_DIS=y" >> config-all-disas.mak 41449195b2c2SStefan Weilfi 414564656024SJuan Quintela 41466ee7126fSJuan Quintelacase "$ARCH" in 41476ee7126fSJuan Quintelaalpha) 41486ee7126fSJuan Quintela # Ensure there's only a single GP 41496ee7126fSJuan Quintela cflags="-msmall-data $cflags" 41506ee7126fSJuan Quintela;; 41516ee7126fSJuan Quintelaesac 41526ee7126fSJuan Quintela 415355d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then 415455d9c04bSJuan Quintela case "$TARGET_BASE_ARCH" in 415555d9c04bSJuan Quintela arm) 415655d9c04bSJuan Quintela cflags="-DHAS_AUDIO $cflags" 415755d9c04bSJuan Quintela ;; 415825a8bb96SMichael Walle lm32) 415925a8bb96SMichael Walle cflags="-DHAS_AUDIO $cflags" 416025a8bb96SMichael Walle ;; 416155d9c04bSJuan Quintela i386|mips|ppc) 416255d9c04bSJuan Quintela cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" 416355d9c04bSJuan Quintela ;; 416455d9c04bSJuan Quintela esac 416555d9c04bSJuan Quintelafi 416655d9c04bSJuan Quintela 4167d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 416825be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 4169d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 4170d02c1db3SJuan Quintela cflags="-p $cflags" 4171d02c1db3SJuan Quintela ldflags="-p $ldflags" 4172d02c1db3SJuan Quintela fi 4173d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 4174d02c1db3SJuan Quintela ldflags="-p $ldflags" 417525be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 4176d02c1db3SJuan Quintela fi 4177d02c1db3SJuan Quintelafi 4178d02c1db3SJuan Quintela 41799195b2c2SStefan Weilif test "$ARCH" = "tci"; then 41809195b2c2SStefan Weil linker_script="" 41819195b2c2SStefan Weilelse 4182c1c93672SPaolo Bonzini linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/ldscripts/\$(ARCH).ld" 41839195b2c2SStefan Weilfi 41849195b2c2SStefan Weil 41859b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 4186fa282484SJuan Quintela case "$ARCH" in 41874d58be06SRichard Henderson alpha | s390x) 41884d58be06SRichard Henderson # The default placement of the application is fine. 41894d58be06SRichard Henderson ;; 4190fd76e73aSRichard Henderson *) 4191322e5878SJuan Quintela ldflags="$linker_script $ldflags" 4192fa282484SJuan Quintela ;; 4193fa282484SJuan Quintela esac 4194fa282484SJuan Quintelafi 4195fa282484SJuan Quintela 419625be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 419725be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 4198f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak 4199fa282484SJuan Quintela 420097a847bcSbellarddone # for target in $targets 42017d13299dSbellard 4202b776eca1SGerd Hoffmannif [ "$pixman" = "internal" ]; then 4203b776eca1SGerd Hoffmann echo "config-host.h: subdir-pixman" >> $config_host_mak 4204b776eca1SGerd Hoffmannfi 4205b776eca1SGerd Hoffmann 4206d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 4207927b241dSMichael WalleDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32" 42082dee8d54SPaolo BonziniDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas" 42092d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 42102dee8d54SPaolo BonziniDIRS="$DIRS qapi-generated" 421100c705fbSPaolo BonziniDIRS="$DIRS libcacard libcacard/libcacard libcacard/trace" 4212c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt" 4213c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" 421400c705fbSPaolo BonziniFILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile" 4215ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 4216446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile" 42172d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 4218753d11f2SRichard Hendersonfor bios_file in \ 4219753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 4220753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 4221753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 4222753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 4223753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 4224753d11f2SRichard Hendersondo 42257ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 42267ea78b74SJan Kiszkadone 4227d1807a4fSPaolo Bonzinimkdir -p $DIRS 42287d13299dSbellardfor f in $FILES ; do 422972b8b5a1SStefan Weil if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then 4230f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 4231f9245e10SPeter Maydell fi 42327d13299dSbellarddone 42331ad2134fSPaul Brook 4234c34ebfdcSAnthony Liguori# temporary config to build submodules 42352d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 4236c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 423737116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 4238c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 4239c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 4240c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 4241c34ebfdcSAnthony Liguori echo "CPP=${cross_prefix}cpp" >> $config_mak 4242c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 4243c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 4244c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 4245c34ebfdcSAnthony Liguoridone 4246c34ebfdcSAnthony Liguori 4247b40292e7SJan Kiszkaif test "$docs" = "yes" ; then 4248b40292e7SJan Kiszka mkdir -p QMP 4249b40292e7SJan Kiszkafi 4250