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" 281*9d9199a0SPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include -I\$(SRC_PATH)/fpu" 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 ;; 65997a847bcSbellard --disable-sdl) sdl="no" 66097a847bcSbellard ;; 661c4198157SJuan Quintela --enable-sdl) sdl="yes" 662c4198157SJuan Quintela ;; 663983eef5aSMeador Inge --disable-virtfs) virtfs="no" 664983eef5aSMeador Inge ;; 665983eef5aSMeador Inge --enable-virtfs) virtfs="yes" 666983eef5aSMeador Inge ;; 667821601eaSJes Sorensen --disable-vnc) vnc="no" 668821601eaSJes Sorensen ;; 669821601eaSJes Sorensen --enable-vnc) vnc="yes" 670821601eaSJes Sorensen ;; 671b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 672102a52e4Sbellard ;; 673c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 674c2de5c91Smalc ;; 6752f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 6762f6a1ab0Sblueswir1 ;; 6772fa7d3bfSmalc --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` 6780c58ac1cSmalc ;; 6790c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 6800c58ac1cSmalc ;; 681eb852011SMarkus Armbruster --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 682eb852011SMarkus Armbruster ;; 683f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 684f8393946Saurel32 ;; 685f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 686f8393946Saurel32 ;; 687f3d08ee6SPaul Brook --enable-debug) 688f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 689f3d08ee6SPaul Brook debug_tcg="yes" 690f3d08ee6SPaul Brook debug="yes" 691f3d08ee6SPaul Brook strip_opt="no" 692f3d08ee6SPaul Brook ;; 69303b4fe7dSaliguori --enable-sparse) sparse="yes" 69403b4fe7dSaliguori ;; 69503b4fe7dSaliguori --disable-sparse) sparse="no" 69603b4fe7dSaliguori ;; 6971625af87Saliguori --disable-strip) strip_opt="no" 6981625af87Saliguori ;; 6998d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 7008d5d2d4cSths ;; 7011be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 7021be10ad2SJuan Quintela ;; 7032f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 7042f9606b3Saliguori ;; 705ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 706ea784e3bSJuan Quintela ;; 7072f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 7082f6f5c7aSCorentin Chary ;; 7092f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 7102f6f5c7aSCorentin Chary ;; 711efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 712efe556adSCorentin Chary ;; 713efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 714efe556adSCorentin Chary ;; 715443f1376Sbellard --disable-slirp) slirp="no" 716c20709aaSbellard ;; 717ee682d27SStefan Weil --disable-uuid) uuid="no" 718ee682d27SStefan Weil ;; 719ee682d27SStefan Weil --enable-uuid) uuid="yes" 720ee682d27SStefan Weil ;; 721e0e6c8c0Saliguori --disable-vde) vde="no" 7228a16d273Sths ;; 723dfb278bdSJuan Quintela --enable-vde) vde="yes" 724dfb278bdSJuan Quintela ;; 725e37630caSaliguori --disable-xen) xen="no" 726e37630caSaliguori ;; 727fc321b4bSJuan Quintela --enable-xen) xen="yes" 728fc321b4bSJuan Quintela ;; 729eb6fda0fSAnthony PERARD --disable-xen-pci-passthrough) xen_pci_passthrough="no" 730eb6fda0fSAnthony PERARD ;; 731eb6fda0fSAnthony PERARD --enable-xen-pci-passthrough) xen_pci_passthrough="yes" 732eb6fda0fSAnthony PERARD ;; 7332e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 7342e4d9fb1Saurel32 ;; 7354ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 7364ffcedb6SJuan Quintela ;; 737fb599c9aSbalrog --disable-bluez) bluez="no" 738fb599c9aSbalrog ;; 739a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 740a20a6f46SJuan Quintela ;; 7417ba1e619Saliguori --disable-kvm) kvm="no" 7427ba1e619Saliguori ;; 743b31a0277SJuan Quintela --enable-kvm) kvm="yes" 744b31a0277SJuan Quintela ;; 7459195b2c2SStefan Weil --disable-tcg-interpreter) tcg_interpreter="no" 7469195b2c2SStefan Weil ;; 7479195b2c2SStefan Weil --enable-tcg-interpreter) tcg_interpreter="yes" 7489195b2c2SStefan Weil ;; 74947e98658SCorey Bryant --disable-cap-ng) cap_ng="no" 75047e98658SCorey Bryant ;; 75147e98658SCorey Bryant --enable-cap-ng) cap_ng="yes" 75247e98658SCorey Bryant ;; 753cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 754cd4ec0b4SGerd Hoffmann ;; 755cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 756cd4ec0b4SGerd Hoffmann ;; 757c589b249SRonnie Sahlberg --disable-libiscsi) libiscsi="no" 758c589b249SRonnie Sahlberg ;; 759c589b249SRonnie Sahlberg --enable-libiscsi) libiscsi="yes" 760c589b249SRonnie Sahlberg ;; 76105c2a3e7Sbellard --enable-profiler) profiler="yes" 76205c2a3e7Sbellard ;; 76314821030SPavel Borzenkov --disable-cocoa) cocoa="no" 76414821030SPavel Borzenkov ;; 765c2de5c91Smalc --enable-cocoa) 766c2de5c91Smalc cocoa="yes" ; 767c2de5c91Smalc sdl="no" ; 768c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 7695b0753e0Sbellard ;; 770cad25d69Spbrook --disable-system) softmmu="no" 7710a8e90f4Spbrook ;; 772cad25d69Spbrook --enable-system) softmmu="yes" 7730a8e90f4Spbrook ;; 7740953a80fSZachary Amsden --disable-user) 7750953a80fSZachary Amsden linux_user="no" ; 7760953a80fSZachary Amsden bsd_user="no" ; 7770953a80fSZachary Amsden ;; 7780953a80fSZachary Amsden --enable-user) ;; 779831b7825Sths --disable-linux-user) linux_user="no" 7800a8e90f4Spbrook ;; 781831b7825Sths --enable-linux-user) linux_user="yes" 782831b7825Sths ;; 78384778508Sblueswir1 --disable-bsd-user) bsd_user="no" 78484778508Sblueswir1 ;; 78584778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 78684778508Sblueswir1 ;; 787379f6698SPaul Brook --enable-guest-base) guest_base="yes" 788379f6698SPaul Brook ;; 789379f6698SPaul Brook --disable-guest-base) guest_base="no" 790379f6698SPaul Brook ;; 79140d6444eSAvi Kivity --enable-pie) pie="yes" 79234005a00SKirill A. Shutemov ;; 79340d6444eSAvi Kivity --disable-pie) pie="no" 79434005a00SKirill A. Shutemov ;; 795c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 796c5937220Spbrook ;; 79785aa5189Sbellard --enable-werror) werror="yes" 79885aa5189Sbellard ;; 79985aa5189Sbellard --disable-werror) werror="no" 80085aa5189Sbellard ;; 8014d3b6f6eSbalrog --disable-curses) curses="no" 8024d3b6f6eSbalrog ;; 803c584a6d0SJuan Quintela --enable-curses) curses="yes" 804c584a6d0SJuan Quintela ;; 805769ce76dSAlexander Graf --disable-curl) curl="no" 806769ce76dSAlexander Graf ;; 807788c8196SJuan Quintela --enable-curl) curl="yes" 808788c8196SJuan Quintela ;; 8092df87df7SJuan Quintela --disable-fdt) fdt="no" 8102df87df7SJuan Quintela ;; 8112df87df7SJuan Quintela --enable-fdt) fdt="yes" 8122df87df7SJuan Quintela ;; 813bd0c5661Spbrook --disable-nptl) nptl="no" 814bd0c5661Spbrook ;; 815b0a47e79SJuan Quintela --enable-nptl) nptl="yes" 816b0a47e79SJuan Quintela ;; 8178ff9cbf7Smalc --enable-mixemu) mixemu="yes" 8188ff9cbf7Smalc ;; 8195c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 8205c6c3a6cSChristoph Hellwig ;; 8215c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 8225c6c3a6cSChristoph Hellwig ;; 823758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 824758e8e38SVenkateswararao Jujjuri (JV) ;; 825758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 826758e8e38SVenkateswararao Jujjuri (JV) ;; 82777755340Sths --disable-blobs) blobs="no" 82877755340Sths ;; 8294a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 8304a19f1ecSpbrook ;; 831519175a2SAlex Barcelo --with-coroutine=*) coroutine="$optarg" 832519175a2SAlex Barcelo ;; 833a25dba17SJuan Quintela --disable-docs) docs="no" 83470ec5dc0SAnthony Liguori ;; 835a25dba17SJuan Quintela --enable-docs) docs="yes" 83683a3ab8bSJuan Quintela ;; 837d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 838d5970055SMichael S. Tsirkin ;; 839d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 840d5970055SMichael S. Tsirkin ;; 84120ff075bSMichael Walle --disable-opengl) opengl="no" 84220ff075bSMichael Walle ;; 84320ff075bSMichael Walle --enable-opengl) opengl="yes" 84420ff075bSMichael Walle ;; 845f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 846f27aaf4bSChristian Brunner ;; 847f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 848f27aaf4bSChristian Brunner ;; 8498c84cf11SSergei Trofimovich --disable-xfsctl) xfs="no" 8508c84cf11SSergei Trofimovich ;; 8518c84cf11SSergei Trofimovich --enable-xfsctl) xfs="yes" 8528c84cf11SSergei Trofimovich ;; 85336707144SAlon Levy --disable-smartcard) smartcard="no" 85436707144SAlon Levy ;; 85536707144SAlon Levy --enable-smartcard) smartcard="yes" 85636707144SAlon Levy ;; 857111a38b0SRobert Relyea --disable-smartcard-nss) smartcard_nss="no" 858111a38b0SRobert Relyea ;; 859111a38b0SRobert Relyea --enable-smartcard-nss) smartcard_nss="yes" 860111a38b0SRobert Relyea ;; 86169354a83SHans de Goede --disable-usb-redir) usb_redir="no" 86269354a83SHans de Goede ;; 86369354a83SHans de Goede --enable-usb-redir) usb_redir="yes" 86469354a83SHans de Goede ;; 8651ece9905SAlon Levy --disable-zlib-test) zlib="no" 8661ece9905SAlon Levy ;; 867d138cee9SMichael Roth --enable-guest-agent) guest_agent="yes" 868d138cee9SMichael Roth ;; 869d138cee9SMichael Roth --disable-guest-agent) guest_agent="no" 870d138cee9SMichael Roth ;; 8714b1c11fdSDaniel P. Berrange --enable-tools) want_tools="yes" 8724b1c11fdSDaniel P. Berrange ;; 8734b1c11fdSDaniel P. Berrange --disable-tools) want_tools="no" 8744b1c11fdSDaniel P. Berrange ;; 875f794573eSEduardo Otubo --enable-seccomp) seccomp="yes" 876f794573eSEduardo Otubo ;; 877f794573eSEduardo Otubo --disable-seccomp) seccomp="no" 878f794573eSEduardo Otubo ;; 879eb100396SBharata B Rao --disable-glusterfs) glusterfs="no" 880eb100396SBharata B Rao ;; 881eb100396SBharata B Rao --enable-glusterfs) glusterfs="yes" 882eb100396SBharata B Rao ;; 8837f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 8847f1559c6Sbalrog ;; 8857d13299dSbellard esac 8867d13299dSbellarddone 8877d13299dSbellard 88840293e58Sbellardcase "$cpu" in 8899b9c37c3SRichard Henderson sparc) 8900c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 8919b9c37c3SRichard Henderson QEMU_CFLAGS="-m32 -mcpu=ultrasparc $QEMU_CFLAGS" 8923142255cSblueswir1 ;; 893ed968ff1SJuan Quintela sparc64) 8940c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 8959b9c37c3SRichard Henderson QEMU_CFLAGS="-m64 -mcpu=ultrasparc $QEMU_CFLAGS" 8963142255cSblueswir1 ;; 89776d83bdeSths s390) 89828d7cc49SRichard Henderson QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS" 89928d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 90028d7cc49SRichard Henderson ;; 90128d7cc49SRichard Henderson s390x) 90228d7cc49SRichard Henderson QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS" 90328d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 90476d83bdeSths ;; 90540293e58Sbellard i386) 906a558ee17SJuan Quintela QEMU_CFLAGS="-m32 $QEMU_CFLAGS" 9070c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 9082b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 90940293e58Sbellard ;; 91040293e58Sbellard x86_64) 911a558ee17SJuan Quintela QEMU_CFLAGS="-m64 $QEMU_CFLAGS" 9120c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 9132b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 914379f6698SPaul Brook ;; 91530163d89SPeter Maydell # No special flags required for other host CPUs 9163142255cSblueswir1esac 9173142255cSblueswir1 91860e0df25SPeter Maydelldefault_target_list="" 91960e0df25SPeter Maydell 92060e0df25SPeter Maydell# these targets are portable 92160e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then 92260e0df25SPeter Maydell default_target_list="\ 92360e0df25SPeter Maydelli386-softmmu \ 92460e0df25SPeter Maydellx86_64-softmmu \ 92527cdad67SRichard Hendersonalpha-softmmu \ 92660e0df25SPeter Maydellarm-softmmu \ 92760e0df25SPeter Maydellcris-softmmu \ 92860e0df25SPeter Maydelllm32-softmmu \ 92960e0df25SPeter Maydellm68k-softmmu \ 93060e0df25SPeter Maydellmicroblaze-softmmu \ 93160e0df25SPeter Maydellmicroblazeel-softmmu \ 93260e0df25SPeter Maydellmips-softmmu \ 93360e0df25SPeter Maydellmipsel-softmmu \ 93460e0df25SPeter Maydellmips64-softmmu \ 93560e0df25SPeter Maydellmips64el-softmmu \ 936e67db06eSJia Liuor32-softmmu \ 93760e0df25SPeter Maydellppc-softmmu \ 93860e0df25SPeter Maydellppcemb-softmmu \ 93960e0df25SPeter Maydellppc64-softmmu \ 94060e0df25SPeter Maydellsh4-softmmu \ 94160e0df25SPeter Maydellsh4eb-softmmu \ 94260e0df25SPeter Maydellsparc-softmmu \ 94360e0df25SPeter Maydellsparc64-softmmu \ 9440f3301d4SAlexander Grafs390x-softmmu \ 945cfa550c6SMax Filippovxtensa-softmmu \ 946cfa550c6SMax Filippovxtensaeb-softmmu \ 9474f23a1e6SGuan Xuetaounicore32-softmmu \ 94860e0df25SPeter Maydell" 94960e0df25SPeter Maydellfi 95060e0df25SPeter Maydell# the following are Linux specific 95160e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then 95260e0df25SPeter Maydell default_target_list="${default_target_list}\ 95360e0df25SPeter Maydelli386-linux-user \ 95460e0df25SPeter Maydellx86_64-linux-user \ 95560e0df25SPeter Maydellalpha-linux-user \ 95660e0df25SPeter Maydellarm-linux-user \ 95760e0df25SPeter Maydellarmeb-linux-user \ 95860e0df25SPeter Maydellcris-linux-user \ 95960e0df25SPeter Maydellm68k-linux-user \ 96060e0df25SPeter Maydellmicroblaze-linux-user \ 96160e0df25SPeter Maydellmicroblazeel-linux-user \ 96260e0df25SPeter Maydellmips-linux-user \ 96360e0df25SPeter Maydellmipsel-linux-user \ 964d962783eSJia Liuor32-linux-user \ 96560e0df25SPeter Maydellppc-linux-user \ 96660e0df25SPeter Maydellppc64-linux-user \ 96760e0df25SPeter Maydellppc64abi32-linux-user \ 96860e0df25SPeter Maydellsh4-linux-user \ 96960e0df25SPeter Maydellsh4eb-linux-user \ 97060e0df25SPeter Maydellsparc-linux-user \ 97160e0df25SPeter Maydellsparc64-linux-user \ 97260e0df25SPeter Maydellsparc32plus-linux-user \ 97360e0df25SPeter Maydellunicore32-linux-user \ 9740f3301d4SAlexander Grafs390x-linux-user \ 97560e0df25SPeter Maydell" 97660e0df25SPeter Maydellfi 97760e0df25SPeter Maydell# the following are BSD specific 97860e0df25SPeter Maydellif [ "$bsd_user" = "yes" ] ; then 97960e0df25SPeter Maydell default_target_list="${default_target_list}\ 98060e0df25SPeter Maydelli386-bsd-user \ 98160e0df25SPeter Maydellx86_64-bsd-user \ 98260e0df25SPeter Maydellsparc-bsd-user \ 98360e0df25SPeter Maydellsparc64-bsd-user \ 98460e0df25SPeter Maydell" 98560e0df25SPeter Maydellfi 98660e0df25SPeter Maydell 987af5db58eSpbrookif test x"$show_help" = x"yes" ; then 988af5db58eSpbrookcat << EOF 989af5db58eSpbrook 990af5db58eSpbrookUsage: configure [options] 991af5db58eSpbrookOptions: [defaults in brackets after descriptions] 992af5db58eSpbrook 993af5db58eSpbrookEOF 994af5db58eSpbrookecho "Standard options:" 995af5db58eSpbrookecho " --help print this message" 996af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 997af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 998af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 99960e0df25SPeter Maydellecho " --target-list=LIST set target list (default: build everything)" 100060e0df25SPeter Maydellecho "Available targets: $default_target_list" | \ 100160e0df25SPeter Maydell fold -s -w 53 | sed -e 's/^/ /' 1002af5db58eSpbrookecho "" 1003af5db58eSpbrookecho "Advanced options (experts only):" 1004af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 1005af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 1006af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 10070bfe8cc0SPaolo Bonziniecho " --host-cc=CC use C compiler CC [$host_cc] for code run at" 10080bfe8cc0SPaolo Bonziniecho " build time" 10093c4a4d0dSPeter Maydellecho " --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]" 1010a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 1011e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 1012af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 10136a882643Spbrookecho " --install=INSTALL use specified install [$install]" 1014c886edfbSBlue Swirlecho " --python=PYTHON use specified python [$python]" 1015e2d8830eSBradecho " --smbd=SMBD use specified smbd [$smbd]" 1016af5db58eSpbrookecho " --static enable static build [$static]" 10170b24e75fSPaolo Bonziniecho " --mandir=PATH install man pages in PATH" 1018023d3d67SEduardo Habkostecho " --datadir=PATH install firmware in PATH$confsuffix" 1019023d3d67SEduardo Habkostecho " --docdir=PATH install documentation in PATH$confsuffix" 10200b24e75fSPaolo Bonziniecho " --bindir=PATH install binaries in PATH" 1021023d3d67SEduardo Habkostecho " --sysconfdir=PATH install config in PATH$confsuffix" 1022785c23aeSLuiz Capitulinoecho " --localstatedir=PATH install local state in PATH" 10232ae4748fSStefan Weilecho " --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]" 1024f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 1025f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 102609695a4aSStefan Weilecho " --enable-debug enable common debug build options" 1027890b1658Saliguoriecho " --enable-sparse enable sparse checker" 1028890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 10291625af87Saliguoriecho " --disable-strip disable stripping binaries" 103085aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 1031fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 1032c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 1033983eef5aSMeador Ingeecho " --disable-virtfs disable VirtFS" 1034983eef5aSMeador Ingeecho " --enable-virtfs enable VirtFS" 1035821601eaSJes Sorensenecho " --disable-vnc disable VNC" 1036821601eaSJes Sorensenecho " --enable-vnc enable VNC" 103714821030SPavel Borzenkovecho " --disable-cocoa disable Cocoa (Mac OS X only)" 103814821030SPavel Borzenkovecho " --enable-cocoa enable Cocoa (default on Mac OS X)" 1039c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 1040c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 10414c9b53e3Smalcecho " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" 10424c9b53e3Smalcecho " Available cards: $audio_possible_cards" 1043eb852011SMarkus Armbrusterecho " --block-drv-whitelist=L set block driver whitelist" 1044eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 10458ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 1046e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 1047fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 1048eb6fda0fSAnthony PERARDecho " --disable-xen-pci-passthrough" 1049eb6fda0fSAnthony PERARDecho " --enable-xen-pci-passthrough" 10502e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 10514ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 10528d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 10531be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 10542f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 1055ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 10562f6f5c7aSCorentin Charyecho " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" 10572f6f5c7aSCorentin Charyecho " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" 105896763cf9SCorentin Charyecho " --disable-vnc-png disable PNG compression for VNC server (default)" 1059efe556adSCorentin Charyecho " --enable-vnc-png enable PNG compression for VNC server" 1060af896aaaSpbrookecho " --disable-curses disable curses output" 1061c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 1062769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 1063788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 10642df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 10652df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 1066fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 1067a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 10686093d3d4SPeter Maydellecho " --disable-slirp disable SLIRP userspace network connectivity" 10697ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 1070b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 10719195b2c2SStefan Weilecho " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)" 1072bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 1073e5934d33SAndre Przywaraecho " --enable-nptl enable usermode NPTL support" 1074af5db58eSpbrookecho " --enable-system enable all system emulation targets" 1075af5db58eSpbrookecho " --disable-system disable all system emulation targets" 10760953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 10770953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 1078831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 1079831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 108084778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 108184778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 1082379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 1083379f6698SPaul Brookecho " emulation targets" 1084379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 108540d6444eSAvi Kivityecho " --enable-pie build Position Independent Executables" 108640d6444eSAvi Kivityecho " --disable-pie do not build Position Independent Executables" 1087af5db58eSpbrookecho " --fmod-lib path to FMOD library" 1088af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 10892f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 1090c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 1091235e510cS陳韋任echo " --cpu=CPU Build for host CPU [$cpu]" 10923142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 1093ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 1094ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 1095e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 1096dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 10975c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 10985c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 109947e98658SCorey Bryantecho " --disable-cap-ng disable libcap-ng support" 110047e98658SCorey Bryantecho " --enable-cap-ng enable libcap-ng support" 1101758e8e38SVenkateswararao Jujjuri (JV)echo " --disable-attr disables attr and xattr support" 1102758e8e38SVenkateswararao Jujjuri (JV)echo " --enable-attr enable attr and xattr support" 110377755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 1104d2807bc9SDirk Ullrichecho " --enable-docs enable documentation build" 1105d2807bc9SDirk Ullrichecho " --disable-docs disable documentation build" 1106d5970055SMichael S. Tsirkinecho " --disable-vhost-net disable vhost-net acceleration support" 1107d5970055SMichael S. Tsirkinecho " --enable-vhost-net enable vhost-net acceleration support" 1108320fba2aSFabien Chouteauecho " --enable-trace-backend=B Set trace backend" 1109650ab98dSLluís Vilanovaecho " Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends) 111074242e0fSPaolo Bonziniecho " --with-trace-file=NAME Full PATH,NAME of file to store traces" 11119410b56cSPrerna Saxenaecho " Default:trace-<pid>" 1112cd4ec0b4SGerd Hoffmannecho " --disable-spice disable spice" 1113cd4ec0b4SGerd Hoffmannecho " --enable-spice enable spice" 1114f27aaf4bSChristian Brunnerecho " --enable-rbd enable building the rados block device (rbd)" 1115c589b249SRonnie Sahlbergecho " --disable-libiscsi disable iscsi support" 1116c589b249SRonnie Sahlbergecho " --enable-libiscsi enable iscsi support" 111736707144SAlon Levyecho " --disable-smartcard disable smartcard support" 111836707144SAlon Levyecho " --enable-smartcard enable smartcard support" 1119111a38b0SRobert Relyeaecho " --disable-smartcard-nss disable smartcard nss support" 1120111a38b0SRobert Relyeaecho " --enable-smartcard-nss enable smartcard nss support" 112169354a83SHans de Goedeecho " --disable-usb-redir disable usb network redirection support" 112269354a83SHans de Goedeecho " --enable-usb-redir enable usb network redirection support" 1123d138cee9SMichael Rothecho " --disable-guest-agent disable building of the QEMU Guest Agent" 1124d138cee9SMichael Rothecho " --enable-guest-agent enable building of the QEMU Guest Agent" 1125f794573eSEduardo Otuboecho " --disable-seccomp disable seccomp support" 1126f794573eSEduardo Otuboecho " --enable-seccomp enables seccomp support" 1127519175a2SAlex Barceloecho " --with-coroutine=BACKEND coroutine backend. Supported options:" 1128fe91bfa8SAlex Barceloecho " gthread, ucontext, sigaltstack, windows" 1129eb100396SBharata B Raoecho " --enable-glusterfs enable GlusterFS backend" 1130eb100396SBharata B Raoecho " --disable-glusterfs disable GlusterFS backend" 1131af5db58eSpbrookecho "" 11325bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 1133af5db58eSpbrookexit 1 1134af5db58eSpbrookfi 1135af5db58eSpbrook 1136359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just 1137359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported. 1138359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then 1139359bc95dSPeter Maydell if test "$tcg_interpreter" = "yes" ; then 1140359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" 1141359bc95dSPeter Maydell ARCH=tci 1142359bc95dSPeter Maydell else 1143359bc95dSPeter Maydell echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter" 1144359bc95dSPeter Maydell exit 1 1145359bc95dSPeter Maydell fi 1146359bc95dSPeter Maydellfi 1147359bc95dSPeter Maydell 11488d05095cSPaolo Bonzini# check that the C compiler works. 11498d05095cSPaolo Bonzinicat > $TMPC <<EOF 115075cafad7SStefan Weilint main(void) { return 0; } 11518d05095cSPaolo BonziniEOF 11528d05095cSPaolo Bonzini 11538d05095cSPaolo Bonziniif compile_object ; then 11548d05095cSPaolo Bonzini : C compiler works ok 11558d05095cSPaolo Bonzinielse 11568d05095cSPaolo Bonzini echo "ERROR: \"$cc\" either does not exist or does not work" 11578d05095cSPaolo Bonzini exit 1 11588d05095cSPaolo Bonzinifi 11598d05095cSPaolo Bonzini 1160417c9d72SAlexander Graf# Consult white-list to determine whether to enable werror 1161417c9d72SAlexander Graf# by default. Only enable by default for git builds 1162417c9d72SAlexander Grafz_version=`cut -f3 -d. $source_path/VERSION` 1163417c9d72SAlexander Graf 1164417c9d72SAlexander Grafif test -z "$werror" ; then 1165417c9d72SAlexander Graf if test "$z_version" = "50" -a \ 1166417c9d72SAlexander Graf "$linux" = "yes" ; then 1167417c9d72SAlexander Graf werror="yes" 1168417c9d72SAlexander Graf else 1169417c9d72SAlexander Graf werror="no" 1170417c9d72SAlexander Graf fi 1171417c9d72SAlexander Graffi 1172417c9d72SAlexander Graf 11738d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 11748d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 11758d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 1176f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags" 1177c1556a81SPeter Maydellgcc_flags="-Wno-initializer-overrides $gcc_flags" 11786ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would 11796ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due 11806ca026cbSPeter Maydell# to -Werror this would just silently disable some features, 11816ca026cbSPeter Maydell# so it's too error prone. 11828d05095cSPaolo Bonzinicat > $TMPC << EOF 11838d05095cSPaolo Bonziniint main(void) { return 0; } 11848d05095cSPaolo BonziniEOF 11858d05095cSPaolo Bonzinifor flag in $gcc_flags; do 1186a1d29d6cSPeter Maydell # Use the positive sense of the flag when testing for -Wno-wombat 1187a1d29d6cSPeter Maydell # support (gcc will happily accept the -Wno- form of unknown 1188a1d29d6cSPeter Maydell # warning options). 1189a1d29d6cSPeter Maydell optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')" 1190a1d29d6cSPeter Maydell if compile_prog "-Werror $optflag" "" ; then 11918d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 11928d05095cSPaolo Bonzini fi 11938d05095cSPaolo Bonzinidone 11948d05095cSPaolo Bonzini 1195cbdd1999SPaolo Bonzini# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and 1196cbdd1999SPaolo Bonzini# large functions that use global variables. The bug is in all releases of 1197cbdd1999SPaolo Bonzini# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in 1198cbdd1999SPaolo Bonzini# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013. 1199cbdd1999SPaolo Bonzinicat > $TMPC << EOF 1200cbdd1999SPaolo Bonzini#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2)) 1201cbdd1999SPaolo Bonziniint main(void) { return 0; } 1202cbdd1999SPaolo Bonzini#else 1203cbdd1999SPaolo Bonzini#error No bug in this compiler. 1204cbdd1999SPaolo Bonzini#endif 1205cbdd1999SPaolo BonziniEOF 1206cbdd1999SPaolo Bonziniif compile_prog "-Werror -fno-gcse" "" ; then 1207cbdd1999SPaolo Bonzini TRANSLATE_OPT_CFLAGS=-fno-gcse 1208cbdd1999SPaolo Bonzinifi 1209cbdd1999SPaolo Bonzini 121040d6444eSAvi Kivityif test "$static" = "yes" ; then 121140d6444eSAvi Kivity if test "$pie" = "yes" ; then 121240d6444eSAvi Kivity echo "static and pie are mutually incompatible" 121340d6444eSAvi Kivity exit 1 121440d6444eSAvi Kivity else 121540d6444eSAvi Kivity pie="no" 121640d6444eSAvi Kivity fi 121740d6444eSAvi Kivityfi 121840d6444eSAvi Kivity 121940d6444eSAvi Kivityif test "$pie" = ""; then 122040d6444eSAvi Kivity case "$cpu-$targetos" in 1221f9db31a2SBrad i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD) 122240d6444eSAvi Kivity ;; 122340d6444eSAvi Kivity *) 122440d6444eSAvi Kivity pie="no" 122540d6444eSAvi Kivity ;; 122640d6444eSAvi Kivity esac 122740d6444eSAvi Kivityfi 122840d6444eSAvi Kivity 122940d6444eSAvi Kivityif test "$pie" != "no" ; then 123040d6444eSAvi Kivity cat > $TMPC << EOF 123121d4a791SAvi Kivity 123221d4a791SAvi Kivity#ifdef __linux__ 123321d4a791SAvi Kivity# define THREAD __thread 123421d4a791SAvi Kivity#else 123521d4a791SAvi Kivity# define THREAD 123621d4a791SAvi Kivity#endif 123721d4a791SAvi Kivity 123821d4a791SAvi Kivitystatic THREAD int tls_var; 123921d4a791SAvi Kivity 124021d4a791SAvi Kivityint main(void) { return tls_var; } 124121d4a791SAvi Kivity 124240d6444eSAvi KivityEOF 124340d6444eSAvi Kivity if compile_prog "-fPIE -DPIE" "-pie"; then 124440d6444eSAvi Kivity QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" 124540d6444eSAvi Kivity LDFLAGS="-pie $LDFLAGS" 124640d6444eSAvi Kivity pie="yes" 124740d6444eSAvi Kivity if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then 124840d6444eSAvi Kivity LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" 124940d6444eSAvi Kivity fi 125040d6444eSAvi Kivity else 125140d6444eSAvi Kivity if test "$pie" = "yes"; then 125240d6444eSAvi Kivity echo "PIE not available due to missing toolchain support" 125340d6444eSAvi Kivity exit 1 125440d6444eSAvi Kivity else 125540d6444eSAvi Kivity echo "Disabling PIE due to missing toolchain support" 125640d6444eSAvi Kivity pie="no" 125740d6444eSAvi Kivity fi 125840d6444eSAvi Kivity fi 125940d6444eSAvi Kivityfi 126040d6444eSAvi Kivity 1261ec530c81Sbellard# 1262ec530c81Sbellard# Solaris specific configure tool chain decisions 1263ec530c81Sbellard# 1264ec530c81Sbellardif test "$solaris" = "yes" ; then 12656792aa11SLoïc Minier if has $install; then 12666792aa11SLoïc Minier : 12676792aa11SLoïc Minier else 1268ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 1269ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 1270ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 1271ec530c81Sbellard exit 1 1272ec530c81Sbellard fi 12736792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 1274ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 1275ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 1276ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 1277ec530c81Sbellard exit 1 1278ec530c81Sbellard fi 12796792aa11SLoïc Minier if has ar; then 12806792aa11SLoïc Minier : 12816792aa11SLoïc Minier else 1282ec530c81Sbellard echo "Error: No path includes ar" 1283ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 1284ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 1285ec530c81Sbellard fi 1286ec530c81Sbellard exit 1 1287ec530c81Sbellard fi 1288ec530c81Sbellardfi 1289ec530c81Sbellard 12907a3fc891SSebastian Herbsztif ! has $python; then 1291c886edfbSBlue Swirl echo "Python not found. Use --python=/path/to/python" 1292c886edfbSBlue Swirl exit 1 1293c886edfbSBlue Swirlfi 1294c886edfbSBlue Swirl 12956ccea1e4SPeter Maydell# Note that if the Python conditional here evaluates True we will exit 12966ccea1e4SPeter Maydell# with status 1 which is a shell 'false' value. 1297e120d449SStefan Hajnocziif ! "$python" -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then 1298e120d449SStefan Hajnoczi echo "Cannot use '$python', Python 2.4 or later is required." 1299e120d449SStefan Hajnoczi echo "Note that Python 3 or later is not yet supported." 1300e120d449SStefan Hajnoczi echo "Use --python=/path/to/python to specify a supported Python." 13016ccea1e4SPeter Maydell exit 1 13026ccea1e4SPeter Maydellfi 13036ccea1e4SPeter Maydell 1304afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then 1305121afa9eSAnthony Liguori target_list="$default_target_list" 1306121afa9eSAnthony Liguorielse 1307121afa9eSAnthony Liguori target_list=`echo "$target_list" | sed -e 's/,/ /g'` 13085327cf48Sbellardfi 1309f55fe278SPaolo Bonzini# see if system emulation was really requested 1310f55fe278SPaolo Bonzinicase " $target_list " in 1311f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1312f55fe278SPaolo Bonzini ;; 1313f55fe278SPaolo Bonzini *) softmmu=no 1314f55fe278SPaolo Bonzini ;; 1315f55fe278SPaolo Bonziniesac 13165327cf48Sbellard 1317249247c9SJuan Quintelafeature_not_found() { 1318249247c9SJuan Quintela feature=$1 1319249247c9SJuan Quintela 1320249247c9SJuan Quintela echo "ERROR" 1321249247c9SJuan Quintela echo "ERROR: User requested feature $feature" 13229332f6a2SSebastian Herbszt echo "ERROR: configure was not able to find it" 1323249247c9SJuan Quintela echo "ERROR" 1324249247c9SJuan Quintela exit 1; 1325249247c9SJuan Quintela} 1326249247c9SJuan Quintela 13277d13299dSbellardif test -z "$cross_prefix" ; then 13287d13299dSbellard 13297d13299dSbellard# --- 13307d13299dSbellard# big/little endian test 13317d13299dSbellardcat > $TMPC << EOF 13327d13299dSbellard#include <inttypes.h> 1333abab1a0fSStefan Weilint main(void) { 13347d13299dSbellard volatile uint32_t i=0x01234567; 13357d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 13367d13299dSbellard} 13377d13299dSbellardEOF 13387d13299dSbellard 133952166aa0SJuan Quintelaif compile_prog "" "" ; then 13407d13299dSbellard$TMPE && bigendian="yes" 13417d13299dSbellardelse 13427d13299dSbellardecho big/little test failed 13437d13299dSbellardfi 13447d13299dSbellard 13457d13299dSbellardelse 13467d13299dSbellard 13477d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 1348ea8f20f8SJuan Quintelacase "$cpu" in 134921d89f84SPeter Maydell arm) 135021d89f84SPeter Maydell # ARM can be either way; ask the compiler which one we are 135121d89f84SPeter Maydell if check_define __ARMEB__; then 135221d89f84SPeter Maydell bigendian=yes 135321d89f84SPeter Maydell fi 135421d89f84SPeter Maydell ;; 135521d89f84SPeter Maydell hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 1356ea8f20f8SJuan Quintela bigendian=yes 1357ea8f20f8SJuan Quintela ;; 1358ea8f20f8SJuan Quintelaesac 13597d13299dSbellard 13607d13299dSbellardfi 13617d13299dSbellard 1362b0a47e79SJuan Quintela########################################## 1363b0a47e79SJuan Quintela# NPTL probe 1364b0a47e79SJuan Quintela 1365b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then 1366bd0c5661Spbrook cat > $TMPC <<EOF 1367bd0c5661Spbrook#include <sched.h> 136830813ceaSpbrook#include <linux/futex.h> 1369182eacc0SStefan Weilint main(void) { 1370bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1371bd0c5661Spbrook#error bork 1372bd0c5661Spbrook#endif 1373182eacc0SStefan Weil return 0; 1374bd0c5661Spbrook} 1375bd0c5661SpbrookEOF 1376bd0c5661Spbrook 137752166aa0SJuan Quintela if compile_object ; then 1378b0a47e79SJuan Quintela nptl=yes 1379bd0c5661Spbrook else 1380b0a47e79SJuan Quintela if test "$nptl" = "yes" ; then 1381b0a47e79SJuan Quintela feature_not_found "nptl" 1382b0a47e79SJuan Quintela fi 1383b0a47e79SJuan Quintela nptl=no 1384b0a47e79SJuan Quintela fi 1385bd0c5661Spbrookfi 1386bd0c5661Spbrook 138711d9f695Sbellard########################################## 1388ac62922eSbalrog# zlib check 1389ac62922eSbalrog 13901ece9905SAlon Levyif test "$zlib" != "no" ; then 1391ac62922eSbalrog cat > $TMPC << EOF 1392ac62922eSbalrog#include <zlib.h> 1393ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1394ac62922eSbalrogEOF 139552166aa0SJuan Quintela if compile_prog "" "-lz" ; then 1396ac62922eSbalrog : 1397ac62922eSbalrog else 1398ac62922eSbalrog echo 1399ac62922eSbalrog echo "Error: zlib check failed" 1400ac62922eSbalrog echo "Make sure to have the zlib libs and headers installed." 1401ac62922eSbalrog echo 1402ac62922eSbalrog exit 1 1403ac62922eSbalrog fi 14041ece9905SAlon Levyfi 1405ac62922eSbalrog 1406ac62922eSbalrog########################################## 1407f794573eSEduardo Otubo# libseccomp check 1408f794573eSEduardo Otubo 1409f794573eSEduardo Otuboif test "$seccomp" != "no" ; then 14102c5c4451SBlue Swirl if $pkg_config --atleast-version=1.0.0 libseccomp --modversion >/dev/null 2>&1; then 1411f794573eSEduardo Otubo LIBS=`$pkg_config --libs libseccomp` 1412f794573eSEduardo Otubo seccomp="yes" 1413f794573eSEduardo Otubo else 1414f794573eSEduardo Otubo if test "$seccomp" = "yes"; then 1415f794573eSEduardo Otubo feature_not_found "libseccomp" 1416f794573eSEduardo Otubo fi 1417e84d5956SYann E. MORIN seccomp="no" 1418f794573eSEduardo Otubo fi 1419f794573eSEduardo Otubofi 1420f794573eSEduardo Otubo########################################## 1421e37630caSaliguori# xen probe 1422e37630caSaliguori 1423fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1424b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1425d5b93ddfSAnthony PERARD 142650ced5b3SStefan Weil # First we test whether Xen headers and libraries are available. 142750ced5b3SStefan Weil # If no, we are done and there is no Xen support. 142850ced5b3SStefan Weil # If yes, more tests are run to detect the Xen version. 142950ced5b3SStefan Weil 143050ced5b3SStefan Weil # Xen (any) 143150ced5b3SStefan Weil cat > $TMPC <<EOF 143250ced5b3SStefan Weil#include <xenctrl.h> 143350ced5b3SStefan Weilint main(void) { 143450ced5b3SStefan Weil return 0; 143550ced5b3SStefan Weil} 143650ced5b3SStefan WeilEOF 143750ced5b3SStefan Weil if ! compile_prog "" "$xen_libs" ; then 143850ced5b3SStefan Weil # Xen not found 143950ced5b3SStefan Weil if test "$xen" = "yes" ; then 144050ced5b3SStefan Weil feature_not_found "xen" 144150ced5b3SStefan Weil fi 144250ced5b3SStefan Weil xen=no 144350ced5b3SStefan Weil 1444d5b93ddfSAnthony PERARD # Xen unstable 144569deef08SPeter Maydell elif 144669deef08SPeter Maydell cat > $TMPC <<EOF && 1447e37630caSaliguori#include <xenctrl.h> 1448e108a3c1SAnthony PERARD#include <xenstore.h> 1449d5b93ddfSAnthony PERARD#include <stdint.h> 1450d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1451d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1452d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1453d5b93ddfSAnthony PERARD#endif 1454d5b93ddfSAnthony PERARDint main(void) { 1455d5b93ddfSAnthony PERARD xc_interface *xc; 1456d5b93ddfSAnthony PERARD xs_daemon_open(); 1457d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 1458d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1459d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 1460b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 14618688e065SStefano Stabellini xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000); 14628688e065SStefano Stabellini return 0; 14638688e065SStefano Stabellini} 14648688e065SStefano StabelliniEOF 14658688e065SStefano Stabellini compile_prog "" "$xen_libs" 146669deef08SPeter Maydell then 14678688e065SStefano Stabellini xen_ctrl_version=420 14688688e065SStefano Stabellini xen=yes 14698688e065SStefano Stabellini 147069deef08SPeter Maydell elif 147169deef08SPeter Maydell cat > $TMPC <<EOF && 14728688e065SStefano Stabellini#include <xenctrl.h> 14738688e065SStefano Stabellini#include <xs.h> 14748688e065SStefano Stabellini#include <stdint.h> 14758688e065SStefano Stabellini#include <xen/hvm/hvm_info_table.h> 14768688e065SStefano Stabellini#if !defined(HVM_MAX_VCPUS) 14778688e065SStefano Stabellini# error HVM_MAX_VCPUS not defined 14788688e065SStefano Stabellini#endif 14798688e065SStefano Stabelliniint main(void) { 14808688e065SStefano Stabellini xs_daemon_open(); 14819b4c0b56SPeter Maydell xc_interface_open(0, 0, 0); 14828688e065SStefano Stabellini xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 14838688e065SStefano Stabellini xc_gnttab_open(NULL, 0); 14848688e065SStefano Stabellini xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 1485d5b93ddfSAnthony PERARD return 0; 1486d5b93ddfSAnthony PERARD} 1487e37630caSaliguoriEOF 148850ced5b3SStefan Weil compile_prog "" "$xen_libs" 148969deef08SPeter Maydell then 1490d5b93ddfSAnthony PERARD xen_ctrl_version=410 1491fc321b4bSJuan Quintela xen=yes 1492d5b93ddfSAnthony PERARD 1493d5b93ddfSAnthony PERARD # Xen 4.0.0 149469deef08SPeter Maydell elif 149569deef08SPeter Maydell cat > $TMPC <<EOF && 1496d5b93ddfSAnthony PERARD#include <xenctrl.h> 1497d5b93ddfSAnthony PERARD#include <xs.h> 1498d5b93ddfSAnthony PERARD#include <stdint.h> 1499d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1500d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1501d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1502d5b93ddfSAnthony PERARD#endif 1503d5b93ddfSAnthony PERARDint main(void) { 1504b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1505b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1506b87de24eSAnthony PERARD }; 1507d5b93ddfSAnthony PERARD xs_daemon_open(); 1508d5b93ddfSAnthony PERARD xc_interface_open(); 1509d5b93ddfSAnthony PERARD xc_gnttab_open(); 1510d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1511b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1512d5b93ddfSAnthony PERARD return 0; 1513d5b93ddfSAnthony PERARD} 1514d5b93ddfSAnthony PERARDEOF 1515d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 151669deef08SPeter Maydell then 1517d5b93ddfSAnthony PERARD xen_ctrl_version=400 1518d5b93ddfSAnthony PERARD xen=yes 1519d5b93ddfSAnthony PERARD 1520b87de24eSAnthony PERARD # Xen 3.4.0 152169deef08SPeter Maydell elif 152269deef08SPeter Maydell cat > $TMPC <<EOF && 1523b87de24eSAnthony PERARD#include <xenctrl.h> 1524b87de24eSAnthony PERARD#include <xs.h> 1525b87de24eSAnthony PERARDint main(void) { 1526b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1527b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1528b87de24eSAnthony PERARD }; 1529b87de24eSAnthony PERARD xs_daemon_open(); 1530b87de24eSAnthony PERARD xc_interface_open(); 1531b87de24eSAnthony PERARD xc_gnttab_open(); 1532b87de24eSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1533b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1534b87de24eSAnthony PERARD return 0; 1535b87de24eSAnthony PERARD} 1536b87de24eSAnthony PERARDEOF 1537b87de24eSAnthony PERARD compile_prog "" "$xen_libs" 153869deef08SPeter Maydell then 1539b87de24eSAnthony PERARD xen_ctrl_version=340 1540b87de24eSAnthony PERARD xen=yes 1541b87de24eSAnthony PERARD 1542b87de24eSAnthony PERARD # Xen 3.3.0 154369deef08SPeter Maydell elif 154469deef08SPeter Maydell cat > $TMPC <<EOF && 1545d5b93ddfSAnthony PERARD#include <xenctrl.h> 1546d5b93ddfSAnthony PERARD#include <xs.h> 1547d5b93ddfSAnthony PERARDint main(void) { 1548d5b93ddfSAnthony PERARD xs_daemon_open(); 1549d5b93ddfSAnthony PERARD xc_interface_open(); 1550d5b93ddfSAnthony PERARD xc_gnttab_open(); 1551d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1552d5b93ddfSAnthony PERARD return 0; 1553d5b93ddfSAnthony PERARD} 1554d5b93ddfSAnthony PERARDEOF 1555d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 155669deef08SPeter Maydell then 1557d5b93ddfSAnthony PERARD xen_ctrl_version=330 1558d5b93ddfSAnthony PERARD xen=yes 1559d5b93ddfSAnthony PERARD 156050ced5b3SStefan Weil # Xen version unsupported 1561e37630caSaliguori else 1562fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 156350ced5b3SStefan Weil feature_not_found "xen (unsupported version)" 1564fc321b4bSJuan Quintela fi 1565fc321b4bSJuan Quintela xen=no 1566e37630caSaliguori fi 1567d5b93ddfSAnthony PERARD 1568d5b93ddfSAnthony PERARD if test "$xen" = yes; then 1569d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 1570d5b93ddfSAnthony PERARD fi 1571e37630caSaliguorifi 1572e37630caSaliguori 1573eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then 1574eb6fda0fSAnthony PERARD if test "$xen" = "yes" && test "$linux" = "yes" && 1575eb6fda0fSAnthony PERARD test "$xen_ctrl_version" -ge 340; then 1576eb6fda0fSAnthony PERARD xen_pci_passthrough=yes 1577eb6fda0fSAnthony PERARD else 1578eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = "yes"; then 1579eb6fda0fSAnthony PERARD echo "ERROR" 1580eb6fda0fSAnthony PERARD echo "ERROR: User requested feature Xen PCI Passthrough" 1581eb6fda0fSAnthony PERARD echo "ERROR: but this feature require /sys from Linux" 1582eb6fda0fSAnthony PERARD if test "$xen_ctrl_version" -lt 340; then 1583eb6fda0fSAnthony PERARD echo "ERROR: This feature does not work with Xen 3.3" 1584eb6fda0fSAnthony PERARD fi 1585eb6fda0fSAnthony PERARD echo "ERROR" 1586eb6fda0fSAnthony PERARD exit 1; 1587eb6fda0fSAnthony PERARD fi 1588eb6fda0fSAnthony PERARD xen_pci_passthrough=no 1589eb6fda0fSAnthony PERARD fi 1590eb6fda0fSAnthony PERARDfi 1591eb6fda0fSAnthony PERARD 1592e37630caSaliguori########################################## 1593a8bd70adSPaolo Bonzini# pkg-config probe 1594f91672e5SPaolo Bonzini 159517884d7bSSergei Trofimovichif ! has "$pkg_config_exe"; then 159617884d7bSSergei Trofimovich echo "Error: pkg-config binary '$pkg_config_exe' not found" 1597a213fcb2SPeter Maydell exit 1 1598f91672e5SPaolo Bonzinifi 1599f91672e5SPaolo Bonzini 1600f91672e5SPaolo Bonzini########################################## 160144dc0ca3SAlon Levy# libtool probe 160244dc0ca3SAlon Levy 16033f534581SBradif ! has $libtool; then 160444dc0ca3SAlon Levy libtool= 160544dc0ca3SAlon Levyfi 160644dc0ca3SAlon Levy 160744dc0ca3SAlon Levy########################################## 1608dfffc653SJuan Quintela# Sparse probe 1609dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 16100dba6195SLoïc Minier if has cgcc; then 1611dfffc653SJuan Quintela sparse=yes 1612dfffc653SJuan Quintela else 1613dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 1614dfffc653SJuan Quintela feature_not_found "sparse" 1615dfffc653SJuan Quintela fi 1616dfffc653SJuan Quintela sparse=no 1617dfffc653SJuan Quintela fi 1618dfffc653SJuan Quintelafi 1619dfffc653SJuan Quintela 1620dfffc653SJuan Quintela########################################## 162111d9f695Sbellard# SDL probe 162211d9f695Sbellard 16233ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 16243ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 16253ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then 16263ec87ffeSPaolo Bonzini sdl_config=sdl-config 16273ec87ffeSPaolo Bonzinifi 16283ec87ffeSPaolo Bonzini 16293ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then 1630a8bd70adSPaolo Bonzini sdlconfig="$pkg_config sdl" 1631fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 16323ec87ffeSPaolo Bonzinielif has ${sdl_config}; then 16333ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 16349316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1635a0dfd8a4SLoïc Minierelse 1636a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 1637a0dfd8a4SLoïc Minier feature_not_found "sdl" 1638a0dfd8a4SLoïc Minier fi 1639a0dfd8a4SLoïc Minier sdl=no 16409316f803SPaolo Bonzinifi 164129e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 16423ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 16433ec87ffeSPaolo Bonzinifi 164411d9f695Sbellard 16459316f803SPaolo Bonzinisdl_too_old=no 1646c4198157SJuan Quintelaif test "$sdl" != "no" ; then 164711d9f695Sbellard cat > $TMPC << EOF 164811d9f695Sbellard#include <SDL.h> 164911d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 165011d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 165111d9f695SbellardEOF 16529316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 165374f42e18STeLeMan if test "$static" = "yes" ; then 165474f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 165574f42e18STeLeMan else 16569316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 165774f42e18STeLeMan fi 165852166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 165911d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 166011d9f695Sbellard sdl_too_old=yes 166111d9f695Sbellard else 1662fd677642Sths if test "$cocoa" = "no" ; then 166311d9f695Sbellard sdl=yes 166411d9f695Sbellard fi 1665fd677642Sths fi 16667c1f25b4Sbellard 166767c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 16681ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 166967c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 1670f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 1671f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 167211d9f695Sbellard fi 167352166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 16741ac88f28SJuan Quintela : 16751ac88f28SJuan Quintela else 16761ac88f28SJuan Quintela sdl=no 16777c1f25b4Sbellard fi 16787c1f25b4Sbellard fi # static link 1679c4198157SJuan Quintela else # sdl not found 1680c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1681c4198157SJuan Quintela feature_not_found "sdl" 1682c4198157SJuan Quintela fi 1683c4198157SJuan Quintela sdl=no 16847c1f25b4Sbellard fi # sdl compile test 1685fd677642Sthsfi 168611d9f695Sbellard 16875368a422Saliguoriif test "$sdl" = "yes" ; then 16885368a422Saliguori cat > $TMPC <<EOF 16895368a422Saliguori#include <SDL.h> 16905368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 16915368a422Saliguori#include <X11/XKBlib.h> 16925368a422Saliguori#else 16935368a422Saliguori#error No x11 support 16945368a422Saliguori#endif 16955368a422Saliguoriint main(void) { return 0; } 16965368a422SaliguoriEOF 169752166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1698681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 16995368a422Saliguori fi 17000705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 17015368a422Saliguorifi 17025368a422Saliguori 17038f28f3fbSths########################################## 17048d5d2d4cSths# VNC TLS detection 1705821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then 1706ae6b5e5aSaliguori cat > $TMPC <<EOF 1707ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1708ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1709ae6b5e5aSaliguoriEOF 1710a8bd70adSPaolo Bonzini vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` 1711a8bd70adSPaolo Bonzini vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` 171252166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 17131be10ad2SJuan Quintela vnc_tls=yes 1714a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1715ae6b5e5aSaliguori else 17161be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 17171be10ad2SJuan Quintela feature_not_found "vnc-tls" 17181be10ad2SJuan Quintela fi 17191be10ad2SJuan Quintela vnc_tls=no 17208d5d2d4cSths fi 17218d5d2d4cSthsfi 17228d5d2d4cSths 17238d5d2d4cSths########################################## 17242f9606b3Saliguori# VNC SASL detection 1725821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then 17262f9606b3Saliguori cat > $TMPC <<EOF 17272f9606b3Saliguori#include <sasl/sasl.h> 17282f9606b3Saliguori#include <stdio.h> 17292f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 17302f9606b3SaliguoriEOF 17312f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 17322f9606b3Saliguori vnc_sasl_cflags="" 17332f9606b3Saliguori vnc_sasl_libs="-lsasl2" 173452166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1735ea784e3bSJuan Quintela vnc_sasl=yes 1736fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 17372f9606b3Saliguori else 1738ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1739ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1740ea784e3bSJuan Quintela fi 1741ea784e3bSJuan Quintela vnc_sasl=no 17422f9606b3Saliguori fi 17432f9606b3Saliguorifi 17442f9606b3Saliguori 17452f9606b3Saliguori########################################## 17462f6f5c7aSCorentin Chary# VNC JPEG detection 1747821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then 17482f6f5c7aSCorentin Charycat > $TMPC <<EOF 17492f6f5c7aSCorentin Chary#include <stdio.h> 17502f6f5c7aSCorentin Chary#include <jpeglib.h> 17512f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 17522f6f5c7aSCorentin CharyEOF 17532f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 17542f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 17552f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 17562f6f5c7aSCorentin Chary vnc_jpeg=yes 17572f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 17582f6f5c7aSCorentin Chary else 17592f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 17602f6f5c7aSCorentin Chary feature_not_found "vnc-jpeg" 17612f6f5c7aSCorentin Chary fi 17622f6f5c7aSCorentin Chary vnc_jpeg=no 17632f6f5c7aSCorentin Chary fi 17642f6f5c7aSCorentin Charyfi 17652f6f5c7aSCorentin Chary 17662f6f5c7aSCorentin Chary########################################## 1767efe556adSCorentin Chary# VNC PNG detection 1768821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then 1769efe556adSCorentin Charycat > $TMPC <<EOF 1770efe556adSCorentin Chary//#include <stdio.h> 1771efe556adSCorentin Chary#include <png.h> 1772832ce9c2SScott Wood#include <stddef.h> 1773efe556adSCorentin Charyint main(void) { 1774efe556adSCorentin Chary png_structp png_ptr; 1775efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 17767edc3fedSPeter Maydell return png_ptr != 0; 1777efe556adSCorentin Chary} 1778efe556adSCorentin CharyEOF 17799af8025eSBrad if $pkg_config libpng --modversion >/dev/null 2>&1; then 17809af8025eSBrad vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null` 17819af8025eSBrad vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null` 17829af8025eSBrad else 1783efe556adSCorentin Chary vnc_png_cflags="" 1784efe556adSCorentin Chary vnc_png_libs="-lpng" 17859af8025eSBrad fi 1786efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 1787efe556adSCorentin Chary vnc_png=yes 1788efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 17899af8025eSBrad QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags" 1790efe556adSCorentin Chary else 1791efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 1792efe556adSCorentin Chary feature_not_found "vnc-png" 1793efe556adSCorentin Chary fi 1794efe556adSCorentin Chary vnc_png=no 1795efe556adSCorentin Chary fi 1796efe556adSCorentin Charyfi 1797efe556adSCorentin Chary 1798efe556adSCorentin Chary########################################## 179976655d6dSaliguori# fnmatch() probe, used for ACL routines 180076655d6dSaliguorifnmatch="no" 180176655d6dSaliguoricat > $TMPC << EOF 180276655d6dSaliguori#include <fnmatch.h> 180376655d6dSaliguoriint main(void) 180476655d6dSaliguori{ 180576655d6dSaliguori fnmatch("foo", "foo", 0); 180676655d6dSaliguori return 0; 180776655d6dSaliguori} 180876655d6dSaliguoriEOF 180952166aa0SJuan Quintelaif compile_prog "" "" ; then 181076655d6dSaliguori fnmatch="yes" 181176655d6dSaliguorifi 181276655d6dSaliguori 181376655d6dSaliguori########################################## 1814ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 1815ee682d27SStefan Weilif test "$uuid" != "no" ; then 1816ee682d27SStefan Weil uuid_libs="-luuid" 1817ee682d27SStefan Weil cat > $TMPC << EOF 1818ee682d27SStefan Weil#include <uuid/uuid.h> 1819ee682d27SStefan Weilint main(void) 1820ee682d27SStefan Weil{ 1821ee682d27SStefan Weil uuid_t my_uuid; 1822ee682d27SStefan Weil uuid_generate(my_uuid); 1823ee682d27SStefan Weil return 0; 1824ee682d27SStefan Weil} 1825ee682d27SStefan WeilEOF 1826ee682d27SStefan Weil if compile_prog "" "$uuid_libs" ; then 1827ee682d27SStefan Weil uuid="yes" 1828ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1829ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1830ee682d27SStefan Weil else 1831ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1832ee682d27SStefan Weil feature_not_found "uuid" 1833ee682d27SStefan Weil fi 1834ee682d27SStefan Weil uuid=no 1835ee682d27SStefan Weil fi 1836ee682d27SStefan Weilfi 1837ee682d27SStefan Weil 1838ee682d27SStefan Weil########################################## 1839dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix 1840dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 1841dce512deSChristoph Hellwig cat > $TMPC << EOF 1842ffc41d10SStefan Weil#include <stddef.h> /* NULL */ 1843dce512deSChristoph Hellwig#include <xfs/xfs.h> 1844dce512deSChristoph Hellwigint main(void) 1845dce512deSChristoph Hellwig{ 1846dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 1847dce512deSChristoph Hellwig return 0; 1848dce512deSChristoph Hellwig} 1849dce512deSChristoph HellwigEOF 1850dce512deSChristoph Hellwig if compile_prog "" "" ; then 1851dce512deSChristoph Hellwig xfs="yes" 1852dce512deSChristoph Hellwig else 1853dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 1854dce512deSChristoph Hellwig feature_not_found "xfs" 1855dce512deSChristoph Hellwig fi 1856dce512deSChristoph Hellwig xfs=no 1857dce512deSChristoph Hellwig fi 1858dce512deSChristoph Hellwigfi 1859dce512deSChristoph Hellwig 1860dce512deSChristoph Hellwig########################################## 18618a16d273Sths# vde libraries probe 1862dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 18634baae0acSJuan Quintela vde_libs="-lvdeplug" 18648a16d273Sths cat > $TMPC << EOF 18658a16d273Sths#include <libvdeplug.h> 18664a7f0e06Spbrookint main(void) 18674a7f0e06Spbrook{ 18684a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 1869fea08e08SPeter Maydell char s[] = ""; 1870fea08e08SPeter Maydell vde_open(s, s, &a); 18714a7f0e06Spbrook return 0; 18724a7f0e06Spbrook} 18738a16d273SthsEOF 187452166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 18754baae0acSJuan Quintela vde=yes 18768e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 18778e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 1878dfb278bdSJuan Quintela else 1879dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 1880dfb278bdSJuan Quintela feature_not_found "vde" 1881dfb278bdSJuan Quintela fi 1882dfb278bdSJuan Quintela vde=no 18838a16d273Sths fi 18848a16d273Sthsfi 18858a16d273Sths 18868a16d273Sths########################################## 188747e98658SCorey Bryant# libcap-ng library probe 188847e98658SCorey Bryantif test "$cap_ng" != "no" ; then 188947e98658SCorey Bryant cap_libs="-lcap-ng" 189047e98658SCorey Bryant cat > $TMPC << EOF 189147e98658SCorey Bryant#include <cap-ng.h> 189247e98658SCorey Bryantint main(void) 189347e98658SCorey Bryant{ 189447e98658SCorey Bryant capng_capability_to_name(CAPNG_EFFECTIVE); 189547e98658SCorey Bryant return 0; 189647e98658SCorey Bryant} 189747e98658SCorey BryantEOF 189847e98658SCorey Bryant if compile_prog "" "$cap_libs" ; then 189947e98658SCorey Bryant cap_ng=yes 190047e98658SCorey Bryant libs_tools="$cap_libs $libs_tools" 190147e98658SCorey Bryant else 190247e98658SCorey Bryant if test "$cap_ng" = "yes" ; then 190347e98658SCorey Bryant feature_not_found "cap_ng" 190447e98658SCorey Bryant fi 190547e98658SCorey Bryant cap_ng=no 190647e98658SCorey Bryant fi 190747e98658SCorey Bryantfi 190847e98658SCorey Bryant 190947e98658SCorey Bryant########################################## 1910c2de5c91Smalc# Sound support libraries probe 19118f28f3fbSths 1912c2de5c91Smalcaudio_drv_probe() 1913c2de5c91Smalc{ 1914c2de5c91Smalc drv=$1 1915c2de5c91Smalc hdr=$2 1916c2de5c91Smalc lib=$3 1917c2de5c91Smalc exp=$4 1918c2de5c91Smalc cfl=$5 19198f28f3fbSths cat > $TMPC << EOF 1920c2de5c91Smalc#include <$hdr> 1921c2de5c91Smalcint main(void) { $exp } 19228f28f3fbSthsEOF 192352166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 19248f28f3fbSths : 19258f28f3fbSths else 19268f28f3fbSths echo 1927c2de5c91Smalc echo "Error: $drv check failed" 1928c2de5c91Smalc echo "Make sure to have the $drv libs and headers installed." 19298f28f3fbSths echo 19308f28f3fbSths exit 1 19318f28f3fbSths fi 1932c2de5c91Smalc} 1933c2de5c91Smalc 19342fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 1935c2de5c91Smalcfor drv in $audio_drv_list; do 1936c2de5c91Smalc case $drv in 1937c2de5c91Smalc alsa) 1938c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 1939e35bcb0cSStefan Weil "return snd_pcm_close((snd_pcm_t *)0);" 1940a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 1941c2de5c91Smalc ;; 1942c2de5c91Smalc 1943c2de5c91Smalc fmod) 1944c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 1945c2de5c91Smalc echo 1946c2de5c91Smalc echo "Error: You must specify path to FMOD library and headers" 1947c2de5c91Smalc echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 1948c2de5c91Smalc echo 1949c2de5c91Smalc exit 1 19508f28f3fbSths fi 1951c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 1952a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 1953c2de5c91Smalc ;; 1954c2de5c91Smalc 1955c2de5c91Smalc esd) 1956c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 1957a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 195867f86e8eSJuan Quintela audio_pt_int="yes" 1959c2de5c91Smalc ;; 1960b8e59f18Smalc 1961b8e59f18Smalc pa) 1962a394aed2SMarc-André Lureau audio_drv_probe $drv pulse/mainloop.h "-lpulse" \ 1963a394aed2SMarc-André Lureau "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;" 1964a394aed2SMarc-André Lureau libs_softmmu="-lpulse $libs_softmmu" 196567f86e8eSJuan Quintela audio_pt_int="yes" 1966b8e59f18Smalc ;; 1967b8e59f18Smalc 1968997e690aSJuan Quintela coreaudio) 1969997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 1970997e690aSJuan Quintela ;; 1971997e690aSJuan Quintela 1972a4bf6780SJuan Quintela dsound) 1973a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 1974d5631638Smalc audio_win_int="yes" 1975a4bf6780SJuan Quintela ;; 1976a4bf6780SJuan Quintela 1977a4bf6780SJuan Quintela oss) 1978a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 1979a4bf6780SJuan Quintela ;; 1980a4bf6780SJuan Quintela 1981a4bf6780SJuan Quintela sdl|wav) 19822f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 19832f6a1ab0Sblueswir1 ;; 19842f6a1ab0Sblueswir1 1985d5631638Smalc winwave) 1986d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 1987d5631638Smalc audio_win_int="yes" 1988d5631638Smalc ;; 1989d5631638Smalc 1990e4c63a6aSmalc *) 19911c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 1992e4c63a6aSmalc echo 1993e4c63a6aSmalc echo "Error: Unknown driver '$drv' selected" 1994e4c63a6aSmalc echo "Possible drivers are: $audio_possible_drivers" 1995e4c63a6aSmalc echo 1996e4c63a6aSmalc exit 1 1997e4c63a6aSmalc } 1998e4c63a6aSmalc ;; 1999c2de5c91Smalc esac 2000c2de5c91Smalcdone 20018f28f3fbSths 20024d3b6f6eSbalrog########################################## 20032e4d9fb1Saurel32# BrlAPI probe 20042e4d9fb1Saurel32 20054ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 2006eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 20072e4d9fb1Saurel32 cat > $TMPC << EOF 20082e4d9fb1Saurel32#include <brlapi.h> 2009832ce9c2SScott Wood#include <stddef.h> 20102e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 20112e4d9fb1Saurel32EOF 201252166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 20132e4d9fb1Saurel32 brlapi=yes 2014264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 20154ffcedb6SJuan Quintela else 20164ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 20174ffcedb6SJuan Quintela feature_not_found "brlapi" 20184ffcedb6SJuan Quintela fi 20194ffcedb6SJuan Quintela brlapi=no 2020eb82284fSJuan Quintela fi 2021eb82284fSJuan Quintelafi 20222e4d9fb1Saurel32 20232e4d9fb1Saurel32########################################## 20244d3b6f6eSbalrog# curses probe 2025e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then 2026e095e2f3SStefan Weil curses_list="-lpdcurses" 2027e095e2f3SStefan Weilelse 20284f78ef9aSJuan Quintela curses_list="-lncurses -lcurses" 2029e095e2f3SStefan Weilfi 20304d3b6f6eSbalrog 2031c584a6d0SJuan Quintelaif test "$curses" != "no" ; then 2032c584a6d0SJuan Quintela curses_found=no 20334d3b6f6eSbalrog cat > $TMPC << EOF 20344d3b6f6eSbalrog#include <curses.h> 2035ef9a2524SStefan Weilint main(void) { 2036ef9a2524SStefan Weil const char *s = curses_version(); 2037ef9a2524SStefan Weil resize_term(0, 0); 2038ef9a2524SStefan Weil return s != 0; 2039ef9a2524SStefan Weil} 20404d3b6f6eSbalrogEOF 20414f78ef9aSJuan Quintela for curses_lib in $curses_list; do 20424f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 2043c584a6d0SJuan Quintela curses_found=yes 20444f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 20454f78ef9aSJuan Quintela break 20464d3b6f6eSbalrog fi 20474f78ef9aSJuan Quintela done 2048c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 2049c584a6d0SJuan Quintela curses=yes 2050c584a6d0SJuan Quintela else 2051c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 2052c584a6d0SJuan Quintela feature_not_found "curses" 2053c584a6d0SJuan Quintela fi 2054c584a6d0SJuan Quintela curses=no 2055c584a6d0SJuan Quintela fi 20564f78ef9aSJuan Quintelafi 20574d3b6f6eSbalrog 2058414f0dabSblueswir1########################################## 2059769ce76dSAlexander Graf# curl probe 2060769ce76dSAlexander Graf 2061a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then 2062a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 20634e2b0658SPaolo Bonzinielse 20644e2b0658SPaolo Bonzini curlconfig=curl-config 20654e2b0658SPaolo Bonzinifi 20664e2b0658SPaolo Bonzini 2067788c8196SJuan Quintelaif test "$curl" != "no" ; then 2068769ce76dSAlexander Graf cat > $TMPC << EOF 2069769ce76dSAlexander Graf#include <curl/curl.h> 20700b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 2071769ce76dSAlexander GrafEOF 20724e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 20734e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 2074b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 2075769ce76dSAlexander Graf curl=yes 2076f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 2077f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 2078788c8196SJuan Quintela else 2079788c8196SJuan Quintela if test "$curl" = "yes" ; then 2080788c8196SJuan Quintela feature_not_found "curl" 2081788c8196SJuan Quintela fi 2082788c8196SJuan Quintela curl=no 2083769ce76dSAlexander Graf fi 2084769ce76dSAlexander Graffi # test "$curl" 2085769ce76dSAlexander Graf 2086769ce76dSAlexander Graf########################################## 2087fb599c9aSbalrog# bluez support probe 2088a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 2089e820e3f4Sbalrog cat > $TMPC << EOF 2090e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 2091e820e3f4Sbalrogint main(void) { return bt_error(0); } 2092e820e3f4SbalrogEOF 2093a8bd70adSPaolo Bonzini bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` 2094a8bd70adSPaolo Bonzini bluez_libs=`$pkg_config --libs bluez 2> /dev/null` 209552166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 2096a20a6f46SJuan Quintela bluez=yes 2097e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 2098e820e3f4Sbalrog else 2099a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 2100a20a6f46SJuan Quintela feature_not_found "bluez" 2101a20a6f46SJuan Quintela fi 2102e820e3f4Sbalrog bluez="no" 2103e820e3f4Sbalrog fi 2104fb599c9aSbalrogfi 2105fb599c9aSbalrog 2106fb599c9aSbalrog########################################## 2107e18df141SAnthony Liguori# glib support probe 2108a52d28afSPaolo Bonzini 2109a52d28afSPaolo Bonziniif test "$mingw32" = yes; then 2110a52d28afSPaolo Bonzini # g_poll is required in order to integrate with the glib main loop. 2111a52d28afSPaolo Bonzini glib_req_ver=2.20 2112a52d28afSPaolo Bonzinielse 2113a52d28afSPaolo Bonzini glib_req_ver=2.12 2114a52d28afSPaolo Bonzinifi 2115a52d28afSPaolo Bonziniif $pkg_config --atleast-version=$glib_req_ver gthread-2.0 > /dev/null 2>&1 2116a52d28afSPaolo Bonzinithen 21174b76a481SStefan Hajnoczi glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null` 21184b76a481SStefan Hajnoczi glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null` 211914015304SAnthony Liguori LIBS="$glib_libs $LIBS" 2120957f1f99SMichael Roth libs_qga="$glib_libs $libs_qga" 2121e18df141SAnthony Liguorielse 2122a52d28afSPaolo Bonzini echo "glib-$glib_req_ver required to compile QEMU" 2123e18df141SAnthony Liguori exit 1 2124e18df141SAnthony Liguorifi 2125e18df141SAnthony Liguori 2126e18df141SAnthony Liguori########################################## 2127e2134eb9SGerd Hoffmann# pixman support probe 2128e2134eb9SGerd Hoffmann 2129e2134eb9SGerd Hoffmannif test "$pixman" = ""; then 2130cb1d40d7SGerd Hoffmann if $pkg_config pixman-1 > /dev/null 2>&1; then 2131e2134eb9SGerd Hoffmann pixman="system" 2132e2134eb9SGerd Hoffmann else 2133e2134eb9SGerd Hoffmann pixman="internal" 2134e2134eb9SGerd Hoffmann fi 2135e2134eb9SGerd Hoffmannfi 2136e2134eb9SGerd Hoffmannif test "$pixman" = "system"; then 2137e2134eb9SGerd Hoffmann pixman_cflags=`$pkg_config --cflags pixman-1 2>/dev/null` 2138e2134eb9SGerd Hoffmann pixman_libs=`$pkg_config --libs pixman-1 2>/dev/null` 2139e2134eb9SGerd Hoffmannelse 2140e2134eb9SGerd Hoffmann if test ! -d ${source_path}/pixman/pixman; then 2141cb1d40d7SGerd Hoffmann echo "ERROR: pixman not present. Your options:" 2142eac29d87SStefan Weil echo " (1) Preferred: Install the pixman devel package (any recent" 2143e2134eb9SGerd Hoffmann echo " distro should have packages as Xorg needs pixman too)." 2144e2134eb9SGerd Hoffmann echo " (2) Fetch the pixman submodule, using:" 2145e2134eb9SGerd Hoffmann echo " git submodule update --init pixman" 2146e2134eb9SGerd Hoffmann exit 1 2147e2134eb9SGerd Hoffmann fi 21485ca9388aSGerd Hoffmann mkdir -p pixman/pixman 21495ca9388aSGerd Hoffmann pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman" 21505ca9388aSGerd Hoffmann pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1" 2151e2134eb9SGerd Hoffmannfi 2152e2134eb9SGerd Hoffmann 2153e2134eb9SGerd Hoffmann########################################## 215417bff52bSM. Mohan Kumar# libcap probe 215517bff52bSM. Mohan Kumar 215617bff52bSM. Mohan Kumarif test "$cap" != "no" ; then 215717bff52bSM. Mohan Kumar cat > $TMPC <<EOF 215817bff52bSM. Mohan Kumar#include <stdio.h> 215917bff52bSM. Mohan Kumar#include <sys/capability.h> 2160cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; } 216117bff52bSM. Mohan KumarEOF 216217bff52bSM. Mohan Kumar if compile_prog "" "-lcap" ; then 216317bff52bSM. Mohan Kumar cap=yes 216417bff52bSM. Mohan Kumar else 216517bff52bSM. Mohan Kumar cap=no 216617bff52bSM. Mohan Kumar fi 216717bff52bSM. Mohan Kumarfi 216817bff52bSM. Mohan Kumar 216917bff52bSM. Mohan Kumar########################################## 2170e5d355d1Saliguori# pthread probe 21714b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" 21723c529d93Saliguori 2173e5d355d1Saliguoripthread=no 2174414f0dabSblueswir1cat > $TMPC << EOF 21753c529d93Saliguori#include <pthread.h> 21767a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; } 21777a42bbe4SStefan Weilint main(void) { 21787a42bbe4SStefan Weil pthread_t thread; 21797a42bbe4SStefan Weil pthread_create(&thread, 0, f, 0); 21807a42bbe4SStefan Weil return 0; 21817a42bbe4SStefan Weil} 2182414f0dabSblueswir1EOF 2183bd00d539SAndreas Färberif compile_prog "" "" ; then 2184bd00d539SAndreas Färber pthread=yes 2185bd00d539SAndreas Färberelse 2186de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 218752166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 2188e5d355d1Saliguori pthread=yes 2189e3c56761SPeter Portante found=no 2190e3c56761SPeter Portante for lib_entry in $LIBS; do 2191e3c56761SPeter Portante if test "$lib_entry" = "$pthread_lib"; then 2192e3c56761SPeter Portante found=yes 2193e3c56761SPeter Portante break 2194e3c56761SPeter Portante fi 2195e3c56761SPeter Portante done 2196e3c56761SPeter Portante if test "$found" = "no"; then 21975572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 2198e3c56761SPeter Portante fi 2199de65fe0fSSebastian Herbszt break 2200414f0dabSblueswir1 fi 2201de65fe0fSSebastian Herbszt done 2202bd00d539SAndreas Färberfi 2203414f0dabSblueswir1 22044617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 22054dd75c70SChristoph Hellwig echo 22064dd75c70SChristoph Hellwig echo "Error: pthread check failed" 22074dd75c70SChristoph Hellwig echo "Make sure to have the pthread libs and headers installed." 22084dd75c70SChristoph Hellwig echo 22094dd75c70SChristoph Hellwig exit 1 2210e5d355d1Saliguorifi 2211e5d355d1Saliguori 2212bf9298b9Saliguori########################################## 2213f27aaf4bSChristian Brunner# rbd probe 2214f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 2215f27aaf4bSChristian Brunner cat > $TMPC <<EOF 2216f27aaf4bSChristian Brunner#include <stdio.h> 2217ad32e9c0SJosh Durgin#include <rbd/librbd.h> 2218f27aaf4bSChristian Brunnerint main(void) { 2219ad32e9c0SJosh Durgin rados_t cluster; 2220ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 2221f27aaf4bSChristian Brunner return 0; 2222f27aaf4bSChristian Brunner} 2223f27aaf4bSChristian BrunnerEOF 2224ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 2225f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 2226f27aaf4bSChristian Brunner rbd=yes 2227f27aaf4bSChristian Brunner libs_tools="$rbd_libs $libs_tools" 2228f27aaf4bSChristian Brunner libs_softmmu="$rbd_libs $libs_softmmu" 2229f27aaf4bSChristian Brunner else 2230f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 2231f27aaf4bSChristian Brunner feature_not_found "rados block device" 2232f27aaf4bSChristian Brunner fi 2233f27aaf4bSChristian Brunner rbd=no 2234f27aaf4bSChristian Brunner fi 2235f27aaf4bSChristian Brunnerfi 2236f27aaf4bSChristian Brunner 2237f27aaf4bSChristian Brunner########################################## 22385c6c3a6cSChristoph Hellwig# linux-aio probe 22395c6c3a6cSChristoph Hellwig 22405c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 22415c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 22425c6c3a6cSChristoph Hellwig#include <libaio.h> 22435c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 2244832ce9c2SScott Wood#include <stddef.h> 22455c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 22465c6c3a6cSChristoph HellwigEOF 22475c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 22485c6c3a6cSChristoph Hellwig linux_aio=yes 2249048d179fSPaul Brook libs_softmmu="$libs_softmmu -laio" 2250048d179fSPaul Brook libs_tools="$libs_tools -laio" 22515c6c3a6cSChristoph Hellwig else 22525c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 22535c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 22545c6c3a6cSChristoph Hellwig fi 22553cfcae3cSLuiz Capitulino linux_aio=no 22565c6c3a6cSChristoph Hellwig fi 22575c6c3a6cSChristoph Hellwigfi 22585c6c3a6cSChristoph Hellwig 22595c6c3a6cSChristoph Hellwig########################################## 2260758e8e38SVenkateswararao Jujjuri (JV)# attr probe 2261758e8e38SVenkateswararao Jujjuri (JV) 2262758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 2263758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 2264758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 2265758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 2266f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR 2267f2338fb4SPavel Borzenkov#include <attr/xattr.h> 2268f2338fb4SPavel Borzenkov#else 22694f26f2b6SAvi Kivity#include <sys/xattr.h> 2270f2338fb4SPavel Borzenkov#endif 2271758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 2272758e8e38SVenkateswararao Jujjuri (JV)EOF 22734f26f2b6SAvi Kivity if compile_prog "" "" ; then 22744f26f2b6SAvi Kivity attr=yes 22754f26f2b6SAvi Kivity # Older distros have <attr/xattr.h>, and need -lattr: 2276f2338fb4SPavel Borzenkov elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then 2277758e8e38SVenkateswararao Jujjuri (JV) attr=yes 2278758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 22794f26f2b6SAvi Kivity libattr=yes 2280758e8e38SVenkateswararao Jujjuri (JV) else 2281758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 2282758e8e38SVenkateswararao Jujjuri (JV) feature_not_found "ATTR" 2283758e8e38SVenkateswararao Jujjuri (JV) fi 2284758e8e38SVenkateswararao Jujjuri (JV) attr=no 2285758e8e38SVenkateswararao Jujjuri (JV) fi 2286758e8e38SVenkateswararao Jujjuri (JV)fi 2287758e8e38SVenkateswararao Jujjuri (JV) 2288758e8e38SVenkateswararao Jujjuri (JV)########################################## 2289bf9298b9Saliguori# iovec probe 2290bf9298b9Saliguoricat > $TMPC <<EOF 2291db34f0b3Sblueswir1#include <sys/types.h> 2292bf9298b9Saliguori#include <sys/uio.h> 2293db34f0b3Sblueswir1#include <unistd.h> 2294f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); } 2295bf9298b9SaliguoriEOF 2296bf9298b9Saliguoriiovec=no 229752166aa0SJuan Quintelaif compile_prog "" "" ; then 2298bf9298b9Saliguori iovec=yes 2299bf9298b9Saliguorifi 2300bf9298b9Saliguori 2301f652e6afSaurel32########################################## 2302ceb42de8Saliguori# preadv probe 2303ceb42de8Saliguoricat > $TMPC <<EOF 2304ceb42de8Saliguori#include <sys/types.h> 2305ceb42de8Saliguori#include <sys/uio.h> 2306ceb42de8Saliguori#include <unistd.h> 2307c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); } 2308ceb42de8SaliguoriEOF 2309ceb42de8Saliguoripreadv=no 231052166aa0SJuan Quintelaif compile_prog "" "" ; then 2311ceb42de8Saliguori preadv=yes 2312ceb42de8Saliguorifi 2313ceb42de8Saliguori 2314ceb42de8Saliguori########################################## 2315f652e6afSaurel32# fdt probe 23162df87df7SJuan Quintelaif test "$fdt" != "no" ; then 2317b41af4baSJuan Quintela fdt_libs="-lfdt" 2318f652e6afSaurel32 cat > $TMPC << EOF 2319f652e6afSaurel32int main(void) { return 0; } 2320f652e6afSaurel32EOF 232152166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 2322f652e6afSaurel32 fdt=yes 23232df87df7SJuan Quintela else 23242df87df7SJuan Quintela if test "$fdt" = "yes" ; then 23252df87df7SJuan Quintela feature_not_found "fdt" 23262df87df7SJuan Quintela fi 2327de3a354aSMichael Walle fdt_libs= 23282df87df7SJuan Quintela fdt=no 2329f652e6afSaurel32 fi 2330f652e6afSaurel32fi 2331f652e6afSaurel32 233220ff075bSMichael Walle########################################## 233320ff075bSMichael Walle# opengl probe, used by milkymist-tmu2 233420ff075bSMichael Walleif test "$opengl" != "no" ; then 233520ff075bSMichael Walle opengl_libs="-lGL" 233620ff075bSMichael Walle cat > $TMPC << EOF 233720ff075bSMichael Walle#include <X11/Xlib.h> 233820ff075bSMichael Walle#include <GL/gl.h> 233920ff075bSMichael Walle#include <GL/glx.h> 234084972cbbSStefan Weilint main(void) { return GL_VERSION != 0; } 234120ff075bSMichael WalleEOF 234220ff075bSMichael Walle if compile_prog "" "-lGL" ; then 234320ff075bSMichael Walle opengl=yes 234420ff075bSMichael Walle else 234520ff075bSMichael Walle if test "$opengl" = "yes" ; then 234620ff075bSMichael Walle feature_not_found "opengl" 234720ff075bSMichael Walle fi 2348de3a354aSMichael Walle opengl_libs= 234920ff075bSMichael Walle opengl=no 235020ff075bSMichael Walle fi 235120ff075bSMichael Wallefi 235220ff075bSMichael Walle 2353eb100396SBharata B Rao########################################## 2354eb100396SBharata B Rao# glusterfs probe 2355eb100396SBharata B Raoif test "$glusterfs" != "no" ; then 2356eb100396SBharata B Rao cat > $TMPC <<EOF 2357eb100396SBharata B Rao#include <glusterfs/api/glfs.h> 2358eb100396SBharata B Raoint main(void) { 2359eb100396SBharata B Rao (void) glfs_new("volume"); 2360eb100396SBharata B Rao return 0; 2361eb100396SBharata B Rao} 2362eb100396SBharata B RaoEOF 2363eb100396SBharata B Rao glusterfs_libs="-lgfapi -lgfrpc -lgfxdr" 2364eb100396SBharata B Rao if compile_prog "" "$glusterfs_libs" ; then 2365eb100396SBharata B Rao glusterfs=yes 2366eb100396SBharata B Rao libs_tools="$glusterfs_libs $libs_tools" 2367eb100396SBharata B Rao libs_softmmu="$glusterfs_libs $libs_softmmu" 2368eb100396SBharata B Rao else 2369eb100396SBharata B Rao if test "$glusterfs" = "yes" ; then 2370eb100396SBharata B Rao feature_not_found "GlusterFS backend support" 2371eb100396SBharata B Rao fi 2372eb100396SBharata B Rao glusterfs=no 2373eb100396SBharata B Rao fi 2374eb100396SBharata B Raofi 2375eb100396SBharata B Rao 23763b3f24adSaurel32# 23773b3f24adSaurel32# Check for xxxat() functions when we are building linux-user 23783b3f24adSaurel32# emulator. This is done because older glibc versions don't 23793b3f24adSaurel32# have syscall stubs for these implemented. 23803b3f24adSaurel32# 23813b3f24adSaurel32atfile=no 23823b3f24adSaurel32cat > $TMPC << EOF 23833b3f24adSaurel32#define _ATFILE_SOURCE 23843b3f24adSaurel32#include <sys/types.h> 23853b3f24adSaurel32#include <fcntl.h> 23863b3f24adSaurel32#include <unistd.h> 23873b3f24adSaurel32 23883b3f24adSaurel32int 23893b3f24adSaurel32main(void) 23903b3f24adSaurel32{ 23913b3f24adSaurel32 /* try to unlink nonexisting file */ 23923b3f24adSaurel32 return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); 23933b3f24adSaurel32} 23943b3f24adSaurel32EOF 239552166aa0SJuan Quintelaif compile_prog "" "" ; then 23963b3f24adSaurel32 atfile=yes 23973b3f24adSaurel32fi 23983b3f24adSaurel32 239939386ac7Saurel32# Check for inotify functions when we are building linux-user 24003b3f24adSaurel32# emulator. This is done because older glibc versions don't 24013b3f24adSaurel32# have syscall stubs for these implemented. In that case we 24023b3f24adSaurel32# don't provide them even if kernel supports them. 24033b3f24adSaurel32# 24043b3f24adSaurel32inotify=no 24053b3f24adSaurel32cat > $TMPC << EOF 24063b3f24adSaurel32#include <sys/inotify.h> 24073b3f24adSaurel32 24083b3f24adSaurel32int 24093b3f24adSaurel32main(void) 24103b3f24adSaurel32{ 24113b3f24adSaurel32 /* try to start inotify */ 24128690e420Saurel32 return inotify_init(); 24133b3f24adSaurel32} 24143b3f24adSaurel32EOF 241552166aa0SJuan Quintelaif compile_prog "" "" ; then 24163b3f24adSaurel32 inotify=yes 24173b3f24adSaurel32fi 24183b3f24adSaurel32 2419c05c7a73SRiku Voipioinotify1=no 2420c05c7a73SRiku Voipiocat > $TMPC << EOF 2421c05c7a73SRiku Voipio#include <sys/inotify.h> 2422c05c7a73SRiku Voipio 2423c05c7a73SRiku Voipioint 2424c05c7a73SRiku Voipiomain(void) 2425c05c7a73SRiku Voipio{ 2426c05c7a73SRiku Voipio /* try to start inotify */ 2427c05c7a73SRiku Voipio return inotify_init1(0); 2428c05c7a73SRiku Voipio} 2429c05c7a73SRiku VoipioEOF 2430c05c7a73SRiku Voipioif compile_prog "" "" ; then 2431c05c7a73SRiku Voipio inotify1=yes 2432c05c7a73SRiku Voipiofi 2433c05c7a73SRiku Voipio 2434ebc996f3SRiku Voipio# check if utimensat and futimens are supported 2435ebc996f3SRiku Voipioutimens=no 2436ebc996f3SRiku Voipiocat > $TMPC << EOF 2437ebc996f3SRiku Voipio#define _ATFILE_SOURCE 2438ebc996f3SRiku Voipio#include <stddef.h> 2439ebc996f3SRiku Voipio#include <fcntl.h> 24403014ee00SPeter Maydell#include <sys/stat.h> 2441ebc996f3SRiku Voipio 2442ebc996f3SRiku Voipioint main(void) 2443ebc996f3SRiku Voipio{ 2444ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 2445ebc996f3SRiku Voipio futimens(0, NULL); 2446ebc996f3SRiku Voipio return 0; 2447ebc996f3SRiku Voipio} 2448ebc996f3SRiku VoipioEOF 244952166aa0SJuan Quintelaif compile_prog "" "" ; then 2450ebc996f3SRiku Voipio utimens=yes 2451ebc996f3SRiku Voipiofi 2452ebc996f3SRiku Voipio 2453099d6b0fSRiku Voipio# check if pipe2 is there 2454099d6b0fSRiku Voipiopipe2=no 2455099d6b0fSRiku Voipiocat > $TMPC << EOF 2456099d6b0fSRiku Voipio#include <unistd.h> 2457099d6b0fSRiku Voipio#include <fcntl.h> 2458099d6b0fSRiku Voipio 2459099d6b0fSRiku Voipioint main(void) 2460099d6b0fSRiku Voipio{ 2461099d6b0fSRiku Voipio int pipefd[2]; 24629bca8162SBruce Rogers return pipe2(pipefd, O_CLOEXEC); 2463099d6b0fSRiku Voipio} 2464099d6b0fSRiku VoipioEOF 246552166aa0SJuan Quintelaif compile_prog "" "" ; then 2466099d6b0fSRiku Voipio pipe2=yes 2467099d6b0fSRiku Voipiofi 2468099d6b0fSRiku Voipio 246940ff6d7eSKevin Wolf# check if accept4 is there 247040ff6d7eSKevin Wolfaccept4=no 247140ff6d7eSKevin Wolfcat > $TMPC << EOF 247240ff6d7eSKevin Wolf#include <sys/socket.h> 247340ff6d7eSKevin Wolf#include <stddef.h> 247440ff6d7eSKevin Wolf 247540ff6d7eSKevin Wolfint main(void) 247640ff6d7eSKevin Wolf{ 247740ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 247840ff6d7eSKevin Wolf return 0; 247940ff6d7eSKevin Wolf} 248040ff6d7eSKevin WolfEOF 248140ff6d7eSKevin Wolfif compile_prog "" "" ; then 248240ff6d7eSKevin Wolf accept4=yes 248340ff6d7eSKevin Wolffi 248440ff6d7eSKevin Wolf 24853ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 24863ce34dfbSvibisreenivasansplice=no 24873ce34dfbSvibisreenivasancat > $TMPC << EOF 24883ce34dfbSvibisreenivasan#include <unistd.h> 24893ce34dfbSvibisreenivasan#include <fcntl.h> 24903ce34dfbSvibisreenivasan#include <limits.h> 24913ce34dfbSvibisreenivasan 24923ce34dfbSvibisreenivasanint main(void) 24933ce34dfbSvibisreenivasan{ 249466ea0f22SStefan Weil int len, fd = 0; 24953ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 24963ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 24973ce34dfbSvibisreenivasan return 0; 24983ce34dfbSvibisreenivasan} 24993ce34dfbSvibisreenivasanEOF 250052166aa0SJuan Quintelaif compile_prog "" "" ; then 25013ce34dfbSvibisreenivasan splice=yes 25023ce34dfbSvibisreenivasanfi 25033ce34dfbSvibisreenivasan 2504dcc38d1cSMarcelo Tosatti########################################## 2505dcc38d1cSMarcelo Tosatti# signalfd probe 2506dcc38d1cSMarcelo Tosattisignalfd="no" 2507dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 2508dcc38d1cSMarcelo Tosatti#include <unistd.h> 2509dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 2510dcc38d1cSMarcelo Tosatti#include <signal.h> 2511dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 2512dcc38d1cSMarcelo TosattiEOF 2513dcc38d1cSMarcelo Tosatti 2514dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 2515dcc38d1cSMarcelo Tosatti signalfd=yes 2516dcc38d1cSMarcelo Tosattifi 2517dcc38d1cSMarcelo Tosatti 2518c2882b96SRiku Voipio# check if eventfd is supported 2519c2882b96SRiku Voipioeventfd=no 2520c2882b96SRiku Voipiocat > $TMPC << EOF 2521c2882b96SRiku Voipio#include <sys/eventfd.h> 2522c2882b96SRiku Voipio 2523c2882b96SRiku Voipioint main(void) 2524c2882b96SRiku Voipio{ 252555cc7f3eSStefan Weil return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); 2526c2882b96SRiku Voipio} 2527c2882b96SRiku VoipioEOF 2528c2882b96SRiku Voipioif compile_prog "" "" ; then 2529c2882b96SRiku Voipio eventfd=yes 2530c2882b96SRiku Voipiofi 2531c2882b96SRiku Voipio 2532d0927938SUlrich Hecht# check for fallocate 2533d0927938SUlrich Hechtfallocate=no 2534d0927938SUlrich Hechtcat > $TMPC << EOF 2535d0927938SUlrich Hecht#include <fcntl.h> 2536d0927938SUlrich Hecht 2537d0927938SUlrich Hechtint main(void) 2538d0927938SUlrich Hecht{ 2539d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 2540d0927938SUlrich Hecht return 0; 2541d0927938SUlrich Hecht} 2542d0927938SUlrich HechtEOF 25438fb03151SPeter Maydellif compile_prog "" "" ; then 2544d0927938SUlrich Hecht fallocate=yes 2545d0927938SUlrich Hechtfi 2546d0927938SUlrich Hecht 2547c727f47dSPeter Maydell# check for sync_file_range 2548c727f47dSPeter Maydellsync_file_range=no 2549c727f47dSPeter Maydellcat > $TMPC << EOF 2550c727f47dSPeter Maydell#include <fcntl.h> 2551c727f47dSPeter Maydell 2552c727f47dSPeter Maydellint main(void) 2553c727f47dSPeter Maydell{ 2554c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 2555c727f47dSPeter Maydell return 0; 2556c727f47dSPeter Maydell} 2557c727f47dSPeter MaydellEOF 25588fb03151SPeter Maydellif compile_prog "" "" ; then 2559c727f47dSPeter Maydell sync_file_range=yes 2560c727f47dSPeter Maydellfi 2561c727f47dSPeter Maydell 2562dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 2563dace20dcSPeter Maydellfiemap=no 2564dace20dcSPeter Maydellcat > $TMPC << EOF 2565dace20dcSPeter Maydell#include <sys/ioctl.h> 2566dace20dcSPeter Maydell#include <linux/fs.h> 2567dace20dcSPeter Maydell#include <linux/fiemap.h> 2568dace20dcSPeter Maydell 2569dace20dcSPeter Maydellint main(void) 2570dace20dcSPeter Maydell{ 2571dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 2572dace20dcSPeter Maydell return 0; 2573dace20dcSPeter Maydell} 2574dace20dcSPeter MaydellEOF 25758fb03151SPeter Maydellif compile_prog "" "" ; then 2576dace20dcSPeter Maydell fiemap=yes 2577dace20dcSPeter Maydellfi 2578dace20dcSPeter Maydell 2579d0927938SUlrich Hecht# check for dup3 2580d0927938SUlrich Hechtdup3=no 2581d0927938SUlrich Hechtcat > $TMPC << EOF 2582d0927938SUlrich Hecht#include <unistd.h> 2583d0927938SUlrich Hecht 2584d0927938SUlrich Hechtint main(void) 2585d0927938SUlrich Hecht{ 2586d0927938SUlrich Hecht dup3(0, 0, 0); 2587d0927938SUlrich Hecht return 0; 2588d0927938SUlrich Hecht} 2589d0927938SUlrich HechtEOF 259078f5d726SJan Kiszkaif compile_prog "" "" ; then 2591d0927938SUlrich Hecht dup3=yes 2592d0927938SUlrich Hechtfi 2593d0927938SUlrich Hecht 25943b6edd16SPeter Maydell# check for epoll support 25953b6edd16SPeter Maydellepoll=no 25963b6edd16SPeter Maydellcat > $TMPC << EOF 25973b6edd16SPeter Maydell#include <sys/epoll.h> 25983b6edd16SPeter Maydell 25993b6edd16SPeter Maydellint main(void) 26003b6edd16SPeter Maydell{ 26013b6edd16SPeter Maydell epoll_create(0); 26023b6edd16SPeter Maydell return 0; 26033b6edd16SPeter Maydell} 26043b6edd16SPeter MaydellEOF 26058fb03151SPeter Maydellif compile_prog "" "" ; then 26063b6edd16SPeter Maydell epoll=yes 26073b6edd16SPeter Maydellfi 26083b6edd16SPeter Maydell 26093b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions 26103b6edd16SPeter Maydell# so we must check separately for their presence 26113b6edd16SPeter Maydellepoll_create1=no 26123b6edd16SPeter Maydellcat > $TMPC << EOF 26133b6edd16SPeter Maydell#include <sys/epoll.h> 26143b6edd16SPeter Maydell 26153b6edd16SPeter Maydellint main(void) 26163b6edd16SPeter Maydell{ 261719e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 261819e83f6bSPeter Maydell * a function being called. This is necessary so that on 261919e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 262019e83f6bSPeter Maydell * the library but not declared in the header file we will 262119e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 262219e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 262319e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 262419e83f6bSPeter Maydell */ 2625c075a723SBlue Swirl return (int)(uintptr_t)&epoll_create1; 26263b6edd16SPeter Maydell} 26273b6edd16SPeter MaydellEOF 26288fb03151SPeter Maydellif compile_prog "" "" ; then 26293b6edd16SPeter Maydell epoll_create1=yes 26303b6edd16SPeter Maydellfi 26313b6edd16SPeter Maydell 26323b6edd16SPeter Maydellepoll_pwait=no 26333b6edd16SPeter Maydellcat > $TMPC << EOF 26343b6edd16SPeter Maydell#include <sys/epoll.h> 26353b6edd16SPeter Maydell 26363b6edd16SPeter Maydellint main(void) 26373b6edd16SPeter Maydell{ 26383b6edd16SPeter Maydell epoll_pwait(0, 0, 0, 0, 0); 26393b6edd16SPeter Maydell return 0; 26403b6edd16SPeter Maydell} 26413b6edd16SPeter MaydellEOF 26428fb03151SPeter Maydellif compile_prog "" "" ; then 26433b6edd16SPeter Maydell epoll_pwait=yes 26443b6edd16SPeter Maydellfi 26453b6edd16SPeter Maydell 2646cc8ae6deSpbrook# Check if tools are available to build documentation. 2647a25dba17SJuan Quintelaif test "$docs" != "no" ; then 264801668d98SStefan Weil if has makeinfo && has pod2man; then 2649a25dba17SJuan Quintela docs=yes 265083a3ab8bSJuan Quintela else 2651a25dba17SJuan Quintela if test "$docs" = "yes" ; then 2652a25dba17SJuan Quintela feature_not_found "docs" 265383a3ab8bSJuan Quintela fi 2654a25dba17SJuan Quintela docs=no 265583a3ab8bSJuan Quintela fi 2656cc8ae6deSpbrookfi 2657cc8ae6deSpbrook 2658f514f41cSStefan Weil# Search for bswap_32 function 26596ae9a1f4SJuan Quintelabyteswap_h=no 26606ae9a1f4SJuan Quintelacat > $TMPC << EOF 26616ae9a1f4SJuan Quintela#include <byteswap.h> 26626ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 26636ae9a1f4SJuan QuintelaEOF 266452166aa0SJuan Quintelaif compile_prog "" "" ; then 26656ae9a1f4SJuan Quintela byteswap_h=yes 26666ae9a1f4SJuan Quintelafi 26676ae9a1f4SJuan Quintela 2668f514f41cSStefan Weil# Search for bswap_32 function 26696ae9a1f4SJuan Quintelabswap_h=no 26706ae9a1f4SJuan Quintelacat > $TMPC << EOF 26716ae9a1f4SJuan Quintela#include <sys/endian.h> 26726ae9a1f4SJuan Quintela#include <sys/types.h> 26736ae9a1f4SJuan Quintela#include <machine/bswap.h> 26746ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 26756ae9a1f4SJuan QuintelaEOF 267652166aa0SJuan Quintelaif compile_prog "" "" ; then 26776ae9a1f4SJuan Quintela bswap_h=yes 26786ae9a1f4SJuan Quintelafi 26796ae9a1f4SJuan Quintela 2680da93a1fdSaliguori########################################## 2681c589b249SRonnie Sahlberg# Do we have libiscsi 2682fa6acb0cSRonnie Sahlberg# We check for iscsi_unmap_sync() to make sure we have a 2683fa6acb0cSRonnie Sahlberg# recent enough version of libiscsi. 2684c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then 2685c589b249SRonnie Sahlberg cat > $TMPC << EOF 2686fa6acb0cSRonnie Sahlberg#include <stdio.h> 2687c589b249SRonnie Sahlberg#include <iscsi/iscsi.h> 2688fa6acb0cSRonnie Sahlbergint main(void) { iscsi_unmap_sync(NULL,0,0,0,NULL,0); return 0; } 2689c589b249SRonnie SahlbergEOF 2690417c9d72SAlexander Graf if compile_prog "" "-liscsi" ; then 2691c589b249SRonnie Sahlberg libiscsi="yes" 2692c589b249SRonnie Sahlberg LIBS="$LIBS -liscsi" 2693c589b249SRonnie Sahlberg else 2694c589b249SRonnie Sahlberg if test "$libiscsi" = "yes" ; then 2695c589b249SRonnie Sahlberg feature_not_found "libiscsi" 2696c589b249SRonnie Sahlberg fi 2697c589b249SRonnie Sahlberg libiscsi="no" 2698c589b249SRonnie Sahlberg fi 2699c589b249SRonnie Sahlbergfi 2700c589b249SRonnie Sahlberg 2701c589b249SRonnie Sahlberg 2702c589b249SRonnie Sahlberg########################################## 27038bacde8dSNatanael Copa# Do we need libm 27048bacde8dSNatanael Copacat > $TMPC << EOF 27058bacde8dSNatanael Copa#include <math.h> 27068bacde8dSNatanael Copaint main(void) { return isnan(sin(0.0)); } 27078bacde8dSNatanael CopaEOF 27088bacde8dSNatanael Copaif compile_prog "" "" ; then 27098bacde8dSNatanael Copa : 27108bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then 27118bacde8dSNatanael Copa LIBS="-lm $LIBS" 27128bacde8dSNatanael Copa libs_qga="-lm $libs_qga" 27138bacde8dSNatanael Copaelse 27148bacde8dSNatanael Copa echo 27158bacde8dSNatanael Copa echo "Error: libm check failed" 27168bacde8dSNatanael Copa echo 27178bacde8dSNatanael Copa exit 1 27188bacde8dSNatanael Copafi 27198bacde8dSNatanael Copa 27208bacde8dSNatanael Copa########################################## 2721da93a1fdSaliguori# Do we need librt 27228bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime 27238bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't 27248bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this 27258bacde8dSNatanael Copa# function in addition. 2726da93a1fdSaliguoricat > $TMPC <<EOF 2727da93a1fdSaliguori#include <signal.h> 2728da93a1fdSaliguori#include <time.h> 27298bacde8dSNatanael Copaint main(void) { 27308bacde8dSNatanael Copa timer_create(CLOCK_REALTIME, NULL, NULL); 27318bacde8dSNatanael Copa return clock_gettime(CLOCK_REALTIME, NULL); 27328bacde8dSNatanael Copa} 2733da93a1fdSaliguoriEOF 2734da93a1fdSaliguori 273552166aa0SJuan Quintelaif compile_prog "" "" ; then 273607ffa4bdSJuan Quintela : 27378bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result 27388bacde8dSNatanael Copaelif compile_prog "" "-lrt $pthread_lib" ; then 273907ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 27408bacde8dSNatanael Copa libs_qga="-lrt $libs_qga" 2741da93a1fdSaliguorifi 2742da93a1fdSaliguori 274331ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 2744179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 27456362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 27466362a53fSJuan Quintelafi 27476362a53fSJuan Quintela 2748de5071c5SBlue Swirl########################################## 2749cd4ec0b4SGerd Hoffmann# spice probe 2750cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 2751cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 2752cd4ec0b4SGerd Hoffmann#include <spice.h> 2753cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 2754cd4ec0b4SGerd HoffmannEOF 2755710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 2756710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 275767be6726SGerd Hoffmann if $pkg_config --atleast-version=0.12.0 spice-server >/dev/null 2>&1 && \ 275867be6726SGerd Hoffmann $pkg_config --atleast-version=0.12.2 spice-protocol > /dev/null 2>&1 && \ 2759cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 2760cd4ec0b4SGerd Hoffmann spice="yes" 2761cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 2762cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 27632e0e3c39SAlon Levy spice_protocol_version=$($pkg_config --modversion spice-protocol) 27642e0e3c39SAlon Levy spice_server_version=$($pkg_config --modversion spice-server) 2765cd4ec0b4SGerd Hoffmann else 2766cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 2767cd4ec0b4SGerd Hoffmann feature_not_found "spice" 2768cd4ec0b4SGerd Hoffmann fi 2769cd4ec0b4SGerd Hoffmann spice="no" 2770cd4ec0b4SGerd Hoffmann fi 2771cd4ec0b4SGerd Hoffmannfi 2772cd4ec0b4SGerd Hoffmann 2773111a38b0SRobert Relyea# check for libcacard for smartcard support 2774111a38b0SRobert Relyeaif test "$smartcard" != "no" ; then 2775111a38b0SRobert Relyea smartcard="yes" 2776111a38b0SRobert Relyea smartcard_cflags="" 2777111a38b0SRobert Relyea # TODO - what's the minimal nss version we support? 2778111a38b0SRobert Relyea if test "$smartcard_nss" != "no"; then 27795f01e06fSSergei Trofimovich cat > $TMPC << EOF 27805f01e06fSSergei Trofimovich#include <pk11pub.h> 27815f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; } 27825f01e06fSSergei TrofimovichEOF 27830b22ef0fSPeter Maydell smartcard_includes="-I\$(SRC_PATH)/libcacard" 27848c741c22SAlon Levy libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs" 27858c741c22SAlon Levy libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags" 27866ca026cbSPeter Maydell test_cflags="$libcacard_cflags" 27876ca026cbSPeter Maydell # The header files in nss < 3.13.3 have a bug which causes them to 27886ca026cbSPeter Maydell # emit a warning. If we're going to compile QEMU with -Werror, then 27896ca026cbSPeter Maydell # test that the headers don't have this bug. Otherwise we would pass 27906ca026cbSPeter Maydell # the configure test but fail to compile QEMU later. 27916ca026cbSPeter Maydell if test "$werror" = "yes"; then 27926ca026cbSPeter Maydell test_cflags="-Werror $test_cflags" 27936ca026cbSPeter Maydell fi 27945f01e06fSSergei Trofimovich if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \ 27956ca026cbSPeter Maydell compile_prog "$test_cflags" "$libcacard_libs"; then 27965f01e06fSSergei Trofimovich smartcard_nss="yes" 27970b22ef0fSPeter Maydell QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags" 27980b22ef0fSPeter Maydell QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes" 2799ad4cf3f6SPaul Brook libs_softmmu="$libcacard_libs $libs_softmmu" 2800111a38b0SRobert Relyea else 2801111a38b0SRobert Relyea if test "$smartcard_nss" = "yes"; then 2802111a38b0SRobert Relyea feature_not_found "nss" 2803111a38b0SRobert Relyea fi 2804111a38b0SRobert Relyea smartcard_nss="no" 2805111a38b0SRobert Relyea fi 2806111a38b0SRobert Relyea fi 2807111a38b0SRobert Relyeafi 2808111a38b0SRobert Relyeaif test "$smartcard" = "no" ; then 2809111a38b0SRobert Relyea smartcard_nss="no" 2810111a38b0SRobert Relyeafi 2811111a38b0SRobert Relyea 281269354a83SHans de Goede# check for usbredirparser for usb network redirection support 281369354a83SHans de Goedeif test "$usb_redir" != "no" ; then 2814c19a7981SHans de Goede if $pkg_config --atleast-version=0.5.3 libusbredirparser-0.5 >/dev/null 2>&1 ; then 281569354a83SHans de Goede usb_redir="yes" 28168b626aa7SHans de Goede usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5 2>/dev/null) 28178b626aa7SHans de Goede usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5 2>/dev/null) 281869354a83SHans de Goede QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags" 281956ab2ad1SAurelien Jarno libs_softmmu="$libs_softmmu $usb_redir_libs" 282069354a83SHans de Goede else 282169354a83SHans de Goede if test "$usb_redir" = "yes"; then 282269354a83SHans de Goede feature_not_found "usb-redir" 282369354a83SHans de Goede fi 282469354a83SHans de Goede usb_redir="no" 282569354a83SHans de Goede fi 282669354a83SHans de Goedefi 282769354a83SHans de Goede 2828cd4ec0b4SGerd Hoffmann########################################## 2829cd4ec0b4SGerd Hoffmann 2830747bbdf7SBlue Swirl########################################## 28315f6b9e8fSBlue Swirl# check if we have fdatasync 28325f6b9e8fSBlue Swirl 28335f6b9e8fSBlue Swirlfdatasync=no 28345f6b9e8fSBlue Swirlcat > $TMPC << EOF 28355f6b9e8fSBlue Swirl#include <unistd.h> 2836d1722a27SAlexandre Raymondint main(void) { 2837d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 2838d1722a27SAlexandre Raymondreturn fdatasync(0); 2839d1722a27SAlexandre Raymond#else 2840e172fe11SStefan Weil#error Not supported 2841d1722a27SAlexandre Raymond#endif 2842d1722a27SAlexandre Raymond} 28435f6b9e8fSBlue SwirlEOF 28445f6b9e8fSBlue Swirlif compile_prog "" "" ; then 28455f6b9e8fSBlue Swirl fdatasync=yes 28465f6b9e8fSBlue Swirlfi 28475f6b9e8fSBlue Swirl 284894a420b1SStefan Hajnoczi########################################## 2849e78815a5SAndreas Färber# check if we have madvise 2850e78815a5SAndreas Färber 2851e78815a5SAndreas Färbermadvise=no 2852e78815a5SAndreas Färbercat > $TMPC << EOF 2853e78815a5SAndreas Färber#include <sys/types.h> 2854e78815a5SAndreas Färber#include <sys/mman.h> 2855832ce9c2SScott Wood#include <stddef.h> 2856e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 2857e78815a5SAndreas FärberEOF 2858e78815a5SAndreas Färberif compile_prog "" "" ; then 2859e78815a5SAndreas Färber madvise=yes 2860e78815a5SAndreas Färberfi 2861e78815a5SAndreas Färber 2862e78815a5SAndreas Färber########################################## 2863e78815a5SAndreas Färber# check if we have posix_madvise 2864e78815a5SAndreas Färber 2865e78815a5SAndreas Färberposix_madvise=no 2866e78815a5SAndreas Färbercat > $TMPC << EOF 2867e78815a5SAndreas Färber#include <sys/mman.h> 2868832ce9c2SScott Wood#include <stddef.h> 2869e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 2870e78815a5SAndreas FärberEOF 2871e78815a5SAndreas Färberif compile_prog "" "" ; then 2872e78815a5SAndreas Färber posix_madvise=yes 2873e78815a5SAndreas Färberfi 2874e78815a5SAndreas Färber 2875e78815a5SAndreas Färber########################################## 28761e9737daSRichard Henderson# check if we have usable SIGEV_THREAD_ID 28771e9737daSRichard Henderson 28781e9737daSRichard Hendersonsigev_thread_id=no 28791e9737daSRichard Hendersoncat > $TMPC << EOF 28801e9737daSRichard Henderson#include <signal.h> 28811e9737daSRichard Hendersonint main(void) { 28821e9737daSRichard Henderson struct sigevent ev; 28831e9737daSRichard Henderson ev.sigev_notify = SIGEV_THREAD_ID; 28841e9737daSRichard Henderson ev._sigev_un._tid = 0; 28851e9737daSRichard Henderson asm volatile("" : : "g"(&ev)); 28861e9737daSRichard Henderson return 0; 28871e9737daSRichard Henderson} 28881e9737daSRichard HendersonEOF 28891e9737daSRichard Hendersonif compile_prog "" "" ; then 28901e9737daSRichard Henderson sigev_thread_id=yes 28911e9737daSRichard Hendersonfi 28921e9737daSRichard Henderson 28931e9737daSRichard Henderson########################################## 289494a420b1SStefan Hajnoczi# check if trace backend exists 289594a420b1SStefan Hajnoczi 2896650ab98dSLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend > /dev/null 2> /dev/null 289794a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 289894a420b1SStefan Hajnoczi echo 289994a420b1SStefan Hajnoczi echo "Error: invalid trace backend" 290094a420b1SStefan Hajnoczi echo "Please choose a supported trace backend." 290194a420b1SStefan Hajnoczi echo 290294a420b1SStefan Hajnoczi exit 1 290394a420b1SStefan Hajnoczifi 290494a420b1SStefan Hajnoczi 29057e24e92aSStefan Hajnoczi########################################## 29067e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 29077e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then 29087e24e92aSStefan Hajnoczi cat > $TMPC << EOF 29097e24e92aSStefan Hajnoczi#include <ust/tracepoint.h> 29107e24e92aSStefan Hajnoczi#include <ust/marker.h> 29117e24e92aSStefan Hajnocziint main(void) { return 0; } 29127e24e92aSStefan HajnocziEOF 29137e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 291494b4fefaSLluís Vilanova LIBS="-lust -lurcu-bp $LIBS" 2915c9a2e37cSLluís Vilanova libs_qga="-lust -lurcu-bp $libs_qga" 29167e24e92aSStefan Hajnoczi else 29177e24e92aSStefan Hajnoczi echo 29187e24e92aSStefan Hajnoczi echo "Error: Trace backend 'ust' missing libust header files" 29197e24e92aSStefan Hajnoczi echo 29207e24e92aSStefan Hajnoczi exit 1 29217e24e92aSStefan Hajnoczi fi 29227e24e92aSStefan Hajnoczifi 2923b3d08c02SDaniel P. Berrange 2924b3d08c02SDaniel P. Berrange########################################## 2925b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 2926b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then 2927b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 2928b3d08c02SDaniel P. Berrange echo 2929b3d08c02SDaniel P. Berrange echo "Error: dtrace command is not found in PATH $PATH" 2930b3d08c02SDaniel P. Berrange echo 2931b3d08c02SDaniel P. Berrange exit 1 2932b3d08c02SDaniel P. Berrange fi 2933c276b17dSDaniel P. Berrange trace_backend_stap="no" 2934c276b17dSDaniel P. Berrange if has 'stap' ; then 2935c276b17dSDaniel P. Berrange trace_backend_stap="yes" 2936c276b17dSDaniel P. Berrange fi 2937b3d08c02SDaniel P. Berrangefi 2938b3d08c02SDaniel P. Berrange 29397e24e92aSStefan Hajnoczi########################################## 2940023367e6SWolfgang Mauerer# __sync_fetch_and_and requires at least -march=i486. Many toolchains 2941023367e6SWolfgang Mauerer# use i686 as default anyway, but for those that don't, an explicit 2942023367e6SWolfgang Mauerer# specification is necessary 29431ba16968SStefan Weilif test "$vhost_net" = "yes" && test "$cpu" = "i386"; then 2944023367e6SWolfgang Mauerer cat > $TMPC << EOF 29457ace252aSStefan Weilstatic int sfaa(int *ptr) 2946023367e6SWolfgang Mauerer{ 2947023367e6SWolfgang Mauerer return __sync_fetch_and_and(ptr, 0); 2948023367e6SWolfgang Mauerer} 2949023367e6SWolfgang Mauerer 2950abab1a0fSStefan Weilint main(void) 2951023367e6SWolfgang Mauerer{ 2952023367e6SWolfgang Mauerer int val = 42; 2953023367e6SWolfgang Mauerer sfaa(&val); 2954023367e6SWolfgang Mauerer return val; 2955023367e6SWolfgang Mauerer} 2956023367e6SWolfgang MauererEOF 2957023367e6SWolfgang Mauerer if ! compile_prog "" "" ; then 2958caa50971SPeter Maydell QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS" 2959023367e6SWolfgang Mauerer fi 2960023367e6SWolfgang Mauererfi 2961023367e6SWolfgang Mauerer 2962023367e6SWolfgang Mauerer########################################## 2963519175a2SAlex Barcelo# check and set a backend for coroutine 2964d0e2fce5SAneesh Kumar K.V 2965519175a2SAlex Barcelo# default is ucontext, but always fallback to gthread 2966519175a2SAlex Barcelo# windows autodetected by make 2967519175a2SAlex Barceloif test "$coroutine" = "" -o "$coroutine" = "ucontext"; then 2968d0e2fce5SAneesh Kumar K.V if test "$darwin" != "yes"; then 2969d0e2fce5SAneesh Kumar K.V cat > $TMPC << EOF 2970d0e2fce5SAneesh Kumar K.V#include <ucontext.h> 2971cdf84806SPeter Maydell#ifdef __stub_makecontext 2972cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail 2973cdf84806SPeter Maydell#endif 297475cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; } 2975d0e2fce5SAneesh Kumar K.VEOF 2976d0e2fce5SAneesh Kumar K.V if compile_prog "" "" ; then 2977519175a2SAlex Barcelo coroutine_backend=ucontext 2978519175a2SAlex Barcelo else 2979519175a2SAlex Barcelo coroutine_backend=gthread 2980d0e2fce5SAneesh Kumar K.V fi 2981519175a2SAlex Barcelo fi 2982519175a2SAlex Barceloelif test "$coroutine" = "gthread" ; then 2983519175a2SAlex Barcelo coroutine_backend=gthread 2984519175a2SAlex Barceloelif test "$coroutine" = "windows" ; then 2985519175a2SAlex Barcelo coroutine_backend=windows 2986fe91bfa8SAlex Barceloelif test "$coroutine" = "sigaltstack" ; then 2987fe91bfa8SAlex Barcelo coroutine_backend=sigaltstack 2988519175a2SAlex Barceloelse 2989519175a2SAlex Barcelo echo 2990519175a2SAlex Barcelo echo "Error: unknown coroutine backend $coroutine" 2991519175a2SAlex Barcelo echo 2992519175a2SAlex Barcelo exit 1 2993d0e2fce5SAneesh Kumar K.Vfi 2994d0e2fce5SAneesh Kumar K.V 2995d0e2fce5SAneesh Kumar K.V########################################## 2996d2042378SAneesh Kumar K.V# check if we have open_by_handle_at 2997d2042378SAneesh Kumar K.V 29984e1797f9SStefan Weilopen_by_handle_at=no 2999d2042378SAneesh Kumar K.Vcat > $TMPC << EOF 3000d2042378SAneesh Kumar K.V#include <fcntl.h> 3001acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH) 3002acc55ba8SStefan Weil# error missing definition 3003acc55ba8SStefan Weil#else 300475cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } 3005acc55ba8SStefan Weil#endif 3006d2042378SAneesh Kumar K.VEOF 3007d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then 3008d2042378SAneesh Kumar K.V open_by_handle_at=yes 3009d2042378SAneesh Kumar K.Vfi 3010d2042378SAneesh Kumar K.V 3011e06a765eSHarsh Prateek Bora######################################## 3012e06a765eSHarsh Prateek Bora# check if we have linux/magic.h 3013e06a765eSHarsh Prateek Bora 3014e06a765eSHarsh Prateek Boralinux_magic_h=no 3015e06a765eSHarsh Prateek Boracat > $TMPC << EOF 3016e06a765eSHarsh Prateek Bora#include <linux/magic.h> 3017e06a765eSHarsh Prateek Boraint main(void) { 301875cafad7SStefan Weil return 0; 3019e06a765eSHarsh Prateek Bora} 3020e06a765eSHarsh Prateek BoraEOF 3021e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then 3022e06a765eSHarsh Prateek Bora linux_magic_h=yes 3023e06a765eSHarsh Prateek Borafi 3024e06a765eSHarsh Prateek Bora 30258ab1bf12SLuiz Capitulino######################################## 302606d71fa1SPeter Maydell# check whether we can disable the -Wunused-but-set-variable 302706d71fa1SPeter Maydell# option with a pragma (this is needed to silence a warning in 302806d71fa1SPeter Maydell# some versions of the valgrind VALGRIND_STACK_DEREGISTER macro.) 302906d71fa1SPeter Maydell# This test has to be compiled with -Werror as otherwise an 303006d71fa1SPeter Maydell# unknown pragma is only a warning. 303106d71fa1SPeter Maydellpragma_disable_unused_but_set=no 303206d71fa1SPeter Maydellcat > $TMPC << EOF 303306d71fa1SPeter Maydell#pragma GCC diagnostic ignored "-Wunused-but-set-variable" 303406d71fa1SPeter Maydellint main(void) { 303506d71fa1SPeter Maydell return 0; 303606d71fa1SPeter Maydell} 303706d71fa1SPeter MaydellEOF 303806d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then 303906d71fa1SPeter Maydell pragma_disable_unused_but_set=yes 304006d71fa1SPeter Maydellfi 304106d71fa1SPeter Maydell 304206d71fa1SPeter Maydell######################################## 304362fe8331SChristian Borntraeger# check if we have valgrind/valgrind.h and valgrind/memcheck.h 30443f4349dcSKevin Wolf 30453f4349dcSKevin Wolfvalgrind_h=no 30463f4349dcSKevin Wolfcat > $TMPC << EOF 30473f4349dcSKevin Wolf#include <valgrind/valgrind.h> 304862fe8331SChristian Borntraeger#include <valgrind/memcheck.h> 30493f4349dcSKevin Wolfint main(void) { 30503f4349dcSKevin Wolf return 0; 30513f4349dcSKevin Wolf} 30523f4349dcSKevin WolfEOF 30533f4349dcSKevin Wolfif compile_prog "" "" ; then 30543f4349dcSKevin Wolf valgrind_h=yes 30553f4349dcSKevin Wolffi 30563f4349dcSKevin Wolf 30573f4349dcSKevin Wolf######################################## 30588ab1bf12SLuiz Capitulino# check if environ is declared 30598ab1bf12SLuiz Capitulino 30608ab1bf12SLuiz Capitulinohas_environ=no 30618ab1bf12SLuiz Capitulinocat > $TMPC << EOF 30628ab1bf12SLuiz Capitulino#include <unistd.h> 30638ab1bf12SLuiz Capitulinoint main(void) { 3064c075a723SBlue Swirl environ = 0; 30658ab1bf12SLuiz Capitulino return 0; 30668ab1bf12SLuiz Capitulino} 30678ab1bf12SLuiz CapitulinoEOF 30688ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then 30698ab1bf12SLuiz Capitulino has_environ=yes 30708ab1bf12SLuiz Capitulinofi 30718ab1bf12SLuiz Capitulino 3072d2042378SAneesh Kumar K.V########################################## 3073e86ecd4bSJuan Quintela# End of CC checks 3074e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 3075e86ecd4bSJuan Quintela 3076e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then 30778be74dc0SAvi Kivity CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS" 3078e86ecd4bSJuan Quintelafi 3079a316e378SJuan Quintela 308020ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 308120ff6c80SAnthony Liguori# enable/disable 308220ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 308320ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 308420ff6c80SAnthony Liguori zero_malloc="no" 308520ff6c80SAnthony Liguori else 308620ff6c80SAnthony Liguori zero_malloc="yes" 308720ff6c80SAnthony Liguori fi 308820ff6c80SAnthony Liguorifi 308920ff6c80SAnthony Liguori 30906ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags 30916ca026cbSPeter Maydellif test "$werror" = "yes"; then 30926ca026cbSPeter Maydell QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 30936ca026cbSPeter Maydellfi 30946ca026cbSPeter Maydell 3095e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 3096e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 30971156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 3098e86ecd4bSJuan Quintela fi 3099e86ecd4bSJuan Quintelafi 3100e86ecd4bSJuan Quintela 310194dd53c5SGerd Hoffmann# test if pod2man has --utf8 option 310294dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then 310394dd53c5SGerd Hoffmann POD2MAN="pod2man --utf8" 310494dd53c5SGerd Hoffmannelse 310594dd53c5SGerd Hoffmann POD2MAN="pod2man" 310694dd53c5SGerd Hoffmannfi 310794dd53c5SGerd Hoffmann 3108952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 3109952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 3110952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 3111952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 3112952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 3113952afb71SBlue Swirl fi 3114952afb71SBlue Swirl done 3115952afb71SBlue Swirlfi 3116952afb71SBlue Swirl 311710ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix 3118528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix 31195a67135aSbellard 31204b1c11fdSDaniel P. Berrangetools="" 31214b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then 3122ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 31234b1c11fdSDaniel P. Berrange if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 31244b1c11fdSDaniel P. Berrange tools="qemu-nbd\$(EXESUF) $tools" 31254b1c11fdSDaniel P. Berrange fi 31264b1c11fdSDaniel P. Berrangefi 31274b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then 3128983eef5aSMeador Inge if test "$virtfs" != no ; then 3129be5ea8edSAnthony Liguori if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then 3130983eef5aSMeador Inge virtfs=yes 313117bff52bSM. Mohan Kumar tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)" 3132983eef5aSMeador Inge else 3133983eef5aSMeador Inge if test "$virtfs" = yes; then 3134263ddcc8SHarsh Prateek Bora echo "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel" 3135263ddcc8SHarsh Prateek Bora exit 1 3136983eef5aSMeador Inge fi 313717500370SAndreas Färber virtfs=no 3138983eef5aSMeador Inge fi 313917bff52bSM. Mohan Kumar fi 3140ca35f780SPaolo Bonzini if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 3141d138cee9SMichael Roth if [ "$guest_agent" = "yes" ]; then 314248ff7a62SMichael Roth tools="qemu-ga\$(EXESUF) $tools" 3143d138cee9SMichael Roth fi 3144ca35f780SPaolo Bonzini fi 314500c705fbSPaolo Bonzini if test "$smartcard_nss" = "yes" ; then 314600c705fbSPaolo Bonzini tools="vscclient\$(EXESUF) $tools" 314700c705fbSPaolo Bonzini fi 31484b1c11fdSDaniel P. Berrangefi 3149ca35f780SPaolo Bonzini 3150ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 3151ca35f780SPaolo Bonziniroms= 3152ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 3153ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 3154ca35f780SPaolo Bonzini "$softmmu" = yes ; then 3155ca35f780SPaolo Bonzini roms="optionrom" 3156ca35f780SPaolo Bonzinifi 3157d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then 315839ac8455SDavid Gibson roms="$roms spapr-rtas" 315939ac8455SDavid Gibsonfi 3160ca35f780SPaolo Bonzini 31615ca9388aSGerd Hoffmann# add pixman flags after all config tests are done 31625ca9388aSGerd HoffmannQEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags" 31635ca9388aSGerd Hoffmannlibs_softmmu="$libs_softmmu $pixman_libs" 31645ca9388aSGerd Hoffmann 31657d13299dSbellardecho "Install prefix $prefix" 3166c00b2808SEduardo Habkostecho "BIOS directory `eval echo $qemu_datadir`" 3167f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 31683aa5d2beSAlon Levyecho "library directory `eval echo $libdir`" 31698bf188aaSMichael Tokarevecho "libexec directory `eval echo $libexecdir`" 31700f94d6daSAlon Levyecho "include directory `eval echo $includedir`" 31711c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 3172785c23aeSLuiz Capitulinoecho "local state directory `eval echo $local_statedir`" 317311d9f695Sbellardif test "$mingw32" = "no" ; then 3174f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 317543ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 317611d9f695Sbellardfi 31775a67135aSbellardecho "Source path $source_path" 31787d13299dSbellardecho "C compiler $cc" 317983469015Sbellardecho "Host C compiler $host_cc" 31803c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc" 31810c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 3182a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 31830c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 31847d13299dSbellardecho "make $make" 31856a882643Spbrookecho "install $install" 3186c886edfbSBlue Swirlecho "python $python" 3187e2d8830eSBradif test "$slirp" = "yes" ; then 3188e2d8830eSBrad echo "smbd $smbd" 3189e2d8830eSBradfi 3190a98fd896Sbellardecho "host CPU $cpu" 3191de83cd02Sbellardecho "host big endian $bigendian" 319297a847bcSbellardecho "target list $target_list" 3193ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 31947d13299dSbellardecho "gprof enabled $gprof" 319503b4fe7dSaliguoriecho "sparse enabled $sparse" 31961625af87Saliguoriecho "strip binaries $strip_opt" 319705c2a3e7Sbellardecho "profiler $profiler" 319843ce4dfeSbellardecho "static build $static" 319985aa5189Sbellardecho "-Werror enabled $werror" 32005b0753e0Sbellardif test "$darwin" = "yes" ; then 32015b0753e0Sbellard echo "Cocoa support $cocoa" 32025b0753e0Sbellardfi 3203e2134eb9SGerd Hoffmannecho "pixman $pixman" 320497a847bcSbellardecho "SDL support $sdl" 32054d3b6f6eSbalrogecho "curses support $curses" 3206769ce76dSAlexander Grafecho "curl support $curl" 320767b915a5Sbellardecho "mingw32 support $mingw32" 32080c58ac1cSmalcecho "Audio drivers $audio_drv_list" 32090c58ac1cSmalcecho "Extra audio cards $audio_card_list" 3210eb852011SMarkus Armbrusterecho "Block whitelist $block_drv_whitelist" 32118ff9cbf7Smalcecho "Mixer emulation $mixemu" 3212983eef5aSMeador Ingeecho "VirtFS support $virtfs" 3213821601eaSJes Sorensenecho "VNC support $vnc" 3214821601eaSJes Sorensenif test "$vnc" = "yes" ; then 32158d5d2d4cSths echo "VNC TLS support $vnc_tls" 32162f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 32172f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 3218efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 3219821601eaSJes Sorensenfi 32203142255cSblueswir1if test -n "$sparc_cpu"; then 32213142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 32223142255cSblueswir1fi 3223e37630caSaliguoriecho "xen support $xen" 32242e4d9fb1Saurel32echo "brlapi support $brlapi" 3225a20a6f46SJuan Quintelaecho "bluez support $bluez" 3226a25dba17SJuan Quintelaecho "Documentation $docs" 3227c5937220Spbrook[ ! -z "$uname_release" ] && \ 3228c5937220Spbrookecho "uname -r $uname_release" 3229bd0c5661Spbrookecho "NPTL support $nptl" 3230379f6698SPaul Brookecho "GUEST_BASE $guest_base" 323140d6444eSAvi Kivityecho "PIE $pie" 32328a16d273Sthsecho "vde support $vde" 32335c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 3234758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 323577755340Sthsecho "Install blobs $blobs" 3236b31a0277SJuan Quintelaecho "KVM support $kvm" 32379195b2c2SStefan Weilecho "TCG interpreter $tcg_interpreter" 3238f652e6afSaurel32echo "fdt support $fdt" 3239ceb42de8Saliguoriecho "preadv support $preadv" 32405f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 3241e78815a5SAndreas Färberecho "madvise $madvise" 3242e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 32431e9737daSRichard Hendersonecho "sigev_thread_id $sigev_thread_id" 3244ee682d27SStefan Weilecho "uuid support $uuid" 324547e98658SCorey Bryantecho "libcap-ng support $cap_ng" 3246d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 324794a420b1SStefan Hajnocziecho "Trace backend $trace_backend" 32489410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 32492e0e3c39SAlon Levyecho "spice support $spice ($spice_protocol_version/$spice_server_version)" 3250f27aaf4bSChristian Brunnerecho "rbd support $rbd" 3251dce512deSChristoph Hellwigecho "xfsctl support $xfs" 3252111a38b0SRobert Relyeaecho "nss used $smartcard_nss" 325369354a83SHans de Goedeecho "usb net redir $usb_redir" 325420ff075bSMichael Walleecho "OpenGL support $opengl" 3255c589b249SRonnie Sahlbergecho "libiscsi support $libiscsi" 3256d138cee9SMichael Rothecho "build guest agent $guest_agent" 3257f794573eSEduardo Otuboecho "seccomp support $seccomp" 3258519175a2SAlex Barceloecho "coroutine backend $coroutine_backend" 3259eb100396SBharata B Raoecho "GlusterFS support $glusterfs" 326067b915a5Sbellard 32611ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then 326224b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 3263e8cd23deSbellardfi 326497a847bcSbellard 326598ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 32664bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld" 326797a847bcSbellard 326898ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 326998ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 327098ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 327198ec69acSJuan Quintelaecho >> $config_host_mak 327298ec69acSJuan Quintela 3273e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 327499d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 327599d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 32763aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 32778bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak 32780f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak 327999d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 328099d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 328122d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak 32829afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak 32839afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak 3284785c23aeSLuiz Capitulinoecho "qemu_localstatedir=$local_statedir" >> $config_host_mak 3285f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak 3286804edf29SJuan Quintela 328798ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 3288f8393946Saurel32if test "$debug_tcg" = "yes" ; then 32892358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 3290f8393946Saurel32fi 3291f3d08ee6SPaul Brookif test "$debug" = "yes" ; then 32922358a494SJuan Quintela echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak 3293f3d08ee6SPaul Brookfi 32941625af87Saliguoriif test "$strip_opt" = "yes" ; then 329552ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 32961625af87Saliguorifi 32977d13299dSbellardif test "$bigendian" = "yes" ; then 3298e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 329997a847bcSbellardfi 330067b915a5Sbellardif test "$mingw32" = "yes" ; then 330198ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 33029fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 33039fe6de94SBlue Swirl version_major=${rc_version%%.*} 33049fe6de94SBlue Swirl rc_version=${rc_version#*.} 33059fe6de94SBlue Swirl version_minor=${rc_version%%.*} 33069fe6de94SBlue Swirl rc_version=${rc_version#*.} 33079fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 33089fe6de94SBlue Swirl version_micro=0 33099fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 33109fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 3311210fa556Spbrookelse 331235f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 3313210fa556Spbrookfi 3314128ab2ffSblueswir1 3315dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 3316dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 3317dffcb71cSMark McLoughlinfi 3318dffcb71cSMark McLoughlin 331983fb7adfSbellardif test "$darwin" = "yes" ; then 332098ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 332183fb7adfSbellardfi 3322b29fe3edSmalc 3323b29fe3edSmalcif test "$aix" = "yes" ; then 332498ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 3325b29fe3edSmalcfi 3326b29fe3edSmalc 3327ec530c81Sbellardif test "$solaris" = "yes" ; then 332898ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 33292358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 33300475a5caSths if test "$needs_libsunmath" = "yes" ; then 333175b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 33320475a5caSths fi 3333ec530c81Sbellardfi 3334179cf400SAndreas Färberif test "$haiku" = "yes" ; then 3335179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 3336179cf400SAndreas Färberfi 333797a847bcSbellardif test "$static" = "yes" ; then 333898ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 333997a847bcSbellardfi 33401ba16968SStefan Weilif test "$profiler" = "yes" ; then 33412358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 334205c2a3e7Sbellardfi 3343c20709aaSbellardif test "$slirp" = "yes" ; then 334498ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 3345e2d8830eSBrad echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak 3346c20709aaSbellardfi 33478a16d273Sthsif test "$vde" = "yes" ; then 334898ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 33498a16d273Sthsfi 335047e98658SCorey Bryantif test "$cap_ng" = "yes" ; then 335147e98658SCorey Bryant echo "CONFIG_LIBCAP=y" >> $config_host_mak 335247e98658SCorey Bryantfi 33530c58ac1cSmalcfor card in $audio_card_list; do 3354bb55b712SStefan Weil def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'` 335598ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 33560c58ac1cSmalcdone 33572358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 33580c58ac1cSmalcfor drv in $audio_drv_list; do 3359bb55b712SStefan Weil def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'` 336098ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 3361923e4521Smalc if test "$drv" = "fmod"; then 33627aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 3363fb065187Sbellard fi 33640c58ac1cSmalcdone 336567f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 336667f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 336767f86e8eSJuan Quintelafi 3368d5631638Smalcif test "$audio_win_int" = "yes" ; then 3369d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 3370d5631638Smalcfi 3371eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak 33728ff9cbf7Smalcif test "$mixemu" = "yes" ; then 337398ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 33748ff9cbf7Smalcfi 3375821601eaSJes Sorensenif test "$vnc" = "yes" ; then 3376821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 3377821601eaSJes Sorensenfi 33788d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 337998ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 3380525061bfSJuan Quintela echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak 33818d5d2d4cSthsfi 33822f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 338398ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 338460ddf533SJuan Quintela echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak 33852f9606b3Saliguorifi 3386821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 33872f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 33882f6f5c7aSCorentin Chary echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak 33892f6f5c7aSCorentin Charyfi 3390821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 3391efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 3392efe556adSCorentin Chary echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak 3393efe556adSCorentin Charyfi 339476655d6dSaliguoriif test "$fnmatch" = "yes" ; then 33952358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 339676655d6dSaliguorifi 3397ee682d27SStefan Weilif test "$uuid" = "yes" ; then 3398ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 3399ee682d27SStefan Weilfi 3400dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 3401dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 3402dce512deSChristoph Hellwigfi 3403b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 340498ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 34052358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 340698ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 340798ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 3408a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 340998ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 3410cc8ae6deSpbrookfi 34111ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 341298ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 34138ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 341449ecc3faSbellardfi 341549ecc3faSbellardif test "$cocoa" = "yes" ; then 341698ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 341749ecc3faSbellardfi 34184d3b6f6eSbalrogif test "$curses" = "yes" ; then 341998ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 3420ab4e5602SJan Kiszkafi 34213b3f24adSaurel32if test "$atfile" = "yes" ; then 34222358a494SJuan Quintela echo "CONFIG_ATFILE=y" >> $config_host_mak 34233b3f24adSaurel32fi 3424ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 34252358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 3426ebc996f3SRiku Voipiofi 3427099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 34282358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 3429099d6b0fSRiku Voipiofi 343040ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 343140ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 343240ff6d7eSKevin Wolffi 34333ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 34342358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 34353ce34dfbSvibisreenivasanfi 3436c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 3437c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 3438c2882b96SRiku Voipiofi 3439d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 3440d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 3441d0927938SUlrich Hechtfi 3442c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 3443c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 3444c727f47dSPeter Maydellfi 3445dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 3446dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 3447dace20dcSPeter Maydellfi 3448d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 3449d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 3450d0927938SUlrich Hechtfi 34513b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 34523b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 34533b6edd16SPeter Maydellfi 34543b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 34553b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 34563b6edd16SPeter Maydellfi 34573b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then 34583b6edd16SPeter Maydell echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak 34593b6edd16SPeter Maydellfi 34603b3f24adSaurel32if test "$inotify" = "yes" ; then 34612358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 34623b3f24adSaurel32fi 3463c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 3464c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 3465c05c7a73SRiku Voipiofi 34666ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 34676ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 34686ae9a1f4SJuan Quintelafi 34696ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 34706ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 34716ae9a1f4SJuan Quintelafi 3472769ce76dSAlexander Grafif test "$curl" = "yes" ; then 347398ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 3474b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 3475769ce76dSAlexander Graffi 34762e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 347798ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 34782e4d9fb1Saurel32fi 3479fb599c9aSbalrogif test "$bluez" = "yes" ; then 348098ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 3481ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 3482fb599c9aSbalrogfi 3483e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak 3484e37630caSaliguoriif test "$xen" = "yes" ; then 34856dbd588aSJan Kiszka echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak 3486d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 3487e37630caSaliguorifi 34885c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 34895c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 34905c6c3a6cSChristoph Hellwigfi 3491758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 3492758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 3493758e8e38SVenkateswararao Jujjuri (JV)fi 34944f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then 34954f26f2b6SAvi Kivity echo "CONFIG_LIBATTR=y" >> $config_host_mak 34964f26f2b6SAvi Kivityfi 3497983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then 3498758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 3499758e8e38SVenkateswararao Jujjuri (JV)fi 350077755340Sthsif test "$blobs" = "yes" ; then 350198ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 350277755340Sthsfi 3503bf9298b9Saliguoriif test "$iovec" = "yes" ; then 35042358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 3505bf9298b9Saliguorifi 3506ceb42de8Saliguoriif test "$preadv" = "yes" ; then 35072358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 3508ceb42de8Saliguorifi 3509f652e6afSaurel32if test "$fdt" = "yes" ; then 35103f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 3511f652e6afSaurel32fi 3512dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 3513dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 3514dcc38d1cSMarcelo Tosattifi 35159195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 35169195b2c2SStefan Weil echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak 35179195b2c2SStefan Weilfi 35185f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 35195f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 35205f6b9e8fSBlue Swirlfi 3521e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 3522e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 3523e78815a5SAndreas Färberfi 3524e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 3525e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 3526e78815a5SAndreas Färberfi 35271e9737daSRichard Hendersonif test "$sigev_thread_id" = "yes" ; then 35281e9737daSRichard Henderson echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak 35291e9737daSRichard Hendersonfi 353097a847bcSbellard 3531cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 3532cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 3533cd4ec0b4SGerd Hoffmannfi 3534cd4ec0b4SGerd Hoffmann 353536707144SAlon Levyif test "$smartcard" = "yes" ; then 353636707144SAlon Levy echo "CONFIG_SMARTCARD=y" >> $config_host_mak 353736707144SAlon Levyfi 353836707144SAlon Levy 3539111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 3540111a38b0SRobert Relyea echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak 3541ad4cf3f6SPaul Brook echo "libcacard_libs=$libcacard_libs" >> $config_host_mak 3542ad4cf3f6SPaul Brook echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak 3543111a38b0SRobert Relyeafi 3544111a38b0SRobert Relyea 354569354a83SHans de Goedeif test "$usb_redir" = "yes" ; then 354669354a83SHans de Goede echo "CONFIG_USB_REDIR=y" >> $config_host_mak 354769354a83SHans de Goedefi 354869354a83SHans de Goede 354920ff075bSMichael Walleif test "$opengl" = "yes" ; then 355020ff075bSMichael Walle echo "CONFIG_OPENGL=y" >> $config_host_mak 355120ff075bSMichael Wallefi 355220ff075bSMichael Walle 3553c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then 3554c589b249SRonnie Sahlberg echo "CONFIG_LIBISCSI=y" >> $config_host_mak 3555c589b249SRonnie Sahlbergfi 3556c589b249SRonnie Sahlberg 3557f794573eSEduardo Otuboif test "$seccomp" = "yes"; then 3558f794573eSEduardo Otubo echo "CONFIG_SECCOMP=y" >> $config_host_mak 3559f794573eSEduardo Otubofi 3560f794573eSEduardo Otubo 356183fb7adfSbellard# XXX: suppress that 35627d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 35632358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 35647d3505c5Sbellardfi 35657d3505c5Sbellard 35662358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 3567c5937220Spbrook 356820ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 356920ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 357020ff6c80SAnthony Liguorifi 3571f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 3572f27aaf4bSChristian Brunner echo "CONFIG_RBD=y" >> $config_host_mak 3573f27aaf4bSChristian Brunnerfi 357420ff6c80SAnthony Liguori 3575519175a2SAlex Barceloif test "$coroutine_backend" = "ucontext" ; then 3576d0e2fce5SAneesh Kumar K.V echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak 3577fe91bfa8SAlex Barceloelif test "$coroutine_backend" = "sigaltstack" ; then 3578fe91bfa8SAlex Barcelo echo "CONFIG_SIGALTSTACK_COROUTINE=y" >> $config_host_mak 3579d0e2fce5SAneesh Kumar K.Vfi 3580d0e2fce5SAneesh Kumar K.V 3581d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then 3582d2042378SAneesh Kumar K.V echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak 3583d2042378SAneesh Kumar K.Vfi 3584d2042378SAneesh Kumar K.V 3585e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then 3586e06a765eSHarsh Prateek Bora echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak 3587e06a765eSHarsh Prateek Borafi 3588e06a765eSHarsh Prateek Bora 358906d71fa1SPeter Maydellif test "$pragma_disable_unused_but_set" = "yes" ; then 359006d71fa1SPeter Maydell echo "CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET=y" >> $config_host_mak 359106d71fa1SPeter Maydellfi 359206d71fa1SPeter Maydell 35933f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then 35943f4349dcSKevin Wolf echo "CONFIG_VALGRIND_H=y" >> $config_host_mak 35953f4349dcSKevin Wolffi 35963f4349dcSKevin Wolf 35978ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then 35988ab1bf12SLuiz Capitulino echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak 35998ab1bf12SLuiz Capitulinofi 36008ab1bf12SLuiz Capitulino 3601eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then 3602eb100396SBharata B Rao echo "CONFIG_GLUSTERFS=y" >> $config_host_mak 3603eb100396SBharata B Raofi 3604eb100396SBharata B Rao 360568063649Sblueswir1# USB host support 360668063649Sblueswir1case "$usb" in 360768063649Sblueswir1linux) 360898ec69acSJuan Quintela echo "HOST_USB=linux" >> $config_host_mak 360968063649Sblueswir1;; 361068063649Sblueswir1bsd) 361198ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 361268063649Sblueswir1;; 361368063649Sblueswir1*) 361498ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 361568063649Sblueswir1;; 361668063649Sblueswir1esac 361768063649Sblueswir1 3618e4858974SLluís# use default implementation for tracing backend-specific routines 3619e4858974SLluístrace_default=yes 362094a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak 36216d8a764eSLluísif test "$trace_backend" = "nop"; then 36226d8a764eSLluís echo "CONFIG_TRACE_NOP=y" >> $config_host_mak 362322890ab5SPrerna Saxenafi 36249410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then 36256d8a764eSLluís echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak 3626e4858974SLluís trace_default=no 36276d8a764eSLluís # Set the appropriate trace file. 3628953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 36299410b56cSPrerna Saxenafi 36306d8a764eSLluísif test "$trace_backend" = "stderr"; then 36316d8a764eSLluís echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak 36329a82b6a5SLluís trace_default=no 36336d8a764eSLluísfi 36346d8a764eSLluísif test "$trace_backend" = "ust"; then 36356d8a764eSLluís echo "CONFIG_TRACE_UST=y" >> $config_host_mak 36366d8a764eSLluísfi 36376d8a764eSLluísif test "$trace_backend" = "dtrace"; then 36386d8a764eSLluís echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak 36396d8a764eSLluís if test "$trace_backend_stap" = "yes" ; then 36406d8a764eSLluís echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak 36416d8a764eSLluís fi 3642c276b17dSDaniel P. Berrangefi 36439410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 3644e4858974SLluísif test "$trace_default" = "yes"; then 3645e4858974SLluís echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak 3646e4858974SLluísfi 36479410b56cSPrerna Saxena 364898ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 364998ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 3650804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 3651804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 36521901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak 36531901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak 36541901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak 3655c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak 3656804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 36572b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 3658804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 36593c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak 3660804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 3661804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 3662804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 36639fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 366444dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak 3665e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 3666a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 3667f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 3668e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 3669e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 3670e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 3671e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 3672e39f0062SPaolo Bonzinifi 367342da6041SGerd Hoffmannif test "$cross_prefix" != ""; then 367442da6041SGerd Hoffmann echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak 367542da6041SGerd Hoffmannelse 367642da6041SGerd Hoffmann echo "AUTOCONF_HOST := " >> $config_host_mak 367742da6041SGerd Hoffmannfi 3678e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 3679a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak 3680a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak 368173da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 36823e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 3683804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 3684957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak 368594dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak 3686cbdd1999SPaolo Bonziniecho "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak 3687804edf29SJuan Quintela 36884bf6b55bSJuan Quintela# generate list of library paths for linker script 36894bf6b55bSJuan Quintela 36904bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} 36914bf6b55bSJuan Quintela 36924bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then 36934bf6b55bSJuan Quintela if cmp -s $config_host_ld ${config_host_ld}~ ; then 36944bf6b55bSJuan Quintela mv ${config_host_ld}~ $config_host_ld 36954bf6b55bSJuan Quintela else 36964bf6b55bSJuan Quintela rm ${config_host_ld}~ 36974bf6b55bSJuan Quintela fi 36984bf6b55bSJuan Quintelafi 36994bf6b55bSJuan Quintela 37004d904533SBlue Swirlfor d in libdis libdis-user; do 370172b8b5a1SStefan Weil symlink "$source_path/Makefile.dis" "$d/Makefile" 37024d904533SBlue Swirl echo > $d/config.mak 37034d904533SBlue Swirldone 37044d904533SBlue Swirl 37056efd7517SPeter Maydell# use included Linux headers 37066efd7517SPeter Maydellif test "$linux" = "yes" ; then 3707a307beb6SAndreas Färber mkdir -p linux-headers 37086efd7517SPeter Maydell case "$cpu" in 37096efd7517SPeter Maydell i386|x86_64) 371008312a63SPeter Maydell linux_arch=x86 37116efd7517SPeter Maydell ;; 37126efd7517SPeter Maydell ppcemb|ppc|ppc64) 371308312a63SPeter Maydell linux_arch=powerpc 37146efd7517SPeter Maydell ;; 37156efd7517SPeter Maydell s390x) 371608312a63SPeter Maydell linux_arch=s390 371708312a63SPeter Maydell ;; 371808312a63SPeter Maydell *) 371908312a63SPeter Maydell # For most CPUs the kernel architecture name and QEMU CPU name match. 372008312a63SPeter Maydell linux_arch="$cpu" 37216efd7517SPeter Maydell ;; 37226efd7517SPeter Maydell esac 372308312a63SPeter Maydell # For non-KVM architectures we will not have asm headers 372408312a63SPeter Maydell if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then 372508312a63SPeter Maydell symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm 372608312a63SPeter Maydell fi 37276efd7517SPeter Maydellfi 37286efd7517SPeter Maydell 372997a847bcSbellardfor target in $target_list; do 373097a847bcSbellardtarget_dir="$target" 373125be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 3732600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1` 373397a847bcSbellardtarget_bigendian="no" 37341f3d3c8fSJuan Quintela 3735ea2d6a39SJuan Quintelacase "$target_arch2" in 3736e67db06eSJia Liu armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) 3737ea2d6a39SJuan Quintela target_bigendian=yes 3738ea2d6a39SJuan Quintela ;; 3739ea2d6a39SJuan Quintelaesac 374097a847bcSbellardtarget_softmmu="no" 3741997344f3Sbellardtarget_user_only="no" 3742831b7825Sthstarget_linux_user="no" 374384778508Sblueswir1target_bsd_user="no" 37449e407a85Spbrookcase "$target" in 3745600309b6SBlue Swirl ${target_arch2}-softmmu) 37469e407a85Spbrook target_softmmu="yes" 37479e407a85Spbrook ;; 3748600309b6SBlue Swirl ${target_arch2}-linux-user) 37499c7a4202SBlue Swirl if test "$linux" != "yes" ; then 37509c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Linux host" 37519c7a4202SBlue Swirl exit 1 37529c7a4202SBlue Swirl fi 37539e407a85Spbrook target_user_only="yes" 37549e407a85Spbrook target_linux_user="yes" 37559e407a85Spbrook ;; 3756600309b6SBlue Swirl ${target_arch2}-bsd-user) 37579cf55765SBlue Swirl if test "$bsd" != "yes" ; then 37589c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a BSD host" 37599c7a4202SBlue Swirl exit 1 37609c7a4202SBlue Swirl fi 376184778508Sblueswir1 target_user_only="yes" 376284778508Sblueswir1 target_bsd_user="yes" 376384778508Sblueswir1 ;; 37649e407a85Spbrook *) 37659e407a85Spbrook echo "ERROR: Target '$target' not recognised" 37669e407a85Spbrook exit 1 37679e407a85Spbrook ;; 37689e407a85Spbrookesac 3769831b7825Sths 377097a847bcSbellardmkdir -p $target_dir 377125be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 377297a847bcSbellard 3773e5fe0c52Spbrookbflt="no" 3774bd0c5661Spbrooktarget_nptl="no" 3775600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` 377656aebc89Spbrookgdb_xml_files="" 3777c2e3dee6SLaurent Viviertarget_short_alignment=2 3778c2e3dee6SLaurent Viviertarget_int_alignment=4 3779c2e3dee6SLaurent Viviertarget_long_alignment=4 3780c2e3dee6SLaurent Viviertarget_llong_alignment=8 3781de3a354aSMichael Walletarget_libs_softmmu= 37827ba1e619Saliguori 3783938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2" 37846acff7daSJuan QuintelaTARGET_BASE_ARCH="" 3785e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 3786e73aae67SJuan Quintela 3787600309b6SBlue Swirlcase "$target_arch2" in 37882408a527Saurel32 i386) 37892408a527Saurel32 ;; 37902408a527Saurel32 x86_64) 37916acff7daSJuan Quintela TARGET_BASE_ARCH=i386 3792c2e3dee6SLaurent Vivier target_long_alignment=8 37932408a527Saurel32 ;; 37942408a527Saurel32 alpha) 3795c2e3dee6SLaurent Vivier target_long_alignment=8 3796a4b388ffSRichard Henderson target_nptl="yes" 37972408a527Saurel32 ;; 37982408a527Saurel32 arm|armeb) 3799b498c8a0SJuan Quintela TARGET_ARCH=arm 3800e5fe0c52Spbrook bflt="yes" 3801bd0c5661Spbrook target_nptl="yes" 380256aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 3803c2e3dee6SLaurent Vivier target_llong_alignment=4 3804412beee6SGrant Likely target_libs_softmmu="$fdt_libs" 38052408a527Saurel32 ;; 38062408a527Saurel32 cris) 3807253bd7f8Sedgar_igl target_nptl="yes" 38082408a527Saurel32 ;; 3809613a22c9SMichael Walle lm32) 3810de3a354aSMichael Walle target_libs_softmmu="$opengl_libs" 3811613a22c9SMichael Walle ;; 38122408a527Saurel32 m68k) 38130938cda5Saurel32 bflt="yes" 381456aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 3815c2e3dee6SLaurent Vivier target_int_alignment=2 3816c2e3dee6SLaurent Vivier target_long_alignment=2 3817c2e3dee6SLaurent Vivier target_llong_alignment=2 38182408a527Saurel32 ;; 3819877fdc12SEdgar E. Iglesias microblaze|microblazeel) 3820877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 382172b675caSEdgar E. Iglesias bflt="yes" 382272b675caSEdgar E. Iglesias target_nptl="yes" 3823de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 382472b675caSEdgar E. Iglesias ;; 38252408a527Saurel32 mips|mipsel) 3826b498c8a0SJuan Quintela TARGET_ARCH=mips 382725be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 3828f04dc72fSPaul Brook target_nptl="yes" 38292408a527Saurel32 ;; 38302408a527Saurel32 mipsn32|mipsn32el) 3831b498c8a0SJuan Quintela TARGET_ARCH=mipsn32 38326acff7daSJuan Quintela TARGET_BASE_ARCH=mips 383325be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 38342408a527Saurel32 ;; 38352408a527Saurel32 mips64|mips64el) 3836b498c8a0SJuan Quintela TARGET_ARCH=mips64 38376acff7daSJuan Quintela TARGET_BASE_ARCH=mips 383825be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 3839c2e3dee6SLaurent Vivier target_long_alignment=8 38402408a527Saurel32 ;; 3841e67db06eSJia Liu or32) 3842e67db06eSJia Liu TARGET_ARCH=openrisc 3843e67db06eSJia Liu TARGET_BASE_ARCH=openrisc 3844e67db06eSJia Liu ;; 38452408a527Saurel32 ppc) 3846c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 3847d6630708SNathan Froyd target_nptl="yes" 3848de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 38492408a527Saurel32 ;; 38502408a527Saurel32 ppcemb) 38516acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3852e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3853c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 3854d6630708SNathan Froyd target_nptl="yes" 3855de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 38562408a527Saurel32 ;; 38572408a527Saurel32 ppc64) 38586acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3859e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3860c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 3861c2e3dee6SLaurent Vivier target_long_alignment=8 3862de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 38632408a527Saurel32 ;; 38642408a527Saurel32 ppc64abi32) 3865b498c8a0SJuan Quintela TARGET_ARCH=ppc64 38666acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3867e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 386825be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 3869c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 3870de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 38712408a527Saurel32 ;; 38722408a527Saurel32 sh4|sh4eb) 3873b498c8a0SJuan Quintela TARGET_ARCH=sh4 38744dbed897Spbrook bflt="yes" 38750b6d3ae0Saurel32 target_nptl="yes" 38762408a527Saurel32 ;; 38772408a527Saurel32 sparc) 38782408a527Saurel32 ;; 38792408a527Saurel32 sparc64) 38806acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 3881c2e3dee6SLaurent Vivier target_long_alignment=8 38822408a527Saurel32 ;; 38832408a527Saurel32 sparc32plus) 3884b498c8a0SJuan Quintela TARGET_ARCH=sparc64 38856acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 3886e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 388725be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 38882408a527Saurel32 ;; 388924e804ecSAlexander Graf s390x) 3890bc434676SUlrich Hecht target_nptl="yes" 38917b3da903SAlexander Graf target_long_alignment=8 389224e804ecSAlexander Graf ;; 3893d2fbca94SGuan Xuetao unicore32) 3894d2fbca94SGuan Xuetao ;; 3895cfa550c6SMax Filippov xtensa|xtensaeb) 3896cfa550c6SMax Filippov TARGET_ARCH=xtensa 3897cfa550c6SMax Filippov ;; 38982408a527Saurel32 *) 3899de83cd02Sbellard echo "Unsupported target CPU" 3900de83cd02Sbellard exit 1 39012408a527Saurel32 ;; 39022408a527Saurel32esac 39035e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 39045e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then 39055e8861a0SPaolo Bonzini TARGET_BASE_ARCH=$TARGET_ARCH 39065e8861a0SPaolo Bonzinifi 39075e8861a0SPaolo Bonzini 39085e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile" 39095e8861a0SPaolo Bonzini 391099afc91dSDaniel P. Berrangeupper() { 391199afc91dSDaniel P. Berrange echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]' 391299afc91dSDaniel P. Berrange} 391399afc91dSDaniel P. Berrange 391432761257SYeongkyoon Leecase "$cpu" in 3915ed224a56Smalc i386|x86_64|ppc) 391613586813SStefan Weil # The TCG interpreter currently does not support ld/st optimization. 391713586813SStefan Weil if test "$tcg_interpreter" = "no" ; then 391832761257SYeongkyoon Lee echo "CONFIG_QEMU_LDST_OPTIMIZATION=y" >> $config_target_mak 391913586813SStefan Weil fi 392032761257SYeongkyoon Lee ;; 392132761257SYeongkyoon Leeesac 392232761257SYeongkyoon Lee 3923c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak 3924c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak 3925c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak 3926c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak 392725be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak 392899afc91dSDaniel P. Berrangetarget_arch_name="`upper $TARGET_ARCH`" 392925be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 393025be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak 393199afc91dSDaniel P. Berrangeecho "TARGET_TYPE=TARGET_TYPE_`upper $target_arch2`" >> $config_target_mak 393225be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 3933e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 3934e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 3935e6e91b9cSJuan Quintelafi 393625be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 39371b0c87fcSJuan Quintelacase "$target_arch2" in 39381b0c87fcSJuan Quintela i386|x86_64) 39391b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 394025be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 3941eb6fda0fSAnthony PERARD if test "$xen_pci_passthrough" = yes; then 3942eb6fda0fSAnthony PERARD echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak" 3943eb6fda0fSAnthony PERARD fi 394459d21e53SAlexander Graf else 394559d21e53SAlexander Graf echo "CONFIG_NO_XEN=y" >> $config_target_mak 3946432d268cSJun Nakajima fi 394759d21e53SAlexander Graf ;; 394859d21e53SAlexander Graf *) 394959d21e53SAlexander Graf echo "CONFIG_NO_XEN=y" >> $config_target_mak 39501b0c87fcSJuan Quintelaesac 3951c59249f9SJuan Quintelacase "$target_arch2" in 39520e60a699SAlexander Graf i386|x86_64|ppcemb|ppc|ppc64|s390x) 3953c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 3954c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 3955c59249f9SJuan Quintela \( "$target_arch2" = "$cpu" -o \ 3956c59249f9SJuan Quintela \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 39575f114bc6SAlexander Graf \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ 3958adf82011SRené Rebe \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \ 3959adf82011SRené Rebe \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ 3960c59249f9SJuan Quintela \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ 3961c59249f9SJuan Quintela \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then 396225be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 39631ba16968SStefan Weil if test "$vhost_net" = "yes" ; then 3964d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 3965d5970055SMichael S. Tsirkin fi 3966c59249f9SJuan Quintela fi 3967c59249f9SJuan Quintelaesac 3968fae001f5SWen Congyangcase "$target_arch2" in 3969fae001f5SWen Congyang i386|x86_64) 3970fae001f5SWen Congyang echo "CONFIG_HAVE_GET_MEMORY_MAPPING=y" >> $config_target_mak 3971fae001f5SWen Congyangesac 39727f762366SBlue Swirlif test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then 39730a6b8ddeSAlexander Graf echo "CONFIG_PSERIES=y" >> $config_target_mak 39740a6b8ddeSAlexander Graffi 3975de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 397625be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 397797a847bcSbellardfi 397897a847bcSbellardif test "$target_softmmu" = "yes" ; then 397925be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 3980de3a354aSMichael Walle echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak 3981ad4cf3f6SPaul Brook if test "$smartcard_nss" = "yes" ; then 3982ad4cf3f6SPaul Brook echo "subdir-$target: subdir-libcacard" >> $config_host_mak 3983ad4cf3f6SPaul Brook fi 39849fecbed0SWen Congyang case "$target_arch2" in 39859fecbed0SWen Congyang i386|x86_64) 39869fecbed0SWen Congyang echo "CONFIG_HAVE_CORE_DUMP=y" >> $config_target_mak 39879fecbed0SWen Congyang esac 3988de83cd02Sbellardfi 3989997344f3Sbellardif test "$target_user_only" = "yes" ; then 399025be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 3991a2c80be9SStefan Weil echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 3992997344f3Sbellardfi 3993831b7825Sthsif test "$target_linux_user" = "yes" ; then 399425be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 3995831b7825Sthsfi 399656aebc89Spbrooklist="" 399756aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 399856aebc89Spbrook for x in $gdb_xml_files; do 399956aebc89Spbrook list="$list $source_path/gdb-xml/$x" 400056aebc89Spbrook done 400125be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 40023d0f1517SJuan Quintelafi 4003de83cd02Sbellard 4004e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 400525be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 4006e5fe0c52Spbrookfi 4007bd0c5661Spbrookif test "$target_user_only" = "yes" \ 4008bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 400925be210fSJuan Quintela echo "CONFIG_USE_NPTL=y" >> $config_target_mak 4010bd0c5661Spbrookfi 4011379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 401225be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 4013379f6698SPaul Brookfi 401484778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 401525be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 401684778508Sblueswir1fi 40175b0753e0Sbellard 40185a4d701aSJan Kiszka# the static way of configuring available audio cards requires this workaround 40195a4d701aSJan Kiszkaif test "$target_user_only" != "yes" && grep -q CONFIG_PCSPK $source_path/default-configs/$target.mak; then 40205a4d701aSJan Kiszka echo "CONFIG_PCSPK=y" >> $config_target_mak 40215a4d701aSJan Kiszkafi 40225a4d701aSJan Kiszka 40234afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 4024fa282484SJuan Quintela 40254afddb55SJuan Quintelacflags="" 4026f9728943SPaolo Bonziniincludes="" 4027fa282484SJuan Quintelaldflags="" 40289b8e111fSJuan Quintela 40299195b2c2SStefan Weilif test "$tcg_interpreter" = "yes"; then 40309195b2c2SStefan Weil includes="-I\$(SRC_PATH)/tcg/tci $includes" 40319195b2c2SStefan Weilelif test "$ARCH" = "sparc64" ; then 4032f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/sparc $includes" 403324e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then 4034f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/s390 $includes" 40355d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then 4036f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/i386 $includes" 403757ddfbf7SJuan Quintelaelse 4038f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes" 403957ddfbf7SJuan Quintelafi 4040f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes" 404157ddfbf7SJuan Quintela 40426efd7517SPeter Maydellif test "$linux" = "yes" ; then 40436efd7517SPeter Maydell includes="-I\$(SRC_PATH)/linux-headers $includes" 40446efd7517SPeter Maydellfi 40456efd7517SPeter Maydell 40464d904533SBlue Swirlif test "$target_user_only" = "yes" ; then 40474d904533SBlue Swirl libdis_config_mak=libdis-user/config.mak 40484d904533SBlue Swirlelse 40494d904533SBlue Swirl libdis_config_mak=libdis/config.mak 40504d904533SBlue Swirlfi 40514d904533SBlue Swirl 405264656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 405364656024SJuan Quintela case "$i" in 405464656024SJuan Quintela alpha) 405525be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 40564d904533SBlue Swirl echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak 405764656024SJuan Quintela ;; 405864656024SJuan Quintela arm) 405925be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 40604d904533SBlue Swirl echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak 406164656024SJuan Quintela ;; 406264656024SJuan Quintela cris) 406325be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 40644d904533SBlue Swirl echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak 406564656024SJuan Quintela ;; 406664656024SJuan Quintela hppa) 406725be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 40684d904533SBlue Swirl echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak 406964656024SJuan Quintela ;; 407064656024SJuan Quintela i386|x86_64) 407125be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 40724d904533SBlue Swirl echo "CONFIG_I386_DIS=y" >> $libdis_config_mak 407364656024SJuan Quintela ;; 4074903ec55cSAurelien Jarno ia64*) 4075903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $config_target_mak 4076903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak 4077903ec55cSAurelien Jarno ;; 407879368f49SMichael Walle lm32) 407979368f49SMichael Walle echo "CONFIG_LM32_DIS=y" >> $config_target_mak 408079368f49SMichael Walle echo "CONFIG_LM32_DIS=y" >> $libdis_config_mak 408179368f49SMichael Walle ;; 408264656024SJuan Quintela m68k) 408325be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 40844d904533SBlue Swirl echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak 408564656024SJuan Quintela ;; 4086877fdc12SEdgar E. Iglesias microblaze*) 408725be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 40884d904533SBlue Swirl echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak 408964656024SJuan Quintela ;; 409064656024SJuan Quintela mips*) 409125be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 40924d904533SBlue Swirl echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak 409364656024SJuan Quintela ;; 4094e67db06eSJia Liu or32) 4095e67db06eSJia Liu echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak 4096e67db06eSJia Liu echo "CONFIG_OPENRISC_DIS=y" >> $libdis_config_mak 4097e67db06eSJia Liu ;; 409864656024SJuan Quintela ppc*) 409925be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 41004d904533SBlue Swirl echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak 410164656024SJuan Quintela ;; 410224e804ecSAlexander Graf s390*) 410325be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 41044d904533SBlue Swirl echo "CONFIG_S390_DIS=y" >> $libdis_config_mak 410564656024SJuan Quintela ;; 410664656024SJuan Quintela sh4) 410725be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 41084d904533SBlue Swirl echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak 410964656024SJuan Quintela ;; 411064656024SJuan Quintela sparc*) 411125be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 41124d904533SBlue Swirl echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak 411364656024SJuan Quintela ;; 4114cfa550c6SMax Filippov xtensa*) 4115cfa550c6SMax Filippov echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak 4116cfa550c6SMax Filippov echo "CONFIG_XTENSA_DIS=y" >> $libdis_config_mak 4117cfa550c6SMax Filippov ;; 411864656024SJuan Quintela esac 411964656024SJuan Quinteladone 41209195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then 41219195b2c2SStefan Weil echo "CONFIG_TCI_DIS=y" >> $config_target_mak 41229195b2c2SStefan Weil echo "CONFIG_TCI_DIS=y" >> $libdis_config_mak 41239195b2c2SStefan Weilfi 412464656024SJuan Quintela 41256ee7126fSJuan Quintelacase "$ARCH" in 41266ee7126fSJuan Quintelaalpha) 41276ee7126fSJuan Quintela # Ensure there's only a single GP 41286ee7126fSJuan Quintela cflags="-msmall-data $cflags" 41296ee7126fSJuan Quintela;; 41306ee7126fSJuan Quintelaesac 41316ee7126fSJuan Quintela 413255d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then 413355d9c04bSJuan Quintela case "$TARGET_BASE_ARCH" in 413455d9c04bSJuan Quintela arm) 413555d9c04bSJuan Quintela cflags="-DHAS_AUDIO $cflags" 413655d9c04bSJuan Quintela ;; 413725a8bb96SMichael Walle lm32) 413825a8bb96SMichael Walle cflags="-DHAS_AUDIO $cflags" 413925a8bb96SMichael Walle ;; 414055d9c04bSJuan Quintela i386|mips|ppc) 414155d9c04bSJuan Quintela cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" 414255d9c04bSJuan Quintela ;; 414355d9c04bSJuan Quintela esac 414455d9c04bSJuan Quintelafi 414555d9c04bSJuan Quintela 4146d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 414725be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 4148d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 4149d02c1db3SJuan Quintela cflags="-p $cflags" 4150d02c1db3SJuan Quintela ldflags="-p $ldflags" 4151d02c1db3SJuan Quintela fi 4152d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 4153d02c1db3SJuan Quintela ldflags="-p $ldflags" 415425be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 4155d02c1db3SJuan Quintela fi 4156d02c1db3SJuan Quintelafi 4157d02c1db3SJuan Quintela 41589195b2c2SStefan Weilif test "$ARCH" = "tci"; then 41599195b2c2SStefan Weil linker_script="" 41609195b2c2SStefan Weilelse 41616ee7126fSJuan Quintela linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld" 41629195b2c2SStefan Weilfi 41639195b2c2SStefan Weil 41649b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 4165fa282484SJuan Quintela case "$ARCH" in 41664d58be06SRichard Henderson alpha | s390x) 41674d58be06SRichard Henderson # The default placement of the application is fine. 41684d58be06SRichard Henderson ;; 4169fd76e73aSRichard Henderson *) 4170322e5878SJuan Quintela ldflags="$linker_script $ldflags" 4171fa282484SJuan Quintela ;; 4172fa282484SJuan Quintela esac 4173fa282484SJuan Quintelafi 4174fa282484SJuan Quintela 417525be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 417625be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 4177f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak 4178fa282484SJuan Quintela 417997a847bcSbellarddone # for target in $targets 41807d13299dSbellard 4181b776eca1SGerd Hoffmannif [ "$pixman" = "internal" ]; then 4182b776eca1SGerd Hoffmann echo "config-host.h: subdir-pixman" >> $config_host_mak 4183b776eca1SGerd Hoffmannfi 4184b776eca1SGerd Hoffmann 4185d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 4186927b241dSMichael WalleDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32" 41872dee8d54SPaolo BonziniDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas" 41882d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 41892dee8d54SPaolo BonziniDIRS="$DIRS qapi-generated" 419000c705fbSPaolo BonziniDIRS="$DIRS libcacard libcacard/libcacard libcacard/trace" 4191c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt" 4192c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" 419300c705fbSPaolo BonziniFILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile" 4194ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 4195446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile" 41962d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 4197753d11f2SRichard Hendersonfor bios_file in \ 4198753d11f2SRichard Henderson $source_path/pc-bios/*.bin \ 4199753d11f2SRichard Henderson $source_path/pc-bios/*.rom \ 4200753d11f2SRichard Henderson $source_path/pc-bios/*.dtb \ 4201753d11f2SRichard Henderson $source_path/pc-bios/openbios-* \ 4202753d11f2SRichard Henderson $source_path/pc-bios/palcode-* 4203753d11f2SRichard Hendersondo 42047ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 42057ea78b74SJan Kiszkadone 4206d1807a4fSPaolo Bonzinimkdir -p $DIRS 42077d13299dSbellardfor f in $FILES ; do 420872b8b5a1SStefan Weil if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then 4209f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 4210f9245e10SPeter Maydell fi 42117d13299dSbellarddone 42121ad2134fSPaul Brook 4213c34ebfdcSAnthony Liguori# temporary config to build submodules 42142d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 4215c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 421637116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 4217c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 4218c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 4219c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 4220c34ebfdcSAnthony Liguori echo "CPP=${cross_prefix}cpp" >> $config_mak 4221c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 4222c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 4223c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 4224c34ebfdcSAnthony Liguoridone 4225c34ebfdcSAnthony Liguori 4226add16157SBlue Swirld=libuser 422772b8b5a1SStefan Weilsymlink "$source_path/Makefile.user" "$d/Makefile" 4228b40292e7SJan Kiszka 4229b40292e7SJan Kiszkaif test "$docs" = "yes" ; then 4230b40292e7SJan Kiszka mkdir -p QMP 4231b40292e7SJan Kiszkafi 4232