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 2352166aa0SJuan Quintelacompile_object() { 24da1d85e3SGerd Hoffmann echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 25da1d85e3SGerd Hoffmann $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1 2652166aa0SJuan Quintela} 2752166aa0SJuan Quintela 2852166aa0SJuan Quintelacompile_prog() { 2952166aa0SJuan Quintela local_cflags="$1" 3052166aa0SJuan Quintela local_ldflags="$2" 31da1d85e3SGerd Hoffmann echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 32da1d85e3SGerd Hoffmann $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1 3352166aa0SJuan Quintela} 3452166aa0SJuan Quintela 3511568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 3611568d6dSPaolo Bonzinisymlink() { 3711568d6dSPaolo Bonzini rm -f $2 3811568d6dSPaolo Bonzini ln -s $1 $2 3911568d6dSPaolo Bonzini} 4011568d6dSPaolo Bonzini 410dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 420dba6195SLoïc Minier# executable or a builtin) 430dba6195SLoïc Minierhas() { 440dba6195SLoïc Minier type "$1" >/dev/null 2>&1 450dba6195SLoïc Minier} 460dba6195SLoïc Minier 470dba6195SLoïc Minier# search for an executable in PATH 480dba6195SLoïc Minierpath_of() { 490dba6195SLoïc Minier local_command="$1" 500dba6195SLoïc Minier local_ifs="$IFS" 510dba6195SLoïc Minier local_dir="" 520dba6195SLoïc Minier 530dba6195SLoïc Minier # pathname has a dir component? 540dba6195SLoïc Minier if [ "${local_command#*/}" != "$local_command" ]; then 550dba6195SLoïc Minier if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 560dba6195SLoïc Minier echo "$local_command" 570dba6195SLoïc Minier return 0 580dba6195SLoïc Minier fi 590dba6195SLoïc Minier fi 600dba6195SLoïc Minier if [ -z "$local_command" ]; then 610dba6195SLoïc Minier return 1 620dba6195SLoïc Minier fi 630dba6195SLoïc Minier 640dba6195SLoïc Minier IFS=: 650dba6195SLoïc Minier for local_dir in $PATH; do 660dba6195SLoïc Minier if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 670dba6195SLoïc Minier echo "$local_dir/$local_command" 680dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 690dba6195SLoïc Minier return 0 700dba6195SLoïc Minier fi 710dba6195SLoïc Minier done 720dba6195SLoïc Minier # not found 730dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 740dba6195SLoïc Minier return 1 750dba6195SLoïc Minier} 760dba6195SLoïc Minier 777d13299dSbellard# default parameters 78ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"` 792ff6b91eSJuan Quintelacpu="" 801e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 8143ce4dfeSbellardstatic="no" 82ed968ff1SJuan Quintelasparc_cpu="" 837d13299dSbellardcross_prefix="" 840c58ac1cSmalcaudio_drv_list="" 85d61a4ce8SGerd Hoffmannaudio_card_list="ac97 es1370 sb16 hda" 86d61a4ce8SGerd Hoffmannaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda" 87eb852011SMarkus Armbrusterblock_drv_whitelist="" 887d13299dSbellardhost_cc="gcc" 89c81da56eSJuan Quintelahelper_cflags="" 9073da375eSJuan Quintelalibs_softmmu="" 913e2e0e6bSJuan Quintelalibs_tools="" 9267f86e8eSJuan Quintelaaudio_pt_int="" 93d5631638Smalcaudio_win_int="" 942b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc 95ac0df51dSaliguori 96377529c0SPaolo Bonzinitarget_list="" 97377529c0SPaolo Bonzini 98377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 99377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 100377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 101377529c0SPaolo Bonzini# unless --disable-foo is given 102377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 103377529c0SPaolo Bonzini# feature will searched for, 104377529c0SPaolo Bonzini# if not found, configure exits with error 105377529c0SPaolo Bonzini# 106377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 107377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 108377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 109377529c0SPaolo Bonzini 110377529c0SPaolo Bonzinibluez="" 111377529c0SPaolo Bonzinibrlapi="" 112377529c0SPaolo Bonzinicurl="" 113377529c0SPaolo Bonzinicurses="" 114377529c0SPaolo Bonzinidocs="" 115377529c0SPaolo Bonzinifdt="" 116377529c0SPaolo Bonzinikvm="" 117377529c0SPaolo Bonzinikvm_para="" 118377529c0SPaolo Bonzininptl="" 119377529c0SPaolo Bonzinisdl="" 120377529c0SPaolo Bonzinisparse="no" 121377529c0SPaolo Bonziniuuid="" 122377529c0SPaolo Bonzinivde="" 123377529c0SPaolo Bonzinivnc_tls="" 124377529c0SPaolo Bonzinivnc_sasl="" 125377529c0SPaolo Bonzinivnc_jpeg="" 126377529c0SPaolo Bonzinivnc_png="" 127377529c0SPaolo Bonzinivnc_thread="no" 128377529c0SPaolo Bonzinixen="" 129377529c0SPaolo Bonzinilinux_aio="" 130377529c0SPaolo Bonziniattr="" 131377529c0SPaolo Bonzinivhost_net="" 132377529c0SPaolo Bonzinixfs="" 133377529c0SPaolo Bonzini 134377529c0SPaolo Bonzinigprof="no" 135377529c0SPaolo Bonzinidebug_tcg="no" 136377529c0SPaolo Bonzinidebug_mon="no" 137377529c0SPaolo Bonzinidebug="no" 138377529c0SPaolo Bonzinistrip_opt="yes" 139377529c0SPaolo Bonzinibigendian="no" 140377529c0SPaolo Bonzinimingw32="no" 141377529c0SPaolo BonziniEXESUF="" 142377529c0SPaolo Bonziniprefix="/usr/local" 143377529c0SPaolo Bonzinimandir="\${prefix}/share/man" 144377529c0SPaolo Bonzinidatadir="\${prefix}/share/qemu" 145377529c0SPaolo Bonzinidocdir="\${prefix}/share/doc/qemu" 146377529c0SPaolo Bonzinibindir="\${prefix}/bin" 147377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc" 148377529c0SPaolo Bonziniconfsuffix="/qemu" 149377529c0SPaolo Bonzinislirp="yes" 150377529c0SPaolo Bonzinifmod_lib="" 151377529c0SPaolo Bonzinifmod_inc="" 152377529c0SPaolo Bonzinioss_lib="" 153377529c0SPaolo Bonzinibsd="no" 154377529c0SPaolo Bonzinilinux="no" 155377529c0SPaolo Bonzinisolaris="no" 156377529c0SPaolo Bonziniprofiler="no" 157377529c0SPaolo Bonzinicocoa="no" 158377529c0SPaolo Bonzinisoftmmu="yes" 159377529c0SPaolo Bonzinilinux_user="no" 160377529c0SPaolo Bonzinidarwin_user="no" 161377529c0SPaolo Bonzinibsd_user="no" 162377529c0SPaolo Bonziniguest_base="" 163377529c0SPaolo Bonziniuname_release="" 164377529c0SPaolo Bonziniio_thread="no" 165377529c0SPaolo Bonzinimixemu="no" 166377529c0SPaolo Bonzinikerneldir="" 167377529c0SPaolo Bonziniaix="no" 168377529c0SPaolo Bonziniblobs="yes" 169377529c0SPaolo Bonzinipkgversion="" 170377529c0SPaolo Bonzinicheck_utests="no" 171377529c0SPaolo Bonziniuser_pie="no" 172377529c0SPaolo Bonzinizero_malloc="" 173377529c0SPaolo Bonzinitrace_backend="nop" 174377529c0SPaolo Bonzinitrace_file="trace" 175377529c0SPaolo Bonzinispice="" 176377529c0SPaolo Bonzinirbd="" 177377529c0SPaolo Bonzini 178ac0df51dSaliguori# parse CC options first 179ac0df51dSaliguorifor opt do 180ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 181ac0df51dSaliguori case "$opt" in 182ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 183ac0df51dSaliguori ;; 1843d8df640SPaolo Bonzini --cc=*) CC="$optarg" 185ac0df51dSaliguori ;; 186ca4deeb1SPaolo Bonzini --source-path=*) source_path="$optarg" 187ca4deeb1SPaolo Bonzini ;; 1882ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 1892ff6b91eSJuan Quintela ;; 190a558ee17SJuan Quintela --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" 191e2a2ed06SJuan Quintela ;; 192e2a2ed06SJuan Quintela --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" 193e2a2ed06SJuan Quintela ;; 19450e7b1a0SJuan Quintela --sparc_cpu=*) 19550e7b1a0SJuan Quintela sparc_cpu="$optarg" 19650e7b1a0SJuan Quintela case $sparc_cpu in 197ed968ff1SJuan Quintela v7|v8|v8plus|v8plusa) 19850e7b1a0SJuan Quintela cpu="sparc" 19950e7b1a0SJuan Quintela ;; 20050e7b1a0SJuan Quintela v9) 20150e7b1a0SJuan Quintela cpu="sparc64" 20250e7b1a0SJuan Quintela ;; 20350e7b1a0SJuan Quintela *) 20450e7b1a0SJuan Quintela echo "undefined SPARC architecture. Exiting"; 20550e7b1a0SJuan Quintela exit 1 20650e7b1a0SJuan Quintela ;; 20750e7b1a0SJuan Quintela esac 20850e7b1a0SJuan Quintela ;; 209ac0df51dSaliguori esac 210ac0df51dSaliguoridone 211ac0df51dSaliguori# OS specific 212ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 213ac0df51dSaliguori# we can eliminate it's usage altogether 214ac0df51dSaliguori 2153d8df640SPaolo Bonzinicc="${cross_prefix}${CC-gcc}" 2163d8df640SPaolo Bonziniar="${cross_prefix}${AR-ar}" 2173d8df640SPaolo Bonziniobjcopy="${cross_prefix}${OBJCOPY-objcopy}" 2183d8df640SPaolo Bonzinild="${cross_prefix}${LD-ld}" 2193d8df640SPaolo Bonzinistrip="${cross_prefix}${STRIP-strip}" 2203d8df640SPaolo Bonziniwindres="${cross_prefix}${WINDRES-windres}" 221a8bd70adSPaolo Bonzinipkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}" 2223ec87ffeSPaolo Bonzinisdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}" 223ac0df51dSaliguori 224be17dc90SMichael S. Tsirkin# default flags for all hosts 225be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" 226be17dc90SMichael S. TsirkinCFLAGS="-g $CFLAGS" 227be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 228be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 229be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 23084958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 231f9728943SPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH)" 232be17dc90SMichael S. TsirkinLDFLAGS="-g $LDFLAGS" 233be17dc90SMichael S. Tsirkin 234ca4deeb1SPaolo Bonzini# make source path absolute 235ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd` 236ca4deeb1SPaolo Bonzini 237ac0df51dSaliguoricheck_define() { 238ac0df51dSaliguoricat > $TMPC <<EOF 239ac0df51dSaliguori#if !defined($1) 240ac0df51dSaliguori#error Not defined 241ac0df51dSaliguori#endif 242ac0df51dSaliguoriint main(void) { return 0; } 243ac0df51dSaliguoriEOF 24452166aa0SJuan Quintela compile_object 245ac0df51dSaliguori} 246ac0df51dSaliguori 2472ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 2482ff6b91eSJuan Quintela # command line argument 2492ff6b91eSJuan Quintela : 2502ff6b91eSJuan Quintelaelif check_define __i386__ ; then 251ac0df51dSaliguori cpu="i386" 252ac0df51dSaliguorielif check_define __x86_64__ ; then 253ac0df51dSaliguori cpu="x86_64" 2543aa9bd6cSblueswir1elif check_define __sparc__ ; then 2553aa9bd6cSblueswir1 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA 2563aa9bd6cSblueswir1 # They must be specified using --sparc_cpu 2573aa9bd6cSblueswir1 if check_define __arch64__ ; then 2583aa9bd6cSblueswir1 cpu="sparc64" 2593aa9bd6cSblueswir1 else 2603aa9bd6cSblueswir1 cpu="sparc" 2613aa9bd6cSblueswir1 fi 262fdf7ed96Smalcelif check_define _ARCH_PPC ; then 263fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 264fdf7ed96Smalc cpu="ppc64" 265ac0df51dSaliguori else 266fdf7ed96Smalc cpu="ppc" 267fdf7ed96Smalc fi 268afa05235SAurelien Jarnoelif check_define __mips__ ; then 269afa05235SAurelien Jarno cpu="mips" 270477ba620SAurelien Jarnoelif check_define __ia64__ ; then 271477ba620SAurelien Jarno cpu="ia64" 272d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 273d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 274d66ed0eaSAurelien Jarno cpu="s390x" 275d66ed0eaSAurelien Jarno else 276d66ed0eaSAurelien Jarno cpu="s390" 277d66ed0eaSAurelien Jarno fi 278fdf7ed96Smalcelse 279fdf7ed96Smalc cpu=`uname -m` 280ac0df51dSaliguorifi 281ac0df51dSaliguori 2827d13299dSbellardcase "$cpu" in 283afa05235SAurelien Jarno alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64) 284ea8f20f8SJuan Quintela cpu="$cpu" 285ea8f20f8SJuan Quintela ;; 2867d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 28797a847bcSbellard cpu="i386" 2887d13299dSbellard ;; 289aaa5fa14Saurel32 x86_64|amd64) 290aaa5fa14Saurel32 cpu="x86_64" 291aaa5fa14Saurel32 ;; 292ba68055eSbellard armv*b) 293808c4954Sbellard cpu="armv4b" 294808c4954Sbellard ;; 295ba68055eSbellard armv*l) 2967d13299dSbellard cpu="armv4l" 2977d13299dSbellard ;; 298f54b3f92Saurel32 parisc|parisc64) 299f54b3f92Saurel32 cpu="hppa" 300f54b3f92Saurel32 ;; 301afa05235SAurelien Jarno mips*) 302afa05235SAurelien Jarno cpu="mips" 303afa05235SAurelien Jarno ;; 30424e804ecSAlexander Graf s390) 305fb3e5849Sbellard cpu="s390" 306fb3e5849Sbellard ;; 30724e804ecSAlexander Graf s390x) 30824e804ecSAlexander Graf cpu="s390x" 30924e804ecSAlexander Graf ;; 3103142255cSblueswir1 sparc|sun4[cdmuv]) 311ae228531Sbellard cpu="sparc" 312ae228531Sbellard ;; 3137d13299dSbellard *) 314a447d4dcSPaolo Bonzini echo "Unsupported CPU = $cpu" 315a447d4dcSPaolo Bonzini exit 1 3167d13299dSbellard ;; 3177d13299dSbellardesac 318e2d52ad3SJuan Quintela 3197d13299dSbellard# OS specific 320ac0df51dSaliguoriif check_define __linux__ ; then 321ac0df51dSaliguori targetos="Linux" 322ac0df51dSaliguorielif check_define _WIN32 ; then 323ac0df51dSaliguori targetos='MINGW32' 324169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then 325169dc5d3Sblueswir1 targetos='OpenBSD' 326169dc5d3Sblueswir1elif check_define __sun__ ; then 327169dc5d3Sblueswir1 targetos='SunOS' 328179cf400SAndreas Färberelif check_define __HAIKU__ ; then 329179cf400SAndreas Färber targetos='Haiku' 330ac0df51dSaliguorielse 3317d13299dSbellard targetos=`uname -s` 332ac0df51dSaliguorifi 3330dbfc675SJuan Quintela 3347d13299dSbellardcase $targetos in 335c326e0afSbellardCYGWIN*) 336c326e0afSbellard mingw32="yes" 337a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 338d5631638Smalc audio_possible_drivers="winwave sdl" 339d5631638Smalc audio_drv_list="winwave" 340c326e0afSbellard;; 34167b915a5SbellardMINGW32*) 34267b915a5Sbellard mingw32="yes" 343d5631638Smalc audio_possible_drivers="winwave dsound sdl fmod" 344d5631638Smalc audio_drv_list="winwave" 34567b915a5Sbellard;; 3465c40d2bdSthsGNU/kFreeBSD) 347a167ba50SAurelien Jarno bsd="yes" 3480c58ac1cSmalc audio_drv_list="oss" 349f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 3505c40d2bdSths;; 3517d3505c5SbellardFreeBSD) 3527d3505c5Sbellard bsd="yes" 3530db4a067SPaolo Bonzini make="${MAKE-gmake}" 3540c58ac1cSmalc audio_drv_list="oss" 355f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 356f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 357f01576f1SJuergen Lock LIBS="-lutil $LIBS" 3587d3505c5Sbellard;; 359c5e97233Sblueswir1DragonFly) 360c5e97233Sblueswir1 bsd="yes" 3610db4a067SPaolo Bonzini make="${MAKE-gmake}" 362c5e97233Sblueswir1 audio_drv_list="oss" 363c5e97233Sblueswir1 audio_possible_drivers="oss sdl esd pa" 364c5e97233Sblueswir1;; 3657d3505c5SbellardNetBSD) 3667d3505c5Sbellard bsd="yes" 3670db4a067SPaolo Bonzini make="${MAKE-gmake}" 3680c58ac1cSmalc audio_drv_list="oss" 369c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3708ef92a88Sblueswir1 oss_lib="-lossaudio" 3717d3505c5Sbellard;; 3727d3505c5SbellardOpenBSD) 3737d3505c5Sbellard bsd="yes" 3740db4a067SPaolo Bonzini make="${MAKE-gmake}" 3750c58ac1cSmalc audio_drv_list="oss" 376c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3772f6a1ab0Sblueswir1 oss_lib="-lossaudio" 3787d3505c5Sbellard;; 37983fb7adfSbellardDarwin) 38083fb7adfSbellard bsd="yes" 38183fb7adfSbellard darwin="yes" 3820dbfc675SJuan Quintela # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can 3830dbfc675SJuan Quintela # run 64-bit userspace code 384aab8588aSmalc if [ "$cpu" = "i386" ] ; then 3851b0f9cc2Saliguori is_x86_64=`sysctl -n hw.optional.x86_64` 386aab8588aSmalc [ "$is_x86_64" = "1" ] && cpu=x86_64 3871b0f9cc2Saliguori fi 3881b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 389a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 3900c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 3911b0f9cc2Saliguori else 392a558ee17SJuan Quintela QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS" 3931b0f9cc2Saliguori fi 394831b7825Sths darwin_user="yes" 395fd677642Sths cocoa="yes" 3960c58ac1cSmalc audio_drv_list="coreaudio" 397c2de5c91Smalc audio_possible_drivers="coreaudio sdl fmod" 3980c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 3997973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 40083fb7adfSbellard;; 401ec530c81SbellardSunOS) 402ec530c81Sbellard solaris="yes" 4030db4a067SPaolo Bonzini make="${MAKE-gmake}" 4040db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 405fa58948dSBlue Swirl ld="gld" 4060475a5caSths needs_libsunmath="no" 407c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 408ef18c883Sths # have to select again, because `uname -m` returns i86pc 409ef18c883Sths # even on an x86_64 box. 410ef18c883Sths solariscpu=`isainfo -k` 411ef18c883Sths if test "${solariscpu}" = "amd64" ; then 412ef18c883Sths cpu="x86_64" 413ef18c883Sths fi 414c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 4150475a5caSths if test "$solarisrev" -le 9 ; then 4160475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 4170475a5caSths needs_libsunmath="yes" 418f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 419f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 420f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 4210475a5caSths else 4220475a5caSths echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" 4230475a5caSths echo "libsunmath from the Sun Studio compilers tools, due to a lack of" 4240475a5caSths echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" 4250475a5caSths echo "Studio 11 can be downloaded from www.sun.com." 4260475a5caSths exit 1 4270475a5caSths fi 4280475a5caSths fi 42986b2bd93Sths fi 4306b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 4310c58ac1cSmalc audio_drv_list="oss" 4326b4d2ba1Sths fi 433c2de5c91Smalc audio_possible_drivers="oss sdl" 434d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 435d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 436d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 437d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 438a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 439e174c0bbSJuan Quintela LIBS="-lsocket -lnsl -lresolv $LIBS" 440ec530c81Sbellard;; 441b29fe3edSmalcAIX) 442b29fe3edSmalc aix="yes" 4430db4a067SPaolo Bonzini make="${MAKE-gmake}" 444b29fe3edSmalc;; 445179cf400SAndreas FärberHaiku) 446179cf400SAndreas Färber haiku="yes" 447179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 448179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 449179cf400SAndreas Färber;; 450fb065187Sbellard*) 4510c58ac1cSmalc audio_drv_list="oss" 452b8e59f18Smalc audio_possible_drivers="oss alsa sdl esd pa" 4535327cf48Sbellard linux="yes" 454831b7825Sths linux_user="yes" 45568063649Sblueswir1 usb="linux" 45607f4ddbfSbellard if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 457c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 458c9ec1fe4Sbellard fi 459fb065187Sbellard;; 4607d13299dSbellardesac 4617d13299dSbellard 4627d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 463b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 46468063649Sblueswir1 usb="bsd" 46583fb7adfSbellard fi 46684778508Sblueswir1 bsd_user="yes" 4677d3505c5Sbellardfi 4687d3505c5Sbellard 4690db4a067SPaolo Bonzini: ${make=${MAKE-make}} 4700db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 4710db4a067SPaolo Bonzini 4723457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 4733457a3f8SJuan Quintela EXESUF=".exe" 474a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 475e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 476e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 477884044aaSJuan Quintela LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" 478683035deSPaolo Bonzini prefix="c:/Program Files/Qemu" 479683035deSPaolo Bonzini mandir="\${prefix}" 480683035deSPaolo Bonzini datadir="\${prefix}" 481683035deSPaolo Bonzini docdir="\${prefix}" 482683035deSPaolo Bonzini bindir="\${prefix}" 483683035deSPaolo Bonzini sysconfdir="\${prefix}" 484683035deSPaolo Bonzini confsuffix="" 4853457a3f8SJuan Quintelafi 4863457a3f8SJuan Quintela 487487fefdbSAnthony Liguoriwerror="" 48885aa5189Sbellard 4897d13299dSbellardfor opt do 490a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 4917d13299dSbellard case "$opt" in 4922efc3265Sbellard --help|-h) show_help=yes 4932efc3265Sbellard ;; 494b1a550a0Spbrook --prefix=*) prefix="$optarg" 4957d13299dSbellard ;; 496b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 49732ce6337Sbellard ;; 498ca4deeb1SPaolo Bonzini --source-path=*) 4997d13299dSbellard ;; 500ac0df51dSaliguori --cross-prefix=*) 5017d13299dSbellard ;; 502ac0df51dSaliguori --cc=*) 5037d13299dSbellard ;; 504b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 50583469015Sbellard ;; 506b1a550a0Spbrook --make=*) make="$optarg" 5077d13299dSbellard ;; 5086a882643Spbrook --install=*) install="$optarg" 5096a882643Spbrook ;; 510e2a2ed06SJuan Quintela --extra-cflags=*) 5117d13299dSbellard ;; 512e2a2ed06SJuan Quintela --extra-ldflags=*) 5137d13299dSbellard ;; 5142ff6b91eSJuan Quintela --cpu=*) 5157d13299dSbellard ;; 516b1a550a0Spbrook --target-list=*) target_list="$optarg" 517de83cd02Sbellard ;; 51874242e0fSPaolo Bonzini --enable-trace-backend=*) trace_backend="$optarg" 51994a420b1SStefan Hajnoczi ;; 52074242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 5219410b56cSPrerna Saxena ;; 5227d13299dSbellard --enable-gprof) gprof="yes" 5237d13299dSbellard ;; 52479427693SLoïc Minier --static) 52579427693SLoïc Minier static="yes" 52679427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 52743ce4dfeSbellard ;; 5280b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 5290b24e75fSPaolo Bonzini ;; 5300b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 5310b24e75fSPaolo Bonzini ;; 5320b24e75fSPaolo Bonzini --datadir=*) datadir="$optarg" 5330b24e75fSPaolo Bonzini ;; 5340b24e75fSPaolo Bonzini --docdir=*) docdir="$optarg" 5350b24e75fSPaolo Bonzini ;; 536ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 53707381cc1SAnthony Liguori ;; 53897a847bcSbellard --disable-sdl) sdl="no" 53997a847bcSbellard ;; 540c4198157SJuan Quintela --enable-sdl) sdl="yes" 541c4198157SJuan Quintela ;; 542b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 543102a52e4Sbellard ;; 544c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 545c2de5c91Smalc ;; 5462f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 5472f6a1ab0Sblueswir1 ;; 5482fa7d3bfSmalc --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` 5490c58ac1cSmalc ;; 5500c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 5510c58ac1cSmalc ;; 552eb852011SMarkus Armbruster --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 553eb852011SMarkus Armbruster ;; 554f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 555f8393946Saurel32 ;; 556f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 557f8393946Saurel32 ;; 558b4475aa2SLuiz Capitulino --enable-debug-mon) debug_mon="yes" 559b4475aa2SLuiz Capitulino ;; 560b4475aa2SLuiz Capitulino --disable-debug-mon) debug_mon="no" 561b4475aa2SLuiz Capitulino ;; 562f3d08ee6SPaul Brook --enable-debug) 563f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 564f3d08ee6SPaul Brook debug_tcg="yes" 565b4475aa2SLuiz Capitulino debug_mon="yes" 566f3d08ee6SPaul Brook debug="yes" 567f3d08ee6SPaul Brook strip_opt="no" 568f3d08ee6SPaul Brook ;; 56903b4fe7dSaliguori --enable-sparse) sparse="yes" 57003b4fe7dSaliguori ;; 57103b4fe7dSaliguori --disable-sparse) sparse="no" 57203b4fe7dSaliguori ;; 5731625af87Saliguori --disable-strip) strip_opt="no" 5741625af87Saliguori ;; 5758d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 5768d5d2d4cSths ;; 5771be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 5781be10ad2SJuan Quintela ;; 5792f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 5802f9606b3Saliguori ;; 581ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 582ea784e3bSJuan Quintela ;; 5832f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 5842f6f5c7aSCorentin Chary ;; 5852f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 5862f6f5c7aSCorentin Chary ;; 587efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 588efe556adSCorentin Chary ;; 589efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 590efe556adSCorentin Chary ;; 591bd023f95SCorentin Chary --disable-vnc-thread) vnc_thread="no" 592bd023f95SCorentin Chary ;; 593bd023f95SCorentin Chary --enable-vnc-thread) vnc_thread="yes" 594bd023f95SCorentin Chary ;; 595443f1376Sbellard --disable-slirp) slirp="no" 596c20709aaSbellard ;; 597ee682d27SStefan Weil --disable-uuid) uuid="no" 598ee682d27SStefan Weil ;; 599ee682d27SStefan Weil --enable-uuid) uuid="yes" 600ee682d27SStefan Weil ;; 601e0e6c8c0Saliguori --disable-vde) vde="no" 6028a16d273Sths ;; 603dfb278bdSJuan Quintela --enable-vde) vde="yes" 604dfb278bdSJuan Quintela ;; 605e37630caSaliguori --disable-xen) xen="no" 606e37630caSaliguori ;; 607fc321b4bSJuan Quintela --enable-xen) xen="yes" 608fc321b4bSJuan Quintela ;; 6092e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 6102e4d9fb1Saurel32 ;; 6114ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 6124ffcedb6SJuan Quintela ;; 613fb599c9aSbalrog --disable-bluez) bluez="no" 614fb599c9aSbalrog ;; 615a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 616a20a6f46SJuan Quintela ;; 6177ba1e619Saliguori --disable-kvm) kvm="no" 6187ba1e619Saliguori ;; 619b31a0277SJuan Quintela --enable-kvm) kvm="yes" 620b31a0277SJuan Quintela ;; 621cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 622cd4ec0b4SGerd Hoffmann ;; 623cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 624cd4ec0b4SGerd Hoffmann ;; 62505c2a3e7Sbellard --enable-profiler) profiler="yes" 62605c2a3e7Sbellard ;; 627c2de5c91Smalc --enable-cocoa) 628c2de5c91Smalc cocoa="yes" ; 629c2de5c91Smalc sdl="no" ; 630c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 6315b0753e0Sbellard ;; 632cad25d69Spbrook --disable-system) softmmu="no" 6330a8e90f4Spbrook ;; 634cad25d69Spbrook --enable-system) softmmu="yes" 6350a8e90f4Spbrook ;; 6360953a80fSZachary Amsden --disable-user) 6370953a80fSZachary Amsden linux_user="no" ; 6380953a80fSZachary Amsden bsd_user="no" ; 6390953a80fSZachary Amsden darwin_user="no" 6400953a80fSZachary Amsden ;; 6410953a80fSZachary Amsden --enable-user) ;; 642831b7825Sths --disable-linux-user) linux_user="no" 6430a8e90f4Spbrook ;; 644831b7825Sths --enable-linux-user) linux_user="yes" 645831b7825Sths ;; 646831b7825Sths --disable-darwin-user) darwin_user="no" 647831b7825Sths ;; 648831b7825Sths --enable-darwin-user) darwin_user="yes" 6490a8e90f4Spbrook ;; 65084778508Sblueswir1 --disable-bsd-user) bsd_user="no" 65184778508Sblueswir1 ;; 65284778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 65384778508Sblueswir1 ;; 654379f6698SPaul Brook --enable-guest-base) guest_base="yes" 655379f6698SPaul Brook ;; 656379f6698SPaul Brook --disable-guest-base) guest_base="no" 657379f6698SPaul Brook ;; 65834005a00SKirill A. Shutemov --enable-user-pie) user_pie="yes" 65934005a00SKirill A. Shutemov ;; 66034005a00SKirill A. Shutemov --disable-user-pie) user_pie="no" 66134005a00SKirill A. Shutemov ;; 662c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 663c5937220Spbrook ;; 6643142255cSblueswir1 --sparc_cpu=*) 6653142255cSblueswir1 ;; 66685aa5189Sbellard --enable-werror) werror="yes" 66785aa5189Sbellard ;; 66885aa5189Sbellard --disable-werror) werror="no" 66985aa5189Sbellard ;; 6704d3b6f6eSbalrog --disable-curses) curses="no" 6714d3b6f6eSbalrog ;; 672c584a6d0SJuan Quintela --enable-curses) curses="yes" 673c584a6d0SJuan Quintela ;; 674769ce76dSAlexander Graf --disable-curl) curl="no" 675769ce76dSAlexander Graf ;; 676788c8196SJuan Quintela --enable-curl) curl="yes" 677788c8196SJuan Quintela ;; 6782df87df7SJuan Quintela --disable-fdt) fdt="no" 6792df87df7SJuan Quintela ;; 6802df87df7SJuan Quintela --enable-fdt) fdt="yes" 6812df87df7SJuan Quintela ;; 6825495ed11SLuiz Capitulino --disable-check-utests) check_utests="no" 6835495ed11SLuiz Capitulino ;; 6845495ed11SLuiz Capitulino --enable-check-utests) check_utests="yes" 6855495ed11SLuiz Capitulino ;; 686bd0c5661Spbrook --disable-nptl) nptl="no" 687bd0c5661Spbrook ;; 688b0a47e79SJuan Quintela --enable-nptl) nptl="yes" 689b0a47e79SJuan Quintela ;; 6908ff9cbf7Smalc --enable-mixemu) mixemu="yes" 6918ff9cbf7Smalc ;; 6925c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 6935c6c3a6cSChristoph Hellwig ;; 6945c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 6955c6c3a6cSChristoph Hellwig ;; 696758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 697758e8e38SVenkateswararao Jujjuri (JV) ;; 698758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 699758e8e38SVenkateswararao Jujjuri (JV) ;; 700e5d355d1Saliguori --enable-io-thread) io_thread="yes" 701e5d355d1Saliguori ;; 70277755340Sths --disable-blobs) blobs="no" 70377755340Sths ;; 704eac30262Saliguori --kerneldir=*) kerneldir="$optarg" 705eac30262Saliguori ;; 7064a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 7074a19f1ecSpbrook ;; 708a25dba17SJuan Quintela --disable-docs) docs="no" 70970ec5dc0SAnthony Liguori ;; 710a25dba17SJuan Quintela --enable-docs) docs="yes" 71183a3ab8bSJuan Quintela ;; 712d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 713d5970055SMichael S. Tsirkin ;; 714d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 715d5970055SMichael S. Tsirkin ;; 7166bde81cbSPaolo Bonzini --*dir) 7176bde81cbSPaolo Bonzini ;; 718f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 719f27aaf4bSChristian Brunner ;; 720f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 721f27aaf4bSChristian Brunner ;; 7227f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 7237f1559c6Sbalrog ;; 7247d13299dSbellard esac 7257d13299dSbellarddone 7267d13299dSbellard 7273142255cSblueswir1# 7283142255cSblueswir1# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right 729a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) 7303142255cSblueswir1# 731379f6698SPaul Brookhost_guest_base="no" 73240293e58Sbellardcase "$cpu" in 733ed968ff1SJuan Quintela sparc) case $sparc_cpu in 734ed968ff1SJuan Quintela v7|v8) 735a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 736ed968ff1SJuan Quintela ;; 737ed968ff1SJuan Quintela v8plus|v8plusa) 738a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 739ed968ff1SJuan Quintela ;; 740ed968ff1SJuan Quintela *) # sparc_cpu not defined in the command line 741a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" 742ed968ff1SJuan Quintela esac 7430c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 744a558ee17SJuan Quintela QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS" 745762e8230Sblueswir1 if test "$solaris" = "no" ; then 746a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS" 747c81da56eSJuan Quintela helper_cflags="-ffixed-i0" 748762e8230Sblueswir1 fi 7493142255cSblueswir1 ;; 750ed968ff1SJuan Quintela sparc64) 751a558ee17SJuan Quintela QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" 7520c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 753a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" 754ed968ff1SJuan Quintela if test "$solaris" != "no" ; then 755a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS" 756762e8230Sblueswir1 fi 7573142255cSblueswir1 ;; 75876d83bdeSths s390) 75928d7cc49SRichard Henderson QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS" 76028d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 76148bb3750SRichard Henderson host_guest_base="yes" 76228d7cc49SRichard Henderson ;; 76328d7cc49SRichard Henderson s390x) 76428d7cc49SRichard Henderson QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS" 76528d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 76648bb3750SRichard Henderson host_guest_base="yes" 76776d83bdeSths ;; 76840293e58Sbellard i386) 769a558ee17SJuan Quintela QEMU_CFLAGS="-m32 $QEMU_CFLAGS" 7700c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 7712b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 772c81da56eSJuan Quintela helper_cflags="-fomit-frame-pointer" 773379f6698SPaul Brook host_guest_base="yes" 77440293e58Sbellard ;; 77540293e58Sbellard x86_64) 776a558ee17SJuan Quintela QEMU_CFLAGS="-m64 $QEMU_CFLAGS" 7770c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 7782b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 779379f6698SPaul Brook host_guest_base="yes" 780379f6698SPaul Brook ;; 781379f6698SPaul Brook arm*) 782379f6698SPaul Brook host_guest_base="yes" 78340293e58Sbellard ;; 784f6548c0aSmalc ppc*) 785f6548c0aSmalc host_guest_base="yes" 786f6548c0aSmalc ;; 787cc01cc8eSAurelien Jarno mips*) 788cc01cc8eSAurelien Jarno host_guest_base="yes" 789cc01cc8eSAurelien Jarno ;; 790477ba620SAurelien Jarno ia64*) 791477ba620SAurelien Jarno host_guest_base="yes" 792477ba620SAurelien Jarno ;; 793fd76e73aSRichard Henderson hppa*) 794fd76e73aSRichard Henderson host_guest_base="yes" 795fd76e73aSRichard Henderson ;; 7963142255cSblueswir1esac 7973142255cSblueswir1 798379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base" 799379f6698SPaul Brook 800af5db58eSpbrookif test x"$show_help" = x"yes" ; then 801af5db58eSpbrookcat << EOF 802af5db58eSpbrook 803af5db58eSpbrookUsage: configure [options] 804af5db58eSpbrookOptions: [defaults in brackets after descriptions] 805af5db58eSpbrook 806af5db58eSpbrookEOF 807af5db58eSpbrookecho "Standard options:" 808af5db58eSpbrookecho " --help print this message" 809af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 810af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 811af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 812af5db58eSpbrookecho " --target-list=LIST set target list [$target_list]" 813af5db58eSpbrookecho "" 814af5db58eSpbrookecho "Advanced options (experts only):" 815af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 816af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 817af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 8180bfe8cc0SPaolo Bonziniecho " --host-cc=CC use C compiler CC [$host_cc] for code run at" 8190bfe8cc0SPaolo Bonziniecho " build time" 820a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 821e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 822af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 8236a882643Spbrookecho " --install=INSTALL use specified install [$install]" 824af5db58eSpbrookecho " --static enable static build [$static]" 8250b24e75fSPaolo Bonziniecho " --mandir=PATH install man pages in PATH" 8260b24e75fSPaolo Bonziniecho " --datadir=PATH install firmware in PATH" 8270b24e75fSPaolo Bonziniecho " --docdir=PATH install documentation in PATH" 8280b24e75fSPaolo Bonziniecho " --bindir=PATH install binaries in PATH" 8290b24e75fSPaolo Bonziniecho " --sysconfdir=PATH install config in PATH/qemu" 830f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 831f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 83209695a4aSStefan Weilecho " --enable-debug enable common debug build options" 833890b1658Saliguoriecho " --enable-sparse enable sparse checker" 834890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 8351625af87Saliguoriecho " --disable-strip disable stripping binaries" 83685aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 837fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 838c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 839af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 840c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 841c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 8424c9b53e3Smalcecho " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" 8434c9b53e3Smalcecho " Available cards: $audio_possible_cards" 844eb852011SMarkus Armbrusterecho " --block-drv-whitelist=L set block driver whitelist" 845eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 8468ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 847e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 848fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 8492e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 8504ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 8518d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 8521be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 8532f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 854ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 8552f6f5c7aSCorentin Charyecho " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" 8562f6f5c7aSCorentin Charyecho " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" 85796763cf9SCorentin Charyecho " --disable-vnc-png disable PNG compression for VNC server (default)" 858efe556adSCorentin Charyecho " --enable-vnc-png enable PNG compression for VNC server" 859bd023f95SCorentin Charyecho " --disable-vnc-thread disable threaded VNC server" 860bd023f95SCorentin Charyecho " --enable-vnc-thread enable threaded VNC server" 861af896aaaSpbrookecho " --disable-curses disable curses output" 862c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 863769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 864788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 8652df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 8662df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 8675495ed11SLuiz Capitulinoecho " --disable-check-utests disable check unit-tests" 8685495ed11SLuiz Capitulinoecho " --enable-check-utests enable check unit-tests" 869fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 870a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 8717ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 872b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 873bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 874e5934d33SAndre Przywaraecho " --enable-nptl enable usermode NPTL support" 875af5db58eSpbrookecho " --enable-system enable all system emulation targets" 876af5db58eSpbrookecho " --disable-system disable all system emulation targets" 8770953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 8780953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 879831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 880831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 881831b7825Sthsecho " --enable-darwin-user enable all darwin usermode emulation targets" 882831b7825Sthsecho " --disable-darwin-user disable all darwin usermode emulation targets" 88384778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 88484778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 885379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 886379f6698SPaul Brookecho " emulation targets" 887379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 88834005a00SKirill A. Shutemovecho " --enable-user-pie build usermode emulation targets as PIE" 88934005a00SKirill A. Shutemovecho " --disable-user-pie do not build usermode emulation targets as PIE" 890af5db58eSpbrookecho " --fmod-lib path to FMOD library" 891af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 8922f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 893c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 8943142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 895ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 896ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 897e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 898dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 8995c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 9005c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 901758e8e38SVenkateswararao Jujjuri (JV)echo " --disable-attr disables attr and xattr support" 902758e8e38SVenkateswararao Jujjuri (JV)echo " --enable-attr enable attr and xattr support" 903e5d355d1Saliguoriecho " --enable-io-thread enable IO thread" 90477755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 905eac30262Saliguoriecho " --kerneldir=PATH look for kernel includes in PATH" 906d2807bc9SDirk Ullrichecho " --enable-docs enable documentation build" 907d2807bc9SDirk Ullrichecho " --disable-docs disable documentation build" 908d5970055SMichael S. Tsirkinecho " --disable-vhost-net disable vhost-net acceleration support" 909d5970055SMichael S. Tsirkinecho " --enable-vhost-net enable vhost-net acceleration support" 910320fba2aSFabien Chouteauecho " --enable-trace-backend=B Set trace backend" 911320fba2aSFabien Chouteauecho " Available backends:" $("$source_path"/scripts/tracetool --list-backends) 91274242e0fSPaolo Bonziniecho " --with-trace-file=NAME Full PATH,NAME of file to store traces" 9139410b56cSPrerna Saxenaecho " Default:trace-<pid>" 914cd4ec0b4SGerd Hoffmannecho " --disable-spice disable spice" 915cd4ec0b4SGerd Hoffmannecho " --enable-spice enable spice" 916f27aaf4bSChristian Brunnerecho " --enable-rbd enable building the rados block device (rbd)" 917af5db58eSpbrookecho "" 9185bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 919af5db58eSpbrookexit 1 920af5db58eSpbrookfi 921af5db58eSpbrook 9228d05095cSPaolo Bonzini# check that the C compiler works. 9238d05095cSPaolo Bonzinicat > $TMPC <<EOF 9248d05095cSPaolo Bonziniint main(void) {} 9258d05095cSPaolo BonziniEOF 9268d05095cSPaolo Bonzini 9278d05095cSPaolo Bonziniif compile_object ; then 9288d05095cSPaolo Bonzini : C compiler works ok 9298d05095cSPaolo Bonzinielse 9308d05095cSPaolo Bonzini echo "ERROR: \"$cc\" either does not exist or does not work" 9318d05095cSPaolo Bonzini exit 1 9328d05095cSPaolo Bonzinifi 9338d05095cSPaolo Bonzini 9348d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 9358d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 9368d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 9378d05095cSPaolo Bonzinigcc_flags="-fstack-protector-all $gcc_flags" 9388d05095cSPaolo Bonzinicat > $TMPC << EOF 9398d05095cSPaolo Bonziniint main(void) { return 0; } 9408d05095cSPaolo BonziniEOF 9418d05095cSPaolo Bonzinifor flag in $gcc_flags; do 9428d05095cSPaolo Bonzini if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then 9438d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 9448d05095cSPaolo Bonzini fi 9458d05095cSPaolo Bonzinidone 9468d05095cSPaolo Bonzini 947ec530c81Sbellard# 948ec530c81Sbellard# Solaris specific configure tool chain decisions 949ec530c81Sbellard# 950ec530c81Sbellardif test "$solaris" = "yes" ; then 9516792aa11SLoïc Minier if has $install; then 9526792aa11SLoïc Minier : 9536792aa11SLoïc Minier else 954ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 955ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 956ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 957ec530c81Sbellard exit 1 958ec530c81Sbellard fi 9596792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 960ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 961ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 962ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 963ec530c81Sbellard exit 1 964ec530c81Sbellard fi 9656792aa11SLoïc Minier if has ar; then 9666792aa11SLoïc Minier : 9676792aa11SLoïc Minier else 968ec530c81Sbellard echo "Error: No path includes ar" 969ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 970ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 971ec530c81Sbellard fi 972ec530c81Sbellard exit 1 973ec530c81Sbellard fi 974ec530c81Sbellardfi 975ec530c81Sbellard 976ec530c81Sbellard 9775327cf48Sbellardif test -z "$target_list" ; then 9785327cf48Sbellard# these targets are portable 9790a8e90f4Spbrook if [ "$softmmu" = "yes" ] ; then 9802408a527Saurel32 target_list="\ 9812408a527Saurel32i386-softmmu \ 9822408a527Saurel32x86_64-softmmu \ 9832408a527Saurel32arm-softmmu \ 9842408a527Saurel32cris-softmmu \ 9852408a527Saurel32m68k-softmmu \ 98672b675caSEdgar E. Iglesiasmicroblaze-softmmu \ 9872408a527Saurel32mips-softmmu \ 9882408a527Saurel32mipsel-softmmu \ 9892408a527Saurel32mips64-softmmu \ 9902408a527Saurel32mips64el-softmmu \ 9912408a527Saurel32ppc-softmmu \ 9922408a527Saurel32ppcemb-softmmu \ 9932408a527Saurel32ppc64-softmmu \ 9942408a527Saurel32sh4-softmmu \ 9952408a527Saurel32sh4eb-softmmu \ 9962408a527Saurel32sparc-softmmu \ 9971b64fcaeSIgor V. Kovalenkosparc64-softmmu \ 9982408a527Saurel32" 9990a8e90f4Spbrook fi 10005327cf48Sbellard# the following are Linux specific 1001831b7825Sths if [ "$linux_user" = "yes" ] ; then 10022408a527Saurel32 target_list="${target_list}\ 10032408a527Saurel32i386-linux-user \ 10042408a527Saurel32x86_64-linux-user \ 10052408a527Saurel32alpha-linux-user \ 10062408a527Saurel32arm-linux-user \ 10072408a527Saurel32armeb-linux-user \ 10082408a527Saurel32cris-linux-user \ 10092408a527Saurel32m68k-linux-user \ 101072b675caSEdgar E. Iglesiasmicroblaze-linux-user \ 10112408a527Saurel32mips-linux-user \ 10122408a527Saurel32mipsel-linux-user \ 10132408a527Saurel32ppc-linux-user \ 10142408a527Saurel32ppc64-linux-user \ 10152408a527Saurel32ppc64abi32-linux-user \ 10162408a527Saurel32sh4-linux-user \ 10172408a527Saurel32sh4eb-linux-user \ 10182408a527Saurel32sparc-linux-user \ 10192408a527Saurel32sparc64-linux-user \ 10202408a527Saurel32sparc32plus-linux-user \ 10212408a527Saurel32" 1022831b7825Sths fi 1023831b7825Sths# the following are Darwin specific 1024831b7825Sths if [ "$darwin_user" = "yes" ] ; then 10252408a527Saurel32 target_list="$target_list i386-darwin-user ppc-darwin-user " 10265327cf48Sbellard fi 102784778508Sblueswir1# the following are BSD specific 102884778508Sblueswir1 if [ "$bsd_user" = "yes" ] ; then 102984778508Sblueswir1 target_list="${target_list}\ 103031fc12dfSblueswir1i386-bsd-user \ 103131fc12dfSblueswir1x86_64-bsd-user \ 103231fc12dfSblueswir1sparc-bsd-user \ 103384778508Sblueswir1sparc64-bsd-user \ 103484778508Sblueswir1" 103584778508Sblueswir1 fi 10366e20a45fSbellardelse 1037b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 10385327cf48Sbellardfi 10390a8e90f4Spbrookif test -z "$target_list" ; then 10400a8e90f4Spbrook echo "No targets enabled" 10410a8e90f4Spbrook exit 1 10420a8e90f4Spbrookfi 1043f55fe278SPaolo Bonzini# see if system emulation was really requested 1044f55fe278SPaolo Bonzinicase " $target_list " in 1045f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1046f55fe278SPaolo Bonzini ;; 1047f55fe278SPaolo Bonzini *) softmmu=no 1048f55fe278SPaolo Bonzini ;; 1049f55fe278SPaolo Bonziniesac 10505327cf48Sbellard 1051249247c9SJuan Quintelafeature_not_found() { 1052249247c9SJuan Quintela feature=$1 1053249247c9SJuan Quintela 1054249247c9SJuan Quintela echo "ERROR" 1055249247c9SJuan Quintela echo "ERROR: User requested feature $feature" 10569332f6a2SSebastian Herbszt echo "ERROR: configure was not able to find it" 1057249247c9SJuan Quintela echo "ERROR" 1058249247c9SJuan Quintela exit 1; 1059249247c9SJuan Quintela} 1060249247c9SJuan Quintela 10617d13299dSbellardif test -z "$cross_prefix" ; then 10627d13299dSbellard 10637d13299dSbellard# --- 10647d13299dSbellard# big/little endian test 10657d13299dSbellardcat > $TMPC << EOF 10667d13299dSbellard#include <inttypes.h> 10677d13299dSbellardint main(int argc, char ** argv){ 10687d13299dSbellard volatile uint32_t i=0x01234567; 10697d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 10707d13299dSbellard} 10717d13299dSbellardEOF 10727d13299dSbellard 107352166aa0SJuan Quintelaif compile_prog "" "" ; then 10747d13299dSbellard$TMPE && bigendian="yes" 10757d13299dSbellardelse 10767d13299dSbellardecho big/little test failed 10777d13299dSbellardfi 10787d13299dSbellard 10797d13299dSbellardelse 10807d13299dSbellard 10817d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 1082ea8f20f8SJuan Quintelacase "$cpu" in 108324e804ecSAlexander Graf armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 1084ea8f20f8SJuan Quintela bigendian=yes 1085ea8f20f8SJuan Quintela ;; 1086ea8f20f8SJuan Quintelaesac 10877d13299dSbellard 10887d13299dSbellardfi 10897d13299dSbellard 109070be1a2eSPaolo Bonzini# host long bits test, actually a pointer size test 109170be1a2eSPaolo Bonzinicat > $TMPC << EOF 109270be1a2eSPaolo Bonziniint sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1]; 109370be1a2eSPaolo BonziniEOF 109470be1a2eSPaolo Bonziniif compile_object; then 1095ea8f20f8SJuan Quintelahostlongbits=64 109670be1a2eSPaolo Bonzinielse 109770be1a2eSPaolo Bonzinihostlongbits=32 109870be1a2eSPaolo Bonzinifi 1099b6853697Sbellard 1100b0a47e79SJuan Quintela 1101b0a47e79SJuan Quintela########################################## 1102b0a47e79SJuan Quintela# NPTL probe 1103b0a47e79SJuan Quintela 1104b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then 1105bd0c5661Spbrook cat > $TMPC <<EOF 1106bd0c5661Spbrook#include <sched.h> 110730813ceaSpbrook#include <linux/futex.h> 1108bd0c5661Spbrookvoid foo() 1109bd0c5661Spbrook{ 1110bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1111bd0c5661Spbrook#error bork 1112bd0c5661Spbrook#endif 1113bd0c5661Spbrook} 1114bd0c5661SpbrookEOF 1115bd0c5661Spbrook 111652166aa0SJuan Quintela if compile_object ; then 1117b0a47e79SJuan Quintela nptl=yes 1118bd0c5661Spbrook else 1119b0a47e79SJuan Quintela if test "$nptl" = "yes" ; then 1120b0a47e79SJuan Quintela feature_not_found "nptl" 1121b0a47e79SJuan Quintela fi 1122b0a47e79SJuan Quintela nptl=no 1123b0a47e79SJuan Quintela fi 1124bd0c5661Spbrookfi 1125bd0c5661Spbrook 112611d9f695Sbellard########################################## 1127ac62922eSbalrog# zlib check 1128ac62922eSbalrog 1129ac62922eSbalrogcat > $TMPC << EOF 1130ac62922eSbalrog#include <zlib.h> 1131ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1132ac62922eSbalrogEOF 113352166aa0SJuan Quintelaif compile_prog "" "-lz" ; then 1134ac62922eSbalrog : 1135ac62922eSbalrogelse 1136ac62922eSbalrog echo 1137ac62922eSbalrog echo "Error: zlib check failed" 1138ac62922eSbalrog echo "Make sure to have the zlib libs and headers installed." 1139ac62922eSbalrog echo 1140ac62922eSbalrog exit 1 1141ac62922eSbalrogfi 1142ac62922eSbalrog 1143ac62922eSbalrog########################################## 1144e37630caSaliguori# xen probe 1145e37630caSaliguori 1146fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1147b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1148e37630caSaliguori cat > $TMPC <<EOF 1149e37630caSaliguori#include <xenctrl.h> 1150e37630caSaliguori#include <xs.h> 1151df7a607bSChristoph Eggerint main(void) { xs_daemon_open(); xc_interface_open(); return 0; } 1152e37630caSaliguoriEOF 115352166aa0SJuan Quintela if compile_prog "" "$xen_libs" ; then 1154fc321b4bSJuan Quintela xen=yes 11553efd632bSJuan Quintela libs_softmmu="$xen_libs $libs_softmmu" 1156e37630caSaliguori else 1157fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 1158fc321b4bSJuan Quintela feature_not_found "xen" 1159fc321b4bSJuan Quintela fi 1160fc321b4bSJuan Quintela xen=no 1161e37630caSaliguori fi 1162e37630caSaliguorifi 1163e37630caSaliguori 1164e37630caSaliguori########################################## 1165a8bd70adSPaolo Bonzini# pkg-config probe 1166f91672e5SPaolo Bonzini 1167a8bd70adSPaolo Bonziniif ! has $pkg_config; then 116808421541SPaolo Bonzini echo warning: proceeding without "$pkg_config" >&2 116908421541SPaolo Bonzini pkg_config=/bin/false 1170f91672e5SPaolo Bonzinifi 1171f91672e5SPaolo Bonzini 1172f91672e5SPaolo Bonzini########################################## 1173dfffc653SJuan Quintela# Sparse probe 1174dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 11750dba6195SLoïc Minier if has cgcc; then 1176dfffc653SJuan Quintela sparse=yes 1177dfffc653SJuan Quintela else 1178dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 1179dfffc653SJuan Quintela feature_not_found "sparse" 1180dfffc653SJuan Quintela fi 1181dfffc653SJuan Quintela sparse=no 1182dfffc653SJuan Quintela fi 1183dfffc653SJuan Quintelafi 1184dfffc653SJuan Quintela 1185dfffc653SJuan Quintela########################################## 118611d9f695Sbellard# SDL probe 118711d9f695Sbellard 11883ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 11893ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 11903ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then 11913ec87ffeSPaolo Bonzini sdl_config=sdl-config 11923ec87ffeSPaolo Bonzinifi 11933ec87ffeSPaolo Bonzini 11943ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then 1195a8bd70adSPaolo Bonzini sdlconfig="$pkg_config sdl" 1196fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 11973ec87ffeSPaolo Bonzinielif has ${sdl_config}; then 11983ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 11999316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1200a0dfd8a4SLoïc Minierelse 1201a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 1202a0dfd8a4SLoïc Minier feature_not_found "sdl" 1203a0dfd8a4SLoïc Minier fi 1204a0dfd8a4SLoïc Minier sdl=no 12059316f803SPaolo Bonzinifi 12063ec87ffeSPaolo Bonziniif test -n "$cross_prefix" && test "`basename $sdlconfig`" = sdl-config; then 12073ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 12083ec87ffeSPaolo Bonzinifi 120911d9f695Sbellard 12109316f803SPaolo Bonzinisdl_too_old=no 1211c4198157SJuan Quintelaif test "$sdl" != "no" ; then 121211d9f695Sbellard cat > $TMPC << EOF 121311d9f695Sbellard#include <SDL.h> 121411d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 121511d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 121611d9f695SbellardEOF 12179316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 121874f42e18STeLeMan if test "$static" = "yes" ; then 121974f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 122074f42e18STeLeMan else 12219316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 122274f42e18STeLeMan fi 122352166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 122411d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 122511d9f695Sbellard sdl_too_old=yes 122611d9f695Sbellard else 1227fd677642Sths if test "$cocoa" = "no" ; then 122811d9f695Sbellard sdl=yes 122911d9f695Sbellard fi 1230fd677642Sths fi 12317c1f25b4Sbellard 123267c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 12331ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 123467c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 1235f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 1236f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 123711d9f695Sbellard fi 123852166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 12391ac88f28SJuan Quintela : 12401ac88f28SJuan Quintela else 12411ac88f28SJuan Quintela sdl=no 12427c1f25b4Sbellard fi 12437c1f25b4Sbellard fi # static link 1244c4198157SJuan Quintela else # sdl not found 1245c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1246c4198157SJuan Quintela feature_not_found "sdl" 1247c4198157SJuan Quintela fi 1248c4198157SJuan Quintela sdl=no 12497c1f25b4Sbellard fi # sdl compile test 1250fd677642Sthsfi 125111d9f695Sbellard 12525368a422Saliguoriif test "$sdl" = "yes" ; then 12535368a422Saliguori cat > $TMPC <<EOF 12545368a422Saliguori#include <SDL.h> 12555368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 12565368a422Saliguori#include <X11/XKBlib.h> 12575368a422Saliguori#else 12585368a422Saliguori#error No x11 support 12595368a422Saliguori#endif 12605368a422Saliguoriint main(void) { return 0; } 12615368a422SaliguoriEOF 126252166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1263681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 12645368a422Saliguori fi 126507d9ac44SJuan Quintela if test "$mingw32" = "yes" ; then 126607d9ac44SJuan Quintela sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole" 126707d9ac44SJuan Quintela fi 12680705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 12695368a422Saliguorifi 12705368a422Saliguori 12718f28f3fbSths########################################## 12728d5d2d4cSths# VNC TLS detection 12731be10ad2SJuan Quintelaif test "$vnc_tls" != "no" ; then 1274ae6b5e5aSaliguori cat > $TMPC <<EOF 1275ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1276ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1277ae6b5e5aSaliguoriEOF 1278a8bd70adSPaolo Bonzini vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` 1279a8bd70adSPaolo Bonzini vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` 128052166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 12811be10ad2SJuan Quintela vnc_tls=yes 1282a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1283ae6b5e5aSaliguori else 12841be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 12851be10ad2SJuan Quintela feature_not_found "vnc-tls" 12861be10ad2SJuan Quintela fi 12871be10ad2SJuan Quintela vnc_tls=no 12888d5d2d4cSths fi 12898d5d2d4cSthsfi 12908d5d2d4cSths 12918d5d2d4cSths########################################## 12922f9606b3Saliguori# VNC SASL detection 12933aefa744SJuan Quintelaif test "$vnc_sasl" != "no" ; then 12942f9606b3Saliguori cat > $TMPC <<EOF 12952f9606b3Saliguori#include <sasl/sasl.h> 12962f9606b3Saliguori#include <stdio.h> 12972f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 12982f9606b3SaliguoriEOF 12992f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 13002f9606b3Saliguori vnc_sasl_cflags="" 13012f9606b3Saliguori vnc_sasl_libs="-lsasl2" 130252166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1303ea784e3bSJuan Quintela vnc_sasl=yes 1304fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 13052f9606b3Saliguori else 1306ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1307ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1308ea784e3bSJuan Quintela fi 1309ea784e3bSJuan Quintela vnc_sasl=no 13102f9606b3Saliguori fi 13112f9606b3Saliguorifi 13122f9606b3Saliguori 13132f9606b3Saliguori########################################## 13142f6f5c7aSCorentin Chary# VNC JPEG detection 131596763cf9SCorentin Charyif test "$vnc_jpeg" != "no" ; then 13162f6f5c7aSCorentin Charycat > $TMPC <<EOF 13172f6f5c7aSCorentin Chary#include <stdio.h> 13182f6f5c7aSCorentin Chary#include <jpeglib.h> 13192f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 13202f6f5c7aSCorentin CharyEOF 13212f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 13222f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 13232f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 13242f6f5c7aSCorentin Chary vnc_jpeg=yes 13252f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 13262f6f5c7aSCorentin Chary else 13272f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 13282f6f5c7aSCorentin Chary feature_not_found "vnc-jpeg" 13292f6f5c7aSCorentin Chary fi 13302f6f5c7aSCorentin Chary vnc_jpeg=no 13312f6f5c7aSCorentin Chary fi 13322f6f5c7aSCorentin Charyfi 13332f6f5c7aSCorentin Chary 13342f6f5c7aSCorentin Chary########################################## 1335efe556adSCorentin Chary# VNC PNG detection 133696763cf9SCorentin Charyif test "$vnc_png" != "no" ; then 1337efe556adSCorentin Charycat > $TMPC <<EOF 1338efe556adSCorentin Chary//#include <stdio.h> 1339efe556adSCorentin Chary#include <png.h> 1340832ce9c2SScott Wood#include <stddef.h> 1341efe556adSCorentin Charyint main(void) { 1342efe556adSCorentin Chary png_structp png_ptr; 1343efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 1344efe556adSCorentin Chary return 0; 1345efe556adSCorentin Chary} 1346efe556adSCorentin CharyEOF 1347efe556adSCorentin Chary vnc_png_cflags="" 1348efe556adSCorentin Chary vnc_png_libs="-lpng" 1349efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 1350efe556adSCorentin Chary vnc_png=yes 1351efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 1352efe556adSCorentin Chary else 1353efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 1354efe556adSCorentin Chary feature_not_found "vnc-png" 1355efe556adSCorentin Chary fi 1356efe556adSCorentin Chary vnc_png=no 1357efe556adSCorentin Chary fi 1358efe556adSCorentin Charyfi 1359efe556adSCorentin Chary 1360efe556adSCorentin Chary########################################## 136176655d6dSaliguori# fnmatch() probe, used for ACL routines 136276655d6dSaliguorifnmatch="no" 136376655d6dSaliguoricat > $TMPC << EOF 136476655d6dSaliguori#include <fnmatch.h> 136576655d6dSaliguoriint main(void) 136676655d6dSaliguori{ 136776655d6dSaliguori fnmatch("foo", "foo", 0); 136876655d6dSaliguori return 0; 136976655d6dSaliguori} 137076655d6dSaliguoriEOF 137152166aa0SJuan Quintelaif compile_prog "" "" ; then 137276655d6dSaliguori fnmatch="yes" 137376655d6dSaliguorifi 137476655d6dSaliguori 137576655d6dSaliguori########################################## 1376ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 1377ee682d27SStefan Weilif test "$uuid" != "no" ; then 1378ee682d27SStefan Weil uuid_libs="-luuid" 1379ee682d27SStefan Weil cat > $TMPC << EOF 1380ee682d27SStefan Weil#include <uuid/uuid.h> 1381ee682d27SStefan Weilint main(void) 1382ee682d27SStefan Weil{ 1383ee682d27SStefan Weil uuid_t my_uuid; 1384ee682d27SStefan Weil uuid_generate(my_uuid); 1385ee682d27SStefan Weil return 0; 1386ee682d27SStefan Weil} 1387ee682d27SStefan WeilEOF 1388ee682d27SStefan Weil if compile_prog "" "$uuid_libs" ; then 1389ee682d27SStefan Weil uuid="yes" 1390ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1391ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1392ee682d27SStefan Weil else 1393ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1394ee682d27SStefan Weil feature_not_found "uuid" 1395ee682d27SStefan Weil fi 1396ee682d27SStefan Weil uuid=no 1397ee682d27SStefan Weil fi 1398ee682d27SStefan Weilfi 1399ee682d27SStefan Weil 1400ee682d27SStefan Weil########################################## 1401dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix 1402dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 1403dce512deSChristoph Hellwig cat > $TMPC << EOF 1404dce512deSChristoph Hellwig#include <xfs/xfs.h> 1405dce512deSChristoph Hellwigint main(void) 1406dce512deSChristoph Hellwig{ 1407dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 1408dce512deSChristoph Hellwig return 0; 1409dce512deSChristoph Hellwig} 1410dce512deSChristoph HellwigEOF 1411dce512deSChristoph Hellwig if compile_prog "" "" ; then 1412dce512deSChristoph Hellwig xfs="yes" 1413dce512deSChristoph Hellwig else 1414dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 1415dce512deSChristoph Hellwig feature_not_found "xfs" 1416dce512deSChristoph Hellwig fi 1417dce512deSChristoph Hellwig xfs=no 1418dce512deSChristoph Hellwig fi 1419dce512deSChristoph Hellwigfi 1420dce512deSChristoph Hellwig 1421dce512deSChristoph Hellwig########################################## 14228a16d273Sths# vde libraries probe 1423dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 14244baae0acSJuan Quintela vde_libs="-lvdeplug" 14258a16d273Sths cat > $TMPC << EOF 14268a16d273Sths#include <libvdeplug.h> 14274a7f0e06Spbrookint main(void) 14284a7f0e06Spbrook{ 14294a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 14304a7f0e06Spbrook vde_open("", "", &a); 14314a7f0e06Spbrook return 0; 14324a7f0e06Spbrook} 14338a16d273SthsEOF 143452166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 14354baae0acSJuan Quintela vde=yes 14368e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 14378e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 1438dfb278bdSJuan Quintela else 1439dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 1440dfb278bdSJuan Quintela feature_not_found "vde" 1441dfb278bdSJuan Quintela fi 1442dfb278bdSJuan Quintela vde=no 14438a16d273Sths fi 14448a16d273Sthsfi 14458a16d273Sths 14468a16d273Sths########################################## 1447c2de5c91Smalc# Sound support libraries probe 14488f28f3fbSths 1449c2de5c91Smalcaudio_drv_probe() 1450c2de5c91Smalc{ 1451c2de5c91Smalc drv=$1 1452c2de5c91Smalc hdr=$2 1453c2de5c91Smalc lib=$3 1454c2de5c91Smalc exp=$4 1455c2de5c91Smalc cfl=$5 14568f28f3fbSths cat > $TMPC << EOF 1457c2de5c91Smalc#include <$hdr> 1458c2de5c91Smalcint main(void) { $exp } 14598f28f3fbSthsEOF 146052166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 14618f28f3fbSths : 14628f28f3fbSths else 14638f28f3fbSths echo 1464c2de5c91Smalc echo "Error: $drv check failed" 1465c2de5c91Smalc echo "Make sure to have the $drv libs and headers installed." 14668f28f3fbSths echo 14678f28f3fbSths exit 1 14688f28f3fbSths fi 1469c2de5c91Smalc} 1470c2de5c91Smalc 14712fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 1472c2de5c91Smalcfor drv in $audio_drv_list; do 1473c2de5c91Smalc case $drv in 1474c2de5c91Smalc alsa) 1475c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 1476c2de5c91Smalc "snd_pcm_t **handle; return snd_pcm_close(*handle);" 1477a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 1478c2de5c91Smalc ;; 1479c2de5c91Smalc 1480c2de5c91Smalc fmod) 1481c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 1482c2de5c91Smalc echo 1483c2de5c91Smalc echo "Error: You must specify path to FMOD library and headers" 1484c2de5c91Smalc echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 1485c2de5c91Smalc echo 1486c2de5c91Smalc exit 1 14878f28f3fbSths fi 1488c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 1489a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 1490c2de5c91Smalc ;; 1491c2de5c91Smalc 1492c2de5c91Smalc esd) 1493c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 1494a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 149567f86e8eSJuan Quintela audio_pt_int="yes" 1496c2de5c91Smalc ;; 1497b8e59f18Smalc 1498b8e59f18Smalc pa) 1499493abda6SAurelien Jarno audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \ 1500b8e59f18Smalc "pa_simple *s = NULL; pa_simple_free(s); return 0;" 1501493abda6SAurelien Jarno libs_softmmu="-lpulse -lpulse-simple $libs_softmmu" 150267f86e8eSJuan Quintela audio_pt_int="yes" 1503b8e59f18Smalc ;; 1504b8e59f18Smalc 1505997e690aSJuan Quintela coreaudio) 1506997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 1507997e690aSJuan Quintela ;; 1508997e690aSJuan Quintela 1509a4bf6780SJuan Quintela dsound) 1510a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 1511d5631638Smalc audio_win_int="yes" 1512a4bf6780SJuan Quintela ;; 1513a4bf6780SJuan Quintela 1514a4bf6780SJuan Quintela oss) 1515a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 1516a4bf6780SJuan Quintela ;; 1517a4bf6780SJuan Quintela 1518a4bf6780SJuan Quintela sdl|wav) 15192f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 15202f6a1ab0Sblueswir1 ;; 15212f6a1ab0Sblueswir1 1522d5631638Smalc winwave) 1523d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 1524d5631638Smalc audio_win_int="yes" 1525d5631638Smalc ;; 1526d5631638Smalc 1527e4c63a6aSmalc *) 15281c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 1529e4c63a6aSmalc echo 1530e4c63a6aSmalc echo "Error: Unknown driver '$drv' selected" 1531e4c63a6aSmalc echo "Possible drivers are: $audio_possible_drivers" 1532e4c63a6aSmalc echo 1533e4c63a6aSmalc exit 1 1534e4c63a6aSmalc } 1535e4c63a6aSmalc ;; 1536c2de5c91Smalc esac 1537c2de5c91Smalcdone 15388f28f3fbSths 15394d3b6f6eSbalrog########################################## 15402e4d9fb1Saurel32# BrlAPI probe 15412e4d9fb1Saurel32 15424ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 1543eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 15442e4d9fb1Saurel32 cat > $TMPC << EOF 15452e4d9fb1Saurel32#include <brlapi.h> 1546832ce9c2SScott Wood#include <stddef.h> 15472e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 15482e4d9fb1Saurel32EOF 154952166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 15502e4d9fb1Saurel32 brlapi=yes 1551264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 15524ffcedb6SJuan Quintela else 15534ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 15544ffcedb6SJuan Quintela feature_not_found "brlapi" 15554ffcedb6SJuan Quintela fi 15564ffcedb6SJuan Quintela brlapi=no 1557eb82284fSJuan Quintela fi 1558eb82284fSJuan Quintelafi 15592e4d9fb1Saurel32 15602e4d9fb1Saurel32########################################## 15614d3b6f6eSbalrog# curses probe 15624f78ef9aSJuan Quintelacurses_list="-lncurses -lcurses" 15634d3b6f6eSbalrog 1564c584a6d0SJuan Quintelaif test "$curses" != "no" ; then 1565c584a6d0SJuan Quintela curses_found=no 15664d3b6f6eSbalrog cat > $TMPC << EOF 15674d3b6f6eSbalrog#include <curses.h> 15685a8ff3aaSblueswir1#ifdef __OpenBSD__ 15695a8ff3aaSblueswir1#define resize_term resizeterm 15705a8ff3aaSblueswir1#endif 15715a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); } 15724d3b6f6eSbalrogEOF 15734f78ef9aSJuan Quintela for curses_lib in $curses_list; do 15744f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 1575c584a6d0SJuan Quintela curses_found=yes 15764f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 15774f78ef9aSJuan Quintela break 15784d3b6f6eSbalrog fi 15794f78ef9aSJuan Quintela done 1580c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 1581c584a6d0SJuan Quintela curses=yes 1582c584a6d0SJuan Quintela else 1583c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 1584c584a6d0SJuan Quintela feature_not_found "curses" 1585c584a6d0SJuan Quintela fi 1586c584a6d0SJuan Quintela curses=no 1587c584a6d0SJuan Quintela fi 15884f78ef9aSJuan Quintelafi 15894d3b6f6eSbalrog 1590414f0dabSblueswir1########################################## 1591769ce76dSAlexander Graf# curl probe 1592769ce76dSAlexander Graf 1593a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then 1594a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 15954e2b0658SPaolo Bonzinielse 15964e2b0658SPaolo Bonzini curlconfig=curl-config 15974e2b0658SPaolo Bonzinifi 15984e2b0658SPaolo Bonzini 1599788c8196SJuan Quintelaif test "$curl" != "no" ; then 1600769ce76dSAlexander Graf cat > $TMPC << EOF 1601769ce76dSAlexander Graf#include <curl/curl.h> 1602769ce76dSAlexander Grafint main(void) { return curl_easy_init(); } 1603769ce76dSAlexander GrafEOF 16044e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 16054e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 1606b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 1607769ce76dSAlexander Graf curl=yes 1608f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 1609f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 1610788c8196SJuan Quintela else 1611788c8196SJuan Quintela if test "$curl" = "yes" ; then 1612788c8196SJuan Quintela feature_not_found "curl" 1613788c8196SJuan Quintela fi 1614788c8196SJuan Quintela curl=no 1615769ce76dSAlexander Graf fi 1616769ce76dSAlexander Graffi # test "$curl" 1617769ce76dSAlexander Graf 1618769ce76dSAlexander Graf########################################## 16195495ed11SLuiz Capitulino# check framework probe 16205495ed11SLuiz Capitulino 16215495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then 16225495ed11SLuiz Capitulino cat > $TMPC << EOF 16235495ed11SLuiz Capitulino#include <check.h> 16245495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; } 16255495ed11SLuiz CapitulinoEOF 1626a8bd70adSPaolo Bonzini check_libs=`$pkg_config --libs check` 16275495ed11SLuiz Capitulino if compile_prog "" $check_libs ; then 16285495ed11SLuiz Capitulino check_utests=yes 16295495ed11SLuiz Capitulino libs_tools="$check_libs $libs_tools" 16305495ed11SLuiz Capitulino else 16315495ed11SLuiz Capitulino if test "$check_utests" = "yes" ; then 16325495ed11SLuiz Capitulino feature_not_found "check" 16335495ed11SLuiz Capitulino fi 16345495ed11SLuiz Capitulino check_utests=no 16355495ed11SLuiz Capitulino fi 16365495ed11SLuiz Capitulinofi # test "$check_utests" 16375495ed11SLuiz Capitulino 16385495ed11SLuiz Capitulino########################################## 1639fb599c9aSbalrog# bluez support probe 1640a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 1641e820e3f4Sbalrog cat > $TMPC << EOF 1642e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 1643e820e3f4Sbalrogint main(void) { return bt_error(0); } 1644e820e3f4SbalrogEOF 1645a8bd70adSPaolo Bonzini bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` 1646a8bd70adSPaolo Bonzini bluez_libs=`$pkg_config --libs bluez 2> /dev/null` 164752166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 1648a20a6f46SJuan Quintela bluez=yes 1649e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 1650e820e3f4Sbalrog else 1651a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 1652a20a6f46SJuan Quintela feature_not_found "bluez" 1653a20a6f46SJuan Quintela fi 1654e820e3f4Sbalrog bluez="no" 1655e820e3f4Sbalrog fi 1656fb599c9aSbalrogfi 1657fb599c9aSbalrog 1658fb599c9aSbalrog########################################## 16597ba1e619Saliguori# kvm probe 1660b31a0277SJuan Quintelaif test "$kvm" != "no" ; then 16617ba1e619Saliguori cat > $TMPC <<EOF 16627ba1e619Saliguori#include <linux/kvm.h> 16639fd8d8d7Saliguori#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12 16647ba1e619Saliguori#error Invalid KVM version 16657ba1e619Saliguori#endif 166694a8d39aSJan KiszkaEOF 166794a8d39aSJan Kiszka must_have_caps="KVM_CAP_USER_MEMORY \ 166894a8d39aSJan Kiszka KVM_CAP_DESTROY_MEMORY_REGION_WORKS \ 166994a8d39aSJan Kiszka KVM_CAP_COALESCED_MMIO \ 167094a8d39aSJan Kiszka KVM_CAP_SYNC_MMU \ 167194a8d39aSJan Kiszka " 167294a8d39aSJan Kiszka if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) ; then 167394a8d39aSJan Kiszka must_have_caps="$caps \ 167494a8d39aSJan Kiszka KVM_CAP_SET_TSS_ADDR \ 167594a8d39aSJan Kiszka KVM_CAP_EXT_CPUID \ 167694a8d39aSJan Kiszka KVM_CAP_CLOCKSOURCE \ 167794a8d39aSJan Kiszka KVM_CAP_NOP_IO_DELAY \ 167894a8d39aSJan Kiszka KVM_CAP_PV_MMU \ 167994a8d39aSJan Kiszka KVM_CAP_MP_STATE \ 168094a8d39aSJan Kiszka KVM_CAP_USER_NMI \ 168194a8d39aSJan Kiszka " 168294a8d39aSJan Kiszka fi 168394a8d39aSJan Kiszka for c in $must_have_caps ; do 168494a8d39aSJan Kiszka cat >> $TMPC <<EOF 168594a8d39aSJan Kiszka#if !defined($c) 168694a8d39aSJan Kiszka#error Missing KVM capability $c 16879fd8d8d7Saliguori#endif 168894a8d39aSJan KiszkaEOF 168994a8d39aSJan Kiszka done 169094a8d39aSJan Kiszka cat >> $TMPC <<EOF 16917ba1e619Saliguoriint main(void) { return 0; } 16927ba1e619SaliguoriEOF 1693eac30262Saliguori if test "$kerneldir" != "" ; then 1694eac30262Saliguori kvm_cflags=-I"$kerneldir"/include 16958444eb6eSaliguori if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \ 16968444eb6eSaliguori -a -d "$kerneldir/arch/x86/include" ; then 16978444eb6eSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include" 1698406b430dSaliguori elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then 1699406b430dSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include" 17000e60a699SAlexander Graf elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then 17010e60a699SAlexander Graf kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include" 17028444eb6eSaliguori elif test -d "$kerneldir/arch/$cpu/include" ; then 17038444eb6eSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include" 17048444eb6eSaliguori fi 1705eac30262Saliguori else 1706a8bd70adSPaolo Bonzini kvm_cflags=`$pkg_config --cflags kvm-kmod 2>/dev/null` 1707eac30262Saliguori fi 170852166aa0SJuan Quintela if compile_prog "$kvm_cflags" "" ; then 1709b31a0277SJuan Quintela kvm=yes 1710dae5079aSJan Kiszka cat > $TMPC <<EOF 1711dae5079aSJan Kiszka#include <linux/kvm_para.h> 1712dae5079aSJan Kiszkaint main(void) { return 0; } 1713dae5079aSJan KiszkaEOF 1714dae5079aSJan Kiszka if compile_prog "$kvm_cflags" "" ; then 1715dae5079aSJan Kiszka kvm_para=yes 1716dae5079aSJan Kiszka fi 17177ba1e619Saliguori else 1718b31a0277SJuan Quintela if test "$kvm" = "yes" ; then 17190dba6195SLoïc Minier if has awk && has grep; then 1720a558ee17SJuan Quintela kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \ 17219fd8d8d7Saliguori | grep "error: " \ 17229fd8d8d7Saliguori | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` 17239fd8d8d7Saliguori if test "$kvmerr" != "" ; then 1724b31a0277SJuan Quintela echo -e "${kvmerr}\n\ 1725168ccc11SJan KiszkaNOTE: To enable KVM support, update your kernel to 2.6.29+ or install \ 1726168ccc11SJan Kiszkarecent kvm-kmod from http://sourceforge.net/projects/kvm." 17279fd8d8d7Saliguori fi 17289fd8d8d7Saliguori fi 1729b31a0277SJuan Quintela feature_not_found "kvm" 1730b31a0277SJuan Quintela fi 1731b31a0277SJuan Quintela kvm=no 17327ba1e619Saliguori fi 17337ba1e619Saliguorifi 17347ba1e619Saliguori 17357ba1e619Saliguori########################################## 1736d5970055SMichael S. Tsirkin# test for vhost net 1737d5970055SMichael S. Tsirkin 1738d5970055SMichael S. Tsirkinif test "$vhost_net" != "no"; then 1739d5970055SMichael S. Tsirkin if test "$kvm" != "no"; then 1740d5970055SMichael S. Tsirkin cat > $TMPC <<EOF 1741d5970055SMichael S. Tsirkin #include <linux/vhost.h> 1742d5970055SMichael S. Tsirkin int main(void) { return 0; } 1743d5970055SMichael S. TsirkinEOF 1744d5970055SMichael S. Tsirkin if compile_prog "$kvm_cflags" "" ; then 1745d5970055SMichael S. Tsirkin vhost_net=yes 1746d5970055SMichael S. Tsirkin else 1747d5970055SMichael S. Tsirkin if test "$vhost_net" = "yes" ; then 1748d5970055SMichael S. Tsirkin feature_not_found "vhost-net" 1749d5970055SMichael S. Tsirkin fi 1750d5970055SMichael S. Tsirkin vhost_net=no 1751d5970055SMichael S. Tsirkin fi 1752d5970055SMichael S. Tsirkin else 1753d5970055SMichael S. Tsirkin if test "$vhost_net" = "yes" ; then 17544021d247SAurelien Jarno echo "NOTE: vhost-net feature requires KVM (--enable-kvm)." 1755d5970055SMichael S. Tsirkin feature_not_found "vhost-net" 1756d5970055SMichael S. Tsirkin fi 1757d5970055SMichael S. Tsirkin vhost_net=no 1758d5970055SMichael S. Tsirkin fi 1759d5970055SMichael S. Tsirkinfi 1760d5970055SMichael S. Tsirkin 1761d5970055SMichael S. Tsirkin########################################## 1762e5d355d1Saliguori# pthread probe 1763de65fe0fSSebastian HerbsztPTHREADLIBS_LIST="-lpthread -lpthreadGC2" 17643c529d93Saliguori 1765e5d355d1Saliguoripthread=no 1766414f0dabSblueswir1cat > $TMPC << EOF 17673c529d93Saliguori#include <pthread.h> 1768de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; } 1769414f0dabSblueswir1EOF 1770bd00d539SAndreas Färberif compile_prog "" "" ; then 1771bd00d539SAndreas Färber pthread=yes 1772bd00d539SAndreas Färberelse 1773de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 177452166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 1775e5d355d1Saliguori pthread=yes 17765572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 1777de65fe0fSSebastian Herbszt break 1778414f0dabSblueswir1 fi 1779de65fe0fSSebastian Herbszt done 1780bd00d539SAndreas Färberfi 1781414f0dabSblueswir1 17824617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 17834dd75c70SChristoph Hellwig echo 17844dd75c70SChristoph Hellwig echo "Error: pthread check failed" 17854dd75c70SChristoph Hellwig echo "Make sure to have the pthread libs and headers installed." 17864dd75c70SChristoph Hellwig echo 17874dd75c70SChristoph Hellwig exit 1 1788e5d355d1Saliguorifi 1789e5d355d1Saliguori 1790bf9298b9Saliguori########################################## 1791f27aaf4bSChristian Brunner# rbd probe 1792f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 1793f27aaf4bSChristian Brunner cat > $TMPC <<EOF 1794f27aaf4bSChristian Brunner#include <stdio.h> 1795f27aaf4bSChristian Brunner#include <rados/librados.h> 1796f27aaf4bSChristian Brunnerint main(void) { rados_initialize(0, NULL); return 0; } 1797f27aaf4bSChristian BrunnerEOF 1798f27aaf4bSChristian Brunner rbd_libs="-lrados -lcrypto" 1799f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 1800f27aaf4bSChristian Brunner librados_too_old=no 1801f27aaf4bSChristian Brunner cat > $TMPC <<EOF 1802f27aaf4bSChristian Brunner#include <stdio.h> 1803f27aaf4bSChristian Brunner#include <rados/librados.h> 1804f27aaf4bSChristian Brunner#ifndef CEPH_OSD_TMAP_SET 1805f27aaf4bSChristian Brunner#error missing CEPH_OSD_TMAP_SET 1806f27aaf4bSChristian Brunner#endif 1807f27aaf4bSChristian Brunnerint main(void) { 1808f27aaf4bSChristian Brunner int (*func)(const rados_pool_t pool, uint64_t *snapid) = rados_selfmanaged_snap_create; 1809f27aaf4bSChristian Brunner rados_initialize(0, NULL); 1810f27aaf4bSChristian Brunner return 0; 1811f27aaf4bSChristian Brunner} 1812f27aaf4bSChristian BrunnerEOF 1813f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 1814f27aaf4bSChristian Brunner rbd=yes 1815f27aaf4bSChristian Brunner libs_tools="$rbd_libs $libs_tools" 1816f27aaf4bSChristian Brunner libs_softmmu="$rbd_libs $libs_softmmu" 1817f27aaf4bSChristian Brunner else 1818f27aaf4bSChristian Brunner rbd=no 1819f27aaf4bSChristian Brunner librados_too_old=yes 1820f27aaf4bSChristian Brunner fi 1821f27aaf4bSChristian Brunner else 1822f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 1823f27aaf4bSChristian Brunner feature_not_found "rados block device" 1824f27aaf4bSChristian Brunner fi 1825f27aaf4bSChristian Brunner rbd=no 1826f27aaf4bSChristian Brunner fi 1827f27aaf4bSChristian Brunner if test "$librados_too_old" = "yes" ; then 1828f27aaf4bSChristian Brunner echo "-> Your librados version is too old - upgrade needed to have rbd support" 1829f27aaf4bSChristian Brunner fi 1830f27aaf4bSChristian Brunnerfi 1831f27aaf4bSChristian Brunner 1832f27aaf4bSChristian Brunner########################################## 18335c6c3a6cSChristoph Hellwig# linux-aio probe 18345c6c3a6cSChristoph Hellwig 18355c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 18365c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 18375c6c3a6cSChristoph Hellwig#include <libaio.h> 18385c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 1839832ce9c2SScott Wood#include <stddef.h> 18405c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 18415c6c3a6cSChristoph HellwigEOF 18425c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 18435c6c3a6cSChristoph Hellwig linux_aio=yes 1844048d179fSPaul Brook libs_softmmu="$libs_softmmu -laio" 1845048d179fSPaul Brook libs_tools="$libs_tools -laio" 18465c6c3a6cSChristoph Hellwig else 18475c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 18485c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 18495c6c3a6cSChristoph Hellwig fi 18503cfcae3cSLuiz Capitulino linux_aio=no 18515c6c3a6cSChristoph Hellwig fi 18525c6c3a6cSChristoph Hellwigfi 18535c6c3a6cSChristoph Hellwig 18545c6c3a6cSChristoph Hellwig########################################## 1855758e8e38SVenkateswararao Jujjuri (JV)# attr probe 1856758e8e38SVenkateswararao Jujjuri (JV) 1857758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 1858758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 1859758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 1860758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 1861758e8e38SVenkateswararao Jujjuri (JV)#include <attr/xattr.h> 1862758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 1863758e8e38SVenkateswararao Jujjuri (JV)EOF 1864758e8e38SVenkateswararao Jujjuri (JV) if compile_prog "" "-lattr" ; then 1865758e8e38SVenkateswararao Jujjuri (JV) attr=yes 1866758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 1867758e8e38SVenkateswararao Jujjuri (JV) else 1868758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 1869758e8e38SVenkateswararao Jujjuri (JV) feature_not_found "ATTR" 1870758e8e38SVenkateswararao Jujjuri (JV) fi 1871758e8e38SVenkateswararao Jujjuri (JV) attr=no 1872758e8e38SVenkateswararao Jujjuri (JV) fi 1873758e8e38SVenkateswararao Jujjuri (JV)fi 1874758e8e38SVenkateswararao Jujjuri (JV) 1875758e8e38SVenkateswararao Jujjuri (JV)########################################## 1876bf9298b9Saliguori# iovec probe 1877bf9298b9Saliguoricat > $TMPC <<EOF 1878db34f0b3Sblueswir1#include <sys/types.h> 1879bf9298b9Saliguori#include <sys/uio.h> 1880db34f0b3Sblueswir1#include <unistd.h> 1881bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; } 1882bf9298b9SaliguoriEOF 1883bf9298b9Saliguoriiovec=no 188452166aa0SJuan Quintelaif compile_prog "" "" ; then 1885bf9298b9Saliguori iovec=yes 1886bf9298b9Saliguorifi 1887bf9298b9Saliguori 1888f652e6afSaurel32########################################## 1889ceb42de8Saliguori# preadv probe 1890ceb42de8Saliguoricat > $TMPC <<EOF 1891ceb42de8Saliguori#include <sys/types.h> 1892ceb42de8Saliguori#include <sys/uio.h> 1893ceb42de8Saliguori#include <unistd.h> 1894ceb42de8Saliguoriint main(void) { preadv; } 1895ceb42de8SaliguoriEOF 1896ceb42de8Saliguoripreadv=no 189752166aa0SJuan Quintelaif compile_prog "" "" ; then 1898ceb42de8Saliguori preadv=yes 1899ceb42de8Saliguorifi 1900ceb42de8Saliguori 1901ceb42de8Saliguori########################################## 1902f652e6afSaurel32# fdt probe 19032df87df7SJuan Quintelaif test "$fdt" != "no" ; then 1904b41af4baSJuan Quintela fdt_libs="-lfdt" 1905f652e6afSaurel32 cat > $TMPC << EOF 1906f652e6afSaurel32int main(void) { return 0; } 1907f652e6afSaurel32EOF 190852166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 1909f652e6afSaurel32 fdt=yes 1910e4782985SJuan Quintela libs_softmmu="$fdt_libs $libs_softmmu" 19112df87df7SJuan Quintela else 19122df87df7SJuan Quintela if test "$fdt" = "yes" ; then 19132df87df7SJuan Quintela feature_not_found "fdt" 19142df87df7SJuan Quintela fi 19152df87df7SJuan Quintela fdt=no 1916f652e6afSaurel32 fi 1917f652e6afSaurel32fi 1918f652e6afSaurel32 19193b3f24adSaurel32# 19203b3f24adSaurel32# Check for xxxat() functions when we are building linux-user 19213b3f24adSaurel32# emulator. This is done because older glibc versions don't 19223b3f24adSaurel32# have syscall stubs for these implemented. 19233b3f24adSaurel32# 19243b3f24adSaurel32atfile=no 19253b3f24adSaurel32cat > $TMPC << EOF 19263b3f24adSaurel32#define _ATFILE_SOURCE 19273b3f24adSaurel32#include <sys/types.h> 19283b3f24adSaurel32#include <fcntl.h> 19293b3f24adSaurel32#include <unistd.h> 19303b3f24adSaurel32 19313b3f24adSaurel32int 19323b3f24adSaurel32main(void) 19333b3f24adSaurel32{ 19343b3f24adSaurel32 /* try to unlink nonexisting file */ 19353b3f24adSaurel32 return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); 19363b3f24adSaurel32} 19373b3f24adSaurel32EOF 193852166aa0SJuan Quintelaif compile_prog "" "" ; then 19393b3f24adSaurel32 atfile=yes 19403b3f24adSaurel32fi 19413b3f24adSaurel32 194239386ac7Saurel32# Check for inotify functions when we are building linux-user 19433b3f24adSaurel32# emulator. This is done because older glibc versions don't 19443b3f24adSaurel32# have syscall stubs for these implemented. In that case we 19453b3f24adSaurel32# don't provide them even if kernel supports them. 19463b3f24adSaurel32# 19473b3f24adSaurel32inotify=no 19483b3f24adSaurel32cat > $TMPC << EOF 19493b3f24adSaurel32#include <sys/inotify.h> 19503b3f24adSaurel32 19513b3f24adSaurel32int 19523b3f24adSaurel32main(void) 19533b3f24adSaurel32{ 19543b3f24adSaurel32 /* try to start inotify */ 19558690e420Saurel32 return inotify_init(); 19563b3f24adSaurel32} 19573b3f24adSaurel32EOF 195852166aa0SJuan Quintelaif compile_prog "" "" ; then 19593b3f24adSaurel32 inotify=yes 19603b3f24adSaurel32fi 19613b3f24adSaurel32 1962c05c7a73SRiku Voipioinotify1=no 1963c05c7a73SRiku Voipiocat > $TMPC << EOF 1964c05c7a73SRiku Voipio#include <sys/inotify.h> 1965c05c7a73SRiku Voipio 1966c05c7a73SRiku Voipioint 1967c05c7a73SRiku Voipiomain(void) 1968c05c7a73SRiku Voipio{ 1969c05c7a73SRiku Voipio /* try to start inotify */ 1970c05c7a73SRiku Voipio return inotify_init1(0); 1971c05c7a73SRiku Voipio} 1972c05c7a73SRiku VoipioEOF 1973c05c7a73SRiku Voipioif compile_prog "" "" ; then 1974c05c7a73SRiku Voipio inotify1=yes 1975c05c7a73SRiku Voipiofi 1976c05c7a73SRiku Voipio 1977ebc996f3SRiku Voipio# check if utimensat and futimens are supported 1978ebc996f3SRiku Voipioutimens=no 1979ebc996f3SRiku Voipiocat > $TMPC << EOF 1980ebc996f3SRiku Voipio#define _ATFILE_SOURCE 1981ebc996f3SRiku Voipio#include <stddef.h> 1982ebc996f3SRiku Voipio#include <fcntl.h> 1983ebc996f3SRiku Voipio 1984ebc996f3SRiku Voipioint main(void) 1985ebc996f3SRiku Voipio{ 1986ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 1987ebc996f3SRiku Voipio futimens(0, NULL); 1988ebc996f3SRiku Voipio return 0; 1989ebc996f3SRiku Voipio} 1990ebc996f3SRiku VoipioEOF 199152166aa0SJuan Quintelaif compile_prog "" "" ; then 1992ebc996f3SRiku Voipio utimens=yes 1993ebc996f3SRiku Voipiofi 1994ebc996f3SRiku Voipio 1995099d6b0fSRiku Voipio# check if pipe2 is there 1996099d6b0fSRiku Voipiopipe2=no 1997099d6b0fSRiku Voipiocat > $TMPC << EOF 1998099d6b0fSRiku Voipio#include <unistd.h> 1999099d6b0fSRiku Voipio#include <fcntl.h> 2000099d6b0fSRiku Voipio 2001099d6b0fSRiku Voipioint main(void) 2002099d6b0fSRiku Voipio{ 2003099d6b0fSRiku Voipio int pipefd[2]; 2004099d6b0fSRiku Voipio pipe2(pipefd, O_CLOEXEC); 2005099d6b0fSRiku Voipio return 0; 2006099d6b0fSRiku Voipio} 2007099d6b0fSRiku VoipioEOF 200852166aa0SJuan Quintelaif compile_prog "" "" ; then 2009099d6b0fSRiku Voipio pipe2=yes 2010099d6b0fSRiku Voipiofi 2011099d6b0fSRiku Voipio 201240ff6d7eSKevin Wolf# check if accept4 is there 201340ff6d7eSKevin Wolfaccept4=no 201440ff6d7eSKevin Wolfcat > $TMPC << EOF 201540ff6d7eSKevin Wolf#include <sys/socket.h> 201640ff6d7eSKevin Wolf#include <stddef.h> 201740ff6d7eSKevin Wolf 201840ff6d7eSKevin Wolfint main(void) 201940ff6d7eSKevin Wolf{ 202040ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 202140ff6d7eSKevin Wolf return 0; 202240ff6d7eSKevin Wolf} 202340ff6d7eSKevin WolfEOF 202440ff6d7eSKevin Wolfif compile_prog "" "" ; then 202540ff6d7eSKevin Wolf accept4=yes 202640ff6d7eSKevin Wolffi 202740ff6d7eSKevin Wolf 20283ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 20293ce34dfbSvibisreenivasansplice=no 20303ce34dfbSvibisreenivasancat > $TMPC << EOF 20313ce34dfbSvibisreenivasan#include <unistd.h> 20323ce34dfbSvibisreenivasan#include <fcntl.h> 20333ce34dfbSvibisreenivasan#include <limits.h> 20343ce34dfbSvibisreenivasan 20353ce34dfbSvibisreenivasanint main(void) 20363ce34dfbSvibisreenivasan{ 20373ce34dfbSvibisreenivasan int len, fd; 20383ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 20393ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 20403ce34dfbSvibisreenivasan return 0; 20413ce34dfbSvibisreenivasan} 20423ce34dfbSvibisreenivasanEOF 204352166aa0SJuan Quintelaif compile_prog "" "" ; then 20443ce34dfbSvibisreenivasan splice=yes 20453ce34dfbSvibisreenivasanfi 20463ce34dfbSvibisreenivasan 2047dcc38d1cSMarcelo Tosatti########################################## 2048dcc38d1cSMarcelo Tosatti# signalfd probe 2049dcc38d1cSMarcelo Tosattisignalfd="no" 2050dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 2051dcc38d1cSMarcelo Tosatti#define _GNU_SOURCE 2052dcc38d1cSMarcelo Tosatti#include <unistd.h> 2053dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 2054dcc38d1cSMarcelo Tosatti#include <signal.h> 2055dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 2056dcc38d1cSMarcelo TosattiEOF 2057dcc38d1cSMarcelo Tosatti 2058dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 2059dcc38d1cSMarcelo Tosatti signalfd=yes 2060de758970SJan Kiszkaelif test "$kvm" = "yes" -a "$io_thread" != "yes"; then 2061de758970SJan Kiszka echo 2062de758970SJan Kiszka echo "ERROR: Host kernel lacks signalfd() support," 2063de758970SJan Kiszka echo "but KVM depends on it when the IO thread is disabled." 2064de758970SJan Kiszka echo 2065de758970SJan Kiszka exit 1 2066dcc38d1cSMarcelo Tosattifi 2067dcc38d1cSMarcelo Tosatti 2068c2882b96SRiku Voipio# check if eventfd is supported 2069c2882b96SRiku Voipioeventfd=no 2070c2882b96SRiku Voipiocat > $TMPC << EOF 2071c2882b96SRiku Voipio#include <sys/eventfd.h> 2072c2882b96SRiku Voipio 2073c2882b96SRiku Voipioint main(void) 2074c2882b96SRiku Voipio{ 2075c2882b96SRiku Voipio int efd = eventfd(0, 0); 2076c2882b96SRiku Voipio return 0; 2077c2882b96SRiku Voipio} 2078c2882b96SRiku VoipioEOF 2079c2882b96SRiku Voipioif compile_prog "" "" ; then 2080c2882b96SRiku Voipio eventfd=yes 2081c2882b96SRiku Voipiofi 2082c2882b96SRiku Voipio 2083d0927938SUlrich Hecht# check for fallocate 2084d0927938SUlrich Hechtfallocate=no 2085d0927938SUlrich Hechtcat > $TMPC << EOF 2086d0927938SUlrich Hecht#include <fcntl.h> 2087d0927938SUlrich Hecht 2088d0927938SUlrich Hechtint main(void) 2089d0927938SUlrich Hecht{ 2090d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 2091d0927938SUlrich Hecht return 0; 2092d0927938SUlrich Hecht} 2093d0927938SUlrich HechtEOF 2094be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then 2095d0927938SUlrich Hecht fallocate=yes 2096d0927938SUlrich Hechtfi 2097d0927938SUlrich Hecht 2098c727f47dSPeter Maydell# check for sync_file_range 2099c727f47dSPeter Maydellsync_file_range=no 2100c727f47dSPeter Maydellcat > $TMPC << EOF 2101c727f47dSPeter Maydell#include <fcntl.h> 2102c727f47dSPeter Maydell 2103c727f47dSPeter Maydellint main(void) 2104c727f47dSPeter Maydell{ 2105c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 2106c727f47dSPeter Maydell return 0; 2107c727f47dSPeter Maydell} 2108c727f47dSPeter MaydellEOF 2109c727f47dSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2110c727f47dSPeter Maydell sync_file_range=yes 2111c727f47dSPeter Maydellfi 2112c727f47dSPeter Maydell 2113dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 2114dace20dcSPeter Maydellfiemap=no 2115dace20dcSPeter Maydellcat > $TMPC << EOF 2116dace20dcSPeter Maydell#include <sys/ioctl.h> 2117dace20dcSPeter Maydell#include <linux/fs.h> 2118dace20dcSPeter Maydell#include <linux/fiemap.h> 2119dace20dcSPeter Maydell 2120dace20dcSPeter Maydellint main(void) 2121dace20dcSPeter Maydell{ 2122dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 2123dace20dcSPeter Maydell return 0; 2124dace20dcSPeter Maydell} 2125dace20dcSPeter MaydellEOF 2126dace20dcSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2127dace20dcSPeter Maydell fiemap=yes 2128dace20dcSPeter Maydellfi 2129dace20dcSPeter Maydell 2130d0927938SUlrich Hecht# check for dup3 2131d0927938SUlrich Hechtdup3=no 2132d0927938SUlrich Hechtcat > $TMPC << EOF 2133d0927938SUlrich Hecht#include <unistd.h> 2134d0927938SUlrich Hecht 2135d0927938SUlrich Hechtint main(void) 2136d0927938SUlrich Hecht{ 2137d0927938SUlrich Hecht dup3(0, 0, 0); 2138d0927938SUlrich Hecht return 0; 2139d0927938SUlrich Hecht} 2140d0927938SUlrich HechtEOF 214178f5d726SJan Kiszkaif compile_prog "" "" ; then 2142d0927938SUlrich Hecht dup3=yes 2143d0927938SUlrich Hechtfi 2144d0927938SUlrich Hecht 2145*3b6edd16SPeter Maydell# check for epoll support 2146*3b6edd16SPeter Maydellepoll=no 2147*3b6edd16SPeter Maydellcat > $TMPC << EOF 2148*3b6edd16SPeter Maydell#include <sys/epoll.h> 2149*3b6edd16SPeter Maydell 2150*3b6edd16SPeter Maydellint main(void) 2151*3b6edd16SPeter Maydell{ 2152*3b6edd16SPeter Maydell epoll_create(0); 2153*3b6edd16SPeter Maydell return 0; 2154*3b6edd16SPeter Maydell} 2155*3b6edd16SPeter MaydellEOF 2156*3b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2157*3b6edd16SPeter Maydell epoll=yes 2158*3b6edd16SPeter Maydellfi 2159*3b6edd16SPeter Maydell 2160*3b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions 2161*3b6edd16SPeter Maydell# so we must check separately for their presence 2162*3b6edd16SPeter Maydellepoll_create1=no 2163*3b6edd16SPeter Maydellcat > $TMPC << EOF 2164*3b6edd16SPeter Maydell#include <sys/epoll.h> 2165*3b6edd16SPeter Maydell 2166*3b6edd16SPeter Maydellint main(void) 2167*3b6edd16SPeter Maydell{ 2168*3b6edd16SPeter Maydell epoll_create1(0); 2169*3b6edd16SPeter Maydell return 0; 2170*3b6edd16SPeter Maydell} 2171*3b6edd16SPeter MaydellEOF 2172*3b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2173*3b6edd16SPeter Maydell epoll_create1=yes 2174*3b6edd16SPeter Maydellfi 2175*3b6edd16SPeter Maydell 2176*3b6edd16SPeter Maydellepoll_pwait=no 2177*3b6edd16SPeter Maydellcat > $TMPC << EOF 2178*3b6edd16SPeter Maydell#include <sys/epoll.h> 2179*3b6edd16SPeter Maydell 2180*3b6edd16SPeter Maydellint main(void) 2181*3b6edd16SPeter Maydell{ 2182*3b6edd16SPeter Maydell epoll_pwait(0, 0, 0, 0, 0); 2183*3b6edd16SPeter Maydell return 0; 2184*3b6edd16SPeter Maydell} 2185*3b6edd16SPeter MaydellEOF 2186*3b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2187*3b6edd16SPeter Maydell epoll_pwait=yes 2188*3b6edd16SPeter Maydellfi 2189*3b6edd16SPeter Maydell 2190cc8ae6deSpbrook# Check if tools are available to build documentation. 2191a25dba17SJuan Quintelaif test "$docs" != "no" ; then 219201668d98SStefan Weil if has makeinfo && has pod2man; then 2193a25dba17SJuan Quintela docs=yes 219483a3ab8bSJuan Quintela else 2195a25dba17SJuan Quintela if test "$docs" = "yes" ; then 2196a25dba17SJuan Quintela feature_not_found "docs" 219783a3ab8bSJuan Quintela fi 2198a25dba17SJuan Quintela docs=no 219983a3ab8bSJuan Quintela fi 2200cc8ae6deSpbrookfi 2201cc8ae6deSpbrook 2202f514f41cSStefan Weil# Search for bswap_32 function 22036ae9a1f4SJuan Quintelabyteswap_h=no 22046ae9a1f4SJuan Quintelacat > $TMPC << EOF 22056ae9a1f4SJuan Quintela#include <byteswap.h> 22066ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 22076ae9a1f4SJuan QuintelaEOF 220852166aa0SJuan Quintelaif compile_prog "" "" ; then 22096ae9a1f4SJuan Quintela byteswap_h=yes 22106ae9a1f4SJuan Quintelafi 22116ae9a1f4SJuan Quintela 2212f514f41cSStefan Weil# Search for bswap_32 function 22136ae9a1f4SJuan Quintelabswap_h=no 22146ae9a1f4SJuan Quintelacat > $TMPC << EOF 22156ae9a1f4SJuan Quintela#include <sys/endian.h> 22166ae9a1f4SJuan Quintela#include <sys/types.h> 22176ae9a1f4SJuan Quintela#include <machine/bswap.h> 22186ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 22196ae9a1f4SJuan QuintelaEOF 222052166aa0SJuan Quintelaif compile_prog "" "" ; then 22216ae9a1f4SJuan Quintela bswap_h=yes 22226ae9a1f4SJuan Quintelafi 22236ae9a1f4SJuan Quintela 2224da93a1fdSaliguori########################################## 2225da93a1fdSaliguori# Do we need librt 2226da93a1fdSaliguoricat > $TMPC <<EOF 2227da93a1fdSaliguori#include <signal.h> 2228da93a1fdSaliguori#include <time.h> 2229da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); } 2230da93a1fdSaliguoriEOF 2231da93a1fdSaliguori 223252166aa0SJuan Quintelaif compile_prog "" "" ; then 223307ffa4bdSJuan Quintela : 223452166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then 223507ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 2236da93a1fdSaliguorifi 2237da93a1fdSaliguori 223831ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 2239179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 22406362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 22416362a53fSJuan Quintelafi 22426362a53fSJuan Quintela 2243de5071c5SBlue Swirl########################################## 2244de5071c5SBlue Swirl# check if the compiler defines offsetof 2245de5071c5SBlue Swirl 2246de5071c5SBlue Swirlneed_offsetof=yes 2247de5071c5SBlue Swirlcat > $TMPC << EOF 2248de5071c5SBlue Swirl#include <stddef.h> 2249de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); } 2250de5071c5SBlue SwirlEOF 2251de5071c5SBlue Swirlif compile_prog "" "" ; then 2252de5071c5SBlue Swirl need_offsetof=no 2253de5071c5SBlue Swirlfi 2254de5071c5SBlue Swirl 22555f6b9e8fSBlue Swirl########################################## 2256747bbdf7SBlue Swirl# check if the compiler understands attribute warn_unused_result 2257747bbdf7SBlue Swirl# 2258747bbdf7SBlue Swirl# This could be smarter, but gcc -Werror does not error out even when warning 2259747bbdf7SBlue Swirl# about attribute warn_unused_result 2260747bbdf7SBlue Swirl 2261747bbdf7SBlue Swirlgcc_attribute_warn_unused_result=no 2262747bbdf7SBlue Swirlcat > $TMPC << EOF 2263747bbdf7SBlue Swirl#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4) 2264747bbdf7SBlue Swirl#error gcc 3.3 or older 2265747bbdf7SBlue Swirl#endif 2266747bbdf7SBlue Swirlint main(void) { return 0;} 2267747bbdf7SBlue SwirlEOF 2268747bbdf7SBlue Swirlif compile_prog "" ""; then 2269747bbdf7SBlue Swirl gcc_attribute_warn_unused_result=yes 2270747bbdf7SBlue Swirlfi 2271747bbdf7SBlue Swirl 2272cd4ec0b4SGerd Hoffmann# spice probe 2273cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 2274cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 2275cd4ec0b4SGerd Hoffmann#include <spice.h> 2276cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 2277cd4ec0b4SGerd HoffmannEOF 2278710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 2279710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 2280710fc4f5SJiri Denemark if $pkg_config --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \ 2281cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 2282cd4ec0b4SGerd Hoffmann spice="yes" 2283cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 2284cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 2285cd4ec0b4SGerd Hoffmann else 2286cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 2287cd4ec0b4SGerd Hoffmann feature_not_found "spice" 2288cd4ec0b4SGerd Hoffmann fi 2289cd4ec0b4SGerd Hoffmann spice="no" 2290cd4ec0b4SGerd Hoffmann fi 2291cd4ec0b4SGerd Hoffmannfi 2292cd4ec0b4SGerd Hoffmann 2293cd4ec0b4SGerd Hoffmann########################################## 2294cd4ec0b4SGerd Hoffmann 2295747bbdf7SBlue Swirl########################################## 22965f6b9e8fSBlue Swirl# check if we have fdatasync 22975f6b9e8fSBlue Swirl 22985f6b9e8fSBlue Swirlfdatasync=no 22995f6b9e8fSBlue Swirlcat > $TMPC << EOF 23005f6b9e8fSBlue Swirl#include <unistd.h> 23015f6b9e8fSBlue Swirlint main(void) { return fdatasync(0); } 23025f6b9e8fSBlue SwirlEOF 23035f6b9e8fSBlue Swirlif compile_prog "" "" ; then 23045f6b9e8fSBlue Swirl fdatasync=yes 23055f6b9e8fSBlue Swirlfi 23065f6b9e8fSBlue Swirl 230794a420b1SStefan Hajnoczi########################################## 2308e78815a5SAndreas Färber# check if we have madvise 2309e78815a5SAndreas Färber 2310e78815a5SAndreas Färbermadvise=no 2311e78815a5SAndreas Färbercat > $TMPC << EOF 2312e78815a5SAndreas Färber#include <sys/types.h> 2313e78815a5SAndreas Färber#include <sys/mman.h> 2314832ce9c2SScott Wood#include <stddef.h> 2315e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 2316e78815a5SAndreas FärberEOF 2317e78815a5SAndreas Färberif compile_prog "" "" ; then 2318e78815a5SAndreas Färber madvise=yes 2319e78815a5SAndreas Färberfi 2320e78815a5SAndreas Färber 2321e78815a5SAndreas Färber########################################## 2322e78815a5SAndreas Färber# check if we have posix_madvise 2323e78815a5SAndreas Färber 2324e78815a5SAndreas Färberposix_madvise=no 2325e78815a5SAndreas Färbercat > $TMPC << EOF 2326e78815a5SAndreas Färber#include <sys/mman.h> 2327832ce9c2SScott Wood#include <stddef.h> 2328e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 2329e78815a5SAndreas FärberEOF 2330e78815a5SAndreas Färberif compile_prog "" "" ; then 2331e78815a5SAndreas Färber posix_madvise=yes 2332e78815a5SAndreas Färberfi 2333e78815a5SAndreas Färber 2334e78815a5SAndreas Färber########################################## 233594a420b1SStefan Hajnoczi# check if trace backend exists 233694a420b1SStefan Hajnoczi 23374c3b5a48SBlue Swirlsh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null 233894a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 233994a420b1SStefan Hajnoczi echo 234094a420b1SStefan Hajnoczi echo "Error: invalid trace backend" 234194a420b1SStefan Hajnoczi echo "Please choose a supported trace backend." 234294a420b1SStefan Hajnoczi echo 234394a420b1SStefan Hajnoczi exit 1 234494a420b1SStefan Hajnoczifi 234594a420b1SStefan Hajnoczi 23467e24e92aSStefan Hajnoczi########################################## 23477e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 23487e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then 23497e24e92aSStefan Hajnoczi cat > $TMPC << EOF 23507e24e92aSStefan Hajnoczi#include <ust/tracepoint.h> 23517e24e92aSStefan Hajnoczi#include <ust/marker.h> 23527e24e92aSStefan Hajnocziint main(void) { return 0; } 23537e24e92aSStefan HajnocziEOF 23547e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 23557e24e92aSStefan Hajnoczi LIBS="-lust $LIBS" 23567e24e92aSStefan Hajnoczi else 23577e24e92aSStefan Hajnoczi echo 23587e24e92aSStefan Hajnoczi echo "Error: Trace backend 'ust' missing libust header files" 23597e24e92aSStefan Hajnoczi echo 23607e24e92aSStefan Hajnoczi exit 1 23617e24e92aSStefan Hajnoczi fi 23627e24e92aSStefan Hajnoczifi 2363b3d08c02SDaniel P. Berrange 2364b3d08c02SDaniel P. Berrange########################################## 2365b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 2366b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then 2367b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 2368b3d08c02SDaniel P. Berrange echo 2369b3d08c02SDaniel P. Berrange echo "Error: dtrace command is not found in PATH $PATH" 2370b3d08c02SDaniel P. Berrange echo 2371b3d08c02SDaniel P. Berrange exit 1 2372b3d08c02SDaniel P. Berrange fi 2373c276b17dSDaniel P. Berrange trace_backend_stap="no" 2374c276b17dSDaniel P. Berrange if has 'stap' ; then 2375c276b17dSDaniel P. Berrange trace_backend_stap="yes" 2376c276b17dSDaniel P. Berrange fi 2377b3d08c02SDaniel P. Berrangefi 2378b3d08c02SDaniel P. Berrange 23797e24e92aSStefan Hajnoczi########################################## 2380e86ecd4bSJuan Quintela# End of CC checks 2381e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 2382e86ecd4bSJuan Quintela 2383e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then 23841156c669SJuan Quintela CFLAGS="-O2 $CFLAGS" 2385e86ecd4bSJuan Quintelafi 2386a316e378SJuan Quintela 2387e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror 2388e86ecd4bSJuan Quintela# by default. Only enable by default for git builds 2389e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION` 239020ff6c80SAnthony Liguori 239120ff6c80SAnthony Liguoriif test -z "$werror" ; then 2392e86ecd4bSJuan Quintela if test "$z_version" = "50" -a \ 2393e86ecd4bSJuan Quintela "$linux" = "yes" ; then 2394e86ecd4bSJuan Quintela werror="yes" 2395e86ecd4bSJuan Quintela else 2396e86ecd4bSJuan Quintela werror="no" 2397e86ecd4bSJuan Quintela fi 2398e86ecd4bSJuan Quintelafi 2399e86ecd4bSJuan Quintela 240020ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 240120ff6c80SAnthony Liguori# enable/disable 240220ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 240320ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 240420ff6c80SAnthony Liguori zero_malloc="no" 240520ff6c80SAnthony Liguori else 240620ff6c80SAnthony Liguori zero_malloc="yes" 240720ff6c80SAnthony Liguori fi 240820ff6c80SAnthony Liguorifi 240920ff6c80SAnthony Liguori 2410e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then 2411a558ee17SJuan Quintela QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 2412e86ecd4bSJuan Quintelafi 2413e86ecd4bSJuan Quintela 2414e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 2415e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 24161156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 2417e86ecd4bSJuan Quintela fi 2418e86ecd4bSJuan Quintelafi 2419e86ecd4bSJuan Quintela 2420952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 2421952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 2422952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 2423952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 2424952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 2425952afb71SBlue Swirl fi 2426952afb71SBlue Swirl done 2427952afb71SBlue Swirlfi 2428952afb71SBlue Swirl 2429190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix 24305a67135aSbellard 2431ca35f780SPaolo Bonzinitools= 2432ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then 2433ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 2434ca35f780SPaolo Bonzini if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 2435ca35f780SPaolo Bonzini tools="qemu-nbd\$(EXESUF) $tools" 2436ca35f780SPaolo Bonzini if [ "$check_utests" = "yes" ]; then 2437ca35f780SPaolo Bonzini tools="check-qint check-qstring check-qdict check-qlist $tools" 2438ca35f780SPaolo Bonzini tools="check-qfloat check-qjson $tools" 2439ca35f780SPaolo Bonzini fi 2440ca35f780SPaolo Bonzini fi 2441ca35f780SPaolo Bonzinifi 2442ca35f780SPaolo Bonzini 2443ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 2444ca35f780SPaolo Bonziniroms= 2445ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 2446ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 2447ca35f780SPaolo Bonzini "$softmmu" = yes ; then 2448ca35f780SPaolo Bonzini roms="optionrom" 2449ca35f780SPaolo Bonzinifi 2450ca35f780SPaolo Bonzini 2451ca35f780SPaolo Bonzini 24527d13299dSbellardecho "Install prefix $prefix" 2453f2b9e1e3SPaolo Bonziniecho "BIOS directory `eval echo $datadir`" 2454f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 24551c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 245611d9f695Sbellardif test "$mingw32" = "no" ; then 2457f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 245843ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 245911d9f695Sbellardfi 24605a67135aSbellardecho "Source path $source_path" 24617d13299dSbellardecho "C compiler $cc" 246283469015Sbellardecho "Host C compiler $host_cc" 24630c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 2464a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 24650c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 24667d13299dSbellardecho "make $make" 24676a882643Spbrookecho "install $install" 2468a98fd896Sbellardecho "host CPU $cpu" 2469de83cd02Sbellardecho "host big endian $bigendian" 247097a847bcSbellardecho "target list $target_list" 2471ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 2472b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon" 24737d13299dSbellardecho "gprof enabled $gprof" 247403b4fe7dSaliguoriecho "sparse enabled $sparse" 24751625af87Saliguoriecho "strip binaries $strip_opt" 247605c2a3e7Sbellardecho "profiler $profiler" 247743ce4dfeSbellardecho "static build $static" 247885aa5189Sbellardecho "-Werror enabled $werror" 24795b0753e0Sbellardif test "$darwin" = "yes" ; then 24805b0753e0Sbellard echo "Cocoa support $cocoa" 24815b0753e0Sbellardfi 248297a847bcSbellardecho "SDL support $sdl" 24834d3b6f6eSbalrogecho "curses support $curses" 2484769ce76dSAlexander Grafecho "curl support $curl" 24855495ed11SLuiz Capitulinoecho "check support $check_utests" 248667b915a5Sbellardecho "mingw32 support $mingw32" 24870c58ac1cSmalcecho "Audio drivers $audio_drv_list" 24880c58ac1cSmalcecho "Extra audio cards $audio_card_list" 2489eb852011SMarkus Armbrusterecho "Block whitelist $block_drv_whitelist" 24908ff9cbf7Smalcecho "Mixer emulation $mixemu" 24918d5d2d4cSthsecho "VNC TLS support $vnc_tls" 24922f9606b3Saliguoriecho "VNC SASL support $vnc_sasl" 24932f6f5c7aSCorentin Charyecho "VNC JPEG support $vnc_jpeg" 2494efe556adSCorentin Charyecho "VNC PNG support $vnc_png" 2495bd023f95SCorentin Charyecho "VNC thread $vnc_thread" 24963142255cSblueswir1if test -n "$sparc_cpu"; then 24973142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 24983142255cSblueswir1fi 2499e37630caSaliguoriecho "xen support $xen" 25002e4d9fb1Saurel32echo "brlapi support $brlapi" 2501a20a6f46SJuan Quintelaecho "bluez support $bluez" 2502a25dba17SJuan Quintelaecho "Documentation $docs" 2503c5937220Spbrook[ ! -z "$uname_release" ] && \ 2504c5937220Spbrookecho "uname -r $uname_release" 2505bd0c5661Spbrookecho "NPTL support $nptl" 2506379f6698SPaul Brookecho "GUEST_BASE $guest_base" 250734005a00SKirill A. Shutemovecho "PIE user targets $user_pie" 25088a16d273Sthsecho "vde support $vde" 2509e5d355d1Saliguoriecho "IO thread $io_thread" 25105c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 2511758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 251277755340Sthsecho "Install blobs $blobs" 2513b31a0277SJuan Quintelaecho "KVM support $kvm" 2514f652e6afSaurel32echo "fdt support $fdt" 2515ceb42de8Saliguoriecho "preadv support $preadv" 25165f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 2517e78815a5SAndreas Färberecho "madvise $madvise" 2518e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 2519ee682d27SStefan Weilecho "uuid support $uuid" 2520d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 252194a420b1SStefan Hajnocziecho "Trace backend $trace_backend" 25229410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 2523cd4ec0b4SGerd Hoffmannecho "spice support $spice" 2524f27aaf4bSChristian Brunnerecho "rbd support $rbd" 2525dce512deSChristoph Hellwigecho "xfsctl support $xfs" 252667b915a5Sbellard 252797a847bcSbellardif test $sdl_too_old = "yes"; then 252824b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 2529e8cd23deSbellardfi 253097a847bcSbellard 253198ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 25324bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld" 253397a847bcSbellard 253498ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 253598ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 253698ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 253798ec69acSJuan Quintelaecho >> $config_host_mak 253898ec69acSJuan Quintela 2539e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 254099d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 254199d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 254299d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 254399d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak 254499d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 254599d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak 25461dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak 2547804edf29SJuan Quintela 25482408a527Saurel32case "$cpu" in 254924e804ecSAlexander Graf i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 2550e0da9dd3SJuan Quintela ARCH=$cpu 25512408a527Saurel32 ;; 2552a302c32dSLaurent Desnogues armv4b|armv4l) 255316dbd14fSJuan Quintela ARCH=arm 25542408a527Saurel32 ;; 25552408a527Saurel32esac 255698ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 2557f8393946Saurel32if test "$debug_tcg" = "yes" ; then 25582358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 2559f8393946Saurel32fi 2560b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then 2561b4475aa2SLuiz Capitulino echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak 2562b4475aa2SLuiz Capitulinofi 2563f3d08ee6SPaul Brookif test "$debug" = "yes" ; then 25642358a494SJuan Quintela echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak 2565f3d08ee6SPaul Brookfi 25661625af87Saliguoriif test "$strip_opt" = "yes" ; then 256752ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 25681625af87Saliguorifi 25697d13299dSbellardif test "$bigendian" = "yes" ; then 2570e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 257197a847bcSbellardfi 25722358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak 257367b915a5Sbellardif test "$mingw32" = "yes" ; then 257498ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 25759fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 25769fe6de94SBlue Swirl version_major=${rc_version%%.*} 25779fe6de94SBlue Swirl rc_version=${rc_version#*.} 25789fe6de94SBlue Swirl version_minor=${rc_version%%.*} 25799fe6de94SBlue Swirl rc_version=${rc_version#*.} 25809fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 25819fe6de94SBlue Swirl version_micro=0 25829fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 25839fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 2584210fa556Spbrookelse 258535f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 2586210fa556Spbrookfi 2587128ab2ffSblueswir1 2588dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 2589dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 2590dffcb71cSMark McLoughlinfi 2591dffcb71cSMark McLoughlin 259283fb7adfSbellardif test "$darwin" = "yes" ; then 259398ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 259483fb7adfSbellardfi 2595b29fe3edSmalc 2596b29fe3edSmalcif test "$aix" = "yes" ; then 259798ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 2598b29fe3edSmalcfi 2599b29fe3edSmalc 2600ec530c81Sbellardif test "$solaris" = "yes" ; then 260198ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 26022358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 26030475a5caSths if test "$needs_libsunmath" = "yes" ; then 260475b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 26050475a5caSths fi 2606ec530c81Sbellardfi 2607179cf400SAndreas Färberif test "$haiku" = "yes" ; then 2608179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 2609179cf400SAndreas Färberfi 261097a847bcSbellardif test "$static" = "yes" ; then 261198ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 261297a847bcSbellardfi 261305c2a3e7Sbellardif test $profiler = "yes" ; then 26142358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 261505c2a3e7Sbellardfi 2616c20709aaSbellardif test "$slirp" = "yes" ; then 261798ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 2618f9728943SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES" 2619c20709aaSbellardfi 26208a16d273Sthsif test "$vde" = "yes" ; then 262198ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 26228a16d273Sthsfi 26230c58ac1cSmalcfor card in $audio_card_list; do 2624f6e5889eSpbrook def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` 262598ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 26260c58ac1cSmalcdone 26272358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 26280c58ac1cSmalcfor drv in $audio_drv_list; do 2629f6e5889eSpbrook def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` 263098ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 2631923e4521Smalc if test "$drv" = "fmod"; then 26327aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 2633fb065187Sbellard fi 26340c58ac1cSmalcdone 263567f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 263667f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 263767f86e8eSJuan Quintelafi 2638d5631638Smalcif test "$audio_win_int" = "yes" ; then 2639d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 2640d5631638Smalcfi 2641eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak 26428ff9cbf7Smalcif test "$mixemu" = "yes" ; then 264398ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 26448ff9cbf7Smalcfi 26458d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 264698ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 2647525061bfSJuan Quintela echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak 26488d5d2d4cSthsfi 26492f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 265098ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 265160ddf533SJuan Quintela echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak 26522f9606b3Saliguorifi 265396763cf9SCorentin Charyif test "$vnc_jpeg" != "no" ; then 26542f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 26552f6f5c7aSCorentin Chary echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak 26562f6f5c7aSCorentin Charyfi 265796763cf9SCorentin Charyif test "$vnc_png" != "no" ; then 2658efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 2659efe556adSCorentin Chary echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak 2660efe556adSCorentin Charyfi 266196763cf9SCorentin Charyif test "$vnc_thread" != "no" ; then 2662bd023f95SCorentin Chary echo "CONFIG_VNC_THREAD=y" >> $config_host_mak 2663bd023f95SCorentin Chary echo "CONFIG_THREAD=y" >> $config_host_mak 2664bd023f95SCorentin Charyfi 266576655d6dSaliguoriif test "$fnmatch" = "yes" ; then 26662358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 266776655d6dSaliguorifi 2668ee682d27SStefan Weilif test "$uuid" = "yes" ; then 2669ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 2670ee682d27SStefan Weilfi 2671dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 2672dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 2673dce512deSChristoph Hellwigfi 2674b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 267598ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 26762358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 267798ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 267898ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 2679a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 268098ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 2681cc8ae6deSpbrookfi 26821ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 268398ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 26848ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 268549ecc3faSbellardfi 268649ecc3faSbellardif test "$cocoa" = "yes" ; then 268798ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 268849ecc3faSbellardfi 26894d3b6f6eSbalrogif test "$curses" = "yes" ; then 269098ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 2691ab4e5602SJan Kiszkafi 26923b3f24adSaurel32if test "$atfile" = "yes" ; then 26932358a494SJuan Quintela echo "CONFIG_ATFILE=y" >> $config_host_mak 26943b3f24adSaurel32fi 2695ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 26962358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 2697ebc996f3SRiku Voipiofi 2698099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 26992358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 2700099d6b0fSRiku Voipiofi 270140ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 270240ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 270340ff6d7eSKevin Wolffi 27043ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 27052358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 27063ce34dfbSvibisreenivasanfi 2707c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 2708c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 2709c2882b96SRiku Voipiofi 2710d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 2711d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 2712d0927938SUlrich Hechtfi 2713c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 2714c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 2715c727f47dSPeter Maydellfi 2716dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 2717dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 2718dace20dcSPeter Maydellfi 2719d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 2720d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 2721d0927938SUlrich Hechtfi 2722*3b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 2723*3b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 2724*3b6edd16SPeter Maydellfi 2725*3b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 2726*3b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 2727*3b6edd16SPeter Maydellfi 2728*3b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then 2729*3b6edd16SPeter Maydell echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak 2730*3b6edd16SPeter Maydellfi 27313b3f24adSaurel32if test "$inotify" = "yes" ; then 27322358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 27333b3f24adSaurel32fi 2734c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 2735c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 2736c05c7a73SRiku Voipiofi 27376ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 27386ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 27396ae9a1f4SJuan Quintelafi 27406ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 27416ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 27426ae9a1f4SJuan Quintelafi 2743769ce76dSAlexander Grafif test "$curl" = "yes" ; then 274498ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 2745b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 2746769ce76dSAlexander Graffi 27472e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 274898ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 27492e4d9fb1Saurel32fi 2750fb599c9aSbalrogif test "$bluez" = "yes" ; then 275198ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 2752ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 2753fb599c9aSbalrogfi 2754e37630caSaliguoriif test "$xen" = "yes" ; then 27555647eb74SJuan Quintela echo "CONFIG_XEN=y" >> $config_host_mak 2756e37630caSaliguorifi 2757e5d355d1Saliguoriif test "$io_thread" = "yes" ; then 275898ec69acSJuan Quintela echo "CONFIG_IOTHREAD=y" >> $config_host_mak 2759bd023f95SCorentin Chary echo "CONFIG_THREAD=y" >> $config_host_mak 2760e5d355d1Saliguorifi 27615c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 27625c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 27635c6c3a6cSChristoph Hellwigfi 2764758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 2765758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 2766758e8e38SVenkateswararao Jujjuri (JV)fi 2767758e8e38SVenkateswararao Jujjuri (JV)if test "$linux" = "yes" ; then 2768758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 2769758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 2770758e8e38SVenkateswararao Jujjuri (JV) fi 2771758e8e38SVenkateswararao Jujjuri (JV)fi 277277755340Sthsif test "$blobs" = "yes" ; then 277398ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 277477755340Sthsfi 2775bf9298b9Saliguoriif test "$iovec" = "yes" ; then 27762358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 2777bf9298b9Saliguorifi 2778ceb42de8Saliguoriif test "$preadv" = "yes" ; then 27792358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 2780ceb42de8Saliguorifi 2781f652e6afSaurel32if test "$fdt" = "yes" ; then 27823f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 2783f652e6afSaurel32fi 2784dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 2785dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 2786dcc38d1cSMarcelo Tosattifi 2787de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then 2788de5071c5SBlue Swirl echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak 2789de5071c5SBlue Swirlfi 2790747bbdf7SBlue Swirlif test "$gcc_attribute_warn_unused_result" = "yes" ; then 2791747bbdf7SBlue Swirl echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak 2792747bbdf7SBlue Swirlfi 27935f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 27945f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 27955f6b9e8fSBlue Swirlfi 2796e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 2797e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 2798e78815a5SAndreas Färberfi 2799e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 2800e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 2801e78815a5SAndreas Färberfi 280297a847bcSbellard 2803cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 2804cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 2805cd4ec0b4SGerd Hoffmannfi 2806cd4ec0b4SGerd Hoffmann 280783fb7adfSbellard# XXX: suppress that 28087d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 28092358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 28107d3505c5Sbellardfi 28117d3505c5Sbellard 28122358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 2813c5937220Spbrook 281420ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 281520ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 281620ff6c80SAnthony Liguorifi 2817f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 2818f27aaf4bSChristian Brunner echo "CONFIG_RBD=y" >> $config_host_mak 2819f27aaf4bSChristian Brunnerfi 282020ff6c80SAnthony Liguori 282168063649Sblueswir1# USB host support 282268063649Sblueswir1case "$usb" in 282368063649Sblueswir1linux) 282498ec69acSJuan Quintela echo "HOST_USB=linux" >> $config_host_mak 282568063649Sblueswir1;; 282668063649Sblueswir1bsd) 282798ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 282868063649Sblueswir1;; 282968063649Sblueswir1*) 283098ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 283168063649Sblueswir1;; 283268063649Sblueswir1esac 283368063649Sblueswir1 283494a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak 283522890ab5SPrerna Saxenaif test "$trace_backend" = "simple"; then 283622890ab5SPrerna Saxena echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak 283722890ab5SPrerna Saxenafi 28389410b56cSPrerna Saxena# Set the appropriate trace file. 28399410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then 28409410b56cSPrerna Saxena trace_file="\"$trace_file-%u\"" 28419410b56cSPrerna Saxenafi 2842c276b17dSDaniel P. Berrangeif test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then 2843c276b17dSDaniel P. Berrange echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak 2844c276b17dSDaniel P. Berrangefi 28459410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 28469410b56cSPrerna Saxena 284798ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 284898ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 2849804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 2850804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 2851804edf29SJuan Quintelaecho "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak 2852804edf29SJuan Quintelaecho "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak 2853804edf29SJuan Quintelaecho "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak 2854804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 28552b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 2856804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 2857804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 2858804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 2859804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 28609fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 2861e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 2862a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 2863f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 2864e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 2865e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 2866e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 2867e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 2868e39f0062SPaolo Bonzinifi 2869c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak 2870e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 2871a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak 2872a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak 287373da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 28743e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 2875804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 2876804edf29SJuan Quintela 28774bf6b55bSJuan Quintela# generate list of library paths for linker script 28784bf6b55bSJuan Quintela 28794bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} 28804bf6b55bSJuan Quintela 28814bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then 28824bf6b55bSJuan Quintela if cmp -s $config_host_ld ${config_host_ld}~ ; then 28834bf6b55bSJuan Quintela mv ${config_host_ld}~ $config_host_ld 28844bf6b55bSJuan Quintela else 28854bf6b55bSJuan Quintela rm ${config_host_ld}~ 28864bf6b55bSJuan Quintela fi 28874bf6b55bSJuan Quintelafi 28884bf6b55bSJuan Quintela 28894d904533SBlue Swirlfor d in libdis libdis-user; do 28904d904533SBlue Swirl mkdir -p $d 289111568d6dSPaolo Bonzini symlink $source_path/Makefile.dis $d/Makefile 28924d904533SBlue Swirl echo > $d/config.mak 28934d904533SBlue Swirldone 2894d44cff22SRichard Hendersonif test "$static" = "no" -a "$user_pie" = "yes" ; then 2895d44cff22SRichard Henderson echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak 2896d44cff22SRichard Hendersonfi 28974d904533SBlue Swirl 289897a847bcSbellardfor target in $target_list; do 289997a847bcSbellardtarget_dir="$target" 290025be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 2901600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1` 290297a847bcSbellardtarget_bigendian="no" 29031f3d3c8fSJuan Quintela 2904ea2d6a39SJuan Quintelacase "$target_arch2" in 290524e804ecSAlexander Graf armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus) 2906ea2d6a39SJuan Quintela target_bigendian=yes 2907ea2d6a39SJuan Quintela ;; 2908ea2d6a39SJuan Quintelaesac 290997a847bcSbellardtarget_softmmu="no" 2910997344f3Sbellardtarget_user_only="no" 2911831b7825Sthstarget_linux_user="no" 2912831b7825Sthstarget_darwin_user="no" 291384778508Sblueswir1target_bsd_user="no" 29149e407a85Spbrookcase "$target" in 2915600309b6SBlue Swirl ${target_arch2}-softmmu) 29169e407a85Spbrook target_softmmu="yes" 29179e407a85Spbrook ;; 2918600309b6SBlue Swirl ${target_arch2}-linux-user) 29199c7a4202SBlue Swirl if test "$linux" != "yes" ; then 29209c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Linux host" 29219c7a4202SBlue Swirl exit 1 29229c7a4202SBlue Swirl fi 29239e407a85Spbrook target_user_only="yes" 29249e407a85Spbrook target_linux_user="yes" 29259e407a85Spbrook ;; 2926600309b6SBlue Swirl ${target_arch2}-darwin-user) 29279c7a4202SBlue Swirl if test "$darwin" != "yes" ; then 29289c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Darwin host" 29299c7a4202SBlue Swirl exit 1 29309c7a4202SBlue Swirl fi 29319e407a85Spbrook target_user_only="yes" 2932831b7825Sths target_darwin_user="yes" 29339e407a85Spbrook ;; 2934600309b6SBlue Swirl ${target_arch2}-bsd-user) 29359cf55765SBlue Swirl if test "$bsd" != "yes" ; then 29369c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a BSD host" 29379c7a4202SBlue Swirl exit 1 29389c7a4202SBlue Swirl fi 293984778508Sblueswir1 target_user_only="yes" 294084778508Sblueswir1 target_bsd_user="yes" 294184778508Sblueswir1 ;; 29429e407a85Spbrook *) 29439e407a85Spbrook echo "ERROR: Target '$target' not recognised" 29449e407a85Spbrook exit 1 29459e407a85Spbrook ;; 29469e407a85Spbrookesac 2947831b7825Sths 294897a847bcSbellardmkdir -p $target_dir 2949158142c2Sbellardmkdir -p $target_dir/fpu 295057fec1feSbellardmkdir -p $target_dir/tcg 295159f2a787SGerd Hoffmannmkdir -p $target_dir/ide 295284778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then 295369de927cSbellard mkdir -p $target_dir/nwfpe 295469de927cSbellardfi 295511568d6dSPaolo Bonzinisymlink $source_path/Makefile.target $target_dir/Makefile 2956ec530c81Sbellard 295797a847bcSbellard 295825be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 295997a847bcSbellard 2960e5fe0c52Spbrookbflt="no" 2961bd0c5661Spbrooktarget_nptl="no" 2962600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` 29637ee2822cSPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 296456aebc89Spbrookgdb_xml_files="" 29657ba1e619Saliguori 2966938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2" 29676acff7daSJuan QuintelaTARGET_BASE_ARCH="" 2968e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 2969e73aae67SJuan Quintela 2970600309b6SBlue Swirlcase "$target_arch2" in 29712408a527Saurel32 i386) 29721ad2134fSPaul Brook target_phys_bits=32 29732408a527Saurel32 ;; 29742408a527Saurel32 x86_64) 29756acff7daSJuan Quintela TARGET_BASE_ARCH=i386 29761ad2134fSPaul Brook target_phys_bits=64 29772408a527Saurel32 ;; 29782408a527Saurel32 alpha) 29791ad2134fSPaul Brook target_phys_bits=64 2980a4b388ffSRichard Henderson target_nptl="yes" 29812408a527Saurel32 ;; 29822408a527Saurel32 arm|armeb) 2983b498c8a0SJuan Quintela TARGET_ARCH=arm 2984e5fe0c52Spbrook bflt="yes" 2985bd0c5661Spbrook target_nptl="yes" 298656aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 29871ad2134fSPaul Brook target_phys_bits=32 29882408a527Saurel32 ;; 29892408a527Saurel32 cris) 2990253bd7f8Sedgar_igl target_nptl="yes" 29911ad2134fSPaul Brook target_phys_bits=32 29922408a527Saurel32 ;; 29932408a527Saurel32 m68k) 29940938cda5Saurel32 bflt="yes" 299556aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 29961ad2134fSPaul Brook target_phys_bits=32 29972408a527Saurel32 ;; 299872b675caSEdgar E. Iglesias microblaze) 299972b675caSEdgar E. Iglesias bflt="yes" 300072b675caSEdgar E. Iglesias target_nptl="yes" 300172b675caSEdgar E. Iglesias target_phys_bits=32 300272b675caSEdgar E. Iglesias ;; 30032408a527Saurel32 mips|mipsel) 3004b498c8a0SJuan Quintela TARGET_ARCH=mips 300525be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 3006f04dc72fSPaul Brook target_nptl="yes" 30071ad2134fSPaul Brook target_phys_bits=64 30082408a527Saurel32 ;; 30092408a527Saurel32 mipsn32|mipsn32el) 3010b498c8a0SJuan Quintela TARGET_ARCH=mipsn32 30116acff7daSJuan Quintela TARGET_BASE_ARCH=mips 301225be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 30131ad2134fSPaul Brook target_phys_bits=64 30142408a527Saurel32 ;; 30152408a527Saurel32 mips64|mips64el) 3016b498c8a0SJuan Quintela TARGET_ARCH=mips64 30176acff7daSJuan Quintela TARGET_BASE_ARCH=mips 301825be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 30191ad2134fSPaul Brook target_phys_bits=64 30202408a527Saurel32 ;; 30212408a527Saurel32 ppc) 3022c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 30231ad2134fSPaul Brook target_phys_bits=32 3024d6630708SNathan Froyd target_nptl="yes" 30252408a527Saurel32 ;; 30262408a527Saurel32 ppcemb) 30276acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3028e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3029c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 30301ad2134fSPaul Brook target_phys_bits=64 3031d6630708SNathan Froyd target_nptl="yes" 30322408a527Saurel32 ;; 30332408a527Saurel32 ppc64) 30346acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3035e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3036c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 30371ad2134fSPaul Brook target_phys_bits=64 30382408a527Saurel32 ;; 30392408a527Saurel32 ppc64abi32) 3040b498c8a0SJuan Quintela TARGET_ARCH=ppc64 30416acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3042e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 304325be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 3044c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 30451ad2134fSPaul Brook target_phys_bits=64 30462408a527Saurel32 ;; 30472408a527Saurel32 sh4|sh4eb) 3048b498c8a0SJuan Quintela TARGET_ARCH=sh4 30494dbed897Spbrook bflt="yes" 30500b6d3ae0Saurel32 target_nptl="yes" 30511ad2134fSPaul Brook target_phys_bits=32 30522408a527Saurel32 ;; 30532408a527Saurel32 sparc) 30541ad2134fSPaul Brook target_phys_bits=64 30552408a527Saurel32 ;; 30562408a527Saurel32 sparc64) 30576acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 30581ad2134fSPaul Brook target_phys_bits=64 30592408a527Saurel32 ;; 30602408a527Saurel32 sparc32plus) 3061b498c8a0SJuan Quintela TARGET_ARCH=sparc64 30626acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 3063e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 306425be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 30651ad2134fSPaul Brook target_phys_bits=64 30662408a527Saurel32 ;; 306724e804ecSAlexander Graf s390x) 306824e804ecSAlexander Graf target_phys_bits=64 306924e804ecSAlexander Graf ;; 30702408a527Saurel32 *) 3071de83cd02Sbellard echo "Unsupported target CPU" 3072de83cd02Sbellard exit 1 30732408a527Saurel32 ;; 30742408a527Saurel32esac 307525be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak 3076053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`" 307725be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 307825be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak 307942bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 30806acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then 30816acff7daSJuan Quintela TARGET_BASE_ARCH=$TARGET_ARCH 30826acff7daSJuan Quintelafi 308325be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 3084e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 3085e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 3086e6e91b9cSJuan Quintelafi 308725be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 30881b0c87fcSJuan Quintelacase "$target_arch2" in 30891b0c87fcSJuan Quintela i386|x86_64) 30901b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 309125be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 30921b0c87fcSJuan Quintela fi 30931b0c87fcSJuan Quintelaesac 3094c59249f9SJuan Quintelacase "$target_arch2" in 30950e60a699SAlexander Graf i386|x86_64|ppcemb|ppc|ppc64|s390x) 3096c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 3097c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 3098c59249f9SJuan Quintela \( "$target_arch2" = "$cpu" -o \ 3099c59249f9SJuan Quintela \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 31005f114bc6SAlexander Graf \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ 3101c59249f9SJuan Quintela \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ 3102c59249f9SJuan Quintela \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then 310325be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 310425be210fSJuan Quintela echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak 3105dae5079aSJan Kiszka if test "$kvm_para" = "yes"; then 3106dae5079aSJan Kiszka echo "CONFIG_KVM_PARA=y" >> $config_target_mak 3107dae5079aSJan Kiszka fi 3108d5970055SMichael S. Tsirkin if test $vhost_net = "yes" ; then 3109d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 3110d5970055SMichael S. Tsirkin fi 3111c59249f9SJuan Quintela fi 3112c59249f9SJuan Quintelaesac 3113de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 311425be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 311597a847bcSbellardfi 311697a847bcSbellardif test "$target_softmmu" = "yes" ; then 3117b1aa27c4SPaul Brook echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak 311825be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 311925be210fSJuan Quintela echo "LIBS+=$libs_softmmu" >> $config_target_mak 31200e8c9214SAndreas Färber echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak 31215791f45bSKirill A. Shutemov echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak 3122de83cd02Sbellardfi 3123997344f3Sbellardif test "$target_user_only" = "yes" ; then 312425be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 3125997344f3Sbellardfi 3126831b7825Sthsif test "$target_linux_user" = "yes" ; then 312725be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 3128831b7825Sthsfi 3129831b7825Sthsif test "$target_darwin_user" = "yes" ; then 313025be210fSJuan Quintela echo "CONFIG_DARWIN_USER=y" >> $config_target_mak 3131831b7825Sthsfi 313256aebc89Spbrooklist="" 313356aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 313456aebc89Spbrook for x in $gdb_xml_files; do 313556aebc89Spbrook list="$list $source_path/gdb-xml/$x" 313656aebc89Spbrook done 313725be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 31383d0f1517SJuan Quintelafi 3139de83cd02Sbellard 3140f57975fbSJuan Quintelacase "$target_arch2" in 3141eb8f7776SAurelien Jarno i386|x86_64) 3142eb8f7776SAurelien Jarno echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak 3143f57975fbSJuan Quintela ;; 3144d6b38939SJuan Quintela *) 3145eb8f7776SAurelien Jarno echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak 3146d6b38939SJuan Quintela ;; 3147f57975fbSJuan Quintelaesac 3148f57975fbSJuan Quintela 3149e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 315025be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 3151e5fe0c52Spbrookfi 3152bd0c5661Spbrookif test "$target_user_only" = "yes" \ 3153bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 315425be210fSJuan Quintela echo "CONFIG_USE_NPTL=y" >> $config_target_mak 3155bd0c5661Spbrookfi 3156379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 315725be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 3158379f6698SPaul Brookfi 315984778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 316025be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 316184778508Sblueswir1fi 31625b0753e0Sbellard 31634afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 3164fa282484SJuan Quintela 31654afddb55SJuan Quintelacflags="" 3166f9728943SPaolo Bonziniincludes="" 3167fa282484SJuan Quintelaldflags="" 31689b8e111fSJuan Quintela 316957ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then 3170f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/sparc $includes" 317124e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then 3172f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/s390 $includes" 31735d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then 3174f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/i386 $includes" 317557ddfbf7SJuan Quintelaelse 3176f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes" 317757ddfbf7SJuan Quintelafi 3178f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes" 3179f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/fpu $includes" 318057ddfbf7SJuan Quintela 31814d904533SBlue Swirlif test "$target_user_only" = "yes" ; then 31824d904533SBlue Swirl libdis_config_mak=libdis-user/config.mak 31834d904533SBlue Swirlelse 31844d904533SBlue Swirl libdis_config_mak=libdis/config.mak 31854d904533SBlue Swirlfi 31864d904533SBlue Swirl 318764656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 318864656024SJuan Quintela case "$i" in 318964656024SJuan Quintela alpha) 319025be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 31914d904533SBlue Swirl echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak 319264656024SJuan Quintela ;; 319364656024SJuan Quintela arm) 319425be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 31954d904533SBlue Swirl echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak 319664656024SJuan Quintela ;; 319764656024SJuan Quintela cris) 319825be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 31994d904533SBlue Swirl echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak 320064656024SJuan Quintela ;; 320164656024SJuan Quintela hppa) 320225be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 32034d904533SBlue Swirl echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak 320464656024SJuan Quintela ;; 320564656024SJuan Quintela i386|x86_64) 320625be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 32074d904533SBlue Swirl echo "CONFIG_I386_DIS=y" >> $libdis_config_mak 320864656024SJuan Quintela ;; 3209903ec55cSAurelien Jarno ia64*) 3210903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $config_target_mak 3211903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak 3212903ec55cSAurelien Jarno ;; 321364656024SJuan Quintela m68k) 321425be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 32154d904533SBlue Swirl echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak 321664656024SJuan Quintela ;; 321764656024SJuan Quintela microblaze) 321825be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 32194d904533SBlue Swirl echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak 322064656024SJuan Quintela ;; 322164656024SJuan Quintela mips*) 322225be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 32234d904533SBlue Swirl echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak 322464656024SJuan Quintela ;; 322564656024SJuan Quintela ppc*) 322625be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 32274d904533SBlue Swirl echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak 322864656024SJuan Quintela ;; 322924e804ecSAlexander Graf s390*) 323025be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 32314d904533SBlue Swirl echo "CONFIG_S390_DIS=y" >> $libdis_config_mak 323264656024SJuan Quintela ;; 323364656024SJuan Quintela sh4) 323425be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 32354d904533SBlue Swirl echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak 323664656024SJuan Quintela ;; 323764656024SJuan Quintela sparc*) 323825be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 32394d904533SBlue Swirl echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak 324064656024SJuan Quintela ;; 324164656024SJuan Quintela esac 324264656024SJuan Quinteladone 324364656024SJuan Quintela 32446ee7126fSJuan Quintelacase "$ARCH" in 32456ee7126fSJuan Quintelaalpha) 32466ee7126fSJuan Quintela # Ensure there's only a single GP 32476ee7126fSJuan Quintela cflags="-msmall-data $cflags" 32486ee7126fSJuan Quintela;; 32496ee7126fSJuan Quintelaesac 32506ee7126fSJuan Quintela 325155d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then 325255d9c04bSJuan Quintela case "$TARGET_BASE_ARCH" in 325355d9c04bSJuan Quintela arm) 325455d9c04bSJuan Quintela cflags="-DHAS_AUDIO $cflags" 325555d9c04bSJuan Quintela ;; 325655d9c04bSJuan Quintela i386|mips|ppc) 325755d9c04bSJuan Quintela cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" 325855d9c04bSJuan Quintela ;; 325955d9c04bSJuan Quintela esac 326055d9c04bSJuan Quintelafi 326155d9c04bSJuan Quintela 326234005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \ 326334005a00SKirill A. Shutemov "$user_pie" = "yes" ; then 326434005a00SKirill A. Shutemov cflags="-fpie $cflags" 326534005a00SKirill A. Shutemov ldflags="-pie $ldflags" 326634005a00SKirill A. Shutemovfi 326734005a00SKirill A. Shutemov 3268471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \ 3269471857ddSJuan Quintela "$TARGET_ARCH" = "microblaze" -o \ 3270471857ddSJuan Quintela "$TARGET_ARCH" = "cris" \) ; then 327125be210fSJuan Quintela echo "CONFIG_NEED_MMU=y" >> $config_target_mak 3272471857ddSJuan Quintelafi 3273471857ddSJuan Quintela 3274d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 327525be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 3276d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 3277d02c1db3SJuan Quintela cflags="-p $cflags" 3278d02c1db3SJuan Quintela ldflags="-p $ldflags" 3279d02c1db3SJuan Quintela fi 3280d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 3281d02c1db3SJuan Quintela ldflags="-p $ldflags" 328225be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 3283d02c1db3SJuan Quintela fi 3284d02c1db3SJuan Quintelafi 3285d02c1db3SJuan Quintela 32866ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld" 32879b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 3288fa282484SJuan Quintela case "$ARCH" in 3289fa282484SJuan Quintela sparc) 3290fa282484SJuan Quintela # -static is used to avoid g1/g3 usage by the dynamic linker 3291322e5878SJuan Quintela ldflags="$linker_script -static $ldflags" 3292fa282484SJuan Quintela ;; 32934d58be06SRichard Henderson alpha | s390x) 32944d58be06SRichard Henderson # The default placement of the application is fine. 32954d58be06SRichard Henderson ;; 3296fd76e73aSRichard Henderson *) 3297322e5878SJuan Quintela ldflags="$linker_script $ldflags" 3298fa282484SJuan Quintela ;; 3299fa282484SJuan Quintela esac 3300fa282484SJuan Quintelafi 3301fa282484SJuan Quintela 330225be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 330325be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 3304f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak 3305fa282484SJuan Quintela 330697a847bcSbellarddone # for target in $targets 33077d13299dSbellard 3308d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 3309e1144d00SMark McLoughlinDIRS="tests tests/cris slirp audio block net pc-bios/optionrom" 33102d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 33113e230dd2SCorentin CharyDIRS="$DIRS fsdev ui" 33127d13299dSbellardFILES="Makefile tests/Makefile" 3313e7daa605SthsFILES="$FILES tests/cris/Makefile tests/cris/.gdbinit" 3314ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 33152d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 33167ea78b74SJan Kiszkafor bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do 33177ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 33187ea78b74SJan Kiszkadone 3319d1807a4fSPaolo Bonzinimkdir -p $DIRS 33207d13299dSbellardfor f in $FILES ; do 3321eae30c8fSAurelien Jarno test -e $f || symlink $source_path/$f $f 33227d13299dSbellarddone 33231ad2134fSPaul Brook 3324c34ebfdcSAnthony Liguori# temporary config to build submodules 33252d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 3326c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 332737116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 3328c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 3329c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 3330c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 3331c34ebfdcSAnthony Liguori echo "CPP=${cross_prefix}cpp" >> $config_mak 3332c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 3333c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 3334c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 3335c34ebfdcSAnthony Liguoridone 3336c34ebfdcSAnthony Liguori 33371ad2134fSPaul Brookfor hwlib in 32 64; do 33381ad2134fSPaul Brook d=libhw$hwlib 33391ad2134fSPaul Brook mkdir -p $d 33409953b2fcSBlue Swirl mkdir -p $d/ide 334111568d6dSPaolo Bonzini symlink $source_path/Makefile.hw $d/Makefile 334237116c89SStefan Weil echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak 33431ad2134fSPaul Brookdone 3344add16157SBlue Swirl 3345add16157SBlue Swirld=libuser 3346add16157SBlue Swirlmkdir -p $d 334711568d6dSPaolo Bonzinisymlink $source_path/Makefile.user $d/Makefile 3348299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then 3349299060a0SKirill A. Shutemov echo "QEMU_CFLAGS+=-fpie" > $d/config.mak 3350299060a0SKirill A. Shutemovfi 3351b40292e7SJan Kiszka 3352b40292e7SJan Kiszkaif test "$docs" = "yes" ; then 3353b40292e7SJan Kiszka mkdir -p QMP 3354b40292e7SJan Kiszkafi 3355