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="" 116*af2be207SJan Kiszkakvm="" 117377529c0SPaolo Bonzininptl="" 118377529c0SPaolo Bonzinisdl="" 119821601eaSJes Sorensenvnc="yes" 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="" 129d5b93ddfSAnthony PERARDxen_ctrl_version="" 130377529c0SPaolo Bonzinilinux_aio="" 131377529c0SPaolo Bonziniattr="" 132*af2be207SJan Kiszkavhost_net="" 133377529c0SPaolo Bonzinixfs="" 134377529c0SPaolo Bonzini 135377529c0SPaolo Bonzinigprof="no" 136377529c0SPaolo Bonzinidebug_tcg="no" 137377529c0SPaolo Bonzinidebug_mon="no" 138377529c0SPaolo Bonzinidebug="no" 139377529c0SPaolo Bonzinistrip_opt="yes" 140377529c0SPaolo Bonzinibigendian="no" 141377529c0SPaolo Bonzinimingw32="no" 142377529c0SPaolo BonziniEXESUF="" 143377529c0SPaolo Bonziniprefix="/usr/local" 144377529c0SPaolo Bonzinimandir="\${prefix}/share/man" 145377529c0SPaolo Bonzinidatadir="\${prefix}/share/qemu" 146377529c0SPaolo Bonzinidocdir="\${prefix}/share/doc/qemu" 147377529c0SPaolo Bonzinibindir="\${prefix}/bin" 1483aa5d2beSAlon Levylibdir="\${prefix}/lib" 149377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc" 150377529c0SPaolo Bonziniconfsuffix="/qemu" 151377529c0SPaolo Bonzinislirp="yes" 152377529c0SPaolo Bonzinifmod_lib="" 153377529c0SPaolo Bonzinifmod_inc="" 154377529c0SPaolo Bonzinioss_lib="" 155377529c0SPaolo Bonzinibsd="no" 156377529c0SPaolo Bonzinilinux="no" 157377529c0SPaolo Bonzinisolaris="no" 158377529c0SPaolo Bonziniprofiler="no" 159377529c0SPaolo Bonzinicocoa="no" 160377529c0SPaolo Bonzinisoftmmu="yes" 161377529c0SPaolo Bonzinilinux_user="no" 162377529c0SPaolo Bonzinidarwin_user="no" 163377529c0SPaolo Bonzinibsd_user="no" 164377529c0SPaolo Bonziniguest_base="" 165377529c0SPaolo Bonziniuname_release="" 166377529c0SPaolo Bonziniio_thread="no" 167377529c0SPaolo Bonzinimixemu="no" 168377529c0SPaolo Bonziniaix="no" 169377529c0SPaolo Bonziniblobs="yes" 170377529c0SPaolo Bonzinipkgversion="" 171377529c0SPaolo Bonzinicheck_utests="no" 172377529c0SPaolo Bonziniuser_pie="no" 173377529c0SPaolo Bonzinizero_malloc="" 174377529c0SPaolo Bonzinitrace_backend="nop" 175377529c0SPaolo Bonzinitrace_file="trace" 176377529c0SPaolo Bonzinispice="" 177377529c0SPaolo Bonzinirbd="" 17836707144SAlon Levysmartcard="" 179111a38b0SRobert Relyeasmartcard_nss="" 180430a3c18SMichael Walleopengl="" 181377529c0SPaolo Bonzini 182ac0df51dSaliguori# parse CC options first 183ac0df51dSaliguorifor opt do 184ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 185ac0df51dSaliguori case "$opt" in 186ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 187ac0df51dSaliguori ;; 1883d8df640SPaolo Bonzini --cc=*) CC="$optarg" 189ac0df51dSaliguori ;; 190ca4deeb1SPaolo Bonzini --source-path=*) source_path="$optarg" 191ca4deeb1SPaolo Bonzini ;; 1922ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 1932ff6b91eSJuan Quintela ;; 194a558ee17SJuan Quintela --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" 195e2a2ed06SJuan Quintela ;; 196e2a2ed06SJuan Quintela --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" 197e2a2ed06SJuan Quintela ;; 19850e7b1a0SJuan Quintela --sparc_cpu=*) 19950e7b1a0SJuan Quintela sparc_cpu="$optarg" 20050e7b1a0SJuan Quintela case $sparc_cpu in 201ed968ff1SJuan Quintela v7|v8|v8plus|v8plusa) 20250e7b1a0SJuan Quintela cpu="sparc" 20350e7b1a0SJuan Quintela ;; 20450e7b1a0SJuan Quintela v9) 20550e7b1a0SJuan Quintela cpu="sparc64" 20650e7b1a0SJuan Quintela ;; 20750e7b1a0SJuan Quintela *) 20850e7b1a0SJuan Quintela echo "undefined SPARC architecture. Exiting"; 20950e7b1a0SJuan Quintela exit 1 21050e7b1a0SJuan Quintela ;; 21150e7b1a0SJuan Quintela esac 21250e7b1a0SJuan Quintela ;; 213ac0df51dSaliguori esac 214ac0df51dSaliguoridone 215ac0df51dSaliguori# OS specific 216ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 217ac0df51dSaliguori# we can eliminate it's usage altogether 218ac0df51dSaliguori 2193d8df640SPaolo Bonzinicc="${cross_prefix}${CC-gcc}" 2203d8df640SPaolo Bonziniar="${cross_prefix}${AR-ar}" 2213d8df640SPaolo Bonziniobjcopy="${cross_prefix}${OBJCOPY-objcopy}" 2223d8df640SPaolo Bonzinild="${cross_prefix}${LD-ld}" 2233d8df640SPaolo Bonzinistrip="${cross_prefix}${STRIP-strip}" 2243d8df640SPaolo Bonziniwindres="${cross_prefix}${WINDRES-windres}" 225a8bd70adSPaolo Bonzinipkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}" 2263ec87ffeSPaolo Bonzinisdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}" 227ac0df51dSaliguori 228be17dc90SMichael S. Tsirkin# default flags for all hosts 229be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" 230be17dc90SMichael S. TsirkinCFLAGS="-g $CFLAGS" 231f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 232be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 233be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 23484958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 235f9728943SPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH)" 236be17dc90SMichael S. TsirkinLDFLAGS="-g $LDFLAGS" 237be17dc90SMichael S. Tsirkin 238ca4deeb1SPaolo Bonzini# make source path absolute 239ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd` 240ca4deeb1SPaolo Bonzini 241ac0df51dSaliguoricheck_define() { 242ac0df51dSaliguoricat > $TMPC <<EOF 243ac0df51dSaliguori#if !defined($1) 244ac0df51dSaliguori#error Not defined 245ac0df51dSaliguori#endif 246ac0df51dSaliguoriint main(void) { return 0; } 247ac0df51dSaliguoriEOF 24852166aa0SJuan Quintela compile_object 249ac0df51dSaliguori} 250ac0df51dSaliguori 2512ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 2522ff6b91eSJuan Quintela # command line argument 2532ff6b91eSJuan Quintela : 2542ff6b91eSJuan Quintelaelif check_define __i386__ ; then 255ac0df51dSaliguori cpu="i386" 256ac0df51dSaliguorielif check_define __x86_64__ ; then 257ac0df51dSaliguori cpu="x86_64" 2583aa9bd6cSblueswir1elif check_define __sparc__ ; then 2593aa9bd6cSblueswir1 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA 2603aa9bd6cSblueswir1 # They must be specified using --sparc_cpu 2613aa9bd6cSblueswir1 if check_define __arch64__ ; then 2623aa9bd6cSblueswir1 cpu="sparc64" 2633aa9bd6cSblueswir1 else 2643aa9bd6cSblueswir1 cpu="sparc" 2653aa9bd6cSblueswir1 fi 266fdf7ed96Smalcelif check_define _ARCH_PPC ; then 267fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 268fdf7ed96Smalc cpu="ppc64" 269ac0df51dSaliguori else 270fdf7ed96Smalc cpu="ppc" 271fdf7ed96Smalc fi 272afa05235SAurelien Jarnoelif check_define __mips__ ; then 273afa05235SAurelien Jarno cpu="mips" 274477ba620SAurelien Jarnoelif check_define __ia64__ ; then 275477ba620SAurelien Jarno cpu="ia64" 276d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 277d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 278d66ed0eaSAurelien Jarno cpu="s390x" 279d66ed0eaSAurelien Jarno else 280d66ed0eaSAurelien Jarno cpu="s390" 281d66ed0eaSAurelien Jarno fi 282fdf7ed96Smalcelse 283fdf7ed96Smalc cpu=`uname -m` 284ac0df51dSaliguorifi 285ac0df51dSaliguori 2867d13299dSbellardcase "$cpu" in 287d2fbca94SGuan Xuetao alpha|cris|ia64|lm32|m68k|microblaze|ppc|ppc64|sparc64|unicore32) 288ea8f20f8SJuan Quintela cpu="$cpu" 289ea8f20f8SJuan Quintela ;; 2907d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 29197a847bcSbellard cpu="i386" 2927d13299dSbellard ;; 293aaa5fa14Saurel32 x86_64|amd64) 294aaa5fa14Saurel32 cpu="x86_64" 295aaa5fa14Saurel32 ;; 296ba68055eSbellard armv*b) 297808c4954Sbellard cpu="armv4b" 298808c4954Sbellard ;; 299ba68055eSbellard armv*l) 3007d13299dSbellard cpu="armv4l" 3017d13299dSbellard ;; 302f54b3f92Saurel32 parisc|parisc64) 303f54b3f92Saurel32 cpu="hppa" 304f54b3f92Saurel32 ;; 305afa05235SAurelien Jarno mips*) 306afa05235SAurelien Jarno cpu="mips" 307afa05235SAurelien Jarno ;; 30824e804ecSAlexander Graf s390) 309fb3e5849Sbellard cpu="s390" 310fb3e5849Sbellard ;; 31124e804ecSAlexander Graf s390x) 31224e804ecSAlexander Graf cpu="s390x" 31324e804ecSAlexander Graf ;; 3143142255cSblueswir1 sparc|sun4[cdmuv]) 315ae228531Sbellard cpu="sparc" 316ae228531Sbellard ;; 3177d13299dSbellard *) 318a447d4dcSPaolo Bonzini echo "Unsupported CPU = $cpu" 319a447d4dcSPaolo Bonzini exit 1 3207d13299dSbellard ;; 3217d13299dSbellardesac 322e2d52ad3SJuan Quintela 3237d13299dSbellard# OS specific 324ac0df51dSaliguoriif check_define __linux__ ; then 325ac0df51dSaliguori targetos="Linux" 326ac0df51dSaliguorielif check_define _WIN32 ; then 327ac0df51dSaliguori targetos='MINGW32' 328169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then 329169dc5d3Sblueswir1 targetos='OpenBSD' 330169dc5d3Sblueswir1elif check_define __sun__ ; then 331169dc5d3Sblueswir1 targetos='SunOS' 332179cf400SAndreas Färberelif check_define __HAIKU__ ; then 333179cf400SAndreas Färber targetos='Haiku' 334ac0df51dSaliguorielse 3357d13299dSbellard targetos=`uname -s` 336ac0df51dSaliguorifi 3370dbfc675SJuan Quintela 3387d13299dSbellardcase $targetos in 339c326e0afSbellardCYGWIN*) 340c326e0afSbellard mingw32="yes" 341a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 342d5631638Smalc audio_possible_drivers="winwave sdl" 343d5631638Smalc audio_drv_list="winwave" 344c326e0afSbellard;; 34567b915a5SbellardMINGW32*) 34667b915a5Sbellard mingw32="yes" 347d5631638Smalc audio_possible_drivers="winwave dsound sdl fmod" 348d5631638Smalc audio_drv_list="winwave" 34967b915a5Sbellard;; 3505c40d2bdSthsGNU/kFreeBSD) 351a167ba50SAurelien Jarno bsd="yes" 3520c58ac1cSmalc audio_drv_list="oss" 353f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 3545c40d2bdSths;; 3557d3505c5SbellardFreeBSD) 3567d3505c5Sbellard bsd="yes" 3570db4a067SPaolo Bonzini make="${MAKE-gmake}" 3580c58ac1cSmalc audio_drv_list="oss" 359f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 360f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 361f01576f1SJuergen Lock LIBS="-lutil $LIBS" 3627d3505c5Sbellard;; 363c5e97233Sblueswir1DragonFly) 364c5e97233Sblueswir1 bsd="yes" 3650db4a067SPaolo Bonzini make="${MAKE-gmake}" 366c5e97233Sblueswir1 audio_drv_list="oss" 367c5e97233Sblueswir1 audio_possible_drivers="oss sdl esd pa" 368c5e97233Sblueswir1;; 3697d3505c5SbellardNetBSD) 3707d3505c5Sbellard bsd="yes" 3710db4a067SPaolo Bonzini make="${MAKE-gmake}" 3720c58ac1cSmalc audio_drv_list="oss" 373c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3748ef92a88Sblueswir1 oss_lib="-lossaudio" 3757d3505c5Sbellard;; 3767d3505c5SbellardOpenBSD) 3777d3505c5Sbellard bsd="yes" 3780db4a067SPaolo Bonzini make="${MAKE-gmake}" 3790c58ac1cSmalc audio_drv_list="oss" 380c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3812f6a1ab0Sblueswir1 oss_lib="-lossaudio" 3827d3505c5Sbellard;; 38383fb7adfSbellardDarwin) 38483fb7adfSbellard bsd="yes" 38583fb7adfSbellard darwin="yes" 3860dbfc675SJuan Quintela # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can 3870dbfc675SJuan Quintela # run 64-bit userspace code 388aab8588aSmalc if [ "$cpu" = "i386" ] ; then 3891b0f9cc2Saliguori is_x86_64=`sysctl -n hw.optional.x86_64` 390aab8588aSmalc [ "$is_x86_64" = "1" ] && cpu=x86_64 3911b0f9cc2Saliguori fi 3921b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 393a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 3940c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 3951b0f9cc2Saliguori else 396a558ee17SJuan Quintela QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS" 3971b0f9cc2Saliguori fi 398831b7825Sths darwin_user="yes" 399fd677642Sths cocoa="yes" 4000c58ac1cSmalc audio_drv_list="coreaudio" 401c2de5c91Smalc audio_possible_drivers="coreaudio sdl fmod" 4020c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 4037973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 40483fb7adfSbellard;; 405ec530c81SbellardSunOS) 406ec530c81Sbellard solaris="yes" 4070db4a067SPaolo Bonzini make="${MAKE-gmake}" 4080db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 409fa58948dSBlue Swirl ld="gld" 4100475a5caSths needs_libsunmath="no" 411c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 412ef18c883Sths # have to select again, because `uname -m` returns i86pc 413ef18c883Sths # even on an x86_64 box. 414ef18c883Sths solariscpu=`isainfo -k` 415ef18c883Sths if test "${solariscpu}" = "amd64" ; then 416ef18c883Sths cpu="x86_64" 417ef18c883Sths fi 418c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 4190475a5caSths if test "$solarisrev" -le 9 ; then 4200475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 4210475a5caSths needs_libsunmath="yes" 422f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 423f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 424f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 4250475a5caSths else 4260475a5caSths echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" 4270475a5caSths echo "libsunmath from the Sun Studio compilers tools, due to a lack of" 4280475a5caSths echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" 4290475a5caSths echo "Studio 11 can be downloaded from www.sun.com." 4300475a5caSths exit 1 4310475a5caSths fi 4320475a5caSths fi 43386b2bd93Sths fi 4346b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 4350c58ac1cSmalc audio_drv_list="oss" 4366b4d2ba1Sths fi 437c2de5c91Smalc audio_possible_drivers="oss sdl" 438d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 439d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 440d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 441d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 442a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 443e174c0bbSJuan Quintela LIBS="-lsocket -lnsl -lresolv $LIBS" 444ec530c81Sbellard;; 445b29fe3edSmalcAIX) 446b29fe3edSmalc aix="yes" 4470db4a067SPaolo Bonzini make="${MAKE-gmake}" 448b29fe3edSmalc;; 449179cf400SAndreas FärberHaiku) 450179cf400SAndreas Färber haiku="yes" 451179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 452179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 453179cf400SAndreas Färber;; 454fb065187Sbellard*) 4550c58ac1cSmalc audio_drv_list="oss" 456b8e59f18Smalc audio_possible_drivers="oss alsa sdl esd pa" 4575327cf48Sbellard linux="yes" 458831b7825Sths linux_user="yes" 45968063649Sblueswir1 usb="linux" 460*af2be207SJan Kiszka kvm="yes" 461*af2be207SJan Kiszka vhost_net="yes" 46207f4ddbfSbellard if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 463c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 464c9ec1fe4Sbellard fi 465fb065187Sbellard;; 4667d13299dSbellardesac 4677d13299dSbellard 4687d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 469b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 47068063649Sblueswir1 usb="bsd" 47183fb7adfSbellard fi 47284778508Sblueswir1 bsd_user="yes" 4737d3505c5Sbellardfi 4747d3505c5Sbellard 4750db4a067SPaolo Bonzini: ${make=${MAKE-make}} 4760db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 4770db4a067SPaolo Bonzini 4783457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 4793457a3f8SJuan Quintela EXESUF=".exe" 480a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 481e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 482e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 48308f3896aSStefan Weil LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS" 484683035deSPaolo Bonzini prefix="c:/Program Files/Qemu" 485683035deSPaolo Bonzini mandir="\${prefix}" 486683035deSPaolo Bonzini datadir="\${prefix}" 487683035deSPaolo Bonzini docdir="\${prefix}" 488683035deSPaolo Bonzini bindir="\${prefix}" 489683035deSPaolo Bonzini sysconfdir="\${prefix}" 490683035deSPaolo Bonzini confsuffix="" 4913457a3f8SJuan Quintelafi 4923457a3f8SJuan Quintela 493487fefdbSAnthony Liguoriwerror="" 49485aa5189Sbellard 4957d13299dSbellardfor opt do 496a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 4977d13299dSbellard case "$opt" in 4982efc3265Sbellard --help|-h) show_help=yes 4992efc3265Sbellard ;; 50099123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 50199123e13SMike Frysinger ;; 502b1a550a0Spbrook --prefix=*) prefix="$optarg" 5037d13299dSbellard ;; 504b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 50532ce6337Sbellard ;; 506ca4deeb1SPaolo Bonzini --source-path=*) 5077d13299dSbellard ;; 508ac0df51dSaliguori --cross-prefix=*) 5097d13299dSbellard ;; 510ac0df51dSaliguori --cc=*) 5117d13299dSbellard ;; 512b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 51383469015Sbellard ;; 514b1a550a0Spbrook --make=*) make="$optarg" 5157d13299dSbellard ;; 5166a882643Spbrook --install=*) install="$optarg" 5176a882643Spbrook ;; 518e2a2ed06SJuan Quintela --extra-cflags=*) 5197d13299dSbellard ;; 520e2a2ed06SJuan Quintela --extra-ldflags=*) 5217d13299dSbellard ;; 5222ff6b91eSJuan Quintela --cpu=*) 5237d13299dSbellard ;; 524b1a550a0Spbrook --target-list=*) target_list="$optarg" 525de83cd02Sbellard ;; 52674242e0fSPaolo Bonzini --enable-trace-backend=*) trace_backend="$optarg" 52794a420b1SStefan Hajnoczi ;; 52874242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 5299410b56cSPrerna Saxena ;; 5307d13299dSbellard --enable-gprof) gprof="yes" 5317d13299dSbellard ;; 53279427693SLoïc Minier --static) 53379427693SLoïc Minier static="yes" 53479427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 53543ce4dfeSbellard ;; 5360b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 5370b24e75fSPaolo Bonzini ;; 5380b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 5390b24e75fSPaolo Bonzini ;; 5403aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 5413aa5d2beSAlon Levy ;; 5420b24e75fSPaolo Bonzini --datadir=*) datadir="$optarg" 5430b24e75fSPaolo Bonzini ;; 5440b24e75fSPaolo Bonzini --docdir=*) docdir="$optarg" 5450b24e75fSPaolo Bonzini ;; 546ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 54707381cc1SAnthony Liguori ;; 54897a847bcSbellard --disable-sdl) sdl="no" 54997a847bcSbellard ;; 550c4198157SJuan Quintela --enable-sdl) sdl="yes" 551c4198157SJuan Quintela ;; 552821601eaSJes Sorensen --disable-vnc) vnc="no" 553821601eaSJes Sorensen ;; 554821601eaSJes Sorensen --enable-vnc) vnc="yes" 555821601eaSJes Sorensen ;; 556b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 557102a52e4Sbellard ;; 558c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 559c2de5c91Smalc ;; 5602f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 5612f6a1ab0Sblueswir1 ;; 5622fa7d3bfSmalc --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` 5630c58ac1cSmalc ;; 5640c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 5650c58ac1cSmalc ;; 566eb852011SMarkus Armbruster --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 567eb852011SMarkus Armbruster ;; 568f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 569f8393946Saurel32 ;; 570f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 571f8393946Saurel32 ;; 572b4475aa2SLuiz Capitulino --enable-debug-mon) debug_mon="yes" 573b4475aa2SLuiz Capitulino ;; 574b4475aa2SLuiz Capitulino --disable-debug-mon) debug_mon="no" 575b4475aa2SLuiz Capitulino ;; 576f3d08ee6SPaul Brook --enable-debug) 577f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 578f3d08ee6SPaul Brook debug_tcg="yes" 579b4475aa2SLuiz Capitulino debug_mon="yes" 580f3d08ee6SPaul Brook debug="yes" 581f3d08ee6SPaul Brook strip_opt="no" 582f3d08ee6SPaul Brook ;; 58303b4fe7dSaliguori --enable-sparse) sparse="yes" 58403b4fe7dSaliguori ;; 58503b4fe7dSaliguori --disable-sparse) sparse="no" 58603b4fe7dSaliguori ;; 5871625af87Saliguori --disable-strip) strip_opt="no" 5881625af87Saliguori ;; 5898d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 5908d5d2d4cSths ;; 5911be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 5921be10ad2SJuan Quintela ;; 5932f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 5942f9606b3Saliguori ;; 595ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 596ea784e3bSJuan Quintela ;; 5972f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 5982f6f5c7aSCorentin Chary ;; 5992f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 6002f6f5c7aSCorentin Chary ;; 601efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 602efe556adSCorentin Chary ;; 603efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 604efe556adSCorentin Chary ;; 605bd023f95SCorentin Chary --disable-vnc-thread) vnc_thread="no" 606bd023f95SCorentin Chary ;; 607bd023f95SCorentin Chary --enable-vnc-thread) vnc_thread="yes" 608bd023f95SCorentin Chary ;; 609443f1376Sbellard --disable-slirp) slirp="no" 610c20709aaSbellard ;; 611ee682d27SStefan Weil --disable-uuid) uuid="no" 612ee682d27SStefan Weil ;; 613ee682d27SStefan Weil --enable-uuid) uuid="yes" 614ee682d27SStefan Weil ;; 615e0e6c8c0Saliguori --disable-vde) vde="no" 6168a16d273Sths ;; 617dfb278bdSJuan Quintela --enable-vde) vde="yes" 618dfb278bdSJuan Quintela ;; 619e37630caSaliguori --disable-xen) xen="no" 620e37630caSaliguori ;; 621fc321b4bSJuan Quintela --enable-xen) xen="yes" 622fc321b4bSJuan Quintela ;; 6232e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 6242e4d9fb1Saurel32 ;; 6254ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 6264ffcedb6SJuan Quintela ;; 627fb599c9aSbalrog --disable-bluez) bluez="no" 628fb599c9aSbalrog ;; 629a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 630a20a6f46SJuan Quintela ;; 6317ba1e619Saliguori --disable-kvm) kvm="no" 6327ba1e619Saliguori ;; 633b31a0277SJuan Quintela --enable-kvm) kvm="yes" 634b31a0277SJuan Quintela ;; 635cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 636cd4ec0b4SGerd Hoffmann ;; 637cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 638cd4ec0b4SGerd Hoffmann ;; 63905c2a3e7Sbellard --enable-profiler) profiler="yes" 64005c2a3e7Sbellard ;; 641c2de5c91Smalc --enable-cocoa) 642c2de5c91Smalc cocoa="yes" ; 643c2de5c91Smalc sdl="no" ; 644c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 6455b0753e0Sbellard ;; 646cad25d69Spbrook --disable-system) softmmu="no" 6470a8e90f4Spbrook ;; 648cad25d69Spbrook --enable-system) softmmu="yes" 6490a8e90f4Spbrook ;; 6500953a80fSZachary Amsden --disable-user) 6510953a80fSZachary Amsden linux_user="no" ; 6520953a80fSZachary Amsden bsd_user="no" ; 6530953a80fSZachary Amsden darwin_user="no" 6540953a80fSZachary Amsden ;; 6550953a80fSZachary Amsden --enable-user) ;; 656831b7825Sths --disable-linux-user) linux_user="no" 6570a8e90f4Spbrook ;; 658831b7825Sths --enable-linux-user) linux_user="yes" 659831b7825Sths ;; 660831b7825Sths --disable-darwin-user) darwin_user="no" 661831b7825Sths ;; 662831b7825Sths --enable-darwin-user) darwin_user="yes" 6630a8e90f4Spbrook ;; 66484778508Sblueswir1 --disable-bsd-user) bsd_user="no" 66584778508Sblueswir1 ;; 66684778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 66784778508Sblueswir1 ;; 668379f6698SPaul Brook --enable-guest-base) guest_base="yes" 669379f6698SPaul Brook ;; 670379f6698SPaul Brook --disable-guest-base) guest_base="no" 671379f6698SPaul Brook ;; 67234005a00SKirill A. Shutemov --enable-user-pie) user_pie="yes" 67334005a00SKirill A. Shutemov ;; 67434005a00SKirill A. Shutemov --disable-user-pie) user_pie="no" 67534005a00SKirill A. Shutemov ;; 676c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 677c5937220Spbrook ;; 6783142255cSblueswir1 --sparc_cpu=*) 6793142255cSblueswir1 ;; 68085aa5189Sbellard --enable-werror) werror="yes" 68185aa5189Sbellard ;; 68285aa5189Sbellard --disable-werror) werror="no" 68385aa5189Sbellard ;; 6844d3b6f6eSbalrog --disable-curses) curses="no" 6854d3b6f6eSbalrog ;; 686c584a6d0SJuan Quintela --enable-curses) curses="yes" 687c584a6d0SJuan Quintela ;; 688769ce76dSAlexander Graf --disable-curl) curl="no" 689769ce76dSAlexander Graf ;; 690788c8196SJuan Quintela --enable-curl) curl="yes" 691788c8196SJuan Quintela ;; 6922df87df7SJuan Quintela --disable-fdt) fdt="no" 6932df87df7SJuan Quintela ;; 6942df87df7SJuan Quintela --enable-fdt) fdt="yes" 6952df87df7SJuan Quintela ;; 6965495ed11SLuiz Capitulino --disable-check-utests) check_utests="no" 6975495ed11SLuiz Capitulino ;; 6985495ed11SLuiz Capitulino --enable-check-utests) check_utests="yes" 6995495ed11SLuiz Capitulino ;; 700bd0c5661Spbrook --disable-nptl) nptl="no" 701bd0c5661Spbrook ;; 702b0a47e79SJuan Quintela --enable-nptl) nptl="yes" 703b0a47e79SJuan Quintela ;; 7048ff9cbf7Smalc --enable-mixemu) mixemu="yes" 7058ff9cbf7Smalc ;; 7065c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 7075c6c3a6cSChristoph Hellwig ;; 7085c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 7095c6c3a6cSChristoph Hellwig ;; 710758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 711758e8e38SVenkateswararao Jujjuri (JV) ;; 712758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 713758e8e38SVenkateswararao Jujjuri (JV) ;; 714e5d355d1Saliguori --enable-io-thread) io_thread="yes" 715e5d355d1Saliguori ;; 71677755340Sths --disable-blobs) blobs="no" 71777755340Sths ;; 7184a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 7194a19f1ecSpbrook ;; 720a25dba17SJuan Quintela --disable-docs) docs="no" 72170ec5dc0SAnthony Liguori ;; 722a25dba17SJuan Quintela --enable-docs) docs="yes" 72383a3ab8bSJuan Quintela ;; 724d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 725d5970055SMichael S. Tsirkin ;; 726d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 727d5970055SMichael S. Tsirkin ;; 72820ff075bSMichael Walle --disable-opengl) opengl="no" 72920ff075bSMichael Walle ;; 73020ff075bSMichael Walle --enable-opengl) opengl="yes" 73120ff075bSMichael Walle ;; 7326bde81cbSPaolo Bonzini --*dir) 7336bde81cbSPaolo Bonzini ;; 734f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 735f27aaf4bSChristian Brunner ;; 736f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 737f27aaf4bSChristian Brunner ;; 73836707144SAlon Levy --disable-smartcard) smartcard="no" 73936707144SAlon Levy ;; 74036707144SAlon Levy --enable-smartcard) smartcard="yes" 74136707144SAlon Levy ;; 742111a38b0SRobert Relyea --disable-smartcard-nss) smartcard_nss="no" 743111a38b0SRobert Relyea ;; 744111a38b0SRobert Relyea --enable-smartcard-nss) smartcard_nss="yes" 745111a38b0SRobert Relyea ;; 7467f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 7477f1559c6Sbalrog ;; 7487d13299dSbellard esac 7497d13299dSbellarddone 7507d13299dSbellard 7513142255cSblueswir1# 7523142255cSblueswir1# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right 753a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) 7543142255cSblueswir1# 755379f6698SPaul Brookhost_guest_base="no" 75640293e58Sbellardcase "$cpu" in 757ed968ff1SJuan Quintela sparc) case $sparc_cpu in 758ed968ff1SJuan Quintela v7|v8) 759a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 760ed968ff1SJuan Quintela ;; 761ed968ff1SJuan Quintela v8plus|v8plusa) 762a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 763ed968ff1SJuan Quintela ;; 764ed968ff1SJuan Quintela *) # sparc_cpu not defined in the command line 765a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" 766ed968ff1SJuan Quintela esac 7670c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 768a558ee17SJuan Quintela QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS" 769762e8230Sblueswir1 if test "$solaris" = "no" ; then 770a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS" 771c81da56eSJuan Quintela helper_cflags="-ffixed-i0" 772762e8230Sblueswir1 fi 7733142255cSblueswir1 ;; 774ed968ff1SJuan Quintela sparc64) 775a558ee17SJuan Quintela QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" 7760c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 777a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" 778ed968ff1SJuan Quintela if test "$solaris" != "no" ; then 779a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS" 780762e8230Sblueswir1 fi 7813142255cSblueswir1 ;; 78276d83bdeSths s390) 78328d7cc49SRichard Henderson QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS" 78428d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 78548bb3750SRichard Henderson host_guest_base="yes" 78628d7cc49SRichard Henderson ;; 78728d7cc49SRichard Henderson s390x) 78828d7cc49SRichard Henderson QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS" 78928d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 79048bb3750SRichard Henderson host_guest_base="yes" 79176d83bdeSths ;; 79240293e58Sbellard i386) 793a558ee17SJuan Quintela QEMU_CFLAGS="-m32 $QEMU_CFLAGS" 7940c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 7952b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 796c81da56eSJuan Quintela helper_cflags="-fomit-frame-pointer" 797379f6698SPaul Brook host_guest_base="yes" 79840293e58Sbellard ;; 79940293e58Sbellard x86_64) 800a558ee17SJuan Quintela QEMU_CFLAGS="-m64 $QEMU_CFLAGS" 8010c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 8022b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 803379f6698SPaul Brook host_guest_base="yes" 804379f6698SPaul Brook ;; 805379f6698SPaul Brook arm*) 806379f6698SPaul Brook host_guest_base="yes" 80740293e58Sbellard ;; 808f6548c0aSmalc ppc*) 809f6548c0aSmalc host_guest_base="yes" 810f6548c0aSmalc ;; 811cc01cc8eSAurelien Jarno mips*) 812cc01cc8eSAurelien Jarno host_guest_base="yes" 813cc01cc8eSAurelien Jarno ;; 814477ba620SAurelien Jarno ia64*) 815477ba620SAurelien Jarno host_guest_base="yes" 816477ba620SAurelien Jarno ;; 817fd76e73aSRichard Henderson hppa*) 818fd76e73aSRichard Henderson host_guest_base="yes" 819fd76e73aSRichard Henderson ;; 820d2fbca94SGuan Xuetao unicore32*) 821d2fbca94SGuan Xuetao host_guest_base="yes" 822d2fbca94SGuan Xuetao ;; 8233142255cSblueswir1esac 8243142255cSblueswir1 825379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base" 826379f6698SPaul Brook 82760e0df25SPeter Maydell 82860e0df25SPeter Maydelldefault_target_list="" 82960e0df25SPeter Maydell 83060e0df25SPeter Maydell# these targets are portable 83160e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then 83260e0df25SPeter Maydell default_target_list="\ 83360e0df25SPeter Maydelli386-softmmu \ 83460e0df25SPeter Maydellx86_64-softmmu \ 835b758aca1SRichard Hendersonalpha-softmmu \ 83660e0df25SPeter Maydellarm-softmmu \ 83760e0df25SPeter Maydellcris-softmmu \ 83860e0df25SPeter Maydelllm32-softmmu \ 83960e0df25SPeter Maydellm68k-softmmu \ 84060e0df25SPeter Maydellmicroblaze-softmmu \ 84160e0df25SPeter Maydellmicroblazeel-softmmu \ 84260e0df25SPeter Maydellmips-softmmu \ 84360e0df25SPeter Maydellmipsel-softmmu \ 84460e0df25SPeter Maydellmips64-softmmu \ 84560e0df25SPeter Maydellmips64el-softmmu \ 84660e0df25SPeter Maydellppc-softmmu \ 84760e0df25SPeter Maydellppcemb-softmmu \ 84860e0df25SPeter Maydellppc64-softmmu \ 84960e0df25SPeter Maydellsh4-softmmu \ 85060e0df25SPeter Maydellsh4eb-softmmu \ 85160e0df25SPeter Maydellsparc-softmmu \ 85260e0df25SPeter Maydellsparc64-softmmu \ 8530f3301d4SAlexander Grafs390x-softmmu \ 85460e0df25SPeter Maydell" 85560e0df25SPeter Maydellfi 85660e0df25SPeter Maydell# the following are Linux specific 85760e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then 85860e0df25SPeter Maydell default_target_list="${default_target_list}\ 85960e0df25SPeter Maydelli386-linux-user \ 86060e0df25SPeter Maydellx86_64-linux-user \ 86160e0df25SPeter Maydellalpha-linux-user \ 86260e0df25SPeter Maydellarm-linux-user \ 86360e0df25SPeter Maydellarmeb-linux-user \ 86460e0df25SPeter Maydellcris-linux-user \ 86560e0df25SPeter Maydellm68k-linux-user \ 86660e0df25SPeter Maydellmicroblaze-linux-user \ 86760e0df25SPeter Maydellmicroblazeel-linux-user \ 86860e0df25SPeter Maydellmips-linux-user \ 86960e0df25SPeter Maydellmipsel-linux-user \ 87060e0df25SPeter Maydellppc-linux-user \ 87160e0df25SPeter Maydellppc64-linux-user \ 87260e0df25SPeter Maydellppc64abi32-linux-user \ 87360e0df25SPeter Maydellsh4-linux-user \ 87460e0df25SPeter Maydellsh4eb-linux-user \ 87560e0df25SPeter Maydellsparc-linux-user \ 87660e0df25SPeter Maydellsparc64-linux-user \ 87760e0df25SPeter Maydellsparc32plus-linux-user \ 87860e0df25SPeter Maydellunicore32-linux-user \ 8790f3301d4SAlexander Grafs390x-linux-user \ 88060e0df25SPeter Maydell" 88160e0df25SPeter Maydellfi 88260e0df25SPeter Maydell# the following are Darwin specific 88360e0df25SPeter Maydellif [ "$darwin_user" = "yes" ] ; then 88460e0df25SPeter Maydell default_target_list="$default_target_list i386-darwin-user ppc-darwin-user " 88560e0df25SPeter Maydellfi 88660e0df25SPeter Maydell# the following are BSD specific 88760e0df25SPeter Maydellif [ "$bsd_user" = "yes" ] ; then 88860e0df25SPeter Maydell default_target_list="${default_target_list}\ 88960e0df25SPeter Maydelli386-bsd-user \ 89060e0df25SPeter Maydellx86_64-bsd-user \ 89160e0df25SPeter Maydellsparc-bsd-user \ 89260e0df25SPeter Maydellsparc64-bsd-user \ 89360e0df25SPeter Maydell" 89460e0df25SPeter Maydellfi 89560e0df25SPeter Maydell 896af5db58eSpbrookif test x"$show_help" = x"yes" ; then 897af5db58eSpbrookcat << EOF 898af5db58eSpbrook 899af5db58eSpbrookUsage: configure [options] 900af5db58eSpbrookOptions: [defaults in brackets after descriptions] 901af5db58eSpbrook 902af5db58eSpbrookEOF 903af5db58eSpbrookecho "Standard options:" 904af5db58eSpbrookecho " --help print this message" 905af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 906af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 907af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 90860e0df25SPeter Maydellecho " --target-list=LIST set target list (default: build everything)" 90960e0df25SPeter Maydellecho "Available targets: $default_target_list" | \ 91060e0df25SPeter Maydell fold -s -w 53 | sed -e 's/^/ /' 911af5db58eSpbrookecho "" 912af5db58eSpbrookecho "Advanced options (experts only):" 913af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 914af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 915af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 9160bfe8cc0SPaolo Bonziniecho " --host-cc=CC use C compiler CC [$host_cc] for code run at" 9170bfe8cc0SPaolo Bonziniecho " build time" 918a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 919e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 920af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 9216a882643Spbrookecho " --install=INSTALL use specified install [$install]" 922af5db58eSpbrookecho " --static enable static build [$static]" 9230b24e75fSPaolo Bonziniecho " --mandir=PATH install man pages in PATH" 9240b24e75fSPaolo Bonziniecho " --datadir=PATH install firmware in PATH" 9250b24e75fSPaolo Bonziniecho " --docdir=PATH install documentation in PATH" 9260b24e75fSPaolo Bonziniecho " --bindir=PATH install binaries in PATH" 9270b24e75fSPaolo Bonziniecho " --sysconfdir=PATH install config in PATH/qemu" 928f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 929f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 93009695a4aSStefan Weilecho " --enable-debug enable common debug build options" 931890b1658Saliguoriecho " --enable-sparse enable sparse checker" 932890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 9331625af87Saliguoriecho " --disable-strip disable stripping binaries" 93485aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 935fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 936c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 937821601eaSJes Sorensenecho " --disable-vnc disable VNC" 938821601eaSJes Sorensenecho " --enable-vnc enable VNC" 939af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 940c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 941c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 9424c9b53e3Smalcecho " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" 9434c9b53e3Smalcecho " Available cards: $audio_possible_cards" 944eb852011SMarkus Armbrusterecho " --block-drv-whitelist=L set block driver whitelist" 945eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 9468ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 947e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 948fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 9492e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 9504ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 9518d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 9521be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 9532f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 954ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 9552f6f5c7aSCorentin Charyecho " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" 9562f6f5c7aSCorentin Charyecho " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" 95796763cf9SCorentin Charyecho " --disable-vnc-png disable PNG compression for VNC server (default)" 958efe556adSCorentin Charyecho " --enable-vnc-png enable PNG compression for VNC server" 959bd023f95SCorentin Charyecho " --disable-vnc-thread disable threaded VNC server" 960bd023f95SCorentin Charyecho " --enable-vnc-thread enable threaded VNC server" 961af896aaaSpbrookecho " --disable-curses disable curses output" 962c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 963769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 964788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 9652df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 9662df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 9675495ed11SLuiz Capitulinoecho " --disable-check-utests disable check unit-tests" 9685495ed11SLuiz Capitulinoecho " --enable-check-utests enable check unit-tests" 969fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 970a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 9716093d3d4SPeter Maydellecho " --disable-slirp disable SLIRP userspace network connectivity" 9727ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 973b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 974bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 975e5934d33SAndre Przywaraecho " --enable-nptl enable usermode NPTL support" 976af5db58eSpbrookecho " --enable-system enable all system emulation targets" 977af5db58eSpbrookecho " --disable-system disable all system emulation targets" 9780953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 9790953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 980831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 981831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 982831b7825Sthsecho " --enable-darwin-user enable all darwin usermode emulation targets" 983831b7825Sthsecho " --disable-darwin-user disable all darwin usermode emulation targets" 98484778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 98584778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 986379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 987379f6698SPaul Brookecho " emulation targets" 988379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 98934005a00SKirill A. Shutemovecho " --enable-user-pie build usermode emulation targets as PIE" 99034005a00SKirill A. Shutemovecho " --disable-user-pie do not build usermode emulation targets as PIE" 991af5db58eSpbrookecho " --fmod-lib path to FMOD library" 992af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 9932f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 994c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 9953142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 996ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 997ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 998e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 999dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 10005c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 10015c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 1002758e8e38SVenkateswararao Jujjuri (JV)echo " --disable-attr disables attr and xattr support" 1003758e8e38SVenkateswararao Jujjuri (JV)echo " --enable-attr enable attr and xattr support" 1004e5d355d1Saliguoriecho " --enable-io-thread enable IO thread" 100577755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 1006d2807bc9SDirk Ullrichecho " --enable-docs enable documentation build" 1007d2807bc9SDirk Ullrichecho " --disable-docs disable documentation build" 1008d5970055SMichael S. Tsirkinecho " --disable-vhost-net disable vhost-net acceleration support" 1009d5970055SMichael S. Tsirkinecho " --enable-vhost-net enable vhost-net acceleration support" 1010320fba2aSFabien Chouteauecho " --enable-trace-backend=B Set trace backend" 1011320fba2aSFabien Chouteauecho " Available backends:" $("$source_path"/scripts/tracetool --list-backends) 101274242e0fSPaolo Bonziniecho " --with-trace-file=NAME Full PATH,NAME of file to store traces" 10139410b56cSPrerna Saxenaecho " Default:trace-<pid>" 1014cd4ec0b4SGerd Hoffmannecho " --disable-spice disable spice" 1015cd4ec0b4SGerd Hoffmannecho " --enable-spice enable spice" 1016f27aaf4bSChristian Brunnerecho " --enable-rbd enable building the rados block device (rbd)" 101736707144SAlon Levyecho " --disable-smartcard disable smartcard support" 101836707144SAlon Levyecho " --enable-smartcard enable smartcard support" 1019111a38b0SRobert Relyeaecho " --disable-smartcard-nss disable smartcard nss support" 1020111a38b0SRobert Relyeaecho " --enable-smartcard-nss enable smartcard nss support" 1021af5db58eSpbrookecho "" 10225bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 1023af5db58eSpbrookexit 1 1024af5db58eSpbrookfi 1025af5db58eSpbrook 10268d05095cSPaolo Bonzini# check that the C compiler works. 10278d05095cSPaolo Bonzinicat > $TMPC <<EOF 10288d05095cSPaolo Bonziniint main(void) {} 10298d05095cSPaolo BonziniEOF 10308d05095cSPaolo Bonzini 10318d05095cSPaolo Bonziniif compile_object ; then 10328d05095cSPaolo Bonzini : C compiler works ok 10338d05095cSPaolo Bonzinielse 10348d05095cSPaolo Bonzini echo "ERROR: \"$cc\" either does not exist or does not work" 10358d05095cSPaolo Bonzini exit 1 10368d05095cSPaolo Bonzinifi 10378d05095cSPaolo Bonzini 10388d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 10398d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 10408d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 1041f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags" 10428d05095cSPaolo Bonzinicat > $TMPC << EOF 10438d05095cSPaolo Bonziniint main(void) { return 0; } 10448d05095cSPaolo BonziniEOF 10458d05095cSPaolo Bonzinifor flag in $gcc_flags; do 10468d05095cSPaolo Bonzini if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then 10478d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 10488d05095cSPaolo Bonzini fi 10498d05095cSPaolo Bonzinidone 10508d05095cSPaolo Bonzini 1051ec530c81Sbellard# 1052ec530c81Sbellard# Solaris specific configure tool chain decisions 1053ec530c81Sbellard# 1054ec530c81Sbellardif test "$solaris" = "yes" ; then 10556792aa11SLoïc Minier if has $install; then 10566792aa11SLoïc Minier : 10576792aa11SLoïc Minier else 1058ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 1059ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 1060ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 1061ec530c81Sbellard exit 1 1062ec530c81Sbellard fi 10636792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 1064ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 1065ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 1066ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 1067ec530c81Sbellard exit 1 1068ec530c81Sbellard fi 10696792aa11SLoïc Minier if has ar; then 10706792aa11SLoïc Minier : 10716792aa11SLoïc Minier else 1072ec530c81Sbellard echo "Error: No path includes ar" 1073ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 1074ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 1075ec530c81Sbellard fi 1076ec530c81Sbellard exit 1 1077ec530c81Sbellard fi 1078ec530c81Sbellardfi 1079ec530c81Sbellard 10805327cf48Sbellardif test -z "$target_list" ; then 108160e0df25SPeter Maydell target_list="$default_target_list" 10826e20a45fSbellardelse 1083b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 10845327cf48Sbellardfi 10850a8e90f4Spbrookif test -z "$target_list" ; then 10860a8e90f4Spbrook echo "No targets enabled" 10870a8e90f4Spbrook exit 1 10880a8e90f4Spbrookfi 1089f55fe278SPaolo Bonzini# see if system emulation was really requested 1090f55fe278SPaolo Bonzinicase " $target_list " in 1091f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1092f55fe278SPaolo Bonzini ;; 1093f55fe278SPaolo Bonzini *) softmmu=no 1094f55fe278SPaolo Bonzini ;; 1095f55fe278SPaolo Bonziniesac 10965327cf48Sbellard 1097249247c9SJuan Quintelafeature_not_found() { 1098249247c9SJuan Quintela feature=$1 1099249247c9SJuan Quintela 1100249247c9SJuan Quintela echo "ERROR" 1101249247c9SJuan Quintela echo "ERROR: User requested feature $feature" 11029332f6a2SSebastian Herbszt echo "ERROR: configure was not able to find it" 1103249247c9SJuan Quintela echo "ERROR" 1104249247c9SJuan Quintela exit 1; 1105249247c9SJuan Quintela} 1106249247c9SJuan Quintela 11077d13299dSbellardif test -z "$cross_prefix" ; then 11087d13299dSbellard 11097d13299dSbellard# --- 11107d13299dSbellard# big/little endian test 11117d13299dSbellardcat > $TMPC << EOF 11127d13299dSbellard#include <inttypes.h> 11137d13299dSbellardint main(int argc, char ** argv){ 11147d13299dSbellard volatile uint32_t i=0x01234567; 11157d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 11167d13299dSbellard} 11177d13299dSbellardEOF 11187d13299dSbellard 111952166aa0SJuan Quintelaif compile_prog "" "" ; then 11207d13299dSbellard$TMPE && bigendian="yes" 11217d13299dSbellardelse 11227d13299dSbellardecho big/little test failed 11237d13299dSbellardfi 11247d13299dSbellard 11257d13299dSbellardelse 11267d13299dSbellard 11277d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 1128ea8f20f8SJuan Quintelacase "$cpu" in 112924e804ecSAlexander Graf armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 1130ea8f20f8SJuan Quintela bigendian=yes 1131ea8f20f8SJuan Quintela ;; 1132ea8f20f8SJuan Quintelaesac 11337d13299dSbellard 11347d13299dSbellardfi 11357d13299dSbellard 113670be1a2eSPaolo Bonzini# host long bits test, actually a pointer size test 113770be1a2eSPaolo Bonzinicat > $TMPC << EOF 113870be1a2eSPaolo Bonziniint sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1]; 113970be1a2eSPaolo BonziniEOF 114070be1a2eSPaolo Bonziniif compile_object; then 1141ea8f20f8SJuan Quintelahostlongbits=64 114270be1a2eSPaolo Bonzinielse 114370be1a2eSPaolo Bonzinihostlongbits=32 114470be1a2eSPaolo Bonzinifi 1145b6853697Sbellard 1146b0a47e79SJuan Quintela 1147b0a47e79SJuan Quintela########################################## 1148b0a47e79SJuan Quintela# NPTL probe 1149b0a47e79SJuan Quintela 1150b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then 1151bd0c5661Spbrook cat > $TMPC <<EOF 1152bd0c5661Spbrook#include <sched.h> 115330813ceaSpbrook#include <linux/futex.h> 1154bd0c5661Spbrookvoid foo() 1155bd0c5661Spbrook{ 1156bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1157bd0c5661Spbrook#error bork 1158bd0c5661Spbrook#endif 1159bd0c5661Spbrook} 1160bd0c5661SpbrookEOF 1161bd0c5661Spbrook 116252166aa0SJuan Quintela if compile_object ; then 1163b0a47e79SJuan Quintela nptl=yes 1164bd0c5661Spbrook else 1165b0a47e79SJuan Quintela if test "$nptl" = "yes" ; then 1166b0a47e79SJuan Quintela feature_not_found "nptl" 1167b0a47e79SJuan Quintela fi 1168b0a47e79SJuan Quintela nptl=no 1169b0a47e79SJuan Quintela fi 1170bd0c5661Spbrookfi 1171bd0c5661Spbrook 117211d9f695Sbellard########################################## 1173ac62922eSbalrog# zlib check 1174ac62922eSbalrog 1175ac62922eSbalrogcat > $TMPC << EOF 1176ac62922eSbalrog#include <zlib.h> 1177ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1178ac62922eSbalrogEOF 117952166aa0SJuan Quintelaif compile_prog "" "-lz" ; then 1180ac62922eSbalrog : 1181ac62922eSbalrogelse 1182ac62922eSbalrog echo 1183ac62922eSbalrog echo "Error: zlib check failed" 1184ac62922eSbalrog echo "Make sure to have the zlib libs and headers installed." 1185ac62922eSbalrog echo 1186ac62922eSbalrog exit 1 1187ac62922eSbalrogfi 1188ac62922eSbalrog 1189ac62922eSbalrog########################################## 1190e37630caSaliguori# xen probe 1191e37630caSaliguori 1192fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1193b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1194d5b93ddfSAnthony PERARD 1195d5b93ddfSAnthony PERARD # Xen unstable 1196e37630caSaliguori cat > $TMPC <<EOF 1197e37630caSaliguori#include <xenctrl.h> 1198e37630caSaliguori#include <xs.h> 1199d5b93ddfSAnthony PERARD#include <stdint.h> 1200d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1201d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1202d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1203d5b93ddfSAnthony PERARD#endif 1204d5b93ddfSAnthony PERARDint main(void) { 1205d5b93ddfSAnthony PERARD xc_interface *xc; 1206d5b93ddfSAnthony PERARD xs_daemon_open(); 1207d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 1208d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1209d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 1210b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 1211d5b93ddfSAnthony PERARD return 0; 1212d5b93ddfSAnthony PERARD} 1213e37630caSaliguoriEOF 121452166aa0SJuan Quintela if compile_prog "" "$xen_libs" ; then 1215d5b93ddfSAnthony PERARD xen_ctrl_version=410 1216fc321b4bSJuan Quintela xen=yes 1217d5b93ddfSAnthony PERARD 1218d5b93ddfSAnthony PERARD # Xen 4.0.0 1219d5b93ddfSAnthony PERARD elif ( 1220d5b93ddfSAnthony PERARD cat > $TMPC <<EOF 1221d5b93ddfSAnthony PERARD#include <xenctrl.h> 1222d5b93ddfSAnthony PERARD#include <xs.h> 1223d5b93ddfSAnthony PERARD#include <stdint.h> 1224d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1225d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1226d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1227d5b93ddfSAnthony PERARD#endif 1228d5b93ddfSAnthony PERARDint main(void) { 1229b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1230b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1231b87de24eSAnthony PERARD }; 1232d5b93ddfSAnthony PERARD xs_daemon_open(); 1233d5b93ddfSAnthony PERARD xc_interface_open(); 1234d5b93ddfSAnthony PERARD xc_gnttab_open(); 1235d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1236b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1237d5b93ddfSAnthony PERARD return 0; 1238d5b93ddfSAnthony PERARD} 1239d5b93ddfSAnthony PERARDEOF 1240d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 1241d5b93ddfSAnthony PERARD ) ; then 1242d5b93ddfSAnthony PERARD xen_ctrl_version=400 1243d5b93ddfSAnthony PERARD xen=yes 1244d5b93ddfSAnthony PERARD 1245b87de24eSAnthony PERARD # Xen 3.4.0 1246b87de24eSAnthony PERARD elif ( 1247b87de24eSAnthony PERARD cat > $TMPC <<EOF 1248b87de24eSAnthony PERARD#include <xenctrl.h> 1249b87de24eSAnthony PERARD#include <xs.h> 1250b87de24eSAnthony PERARDint main(void) { 1251b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1252b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1253b87de24eSAnthony PERARD }; 1254b87de24eSAnthony PERARD xs_daemon_open(); 1255b87de24eSAnthony PERARD xc_interface_open(); 1256b87de24eSAnthony PERARD xc_gnttab_open(); 1257b87de24eSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1258b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1259b87de24eSAnthony PERARD return 0; 1260b87de24eSAnthony PERARD} 1261b87de24eSAnthony PERARDEOF 1262b87de24eSAnthony PERARD compile_prog "" "$xen_libs" 1263b87de24eSAnthony PERARD ) ; then 1264b87de24eSAnthony PERARD xen_ctrl_version=340 1265b87de24eSAnthony PERARD xen=yes 1266b87de24eSAnthony PERARD 1267b87de24eSAnthony PERARD # Xen 3.3.0 1268d5b93ddfSAnthony PERARD elif ( 1269d5b93ddfSAnthony PERARD cat > $TMPC <<EOF 1270d5b93ddfSAnthony PERARD#include <xenctrl.h> 1271d5b93ddfSAnthony PERARD#include <xs.h> 1272d5b93ddfSAnthony PERARDint main(void) { 1273d5b93ddfSAnthony PERARD xs_daemon_open(); 1274d5b93ddfSAnthony PERARD xc_interface_open(); 1275d5b93ddfSAnthony PERARD xc_gnttab_open(); 1276d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1277d5b93ddfSAnthony PERARD return 0; 1278d5b93ddfSAnthony PERARD} 1279d5b93ddfSAnthony PERARDEOF 1280d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 1281d5b93ddfSAnthony PERARD ) ; then 1282d5b93ddfSAnthony PERARD xen_ctrl_version=330 1283d5b93ddfSAnthony PERARD xen=yes 1284d5b93ddfSAnthony PERARD 1285d5b93ddfSAnthony PERARD # Xen not found or unsupported 1286e37630caSaliguori else 1287fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 1288fc321b4bSJuan Quintela feature_not_found "xen" 1289fc321b4bSJuan Quintela fi 1290fc321b4bSJuan Quintela xen=no 1291e37630caSaliguori fi 1292d5b93ddfSAnthony PERARD 1293d5b93ddfSAnthony PERARD if test "$xen" = yes; then 1294d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 1295d5b93ddfSAnthony PERARD fi 1296e37630caSaliguorifi 1297e37630caSaliguori 1298e37630caSaliguori########################################## 1299a8bd70adSPaolo Bonzini# pkg-config probe 1300f91672e5SPaolo Bonzini 1301a8bd70adSPaolo Bonziniif ! has $pkg_config; then 130208421541SPaolo Bonzini echo warning: proceeding without "$pkg_config" >&2 130308421541SPaolo Bonzini pkg_config=/bin/false 1304f91672e5SPaolo Bonzinifi 1305f91672e5SPaolo Bonzini 1306f91672e5SPaolo Bonzini########################################## 130744dc0ca3SAlon Levy# libtool probe 130844dc0ca3SAlon Levy 130944dc0ca3SAlon Levyif ! has libtool; then 131044dc0ca3SAlon Levy libtool= 131144dc0ca3SAlon Levyelse 131244dc0ca3SAlon Levy libtool=libtool 131344dc0ca3SAlon Levyfi 131444dc0ca3SAlon Levy 131544dc0ca3SAlon Levy########################################## 1316dfffc653SJuan Quintela# Sparse probe 1317dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 13180dba6195SLoïc Minier if has cgcc; then 1319dfffc653SJuan Quintela sparse=yes 1320dfffc653SJuan Quintela else 1321dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 1322dfffc653SJuan Quintela feature_not_found "sparse" 1323dfffc653SJuan Quintela fi 1324dfffc653SJuan Quintela sparse=no 1325dfffc653SJuan Quintela fi 1326dfffc653SJuan Quintelafi 1327dfffc653SJuan Quintela 1328dfffc653SJuan Quintela########################################## 132911d9f695Sbellard# SDL probe 133011d9f695Sbellard 13313ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 13323ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 13333ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then 13343ec87ffeSPaolo Bonzini sdl_config=sdl-config 13353ec87ffeSPaolo Bonzinifi 13363ec87ffeSPaolo Bonzini 13373ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then 1338a8bd70adSPaolo Bonzini sdlconfig="$pkg_config sdl" 1339fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 13403ec87ffeSPaolo Bonzinielif has ${sdl_config}; then 13413ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 13429316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1343a0dfd8a4SLoïc Minierelse 1344a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 1345a0dfd8a4SLoïc Minier feature_not_found "sdl" 1346a0dfd8a4SLoïc Minier fi 1347a0dfd8a4SLoïc Minier sdl=no 13489316f803SPaolo Bonzinifi 134929e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 13503ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 13513ec87ffeSPaolo Bonzinifi 135211d9f695Sbellard 13539316f803SPaolo Bonzinisdl_too_old=no 1354c4198157SJuan Quintelaif test "$sdl" != "no" ; then 135511d9f695Sbellard cat > $TMPC << EOF 135611d9f695Sbellard#include <SDL.h> 135711d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 135811d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 135911d9f695SbellardEOF 13609316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 136174f42e18STeLeMan if test "$static" = "yes" ; then 136274f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 136374f42e18STeLeMan else 13649316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 136574f42e18STeLeMan fi 136652166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 136711d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 136811d9f695Sbellard sdl_too_old=yes 136911d9f695Sbellard else 1370fd677642Sths if test "$cocoa" = "no" ; then 137111d9f695Sbellard sdl=yes 137211d9f695Sbellard fi 1373fd677642Sths fi 13747c1f25b4Sbellard 137567c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 13761ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 137767c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 1378f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 1379f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 138011d9f695Sbellard fi 138152166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 13821ac88f28SJuan Quintela : 13831ac88f28SJuan Quintela else 13841ac88f28SJuan Quintela sdl=no 13857c1f25b4Sbellard fi 13867c1f25b4Sbellard fi # static link 1387c4198157SJuan Quintela else # sdl not found 1388c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1389c4198157SJuan Quintela feature_not_found "sdl" 1390c4198157SJuan Quintela fi 1391c4198157SJuan Quintela sdl=no 13927c1f25b4Sbellard fi # sdl compile test 1393fd677642Sthsfi 139411d9f695Sbellard 13955368a422Saliguoriif test "$sdl" = "yes" ; then 13965368a422Saliguori cat > $TMPC <<EOF 13975368a422Saliguori#include <SDL.h> 13985368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 13995368a422Saliguori#include <X11/XKBlib.h> 14005368a422Saliguori#else 14015368a422Saliguori#error No x11 support 14025368a422Saliguori#endif 14035368a422Saliguoriint main(void) { return 0; } 14045368a422SaliguoriEOF 140552166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1406681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 14075368a422Saliguori fi 140807d9ac44SJuan Quintela if test "$mingw32" = "yes" ; then 140907d9ac44SJuan Quintela sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole" 141007d9ac44SJuan Quintela fi 14110705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 14125368a422Saliguorifi 14135368a422Saliguori 14148f28f3fbSths########################################## 14158d5d2d4cSths# VNC TLS detection 1416821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then 1417ae6b5e5aSaliguori cat > $TMPC <<EOF 1418ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1419ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1420ae6b5e5aSaliguoriEOF 1421a8bd70adSPaolo Bonzini vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` 1422a8bd70adSPaolo Bonzini vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` 142352166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 14241be10ad2SJuan Quintela vnc_tls=yes 1425a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1426ae6b5e5aSaliguori else 14271be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 14281be10ad2SJuan Quintela feature_not_found "vnc-tls" 14291be10ad2SJuan Quintela fi 14301be10ad2SJuan Quintela vnc_tls=no 14318d5d2d4cSths fi 14328d5d2d4cSthsfi 14338d5d2d4cSths 14348d5d2d4cSths########################################## 14352f9606b3Saliguori# VNC SASL detection 1436821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then 14372f9606b3Saliguori cat > $TMPC <<EOF 14382f9606b3Saliguori#include <sasl/sasl.h> 14392f9606b3Saliguori#include <stdio.h> 14402f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 14412f9606b3SaliguoriEOF 14422f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 14432f9606b3Saliguori vnc_sasl_cflags="" 14442f9606b3Saliguori vnc_sasl_libs="-lsasl2" 144552166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1446ea784e3bSJuan Quintela vnc_sasl=yes 1447fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 14482f9606b3Saliguori else 1449ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1450ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1451ea784e3bSJuan Quintela fi 1452ea784e3bSJuan Quintela vnc_sasl=no 14532f9606b3Saliguori fi 14542f9606b3Saliguorifi 14552f9606b3Saliguori 14562f9606b3Saliguori########################################## 14572f6f5c7aSCorentin Chary# VNC JPEG detection 1458821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then 14592f6f5c7aSCorentin Charycat > $TMPC <<EOF 14602f6f5c7aSCorentin Chary#include <stdio.h> 14612f6f5c7aSCorentin Chary#include <jpeglib.h> 14622f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 14632f6f5c7aSCorentin CharyEOF 14642f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 14652f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 14662f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 14672f6f5c7aSCorentin Chary vnc_jpeg=yes 14682f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 14692f6f5c7aSCorentin Chary else 14702f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 14712f6f5c7aSCorentin Chary feature_not_found "vnc-jpeg" 14722f6f5c7aSCorentin Chary fi 14732f6f5c7aSCorentin Chary vnc_jpeg=no 14742f6f5c7aSCorentin Chary fi 14752f6f5c7aSCorentin Charyfi 14762f6f5c7aSCorentin Chary 14772f6f5c7aSCorentin Chary########################################## 1478efe556adSCorentin Chary# VNC PNG detection 1479821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then 1480efe556adSCorentin Charycat > $TMPC <<EOF 1481efe556adSCorentin Chary//#include <stdio.h> 1482efe556adSCorentin Chary#include <png.h> 1483832ce9c2SScott Wood#include <stddef.h> 1484efe556adSCorentin Charyint main(void) { 1485efe556adSCorentin Chary png_structp png_ptr; 1486efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 1487efe556adSCorentin Chary return 0; 1488efe556adSCorentin Chary} 1489efe556adSCorentin CharyEOF 1490efe556adSCorentin Chary vnc_png_cflags="" 1491efe556adSCorentin Chary vnc_png_libs="-lpng" 1492efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 1493efe556adSCorentin Chary vnc_png=yes 1494efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 1495efe556adSCorentin Chary else 1496efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 1497efe556adSCorentin Chary feature_not_found "vnc-png" 1498efe556adSCorentin Chary fi 1499efe556adSCorentin Chary vnc_png=no 1500efe556adSCorentin Chary fi 1501efe556adSCorentin Charyfi 1502efe556adSCorentin Chary 1503efe556adSCorentin Chary########################################## 150476655d6dSaliguori# fnmatch() probe, used for ACL routines 150576655d6dSaliguorifnmatch="no" 150676655d6dSaliguoricat > $TMPC << EOF 150776655d6dSaliguori#include <fnmatch.h> 150876655d6dSaliguoriint main(void) 150976655d6dSaliguori{ 151076655d6dSaliguori fnmatch("foo", "foo", 0); 151176655d6dSaliguori return 0; 151276655d6dSaliguori} 151376655d6dSaliguoriEOF 151452166aa0SJuan Quintelaif compile_prog "" "" ; then 151576655d6dSaliguori fnmatch="yes" 151676655d6dSaliguorifi 151776655d6dSaliguori 151876655d6dSaliguori########################################## 1519ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 1520ee682d27SStefan Weilif test "$uuid" != "no" ; then 1521ee682d27SStefan Weil uuid_libs="-luuid" 1522ee682d27SStefan Weil cat > $TMPC << EOF 1523ee682d27SStefan Weil#include <uuid/uuid.h> 1524ee682d27SStefan Weilint main(void) 1525ee682d27SStefan Weil{ 1526ee682d27SStefan Weil uuid_t my_uuid; 1527ee682d27SStefan Weil uuid_generate(my_uuid); 1528ee682d27SStefan Weil return 0; 1529ee682d27SStefan Weil} 1530ee682d27SStefan WeilEOF 1531ee682d27SStefan Weil if compile_prog "" "$uuid_libs" ; then 1532ee682d27SStefan Weil uuid="yes" 1533ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1534ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1535ee682d27SStefan Weil else 1536ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1537ee682d27SStefan Weil feature_not_found "uuid" 1538ee682d27SStefan Weil fi 1539ee682d27SStefan Weil uuid=no 1540ee682d27SStefan Weil fi 1541ee682d27SStefan Weilfi 1542ee682d27SStefan Weil 1543ee682d27SStefan Weil########################################## 1544dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix 1545dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 1546dce512deSChristoph Hellwig cat > $TMPC << EOF 1547dce512deSChristoph Hellwig#include <xfs/xfs.h> 1548dce512deSChristoph Hellwigint main(void) 1549dce512deSChristoph Hellwig{ 1550dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 1551dce512deSChristoph Hellwig return 0; 1552dce512deSChristoph Hellwig} 1553dce512deSChristoph HellwigEOF 1554dce512deSChristoph Hellwig if compile_prog "" "" ; then 1555dce512deSChristoph Hellwig xfs="yes" 1556dce512deSChristoph Hellwig else 1557dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 1558dce512deSChristoph Hellwig feature_not_found "xfs" 1559dce512deSChristoph Hellwig fi 1560dce512deSChristoph Hellwig xfs=no 1561dce512deSChristoph Hellwig fi 1562dce512deSChristoph Hellwigfi 1563dce512deSChristoph Hellwig 1564dce512deSChristoph Hellwig########################################## 15658a16d273Sths# vde libraries probe 1566dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 15674baae0acSJuan Quintela vde_libs="-lvdeplug" 15688a16d273Sths cat > $TMPC << EOF 15698a16d273Sths#include <libvdeplug.h> 15704a7f0e06Spbrookint main(void) 15714a7f0e06Spbrook{ 15724a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 15734a7f0e06Spbrook vde_open("", "", &a); 15744a7f0e06Spbrook return 0; 15754a7f0e06Spbrook} 15768a16d273SthsEOF 157752166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 15784baae0acSJuan Quintela vde=yes 15798e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 15808e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 1581dfb278bdSJuan Quintela else 1582dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 1583dfb278bdSJuan Quintela feature_not_found "vde" 1584dfb278bdSJuan Quintela fi 1585dfb278bdSJuan Quintela vde=no 15868a16d273Sths fi 15878a16d273Sthsfi 15888a16d273Sths 15898a16d273Sths########################################## 1590c2de5c91Smalc# Sound support libraries probe 15918f28f3fbSths 1592c2de5c91Smalcaudio_drv_probe() 1593c2de5c91Smalc{ 1594c2de5c91Smalc drv=$1 1595c2de5c91Smalc hdr=$2 1596c2de5c91Smalc lib=$3 1597c2de5c91Smalc exp=$4 1598c2de5c91Smalc cfl=$5 15998f28f3fbSths cat > $TMPC << EOF 1600c2de5c91Smalc#include <$hdr> 1601c2de5c91Smalcint main(void) { $exp } 16028f28f3fbSthsEOF 160352166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 16048f28f3fbSths : 16058f28f3fbSths else 16068f28f3fbSths echo 1607c2de5c91Smalc echo "Error: $drv check failed" 1608c2de5c91Smalc echo "Make sure to have the $drv libs and headers installed." 16098f28f3fbSths echo 16108f28f3fbSths exit 1 16118f28f3fbSths fi 1612c2de5c91Smalc} 1613c2de5c91Smalc 16142fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 1615c2de5c91Smalcfor drv in $audio_drv_list; do 1616c2de5c91Smalc case $drv in 1617c2de5c91Smalc alsa) 1618c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 1619c2de5c91Smalc "snd_pcm_t **handle; return snd_pcm_close(*handle);" 1620a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 1621c2de5c91Smalc ;; 1622c2de5c91Smalc 1623c2de5c91Smalc fmod) 1624c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 1625c2de5c91Smalc echo 1626c2de5c91Smalc echo "Error: You must specify path to FMOD library and headers" 1627c2de5c91Smalc echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 1628c2de5c91Smalc echo 1629c2de5c91Smalc exit 1 16308f28f3fbSths fi 1631c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 1632a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 1633c2de5c91Smalc ;; 1634c2de5c91Smalc 1635c2de5c91Smalc esd) 1636c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 1637a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 163867f86e8eSJuan Quintela audio_pt_int="yes" 1639c2de5c91Smalc ;; 1640b8e59f18Smalc 1641b8e59f18Smalc pa) 1642493abda6SAurelien Jarno audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \ 1643b8e59f18Smalc "pa_simple *s = NULL; pa_simple_free(s); return 0;" 1644493abda6SAurelien Jarno libs_softmmu="-lpulse -lpulse-simple $libs_softmmu" 164567f86e8eSJuan Quintela audio_pt_int="yes" 1646b8e59f18Smalc ;; 1647b8e59f18Smalc 1648997e690aSJuan Quintela coreaudio) 1649997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 1650997e690aSJuan Quintela ;; 1651997e690aSJuan Quintela 1652a4bf6780SJuan Quintela dsound) 1653a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 1654d5631638Smalc audio_win_int="yes" 1655a4bf6780SJuan Quintela ;; 1656a4bf6780SJuan Quintela 1657a4bf6780SJuan Quintela oss) 1658a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 1659a4bf6780SJuan Quintela ;; 1660a4bf6780SJuan Quintela 1661a4bf6780SJuan Quintela sdl|wav) 16622f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 16632f6a1ab0Sblueswir1 ;; 16642f6a1ab0Sblueswir1 1665d5631638Smalc winwave) 1666d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 1667d5631638Smalc audio_win_int="yes" 1668d5631638Smalc ;; 1669d5631638Smalc 1670e4c63a6aSmalc *) 16711c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 1672e4c63a6aSmalc echo 1673e4c63a6aSmalc echo "Error: Unknown driver '$drv' selected" 1674e4c63a6aSmalc echo "Possible drivers are: $audio_possible_drivers" 1675e4c63a6aSmalc echo 1676e4c63a6aSmalc exit 1 1677e4c63a6aSmalc } 1678e4c63a6aSmalc ;; 1679c2de5c91Smalc esac 1680c2de5c91Smalcdone 16818f28f3fbSths 16824d3b6f6eSbalrog########################################## 16832e4d9fb1Saurel32# BrlAPI probe 16842e4d9fb1Saurel32 16854ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 1686eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 16872e4d9fb1Saurel32 cat > $TMPC << EOF 16882e4d9fb1Saurel32#include <brlapi.h> 1689832ce9c2SScott Wood#include <stddef.h> 16902e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 16912e4d9fb1Saurel32EOF 169252166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 16932e4d9fb1Saurel32 brlapi=yes 1694264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 16954ffcedb6SJuan Quintela else 16964ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 16974ffcedb6SJuan Quintela feature_not_found "brlapi" 16984ffcedb6SJuan Quintela fi 16994ffcedb6SJuan Quintela brlapi=no 1700eb82284fSJuan Quintela fi 1701eb82284fSJuan Quintelafi 17022e4d9fb1Saurel32 17032e4d9fb1Saurel32########################################## 17044d3b6f6eSbalrog# curses probe 1705e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then 1706e095e2f3SStefan Weil curses_list="-lpdcurses" 1707e095e2f3SStefan Weilelse 17084f78ef9aSJuan Quintela curses_list="-lncurses -lcurses" 1709e095e2f3SStefan Weilfi 17104d3b6f6eSbalrog 1711c584a6d0SJuan Quintelaif test "$curses" != "no" ; then 1712c584a6d0SJuan Quintela curses_found=no 17134d3b6f6eSbalrog cat > $TMPC << EOF 17144d3b6f6eSbalrog#include <curses.h> 17155a8ff3aaSblueswir1#ifdef __OpenBSD__ 17165a8ff3aaSblueswir1#define resize_term resizeterm 17175a8ff3aaSblueswir1#endif 17185a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); } 17194d3b6f6eSbalrogEOF 17204f78ef9aSJuan Quintela for curses_lib in $curses_list; do 17214f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 1722c584a6d0SJuan Quintela curses_found=yes 17234f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 17244f78ef9aSJuan Quintela break 17254d3b6f6eSbalrog fi 17264f78ef9aSJuan Quintela done 1727c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 1728c584a6d0SJuan Quintela curses=yes 1729c584a6d0SJuan Quintela else 1730c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 1731c584a6d0SJuan Quintela feature_not_found "curses" 1732c584a6d0SJuan Quintela fi 1733c584a6d0SJuan Quintela curses=no 1734c584a6d0SJuan Quintela fi 17354f78ef9aSJuan Quintelafi 17364d3b6f6eSbalrog 1737414f0dabSblueswir1########################################## 1738769ce76dSAlexander Graf# curl probe 1739769ce76dSAlexander Graf 1740a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then 1741a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 17424e2b0658SPaolo Bonzinielse 17434e2b0658SPaolo Bonzini curlconfig=curl-config 17444e2b0658SPaolo Bonzinifi 17454e2b0658SPaolo Bonzini 1746788c8196SJuan Quintelaif test "$curl" != "no" ; then 1747769ce76dSAlexander Graf cat > $TMPC << EOF 1748769ce76dSAlexander Graf#include <curl/curl.h> 17490b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 1750769ce76dSAlexander GrafEOF 17514e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 17524e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 1753b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 1754769ce76dSAlexander Graf curl=yes 1755f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 1756f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 1757788c8196SJuan Quintela else 1758788c8196SJuan Quintela if test "$curl" = "yes" ; then 1759788c8196SJuan Quintela feature_not_found "curl" 1760788c8196SJuan Quintela fi 1761788c8196SJuan Quintela curl=no 1762769ce76dSAlexander Graf fi 1763769ce76dSAlexander Graffi # test "$curl" 1764769ce76dSAlexander Graf 1765769ce76dSAlexander Graf########################################## 17665495ed11SLuiz Capitulino# check framework probe 17675495ed11SLuiz Capitulino 17685495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then 17695495ed11SLuiz Capitulino cat > $TMPC << EOF 17705495ed11SLuiz Capitulino#include <check.h> 17715495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; } 17725495ed11SLuiz CapitulinoEOF 1773a8bd70adSPaolo Bonzini check_libs=`$pkg_config --libs check` 17745495ed11SLuiz Capitulino if compile_prog "" $check_libs ; then 17755495ed11SLuiz Capitulino check_utests=yes 17765495ed11SLuiz Capitulino libs_tools="$check_libs $libs_tools" 17775495ed11SLuiz Capitulino else 17785495ed11SLuiz Capitulino if test "$check_utests" = "yes" ; then 17795495ed11SLuiz Capitulino feature_not_found "check" 17805495ed11SLuiz Capitulino fi 17815495ed11SLuiz Capitulino check_utests=no 17825495ed11SLuiz Capitulino fi 17835495ed11SLuiz Capitulinofi # test "$check_utests" 17845495ed11SLuiz Capitulino 17855495ed11SLuiz Capitulino########################################## 1786fb599c9aSbalrog# bluez support probe 1787a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 1788e820e3f4Sbalrog cat > $TMPC << EOF 1789e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 1790e820e3f4Sbalrogint main(void) { return bt_error(0); } 1791e820e3f4SbalrogEOF 1792a8bd70adSPaolo Bonzini bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` 1793a8bd70adSPaolo Bonzini bluez_libs=`$pkg_config --libs bluez 2> /dev/null` 179452166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 1795a20a6f46SJuan Quintela bluez=yes 1796e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 1797e820e3f4Sbalrog else 1798a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 1799a20a6f46SJuan Quintela feature_not_found "bluez" 1800a20a6f46SJuan Quintela fi 1801e820e3f4Sbalrog bluez="no" 1802e820e3f4Sbalrog fi 1803fb599c9aSbalrogfi 1804fb599c9aSbalrog 1805fb599c9aSbalrog########################################## 1806e5d355d1Saliguori# pthread probe 1807de65fe0fSSebastian HerbsztPTHREADLIBS_LIST="-lpthread -lpthreadGC2" 18083c529d93Saliguori 1809e5d355d1Saliguoripthread=no 1810414f0dabSblueswir1cat > $TMPC << EOF 18113c529d93Saliguori#include <pthread.h> 1812de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; } 1813414f0dabSblueswir1EOF 1814bd00d539SAndreas Färberif compile_prog "" "" ; then 1815bd00d539SAndreas Färber pthread=yes 1816bd00d539SAndreas Färberelse 1817de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 181852166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 1819e5d355d1Saliguori pthread=yes 18205572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 1821de65fe0fSSebastian Herbszt break 1822414f0dabSblueswir1 fi 1823de65fe0fSSebastian Herbszt done 1824bd00d539SAndreas Färberfi 1825414f0dabSblueswir1 18264617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 18274dd75c70SChristoph Hellwig echo 18284dd75c70SChristoph Hellwig echo "Error: pthread check failed" 18294dd75c70SChristoph Hellwig echo "Make sure to have the pthread libs and headers installed." 18304dd75c70SChristoph Hellwig echo 18314dd75c70SChristoph Hellwig exit 1 1832e5d355d1Saliguorifi 1833e5d355d1Saliguori 1834bf9298b9Saliguori########################################## 1835f27aaf4bSChristian Brunner# rbd probe 1836f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 1837f27aaf4bSChristian Brunner cat > $TMPC <<EOF 1838f27aaf4bSChristian Brunner#include <stdio.h> 1839ad32e9c0SJosh Durgin#include <rbd/librbd.h> 1840f27aaf4bSChristian Brunnerint main(void) { 1841ad32e9c0SJosh Durgin rados_t cluster; 1842ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 1843f27aaf4bSChristian Brunner return 0; 1844f27aaf4bSChristian Brunner} 1845f27aaf4bSChristian BrunnerEOF 1846ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 1847f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 1848f27aaf4bSChristian Brunner rbd=yes 1849f27aaf4bSChristian Brunner libs_tools="$rbd_libs $libs_tools" 1850f27aaf4bSChristian Brunner libs_softmmu="$rbd_libs $libs_softmmu" 1851f27aaf4bSChristian Brunner else 1852f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 1853f27aaf4bSChristian Brunner feature_not_found "rados block device" 1854f27aaf4bSChristian Brunner fi 1855f27aaf4bSChristian Brunner rbd=no 1856f27aaf4bSChristian Brunner fi 1857f27aaf4bSChristian Brunnerfi 1858f27aaf4bSChristian Brunner 1859f27aaf4bSChristian Brunner########################################## 18605c6c3a6cSChristoph Hellwig# linux-aio probe 18615c6c3a6cSChristoph Hellwig 18625c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 18635c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 18645c6c3a6cSChristoph Hellwig#include <libaio.h> 18655c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 1866832ce9c2SScott Wood#include <stddef.h> 18675c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 18685c6c3a6cSChristoph HellwigEOF 18695c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 18705c6c3a6cSChristoph Hellwig linux_aio=yes 1871048d179fSPaul Brook libs_softmmu="$libs_softmmu -laio" 1872048d179fSPaul Brook libs_tools="$libs_tools -laio" 18735c6c3a6cSChristoph Hellwig else 18745c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 18755c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 18765c6c3a6cSChristoph Hellwig fi 18773cfcae3cSLuiz Capitulino linux_aio=no 18785c6c3a6cSChristoph Hellwig fi 18795c6c3a6cSChristoph Hellwigfi 18805c6c3a6cSChristoph Hellwig 18815c6c3a6cSChristoph Hellwig########################################## 1882758e8e38SVenkateswararao Jujjuri (JV)# attr probe 1883758e8e38SVenkateswararao Jujjuri (JV) 1884758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 1885758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 1886758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 1887758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 1888758e8e38SVenkateswararao Jujjuri (JV)#include <attr/xattr.h> 1889758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 1890758e8e38SVenkateswararao Jujjuri (JV)EOF 1891758e8e38SVenkateswararao Jujjuri (JV) if compile_prog "" "-lattr" ; then 1892758e8e38SVenkateswararao Jujjuri (JV) attr=yes 1893758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 1894758e8e38SVenkateswararao Jujjuri (JV) else 1895758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 1896758e8e38SVenkateswararao Jujjuri (JV) feature_not_found "ATTR" 1897758e8e38SVenkateswararao Jujjuri (JV) fi 1898758e8e38SVenkateswararao Jujjuri (JV) attr=no 1899758e8e38SVenkateswararao Jujjuri (JV) fi 1900758e8e38SVenkateswararao Jujjuri (JV)fi 1901758e8e38SVenkateswararao Jujjuri (JV) 1902758e8e38SVenkateswararao Jujjuri (JV)########################################## 1903bf9298b9Saliguori# iovec probe 1904bf9298b9Saliguoricat > $TMPC <<EOF 1905db34f0b3Sblueswir1#include <sys/types.h> 1906bf9298b9Saliguori#include <sys/uio.h> 1907db34f0b3Sblueswir1#include <unistd.h> 1908bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; } 1909bf9298b9SaliguoriEOF 1910bf9298b9Saliguoriiovec=no 191152166aa0SJuan Quintelaif compile_prog "" "" ; then 1912bf9298b9Saliguori iovec=yes 1913bf9298b9Saliguorifi 1914bf9298b9Saliguori 1915f652e6afSaurel32########################################## 1916ceb42de8Saliguori# preadv probe 1917ceb42de8Saliguoricat > $TMPC <<EOF 1918ceb42de8Saliguori#include <sys/types.h> 1919ceb42de8Saliguori#include <sys/uio.h> 1920ceb42de8Saliguori#include <unistd.h> 1921ceb42de8Saliguoriint main(void) { preadv; } 1922ceb42de8SaliguoriEOF 1923ceb42de8Saliguoripreadv=no 192452166aa0SJuan Quintelaif compile_prog "" "" ; then 1925ceb42de8Saliguori preadv=yes 1926ceb42de8Saliguorifi 1927ceb42de8Saliguori 1928ceb42de8Saliguori########################################## 1929f652e6afSaurel32# fdt probe 19302df87df7SJuan Quintelaif test "$fdt" != "no" ; then 1931b41af4baSJuan Quintela fdt_libs="-lfdt" 1932f652e6afSaurel32 cat > $TMPC << EOF 1933f652e6afSaurel32int main(void) { return 0; } 1934f652e6afSaurel32EOF 193552166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 1936f652e6afSaurel32 fdt=yes 19372df87df7SJuan Quintela else 19382df87df7SJuan Quintela if test "$fdt" = "yes" ; then 19392df87df7SJuan Quintela feature_not_found "fdt" 19402df87df7SJuan Quintela fi 1941de3a354aSMichael Walle fdt_libs= 19422df87df7SJuan Quintela fdt=no 1943f652e6afSaurel32 fi 1944f652e6afSaurel32fi 1945f652e6afSaurel32 194620ff075bSMichael Walle########################################## 194720ff075bSMichael Walle# opengl probe, used by milkymist-tmu2 194820ff075bSMichael Walleif test "$opengl" != "no" ; then 194920ff075bSMichael Walle opengl_libs="-lGL" 195020ff075bSMichael Walle cat > $TMPC << EOF 195120ff075bSMichael Walle#include <X11/Xlib.h> 195220ff075bSMichael Walle#include <GL/gl.h> 195320ff075bSMichael Walle#include <GL/glx.h> 195420ff075bSMichael Walleint main(void) { GL_VERSION; return 0; } 195520ff075bSMichael WalleEOF 195620ff075bSMichael Walle if compile_prog "" "-lGL" ; then 195720ff075bSMichael Walle opengl=yes 195820ff075bSMichael Walle else 195920ff075bSMichael Walle if test "$opengl" = "yes" ; then 196020ff075bSMichael Walle feature_not_found "opengl" 196120ff075bSMichael Walle fi 1962de3a354aSMichael Walle opengl_libs= 196320ff075bSMichael Walle opengl=no 196420ff075bSMichael Walle fi 196520ff075bSMichael Wallefi 196620ff075bSMichael Walle 19673b3f24adSaurel32# 19683b3f24adSaurel32# Check for xxxat() functions when we are building linux-user 19693b3f24adSaurel32# emulator. This is done because older glibc versions don't 19703b3f24adSaurel32# have syscall stubs for these implemented. 19713b3f24adSaurel32# 19723b3f24adSaurel32atfile=no 19733b3f24adSaurel32cat > $TMPC << EOF 19743b3f24adSaurel32#define _ATFILE_SOURCE 19753b3f24adSaurel32#include <sys/types.h> 19763b3f24adSaurel32#include <fcntl.h> 19773b3f24adSaurel32#include <unistd.h> 19783b3f24adSaurel32 19793b3f24adSaurel32int 19803b3f24adSaurel32main(void) 19813b3f24adSaurel32{ 19823b3f24adSaurel32 /* try to unlink nonexisting file */ 19833b3f24adSaurel32 return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); 19843b3f24adSaurel32} 19853b3f24adSaurel32EOF 198652166aa0SJuan Quintelaif compile_prog "" "" ; then 19873b3f24adSaurel32 atfile=yes 19883b3f24adSaurel32fi 19893b3f24adSaurel32 199039386ac7Saurel32# Check for inotify functions when we are building linux-user 19913b3f24adSaurel32# emulator. This is done because older glibc versions don't 19923b3f24adSaurel32# have syscall stubs for these implemented. In that case we 19933b3f24adSaurel32# don't provide them even if kernel supports them. 19943b3f24adSaurel32# 19953b3f24adSaurel32inotify=no 19963b3f24adSaurel32cat > $TMPC << EOF 19973b3f24adSaurel32#include <sys/inotify.h> 19983b3f24adSaurel32 19993b3f24adSaurel32int 20003b3f24adSaurel32main(void) 20013b3f24adSaurel32{ 20023b3f24adSaurel32 /* try to start inotify */ 20038690e420Saurel32 return inotify_init(); 20043b3f24adSaurel32} 20053b3f24adSaurel32EOF 200652166aa0SJuan Quintelaif compile_prog "" "" ; then 20073b3f24adSaurel32 inotify=yes 20083b3f24adSaurel32fi 20093b3f24adSaurel32 2010c05c7a73SRiku Voipioinotify1=no 2011c05c7a73SRiku Voipiocat > $TMPC << EOF 2012c05c7a73SRiku Voipio#include <sys/inotify.h> 2013c05c7a73SRiku Voipio 2014c05c7a73SRiku Voipioint 2015c05c7a73SRiku Voipiomain(void) 2016c05c7a73SRiku Voipio{ 2017c05c7a73SRiku Voipio /* try to start inotify */ 2018c05c7a73SRiku Voipio return inotify_init1(0); 2019c05c7a73SRiku Voipio} 2020c05c7a73SRiku VoipioEOF 2021c05c7a73SRiku Voipioif compile_prog "" "" ; then 2022c05c7a73SRiku Voipio inotify1=yes 2023c05c7a73SRiku Voipiofi 2024c05c7a73SRiku Voipio 2025ebc996f3SRiku Voipio# check if utimensat and futimens are supported 2026ebc996f3SRiku Voipioutimens=no 2027ebc996f3SRiku Voipiocat > $TMPC << EOF 2028ebc996f3SRiku Voipio#define _ATFILE_SOURCE 2029ebc996f3SRiku Voipio#include <stddef.h> 2030ebc996f3SRiku Voipio#include <fcntl.h> 2031ebc996f3SRiku Voipio 2032ebc996f3SRiku Voipioint main(void) 2033ebc996f3SRiku Voipio{ 2034ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 2035ebc996f3SRiku Voipio futimens(0, NULL); 2036ebc996f3SRiku Voipio return 0; 2037ebc996f3SRiku Voipio} 2038ebc996f3SRiku VoipioEOF 203952166aa0SJuan Quintelaif compile_prog "" "" ; then 2040ebc996f3SRiku Voipio utimens=yes 2041ebc996f3SRiku Voipiofi 2042ebc996f3SRiku Voipio 2043099d6b0fSRiku Voipio# check if pipe2 is there 2044099d6b0fSRiku Voipiopipe2=no 2045099d6b0fSRiku Voipiocat > $TMPC << EOF 2046099d6b0fSRiku Voipio#include <unistd.h> 2047099d6b0fSRiku Voipio#include <fcntl.h> 2048099d6b0fSRiku Voipio 2049099d6b0fSRiku Voipioint main(void) 2050099d6b0fSRiku Voipio{ 2051099d6b0fSRiku Voipio int pipefd[2]; 2052099d6b0fSRiku Voipio pipe2(pipefd, O_CLOEXEC); 2053099d6b0fSRiku Voipio return 0; 2054099d6b0fSRiku Voipio} 2055099d6b0fSRiku VoipioEOF 205652166aa0SJuan Quintelaif compile_prog "" "" ; then 2057099d6b0fSRiku Voipio pipe2=yes 2058099d6b0fSRiku Voipiofi 2059099d6b0fSRiku Voipio 206040ff6d7eSKevin Wolf# check if accept4 is there 206140ff6d7eSKevin Wolfaccept4=no 206240ff6d7eSKevin Wolfcat > $TMPC << EOF 206340ff6d7eSKevin Wolf#include <sys/socket.h> 206440ff6d7eSKevin Wolf#include <stddef.h> 206540ff6d7eSKevin Wolf 206640ff6d7eSKevin Wolfint main(void) 206740ff6d7eSKevin Wolf{ 206840ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 206940ff6d7eSKevin Wolf return 0; 207040ff6d7eSKevin Wolf} 207140ff6d7eSKevin WolfEOF 207240ff6d7eSKevin Wolfif compile_prog "" "" ; then 207340ff6d7eSKevin Wolf accept4=yes 207440ff6d7eSKevin Wolffi 207540ff6d7eSKevin Wolf 20763ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 20773ce34dfbSvibisreenivasansplice=no 20783ce34dfbSvibisreenivasancat > $TMPC << EOF 20793ce34dfbSvibisreenivasan#include <unistd.h> 20803ce34dfbSvibisreenivasan#include <fcntl.h> 20813ce34dfbSvibisreenivasan#include <limits.h> 20823ce34dfbSvibisreenivasan 20833ce34dfbSvibisreenivasanint main(void) 20843ce34dfbSvibisreenivasan{ 20853ce34dfbSvibisreenivasan int len, fd; 20863ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 20873ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 20883ce34dfbSvibisreenivasan return 0; 20893ce34dfbSvibisreenivasan} 20903ce34dfbSvibisreenivasanEOF 209152166aa0SJuan Quintelaif compile_prog "" "" ; then 20923ce34dfbSvibisreenivasan splice=yes 20933ce34dfbSvibisreenivasanfi 20943ce34dfbSvibisreenivasan 2095dcc38d1cSMarcelo Tosatti########################################## 2096dcc38d1cSMarcelo Tosatti# signalfd probe 2097dcc38d1cSMarcelo Tosattisignalfd="no" 2098dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 2099dcc38d1cSMarcelo Tosatti#define _GNU_SOURCE 2100dcc38d1cSMarcelo Tosatti#include <unistd.h> 2101dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 2102dcc38d1cSMarcelo Tosatti#include <signal.h> 2103dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 2104dcc38d1cSMarcelo TosattiEOF 2105dcc38d1cSMarcelo Tosatti 2106dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 2107dcc38d1cSMarcelo Tosatti signalfd=yes 2108de758970SJan Kiszkaelif test "$kvm" = "yes" -a "$io_thread" != "yes"; then 2109de758970SJan Kiszka echo 2110de758970SJan Kiszka echo "ERROR: Host kernel lacks signalfd() support," 2111de758970SJan Kiszka echo "but KVM depends on it when the IO thread is disabled." 2112de758970SJan Kiszka echo 2113de758970SJan Kiszka exit 1 2114dcc38d1cSMarcelo Tosattifi 2115dcc38d1cSMarcelo Tosatti 2116c2882b96SRiku Voipio# check if eventfd is supported 2117c2882b96SRiku Voipioeventfd=no 2118c2882b96SRiku Voipiocat > $TMPC << EOF 2119c2882b96SRiku Voipio#include <sys/eventfd.h> 2120c2882b96SRiku Voipio 2121c2882b96SRiku Voipioint main(void) 2122c2882b96SRiku Voipio{ 2123c2882b96SRiku Voipio int efd = eventfd(0, 0); 2124c2882b96SRiku Voipio return 0; 2125c2882b96SRiku Voipio} 2126c2882b96SRiku VoipioEOF 2127c2882b96SRiku Voipioif compile_prog "" "" ; then 2128c2882b96SRiku Voipio eventfd=yes 2129c2882b96SRiku Voipiofi 2130c2882b96SRiku Voipio 2131d0927938SUlrich Hecht# check for fallocate 2132d0927938SUlrich Hechtfallocate=no 2133d0927938SUlrich Hechtcat > $TMPC << EOF 2134d0927938SUlrich Hecht#include <fcntl.h> 2135d0927938SUlrich Hecht 2136d0927938SUlrich Hechtint main(void) 2137d0927938SUlrich Hecht{ 2138d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 2139d0927938SUlrich Hecht return 0; 2140d0927938SUlrich Hecht} 2141d0927938SUlrich HechtEOF 2142be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then 2143d0927938SUlrich Hecht fallocate=yes 2144d0927938SUlrich Hechtfi 2145d0927938SUlrich Hecht 2146c727f47dSPeter Maydell# check for sync_file_range 2147c727f47dSPeter Maydellsync_file_range=no 2148c727f47dSPeter Maydellcat > $TMPC << EOF 2149c727f47dSPeter Maydell#include <fcntl.h> 2150c727f47dSPeter Maydell 2151c727f47dSPeter Maydellint main(void) 2152c727f47dSPeter Maydell{ 2153c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 2154c727f47dSPeter Maydell return 0; 2155c727f47dSPeter Maydell} 2156c727f47dSPeter MaydellEOF 2157c727f47dSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2158c727f47dSPeter Maydell sync_file_range=yes 2159c727f47dSPeter Maydellfi 2160c727f47dSPeter Maydell 2161dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 2162dace20dcSPeter Maydellfiemap=no 2163dace20dcSPeter Maydellcat > $TMPC << EOF 2164dace20dcSPeter Maydell#include <sys/ioctl.h> 2165dace20dcSPeter Maydell#include <linux/fs.h> 2166dace20dcSPeter Maydell#include <linux/fiemap.h> 2167dace20dcSPeter Maydell 2168dace20dcSPeter Maydellint main(void) 2169dace20dcSPeter Maydell{ 2170dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 2171dace20dcSPeter Maydell return 0; 2172dace20dcSPeter Maydell} 2173dace20dcSPeter MaydellEOF 2174dace20dcSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2175dace20dcSPeter Maydell fiemap=yes 2176dace20dcSPeter Maydellfi 2177dace20dcSPeter Maydell 2178d0927938SUlrich Hecht# check for dup3 2179d0927938SUlrich Hechtdup3=no 2180d0927938SUlrich Hechtcat > $TMPC << EOF 2181d0927938SUlrich Hecht#include <unistd.h> 2182d0927938SUlrich Hecht 2183d0927938SUlrich Hechtint main(void) 2184d0927938SUlrich Hecht{ 2185d0927938SUlrich Hecht dup3(0, 0, 0); 2186d0927938SUlrich Hecht return 0; 2187d0927938SUlrich Hecht} 2188d0927938SUlrich HechtEOF 218978f5d726SJan Kiszkaif compile_prog "" "" ; then 2190d0927938SUlrich Hecht dup3=yes 2191d0927938SUlrich Hechtfi 2192d0927938SUlrich Hecht 21933b6edd16SPeter Maydell# check for epoll support 21943b6edd16SPeter Maydellepoll=no 21953b6edd16SPeter Maydellcat > $TMPC << EOF 21963b6edd16SPeter Maydell#include <sys/epoll.h> 21973b6edd16SPeter Maydell 21983b6edd16SPeter Maydellint main(void) 21993b6edd16SPeter Maydell{ 22003b6edd16SPeter Maydell epoll_create(0); 22013b6edd16SPeter Maydell return 0; 22023b6edd16SPeter Maydell} 22033b6edd16SPeter MaydellEOF 22043b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 22053b6edd16SPeter Maydell epoll=yes 22063b6edd16SPeter Maydellfi 22073b6edd16SPeter Maydell 22083b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions 22093b6edd16SPeter Maydell# so we must check separately for their presence 22103b6edd16SPeter Maydellepoll_create1=no 22113b6edd16SPeter Maydellcat > $TMPC << EOF 22123b6edd16SPeter Maydell#include <sys/epoll.h> 22133b6edd16SPeter Maydell 22143b6edd16SPeter Maydellint main(void) 22153b6edd16SPeter Maydell{ 221619e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 221719e83f6bSPeter Maydell * a function being called. This is necessary so that on 221819e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 221919e83f6bSPeter Maydell * the library but not declared in the header file we will 222019e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 222119e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 222219e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 222319e83f6bSPeter Maydell */ 222419e83f6bSPeter Maydell epoll_create1; 22253b6edd16SPeter Maydell return 0; 22263b6edd16SPeter Maydell} 22273b6edd16SPeter MaydellEOF 22283b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 22293b6edd16SPeter Maydell epoll_create1=yes 22303b6edd16SPeter Maydellfi 22313b6edd16SPeter Maydell 22323b6edd16SPeter Maydellepoll_pwait=no 22333b6edd16SPeter Maydellcat > $TMPC << EOF 22343b6edd16SPeter Maydell#include <sys/epoll.h> 22353b6edd16SPeter Maydell 22363b6edd16SPeter Maydellint main(void) 22373b6edd16SPeter Maydell{ 22383b6edd16SPeter Maydell epoll_pwait(0, 0, 0, 0, 0); 22393b6edd16SPeter Maydell return 0; 22403b6edd16SPeter Maydell} 22413b6edd16SPeter MaydellEOF 22423b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 22433b6edd16SPeter Maydell epoll_pwait=yes 22443b6edd16SPeter Maydellfi 22453b6edd16SPeter Maydell 2246cc8ae6deSpbrook# Check if tools are available to build documentation. 2247a25dba17SJuan Quintelaif test "$docs" != "no" ; then 224801668d98SStefan Weil if has makeinfo && has pod2man; then 2249a25dba17SJuan Quintela docs=yes 225083a3ab8bSJuan Quintela else 2251a25dba17SJuan Quintela if test "$docs" = "yes" ; then 2252a25dba17SJuan Quintela feature_not_found "docs" 225383a3ab8bSJuan Quintela fi 2254a25dba17SJuan Quintela docs=no 225583a3ab8bSJuan Quintela fi 2256cc8ae6deSpbrookfi 2257cc8ae6deSpbrook 2258f514f41cSStefan Weil# Search for bswap_32 function 22596ae9a1f4SJuan Quintelabyteswap_h=no 22606ae9a1f4SJuan Quintelacat > $TMPC << EOF 22616ae9a1f4SJuan Quintela#include <byteswap.h> 22626ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 22636ae9a1f4SJuan QuintelaEOF 226452166aa0SJuan Quintelaif compile_prog "" "" ; then 22656ae9a1f4SJuan Quintela byteswap_h=yes 22666ae9a1f4SJuan Quintelafi 22676ae9a1f4SJuan Quintela 2268f514f41cSStefan Weil# Search for bswap_32 function 22696ae9a1f4SJuan Quintelabswap_h=no 22706ae9a1f4SJuan Quintelacat > $TMPC << EOF 22716ae9a1f4SJuan Quintela#include <sys/endian.h> 22726ae9a1f4SJuan Quintela#include <sys/types.h> 22736ae9a1f4SJuan Quintela#include <machine/bswap.h> 22746ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 22756ae9a1f4SJuan QuintelaEOF 227652166aa0SJuan Quintelaif compile_prog "" "" ; then 22776ae9a1f4SJuan Quintela bswap_h=yes 22786ae9a1f4SJuan Quintelafi 22796ae9a1f4SJuan Quintela 2280da93a1fdSaliguori########################################## 2281da93a1fdSaliguori# Do we need librt 2282da93a1fdSaliguoricat > $TMPC <<EOF 2283da93a1fdSaliguori#include <signal.h> 2284da93a1fdSaliguori#include <time.h> 2285da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); } 2286da93a1fdSaliguoriEOF 2287da93a1fdSaliguori 228852166aa0SJuan Quintelaif compile_prog "" "" ; then 228907ffa4bdSJuan Quintela : 229052166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then 229107ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 2292da93a1fdSaliguorifi 2293da93a1fdSaliguori 229431ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 2295179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 22966362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 22976362a53fSJuan Quintelafi 22986362a53fSJuan Quintela 2299de5071c5SBlue Swirl########################################## 2300de5071c5SBlue Swirl# check if the compiler defines offsetof 2301de5071c5SBlue Swirl 2302de5071c5SBlue Swirlneed_offsetof=yes 2303de5071c5SBlue Swirlcat > $TMPC << EOF 2304de5071c5SBlue Swirl#include <stddef.h> 2305de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); } 2306de5071c5SBlue SwirlEOF 2307de5071c5SBlue Swirlif compile_prog "" "" ; then 2308de5071c5SBlue Swirl need_offsetof=no 2309de5071c5SBlue Swirlfi 2310de5071c5SBlue Swirl 23115f6b9e8fSBlue Swirl########################################## 2312747bbdf7SBlue Swirl# check if the compiler understands attribute warn_unused_result 2313747bbdf7SBlue Swirl# 2314747bbdf7SBlue Swirl# This could be smarter, but gcc -Werror does not error out even when warning 2315747bbdf7SBlue Swirl# about attribute warn_unused_result 2316747bbdf7SBlue Swirl 2317747bbdf7SBlue Swirlgcc_attribute_warn_unused_result=no 2318747bbdf7SBlue Swirlcat > $TMPC << EOF 2319747bbdf7SBlue Swirl#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4) 2320747bbdf7SBlue Swirl#error gcc 3.3 or older 2321747bbdf7SBlue Swirl#endif 2322747bbdf7SBlue Swirlint main(void) { return 0;} 2323747bbdf7SBlue SwirlEOF 2324747bbdf7SBlue Swirlif compile_prog "" ""; then 2325747bbdf7SBlue Swirl gcc_attribute_warn_unused_result=yes 2326747bbdf7SBlue Swirlfi 2327747bbdf7SBlue Swirl 2328cd4ec0b4SGerd Hoffmann# spice probe 2329cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 2330cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 2331cd4ec0b4SGerd Hoffmann#include <spice.h> 2332cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 2333cd4ec0b4SGerd HoffmannEOF 2334710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 2335710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 2336012b80d3SGerd Hoffmann if $pkg_config --atleast-version=0.6.0 spice-server >/dev/null 2>&1 && \ 2337cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 2338cd4ec0b4SGerd Hoffmann spice="yes" 2339cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 2340cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 2341cd4ec0b4SGerd Hoffmann else 2342cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 2343cd4ec0b4SGerd Hoffmann feature_not_found "spice" 2344cd4ec0b4SGerd Hoffmann fi 2345cd4ec0b4SGerd Hoffmann spice="no" 2346cd4ec0b4SGerd Hoffmann fi 2347cd4ec0b4SGerd Hoffmannfi 2348cd4ec0b4SGerd Hoffmann 2349111a38b0SRobert Relyea# check for libcacard for smartcard support 2350111a38b0SRobert Relyeaif test "$smartcard" != "no" ; then 2351111a38b0SRobert Relyea smartcard="yes" 2352111a38b0SRobert Relyea smartcard_cflags="" 2353111a38b0SRobert Relyea # TODO - what's the minimal nss version we support? 2354111a38b0SRobert Relyea if test "$smartcard_nss" != "no"; then 2355111a38b0SRobert Relyea if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 ; then 2356111a38b0SRobert Relyea smartcard_nss="yes" 2357111a38b0SRobert Relyea smartcard_cflags="-I\$(SRC_PATH)/libcacard" 2358111a38b0SRobert Relyea libcacard_libs=$($pkg_config --libs nss 2>/dev/null) 2359111a38b0SRobert Relyea libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null) 2360111a38b0SRobert Relyea QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags" 2361111a38b0SRobert Relyea LIBS="$libcacard_libs $LIBS" 2362111a38b0SRobert Relyea else 2363111a38b0SRobert Relyea if test "$smartcard_nss" = "yes"; then 2364111a38b0SRobert Relyea feature_not_found "nss" 2365111a38b0SRobert Relyea fi 2366111a38b0SRobert Relyea smartcard_nss="no" 2367111a38b0SRobert Relyea fi 2368111a38b0SRobert Relyea fi 2369111a38b0SRobert Relyeafi 2370111a38b0SRobert Relyeaif test "$smartcard" = "no" ; then 2371111a38b0SRobert Relyea smartcard_nss="no" 2372111a38b0SRobert Relyeafi 2373111a38b0SRobert Relyea 2374cd4ec0b4SGerd Hoffmann########################################## 2375cd4ec0b4SGerd Hoffmann 2376747bbdf7SBlue Swirl########################################## 23775f6b9e8fSBlue Swirl# check if we have fdatasync 23785f6b9e8fSBlue Swirl 23795f6b9e8fSBlue Swirlfdatasync=no 23805f6b9e8fSBlue Swirlcat > $TMPC << EOF 23815f6b9e8fSBlue Swirl#include <unistd.h> 2382d1722a27SAlexandre Raymondint main(void) { 2383d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 2384d1722a27SAlexandre Raymondreturn fdatasync(0); 2385d1722a27SAlexandre Raymond#else 2386d1722a27SAlexandre Raymond#abort Not supported 2387d1722a27SAlexandre Raymond#endif 2388d1722a27SAlexandre Raymond} 23895f6b9e8fSBlue SwirlEOF 23905f6b9e8fSBlue Swirlif compile_prog "" "" ; then 23915f6b9e8fSBlue Swirl fdatasync=yes 23925f6b9e8fSBlue Swirlfi 23935f6b9e8fSBlue Swirl 239494a420b1SStefan Hajnoczi########################################## 2395e78815a5SAndreas Färber# check if we have madvise 2396e78815a5SAndreas Färber 2397e78815a5SAndreas Färbermadvise=no 2398e78815a5SAndreas Färbercat > $TMPC << EOF 2399e78815a5SAndreas Färber#include <sys/types.h> 2400e78815a5SAndreas Färber#include <sys/mman.h> 2401832ce9c2SScott Wood#include <stddef.h> 2402e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 2403e78815a5SAndreas FärberEOF 2404e78815a5SAndreas Färberif compile_prog "" "" ; then 2405e78815a5SAndreas Färber madvise=yes 2406e78815a5SAndreas Färberfi 2407e78815a5SAndreas Färber 2408e78815a5SAndreas Färber########################################## 2409e78815a5SAndreas Färber# check if we have posix_madvise 2410e78815a5SAndreas Färber 2411e78815a5SAndreas Färberposix_madvise=no 2412e78815a5SAndreas Färbercat > $TMPC << EOF 2413e78815a5SAndreas Färber#include <sys/mman.h> 2414832ce9c2SScott Wood#include <stddef.h> 2415e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 2416e78815a5SAndreas FärberEOF 2417e78815a5SAndreas Färberif compile_prog "" "" ; then 2418e78815a5SAndreas Färber posix_madvise=yes 2419e78815a5SAndreas Färberfi 2420e78815a5SAndreas Färber 2421e78815a5SAndreas Färber########################################## 242294a420b1SStefan Hajnoczi# check if trace backend exists 242394a420b1SStefan Hajnoczi 24244c3b5a48SBlue Swirlsh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null 242594a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 242694a420b1SStefan Hajnoczi echo 242794a420b1SStefan Hajnoczi echo "Error: invalid trace backend" 242894a420b1SStefan Hajnoczi echo "Please choose a supported trace backend." 242994a420b1SStefan Hajnoczi echo 243094a420b1SStefan Hajnoczi exit 1 243194a420b1SStefan Hajnoczifi 243294a420b1SStefan Hajnoczi 24337e24e92aSStefan Hajnoczi########################################## 24347e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 24357e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then 24367e24e92aSStefan Hajnoczi cat > $TMPC << EOF 24377e24e92aSStefan Hajnoczi#include <ust/tracepoint.h> 24387e24e92aSStefan Hajnoczi#include <ust/marker.h> 24397e24e92aSStefan Hajnocziint main(void) { return 0; } 24407e24e92aSStefan HajnocziEOF 24417e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 24427e24e92aSStefan Hajnoczi LIBS="-lust $LIBS" 24437e24e92aSStefan Hajnoczi else 24447e24e92aSStefan Hajnoczi echo 24457e24e92aSStefan Hajnoczi echo "Error: Trace backend 'ust' missing libust header files" 24467e24e92aSStefan Hajnoczi echo 24477e24e92aSStefan Hajnoczi exit 1 24487e24e92aSStefan Hajnoczi fi 24497e24e92aSStefan Hajnoczifi 2450b3d08c02SDaniel P. Berrange 2451b3d08c02SDaniel P. Berrange########################################## 2452b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 2453b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then 2454b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 2455b3d08c02SDaniel P. Berrange echo 2456b3d08c02SDaniel P. Berrange echo "Error: dtrace command is not found in PATH $PATH" 2457b3d08c02SDaniel P. Berrange echo 2458b3d08c02SDaniel P. Berrange exit 1 2459b3d08c02SDaniel P. Berrange fi 2460c276b17dSDaniel P. Berrange trace_backend_stap="no" 2461c276b17dSDaniel P. Berrange if has 'stap' ; then 2462c276b17dSDaniel P. Berrange trace_backend_stap="yes" 2463c276b17dSDaniel P. Berrange fi 2464b3d08c02SDaniel P. Berrangefi 2465b3d08c02SDaniel P. Berrange 24667e24e92aSStefan Hajnoczi########################################## 2467e86ecd4bSJuan Quintela# End of CC checks 2468e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 2469e86ecd4bSJuan Quintela 2470e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then 24711156c669SJuan Quintela CFLAGS="-O2 $CFLAGS" 2472e86ecd4bSJuan Quintelafi 2473a316e378SJuan Quintela 2474e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror 2475e86ecd4bSJuan Quintela# by default. Only enable by default for git builds 2476e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION` 247720ff6c80SAnthony Liguori 247820ff6c80SAnthony Liguoriif test -z "$werror" ; then 2479e86ecd4bSJuan Quintela if test "$z_version" = "50" -a \ 2480e86ecd4bSJuan Quintela "$linux" = "yes" ; then 2481e86ecd4bSJuan Quintela werror="yes" 2482e86ecd4bSJuan Quintela else 2483e86ecd4bSJuan Quintela werror="no" 2484e86ecd4bSJuan Quintela fi 2485e86ecd4bSJuan Quintelafi 2486e86ecd4bSJuan Quintela 248720ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 248820ff6c80SAnthony Liguori# enable/disable 248920ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 249020ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 249120ff6c80SAnthony Liguori zero_malloc="no" 249220ff6c80SAnthony Liguori else 249320ff6c80SAnthony Liguori zero_malloc="yes" 249420ff6c80SAnthony Liguori fi 249520ff6c80SAnthony Liguorifi 249620ff6c80SAnthony Liguori 2497e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then 2498a558ee17SJuan Quintela QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 2499e86ecd4bSJuan Quintelafi 2500e86ecd4bSJuan Quintela 2501e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 2502e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 25031156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 2504e86ecd4bSJuan Quintela fi 2505e86ecd4bSJuan Quintelafi 2506e86ecd4bSJuan Quintela 2507952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 2508952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 2509952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 2510952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 2511952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 2512952afb71SBlue Swirl fi 2513952afb71SBlue Swirl done 2514952afb71SBlue Swirlfi 2515952afb71SBlue Swirl 2516190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix 25175a67135aSbellard 2518ca35f780SPaolo Bonzinitools= 2519ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then 2520ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 2521ca35f780SPaolo Bonzini if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 2522ca35f780SPaolo Bonzini tools="qemu-nbd\$(EXESUF) $tools" 2523ca35f780SPaolo Bonzini if [ "$check_utests" = "yes" ]; then 2524ca35f780SPaolo Bonzini tools="check-qint check-qstring check-qdict check-qlist $tools" 2525ca35f780SPaolo Bonzini tools="check-qfloat check-qjson $tools" 2526ca35f780SPaolo Bonzini fi 2527ca35f780SPaolo Bonzini fi 2528ca35f780SPaolo Bonzinifi 2529ca35f780SPaolo Bonzini 2530ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 2531ca35f780SPaolo Bonziniroms= 2532ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 2533ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 2534ca35f780SPaolo Bonzini "$softmmu" = yes ; then 2535ca35f780SPaolo Bonzini roms="optionrom" 2536ca35f780SPaolo Bonzinifi 2537d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then 253839ac8455SDavid Gibson roms="$roms spapr-rtas" 253939ac8455SDavid Gibsonfi 2540ca35f780SPaolo Bonzini 25417d13299dSbellardecho "Install prefix $prefix" 2542f2b9e1e3SPaolo Bonziniecho "BIOS directory `eval echo $datadir`" 2543f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 25443aa5d2beSAlon Levyecho "library directory `eval echo $libdir`" 25451c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 254611d9f695Sbellardif test "$mingw32" = "no" ; then 2547f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 254843ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 254911d9f695Sbellardfi 25505a67135aSbellardecho "Source path $source_path" 25517d13299dSbellardecho "C compiler $cc" 255283469015Sbellardecho "Host C compiler $host_cc" 25530c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 2554a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 25550c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 25567d13299dSbellardecho "make $make" 25576a882643Spbrookecho "install $install" 2558a98fd896Sbellardecho "host CPU $cpu" 2559de83cd02Sbellardecho "host big endian $bigendian" 256097a847bcSbellardecho "target list $target_list" 2561ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 2562b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon" 25637d13299dSbellardecho "gprof enabled $gprof" 256403b4fe7dSaliguoriecho "sparse enabled $sparse" 25651625af87Saliguoriecho "strip binaries $strip_opt" 256605c2a3e7Sbellardecho "profiler $profiler" 256743ce4dfeSbellardecho "static build $static" 256885aa5189Sbellardecho "-Werror enabled $werror" 25695b0753e0Sbellardif test "$darwin" = "yes" ; then 25705b0753e0Sbellard echo "Cocoa support $cocoa" 25715b0753e0Sbellardfi 257297a847bcSbellardecho "SDL support $sdl" 25734d3b6f6eSbalrogecho "curses support $curses" 2574769ce76dSAlexander Grafecho "curl support $curl" 25755495ed11SLuiz Capitulinoecho "check support $check_utests" 257667b915a5Sbellardecho "mingw32 support $mingw32" 25770c58ac1cSmalcecho "Audio drivers $audio_drv_list" 25780c58ac1cSmalcecho "Extra audio cards $audio_card_list" 2579eb852011SMarkus Armbrusterecho "Block whitelist $block_drv_whitelist" 25808ff9cbf7Smalcecho "Mixer emulation $mixemu" 2581821601eaSJes Sorensenecho "VNC support $vnc" 2582821601eaSJes Sorensenif test "$vnc" = "yes" ; then 25838d5d2d4cSths echo "VNC TLS support $vnc_tls" 25842f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 25852f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 2586efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 2587bd023f95SCorentin Chary echo "VNC thread $vnc_thread" 2588821601eaSJes Sorensenfi 25893142255cSblueswir1if test -n "$sparc_cpu"; then 25903142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 25913142255cSblueswir1fi 2592e37630caSaliguoriecho "xen support $xen" 25932e4d9fb1Saurel32echo "brlapi support $brlapi" 2594a20a6f46SJuan Quintelaecho "bluez support $bluez" 2595a25dba17SJuan Quintelaecho "Documentation $docs" 2596c5937220Spbrook[ ! -z "$uname_release" ] && \ 2597c5937220Spbrookecho "uname -r $uname_release" 2598bd0c5661Spbrookecho "NPTL support $nptl" 2599379f6698SPaul Brookecho "GUEST_BASE $guest_base" 260034005a00SKirill A. Shutemovecho "PIE user targets $user_pie" 26018a16d273Sthsecho "vde support $vde" 2602e5d355d1Saliguoriecho "IO thread $io_thread" 26035c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 2604758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 260577755340Sthsecho "Install blobs $blobs" 2606b31a0277SJuan Quintelaecho "KVM support $kvm" 2607f652e6afSaurel32echo "fdt support $fdt" 2608ceb42de8Saliguoriecho "preadv support $preadv" 26095f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 2610e78815a5SAndreas Färberecho "madvise $madvise" 2611e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 2612ee682d27SStefan Weilecho "uuid support $uuid" 2613d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 261494a420b1SStefan Hajnocziecho "Trace backend $trace_backend" 26159410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 2616cd4ec0b4SGerd Hoffmannecho "spice support $spice" 2617f27aaf4bSChristian Brunnerecho "rbd support $rbd" 2618dce512deSChristoph Hellwigecho "xfsctl support $xfs" 2619111a38b0SRobert Relyeaecho "nss used $smartcard_nss" 262020ff075bSMichael Walleecho "OpenGL support $opengl" 262167b915a5Sbellard 262297a847bcSbellardif test $sdl_too_old = "yes"; then 262324b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 2624e8cd23deSbellardfi 262597a847bcSbellard 262698ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 26274bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld" 262897a847bcSbellard 262998ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 263098ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 263198ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 263298ec69acSJuan Quintelaecho >> $config_host_mak 263398ec69acSJuan Quintela 2634e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 263599d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 263699d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 26373aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 263899d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 263999d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak 264099d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 264199d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak 26421dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak 2643804edf29SJuan Quintela 26442408a527Saurel32case "$cpu" in 2645d2fbca94SGuan Xuetao i386|x86_64|alpha|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64|unicore32) 2646e0da9dd3SJuan Quintela ARCH=$cpu 26472408a527Saurel32 ;; 2648a302c32dSLaurent Desnogues armv4b|armv4l) 264916dbd14fSJuan Quintela ARCH=arm 26502408a527Saurel32 ;; 26512408a527Saurel32esac 265298ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 2653f8393946Saurel32if test "$debug_tcg" = "yes" ; then 26542358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 2655f8393946Saurel32fi 2656b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then 2657b4475aa2SLuiz Capitulino echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak 2658b4475aa2SLuiz Capitulinofi 2659f3d08ee6SPaul Brookif test "$debug" = "yes" ; then 26602358a494SJuan Quintela echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak 2661f3d08ee6SPaul Brookfi 26621625af87Saliguoriif test "$strip_opt" = "yes" ; then 266352ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 26641625af87Saliguorifi 26657d13299dSbellardif test "$bigendian" = "yes" ; then 2666e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 266797a847bcSbellardfi 26682358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak 266967b915a5Sbellardif test "$mingw32" = "yes" ; then 267098ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 26719fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 26729fe6de94SBlue Swirl version_major=${rc_version%%.*} 26739fe6de94SBlue Swirl rc_version=${rc_version#*.} 26749fe6de94SBlue Swirl version_minor=${rc_version%%.*} 26759fe6de94SBlue Swirl rc_version=${rc_version#*.} 26769fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 26779fe6de94SBlue Swirl version_micro=0 26789fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 26799fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 2680210fa556Spbrookelse 268135f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 2682210fa556Spbrookfi 2683128ab2ffSblueswir1 2684dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 2685dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 2686dffcb71cSMark McLoughlinfi 2687dffcb71cSMark McLoughlin 268883fb7adfSbellardif test "$darwin" = "yes" ; then 268998ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 269083fb7adfSbellardfi 2691b29fe3edSmalc 2692b29fe3edSmalcif test "$aix" = "yes" ; then 269398ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 2694b29fe3edSmalcfi 2695b29fe3edSmalc 2696ec530c81Sbellardif test "$solaris" = "yes" ; then 269798ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 26982358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 26990475a5caSths if test "$needs_libsunmath" = "yes" ; then 270075b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 27010475a5caSths fi 2702ec530c81Sbellardfi 2703179cf400SAndreas Färberif test "$haiku" = "yes" ; then 2704179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 2705179cf400SAndreas Färberfi 270697a847bcSbellardif test "$static" = "yes" ; then 270798ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 270897a847bcSbellardfi 270905c2a3e7Sbellardif test $profiler = "yes" ; then 27102358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 271105c2a3e7Sbellardfi 2712c20709aaSbellardif test "$slirp" = "yes" ; then 271398ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 2714f9728943SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES" 2715c20709aaSbellardfi 27168a16d273Sthsif test "$vde" = "yes" ; then 271798ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 27188a16d273Sthsfi 27190c58ac1cSmalcfor card in $audio_card_list; do 2720f6e5889eSpbrook def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` 272198ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 27220c58ac1cSmalcdone 27232358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 27240c58ac1cSmalcfor drv in $audio_drv_list; do 2725f6e5889eSpbrook def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` 272698ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 2727923e4521Smalc if test "$drv" = "fmod"; then 27287aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 2729fb065187Sbellard fi 27300c58ac1cSmalcdone 273167f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 273267f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 273367f86e8eSJuan Quintelafi 2734d5631638Smalcif test "$audio_win_int" = "yes" ; then 2735d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 2736d5631638Smalcfi 2737eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak 27388ff9cbf7Smalcif test "$mixemu" = "yes" ; then 273998ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 27408ff9cbf7Smalcfi 2741821601eaSJes Sorensenif test "$vnc" = "yes" ; then 2742821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 2743821601eaSJes Sorensenfi 27448d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 274598ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 2746525061bfSJuan Quintela echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak 27478d5d2d4cSthsfi 27482f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 274998ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 275060ddf533SJuan Quintela echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak 27512f9606b3Saliguorifi 2752821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 27532f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 27542f6f5c7aSCorentin Chary echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak 27552f6f5c7aSCorentin Charyfi 2756821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 2757efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 2758efe556adSCorentin Chary echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak 2759efe556adSCorentin Charyfi 2760821601eaSJes Sorensenif test "$vnc_thread" = "yes" ; then 2761bd023f95SCorentin Chary echo "CONFIG_VNC_THREAD=y" >> $config_host_mak 2762bd023f95SCorentin Charyfi 276376655d6dSaliguoriif test "$fnmatch" = "yes" ; then 27642358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 276576655d6dSaliguorifi 2766ee682d27SStefan Weilif test "$uuid" = "yes" ; then 2767ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 2768ee682d27SStefan Weilfi 2769dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 2770dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 2771dce512deSChristoph Hellwigfi 2772b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 277398ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 27742358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 277598ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 277698ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 2777a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 277898ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 2779cc8ae6deSpbrookfi 27801ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 278198ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 27828ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 278349ecc3faSbellardfi 278449ecc3faSbellardif test "$cocoa" = "yes" ; then 278598ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 278649ecc3faSbellardfi 27874d3b6f6eSbalrogif test "$curses" = "yes" ; then 278898ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 2789ab4e5602SJan Kiszkafi 27903b3f24adSaurel32if test "$atfile" = "yes" ; then 27912358a494SJuan Quintela echo "CONFIG_ATFILE=y" >> $config_host_mak 27923b3f24adSaurel32fi 2793ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 27942358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 2795ebc996f3SRiku Voipiofi 2796099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 27972358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 2798099d6b0fSRiku Voipiofi 279940ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 280040ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 280140ff6d7eSKevin Wolffi 28023ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 28032358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 28043ce34dfbSvibisreenivasanfi 2805c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 2806c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 2807c2882b96SRiku Voipiofi 2808d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 2809d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 2810d0927938SUlrich Hechtfi 2811c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 2812c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 2813c727f47dSPeter Maydellfi 2814dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 2815dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 2816dace20dcSPeter Maydellfi 2817d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 2818d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 2819d0927938SUlrich Hechtfi 28203b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 28213b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 28223b6edd16SPeter Maydellfi 28233b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 28243b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 28253b6edd16SPeter Maydellfi 28263b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then 28273b6edd16SPeter Maydell echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak 28283b6edd16SPeter Maydellfi 28293b3f24adSaurel32if test "$inotify" = "yes" ; then 28302358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 28313b3f24adSaurel32fi 2832c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 2833c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 2834c05c7a73SRiku Voipiofi 28356ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 28366ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 28376ae9a1f4SJuan Quintelafi 28386ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 28396ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 28406ae9a1f4SJuan Quintelafi 2841769ce76dSAlexander Grafif test "$curl" = "yes" ; then 284298ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 2843b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 2844769ce76dSAlexander Graffi 28452e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 284698ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 28472e4d9fb1Saurel32fi 2848fb599c9aSbalrogif test "$bluez" = "yes" ; then 284998ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 2850ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 2851fb599c9aSbalrogfi 2852e37630caSaliguoriif test "$xen" = "yes" ; then 28535647eb74SJuan Quintela echo "CONFIG_XEN=y" >> $config_host_mak 2854d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 2855e37630caSaliguorifi 2856e5d355d1Saliguoriif test "$io_thread" = "yes" ; then 285798ec69acSJuan Quintela echo "CONFIG_IOTHREAD=y" >> $config_host_mak 2858e5d355d1Saliguorifi 28595c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 28605c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 28615c6c3a6cSChristoph Hellwigfi 2862758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 2863758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 2864758e8e38SVenkateswararao Jujjuri (JV)fi 2865758e8e38SVenkateswararao Jujjuri (JV)if test "$linux" = "yes" ; then 2866758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 2867758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 2868758e8e38SVenkateswararao Jujjuri (JV) fi 2869758e8e38SVenkateswararao Jujjuri (JV)fi 287077755340Sthsif test "$blobs" = "yes" ; then 287198ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 287277755340Sthsfi 2873bf9298b9Saliguoriif test "$iovec" = "yes" ; then 28742358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 2875bf9298b9Saliguorifi 2876ceb42de8Saliguoriif test "$preadv" = "yes" ; then 28772358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 2878ceb42de8Saliguorifi 2879f652e6afSaurel32if test "$fdt" = "yes" ; then 28803f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 2881f652e6afSaurel32fi 2882dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 2883dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 2884dcc38d1cSMarcelo Tosattifi 2885de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then 2886de5071c5SBlue Swirl echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak 2887de5071c5SBlue Swirlfi 2888747bbdf7SBlue Swirlif test "$gcc_attribute_warn_unused_result" = "yes" ; then 2889747bbdf7SBlue Swirl echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak 2890747bbdf7SBlue Swirlfi 28915f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 28925f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 28935f6b9e8fSBlue Swirlfi 2894e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 2895e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 2896e78815a5SAndreas Färberfi 2897e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 2898e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 2899e78815a5SAndreas Färberfi 290097a847bcSbellard 2901cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 2902cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 2903cd4ec0b4SGerd Hoffmannfi 2904cd4ec0b4SGerd Hoffmann 290536707144SAlon Levyif test "$smartcard" = "yes" ; then 290636707144SAlon Levy echo "CONFIG_SMARTCARD=y" >> $config_host_mak 290736707144SAlon Levyfi 290836707144SAlon Levy 2909111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 2910111a38b0SRobert Relyea echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak 2911111a38b0SRobert Relyeafi 2912111a38b0SRobert Relyea 291320ff075bSMichael Walleif test "$opengl" = "yes" ; then 291420ff075bSMichael Walle echo "CONFIG_OPENGL=y" >> $config_host_mak 291520ff075bSMichael Wallefi 291620ff075bSMichael Walle 291783fb7adfSbellard# XXX: suppress that 29187d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 29192358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 29207d3505c5Sbellardfi 29217d3505c5Sbellard 29222358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 2923c5937220Spbrook 292420ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 292520ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 292620ff6c80SAnthony Liguorifi 2927f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 2928f27aaf4bSChristian Brunner echo "CONFIG_RBD=y" >> $config_host_mak 2929f27aaf4bSChristian Brunnerfi 293020ff6c80SAnthony Liguori 293168063649Sblueswir1# USB host support 293268063649Sblueswir1case "$usb" in 293368063649Sblueswir1linux) 293498ec69acSJuan Quintela echo "HOST_USB=linux" >> $config_host_mak 293568063649Sblueswir1;; 293668063649Sblueswir1bsd) 293798ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 293868063649Sblueswir1;; 293968063649Sblueswir1*) 294098ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 294168063649Sblueswir1;; 294268063649Sblueswir1esac 294368063649Sblueswir1 294494a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak 294522890ab5SPrerna Saxenaif test "$trace_backend" = "simple"; then 294622890ab5SPrerna Saxena echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak 294722890ab5SPrerna Saxenafi 29489410b56cSPrerna Saxena# Set the appropriate trace file. 29499410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then 2950953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 29519410b56cSPrerna Saxenafi 2952c276b17dSDaniel P. Berrangeif test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then 2953c276b17dSDaniel P. Berrange echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak 2954c276b17dSDaniel P. Berrangefi 29559410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 29569410b56cSPrerna Saxena 295798ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 295898ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 2959804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 2960804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 2961804edf29SJuan Quintelaecho "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak 2962804edf29SJuan Quintelaecho "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak 2963804edf29SJuan Quintelaecho "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak 2964804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 29652b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 2966804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 2967804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 2968804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 2969804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 29709fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 297144dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak 2972e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 2973a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 2974f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 2975e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 2976e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 2977e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 2978e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 2979e39f0062SPaolo Bonzinifi 2980c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak 2981e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 2982a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak 2983a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak 298473da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 29853e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 2986804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 2987804edf29SJuan Quintela 29884bf6b55bSJuan Quintela# generate list of library paths for linker script 29894bf6b55bSJuan Quintela 29904bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} 29914bf6b55bSJuan Quintela 29924bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then 29934bf6b55bSJuan Quintela if cmp -s $config_host_ld ${config_host_ld}~ ; then 29944bf6b55bSJuan Quintela mv ${config_host_ld}~ $config_host_ld 29954bf6b55bSJuan Quintela else 29964bf6b55bSJuan Quintela rm ${config_host_ld}~ 29974bf6b55bSJuan Quintela fi 29984bf6b55bSJuan Quintelafi 29994bf6b55bSJuan Quintela 30004d904533SBlue Swirlfor d in libdis libdis-user; do 30014d904533SBlue Swirl mkdir -p $d 300211568d6dSPaolo Bonzini symlink $source_path/Makefile.dis $d/Makefile 30034d904533SBlue Swirl echo > $d/config.mak 30044d904533SBlue Swirldone 3005d44cff22SRichard Hendersonif test "$static" = "no" -a "$user_pie" = "yes" ; then 3006d44cff22SRichard Henderson echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak 3007d44cff22SRichard Hendersonfi 30084d904533SBlue Swirl 300997a847bcSbellardfor target in $target_list; do 301097a847bcSbellardtarget_dir="$target" 301125be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 3012600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1` 301397a847bcSbellardtarget_bigendian="no" 30141f3d3c8fSJuan Quintela 3015ea2d6a39SJuan Quintelacase "$target_arch2" in 3016613a22c9SMichael Walle armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus) 3017ea2d6a39SJuan Quintela target_bigendian=yes 3018ea2d6a39SJuan Quintela ;; 3019ea2d6a39SJuan Quintelaesac 302097a847bcSbellardtarget_softmmu="no" 3021997344f3Sbellardtarget_user_only="no" 3022831b7825Sthstarget_linux_user="no" 3023831b7825Sthstarget_darwin_user="no" 302484778508Sblueswir1target_bsd_user="no" 30259e407a85Spbrookcase "$target" in 3026600309b6SBlue Swirl ${target_arch2}-softmmu) 30279e407a85Spbrook target_softmmu="yes" 30289e407a85Spbrook ;; 3029600309b6SBlue Swirl ${target_arch2}-linux-user) 30309c7a4202SBlue Swirl if test "$linux" != "yes" ; then 30319c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Linux host" 30329c7a4202SBlue Swirl exit 1 30339c7a4202SBlue Swirl fi 30349e407a85Spbrook target_user_only="yes" 30359e407a85Spbrook target_linux_user="yes" 30369e407a85Spbrook ;; 3037600309b6SBlue Swirl ${target_arch2}-darwin-user) 30389c7a4202SBlue Swirl if test "$darwin" != "yes" ; then 30399c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Darwin host" 30409c7a4202SBlue Swirl exit 1 30419c7a4202SBlue Swirl fi 30429e407a85Spbrook target_user_only="yes" 3043831b7825Sths target_darwin_user="yes" 30449e407a85Spbrook ;; 3045600309b6SBlue Swirl ${target_arch2}-bsd-user) 30469cf55765SBlue Swirl if test "$bsd" != "yes" ; then 30479c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a BSD host" 30489c7a4202SBlue Swirl exit 1 30499c7a4202SBlue Swirl fi 305084778508Sblueswir1 target_user_only="yes" 305184778508Sblueswir1 target_bsd_user="yes" 305284778508Sblueswir1 ;; 30539e407a85Spbrook *) 30549e407a85Spbrook echo "ERROR: Target '$target' not recognised" 30559e407a85Spbrook exit 1 30569e407a85Spbrook ;; 30579e407a85Spbrookesac 3058831b7825Sths 305997a847bcSbellardmkdir -p $target_dir 3060158142c2Sbellardmkdir -p $target_dir/fpu 306157fec1feSbellardmkdir -p $target_dir/tcg 306259f2a787SGerd Hoffmannmkdir -p $target_dir/ide 3063353ac78dSAneesh Kumar K.Vmkdir -p $target_dir/9pfs 306484778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then 306569de927cSbellard mkdir -p $target_dir/nwfpe 306669de927cSbellardfi 306711568d6dSPaolo Bonzinisymlink $source_path/Makefile.target $target_dir/Makefile 3068ec530c81Sbellard 306997a847bcSbellard 307025be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 307197a847bcSbellard 3072e5fe0c52Spbrookbflt="no" 3073bd0c5661Spbrooktarget_nptl="no" 3074600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` 30757ee2822cSPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 307656aebc89Spbrookgdb_xml_files="" 3077c2e3dee6SLaurent Viviertarget_short_alignment=2 3078c2e3dee6SLaurent Viviertarget_int_alignment=4 3079c2e3dee6SLaurent Viviertarget_long_alignment=4 3080c2e3dee6SLaurent Viviertarget_llong_alignment=8 3081de3a354aSMichael Walletarget_libs_softmmu= 30827ba1e619Saliguori 3083938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2" 30846acff7daSJuan QuintelaTARGET_BASE_ARCH="" 3085e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 3086e73aae67SJuan Quintela 3087600309b6SBlue Swirlcase "$target_arch2" in 30882408a527Saurel32 i386) 308971deff27SAurelien Jarno target_phys_bits=64 30902408a527Saurel32 ;; 30912408a527Saurel32 x86_64) 30926acff7daSJuan Quintela TARGET_BASE_ARCH=i386 30931ad2134fSPaul Brook target_phys_bits=64 3094c2e3dee6SLaurent Vivier target_long_alignment=8 30952408a527Saurel32 ;; 30962408a527Saurel32 alpha) 30971ad2134fSPaul Brook target_phys_bits=64 3098c2e3dee6SLaurent Vivier target_long_alignment=8 3099a4b388ffSRichard Henderson target_nptl="yes" 31002408a527Saurel32 ;; 31012408a527Saurel32 arm|armeb) 3102b498c8a0SJuan Quintela TARGET_ARCH=arm 3103e5fe0c52Spbrook bflt="yes" 3104bd0c5661Spbrook target_nptl="yes" 310556aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 31061ad2134fSPaul Brook target_phys_bits=32 3107c2e3dee6SLaurent Vivier target_llong_alignment=4 31082408a527Saurel32 ;; 31092408a527Saurel32 cris) 3110253bd7f8Sedgar_igl target_nptl="yes" 31111ad2134fSPaul Brook target_phys_bits=32 31122408a527Saurel32 ;; 3113613a22c9SMichael Walle lm32) 3114613a22c9SMichael Walle target_phys_bits=32 3115de3a354aSMichael Walle target_libs_softmmu="$opengl_libs" 3116613a22c9SMichael Walle ;; 31172408a527Saurel32 m68k) 31180938cda5Saurel32 bflt="yes" 311956aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 31201ad2134fSPaul Brook target_phys_bits=32 3121c2e3dee6SLaurent Vivier target_int_alignment=2 3122c2e3dee6SLaurent Vivier target_long_alignment=2 3123c2e3dee6SLaurent Vivier target_llong_alignment=2 31242408a527Saurel32 ;; 3125877fdc12SEdgar E. Iglesias microblaze|microblazeel) 3126877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 312772b675caSEdgar E. Iglesias bflt="yes" 312872b675caSEdgar E. Iglesias target_nptl="yes" 312972b675caSEdgar E. Iglesias target_phys_bits=32 3130de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 313172b675caSEdgar E. Iglesias ;; 31322408a527Saurel32 mips|mipsel) 3133b498c8a0SJuan Quintela TARGET_ARCH=mips 313425be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 3135f04dc72fSPaul Brook target_nptl="yes" 31361ad2134fSPaul Brook target_phys_bits=64 31372408a527Saurel32 ;; 31382408a527Saurel32 mipsn32|mipsn32el) 3139b498c8a0SJuan Quintela TARGET_ARCH=mipsn32 31406acff7daSJuan Quintela TARGET_BASE_ARCH=mips 314125be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 31421ad2134fSPaul Brook target_phys_bits=64 31432408a527Saurel32 ;; 31442408a527Saurel32 mips64|mips64el) 3145b498c8a0SJuan Quintela TARGET_ARCH=mips64 31466acff7daSJuan Quintela TARGET_BASE_ARCH=mips 314725be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 31481ad2134fSPaul Brook target_phys_bits=64 3149c2e3dee6SLaurent Vivier target_long_alignment=8 31502408a527Saurel32 ;; 31512408a527Saurel32 ppc) 3152c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 31531ad2134fSPaul Brook target_phys_bits=32 3154d6630708SNathan Froyd target_nptl="yes" 3155de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 31562408a527Saurel32 ;; 31572408a527Saurel32 ppcemb) 31586acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3159e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3160c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 31611ad2134fSPaul Brook target_phys_bits=64 3162d6630708SNathan Froyd target_nptl="yes" 3163de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 31642408a527Saurel32 ;; 31652408a527Saurel32 ppc64) 31666acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3167e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3168c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 31691ad2134fSPaul Brook target_phys_bits=64 3170c2e3dee6SLaurent Vivier target_long_alignment=8 3171de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 31722408a527Saurel32 ;; 31732408a527Saurel32 ppc64abi32) 3174b498c8a0SJuan Quintela TARGET_ARCH=ppc64 31756acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3176e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 317725be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 3178c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 31791ad2134fSPaul Brook target_phys_bits=64 3180de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 31812408a527Saurel32 ;; 31822408a527Saurel32 sh4|sh4eb) 3183b498c8a0SJuan Quintela TARGET_ARCH=sh4 31844dbed897Spbrook bflt="yes" 31850b6d3ae0Saurel32 target_nptl="yes" 31861ad2134fSPaul Brook target_phys_bits=32 31872408a527Saurel32 ;; 31882408a527Saurel32 sparc) 31891ad2134fSPaul Brook target_phys_bits=64 31902408a527Saurel32 ;; 31912408a527Saurel32 sparc64) 31926acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 31931ad2134fSPaul Brook target_phys_bits=64 3194c2e3dee6SLaurent Vivier target_long_alignment=8 31952408a527Saurel32 ;; 31962408a527Saurel32 sparc32plus) 3197b498c8a0SJuan Quintela TARGET_ARCH=sparc64 31986acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 3199e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 320025be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 32011ad2134fSPaul Brook target_phys_bits=64 32022408a527Saurel32 ;; 320324e804ecSAlexander Graf s390x) 3204bc434676SUlrich Hecht target_nptl="yes" 320524e804ecSAlexander Graf target_phys_bits=64 32067b3da903SAlexander Graf target_long_alignment=8 320724e804ecSAlexander Graf ;; 3208d2fbca94SGuan Xuetao unicore32) 3209d2fbca94SGuan Xuetao target_phys_bits=32 3210d2fbca94SGuan Xuetao ;; 32112408a527Saurel32 *) 3212de83cd02Sbellard echo "Unsupported target CPU" 3213de83cd02Sbellard exit 1 32142408a527Saurel32 ;; 32152408a527Saurel32esac 3216c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak 3217c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak 3218c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak 3219c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak 322025be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak 3221053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`" 322225be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 322325be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak 322442bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 32256acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then 32266acff7daSJuan Quintela TARGET_BASE_ARCH=$TARGET_ARCH 32276acff7daSJuan Quintelafi 322825be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 3229e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 3230e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 3231e6e91b9cSJuan Quintelafi 323225be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 32331b0c87fcSJuan Quintelacase "$target_arch2" in 32341b0c87fcSJuan Quintela i386|x86_64) 32351b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 323664b3cfdbSAnthony PERARD target_phys_bits=64 323725be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 3238432d268cSJun Nakajima if test "$cpu" = "i386" -o "$cpu" = "x86_64"; then 3239432d268cSJun Nakajima echo "CONFIG_XEN_MAPCACHE=y" >> $config_target_mak 3240432d268cSJun Nakajima fi 32411b0c87fcSJuan Quintela fi 32421b0c87fcSJuan Quintelaesac 3243c59249f9SJuan Quintelacase "$target_arch2" in 32440e60a699SAlexander Graf i386|x86_64|ppcemb|ppc|ppc64|s390x) 3245c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 3246c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 3247c59249f9SJuan Quintela \( "$target_arch2" = "$cpu" -o \ 3248c59249f9SJuan Quintela \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 32495f114bc6SAlexander Graf \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ 3250adf82011SRené Rebe \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \ 3251adf82011SRené Rebe \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ 3252c59249f9SJuan Quintela \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ 3253c59249f9SJuan Quintela \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then 325425be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 3255d5970055SMichael S. Tsirkin if test $vhost_net = "yes" ; then 3256d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 3257d5970055SMichael S. Tsirkin fi 3258c59249f9SJuan Quintela fi 3259c59249f9SJuan Quintelaesac 3260de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 326125be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 326297a847bcSbellardfi 326397a847bcSbellardif test "$target_softmmu" = "yes" ; then 3264b1aa27c4SPaul Brook echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak 326525be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 3266de3a354aSMichael Walle echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak 32670e8c9214SAndreas Färber echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak 32685791f45bSKirill A. Shutemov echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak 3269de83cd02Sbellardfi 3270997344f3Sbellardif test "$target_user_only" = "yes" ; then 327125be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 3272997344f3Sbellardfi 3273831b7825Sthsif test "$target_linux_user" = "yes" ; then 327425be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 3275831b7825Sthsfi 3276831b7825Sthsif test "$target_darwin_user" = "yes" ; then 327725be210fSJuan Quintela echo "CONFIG_DARWIN_USER=y" >> $config_target_mak 3278831b7825Sthsfi 3279111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 3280111a38b0SRobert Relyea echo "subdir-$target: subdir-libcacard" >> $config_host_mak 3281111a38b0SRobert Relyea echo "libcacard_libs=$libcacard_libs" >> $config_host_mak 3282111a38b0SRobert Relyea echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak 3283111a38b0SRobert Relyeafi 328456aebc89Spbrooklist="" 328556aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 328656aebc89Spbrook for x in $gdb_xml_files; do 328756aebc89Spbrook list="$list $source_path/gdb-xml/$x" 328856aebc89Spbrook done 328925be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 32903d0f1517SJuan Quintelafi 3291de83cd02Sbellard 3292e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 329325be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 3294e5fe0c52Spbrookfi 3295bd0c5661Spbrookif test "$target_user_only" = "yes" \ 3296bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 329725be210fSJuan Quintela echo "CONFIG_USE_NPTL=y" >> $config_target_mak 3298bd0c5661Spbrookfi 3299379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 330025be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 3301379f6698SPaul Brookfi 330284778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 330325be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 330484778508Sblueswir1fi 33055b0753e0Sbellard 33064afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 3307fa282484SJuan Quintela 33084afddb55SJuan Quintelacflags="" 3309f9728943SPaolo Bonziniincludes="" 3310fa282484SJuan Quintelaldflags="" 33119b8e111fSJuan Quintela 331257ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then 3313f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/sparc $includes" 331424e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then 3315f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/s390 $includes" 33165d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then 3317f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/i386 $includes" 331857ddfbf7SJuan Quintelaelse 3319f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes" 332057ddfbf7SJuan Quintelafi 3321f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes" 3322f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/fpu $includes" 332357ddfbf7SJuan Quintela 33244d904533SBlue Swirlif test "$target_user_only" = "yes" ; then 33254d904533SBlue Swirl libdis_config_mak=libdis-user/config.mak 33264d904533SBlue Swirlelse 33274d904533SBlue Swirl libdis_config_mak=libdis/config.mak 33284d904533SBlue Swirlfi 33294d904533SBlue Swirl 333064656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 333164656024SJuan Quintela case "$i" in 333264656024SJuan Quintela alpha) 333325be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 33344d904533SBlue Swirl echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak 333564656024SJuan Quintela ;; 333664656024SJuan Quintela arm) 333725be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 33384d904533SBlue Swirl echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak 333964656024SJuan Quintela ;; 334064656024SJuan Quintela cris) 334125be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 33424d904533SBlue Swirl echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak 334364656024SJuan Quintela ;; 334464656024SJuan Quintela hppa) 334525be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 33464d904533SBlue Swirl echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak 334764656024SJuan Quintela ;; 334864656024SJuan Quintela i386|x86_64) 334925be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 33504d904533SBlue Swirl echo "CONFIG_I386_DIS=y" >> $libdis_config_mak 335164656024SJuan Quintela ;; 3352903ec55cSAurelien Jarno ia64*) 3353903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $config_target_mak 3354903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak 3355903ec55cSAurelien Jarno ;; 335664656024SJuan Quintela m68k) 335725be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 33584d904533SBlue Swirl echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak 335964656024SJuan Quintela ;; 3360877fdc12SEdgar E. Iglesias microblaze*) 336125be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 33624d904533SBlue Swirl echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak 336364656024SJuan Quintela ;; 336464656024SJuan Quintela mips*) 336525be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 33664d904533SBlue Swirl echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak 336764656024SJuan Quintela ;; 336864656024SJuan Quintela ppc*) 336925be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 33704d904533SBlue Swirl echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak 337164656024SJuan Quintela ;; 337224e804ecSAlexander Graf s390*) 337325be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 33744d904533SBlue Swirl echo "CONFIG_S390_DIS=y" >> $libdis_config_mak 337564656024SJuan Quintela ;; 337664656024SJuan Quintela sh4) 337725be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 33784d904533SBlue Swirl echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak 337964656024SJuan Quintela ;; 338064656024SJuan Quintela sparc*) 338125be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 33824d904533SBlue Swirl echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak 338364656024SJuan Quintela ;; 338464656024SJuan Quintela esac 338564656024SJuan Quinteladone 338664656024SJuan Quintela 33876ee7126fSJuan Quintelacase "$ARCH" in 33886ee7126fSJuan Quintelaalpha) 33896ee7126fSJuan Quintela # Ensure there's only a single GP 33906ee7126fSJuan Quintela cflags="-msmall-data $cflags" 33916ee7126fSJuan Quintela;; 33926ee7126fSJuan Quintelaesac 33936ee7126fSJuan Quintela 339455d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then 339555d9c04bSJuan Quintela case "$TARGET_BASE_ARCH" in 339655d9c04bSJuan Quintela arm) 339755d9c04bSJuan Quintela cflags="-DHAS_AUDIO $cflags" 339855d9c04bSJuan Quintela ;; 339925a8bb96SMichael Walle lm32) 340025a8bb96SMichael Walle cflags="-DHAS_AUDIO $cflags" 340125a8bb96SMichael Walle ;; 340255d9c04bSJuan Quintela i386|mips|ppc) 340355d9c04bSJuan Quintela cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" 340455d9c04bSJuan Quintela ;; 340555d9c04bSJuan Quintela esac 340655d9c04bSJuan Quintelafi 340755d9c04bSJuan Quintela 340834005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \ 340934005a00SKirill A. Shutemov "$user_pie" = "yes" ; then 341034005a00SKirill A. Shutemov cflags="-fpie $cflags" 341134005a00SKirill A. Shutemov ldflags="-pie $ldflags" 341234005a00SKirill A. Shutemovfi 341334005a00SKirill A. Shutemov 3414471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \ 3415471857ddSJuan Quintela "$TARGET_ARCH" = "microblaze" -o \ 3416471857ddSJuan Quintela "$TARGET_ARCH" = "cris" \) ; then 341725be210fSJuan Quintela echo "CONFIG_NEED_MMU=y" >> $config_target_mak 3418471857ddSJuan Quintelafi 3419471857ddSJuan Quintela 3420d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 342125be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 3422d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 3423d02c1db3SJuan Quintela cflags="-p $cflags" 3424d02c1db3SJuan Quintela ldflags="-p $ldflags" 3425d02c1db3SJuan Quintela fi 3426d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 3427d02c1db3SJuan Quintela ldflags="-p $ldflags" 342825be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 3429d02c1db3SJuan Quintela fi 3430d02c1db3SJuan Quintelafi 3431d02c1db3SJuan Quintela 34326ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld" 34339b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 3434fa282484SJuan Quintela case "$ARCH" in 3435fa282484SJuan Quintela sparc) 3436fa282484SJuan Quintela # -static is used to avoid g1/g3 usage by the dynamic linker 3437322e5878SJuan Quintela ldflags="$linker_script -static $ldflags" 3438fa282484SJuan Quintela ;; 34394d58be06SRichard Henderson alpha | s390x) 34404d58be06SRichard Henderson # The default placement of the application is fine. 34414d58be06SRichard Henderson ;; 3442fd76e73aSRichard Henderson *) 3443322e5878SJuan Quintela ldflags="$linker_script $ldflags" 3444fa282484SJuan Quintela ;; 3445fa282484SJuan Quintela esac 3446fa282484SJuan Quintelafi 3447fa282484SJuan Quintela 3448e205c790SJan Kiszka# use included Linux headers 3449*af2be207SJan Kiszkaif test "$linux" = "yes" ; then 3450e205c790SJan Kiszka includes="-I\$(SRC_PATH)/linux-headers $includes" 3451e205c790SJan Kiszka mkdir -p linux-headers 3452e205c790SJan Kiszka case "$cpu" in 3453e205c790SJan Kiszka i386|x86_64) 3454e205c790SJan Kiszka symlink $source_path/linux-headers/asm-x86 linux-headers/asm 3455e205c790SJan Kiszka ;; 3456e205c790SJan Kiszka ppcemb|ppc|ppc64) 3457*af2be207SJan Kiszka symlink $source_path/linux-headers/asm-powerpc linux-headers/asm 3458e205c790SJan Kiszka ;; 3459e205c790SJan Kiszka s390x) 3460e205c790SJan Kiszka symlink $source_path/linux-headers/asm-s390 linux-headers/asm 3461e205c790SJan Kiszka ;; 3462e205c790SJan Kiszka esac 3463*af2be207SJan Kiszkafi 3464e205c790SJan Kiszka 346525be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 346625be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 3467f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak 3468fa282484SJuan Quintela 346997a847bcSbellarddone # for target in $targets 34707d13299dSbellard 3471d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 3472e1144d00SMark McLoughlinDIRS="tests tests/cris slirp audio block net pc-bios/optionrom" 3473446b9165SAndreas FärberDIRS="$DIRS pc-bios/spapr-rtas" 34742d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 34753e230dd2SCorentin CharyDIRS="$DIRS fsdev ui" 34767d13299dSbellardFILES="Makefile tests/Makefile" 3477e7daa605SthsFILES="$FILES tests/cris/Makefile tests/cris/.gdbinit" 3478ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 3479446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile" 34802d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 34815ee8ad71SAlex Williamsonfor bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.rom $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do 34827ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 34837ea78b74SJan Kiszkadone 3484d1807a4fSPaolo Bonzinimkdir -p $DIRS 34857d13299dSbellardfor f in $FILES ; do 3486eae30c8fSAurelien Jarno test -e $f || symlink $source_path/$f $f 34877d13299dSbellarddone 34881ad2134fSPaul Brook 3489c34ebfdcSAnthony Liguori# temporary config to build submodules 34902d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 3491c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 349237116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 3493c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 3494c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 3495c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 3496c34ebfdcSAnthony Liguori echo "CPP=${cross_prefix}cpp" >> $config_mak 3497c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 3498c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 3499c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 3500c34ebfdcSAnthony Liguoridone 3501c34ebfdcSAnthony Liguori 35021ad2134fSPaul Brookfor hwlib in 32 64; do 35031ad2134fSPaul Brook d=libhw$hwlib 35041ad2134fSPaul Brook mkdir -p $d 35059953b2fcSBlue Swirl mkdir -p $d/ide 350611568d6dSPaolo Bonzini symlink $source_path/Makefile.hw $d/Makefile 3507353ac78dSAneesh Kumar K.V mkdir -p $d/9pfs 350837116c89SStefan Weil echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak 35091ad2134fSPaul Brookdone 3510add16157SBlue Swirl 3511111a38b0SRobert Relyeaif [ "$source_path" != `pwd` ]; then 3512111a38b0SRobert Relyea # out of tree build 3513111a38b0SRobert Relyea mkdir -p libcacard 3514111a38b0SRobert Relyea rm -f libcacard/Makefile 351544dc0ca3SAlon Levy symlink "$source_path/libcacard/Makefile" libcacard/Makefile 3516111a38b0SRobert Relyeafi 3517111a38b0SRobert Relyea 3518add16157SBlue Swirld=libuser 3519add16157SBlue Swirlmkdir -p $d 352011568d6dSPaolo Bonzinisymlink $source_path/Makefile.user $d/Makefile 3521299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then 3522299060a0SKirill A. Shutemov echo "QEMU_CFLAGS+=-fpie" > $d/config.mak 3523299060a0SKirill A. Shutemovfi 3524b40292e7SJan Kiszka 3525b40292e7SJan Kiszkaif test "$docs" = "yes" ; then 3526b40292e7SJan Kiszka mkdir -p QMP 3527b40292e7SJan Kiszkafi 3528