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="" 116e205c790SJan Kiszkakvm="yes" 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="" 132e205c790SJan Kiszkavhost_net="yes" 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" 46007f4ddbfSbellard if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 461c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 462c9ec1fe4Sbellard fi 463fb065187Sbellard;; 4647d13299dSbellardesac 4657d13299dSbellard 4667d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 467b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 46868063649Sblueswir1 usb="bsd" 46983fb7adfSbellard fi 47084778508Sblueswir1 bsd_user="yes" 4717d3505c5Sbellardfi 4727d3505c5Sbellard 4730db4a067SPaolo Bonzini: ${make=${MAKE-make}} 4740db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 4750db4a067SPaolo Bonzini 4763457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 4773457a3f8SJuan Quintela EXESUF=".exe" 478a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 479e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 480e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 48108f3896aSStefan Weil LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS" 482683035deSPaolo Bonzini prefix="c:/Program Files/Qemu" 483683035deSPaolo Bonzini mandir="\${prefix}" 484683035deSPaolo Bonzini datadir="\${prefix}" 485683035deSPaolo Bonzini docdir="\${prefix}" 486683035deSPaolo Bonzini bindir="\${prefix}" 487683035deSPaolo Bonzini sysconfdir="\${prefix}" 488683035deSPaolo Bonzini confsuffix="" 4893457a3f8SJuan Quintelafi 4903457a3f8SJuan Quintela 491487fefdbSAnthony Liguoriwerror="" 49285aa5189Sbellard 4937d13299dSbellardfor opt do 494a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 4957d13299dSbellard case "$opt" in 4962efc3265Sbellard --help|-h) show_help=yes 4972efc3265Sbellard ;; 49899123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 49999123e13SMike Frysinger ;; 500b1a550a0Spbrook --prefix=*) prefix="$optarg" 5017d13299dSbellard ;; 502b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 50332ce6337Sbellard ;; 504ca4deeb1SPaolo Bonzini --source-path=*) 5057d13299dSbellard ;; 506ac0df51dSaliguori --cross-prefix=*) 5077d13299dSbellard ;; 508ac0df51dSaliguori --cc=*) 5097d13299dSbellard ;; 510b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 51183469015Sbellard ;; 512b1a550a0Spbrook --make=*) make="$optarg" 5137d13299dSbellard ;; 5146a882643Spbrook --install=*) install="$optarg" 5156a882643Spbrook ;; 516e2a2ed06SJuan Quintela --extra-cflags=*) 5177d13299dSbellard ;; 518e2a2ed06SJuan Quintela --extra-ldflags=*) 5197d13299dSbellard ;; 5202ff6b91eSJuan Quintela --cpu=*) 5217d13299dSbellard ;; 522b1a550a0Spbrook --target-list=*) target_list="$optarg" 523de83cd02Sbellard ;; 52474242e0fSPaolo Bonzini --enable-trace-backend=*) trace_backend="$optarg" 52594a420b1SStefan Hajnoczi ;; 52674242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 5279410b56cSPrerna Saxena ;; 5287d13299dSbellard --enable-gprof) gprof="yes" 5297d13299dSbellard ;; 53079427693SLoïc Minier --static) 53179427693SLoïc Minier static="yes" 53279427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 53343ce4dfeSbellard ;; 5340b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 5350b24e75fSPaolo Bonzini ;; 5360b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 5370b24e75fSPaolo Bonzini ;; 5383aa5d2beSAlon Levy --libdir=*) libdir="$optarg" 5393aa5d2beSAlon Levy ;; 5400b24e75fSPaolo Bonzini --datadir=*) datadir="$optarg" 5410b24e75fSPaolo Bonzini ;; 5420b24e75fSPaolo Bonzini --docdir=*) docdir="$optarg" 5430b24e75fSPaolo Bonzini ;; 544ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 54507381cc1SAnthony Liguori ;; 54697a847bcSbellard --disable-sdl) sdl="no" 54797a847bcSbellard ;; 548c4198157SJuan Quintela --enable-sdl) sdl="yes" 549c4198157SJuan Quintela ;; 550821601eaSJes Sorensen --disable-vnc) vnc="no" 551821601eaSJes Sorensen ;; 552821601eaSJes Sorensen --enable-vnc) vnc="yes" 553821601eaSJes Sorensen ;; 554b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 555102a52e4Sbellard ;; 556c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 557c2de5c91Smalc ;; 5582f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 5592f6a1ab0Sblueswir1 ;; 5602fa7d3bfSmalc --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` 5610c58ac1cSmalc ;; 5620c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 5630c58ac1cSmalc ;; 564eb852011SMarkus Armbruster --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 565eb852011SMarkus Armbruster ;; 566f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 567f8393946Saurel32 ;; 568f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 569f8393946Saurel32 ;; 570b4475aa2SLuiz Capitulino --enable-debug-mon) debug_mon="yes" 571b4475aa2SLuiz Capitulino ;; 572b4475aa2SLuiz Capitulino --disable-debug-mon) debug_mon="no" 573b4475aa2SLuiz Capitulino ;; 574f3d08ee6SPaul Brook --enable-debug) 575f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 576f3d08ee6SPaul Brook debug_tcg="yes" 577b4475aa2SLuiz Capitulino debug_mon="yes" 578f3d08ee6SPaul Brook debug="yes" 579f3d08ee6SPaul Brook strip_opt="no" 580f3d08ee6SPaul Brook ;; 58103b4fe7dSaliguori --enable-sparse) sparse="yes" 58203b4fe7dSaliguori ;; 58303b4fe7dSaliguori --disable-sparse) sparse="no" 58403b4fe7dSaliguori ;; 5851625af87Saliguori --disable-strip) strip_opt="no" 5861625af87Saliguori ;; 5878d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 5888d5d2d4cSths ;; 5891be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 5901be10ad2SJuan Quintela ;; 5912f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 5922f9606b3Saliguori ;; 593ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 594ea784e3bSJuan Quintela ;; 5952f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 5962f6f5c7aSCorentin Chary ;; 5972f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 5982f6f5c7aSCorentin Chary ;; 599efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 600efe556adSCorentin Chary ;; 601efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 602efe556adSCorentin Chary ;; 603bd023f95SCorentin Chary --disable-vnc-thread) vnc_thread="no" 604bd023f95SCorentin Chary ;; 605bd023f95SCorentin Chary --enable-vnc-thread) vnc_thread="yes" 606bd023f95SCorentin Chary ;; 607443f1376Sbellard --disable-slirp) slirp="no" 608c20709aaSbellard ;; 609ee682d27SStefan Weil --disable-uuid) uuid="no" 610ee682d27SStefan Weil ;; 611ee682d27SStefan Weil --enable-uuid) uuid="yes" 612ee682d27SStefan Weil ;; 613e0e6c8c0Saliguori --disable-vde) vde="no" 6148a16d273Sths ;; 615dfb278bdSJuan Quintela --enable-vde) vde="yes" 616dfb278bdSJuan Quintela ;; 617e37630caSaliguori --disable-xen) xen="no" 618e37630caSaliguori ;; 619fc321b4bSJuan Quintela --enable-xen) xen="yes" 620fc321b4bSJuan Quintela ;; 6212e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 6222e4d9fb1Saurel32 ;; 6234ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 6244ffcedb6SJuan Quintela ;; 625fb599c9aSbalrog --disable-bluez) bluez="no" 626fb599c9aSbalrog ;; 627a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 628a20a6f46SJuan Quintela ;; 6297ba1e619Saliguori --disable-kvm) kvm="no" 6307ba1e619Saliguori ;; 631b31a0277SJuan Quintela --enable-kvm) kvm="yes" 632b31a0277SJuan Quintela ;; 633cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 634cd4ec0b4SGerd Hoffmann ;; 635cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 636cd4ec0b4SGerd Hoffmann ;; 63705c2a3e7Sbellard --enable-profiler) profiler="yes" 63805c2a3e7Sbellard ;; 639c2de5c91Smalc --enable-cocoa) 640c2de5c91Smalc cocoa="yes" ; 641c2de5c91Smalc sdl="no" ; 642c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 6435b0753e0Sbellard ;; 644cad25d69Spbrook --disable-system) softmmu="no" 6450a8e90f4Spbrook ;; 646cad25d69Spbrook --enable-system) softmmu="yes" 6470a8e90f4Spbrook ;; 6480953a80fSZachary Amsden --disable-user) 6490953a80fSZachary Amsden linux_user="no" ; 6500953a80fSZachary Amsden bsd_user="no" ; 6510953a80fSZachary Amsden darwin_user="no" 6520953a80fSZachary Amsden ;; 6530953a80fSZachary Amsden --enable-user) ;; 654831b7825Sths --disable-linux-user) linux_user="no" 6550a8e90f4Spbrook ;; 656831b7825Sths --enable-linux-user) linux_user="yes" 657831b7825Sths ;; 658831b7825Sths --disable-darwin-user) darwin_user="no" 659831b7825Sths ;; 660831b7825Sths --enable-darwin-user) darwin_user="yes" 6610a8e90f4Spbrook ;; 66284778508Sblueswir1 --disable-bsd-user) bsd_user="no" 66384778508Sblueswir1 ;; 66484778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 66584778508Sblueswir1 ;; 666379f6698SPaul Brook --enable-guest-base) guest_base="yes" 667379f6698SPaul Brook ;; 668379f6698SPaul Brook --disable-guest-base) guest_base="no" 669379f6698SPaul Brook ;; 67034005a00SKirill A. Shutemov --enable-user-pie) user_pie="yes" 67134005a00SKirill A. Shutemov ;; 67234005a00SKirill A. Shutemov --disable-user-pie) user_pie="no" 67334005a00SKirill A. Shutemov ;; 674c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 675c5937220Spbrook ;; 6763142255cSblueswir1 --sparc_cpu=*) 6773142255cSblueswir1 ;; 67885aa5189Sbellard --enable-werror) werror="yes" 67985aa5189Sbellard ;; 68085aa5189Sbellard --disable-werror) werror="no" 68185aa5189Sbellard ;; 6824d3b6f6eSbalrog --disable-curses) curses="no" 6834d3b6f6eSbalrog ;; 684c584a6d0SJuan Quintela --enable-curses) curses="yes" 685c584a6d0SJuan Quintela ;; 686769ce76dSAlexander Graf --disable-curl) curl="no" 687769ce76dSAlexander Graf ;; 688788c8196SJuan Quintela --enable-curl) curl="yes" 689788c8196SJuan Quintela ;; 6902df87df7SJuan Quintela --disable-fdt) fdt="no" 6912df87df7SJuan Quintela ;; 6922df87df7SJuan Quintela --enable-fdt) fdt="yes" 6932df87df7SJuan Quintela ;; 6945495ed11SLuiz Capitulino --disable-check-utests) check_utests="no" 6955495ed11SLuiz Capitulino ;; 6965495ed11SLuiz Capitulino --enable-check-utests) check_utests="yes" 6975495ed11SLuiz Capitulino ;; 698bd0c5661Spbrook --disable-nptl) nptl="no" 699bd0c5661Spbrook ;; 700b0a47e79SJuan Quintela --enable-nptl) nptl="yes" 701b0a47e79SJuan Quintela ;; 7028ff9cbf7Smalc --enable-mixemu) mixemu="yes" 7038ff9cbf7Smalc ;; 7045c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 7055c6c3a6cSChristoph Hellwig ;; 7065c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 7075c6c3a6cSChristoph Hellwig ;; 708758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 709758e8e38SVenkateswararao Jujjuri (JV) ;; 710758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 711758e8e38SVenkateswararao Jujjuri (JV) ;; 712e5d355d1Saliguori --enable-io-thread) io_thread="yes" 713e5d355d1Saliguori ;; 71477755340Sths --disable-blobs) blobs="no" 71577755340Sths ;; 7164a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 7174a19f1ecSpbrook ;; 718a25dba17SJuan Quintela --disable-docs) docs="no" 71970ec5dc0SAnthony Liguori ;; 720a25dba17SJuan Quintela --enable-docs) docs="yes" 72183a3ab8bSJuan Quintela ;; 722d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 723d5970055SMichael S. Tsirkin ;; 724d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 725d5970055SMichael S. Tsirkin ;; 72620ff075bSMichael Walle --disable-opengl) opengl="no" 72720ff075bSMichael Walle ;; 72820ff075bSMichael Walle --enable-opengl) opengl="yes" 72920ff075bSMichael Walle ;; 7306bde81cbSPaolo Bonzini --*dir) 7316bde81cbSPaolo Bonzini ;; 732f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 733f27aaf4bSChristian Brunner ;; 734f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 735f27aaf4bSChristian Brunner ;; 73636707144SAlon Levy --disable-smartcard) smartcard="no" 73736707144SAlon Levy ;; 73836707144SAlon Levy --enable-smartcard) smartcard="yes" 73936707144SAlon Levy ;; 740111a38b0SRobert Relyea --disable-smartcard-nss) smartcard_nss="no" 741111a38b0SRobert Relyea ;; 742111a38b0SRobert Relyea --enable-smartcard-nss) smartcard_nss="yes" 743111a38b0SRobert Relyea ;; 7447f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 7457f1559c6Sbalrog ;; 7467d13299dSbellard esac 7477d13299dSbellarddone 7487d13299dSbellard 7493142255cSblueswir1# 7503142255cSblueswir1# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right 751a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) 7523142255cSblueswir1# 753379f6698SPaul Brookhost_guest_base="no" 75440293e58Sbellardcase "$cpu" in 755ed968ff1SJuan Quintela sparc) case $sparc_cpu in 756ed968ff1SJuan Quintela v7|v8) 757a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 758ed968ff1SJuan Quintela ;; 759ed968ff1SJuan Quintela v8plus|v8plusa) 760a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 761ed968ff1SJuan Quintela ;; 762ed968ff1SJuan Quintela *) # sparc_cpu not defined in the command line 763a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" 764ed968ff1SJuan Quintela esac 7650c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 766a558ee17SJuan Quintela QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS" 767762e8230Sblueswir1 if test "$solaris" = "no" ; then 768a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS" 769c81da56eSJuan Quintela helper_cflags="-ffixed-i0" 770762e8230Sblueswir1 fi 7713142255cSblueswir1 ;; 772ed968ff1SJuan Quintela sparc64) 773a558ee17SJuan Quintela QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" 7740c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 775a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" 776ed968ff1SJuan Quintela if test "$solaris" != "no" ; then 777a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS" 778762e8230Sblueswir1 fi 7793142255cSblueswir1 ;; 78076d83bdeSths s390) 78128d7cc49SRichard Henderson QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS" 78228d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 78348bb3750SRichard Henderson host_guest_base="yes" 78428d7cc49SRichard Henderson ;; 78528d7cc49SRichard Henderson s390x) 78628d7cc49SRichard Henderson QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS" 78728d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 78848bb3750SRichard Henderson host_guest_base="yes" 78976d83bdeSths ;; 79040293e58Sbellard i386) 791a558ee17SJuan Quintela QEMU_CFLAGS="-m32 $QEMU_CFLAGS" 7920c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 7932b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 794c81da56eSJuan Quintela helper_cflags="-fomit-frame-pointer" 795379f6698SPaul Brook host_guest_base="yes" 79640293e58Sbellard ;; 79740293e58Sbellard x86_64) 798a558ee17SJuan Quintela QEMU_CFLAGS="-m64 $QEMU_CFLAGS" 7990c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 8002b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 801379f6698SPaul Brook host_guest_base="yes" 802379f6698SPaul Brook ;; 803379f6698SPaul Brook arm*) 804379f6698SPaul Brook host_guest_base="yes" 80540293e58Sbellard ;; 806f6548c0aSmalc ppc*) 807f6548c0aSmalc host_guest_base="yes" 808f6548c0aSmalc ;; 809cc01cc8eSAurelien Jarno mips*) 810cc01cc8eSAurelien Jarno host_guest_base="yes" 811cc01cc8eSAurelien Jarno ;; 812477ba620SAurelien Jarno ia64*) 813477ba620SAurelien Jarno host_guest_base="yes" 814477ba620SAurelien Jarno ;; 815fd76e73aSRichard Henderson hppa*) 816fd76e73aSRichard Henderson host_guest_base="yes" 817fd76e73aSRichard Henderson ;; 818d2fbca94SGuan Xuetao unicore32*) 819d2fbca94SGuan Xuetao host_guest_base="yes" 820d2fbca94SGuan Xuetao ;; 8213142255cSblueswir1esac 8223142255cSblueswir1 823379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base" 824379f6698SPaul Brook 82560e0df25SPeter Maydell 82660e0df25SPeter Maydelldefault_target_list="" 82760e0df25SPeter Maydell 82860e0df25SPeter Maydell# these targets are portable 82960e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then 83060e0df25SPeter Maydell default_target_list="\ 83160e0df25SPeter Maydelli386-softmmu \ 83260e0df25SPeter Maydellx86_64-softmmu \ 833b758aca1SRichard Hendersonalpha-softmmu \ 83460e0df25SPeter Maydellarm-softmmu \ 83560e0df25SPeter Maydellcris-softmmu \ 83660e0df25SPeter Maydelllm32-softmmu \ 83760e0df25SPeter Maydellm68k-softmmu \ 83860e0df25SPeter Maydellmicroblaze-softmmu \ 83960e0df25SPeter Maydellmicroblazeel-softmmu \ 84060e0df25SPeter Maydellmips-softmmu \ 84160e0df25SPeter Maydellmipsel-softmmu \ 84260e0df25SPeter Maydellmips64-softmmu \ 84360e0df25SPeter Maydellmips64el-softmmu \ 84460e0df25SPeter Maydellppc-softmmu \ 84560e0df25SPeter Maydellppcemb-softmmu \ 84660e0df25SPeter Maydellppc64-softmmu \ 84760e0df25SPeter Maydellsh4-softmmu \ 84860e0df25SPeter Maydellsh4eb-softmmu \ 84960e0df25SPeter Maydellsparc-softmmu \ 85060e0df25SPeter Maydellsparc64-softmmu \ 8510f3301d4SAlexander Grafs390x-softmmu \ 85260e0df25SPeter Maydell" 85360e0df25SPeter Maydellfi 85460e0df25SPeter Maydell# the following are Linux specific 85560e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then 85660e0df25SPeter Maydell default_target_list="${default_target_list}\ 85760e0df25SPeter Maydelli386-linux-user \ 85860e0df25SPeter Maydellx86_64-linux-user \ 85960e0df25SPeter Maydellalpha-linux-user \ 86060e0df25SPeter Maydellarm-linux-user \ 86160e0df25SPeter Maydellarmeb-linux-user \ 86260e0df25SPeter Maydellcris-linux-user \ 86360e0df25SPeter Maydellm68k-linux-user \ 86460e0df25SPeter Maydellmicroblaze-linux-user \ 86560e0df25SPeter Maydellmicroblazeel-linux-user \ 86660e0df25SPeter Maydellmips-linux-user \ 86760e0df25SPeter Maydellmipsel-linux-user \ 86860e0df25SPeter Maydellppc-linux-user \ 86960e0df25SPeter Maydellppc64-linux-user \ 87060e0df25SPeter Maydellppc64abi32-linux-user \ 87160e0df25SPeter Maydellsh4-linux-user \ 87260e0df25SPeter Maydellsh4eb-linux-user \ 87360e0df25SPeter Maydellsparc-linux-user \ 87460e0df25SPeter Maydellsparc64-linux-user \ 87560e0df25SPeter Maydellsparc32plus-linux-user \ 87660e0df25SPeter Maydellunicore32-linux-user \ 8770f3301d4SAlexander Grafs390x-linux-user \ 87860e0df25SPeter Maydell" 87960e0df25SPeter Maydellfi 88060e0df25SPeter Maydell# the following are Darwin specific 88160e0df25SPeter Maydellif [ "$darwin_user" = "yes" ] ; then 88260e0df25SPeter Maydell default_target_list="$default_target_list i386-darwin-user ppc-darwin-user " 88360e0df25SPeter Maydellfi 88460e0df25SPeter Maydell# the following are BSD specific 88560e0df25SPeter Maydellif [ "$bsd_user" = "yes" ] ; then 88660e0df25SPeter Maydell default_target_list="${default_target_list}\ 88760e0df25SPeter Maydelli386-bsd-user \ 88860e0df25SPeter Maydellx86_64-bsd-user \ 88960e0df25SPeter Maydellsparc-bsd-user \ 89060e0df25SPeter Maydellsparc64-bsd-user \ 89160e0df25SPeter Maydell" 89260e0df25SPeter Maydellfi 89360e0df25SPeter Maydell 894af5db58eSpbrookif test x"$show_help" = x"yes" ; then 895af5db58eSpbrookcat << EOF 896af5db58eSpbrook 897af5db58eSpbrookUsage: configure [options] 898af5db58eSpbrookOptions: [defaults in brackets after descriptions] 899af5db58eSpbrook 900af5db58eSpbrookEOF 901af5db58eSpbrookecho "Standard options:" 902af5db58eSpbrookecho " --help print this message" 903af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 904af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 905af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 90660e0df25SPeter Maydellecho " --target-list=LIST set target list (default: build everything)" 90760e0df25SPeter Maydellecho "Available targets: $default_target_list" | \ 90860e0df25SPeter Maydell fold -s -w 53 | sed -e 's/^/ /' 909af5db58eSpbrookecho "" 910af5db58eSpbrookecho "Advanced options (experts only):" 911af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 912af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 913af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 9140bfe8cc0SPaolo Bonziniecho " --host-cc=CC use C compiler CC [$host_cc] for code run at" 9150bfe8cc0SPaolo Bonziniecho " build time" 916a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 917e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 918af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 9196a882643Spbrookecho " --install=INSTALL use specified install [$install]" 920af5db58eSpbrookecho " --static enable static build [$static]" 9210b24e75fSPaolo Bonziniecho " --mandir=PATH install man pages in PATH" 9220b24e75fSPaolo Bonziniecho " --datadir=PATH install firmware in PATH" 9230b24e75fSPaolo Bonziniecho " --docdir=PATH install documentation in PATH" 9240b24e75fSPaolo Bonziniecho " --bindir=PATH install binaries in PATH" 9250b24e75fSPaolo Bonziniecho " --sysconfdir=PATH install config in PATH/qemu" 926f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 927f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 92809695a4aSStefan Weilecho " --enable-debug enable common debug build options" 929890b1658Saliguoriecho " --enable-sparse enable sparse checker" 930890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 9311625af87Saliguoriecho " --disable-strip disable stripping binaries" 93285aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 933fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 934c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 935821601eaSJes Sorensenecho " --disable-vnc disable VNC" 936821601eaSJes Sorensenecho " --enable-vnc enable VNC" 937af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 938c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 939c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 9404c9b53e3Smalcecho " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" 9414c9b53e3Smalcecho " Available cards: $audio_possible_cards" 942eb852011SMarkus Armbrusterecho " --block-drv-whitelist=L set block driver whitelist" 943eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 9448ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 945e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 946fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 9472e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 9484ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 9498d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 9501be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 9512f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 952ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 9532f6f5c7aSCorentin Charyecho " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" 9542f6f5c7aSCorentin Charyecho " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" 95596763cf9SCorentin Charyecho " --disable-vnc-png disable PNG compression for VNC server (default)" 956efe556adSCorentin Charyecho " --enable-vnc-png enable PNG compression for VNC server" 957bd023f95SCorentin Charyecho " --disable-vnc-thread disable threaded VNC server" 958bd023f95SCorentin Charyecho " --enable-vnc-thread enable threaded VNC server" 959af896aaaSpbrookecho " --disable-curses disable curses output" 960c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 961769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 962788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 9632df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 9642df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 9655495ed11SLuiz Capitulinoecho " --disable-check-utests disable check unit-tests" 9665495ed11SLuiz Capitulinoecho " --enable-check-utests enable check unit-tests" 967fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 968a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 9696093d3d4SPeter Maydellecho " --disable-slirp disable SLIRP userspace network connectivity" 9707ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 971b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 972bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 973e5934d33SAndre Przywaraecho " --enable-nptl enable usermode NPTL support" 974af5db58eSpbrookecho " --enable-system enable all system emulation targets" 975af5db58eSpbrookecho " --disable-system disable all system emulation targets" 9760953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 9770953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 978831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 979831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 980831b7825Sthsecho " --enable-darwin-user enable all darwin usermode emulation targets" 981831b7825Sthsecho " --disable-darwin-user disable all darwin usermode emulation targets" 98284778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 98384778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 984379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 985379f6698SPaul Brookecho " emulation targets" 986379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 98734005a00SKirill A. Shutemovecho " --enable-user-pie build usermode emulation targets as PIE" 98834005a00SKirill A. Shutemovecho " --disable-user-pie do not build usermode emulation targets as PIE" 989af5db58eSpbrookecho " --fmod-lib path to FMOD library" 990af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 9912f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 992c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 9933142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 994ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 995ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 996e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 997dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 9985c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 9995c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 1000758e8e38SVenkateswararao Jujjuri (JV)echo " --disable-attr disables attr and xattr support" 1001758e8e38SVenkateswararao Jujjuri (JV)echo " --enable-attr enable attr and xattr support" 1002e5d355d1Saliguoriecho " --enable-io-thread enable IO thread" 100377755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 1004d2807bc9SDirk Ullrichecho " --enable-docs enable documentation build" 1005d2807bc9SDirk Ullrichecho " --disable-docs disable documentation build" 1006d5970055SMichael S. Tsirkinecho " --disable-vhost-net disable vhost-net acceleration support" 1007d5970055SMichael S. Tsirkinecho " --enable-vhost-net enable vhost-net acceleration support" 1008320fba2aSFabien Chouteauecho " --enable-trace-backend=B Set trace backend" 1009320fba2aSFabien Chouteauecho " Available backends:" $("$source_path"/scripts/tracetool --list-backends) 101074242e0fSPaolo Bonziniecho " --with-trace-file=NAME Full PATH,NAME of file to store traces" 10119410b56cSPrerna Saxenaecho " Default:trace-<pid>" 1012cd4ec0b4SGerd Hoffmannecho " --disable-spice disable spice" 1013cd4ec0b4SGerd Hoffmannecho " --enable-spice enable spice" 1014f27aaf4bSChristian Brunnerecho " --enable-rbd enable building the rados block device (rbd)" 101536707144SAlon Levyecho " --disable-smartcard disable smartcard support" 101636707144SAlon Levyecho " --enable-smartcard enable smartcard support" 1017111a38b0SRobert Relyeaecho " --disable-smartcard-nss disable smartcard nss support" 1018111a38b0SRobert Relyeaecho " --enable-smartcard-nss enable smartcard nss support" 1019af5db58eSpbrookecho "" 10205bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 1021af5db58eSpbrookexit 1 1022af5db58eSpbrookfi 1023af5db58eSpbrook 10248d05095cSPaolo Bonzini# check that the C compiler works. 10258d05095cSPaolo Bonzinicat > $TMPC <<EOF 10268d05095cSPaolo Bonziniint main(void) {} 10278d05095cSPaolo BonziniEOF 10288d05095cSPaolo Bonzini 10298d05095cSPaolo Bonziniif compile_object ; then 10308d05095cSPaolo Bonzini : C compiler works ok 10318d05095cSPaolo Bonzinielse 10328d05095cSPaolo Bonzini echo "ERROR: \"$cc\" either does not exist or does not work" 10338d05095cSPaolo Bonzini exit 1 10348d05095cSPaolo Bonzinifi 10358d05095cSPaolo Bonzini 10368d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 10378d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 10388d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 1039f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags" 10408d05095cSPaolo Bonzinicat > $TMPC << EOF 10418d05095cSPaolo Bonziniint main(void) { return 0; } 10428d05095cSPaolo BonziniEOF 10438d05095cSPaolo Bonzinifor flag in $gcc_flags; do 10448d05095cSPaolo Bonzini if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then 10458d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 10468d05095cSPaolo Bonzini fi 10478d05095cSPaolo Bonzinidone 10488d05095cSPaolo Bonzini 1049ec530c81Sbellard# 1050ec530c81Sbellard# Solaris specific configure tool chain decisions 1051ec530c81Sbellard# 1052ec530c81Sbellardif test "$solaris" = "yes" ; then 10536792aa11SLoïc Minier if has $install; then 10546792aa11SLoïc Minier : 10556792aa11SLoïc Minier else 1056ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 1057ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 1058ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 1059ec530c81Sbellard exit 1 1060ec530c81Sbellard fi 10616792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 1062ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 1063ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 1064ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 1065ec530c81Sbellard exit 1 1066ec530c81Sbellard fi 10676792aa11SLoïc Minier if has ar; then 10686792aa11SLoïc Minier : 10696792aa11SLoïc Minier else 1070ec530c81Sbellard echo "Error: No path includes ar" 1071ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 1072ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 1073ec530c81Sbellard fi 1074ec530c81Sbellard exit 1 1075ec530c81Sbellard fi 1076ec530c81Sbellardfi 1077ec530c81Sbellard 10785327cf48Sbellardif test -z "$target_list" ; then 107960e0df25SPeter Maydell target_list="$default_target_list" 10806e20a45fSbellardelse 1081b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 10825327cf48Sbellardfi 10830a8e90f4Spbrookif test -z "$target_list" ; then 10840a8e90f4Spbrook echo "No targets enabled" 10850a8e90f4Spbrook exit 1 10860a8e90f4Spbrookfi 1087f55fe278SPaolo Bonzini# see if system emulation was really requested 1088f55fe278SPaolo Bonzinicase " $target_list " in 1089f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1090f55fe278SPaolo Bonzini ;; 1091f55fe278SPaolo Bonzini *) softmmu=no 1092f55fe278SPaolo Bonzini ;; 1093f55fe278SPaolo Bonziniesac 10945327cf48Sbellard 1095249247c9SJuan Quintelafeature_not_found() { 1096249247c9SJuan Quintela feature=$1 1097249247c9SJuan Quintela 1098249247c9SJuan Quintela echo "ERROR" 1099249247c9SJuan Quintela echo "ERROR: User requested feature $feature" 11009332f6a2SSebastian Herbszt echo "ERROR: configure was not able to find it" 1101249247c9SJuan Quintela echo "ERROR" 1102249247c9SJuan Quintela exit 1; 1103249247c9SJuan Quintela} 1104249247c9SJuan Quintela 11057d13299dSbellardif test -z "$cross_prefix" ; then 11067d13299dSbellard 11077d13299dSbellard# --- 11087d13299dSbellard# big/little endian test 11097d13299dSbellardcat > $TMPC << EOF 11107d13299dSbellard#include <inttypes.h> 11117d13299dSbellardint main(int argc, char ** argv){ 11127d13299dSbellard volatile uint32_t i=0x01234567; 11137d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 11147d13299dSbellard} 11157d13299dSbellardEOF 11167d13299dSbellard 111752166aa0SJuan Quintelaif compile_prog "" "" ; then 11187d13299dSbellard$TMPE && bigendian="yes" 11197d13299dSbellardelse 11207d13299dSbellardecho big/little test failed 11217d13299dSbellardfi 11227d13299dSbellard 11237d13299dSbellardelse 11247d13299dSbellard 11257d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 1126ea8f20f8SJuan Quintelacase "$cpu" in 112724e804ecSAlexander Graf armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 1128ea8f20f8SJuan Quintela bigendian=yes 1129ea8f20f8SJuan Quintela ;; 1130ea8f20f8SJuan Quintelaesac 11317d13299dSbellard 11327d13299dSbellardfi 11337d13299dSbellard 113470be1a2eSPaolo Bonzini# host long bits test, actually a pointer size test 113570be1a2eSPaolo Bonzinicat > $TMPC << EOF 113670be1a2eSPaolo Bonziniint sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1]; 113770be1a2eSPaolo BonziniEOF 113870be1a2eSPaolo Bonziniif compile_object; then 1139ea8f20f8SJuan Quintelahostlongbits=64 114070be1a2eSPaolo Bonzinielse 114170be1a2eSPaolo Bonzinihostlongbits=32 114270be1a2eSPaolo Bonzinifi 1143b6853697Sbellard 1144b0a47e79SJuan Quintela 1145b0a47e79SJuan Quintela########################################## 1146b0a47e79SJuan Quintela# NPTL probe 1147b0a47e79SJuan Quintela 1148b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then 1149bd0c5661Spbrook cat > $TMPC <<EOF 1150bd0c5661Spbrook#include <sched.h> 115130813ceaSpbrook#include <linux/futex.h> 1152bd0c5661Spbrookvoid foo() 1153bd0c5661Spbrook{ 1154bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1155bd0c5661Spbrook#error bork 1156bd0c5661Spbrook#endif 1157bd0c5661Spbrook} 1158bd0c5661SpbrookEOF 1159bd0c5661Spbrook 116052166aa0SJuan Quintela if compile_object ; then 1161b0a47e79SJuan Quintela nptl=yes 1162bd0c5661Spbrook else 1163b0a47e79SJuan Quintela if test "$nptl" = "yes" ; then 1164b0a47e79SJuan Quintela feature_not_found "nptl" 1165b0a47e79SJuan Quintela fi 1166b0a47e79SJuan Quintela nptl=no 1167b0a47e79SJuan Quintela fi 1168bd0c5661Spbrookfi 1169bd0c5661Spbrook 117011d9f695Sbellard########################################## 1171ac62922eSbalrog# zlib check 1172ac62922eSbalrog 1173ac62922eSbalrogcat > $TMPC << EOF 1174ac62922eSbalrog#include <zlib.h> 1175ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1176ac62922eSbalrogEOF 117752166aa0SJuan Quintelaif compile_prog "" "-lz" ; then 1178ac62922eSbalrog : 1179ac62922eSbalrogelse 1180ac62922eSbalrog echo 1181ac62922eSbalrog echo "Error: zlib check failed" 1182ac62922eSbalrog echo "Make sure to have the zlib libs and headers installed." 1183ac62922eSbalrog echo 1184ac62922eSbalrog exit 1 1185ac62922eSbalrogfi 1186ac62922eSbalrog 1187ac62922eSbalrog########################################## 1188e37630caSaliguori# xen probe 1189e37630caSaliguori 1190fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1191b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1192d5b93ddfSAnthony PERARD 1193d5b93ddfSAnthony PERARD # Xen unstable 1194e37630caSaliguori cat > $TMPC <<EOF 1195e37630caSaliguori#include <xenctrl.h> 1196e37630caSaliguori#include <xs.h> 1197d5b93ddfSAnthony PERARD#include <stdint.h> 1198d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1199d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1200d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1201d5b93ddfSAnthony PERARD#endif 1202d5b93ddfSAnthony PERARDint main(void) { 1203d5b93ddfSAnthony PERARD xc_interface *xc; 1204d5b93ddfSAnthony PERARD xs_daemon_open(); 1205d5b93ddfSAnthony PERARD xc = xc_interface_open(0, 0, 0); 1206d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1207d5b93ddfSAnthony PERARD xc_gnttab_open(NULL, 0); 1208b87de24eSAnthony PERARD xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0); 1209d5b93ddfSAnthony PERARD return 0; 1210d5b93ddfSAnthony PERARD} 1211e37630caSaliguoriEOF 121252166aa0SJuan Quintela if compile_prog "" "$xen_libs" ; then 1213d5b93ddfSAnthony PERARD xen_ctrl_version=410 1214fc321b4bSJuan Quintela xen=yes 1215d5b93ddfSAnthony PERARD 1216d5b93ddfSAnthony PERARD # Xen 4.0.0 1217d5b93ddfSAnthony PERARD elif ( 1218d5b93ddfSAnthony PERARD cat > $TMPC <<EOF 1219d5b93ddfSAnthony PERARD#include <xenctrl.h> 1220d5b93ddfSAnthony PERARD#include <xs.h> 1221d5b93ddfSAnthony PERARD#include <stdint.h> 1222d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h> 1223d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS) 1224d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined 1225d5b93ddfSAnthony PERARD#endif 1226d5b93ddfSAnthony PERARDint main(void) { 1227b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1228b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1229b87de24eSAnthony PERARD }; 1230d5b93ddfSAnthony PERARD xs_daemon_open(); 1231d5b93ddfSAnthony PERARD xc_interface_open(); 1232d5b93ddfSAnthony PERARD xc_gnttab_open(); 1233d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1234b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1235d5b93ddfSAnthony PERARD return 0; 1236d5b93ddfSAnthony PERARD} 1237d5b93ddfSAnthony PERARDEOF 1238d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 1239d5b93ddfSAnthony PERARD ) ; then 1240d5b93ddfSAnthony PERARD xen_ctrl_version=400 1241d5b93ddfSAnthony PERARD xen=yes 1242d5b93ddfSAnthony PERARD 1243b87de24eSAnthony PERARD # Xen 3.4.0 1244b87de24eSAnthony PERARD elif ( 1245b87de24eSAnthony PERARD cat > $TMPC <<EOF 1246b87de24eSAnthony PERARD#include <xenctrl.h> 1247b87de24eSAnthony PERARD#include <xs.h> 1248b87de24eSAnthony PERARDint main(void) { 1249b87de24eSAnthony PERARD struct xen_add_to_physmap xatp = { 1250b87de24eSAnthony PERARD .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0, 1251b87de24eSAnthony PERARD }; 1252b87de24eSAnthony PERARD xs_daemon_open(); 1253b87de24eSAnthony PERARD xc_interface_open(); 1254b87de24eSAnthony PERARD xc_gnttab_open(); 1255b87de24eSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1256b87de24eSAnthony PERARD xc_memory_op(0, XENMEM_add_to_physmap, &xatp); 1257b87de24eSAnthony PERARD return 0; 1258b87de24eSAnthony PERARD} 1259b87de24eSAnthony PERARDEOF 1260b87de24eSAnthony PERARD compile_prog "" "$xen_libs" 1261b87de24eSAnthony PERARD ) ; then 1262b87de24eSAnthony PERARD xen_ctrl_version=340 1263b87de24eSAnthony PERARD xen=yes 1264b87de24eSAnthony PERARD 1265b87de24eSAnthony PERARD # Xen 3.3.0 1266d5b93ddfSAnthony PERARD elif ( 1267d5b93ddfSAnthony PERARD cat > $TMPC <<EOF 1268d5b93ddfSAnthony PERARD#include <xenctrl.h> 1269d5b93ddfSAnthony PERARD#include <xs.h> 1270d5b93ddfSAnthony PERARDint main(void) { 1271d5b93ddfSAnthony PERARD xs_daemon_open(); 1272d5b93ddfSAnthony PERARD xc_interface_open(); 1273d5b93ddfSAnthony PERARD xc_gnttab_open(); 1274d5b93ddfSAnthony PERARD xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0); 1275d5b93ddfSAnthony PERARD return 0; 1276d5b93ddfSAnthony PERARD} 1277d5b93ddfSAnthony PERARDEOF 1278d5b93ddfSAnthony PERARD compile_prog "" "$xen_libs" 1279d5b93ddfSAnthony PERARD ) ; then 1280d5b93ddfSAnthony PERARD xen_ctrl_version=330 1281d5b93ddfSAnthony PERARD xen=yes 1282d5b93ddfSAnthony PERARD 1283d5b93ddfSAnthony PERARD # Xen not found or unsupported 1284e37630caSaliguori else 1285fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 1286fc321b4bSJuan Quintela feature_not_found "xen" 1287fc321b4bSJuan Quintela fi 1288fc321b4bSJuan Quintela xen=no 1289e37630caSaliguori fi 1290d5b93ddfSAnthony PERARD 1291d5b93ddfSAnthony PERARD if test "$xen" = yes; then 1292d5b93ddfSAnthony PERARD libs_softmmu="$xen_libs $libs_softmmu" 1293d5b93ddfSAnthony PERARD fi 1294e37630caSaliguorifi 1295e37630caSaliguori 1296e37630caSaliguori########################################## 1297a8bd70adSPaolo Bonzini# pkg-config probe 1298f91672e5SPaolo Bonzini 1299a8bd70adSPaolo Bonziniif ! has $pkg_config; then 130008421541SPaolo Bonzini echo warning: proceeding without "$pkg_config" >&2 130108421541SPaolo Bonzini pkg_config=/bin/false 1302f91672e5SPaolo Bonzinifi 1303f91672e5SPaolo Bonzini 1304f91672e5SPaolo Bonzini########################################## 130544dc0ca3SAlon Levy# libtool probe 130644dc0ca3SAlon Levy 130744dc0ca3SAlon Levyif ! has libtool; then 130844dc0ca3SAlon Levy libtool= 130944dc0ca3SAlon Levyelse 131044dc0ca3SAlon Levy libtool=libtool 131144dc0ca3SAlon Levyfi 131244dc0ca3SAlon Levy 131344dc0ca3SAlon Levy########################################## 1314dfffc653SJuan Quintela# Sparse probe 1315dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 13160dba6195SLoïc Minier if has cgcc; then 1317dfffc653SJuan Quintela sparse=yes 1318dfffc653SJuan Quintela else 1319dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 1320dfffc653SJuan Quintela feature_not_found "sparse" 1321dfffc653SJuan Quintela fi 1322dfffc653SJuan Quintela sparse=no 1323dfffc653SJuan Quintela fi 1324dfffc653SJuan Quintelafi 1325dfffc653SJuan Quintela 1326dfffc653SJuan Quintela########################################## 132711d9f695Sbellard# SDL probe 132811d9f695Sbellard 13293ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 13303ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 13313ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then 13323ec87ffeSPaolo Bonzini sdl_config=sdl-config 13333ec87ffeSPaolo Bonzinifi 13343ec87ffeSPaolo Bonzini 13353ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then 1336a8bd70adSPaolo Bonzini sdlconfig="$pkg_config sdl" 1337fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 13383ec87ffeSPaolo Bonzinielif has ${sdl_config}; then 13393ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 13409316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1341a0dfd8a4SLoïc Minierelse 1342a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 1343a0dfd8a4SLoïc Minier feature_not_found "sdl" 1344a0dfd8a4SLoïc Minier fi 1345a0dfd8a4SLoïc Minier sdl=no 13469316f803SPaolo Bonzinifi 134729e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 13483ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 13493ec87ffeSPaolo Bonzinifi 135011d9f695Sbellard 13519316f803SPaolo Bonzinisdl_too_old=no 1352c4198157SJuan Quintelaif test "$sdl" != "no" ; then 135311d9f695Sbellard cat > $TMPC << EOF 135411d9f695Sbellard#include <SDL.h> 135511d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 135611d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 135711d9f695SbellardEOF 13589316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 135974f42e18STeLeMan if test "$static" = "yes" ; then 136074f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 136174f42e18STeLeMan else 13629316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 136374f42e18STeLeMan fi 136452166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 136511d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 136611d9f695Sbellard sdl_too_old=yes 136711d9f695Sbellard else 1368fd677642Sths if test "$cocoa" = "no" ; then 136911d9f695Sbellard sdl=yes 137011d9f695Sbellard fi 1371fd677642Sths fi 13727c1f25b4Sbellard 137367c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 13741ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 137567c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 1376f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 1377f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 137811d9f695Sbellard fi 137952166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 13801ac88f28SJuan Quintela : 13811ac88f28SJuan Quintela else 13821ac88f28SJuan Quintela sdl=no 13837c1f25b4Sbellard fi 13847c1f25b4Sbellard fi # static link 1385c4198157SJuan Quintela else # sdl not found 1386c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1387c4198157SJuan Quintela feature_not_found "sdl" 1388c4198157SJuan Quintela fi 1389c4198157SJuan Quintela sdl=no 13907c1f25b4Sbellard fi # sdl compile test 1391fd677642Sthsfi 139211d9f695Sbellard 13935368a422Saliguoriif test "$sdl" = "yes" ; then 13945368a422Saliguori cat > $TMPC <<EOF 13955368a422Saliguori#include <SDL.h> 13965368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 13975368a422Saliguori#include <X11/XKBlib.h> 13985368a422Saliguori#else 13995368a422Saliguori#error No x11 support 14005368a422Saliguori#endif 14015368a422Saliguoriint main(void) { return 0; } 14025368a422SaliguoriEOF 140352166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1404681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 14055368a422Saliguori fi 140607d9ac44SJuan Quintela if test "$mingw32" = "yes" ; then 140707d9ac44SJuan Quintela sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole" 140807d9ac44SJuan Quintela fi 14090705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 14105368a422Saliguorifi 14115368a422Saliguori 14128f28f3fbSths########################################## 14138d5d2d4cSths# VNC TLS detection 1414821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then 1415ae6b5e5aSaliguori cat > $TMPC <<EOF 1416ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1417ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1418ae6b5e5aSaliguoriEOF 1419a8bd70adSPaolo Bonzini vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` 1420a8bd70adSPaolo Bonzini vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` 142152166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 14221be10ad2SJuan Quintela vnc_tls=yes 1423a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1424ae6b5e5aSaliguori else 14251be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 14261be10ad2SJuan Quintela feature_not_found "vnc-tls" 14271be10ad2SJuan Quintela fi 14281be10ad2SJuan Quintela vnc_tls=no 14298d5d2d4cSths fi 14308d5d2d4cSthsfi 14318d5d2d4cSths 14328d5d2d4cSths########################################## 14332f9606b3Saliguori# VNC SASL detection 1434821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then 14352f9606b3Saliguori cat > $TMPC <<EOF 14362f9606b3Saliguori#include <sasl/sasl.h> 14372f9606b3Saliguori#include <stdio.h> 14382f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 14392f9606b3SaliguoriEOF 14402f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 14412f9606b3Saliguori vnc_sasl_cflags="" 14422f9606b3Saliguori vnc_sasl_libs="-lsasl2" 144352166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1444ea784e3bSJuan Quintela vnc_sasl=yes 1445fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 14462f9606b3Saliguori else 1447ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1448ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1449ea784e3bSJuan Quintela fi 1450ea784e3bSJuan Quintela vnc_sasl=no 14512f9606b3Saliguori fi 14522f9606b3Saliguorifi 14532f9606b3Saliguori 14542f9606b3Saliguori########################################## 14552f6f5c7aSCorentin Chary# VNC JPEG detection 1456821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then 14572f6f5c7aSCorentin Charycat > $TMPC <<EOF 14582f6f5c7aSCorentin Chary#include <stdio.h> 14592f6f5c7aSCorentin Chary#include <jpeglib.h> 14602f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 14612f6f5c7aSCorentin CharyEOF 14622f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 14632f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 14642f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 14652f6f5c7aSCorentin Chary vnc_jpeg=yes 14662f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 14672f6f5c7aSCorentin Chary else 14682f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 14692f6f5c7aSCorentin Chary feature_not_found "vnc-jpeg" 14702f6f5c7aSCorentin Chary fi 14712f6f5c7aSCorentin Chary vnc_jpeg=no 14722f6f5c7aSCorentin Chary fi 14732f6f5c7aSCorentin Charyfi 14742f6f5c7aSCorentin Chary 14752f6f5c7aSCorentin Chary########################################## 1476efe556adSCorentin Chary# VNC PNG detection 1477821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then 1478efe556adSCorentin Charycat > $TMPC <<EOF 1479efe556adSCorentin Chary//#include <stdio.h> 1480efe556adSCorentin Chary#include <png.h> 1481832ce9c2SScott Wood#include <stddef.h> 1482efe556adSCorentin Charyint main(void) { 1483efe556adSCorentin Chary png_structp png_ptr; 1484efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 1485efe556adSCorentin Chary return 0; 1486efe556adSCorentin Chary} 1487efe556adSCorentin CharyEOF 1488efe556adSCorentin Chary vnc_png_cflags="" 1489efe556adSCorentin Chary vnc_png_libs="-lpng" 1490efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 1491efe556adSCorentin Chary vnc_png=yes 1492efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 1493efe556adSCorentin Chary else 1494efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 1495efe556adSCorentin Chary feature_not_found "vnc-png" 1496efe556adSCorentin Chary fi 1497efe556adSCorentin Chary vnc_png=no 1498efe556adSCorentin Chary fi 1499efe556adSCorentin Charyfi 1500efe556adSCorentin Chary 1501efe556adSCorentin Chary########################################## 150276655d6dSaliguori# fnmatch() probe, used for ACL routines 150376655d6dSaliguorifnmatch="no" 150476655d6dSaliguoricat > $TMPC << EOF 150576655d6dSaliguori#include <fnmatch.h> 150676655d6dSaliguoriint main(void) 150776655d6dSaliguori{ 150876655d6dSaliguori fnmatch("foo", "foo", 0); 150976655d6dSaliguori return 0; 151076655d6dSaliguori} 151176655d6dSaliguoriEOF 151252166aa0SJuan Quintelaif compile_prog "" "" ; then 151376655d6dSaliguori fnmatch="yes" 151476655d6dSaliguorifi 151576655d6dSaliguori 151676655d6dSaliguori########################################## 1517ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 1518ee682d27SStefan Weilif test "$uuid" != "no" ; then 1519ee682d27SStefan Weil uuid_libs="-luuid" 1520ee682d27SStefan Weil cat > $TMPC << EOF 1521ee682d27SStefan Weil#include <uuid/uuid.h> 1522ee682d27SStefan Weilint main(void) 1523ee682d27SStefan Weil{ 1524ee682d27SStefan Weil uuid_t my_uuid; 1525ee682d27SStefan Weil uuid_generate(my_uuid); 1526ee682d27SStefan Weil return 0; 1527ee682d27SStefan Weil} 1528ee682d27SStefan WeilEOF 1529ee682d27SStefan Weil if compile_prog "" "$uuid_libs" ; then 1530ee682d27SStefan Weil uuid="yes" 1531ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1532ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1533ee682d27SStefan Weil else 1534ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1535ee682d27SStefan Weil feature_not_found "uuid" 1536ee682d27SStefan Weil fi 1537ee682d27SStefan Weil uuid=no 1538ee682d27SStefan Weil fi 1539ee682d27SStefan Weilfi 1540ee682d27SStefan Weil 1541ee682d27SStefan Weil########################################## 1542dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix 1543dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 1544dce512deSChristoph Hellwig cat > $TMPC << EOF 1545dce512deSChristoph Hellwig#include <xfs/xfs.h> 1546dce512deSChristoph Hellwigint main(void) 1547dce512deSChristoph Hellwig{ 1548dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 1549dce512deSChristoph Hellwig return 0; 1550dce512deSChristoph Hellwig} 1551dce512deSChristoph HellwigEOF 1552dce512deSChristoph Hellwig if compile_prog "" "" ; then 1553dce512deSChristoph Hellwig xfs="yes" 1554dce512deSChristoph Hellwig else 1555dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 1556dce512deSChristoph Hellwig feature_not_found "xfs" 1557dce512deSChristoph Hellwig fi 1558dce512deSChristoph Hellwig xfs=no 1559dce512deSChristoph Hellwig fi 1560dce512deSChristoph Hellwigfi 1561dce512deSChristoph Hellwig 1562dce512deSChristoph Hellwig########################################## 15638a16d273Sths# vde libraries probe 1564dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 15654baae0acSJuan Quintela vde_libs="-lvdeplug" 15668a16d273Sths cat > $TMPC << EOF 15678a16d273Sths#include <libvdeplug.h> 15684a7f0e06Spbrookint main(void) 15694a7f0e06Spbrook{ 15704a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 15714a7f0e06Spbrook vde_open("", "", &a); 15724a7f0e06Spbrook return 0; 15734a7f0e06Spbrook} 15748a16d273SthsEOF 157552166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 15764baae0acSJuan Quintela vde=yes 15778e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 15788e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 1579dfb278bdSJuan Quintela else 1580dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 1581dfb278bdSJuan Quintela feature_not_found "vde" 1582dfb278bdSJuan Quintela fi 1583dfb278bdSJuan Quintela vde=no 15848a16d273Sths fi 15858a16d273Sthsfi 15868a16d273Sths 15878a16d273Sths########################################## 1588c2de5c91Smalc# Sound support libraries probe 15898f28f3fbSths 1590c2de5c91Smalcaudio_drv_probe() 1591c2de5c91Smalc{ 1592c2de5c91Smalc drv=$1 1593c2de5c91Smalc hdr=$2 1594c2de5c91Smalc lib=$3 1595c2de5c91Smalc exp=$4 1596c2de5c91Smalc cfl=$5 15978f28f3fbSths cat > $TMPC << EOF 1598c2de5c91Smalc#include <$hdr> 1599c2de5c91Smalcint main(void) { $exp } 16008f28f3fbSthsEOF 160152166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 16028f28f3fbSths : 16038f28f3fbSths else 16048f28f3fbSths echo 1605c2de5c91Smalc echo "Error: $drv check failed" 1606c2de5c91Smalc echo "Make sure to have the $drv libs and headers installed." 16078f28f3fbSths echo 16088f28f3fbSths exit 1 16098f28f3fbSths fi 1610c2de5c91Smalc} 1611c2de5c91Smalc 16122fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 1613c2de5c91Smalcfor drv in $audio_drv_list; do 1614c2de5c91Smalc case $drv in 1615c2de5c91Smalc alsa) 1616c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 1617c2de5c91Smalc "snd_pcm_t **handle; return snd_pcm_close(*handle);" 1618a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 1619c2de5c91Smalc ;; 1620c2de5c91Smalc 1621c2de5c91Smalc fmod) 1622c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 1623c2de5c91Smalc echo 1624c2de5c91Smalc echo "Error: You must specify path to FMOD library and headers" 1625c2de5c91Smalc echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 1626c2de5c91Smalc echo 1627c2de5c91Smalc exit 1 16288f28f3fbSths fi 1629c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 1630a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 1631c2de5c91Smalc ;; 1632c2de5c91Smalc 1633c2de5c91Smalc esd) 1634c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 1635a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 163667f86e8eSJuan Quintela audio_pt_int="yes" 1637c2de5c91Smalc ;; 1638b8e59f18Smalc 1639b8e59f18Smalc pa) 1640493abda6SAurelien Jarno audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \ 1641*20fa53ecSMarc-Antoine Perennou "pa_simple *s = 0; pa_simple_free(s); return 0;" 1642493abda6SAurelien Jarno libs_softmmu="-lpulse -lpulse-simple $libs_softmmu" 164367f86e8eSJuan Quintela audio_pt_int="yes" 1644b8e59f18Smalc ;; 1645b8e59f18Smalc 1646997e690aSJuan Quintela coreaudio) 1647997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 1648997e690aSJuan Quintela ;; 1649997e690aSJuan Quintela 1650a4bf6780SJuan Quintela dsound) 1651a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 1652d5631638Smalc audio_win_int="yes" 1653a4bf6780SJuan Quintela ;; 1654a4bf6780SJuan Quintela 1655a4bf6780SJuan Quintela oss) 1656a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 1657a4bf6780SJuan Quintela ;; 1658a4bf6780SJuan Quintela 1659a4bf6780SJuan Quintela sdl|wav) 16602f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 16612f6a1ab0Sblueswir1 ;; 16622f6a1ab0Sblueswir1 1663d5631638Smalc winwave) 1664d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 1665d5631638Smalc audio_win_int="yes" 1666d5631638Smalc ;; 1667d5631638Smalc 1668e4c63a6aSmalc *) 16691c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 1670e4c63a6aSmalc echo 1671e4c63a6aSmalc echo "Error: Unknown driver '$drv' selected" 1672e4c63a6aSmalc echo "Possible drivers are: $audio_possible_drivers" 1673e4c63a6aSmalc echo 1674e4c63a6aSmalc exit 1 1675e4c63a6aSmalc } 1676e4c63a6aSmalc ;; 1677c2de5c91Smalc esac 1678c2de5c91Smalcdone 16798f28f3fbSths 16804d3b6f6eSbalrog########################################## 16812e4d9fb1Saurel32# BrlAPI probe 16822e4d9fb1Saurel32 16834ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 1684eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 16852e4d9fb1Saurel32 cat > $TMPC << EOF 16862e4d9fb1Saurel32#include <brlapi.h> 1687832ce9c2SScott Wood#include <stddef.h> 16882e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 16892e4d9fb1Saurel32EOF 169052166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 16912e4d9fb1Saurel32 brlapi=yes 1692264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 16934ffcedb6SJuan Quintela else 16944ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 16954ffcedb6SJuan Quintela feature_not_found "brlapi" 16964ffcedb6SJuan Quintela fi 16974ffcedb6SJuan Quintela brlapi=no 1698eb82284fSJuan Quintela fi 1699eb82284fSJuan Quintelafi 17002e4d9fb1Saurel32 17012e4d9fb1Saurel32########################################## 17024d3b6f6eSbalrog# curses probe 1703e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then 1704e095e2f3SStefan Weil curses_list="-lpdcurses" 1705e095e2f3SStefan Weilelse 17064f78ef9aSJuan Quintela curses_list="-lncurses -lcurses" 1707e095e2f3SStefan Weilfi 17084d3b6f6eSbalrog 1709c584a6d0SJuan Quintelaif test "$curses" != "no" ; then 1710c584a6d0SJuan Quintela curses_found=no 17114d3b6f6eSbalrog cat > $TMPC << EOF 17124d3b6f6eSbalrog#include <curses.h> 17135a8ff3aaSblueswir1#ifdef __OpenBSD__ 17145a8ff3aaSblueswir1#define resize_term resizeterm 17155a8ff3aaSblueswir1#endif 17165a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); } 17174d3b6f6eSbalrogEOF 17184f78ef9aSJuan Quintela for curses_lib in $curses_list; do 17194f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 1720c584a6d0SJuan Quintela curses_found=yes 17214f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 17224f78ef9aSJuan Quintela break 17234d3b6f6eSbalrog fi 17244f78ef9aSJuan Quintela done 1725c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 1726c584a6d0SJuan Quintela curses=yes 1727c584a6d0SJuan Quintela else 1728c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 1729c584a6d0SJuan Quintela feature_not_found "curses" 1730c584a6d0SJuan Quintela fi 1731c584a6d0SJuan Quintela curses=no 1732c584a6d0SJuan Quintela fi 17334f78ef9aSJuan Quintelafi 17344d3b6f6eSbalrog 1735414f0dabSblueswir1########################################## 1736769ce76dSAlexander Graf# curl probe 1737769ce76dSAlexander Graf 1738a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then 1739a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 17404e2b0658SPaolo Bonzinielse 17414e2b0658SPaolo Bonzini curlconfig=curl-config 17424e2b0658SPaolo Bonzinifi 17434e2b0658SPaolo Bonzini 1744788c8196SJuan Quintelaif test "$curl" != "no" ; then 1745769ce76dSAlexander Graf cat > $TMPC << EOF 1746769ce76dSAlexander Graf#include <curl/curl.h> 17470b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; } 1748769ce76dSAlexander GrafEOF 17494e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 17504e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 1751b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 1752769ce76dSAlexander Graf curl=yes 1753f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 1754f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 1755788c8196SJuan Quintela else 1756788c8196SJuan Quintela if test "$curl" = "yes" ; then 1757788c8196SJuan Quintela feature_not_found "curl" 1758788c8196SJuan Quintela fi 1759788c8196SJuan Quintela curl=no 1760769ce76dSAlexander Graf fi 1761769ce76dSAlexander Graffi # test "$curl" 1762769ce76dSAlexander Graf 1763769ce76dSAlexander Graf########################################## 17645495ed11SLuiz Capitulino# check framework probe 17655495ed11SLuiz Capitulino 17665495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then 17675495ed11SLuiz Capitulino cat > $TMPC << EOF 17685495ed11SLuiz Capitulino#include <check.h> 17695495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; } 17705495ed11SLuiz CapitulinoEOF 1771a8bd70adSPaolo Bonzini check_libs=`$pkg_config --libs check` 17725495ed11SLuiz Capitulino if compile_prog "" $check_libs ; then 17735495ed11SLuiz Capitulino check_utests=yes 17745495ed11SLuiz Capitulino libs_tools="$check_libs $libs_tools" 17755495ed11SLuiz Capitulino else 17765495ed11SLuiz Capitulino if test "$check_utests" = "yes" ; then 17775495ed11SLuiz Capitulino feature_not_found "check" 17785495ed11SLuiz Capitulino fi 17795495ed11SLuiz Capitulino check_utests=no 17805495ed11SLuiz Capitulino fi 17815495ed11SLuiz Capitulinofi # test "$check_utests" 17825495ed11SLuiz Capitulino 17835495ed11SLuiz Capitulino########################################## 1784fb599c9aSbalrog# bluez support probe 1785a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 1786e820e3f4Sbalrog cat > $TMPC << EOF 1787e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 1788e820e3f4Sbalrogint main(void) { return bt_error(0); } 1789e820e3f4SbalrogEOF 1790a8bd70adSPaolo Bonzini bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` 1791a8bd70adSPaolo Bonzini bluez_libs=`$pkg_config --libs bluez 2> /dev/null` 179252166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 1793a20a6f46SJuan Quintela bluez=yes 1794e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 1795e820e3f4Sbalrog else 1796a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 1797a20a6f46SJuan Quintela feature_not_found "bluez" 1798a20a6f46SJuan Quintela fi 1799e820e3f4Sbalrog bluez="no" 1800e820e3f4Sbalrog fi 1801fb599c9aSbalrogfi 1802fb599c9aSbalrog 1803fb599c9aSbalrog########################################## 1804e5d355d1Saliguori# pthread probe 1805de65fe0fSSebastian HerbsztPTHREADLIBS_LIST="-lpthread -lpthreadGC2" 18063c529d93Saliguori 1807e5d355d1Saliguoripthread=no 1808414f0dabSblueswir1cat > $TMPC << EOF 18093c529d93Saliguori#include <pthread.h> 1810de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; } 1811414f0dabSblueswir1EOF 1812bd00d539SAndreas Färberif compile_prog "" "" ; then 1813bd00d539SAndreas Färber pthread=yes 1814bd00d539SAndreas Färberelse 1815de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 181652166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 1817e5d355d1Saliguori pthread=yes 18185572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 1819de65fe0fSSebastian Herbszt break 1820414f0dabSblueswir1 fi 1821de65fe0fSSebastian Herbszt done 1822bd00d539SAndreas Färberfi 1823414f0dabSblueswir1 18244617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 18254dd75c70SChristoph Hellwig echo 18264dd75c70SChristoph Hellwig echo "Error: pthread check failed" 18274dd75c70SChristoph Hellwig echo "Make sure to have the pthread libs and headers installed." 18284dd75c70SChristoph Hellwig echo 18294dd75c70SChristoph Hellwig exit 1 1830e5d355d1Saliguorifi 1831e5d355d1Saliguori 1832bf9298b9Saliguori########################################## 1833f27aaf4bSChristian Brunner# rbd probe 1834f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 1835f27aaf4bSChristian Brunner cat > $TMPC <<EOF 1836f27aaf4bSChristian Brunner#include <stdio.h> 1837ad32e9c0SJosh Durgin#include <rbd/librbd.h> 1838f27aaf4bSChristian Brunnerint main(void) { 1839ad32e9c0SJosh Durgin rados_t cluster; 1840ad32e9c0SJosh Durgin rados_create(&cluster, NULL); 1841f27aaf4bSChristian Brunner return 0; 1842f27aaf4bSChristian Brunner} 1843f27aaf4bSChristian BrunnerEOF 1844ad32e9c0SJosh Durgin rbd_libs="-lrbd -lrados" 1845f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 1846f27aaf4bSChristian Brunner rbd=yes 1847f27aaf4bSChristian Brunner libs_tools="$rbd_libs $libs_tools" 1848f27aaf4bSChristian Brunner libs_softmmu="$rbd_libs $libs_softmmu" 1849f27aaf4bSChristian Brunner else 1850f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 1851f27aaf4bSChristian Brunner feature_not_found "rados block device" 1852f27aaf4bSChristian Brunner fi 1853f27aaf4bSChristian Brunner rbd=no 1854f27aaf4bSChristian Brunner fi 1855f27aaf4bSChristian Brunnerfi 1856f27aaf4bSChristian Brunner 1857f27aaf4bSChristian Brunner########################################## 18585c6c3a6cSChristoph Hellwig# linux-aio probe 18595c6c3a6cSChristoph Hellwig 18605c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 18615c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 18625c6c3a6cSChristoph Hellwig#include <libaio.h> 18635c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 1864832ce9c2SScott Wood#include <stddef.h> 18655c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 18665c6c3a6cSChristoph HellwigEOF 18675c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 18685c6c3a6cSChristoph Hellwig linux_aio=yes 1869048d179fSPaul Brook libs_softmmu="$libs_softmmu -laio" 1870048d179fSPaul Brook libs_tools="$libs_tools -laio" 18715c6c3a6cSChristoph Hellwig else 18725c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 18735c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 18745c6c3a6cSChristoph Hellwig fi 18753cfcae3cSLuiz Capitulino linux_aio=no 18765c6c3a6cSChristoph Hellwig fi 18775c6c3a6cSChristoph Hellwigfi 18785c6c3a6cSChristoph Hellwig 18795c6c3a6cSChristoph Hellwig########################################## 1880758e8e38SVenkateswararao Jujjuri (JV)# attr probe 1881758e8e38SVenkateswararao Jujjuri (JV) 1882758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 1883758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 1884758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 1885758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 1886758e8e38SVenkateswararao Jujjuri (JV)#include <attr/xattr.h> 1887758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 1888758e8e38SVenkateswararao Jujjuri (JV)EOF 1889758e8e38SVenkateswararao Jujjuri (JV) if compile_prog "" "-lattr" ; then 1890758e8e38SVenkateswararao Jujjuri (JV) attr=yes 1891758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 1892758e8e38SVenkateswararao Jujjuri (JV) else 1893758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 1894758e8e38SVenkateswararao Jujjuri (JV) feature_not_found "ATTR" 1895758e8e38SVenkateswararao Jujjuri (JV) fi 1896758e8e38SVenkateswararao Jujjuri (JV) attr=no 1897758e8e38SVenkateswararao Jujjuri (JV) fi 1898758e8e38SVenkateswararao Jujjuri (JV)fi 1899758e8e38SVenkateswararao Jujjuri (JV) 1900758e8e38SVenkateswararao Jujjuri (JV)########################################## 1901bf9298b9Saliguori# iovec probe 1902bf9298b9Saliguoricat > $TMPC <<EOF 1903db34f0b3Sblueswir1#include <sys/types.h> 1904bf9298b9Saliguori#include <sys/uio.h> 1905db34f0b3Sblueswir1#include <unistd.h> 1906bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; } 1907bf9298b9SaliguoriEOF 1908bf9298b9Saliguoriiovec=no 190952166aa0SJuan Quintelaif compile_prog "" "" ; then 1910bf9298b9Saliguori iovec=yes 1911bf9298b9Saliguorifi 1912bf9298b9Saliguori 1913f652e6afSaurel32########################################## 1914ceb42de8Saliguori# preadv probe 1915ceb42de8Saliguoricat > $TMPC <<EOF 1916ceb42de8Saliguori#include <sys/types.h> 1917ceb42de8Saliguori#include <sys/uio.h> 1918ceb42de8Saliguori#include <unistd.h> 1919ceb42de8Saliguoriint main(void) { preadv; } 1920ceb42de8SaliguoriEOF 1921ceb42de8Saliguoripreadv=no 192252166aa0SJuan Quintelaif compile_prog "" "" ; then 1923ceb42de8Saliguori preadv=yes 1924ceb42de8Saliguorifi 1925ceb42de8Saliguori 1926ceb42de8Saliguori########################################## 1927f652e6afSaurel32# fdt probe 19282df87df7SJuan Quintelaif test "$fdt" != "no" ; then 1929b41af4baSJuan Quintela fdt_libs="-lfdt" 1930f652e6afSaurel32 cat > $TMPC << EOF 1931f652e6afSaurel32int main(void) { return 0; } 1932f652e6afSaurel32EOF 193352166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 1934f652e6afSaurel32 fdt=yes 19352df87df7SJuan Quintela else 19362df87df7SJuan Quintela if test "$fdt" = "yes" ; then 19372df87df7SJuan Quintela feature_not_found "fdt" 19382df87df7SJuan Quintela fi 1939de3a354aSMichael Walle fdt_libs= 19402df87df7SJuan Quintela fdt=no 1941f652e6afSaurel32 fi 1942f652e6afSaurel32fi 1943f652e6afSaurel32 194420ff075bSMichael Walle########################################## 194520ff075bSMichael Walle# opengl probe, used by milkymist-tmu2 194620ff075bSMichael Walleif test "$opengl" != "no" ; then 194720ff075bSMichael Walle opengl_libs="-lGL" 194820ff075bSMichael Walle cat > $TMPC << EOF 194920ff075bSMichael Walle#include <X11/Xlib.h> 195020ff075bSMichael Walle#include <GL/gl.h> 195120ff075bSMichael Walle#include <GL/glx.h> 195220ff075bSMichael Walleint main(void) { GL_VERSION; return 0; } 195320ff075bSMichael WalleEOF 195420ff075bSMichael Walle if compile_prog "" "-lGL" ; then 195520ff075bSMichael Walle opengl=yes 195620ff075bSMichael Walle else 195720ff075bSMichael Walle if test "$opengl" = "yes" ; then 195820ff075bSMichael Walle feature_not_found "opengl" 195920ff075bSMichael Walle fi 1960de3a354aSMichael Walle opengl_libs= 196120ff075bSMichael Walle opengl=no 196220ff075bSMichael Walle fi 196320ff075bSMichael Wallefi 196420ff075bSMichael Walle 19653b3f24adSaurel32# 19663b3f24adSaurel32# Check for xxxat() functions when we are building linux-user 19673b3f24adSaurel32# emulator. This is done because older glibc versions don't 19683b3f24adSaurel32# have syscall stubs for these implemented. 19693b3f24adSaurel32# 19703b3f24adSaurel32atfile=no 19713b3f24adSaurel32cat > $TMPC << EOF 19723b3f24adSaurel32#define _ATFILE_SOURCE 19733b3f24adSaurel32#include <sys/types.h> 19743b3f24adSaurel32#include <fcntl.h> 19753b3f24adSaurel32#include <unistd.h> 19763b3f24adSaurel32 19773b3f24adSaurel32int 19783b3f24adSaurel32main(void) 19793b3f24adSaurel32{ 19803b3f24adSaurel32 /* try to unlink nonexisting file */ 19813b3f24adSaurel32 return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); 19823b3f24adSaurel32} 19833b3f24adSaurel32EOF 198452166aa0SJuan Quintelaif compile_prog "" "" ; then 19853b3f24adSaurel32 atfile=yes 19863b3f24adSaurel32fi 19873b3f24adSaurel32 198839386ac7Saurel32# Check for inotify functions when we are building linux-user 19893b3f24adSaurel32# emulator. This is done because older glibc versions don't 19903b3f24adSaurel32# have syscall stubs for these implemented. In that case we 19913b3f24adSaurel32# don't provide them even if kernel supports them. 19923b3f24adSaurel32# 19933b3f24adSaurel32inotify=no 19943b3f24adSaurel32cat > $TMPC << EOF 19953b3f24adSaurel32#include <sys/inotify.h> 19963b3f24adSaurel32 19973b3f24adSaurel32int 19983b3f24adSaurel32main(void) 19993b3f24adSaurel32{ 20003b3f24adSaurel32 /* try to start inotify */ 20018690e420Saurel32 return inotify_init(); 20023b3f24adSaurel32} 20033b3f24adSaurel32EOF 200452166aa0SJuan Quintelaif compile_prog "" "" ; then 20053b3f24adSaurel32 inotify=yes 20063b3f24adSaurel32fi 20073b3f24adSaurel32 2008c05c7a73SRiku Voipioinotify1=no 2009c05c7a73SRiku Voipiocat > $TMPC << EOF 2010c05c7a73SRiku Voipio#include <sys/inotify.h> 2011c05c7a73SRiku Voipio 2012c05c7a73SRiku Voipioint 2013c05c7a73SRiku Voipiomain(void) 2014c05c7a73SRiku Voipio{ 2015c05c7a73SRiku Voipio /* try to start inotify */ 2016c05c7a73SRiku Voipio return inotify_init1(0); 2017c05c7a73SRiku Voipio} 2018c05c7a73SRiku VoipioEOF 2019c05c7a73SRiku Voipioif compile_prog "" "" ; then 2020c05c7a73SRiku Voipio inotify1=yes 2021c05c7a73SRiku Voipiofi 2022c05c7a73SRiku Voipio 2023ebc996f3SRiku Voipio# check if utimensat and futimens are supported 2024ebc996f3SRiku Voipioutimens=no 2025ebc996f3SRiku Voipiocat > $TMPC << EOF 2026ebc996f3SRiku Voipio#define _ATFILE_SOURCE 2027ebc996f3SRiku Voipio#include <stddef.h> 2028ebc996f3SRiku Voipio#include <fcntl.h> 2029ebc996f3SRiku Voipio 2030ebc996f3SRiku Voipioint main(void) 2031ebc996f3SRiku Voipio{ 2032ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 2033ebc996f3SRiku Voipio futimens(0, NULL); 2034ebc996f3SRiku Voipio return 0; 2035ebc996f3SRiku Voipio} 2036ebc996f3SRiku VoipioEOF 203752166aa0SJuan Quintelaif compile_prog "" "" ; then 2038ebc996f3SRiku Voipio utimens=yes 2039ebc996f3SRiku Voipiofi 2040ebc996f3SRiku Voipio 2041099d6b0fSRiku Voipio# check if pipe2 is there 2042099d6b0fSRiku Voipiopipe2=no 2043099d6b0fSRiku Voipiocat > $TMPC << EOF 2044099d6b0fSRiku Voipio#include <unistd.h> 2045099d6b0fSRiku Voipio#include <fcntl.h> 2046099d6b0fSRiku Voipio 2047099d6b0fSRiku Voipioint main(void) 2048099d6b0fSRiku Voipio{ 2049099d6b0fSRiku Voipio int pipefd[2]; 2050099d6b0fSRiku Voipio pipe2(pipefd, O_CLOEXEC); 2051099d6b0fSRiku Voipio return 0; 2052099d6b0fSRiku Voipio} 2053099d6b0fSRiku VoipioEOF 205452166aa0SJuan Quintelaif compile_prog "" "" ; then 2055099d6b0fSRiku Voipio pipe2=yes 2056099d6b0fSRiku Voipiofi 2057099d6b0fSRiku Voipio 205840ff6d7eSKevin Wolf# check if accept4 is there 205940ff6d7eSKevin Wolfaccept4=no 206040ff6d7eSKevin Wolfcat > $TMPC << EOF 206140ff6d7eSKevin Wolf#include <sys/socket.h> 206240ff6d7eSKevin Wolf#include <stddef.h> 206340ff6d7eSKevin Wolf 206440ff6d7eSKevin Wolfint main(void) 206540ff6d7eSKevin Wolf{ 206640ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 206740ff6d7eSKevin Wolf return 0; 206840ff6d7eSKevin Wolf} 206940ff6d7eSKevin WolfEOF 207040ff6d7eSKevin Wolfif compile_prog "" "" ; then 207140ff6d7eSKevin Wolf accept4=yes 207240ff6d7eSKevin Wolffi 207340ff6d7eSKevin Wolf 20743ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 20753ce34dfbSvibisreenivasansplice=no 20763ce34dfbSvibisreenivasancat > $TMPC << EOF 20773ce34dfbSvibisreenivasan#include <unistd.h> 20783ce34dfbSvibisreenivasan#include <fcntl.h> 20793ce34dfbSvibisreenivasan#include <limits.h> 20803ce34dfbSvibisreenivasan 20813ce34dfbSvibisreenivasanint main(void) 20823ce34dfbSvibisreenivasan{ 20833ce34dfbSvibisreenivasan int len, fd; 20843ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 20853ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 20863ce34dfbSvibisreenivasan return 0; 20873ce34dfbSvibisreenivasan} 20883ce34dfbSvibisreenivasanEOF 208952166aa0SJuan Quintelaif compile_prog "" "" ; then 20903ce34dfbSvibisreenivasan splice=yes 20913ce34dfbSvibisreenivasanfi 20923ce34dfbSvibisreenivasan 2093dcc38d1cSMarcelo Tosatti########################################## 2094dcc38d1cSMarcelo Tosatti# signalfd probe 2095dcc38d1cSMarcelo Tosattisignalfd="no" 2096dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 2097dcc38d1cSMarcelo Tosatti#define _GNU_SOURCE 2098dcc38d1cSMarcelo Tosatti#include <unistd.h> 2099dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 2100dcc38d1cSMarcelo Tosatti#include <signal.h> 2101dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 2102dcc38d1cSMarcelo TosattiEOF 2103dcc38d1cSMarcelo Tosatti 2104dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 2105dcc38d1cSMarcelo Tosatti signalfd=yes 2106de758970SJan Kiszkaelif test "$kvm" = "yes" -a "$io_thread" != "yes"; then 2107de758970SJan Kiszka echo 2108de758970SJan Kiszka echo "ERROR: Host kernel lacks signalfd() support," 2109de758970SJan Kiszka echo "but KVM depends on it when the IO thread is disabled." 2110de758970SJan Kiszka echo 2111de758970SJan Kiszka exit 1 2112dcc38d1cSMarcelo Tosattifi 2113dcc38d1cSMarcelo Tosatti 2114c2882b96SRiku Voipio# check if eventfd is supported 2115c2882b96SRiku Voipioeventfd=no 2116c2882b96SRiku Voipiocat > $TMPC << EOF 2117c2882b96SRiku Voipio#include <sys/eventfd.h> 2118c2882b96SRiku Voipio 2119c2882b96SRiku Voipioint main(void) 2120c2882b96SRiku Voipio{ 2121c2882b96SRiku Voipio int efd = eventfd(0, 0); 2122c2882b96SRiku Voipio return 0; 2123c2882b96SRiku Voipio} 2124c2882b96SRiku VoipioEOF 2125c2882b96SRiku Voipioif compile_prog "" "" ; then 2126c2882b96SRiku Voipio eventfd=yes 2127c2882b96SRiku Voipiofi 2128c2882b96SRiku Voipio 2129d0927938SUlrich Hecht# check for fallocate 2130d0927938SUlrich Hechtfallocate=no 2131d0927938SUlrich Hechtcat > $TMPC << EOF 2132d0927938SUlrich Hecht#include <fcntl.h> 2133d0927938SUlrich Hecht 2134d0927938SUlrich Hechtint main(void) 2135d0927938SUlrich Hecht{ 2136d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 2137d0927938SUlrich Hecht return 0; 2138d0927938SUlrich Hecht} 2139d0927938SUlrich HechtEOF 2140be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then 2141d0927938SUlrich Hecht fallocate=yes 2142d0927938SUlrich Hechtfi 2143d0927938SUlrich Hecht 2144c727f47dSPeter Maydell# check for sync_file_range 2145c727f47dSPeter Maydellsync_file_range=no 2146c727f47dSPeter Maydellcat > $TMPC << EOF 2147c727f47dSPeter Maydell#include <fcntl.h> 2148c727f47dSPeter Maydell 2149c727f47dSPeter Maydellint main(void) 2150c727f47dSPeter Maydell{ 2151c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 2152c727f47dSPeter Maydell return 0; 2153c727f47dSPeter Maydell} 2154c727f47dSPeter MaydellEOF 2155c727f47dSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2156c727f47dSPeter Maydell sync_file_range=yes 2157c727f47dSPeter Maydellfi 2158c727f47dSPeter Maydell 2159dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 2160dace20dcSPeter Maydellfiemap=no 2161dace20dcSPeter Maydellcat > $TMPC << EOF 2162dace20dcSPeter Maydell#include <sys/ioctl.h> 2163dace20dcSPeter Maydell#include <linux/fs.h> 2164dace20dcSPeter Maydell#include <linux/fiemap.h> 2165dace20dcSPeter Maydell 2166dace20dcSPeter Maydellint main(void) 2167dace20dcSPeter Maydell{ 2168dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 2169dace20dcSPeter Maydell return 0; 2170dace20dcSPeter Maydell} 2171dace20dcSPeter MaydellEOF 2172dace20dcSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2173dace20dcSPeter Maydell fiemap=yes 2174dace20dcSPeter Maydellfi 2175dace20dcSPeter Maydell 2176d0927938SUlrich Hecht# check for dup3 2177d0927938SUlrich Hechtdup3=no 2178d0927938SUlrich Hechtcat > $TMPC << EOF 2179d0927938SUlrich Hecht#include <unistd.h> 2180d0927938SUlrich Hecht 2181d0927938SUlrich Hechtint main(void) 2182d0927938SUlrich Hecht{ 2183d0927938SUlrich Hecht dup3(0, 0, 0); 2184d0927938SUlrich Hecht return 0; 2185d0927938SUlrich Hecht} 2186d0927938SUlrich HechtEOF 218778f5d726SJan Kiszkaif compile_prog "" "" ; then 2188d0927938SUlrich Hecht dup3=yes 2189d0927938SUlrich Hechtfi 2190d0927938SUlrich Hecht 21913b6edd16SPeter Maydell# check for epoll support 21923b6edd16SPeter Maydellepoll=no 21933b6edd16SPeter Maydellcat > $TMPC << EOF 21943b6edd16SPeter Maydell#include <sys/epoll.h> 21953b6edd16SPeter Maydell 21963b6edd16SPeter Maydellint main(void) 21973b6edd16SPeter Maydell{ 21983b6edd16SPeter Maydell epoll_create(0); 21993b6edd16SPeter Maydell return 0; 22003b6edd16SPeter Maydell} 22013b6edd16SPeter MaydellEOF 22023b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 22033b6edd16SPeter Maydell epoll=yes 22043b6edd16SPeter Maydellfi 22053b6edd16SPeter Maydell 22063b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions 22073b6edd16SPeter Maydell# so we must check separately for their presence 22083b6edd16SPeter Maydellepoll_create1=no 22093b6edd16SPeter Maydellcat > $TMPC << EOF 22103b6edd16SPeter Maydell#include <sys/epoll.h> 22113b6edd16SPeter Maydell 22123b6edd16SPeter Maydellint main(void) 22133b6edd16SPeter Maydell{ 221419e83f6bSPeter Maydell /* Note that we use epoll_create1 as a value, not as 221519e83f6bSPeter Maydell * a function being called. This is necessary so that on 221619e83f6bSPeter Maydell * old SPARC glibc versions where the function was present in 221719e83f6bSPeter Maydell * the library but not declared in the header file we will 221819e83f6bSPeter Maydell * fail the configure check. (Otherwise we will get a compiler 221919e83f6bSPeter Maydell * warning but not an error, and will proceed to fail the 222019e83f6bSPeter Maydell * qemu compile where we compile with -Werror.) 222119e83f6bSPeter Maydell */ 222219e83f6bSPeter Maydell epoll_create1; 22233b6edd16SPeter Maydell return 0; 22243b6edd16SPeter Maydell} 22253b6edd16SPeter MaydellEOF 22263b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 22273b6edd16SPeter Maydell epoll_create1=yes 22283b6edd16SPeter Maydellfi 22293b6edd16SPeter Maydell 22303b6edd16SPeter Maydellepoll_pwait=no 22313b6edd16SPeter Maydellcat > $TMPC << EOF 22323b6edd16SPeter Maydell#include <sys/epoll.h> 22333b6edd16SPeter Maydell 22343b6edd16SPeter Maydellint main(void) 22353b6edd16SPeter Maydell{ 22363b6edd16SPeter Maydell epoll_pwait(0, 0, 0, 0, 0); 22373b6edd16SPeter Maydell return 0; 22383b6edd16SPeter Maydell} 22393b6edd16SPeter MaydellEOF 22403b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 22413b6edd16SPeter Maydell epoll_pwait=yes 22423b6edd16SPeter Maydellfi 22433b6edd16SPeter Maydell 2244cc8ae6deSpbrook# Check if tools are available to build documentation. 2245a25dba17SJuan Quintelaif test "$docs" != "no" ; then 224601668d98SStefan Weil if has makeinfo && has pod2man; then 2247a25dba17SJuan Quintela docs=yes 224883a3ab8bSJuan Quintela else 2249a25dba17SJuan Quintela if test "$docs" = "yes" ; then 2250a25dba17SJuan Quintela feature_not_found "docs" 225183a3ab8bSJuan Quintela fi 2252a25dba17SJuan Quintela docs=no 225383a3ab8bSJuan Quintela fi 2254cc8ae6deSpbrookfi 2255cc8ae6deSpbrook 2256f514f41cSStefan Weil# Search for bswap_32 function 22576ae9a1f4SJuan Quintelabyteswap_h=no 22586ae9a1f4SJuan Quintelacat > $TMPC << EOF 22596ae9a1f4SJuan Quintela#include <byteswap.h> 22606ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 22616ae9a1f4SJuan QuintelaEOF 226252166aa0SJuan Quintelaif compile_prog "" "" ; then 22636ae9a1f4SJuan Quintela byteswap_h=yes 22646ae9a1f4SJuan Quintelafi 22656ae9a1f4SJuan Quintela 2266f514f41cSStefan Weil# Search for bswap_32 function 22676ae9a1f4SJuan Quintelabswap_h=no 22686ae9a1f4SJuan Quintelacat > $TMPC << EOF 22696ae9a1f4SJuan Quintela#include <sys/endian.h> 22706ae9a1f4SJuan Quintela#include <sys/types.h> 22716ae9a1f4SJuan Quintela#include <machine/bswap.h> 22726ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 22736ae9a1f4SJuan QuintelaEOF 227452166aa0SJuan Quintelaif compile_prog "" "" ; then 22756ae9a1f4SJuan Quintela bswap_h=yes 22766ae9a1f4SJuan Quintelafi 22776ae9a1f4SJuan Quintela 2278da93a1fdSaliguori########################################## 2279da93a1fdSaliguori# Do we need librt 2280da93a1fdSaliguoricat > $TMPC <<EOF 2281da93a1fdSaliguori#include <signal.h> 2282da93a1fdSaliguori#include <time.h> 2283da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); } 2284da93a1fdSaliguoriEOF 2285da93a1fdSaliguori 228652166aa0SJuan Quintelaif compile_prog "" "" ; then 228707ffa4bdSJuan Quintela : 228852166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then 228907ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 2290da93a1fdSaliguorifi 2291da93a1fdSaliguori 229231ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 2293179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 22946362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 22956362a53fSJuan Quintelafi 22966362a53fSJuan Quintela 2297de5071c5SBlue Swirl########################################## 2298de5071c5SBlue Swirl# check if the compiler defines offsetof 2299de5071c5SBlue Swirl 2300de5071c5SBlue Swirlneed_offsetof=yes 2301de5071c5SBlue Swirlcat > $TMPC << EOF 2302de5071c5SBlue Swirl#include <stddef.h> 2303de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); } 2304de5071c5SBlue SwirlEOF 2305de5071c5SBlue Swirlif compile_prog "" "" ; then 2306de5071c5SBlue Swirl need_offsetof=no 2307de5071c5SBlue Swirlfi 2308de5071c5SBlue Swirl 23095f6b9e8fSBlue Swirl########################################## 2310747bbdf7SBlue Swirl# check if the compiler understands attribute warn_unused_result 2311747bbdf7SBlue Swirl# 2312747bbdf7SBlue Swirl# This could be smarter, but gcc -Werror does not error out even when warning 2313747bbdf7SBlue Swirl# about attribute warn_unused_result 2314747bbdf7SBlue Swirl 2315747bbdf7SBlue Swirlgcc_attribute_warn_unused_result=no 2316747bbdf7SBlue Swirlcat > $TMPC << EOF 2317747bbdf7SBlue Swirl#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4) 2318747bbdf7SBlue Swirl#error gcc 3.3 or older 2319747bbdf7SBlue Swirl#endif 2320747bbdf7SBlue Swirlint main(void) { return 0;} 2321747bbdf7SBlue SwirlEOF 2322747bbdf7SBlue Swirlif compile_prog "" ""; then 2323747bbdf7SBlue Swirl gcc_attribute_warn_unused_result=yes 2324747bbdf7SBlue Swirlfi 2325747bbdf7SBlue Swirl 2326cd4ec0b4SGerd Hoffmann# spice probe 2327cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 2328cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 2329cd4ec0b4SGerd Hoffmann#include <spice.h> 2330cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 2331cd4ec0b4SGerd HoffmannEOF 2332710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 2333710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 2334012b80d3SGerd Hoffmann if $pkg_config --atleast-version=0.6.0 spice-server >/dev/null 2>&1 && \ 2335cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 2336cd4ec0b4SGerd Hoffmann spice="yes" 2337cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 2338cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 2339cd4ec0b4SGerd Hoffmann else 2340cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 2341cd4ec0b4SGerd Hoffmann feature_not_found "spice" 2342cd4ec0b4SGerd Hoffmann fi 2343cd4ec0b4SGerd Hoffmann spice="no" 2344cd4ec0b4SGerd Hoffmann fi 2345cd4ec0b4SGerd Hoffmannfi 2346cd4ec0b4SGerd Hoffmann 2347111a38b0SRobert Relyea# check for libcacard for smartcard support 2348111a38b0SRobert Relyeaif test "$smartcard" != "no" ; then 2349111a38b0SRobert Relyea smartcard="yes" 2350111a38b0SRobert Relyea smartcard_cflags="" 2351111a38b0SRobert Relyea # TODO - what's the minimal nss version we support? 2352111a38b0SRobert Relyea if test "$smartcard_nss" != "no"; then 2353111a38b0SRobert Relyea if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 ; then 2354111a38b0SRobert Relyea smartcard_nss="yes" 2355111a38b0SRobert Relyea smartcard_cflags="-I\$(SRC_PATH)/libcacard" 2356111a38b0SRobert Relyea libcacard_libs=$($pkg_config --libs nss 2>/dev/null) 2357111a38b0SRobert Relyea libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null) 2358111a38b0SRobert Relyea QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags" 2359111a38b0SRobert Relyea LIBS="$libcacard_libs $LIBS" 2360111a38b0SRobert Relyea else 2361111a38b0SRobert Relyea if test "$smartcard_nss" = "yes"; then 2362111a38b0SRobert Relyea feature_not_found "nss" 2363111a38b0SRobert Relyea fi 2364111a38b0SRobert Relyea smartcard_nss="no" 2365111a38b0SRobert Relyea fi 2366111a38b0SRobert Relyea fi 2367111a38b0SRobert Relyeafi 2368111a38b0SRobert Relyeaif test "$smartcard" = "no" ; then 2369111a38b0SRobert Relyea smartcard_nss="no" 2370111a38b0SRobert Relyeafi 2371111a38b0SRobert Relyea 2372cd4ec0b4SGerd Hoffmann########################################## 2373cd4ec0b4SGerd Hoffmann 2374747bbdf7SBlue Swirl########################################## 23755f6b9e8fSBlue Swirl# check if we have fdatasync 23765f6b9e8fSBlue Swirl 23775f6b9e8fSBlue Swirlfdatasync=no 23785f6b9e8fSBlue Swirlcat > $TMPC << EOF 23795f6b9e8fSBlue Swirl#include <unistd.h> 2380d1722a27SAlexandre Raymondint main(void) { 2381d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 2382d1722a27SAlexandre Raymondreturn fdatasync(0); 2383d1722a27SAlexandre Raymond#else 2384d1722a27SAlexandre Raymond#abort Not supported 2385d1722a27SAlexandre Raymond#endif 2386d1722a27SAlexandre Raymond} 23875f6b9e8fSBlue SwirlEOF 23885f6b9e8fSBlue Swirlif compile_prog "" "" ; then 23895f6b9e8fSBlue Swirl fdatasync=yes 23905f6b9e8fSBlue Swirlfi 23915f6b9e8fSBlue Swirl 239294a420b1SStefan Hajnoczi########################################## 2393e78815a5SAndreas Färber# check if we have madvise 2394e78815a5SAndreas Färber 2395e78815a5SAndreas Färbermadvise=no 2396e78815a5SAndreas Färbercat > $TMPC << EOF 2397e78815a5SAndreas Färber#include <sys/types.h> 2398e78815a5SAndreas Färber#include <sys/mman.h> 2399832ce9c2SScott Wood#include <stddef.h> 2400e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 2401e78815a5SAndreas FärberEOF 2402e78815a5SAndreas Färberif compile_prog "" "" ; then 2403e78815a5SAndreas Färber madvise=yes 2404e78815a5SAndreas Färberfi 2405e78815a5SAndreas Färber 2406e78815a5SAndreas Färber########################################## 2407e78815a5SAndreas Färber# check if we have posix_madvise 2408e78815a5SAndreas Färber 2409e78815a5SAndreas Färberposix_madvise=no 2410e78815a5SAndreas Färbercat > $TMPC << EOF 2411e78815a5SAndreas Färber#include <sys/mman.h> 2412832ce9c2SScott Wood#include <stddef.h> 2413e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 2414e78815a5SAndreas FärberEOF 2415e78815a5SAndreas Färberif compile_prog "" "" ; then 2416e78815a5SAndreas Färber posix_madvise=yes 2417e78815a5SAndreas Färberfi 2418e78815a5SAndreas Färber 2419e78815a5SAndreas Färber########################################## 242094a420b1SStefan Hajnoczi# check if trace backend exists 242194a420b1SStefan Hajnoczi 24224c3b5a48SBlue Swirlsh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null 242394a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 242494a420b1SStefan Hajnoczi echo 242594a420b1SStefan Hajnoczi echo "Error: invalid trace backend" 242694a420b1SStefan Hajnoczi echo "Please choose a supported trace backend." 242794a420b1SStefan Hajnoczi echo 242894a420b1SStefan Hajnoczi exit 1 242994a420b1SStefan Hajnoczifi 243094a420b1SStefan Hajnoczi 24317e24e92aSStefan Hajnoczi########################################## 24327e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 24337e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then 24347e24e92aSStefan Hajnoczi cat > $TMPC << EOF 24357e24e92aSStefan Hajnoczi#include <ust/tracepoint.h> 24367e24e92aSStefan Hajnoczi#include <ust/marker.h> 24377e24e92aSStefan Hajnocziint main(void) { return 0; } 24387e24e92aSStefan HajnocziEOF 24397e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 24407e24e92aSStefan Hajnoczi LIBS="-lust $LIBS" 24417e24e92aSStefan Hajnoczi else 24427e24e92aSStefan Hajnoczi echo 24437e24e92aSStefan Hajnoczi echo "Error: Trace backend 'ust' missing libust header files" 24447e24e92aSStefan Hajnoczi echo 24457e24e92aSStefan Hajnoczi exit 1 24467e24e92aSStefan Hajnoczi fi 24477e24e92aSStefan Hajnoczifi 2448b3d08c02SDaniel P. Berrange 2449b3d08c02SDaniel P. Berrange########################################## 2450b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 2451b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then 2452b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 2453b3d08c02SDaniel P. Berrange echo 2454b3d08c02SDaniel P. Berrange echo "Error: dtrace command is not found in PATH $PATH" 2455b3d08c02SDaniel P. Berrange echo 2456b3d08c02SDaniel P. Berrange exit 1 2457b3d08c02SDaniel P. Berrange fi 2458c276b17dSDaniel P. Berrange trace_backend_stap="no" 2459c276b17dSDaniel P. Berrange if has 'stap' ; then 2460c276b17dSDaniel P. Berrange trace_backend_stap="yes" 2461c276b17dSDaniel P. Berrange fi 2462b3d08c02SDaniel P. Berrangefi 2463b3d08c02SDaniel P. Berrange 24647e24e92aSStefan Hajnoczi########################################## 2465e86ecd4bSJuan Quintela# End of CC checks 2466e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 2467e86ecd4bSJuan Quintela 2468e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then 24691156c669SJuan Quintela CFLAGS="-O2 $CFLAGS" 2470e86ecd4bSJuan Quintelafi 2471a316e378SJuan Quintela 2472e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror 2473e86ecd4bSJuan Quintela# by default. Only enable by default for git builds 2474e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION` 247520ff6c80SAnthony Liguori 247620ff6c80SAnthony Liguoriif test -z "$werror" ; then 2477e86ecd4bSJuan Quintela if test "$z_version" = "50" -a \ 2478e86ecd4bSJuan Quintela "$linux" = "yes" ; then 2479e86ecd4bSJuan Quintela werror="yes" 2480e86ecd4bSJuan Quintela else 2481e86ecd4bSJuan Quintela werror="no" 2482e86ecd4bSJuan Quintela fi 2483e86ecd4bSJuan Quintelafi 2484e86ecd4bSJuan Quintela 248520ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 248620ff6c80SAnthony Liguori# enable/disable 248720ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 248820ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 248920ff6c80SAnthony Liguori zero_malloc="no" 249020ff6c80SAnthony Liguori else 249120ff6c80SAnthony Liguori zero_malloc="yes" 249220ff6c80SAnthony Liguori fi 249320ff6c80SAnthony Liguorifi 249420ff6c80SAnthony Liguori 2495e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then 2496a558ee17SJuan Quintela QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 2497e86ecd4bSJuan Quintelafi 2498e86ecd4bSJuan Quintela 2499e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 2500e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 25011156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 2502e86ecd4bSJuan Quintela fi 2503e86ecd4bSJuan Quintelafi 2504e86ecd4bSJuan Quintela 2505952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 2506952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 2507952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 2508952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 2509952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 2510952afb71SBlue Swirl fi 2511952afb71SBlue Swirl done 2512952afb71SBlue Swirlfi 2513952afb71SBlue Swirl 2514190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix 25155a67135aSbellard 2516ca35f780SPaolo Bonzinitools= 2517ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then 2518ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 2519ca35f780SPaolo Bonzini if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 2520ca35f780SPaolo Bonzini tools="qemu-nbd\$(EXESUF) $tools" 2521ca35f780SPaolo Bonzini if [ "$check_utests" = "yes" ]; then 2522ca35f780SPaolo Bonzini tools="check-qint check-qstring check-qdict check-qlist $tools" 2523ca35f780SPaolo Bonzini tools="check-qfloat check-qjson $tools" 2524ca35f780SPaolo Bonzini fi 2525ca35f780SPaolo Bonzini fi 2526ca35f780SPaolo Bonzinifi 2527ca35f780SPaolo Bonzini 2528ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 2529ca35f780SPaolo Bonziniroms= 2530ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 2531ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 2532ca35f780SPaolo Bonzini "$softmmu" = yes ; then 2533ca35f780SPaolo Bonzini roms="optionrom" 2534ca35f780SPaolo Bonzinifi 2535d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then 253639ac8455SDavid Gibson roms="$roms spapr-rtas" 253739ac8455SDavid Gibsonfi 2538ca35f780SPaolo Bonzini 25397d13299dSbellardecho "Install prefix $prefix" 2540f2b9e1e3SPaolo Bonziniecho "BIOS directory `eval echo $datadir`" 2541f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 25423aa5d2beSAlon Levyecho "library directory `eval echo $libdir`" 25431c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 254411d9f695Sbellardif test "$mingw32" = "no" ; then 2545f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 254643ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 254711d9f695Sbellardfi 25485a67135aSbellardecho "Source path $source_path" 25497d13299dSbellardecho "C compiler $cc" 255083469015Sbellardecho "Host C compiler $host_cc" 25510c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 2552a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 25530c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 25547d13299dSbellardecho "make $make" 25556a882643Spbrookecho "install $install" 2556a98fd896Sbellardecho "host CPU $cpu" 2557de83cd02Sbellardecho "host big endian $bigendian" 255897a847bcSbellardecho "target list $target_list" 2559ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 2560b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon" 25617d13299dSbellardecho "gprof enabled $gprof" 256203b4fe7dSaliguoriecho "sparse enabled $sparse" 25631625af87Saliguoriecho "strip binaries $strip_opt" 256405c2a3e7Sbellardecho "profiler $profiler" 256543ce4dfeSbellardecho "static build $static" 256685aa5189Sbellardecho "-Werror enabled $werror" 25675b0753e0Sbellardif test "$darwin" = "yes" ; then 25685b0753e0Sbellard echo "Cocoa support $cocoa" 25695b0753e0Sbellardfi 257097a847bcSbellardecho "SDL support $sdl" 25714d3b6f6eSbalrogecho "curses support $curses" 2572769ce76dSAlexander Grafecho "curl support $curl" 25735495ed11SLuiz Capitulinoecho "check support $check_utests" 257467b915a5Sbellardecho "mingw32 support $mingw32" 25750c58ac1cSmalcecho "Audio drivers $audio_drv_list" 25760c58ac1cSmalcecho "Extra audio cards $audio_card_list" 2577eb852011SMarkus Armbrusterecho "Block whitelist $block_drv_whitelist" 25788ff9cbf7Smalcecho "Mixer emulation $mixemu" 2579821601eaSJes Sorensenecho "VNC support $vnc" 2580821601eaSJes Sorensenif test "$vnc" = "yes" ; then 25818d5d2d4cSths echo "VNC TLS support $vnc_tls" 25822f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 25832f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 2584efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 2585bd023f95SCorentin Chary echo "VNC thread $vnc_thread" 2586821601eaSJes Sorensenfi 25873142255cSblueswir1if test -n "$sparc_cpu"; then 25883142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 25893142255cSblueswir1fi 2590e37630caSaliguoriecho "xen support $xen" 25912e4d9fb1Saurel32echo "brlapi support $brlapi" 2592a20a6f46SJuan Quintelaecho "bluez support $bluez" 2593a25dba17SJuan Quintelaecho "Documentation $docs" 2594c5937220Spbrook[ ! -z "$uname_release" ] && \ 2595c5937220Spbrookecho "uname -r $uname_release" 2596bd0c5661Spbrookecho "NPTL support $nptl" 2597379f6698SPaul Brookecho "GUEST_BASE $guest_base" 259834005a00SKirill A. Shutemovecho "PIE user targets $user_pie" 25998a16d273Sthsecho "vde support $vde" 2600e5d355d1Saliguoriecho "IO thread $io_thread" 26015c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 2602758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 260377755340Sthsecho "Install blobs $blobs" 2604b31a0277SJuan Quintelaecho "KVM support $kvm" 2605f652e6afSaurel32echo "fdt support $fdt" 2606ceb42de8Saliguoriecho "preadv support $preadv" 26075f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 2608e78815a5SAndreas Färberecho "madvise $madvise" 2609e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 2610ee682d27SStefan Weilecho "uuid support $uuid" 2611d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 261294a420b1SStefan Hajnocziecho "Trace backend $trace_backend" 26139410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 2614cd4ec0b4SGerd Hoffmannecho "spice support $spice" 2615f27aaf4bSChristian Brunnerecho "rbd support $rbd" 2616dce512deSChristoph Hellwigecho "xfsctl support $xfs" 2617111a38b0SRobert Relyeaecho "nss used $smartcard_nss" 261820ff075bSMichael Walleecho "OpenGL support $opengl" 261967b915a5Sbellard 262097a847bcSbellardif test $sdl_too_old = "yes"; then 262124b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 2622e8cd23deSbellardfi 262397a847bcSbellard 262498ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 26254bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld" 262697a847bcSbellard 262798ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 262898ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 262998ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 263098ec69acSJuan Quintelaecho >> $config_host_mak 263198ec69acSJuan Quintela 2632e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 263399d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 263499d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 26353aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak 263699d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 263799d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak 263899d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 263999d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak 26401dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak 2641804edf29SJuan Quintela 26422408a527Saurel32case "$cpu" in 2643d2fbca94SGuan Xuetao i386|x86_64|alpha|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64|unicore32) 2644e0da9dd3SJuan Quintela ARCH=$cpu 26452408a527Saurel32 ;; 2646a302c32dSLaurent Desnogues armv4b|armv4l) 264716dbd14fSJuan Quintela ARCH=arm 26482408a527Saurel32 ;; 26492408a527Saurel32esac 265098ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 2651f8393946Saurel32if test "$debug_tcg" = "yes" ; then 26522358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 2653f8393946Saurel32fi 2654b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then 2655b4475aa2SLuiz Capitulino echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak 2656b4475aa2SLuiz Capitulinofi 2657f3d08ee6SPaul Brookif test "$debug" = "yes" ; then 26582358a494SJuan Quintela echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak 2659f3d08ee6SPaul Brookfi 26601625af87Saliguoriif test "$strip_opt" = "yes" ; then 266152ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 26621625af87Saliguorifi 26637d13299dSbellardif test "$bigendian" = "yes" ; then 2664e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 266597a847bcSbellardfi 26662358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak 266767b915a5Sbellardif test "$mingw32" = "yes" ; then 266898ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 26699fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 26709fe6de94SBlue Swirl version_major=${rc_version%%.*} 26719fe6de94SBlue Swirl rc_version=${rc_version#*.} 26729fe6de94SBlue Swirl version_minor=${rc_version%%.*} 26739fe6de94SBlue Swirl rc_version=${rc_version#*.} 26749fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 26759fe6de94SBlue Swirl version_micro=0 26769fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 26779fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 2678210fa556Spbrookelse 267935f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 2680210fa556Spbrookfi 2681128ab2ffSblueswir1 2682dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 2683dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 2684dffcb71cSMark McLoughlinfi 2685dffcb71cSMark McLoughlin 268683fb7adfSbellardif test "$darwin" = "yes" ; then 268798ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 268883fb7adfSbellardfi 2689b29fe3edSmalc 2690b29fe3edSmalcif test "$aix" = "yes" ; then 269198ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 2692b29fe3edSmalcfi 2693b29fe3edSmalc 2694ec530c81Sbellardif test "$solaris" = "yes" ; then 269598ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 26962358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 26970475a5caSths if test "$needs_libsunmath" = "yes" ; then 269875b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 26990475a5caSths fi 2700ec530c81Sbellardfi 2701179cf400SAndreas Färberif test "$haiku" = "yes" ; then 2702179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 2703179cf400SAndreas Färberfi 270497a847bcSbellardif test "$static" = "yes" ; then 270598ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 270697a847bcSbellardfi 270705c2a3e7Sbellardif test $profiler = "yes" ; then 27082358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 270905c2a3e7Sbellardfi 2710c20709aaSbellardif test "$slirp" = "yes" ; then 271198ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 2712f9728943SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES" 2713c20709aaSbellardfi 27148a16d273Sthsif test "$vde" = "yes" ; then 271598ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 27168a16d273Sthsfi 27170c58ac1cSmalcfor card in $audio_card_list; do 2718f6e5889eSpbrook def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` 271998ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 27200c58ac1cSmalcdone 27212358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 27220c58ac1cSmalcfor drv in $audio_drv_list; do 2723f6e5889eSpbrook def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` 272498ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 2725923e4521Smalc if test "$drv" = "fmod"; then 27267aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 2727fb065187Sbellard fi 27280c58ac1cSmalcdone 272967f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 273067f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 273167f86e8eSJuan Quintelafi 2732d5631638Smalcif test "$audio_win_int" = "yes" ; then 2733d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 2734d5631638Smalcfi 2735eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak 27368ff9cbf7Smalcif test "$mixemu" = "yes" ; then 273798ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 27388ff9cbf7Smalcfi 2739821601eaSJes Sorensenif test "$vnc" = "yes" ; then 2740821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 2741821601eaSJes Sorensenfi 27428d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 274398ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 2744525061bfSJuan Quintela echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak 27458d5d2d4cSthsfi 27462f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 274798ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 274860ddf533SJuan Quintela echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak 27492f9606b3Saliguorifi 2750821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 27512f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 27522f6f5c7aSCorentin Chary echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak 27532f6f5c7aSCorentin Charyfi 2754821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 2755efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 2756efe556adSCorentin Chary echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak 2757efe556adSCorentin Charyfi 2758821601eaSJes Sorensenif test "$vnc_thread" = "yes" ; then 2759bd023f95SCorentin Chary echo "CONFIG_VNC_THREAD=y" >> $config_host_mak 2760bd023f95SCorentin Charyfi 276176655d6dSaliguoriif test "$fnmatch" = "yes" ; then 27622358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 276376655d6dSaliguorifi 2764ee682d27SStefan Weilif test "$uuid" = "yes" ; then 2765ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 2766ee682d27SStefan Weilfi 2767dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 2768dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 2769dce512deSChristoph Hellwigfi 2770b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 277198ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 27722358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 277398ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 277498ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 2775a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 277698ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 2777cc8ae6deSpbrookfi 27781ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 277998ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 27808ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 278149ecc3faSbellardfi 278249ecc3faSbellardif test "$cocoa" = "yes" ; then 278398ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 278449ecc3faSbellardfi 27854d3b6f6eSbalrogif test "$curses" = "yes" ; then 278698ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 2787ab4e5602SJan Kiszkafi 27883b3f24adSaurel32if test "$atfile" = "yes" ; then 27892358a494SJuan Quintela echo "CONFIG_ATFILE=y" >> $config_host_mak 27903b3f24adSaurel32fi 2791ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 27922358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 2793ebc996f3SRiku Voipiofi 2794099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 27952358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 2796099d6b0fSRiku Voipiofi 279740ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 279840ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 279940ff6d7eSKevin Wolffi 28003ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 28012358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 28023ce34dfbSvibisreenivasanfi 2803c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 2804c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 2805c2882b96SRiku Voipiofi 2806d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 2807d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 2808d0927938SUlrich Hechtfi 2809c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 2810c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 2811c727f47dSPeter Maydellfi 2812dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 2813dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 2814dace20dcSPeter Maydellfi 2815d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 2816d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 2817d0927938SUlrich Hechtfi 28183b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 28193b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 28203b6edd16SPeter Maydellfi 28213b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 28223b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 28233b6edd16SPeter Maydellfi 28243b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then 28253b6edd16SPeter Maydell echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak 28263b6edd16SPeter Maydellfi 28273b3f24adSaurel32if test "$inotify" = "yes" ; then 28282358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 28293b3f24adSaurel32fi 2830c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 2831c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 2832c05c7a73SRiku Voipiofi 28336ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 28346ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 28356ae9a1f4SJuan Quintelafi 28366ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 28376ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 28386ae9a1f4SJuan Quintelafi 2839769ce76dSAlexander Grafif test "$curl" = "yes" ; then 284098ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 2841b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 2842769ce76dSAlexander Graffi 28432e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 284498ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 28452e4d9fb1Saurel32fi 2846fb599c9aSbalrogif test "$bluez" = "yes" ; then 284798ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 2848ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 2849fb599c9aSbalrogfi 2850e37630caSaliguoriif test "$xen" = "yes" ; then 28515647eb74SJuan Quintela echo "CONFIG_XEN=y" >> $config_host_mak 2852d5b93ddfSAnthony PERARD echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak 2853e37630caSaliguorifi 2854e5d355d1Saliguoriif test "$io_thread" = "yes" ; then 285598ec69acSJuan Quintela echo "CONFIG_IOTHREAD=y" >> $config_host_mak 2856e5d355d1Saliguorifi 28575c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 28585c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 28595c6c3a6cSChristoph Hellwigfi 2860758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 2861758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 2862758e8e38SVenkateswararao Jujjuri (JV)fi 2863758e8e38SVenkateswararao Jujjuri (JV)if test "$linux" = "yes" ; then 2864758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 2865758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 2866758e8e38SVenkateswararao Jujjuri (JV) fi 2867758e8e38SVenkateswararao Jujjuri (JV)fi 286877755340Sthsif test "$blobs" = "yes" ; then 286998ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 287077755340Sthsfi 2871bf9298b9Saliguoriif test "$iovec" = "yes" ; then 28722358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 2873bf9298b9Saliguorifi 2874ceb42de8Saliguoriif test "$preadv" = "yes" ; then 28752358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 2876ceb42de8Saliguorifi 2877f652e6afSaurel32if test "$fdt" = "yes" ; then 28783f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 2879f652e6afSaurel32fi 2880dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 2881dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 2882dcc38d1cSMarcelo Tosattifi 2883de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then 2884de5071c5SBlue Swirl echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak 2885de5071c5SBlue Swirlfi 2886747bbdf7SBlue Swirlif test "$gcc_attribute_warn_unused_result" = "yes" ; then 2887747bbdf7SBlue Swirl echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak 2888747bbdf7SBlue Swirlfi 28895f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 28905f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 28915f6b9e8fSBlue Swirlfi 2892e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 2893e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 2894e78815a5SAndreas Färberfi 2895e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 2896e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 2897e78815a5SAndreas Färberfi 289897a847bcSbellard 2899cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 2900cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 2901cd4ec0b4SGerd Hoffmannfi 2902cd4ec0b4SGerd Hoffmann 290336707144SAlon Levyif test "$smartcard" = "yes" ; then 290436707144SAlon Levy echo "CONFIG_SMARTCARD=y" >> $config_host_mak 290536707144SAlon Levyfi 290636707144SAlon Levy 2907111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 2908111a38b0SRobert Relyea echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak 2909111a38b0SRobert Relyeafi 2910111a38b0SRobert Relyea 291120ff075bSMichael Walleif test "$opengl" = "yes" ; then 291220ff075bSMichael Walle echo "CONFIG_OPENGL=y" >> $config_host_mak 291320ff075bSMichael Wallefi 291420ff075bSMichael Walle 291583fb7adfSbellard# XXX: suppress that 29167d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 29172358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 29187d3505c5Sbellardfi 29197d3505c5Sbellard 29202358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 2921c5937220Spbrook 292220ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 292320ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 292420ff6c80SAnthony Liguorifi 2925f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 2926f27aaf4bSChristian Brunner echo "CONFIG_RBD=y" >> $config_host_mak 2927f27aaf4bSChristian Brunnerfi 292820ff6c80SAnthony Liguori 292968063649Sblueswir1# USB host support 293068063649Sblueswir1case "$usb" in 293168063649Sblueswir1linux) 293298ec69acSJuan Quintela echo "HOST_USB=linux" >> $config_host_mak 293368063649Sblueswir1;; 293468063649Sblueswir1bsd) 293598ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 293668063649Sblueswir1;; 293768063649Sblueswir1*) 293898ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 293968063649Sblueswir1;; 294068063649Sblueswir1esac 294168063649Sblueswir1 294294a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak 294322890ab5SPrerna Saxenaif test "$trace_backend" = "simple"; then 294422890ab5SPrerna Saxena echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak 294522890ab5SPrerna Saxenafi 29469410b56cSPrerna Saxena# Set the appropriate trace file. 29479410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then 2948953ffe0fSAndreas Färber trace_file="\"$trace_file-\" FMT_pid" 29499410b56cSPrerna Saxenafi 2950c276b17dSDaniel P. Berrangeif test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then 2951c276b17dSDaniel P. Berrange echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak 2952c276b17dSDaniel P. Berrangefi 29539410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 29549410b56cSPrerna Saxena 295598ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 295698ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 2957804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 2958804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 2959804edf29SJuan Quintelaecho "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak 2960804edf29SJuan Quintelaecho "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak 2961804edf29SJuan Quintelaecho "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak 2962804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 29632b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 2964804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 2965804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 2966804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 2967804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 29689fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 296944dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak 2970e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 2971a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 2972f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 2973e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 2974e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 2975e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 2976e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 2977e39f0062SPaolo Bonzinifi 2978c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak 2979e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 2980a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak 2981a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak 298273da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 29833e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 2984804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 2985804edf29SJuan Quintela 29864bf6b55bSJuan Quintela# generate list of library paths for linker script 29874bf6b55bSJuan Quintela 29884bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} 29894bf6b55bSJuan Quintela 29904bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then 29914bf6b55bSJuan Quintela if cmp -s $config_host_ld ${config_host_ld}~ ; then 29924bf6b55bSJuan Quintela mv ${config_host_ld}~ $config_host_ld 29934bf6b55bSJuan Quintela else 29944bf6b55bSJuan Quintela rm ${config_host_ld}~ 29954bf6b55bSJuan Quintela fi 29964bf6b55bSJuan Quintelafi 29974bf6b55bSJuan Quintela 29984d904533SBlue Swirlfor d in libdis libdis-user; do 29994d904533SBlue Swirl mkdir -p $d 300011568d6dSPaolo Bonzini symlink $source_path/Makefile.dis $d/Makefile 30014d904533SBlue Swirl echo > $d/config.mak 30024d904533SBlue Swirldone 3003d44cff22SRichard Hendersonif test "$static" = "no" -a "$user_pie" = "yes" ; then 3004d44cff22SRichard Henderson echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak 3005d44cff22SRichard Hendersonfi 30064d904533SBlue Swirl 300797a847bcSbellardfor target in $target_list; do 300897a847bcSbellardtarget_dir="$target" 300925be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 3010600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1` 301197a847bcSbellardtarget_bigendian="no" 30121f3d3c8fSJuan Quintela 3013ea2d6a39SJuan Quintelacase "$target_arch2" in 3014613a22c9SMichael Walle armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus) 3015ea2d6a39SJuan Quintela target_bigendian=yes 3016ea2d6a39SJuan Quintela ;; 3017ea2d6a39SJuan Quintelaesac 301897a847bcSbellardtarget_softmmu="no" 3019997344f3Sbellardtarget_user_only="no" 3020831b7825Sthstarget_linux_user="no" 3021831b7825Sthstarget_darwin_user="no" 302284778508Sblueswir1target_bsd_user="no" 30239e407a85Spbrookcase "$target" in 3024600309b6SBlue Swirl ${target_arch2}-softmmu) 30259e407a85Spbrook target_softmmu="yes" 30269e407a85Spbrook ;; 3027600309b6SBlue Swirl ${target_arch2}-linux-user) 30289c7a4202SBlue Swirl if test "$linux" != "yes" ; then 30299c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Linux host" 30309c7a4202SBlue Swirl exit 1 30319c7a4202SBlue Swirl fi 30329e407a85Spbrook target_user_only="yes" 30339e407a85Spbrook target_linux_user="yes" 30349e407a85Spbrook ;; 3035600309b6SBlue Swirl ${target_arch2}-darwin-user) 30369c7a4202SBlue Swirl if test "$darwin" != "yes" ; then 30379c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Darwin host" 30389c7a4202SBlue Swirl exit 1 30399c7a4202SBlue Swirl fi 30409e407a85Spbrook target_user_only="yes" 3041831b7825Sths target_darwin_user="yes" 30429e407a85Spbrook ;; 3043600309b6SBlue Swirl ${target_arch2}-bsd-user) 30449cf55765SBlue Swirl if test "$bsd" != "yes" ; then 30459c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a BSD host" 30469c7a4202SBlue Swirl exit 1 30479c7a4202SBlue Swirl fi 304884778508Sblueswir1 target_user_only="yes" 304984778508Sblueswir1 target_bsd_user="yes" 305084778508Sblueswir1 ;; 30519e407a85Spbrook *) 30529e407a85Spbrook echo "ERROR: Target '$target' not recognised" 30539e407a85Spbrook exit 1 30549e407a85Spbrook ;; 30559e407a85Spbrookesac 3056831b7825Sths 305797a847bcSbellardmkdir -p $target_dir 3058158142c2Sbellardmkdir -p $target_dir/fpu 305957fec1feSbellardmkdir -p $target_dir/tcg 306059f2a787SGerd Hoffmannmkdir -p $target_dir/ide 3061353ac78dSAneesh Kumar K.Vmkdir -p $target_dir/9pfs 306284778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then 306369de927cSbellard mkdir -p $target_dir/nwfpe 306469de927cSbellardfi 306511568d6dSPaolo Bonzinisymlink $source_path/Makefile.target $target_dir/Makefile 3066ec530c81Sbellard 306797a847bcSbellard 306825be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 306997a847bcSbellard 3070e5fe0c52Spbrookbflt="no" 3071bd0c5661Spbrooktarget_nptl="no" 3072600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` 30737ee2822cSPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 307456aebc89Spbrookgdb_xml_files="" 3075c2e3dee6SLaurent Viviertarget_short_alignment=2 3076c2e3dee6SLaurent Viviertarget_int_alignment=4 3077c2e3dee6SLaurent Viviertarget_long_alignment=4 3078c2e3dee6SLaurent Viviertarget_llong_alignment=8 3079de3a354aSMichael Walletarget_libs_softmmu= 30807ba1e619Saliguori 3081938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2" 30826acff7daSJuan QuintelaTARGET_BASE_ARCH="" 3083e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 3084e73aae67SJuan Quintela 3085600309b6SBlue Swirlcase "$target_arch2" in 30862408a527Saurel32 i386) 308771deff27SAurelien Jarno target_phys_bits=64 30882408a527Saurel32 ;; 30892408a527Saurel32 x86_64) 30906acff7daSJuan Quintela TARGET_BASE_ARCH=i386 30911ad2134fSPaul Brook target_phys_bits=64 3092c2e3dee6SLaurent Vivier target_long_alignment=8 30932408a527Saurel32 ;; 30942408a527Saurel32 alpha) 30951ad2134fSPaul Brook target_phys_bits=64 3096c2e3dee6SLaurent Vivier target_long_alignment=8 3097a4b388ffSRichard Henderson target_nptl="yes" 30982408a527Saurel32 ;; 30992408a527Saurel32 arm|armeb) 3100b498c8a0SJuan Quintela TARGET_ARCH=arm 3101e5fe0c52Spbrook bflt="yes" 3102bd0c5661Spbrook target_nptl="yes" 310356aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 31041ad2134fSPaul Brook target_phys_bits=32 3105c2e3dee6SLaurent Vivier target_llong_alignment=4 31062408a527Saurel32 ;; 31072408a527Saurel32 cris) 3108253bd7f8Sedgar_igl target_nptl="yes" 31091ad2134fSPaul Brook target_phys_bits=32 31102408a527Saurel32 ;; 3111613a22c9SMichael Walle lm32) 3112613a22c9SMichael Walle target_phys_bits=32 3113de3a354aSMichael Walle target_libs_softmmu="$opengl_libs" 3114613a22c9SMichael Walle ;; 31152408a527Saurel32 m68k) 31160938cda5Saurel32 bflt="yes" 311756aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 31181ad2134fSPaul Brook target_phys_bits=32 3119c2e3dee6SLaurent Vivier target_int_alignment=2 3120c2e3dee6SLaurent Vivier target_long_alignment=2 3121c2e3dee6SLaurent Vivier target_llong_alignment=2 31222408a527Saurel32 ;; 3123877fdc12SEdgar E. Iglesias microblaze|microblazeel) 3124877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 312572b675caSEdgar E. Iglesias bflt="yes" 312672b675caSEdgar E. Iglesias target_nptl="yes" 312772b675caSEdgar E. Iglesias target_phys_bits=32 3128de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 312972b675caSEdgar E. Iglesias ;; 31302408a527Saurel32 mips|mipsel) 3131b498c8a0SJuan Quintela TARGET_ARCH=mips 313225be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 3133f04dc72fSPaul Brook target_nptl="yes" 31341ad2134fSPaul Brook target_phys_bits=64 31352408a527Saurel32 ;; 31362408a527Saurel32 mipsn32|mipsn32el) 3137b498c8a0SJuan Quintela TARGET_ARCH=mipsn32 31386acff7daSJuan Quintela TARGET_BASE_ARCH=mips 313925be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 31401ad2134fSPaul Brook target_phys_bits=64 31412408a527Saurel32 ;; 31422408a527Saurel32 mips64|mips64el) 3143b498c8a0SJuan Quintela TARGET_ARCH=mips64 31446acff7daSJuan Quintela TARGET_BASE_ARCH=mips 314525be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 31461ad2134fSPaul Brook target_phys_bits=64 3147c2e3dee6SLaurent Vivier target_long_alignment=8 31482408a527Saurel32 ;; 31492408a527Saurel32 ppc) 3150c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 31511ad2134fSPaul Brook target_phys_bits=32 3152d6630708SNathan Froyd target_nptl="yes" 3153de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 31542408a527Saurel32 ;; 31552408a527Saurel32 ppcemb) 31566acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3157e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3158c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 31591ad2134fSPaul Brook target_phys_bits=64 3160d6630708SNathan Froyd target_nptl="yes" 3161de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 31622408a527Saurel32 ;; 31632408a527Saurel32 ppc64) 31646acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3165e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3166c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 31671ad2134fSPaul Brook target_phys_bits=64 3168c2e3dee6SLaurent Vivier target_long_alignment=8 3169de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 31702408a527Saurel32 ;; 31712408a527Saurel32 ppc64abi32) 3172b498c8a0SJuan Quintela TARGET_ARCH=ppc64 31736acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3174e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 317525be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 3176c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 31771ad2134fSPaul Brook target_phys_bits=64 3178de3a354aSMichael Walle target_libs_softmmu="$fdt_libs" 31792408a527Saurel32 ;; 31802408a527Saurel32 sh4|sh4eb) 3181b498c8a0SJuan Quintela TARGET_ARCH=sh4 31824dbed897Spbrook bflt="yes" 31830b6d3ae0Saurel32 target_nptl="yes" 31841ad2134fSPaul Brook target_phys_bits=32 31852408a527Saurel32 ;; 31862408a527Saurel32 sparc) 31871ad2134fSPaul Brook target_phys_bits=64 31882408a527Saurel32 ;; 31892408a527Saurel32 sparc64) 31906acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 31911ad2134fSPaul Brook target_phys_bits=64 3192c2e3dee6SLaurent Vivier target_long_alignment=8 31932408a527Saurel32 ;; 31942408a527Saurel32 sparc32plus) 3195b498c8a0SJuan Quintela TARGET_ARCH=sparc64 31966acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 3197e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 319825be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 31991ad2134fSPaul Brook target_phys_bits=64 32002408a527Saurel32 ;; 320124e804ecSAlexander Graf s390x) 3202bc434676SUlrich Hecht target_nptl="yes" 320324e804ecSAlexander Graf target_phys_bits=64 32047b3da903SAlexander Graf target_long_alignment=8 320524e804ecSAlexander Graf ;; 3206d2fbca94SGuan Xuetao unicore32) 3207d2fbca94SGuan Xuetao target_phys_bits=32 3208d2fbca94SGuan Xuetao ;; 32092408a527Saurel32 *) 3210de83cd02Sbellard echo "Unsupported target CPU" 3211de83cd02Sbellard exit 1 32122408a527Saurel32 ;; 32132408a527Saurel32esac 3214c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak 3215c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak 3216c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak 3217c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak 321825be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak 3219053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`" 322025be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 322125be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak 322242bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 32236acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then 32246acff7daSJuan Quintela TARGET_BASE_ARCH=$TARGET_ARCH 32256acff7daSJuan Quintelafi 322625be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 3227e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 3228e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 3229e6e91b9cSJuan Quintelafi 323025be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 32311b0c87fcSJuan Quintelacase "$target_arch2" in 32321b0c87fcSJuan Quintela i386|x86_64) 32331b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 323464b3cfdbSAnthony PERARD target_phys_bits=64 323525be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 3236432d268cSJun Nakajima if test "$cpu" = "i386" -o "$cpu" = "x86_64"; then 3237432d268cSJun Nakajima echo "CONFIG_XEN_MAPCACHE=y" >> $config_target_mak 3238432d268cSJun Nakajima fi 32391b0c87fcSJuan Quintela fi 32401b0c87fcSJuan Quintelaesac 3241c59249f9SJuan Quintelacase "$target_arch2" in 32420e60a699SAlexander Graf i386|x86_64|ppcemb|ppc|ppc64|s390x) 3243c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 3244c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 3245c59249f9SJuan Quintela \( "$target_arch2" = "$cpu" -o \ 3246c59249f9SJuan Quintela \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 32475f114bc6SAlexander Graf \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ 3248adf82011SRené Rebe \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \ 3249adf82011SRené Rebe \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ 3250c59249f9SJuan Quintela \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ 3251c59249f9SJuan Quintela \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then 325225be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 3253d5970055SMichael S. Tsirkin if test $vhost_net = "yes" ; then 3254d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 3255d5970055SMichael S. Tsirkin fi 3256c59249f9SJuan Quintela fi 3257c59249f9SJuan Quintelaesac 3258de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 325925be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 326097a847bcSbellardfi 326197a847bcSbellardif test "$target_softmmu" = "yes" ; then 3262b1aa27c4SPaul Brook echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak 326325be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 3264de3a354aSMichael Walle echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak 32650e8c9214SAndreas Färber echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak 32665791f45bSKirill A. Shutemov echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak 3267de83cd02Sbellardfi 3268997344f3Sbellardif test "$target_user_only" = "yes" ; then 326925be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 3270997344f3Sbellardfi 3271831b7825Sthsif test "$target_linux_user" = "yes" ; then 327225be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 3273831b7825Sthsfi 3274831b7825Sthsif test "$target_darwin_user" = "yes" ; then 327525be210fSJuan Quintela echo "CONFIG_DARWIN_USER=y" >> $config_target_mak 3276831b7825Sthsfi 3277111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 3278111a38b0SRobert Relyea echo "subdir-$target: subdir-libcacard" >> $config_host_mak 3279111a38b0SRobert Relyea echo "libcacard_libs=$libcacard_libs" >> $config_host_mak 3280111a38b0SRobert Relyea echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak 3281111a38b0SRobert Relyeafi 328256aebc89Spbrooklist="" 328356aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 328456aebc89Spbrook for x in $gdb_xml_files; do 328556aebc89Spbrook list="$list $source_path/gdb-xml/$x" 328656aebc89Spbrook done 328725be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 32883d0f1517SJuan Quintelafi 3289de83cd02Sbellard 3290e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 329125be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 3292e5fe0c52Spbrookfi 3293bd0c5661Spbrookif test "$target_user_only" = "yes" \ 3294bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 329525be210fSJuan Quintela echo "CONFIG_USE_NPTL=y" >> $config_target_mak 3296bd0c5661Spbrookfi 3297379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 329825be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 3299379f6698SPaul Brookfi 330084778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 330125be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 330284778508Sblueswir1fi 33035b0753e0Sbellard 33044afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 3305fa282484SJuan Quintela 33064afddb55SJuan Quintelacflags="" 3307f9728943SPaolo Bonziniincludes="" 3308fa282484SJuan Quintelaldflags="" 33099b8e111fSJuan Quintela 331057ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then 3311f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/sparc $includes" 331224e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then 3313f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/s390 $includes" 33145d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then 3315f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/i386 $includes" 331657ddfbf7SJuan Quintelaelse 3317f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes" 331857ddfbf7SJuan Quintelafi 3319f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes" 3320f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/fpu $includes" 332157ddfbf7SJuan Quintela 33224d904533SBlue Swirlif test "$target_user_only" = "yes" ; then 33234d904533SBlue Swirl libdis_config_mak=libdis-user/config.mak 33244d904533SBlue Swirlelse 33254d904533SBlue Swirl libdis_config_mak=libdis/config.mak 33264d904533SBlue Swirlfi 33274d904533SBlue Swirl 332864656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 332964656024SJuan Quintela case "$i" in 333064656024SJuan Quintela alpha) 333125be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 33324d904533SBlue Swirl echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak 333364656024SJuan Quintela ;; 333464656024SJuan Quintela arm) 333525be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 33364d904533SBlue Swirl echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak 333764656024SJuan Quintela ;; 333864656024SJuan Quintela cris) 333925be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 33404d904533SBlue Swirl echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak 334164656024SJuan Quintela ;; 334264656024SJuan Quintela hppa) 334325be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 33444d904533SBlue Swirl echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak 334564656024SJuan Quintela ;; 334664656024SJuan Quintela i386|x86_64) 334725be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 33484d904533SBlue Swirl echo "CONFIG_I386_DIS=y" >> $libdis_config_mak 334964656024SJuan Quintela ;; 3350903ec55cSAurelien Jarno ia64*) 3351903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $config_target_mak 3352903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak 3353903ec55cSAurelien Jarno ;; 335464656024SJuan Quintela m68k) 335525be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 33564d904533SBlue Swirl echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak 335764656024SJuan Quintela ;; 3358877fdc12SEdgar E. Iglesias microblaze*) 335925be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 33604d904533SBlue Swirl echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak 336164656024SJuan Quintela ;; 336264656024SJuan Quintela mips*) 336325be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 33644d904533SBlue Swirl echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak 336564656024SJuan Quintela ;; 336664656024SJuan Quintela ppc*) 336725be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 33684d904533SBlue Swirl echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak 336964656024SJuan Quintela ;; 337024e804ecSAlexander Graf s390*) 337125be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 33724d904533SBlue Swirl echo "CONFIG_S390_DIS=y" >> $libdis_config_mak 337364656024SJuan Quintela ;; 337464656024SJuan Quintela sh4) 337525be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 33764d904533SBlue Swirl echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak 337764656024SJuan Quintela ;; 337864656024SJuan Quintela sparc*) 337925be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 33804d904533SBlue Swirl echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak 338164656024SJuan Quintela ;; 338264656024SJuan Quintela esac 338364656024SJuan Quinteladone 338464656024SJuan Quintela 33856ee7126fSJuan Quintelacase "$ARCH" in 33866ee7126fSJuan Quintelaalpha) 33876ee7126fSJuan Quintela # Ensure there's only a single GP 33886ee7126fSJuan Quintela cflags="-msmall-data $cflags" 33896ee7126fSJuan Quintela;; 33906ee7126fSJuan Quintelaesac 33916ee7126fSJuan Quintela 339255d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then 339355d9c04bSJuan Quintela case "$TARGET_BASE_ARCH" in 339455d9c04bSJuan Quintela arm) 339555d9c04bSJuan Quintela cflags="-DHAS_AUDIO $cflags" 339655d9c04bSJuan Quintela ;; 339725a8bb96SMichael Walle lm32) 339825a8bb96SMichael Walle cflags="-DHAS_AUDIO $cflags" 339925a8bb96SMichael Walle ;; 340055d9c04bSJuan Quintela i386|mips|ppc) 340155d9c04bSJuan Quintela cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" 340255d9c04bSJuan Quintela ;; 340355d9c04bSJuan Quintela esac 340455d9c04bSJuan Quintelafi 340555d9c04bSJuan Quintela 340634005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \ 340734005a00SKirill A. Shutemov "$user_pie" = "yes" ; then 340834005a00SKirill A. Shutemov cflags="-fpie $cflags" 340934005a00SKirill A. Shutemov ldflags="-pie $ldflags" 341034005a00SKirill A. Shutemovfi 341134005a00SKirill A. Shutemov 3412471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \ 3413471857ddSJuan Quintela "$TARGET_ARCH" = "microblaze" -o \ 3414471857ddSJuan Quintela "$TARGET_ARCH" = "cris" \) ; then 341525be210fSJuan Quintela echo "CONFIG_NEED_MMU=y" >> $config_target_mak 3416471857ddSJuan Quintelafi 3417471857ddSJuan Quintela 3418d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 341925be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 3420d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 3421d02c1db3SJuan Quintela cflags="-p $cflags" 3422d02c1db3SJuan Quintela ldflags="-p $ldflags" 3423d02c1db3SJuan Quintela fi 3424d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 3425d02c1db3SJuan Quintela ldflags="-p $ldflags" 342625be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 3427d02c1db3SJuan Quintela fi 3428d02c1db3SJuan Quintelafi 3429d02c1db3SJuan Quintela 34306ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld" 34319b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 3432fa282484SJuan Quintela case "$ARCH" in 3433fa282484SJuan Quintela sparc) 3434fa282484SJuan Quintela # -static is used to avoid g1/g3 usage by the dynamic linker 3435322e5878SJuan Quintela ldflags="$linker_script -static $ldflags" 3436fa282484SJuan Quintela ;; 34374d58be06SRichard Henderson alpha | s390x) 34384d58be06SRichard Henderson # The default placement of the application is fine. 34394d58be06SRichard Henderson ;; 3440fd76e73aSRichard Henderson *) 3441322e5878SJuan Quintela ldflags="$linker_script $ldflags" 3442fa282484SJuan Quintela ;; 3443fa282484SJuan Quintela esac 3444fa282484SJuan Quintelafi 3445fa282484SJuan Quintela 3446e205c790SJan Kiszka# use included Linux headers 3447e205c790SJan Kiszkaincludes="-I\$(SRC_PATH)/linux-headers $includes" 3448e205c790SJan Kiszkamkdir -p linux-headers 3449e205c790SJan Kiszkacase "$cpu" in 3450e205c790SJan Kiszkai386|x86_64) 3451e205c790SJan Kiszka symlink $source_path/linux-headers/asm-x86 linux-headers/asm 3452e205c790SJan Kiszka ;; 3453e205c790SJan Kiszkappcemb|ppc|ppc64) 3454e205c790SJan Kiszka symlink $source_path/linux-headers/asm-x86 linux-headers/asm 3455e205c790SJan Kiszka ;; 3456e205c790SJan Kiszkas390x) 3457e205c790SJan Kiszka symlink $source_path/linux-headers/asm-s390 linux-headers/asm 3458e205c790SJan Kiszka ;; 3459e205c790SJan Kiszkaesac 3460e205c790SJan Kiszka 346125be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 346225be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 3463f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak 3464fa282484SJuan Quintela 346597a847bcSbellarddone # for target in $targets 34667d13299dSbellard 3467d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 3468e1144d00SMark McLoughlinDIRS="tests tests/cris slirp audio block net pc-bios/optionrom" 3469446b9165SAndreas FärberDIRS="$DIRS pc-bios/spapr-rtas" 34702d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 34713e230dd2SCorentin CharyDIRS="$DIRS fsdev ui" 34727d13299dSbellardFILES="Makefile tests/Makefile" 3473e7daa605SthsFILES="$FILES tests/cris/Makefile tests/cris/.gdbinit" 3474ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 3475446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile" 34762d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 34775ee8ad71SAlex 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 34787ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 34797ea78b74SJan Kiszkadone 3480d1807a4fSPaolo Bonzinimkdir -p $DIRS 34817d13299dSbellardfor f in $FILES ; do 3482f9245e10SPeter Maydell if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then 3483f9245e10SPeter Maydell symlink "$source_path/$f" "$f" 3484f9245e10SPeter Maydell fi 34857d13299dSbellarddone 34861ad2134fSPaul Brook 3487c34ebfdcSAnthony Liguori# temporary config to build submodules 34882d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 3489c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 349037116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 3491c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 3492c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 3493c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 3494c34ebfdcSAnthony Liguori echo "CPP=${cross_prefix}cpp" >> $config_mak 3495c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 3496c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 3497c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 3498c34ebfdcSAnthony Liguoridone 3499c34ebfdcSAnthony Liguori 35001ad2134fSPaul Brookfor hwlib in 32 64; do 35011ad2134fSPaul Brook d=libhw$hwlib 35021ad2134fSPaul Brook mkdir -p $d 35039953b2fcSBlue Swirl mkdir -p $d/ide 350411568d6dSPaolo Bonzini symlink $source_path/Makefile.hw $d/Makefile 3505353ac78dSAneesh Kumar K.V mkdir -p $d/9pfs 350637116c89SStefan Weil echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak 35071ad2134fSPaul Brookdone 3508add16157SBlue Swirl 3509111a38b0SRobert Relyeaif [ "$source_path" != `pwd` ]; then 3510111a38b0SRobert Relyea # out of tree build 3511111a38b0SRobert Relyea mkdir -p libcacard 3512111a38b0SRobert Relyea rm -f libcacard/Makefile 351344dc0ca3SAlon Levy symlink "$source_path/libcacard/Makefile" libcacard/Makefile 3514111a38b0SRobert Relyeafi 3515111a38b0SRobert Relyea 3516add16157SBlue Swirld=libuser 3517add16157SBlue Swirlmkdir -p $d 351811568d6dSPaolo Bonzinisymlink $source_path/Makefile.user $d/Makefile 3519299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then 3520299060a0SKirill A. Shutemov echo "QEMU_CFLAGS+=-fpie" > $d/config.mak 3521299060a0SKirill A. Shutemovfi 3522b40292e7SJan Kiszka 3523b40292e7SJan Kiszkaif test "$docs" = "yes" ; then 3524b40292e7SJan Kiszka mkdir -p QMP 3525b40292e7SJan Kiszkafi 3526