17d13299dSbellard#!/bin/sh 27d13299dSbellard# 33ef693a0Sbellard# qemu configure script (c) 2003 Fabrice Bellard 47d13299dSbellard# 57d13299dSbellard# set temporary file name 67d13299dSbellardif test ! -z "$TMPDIR" ; then 77d13299dSbellard TMPDIR1="${TMPDIR}" 87d13299dSbellardelif test ! -z "$TEMPDIR" ; then 97d13299dSbellard TMPDIR1="${TEMPDIR}" 107d13299dSbellardelse 117d13299dSbellard TMPDIR1="/tmp" 127d13299dSbellardfi 137d13299dSbellard 143ef693a0SbellardTMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c" 153ef693a0SbellardTMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o" 16a91b857cSmalcTMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe" 177d13299dSbellard 180ba8681eSLoïc Minier# NB: do not call "exit" in the trap handler; this is buggy with some shells; 190ba8681eSLoïc Minier# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org> 200ba8681eSLoïc Miniertrap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM 21da1d85e3SGerd Hoffmannrm -f config.log 229ac81bbbSmalc 2352166aa0SJuan Quintelacompile_object() { 24da1d85e3SGerd Hoffmann echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 25da1d85e3SGerd Hoffmann $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1 2652166aa0SJuan Quintela} 2752166aa0SJuan Quintela 2852166aa0SJuan Quintelacompile_prog() { 2952166aa0SJuan Quintela local_cflags="$1" 3052166aa0SJuan Quintela local_ldflags="$2" 31da1d85e3SGerd Hoffmann echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 32da1d85e3SGerd Hoffmann $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1 3352166aa0SJuan Quintela} 3452166aa0SJuan Quintela 3511568d6dSPaolo Bonzini# symbolically link $1 to $2. Portable version of "ln -sf". 3611568d6dSPaolo Bonzinisymlink() { 3711568d6dSPaolo Bonzini rm -f $2 3811568d6dSPaolo Bonzini ln -s $1 $2 3911568d6dSPaolo Bonzini} 4011568d6dSPaolo Bonzini 410dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 420dba6195SLoïc Minier# executable or a builtin) 430dba6195SLoïc Minierhas() { 440dba6195SLoïc Minier type "$1" >/dev/null 2>&1 450dba6195SLoïc Minier} 460dba6195SLoïc Minier 470dba6195SLoïc Minier# search for an executable in PATH 480dba6195SLoïc Minierpath_of() { 490dba6195SLoïc Minier local_command="$1" 500dba6195SLoïc Minier local_ifs="$IFS" 510dba6195SLoïc Minier local_dir="" 520dba6195SLoïc Minier 530dba6195SLoïc Minier # pathname has a dir component? 540dba6195SLoïc Minier if [ "${local_command#*/}" != "$local_command" ]; then 550dba6195SLoïc Minier if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 560dba6195SLoïc Minier echo "$local_command" 570dba6195SLoïc Minier return 0 580dba6195SLoïc Minier fi 590dba6195SLoïc Minier fi 600dba6195SLoïc Minier if [ -z "$local_command" ]; then 610dba6195SLoïc Minier return 1 620dba6195SLoïc Minier fi 630dba6195SLoïc Minier 640dba6195SLoïc Minier IFS=: 650dba6195SLoïc Minier for local_dir in $PATH; do 660dba6195SLoïc Minier if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 670dba6195SLoïc Minier echo "$local_dir/$local_command" 680dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 690dba6195SLoïc Minier return 0 700dba6195SLoïc Minier fi 710dba6195SLoïc Minier done 720dba6195SLoïc Minier # not found 730dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 740dba6195SLoïc Minier return 1 750dba6195SLoïc Minier} 760dba6195SLoïc Minier 777d13299dSbellard# default parameters 78ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"` 792ff6b91eSJuan Quintelacpu="" 801e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 8143ce4dfeSbellardstatic="no" 82ed968ff1SJuan Quintelasparc_cpu="" 837d13299dSbellardcross_prefix="" 840c58ac1cSmalcaudio_drv_list="" 85d61a4ce8SGerd Hoffmannaudio_card_list="ac97 es1370 sb16 hda" 86d61a4ce8SGerd Hoffmannaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda" 87eb852011SMarkus Armbrusterblock_drv_whitelist="" 887d13299dSbellardhost_cc="gcc" 89c81da56eSJuan Quintelahelper_cflags="" 9073da375eSJuan Quintelalibs_softmmu="" 913e2e0e6bSJuan Quintelalibs_tools="" 9267f86e8eSJuan Quintelaaudio_pt_int="" 93d5631638Smalcaudio_win_int="" 942b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc 95ac0df51dSaliguori 96377529c0SPaolo Bonzinitarget_list="" 97377529c0SPaolo Bonzini 98377529c0SPaolo Bonzini# Default value for a variable defining feature "foo". 99377529c0SPaolo Bonzini# * foo="no" feature will only be used if --enable-foo arg is given 100377529c0SPaolo Bonzini# * foo="" feature will be searched for, and if found, will be used 101377529c0SPaolo Bonzini# unless --disable-foo is given 102377529c0SPaolo Bonzini# * foo="yes" this value will only be set by --enable-foo flag. 103377529c0SPaolo Bonzini# feature will searched for, 104377529c0SPaolo Bonzini# if not found, configure exits with error 105377529c0SPaolo Bonzini# 106377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args. 107377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it 108377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found. 109377529c0SPaolo Bonzini 110377529c0SPaolo Bonzinibluez="" 111377529c0SPaolo Bonzinibrlapi="" 112377529c0SPaolo Bonzinicurl="" 113377529c0SPaolo Bonzinicurses="" 114377529c0SPaolo Bonzinidocs="" 115377529c0SPaolo Bonzinifdt="" 116377529c0SPaolo Bonzinikvm="" 117377529c0SPaolo Bonzinikvm_para="" 118377529c0SPaolo Bonzininptl="" 119377529c0SPaolo Bonzinisdl="" 120821601eaSJes Sorensenvnc="yes" 121377529c0SPaolo Bonzinisparse="no" 122377529c0SPaolo Bonziniuuid="" 123377529c0SPaolo Bonzinivde="" 124377529c0SPaolo Bonzinivnc_tls="" 125377529c0SPaolo Bonzinivnc_sasl="" 126377529c0SPaolo Bonzinivnc_jpeg="" 127377529c0SPaolo Bonzinivnc_png="" 128377529c0SPaolo Bonzinivnc_thread="no" 129377529c0SPaolo Bonzinixen="" 130377529c0SPaolo Bonzinilinux_aio="" 131377529c0SPaolo Bonziniattr="" 132377529c0SPaolo Bonzinivhost_net="" 133377529c0SPaolo Bonzinixfs="" 134377529c0SPaolo Bonzini 135377529c0SPaolo Bonzinigprof="no" 136377529c0SPaolo Bonzinidebug_tcg="no" 137377529c0SPaolo Bonzinidebug_mon="no" 138377529c0SPaolo Bonzinidebug="no" 139377529c0SPaolo Bonzinistrip_opt="yes" 140377529c0SPaolo Bonzinibigendian="no" 141377529c0SPaolo Bonzinimingw32="no" 142377529c0SPaolo BonziniEXESUF="" 143377529c0SPaolo Bonziniprefix="/usr/local" 144377529c0SPaolo Bonzinimandir="\${prefix}/share/man" 145377529c0SPaolo Bonzinidatadir="\${prefix}/share/qemu" 146377529c0SPaolo Bonzinidocdir="\${prefix}/share/doc/qemu" 147377529c0SPaolo Bonzinibindir="\${prefix}/bin" 148377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc" 149377529c0SPaolo Bonziniconfsuffix="/qemu" 150377529c0SPaolo Bonzinislirp="yes" 151377529c0SPaolo Bonzinifmod_lib="" 152377529c0SPaolo Bonzinifmod_inc="" 153377529c0SPaolo Bonzinioss_lib="" 154377529c0SPaolo Bonzinibsd="no" 155377529c0SPaolo Bonzinilinux="no" 156377529c0SPaolo Bonzinisolaris="no" 157377529c0SPaolo Bonziniprofiler="no" 158377529c0SPaolo Bonzinicocoa="no" 159377529c0SPaolo Bonzinisoftmmu="yes" 160377529c0SPaolo Bonzinilinux_user="no" 161377529c0SPaolo Bonzinidarwin_user="no" 162377529c0SPaolo Bonzinibsd_user="no" 163377529c0SPaolo Bonziniguest_base="" 164377529c0SPaolo Bonziniuname_release="" 165377529c0SPaolo Bonziniio_thread="no" 166377529c0SPaolo Bonzinimixemu="no" 167377529c0SPaolo Bonzinikerneldir="" 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="" 180377529c0SPaolo Bonzini 181ac0df51dSaliguori# parse CC options first 182ac0df51dSaliguorifor opt do 183ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 184ac0df51dSaliguori case "$opt" in 185ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 186ac0df51dSaliguori ;; 1873d8df640SPaolo Bonzini --cc=*) CC="$optarg" 188ac0df51dSaliguori ;; 189ca4deeb1SPaolo Bonzini --source-path=*) source_path="$optarg" 190ca4deeb1SPaolo Bonzini ;; 1912ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 1922ff6b91eSJuan Quintela ;; 193a558ee17SJuan Quintela --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" 194e2a2ed06SJuan Quintela ;; 195e2a2ed06SJuan Quintela --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" 196e2a2ed06SJuan Quintela ;; 19750e7b1a0SJuan Quintela --sparc_cpu=*) 19850e7b1a0SJuan Quintela sparc_cpu="$optarg" 19950e7b1a0SJuan Quintela case $sparc_cpu in 200ed968ff1SJuan Quintela v7|v8|v8plus|v8plusa) 20150e7b1a0SJuan Quintela cpu="sparc" 20250e7b1a0SJuan Quintela ;; 20350e7b1a0SJuan Quintela v9) 20450e7b1a0SJuan Quintela cpu="sparc64" 20550e7b1a0SJuan Quintela ;; 20650e7b1a0SJuan Quintela *) 20750e7b1a0SJuan Quintela echo "undefined SPARC architecture. Exiting"; 20850e7b1a0SJuan Quintela exit 1 20950e7b1a0SJuan Quintela ;; 21050e7b1a0SJuan Quintela esac 21150e7b1a0SJuan Quintela ;; 212ac0df51dSaliguori esac 213ac0df51dSaliguoridone 214ac0df51dSaliguori# OS specific 215ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 216ac0df51dSaliguori# we can eliminate it's usage altogether 217ac0df51dSaliguori 2183d8df640SPaolo Bonzinicc="${cross_prefix}${CC-gcc}" 2193d8df640SPaolo Bonziniar="${cross_prefix}${AR-ar}" 2203d8df640SPaolo Bonziniobjcopy="${cross_prefix}${OBJCOPY-objcopy}" 2213d8df640SPaolo Bonzinild="${cross_prefix}${LD-ld}" 2223d8df640SPaolo Bonzinistrip="${cross_prefix}${STRIP-strip}" 2233d8df640SPaolo Bonziniwindres="${cross_prefix}${WINDRES-windres}" 224a8bd70adSPaolo Bonzinipkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}" 2253ec87ffeSPaolo Bonzinisdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}" 226ac0df51dSaliguori 227be17dc90SMichael S. Tsirkin# default flags for all hosts 228be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" 229be17dc90SMichael S. TsirkinCFLAGS="-g $CFLAGS" 230be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 231be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 232be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 23384958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 234f9728943SPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH)" 235be17dc90SMichael S. TsirkinLDFLAGS="-g $LDFLAGS" 236be17dc90SMichael S. Tsirkin 237ca4deeb1SPaolo Bonzini# make source path absolute 238ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd` 239ca4deeb1SPaolo Bonzini 240ac0df51dSaliguoricheck_define() { 241ac0df51dSaliguoricat > $TMPC <<EOF 242ac0df51dSaliguori#if !defined($1) 243ac0df51dSaliguori#error Not defined 244ac0df51dSaliguori#endif 245ac0df51dSaliguoriint main(void) { return 0; } 246ac0df51dSaliguoriEOF 24752166aa0SJuan Quintela compile_object 248ac0df51dSaliguori} 249ac0df51dSaliguori 2502ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 2512ff6b91eSJuan Quintela # command line argument 2522ff6b91eSJuan Quintela : 2532ff6b91eSJuan Quintelaelif check_define __i386__ ; then 254ac0df51dSaliguori cpu="i386" 255ac0df51dSaliguorielif check_define __x86_64__ ; then 256ac0df51dSaliguori cpu="x86_64" 2573aa9bd6cSblueswir1elif check_define __sparc__ ; then 2583aa9bd6cSblueswir1 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA 2593aa9bd6cSblueswir1 # They must be specified using --sparc_cpu 2603aa9bd6cSblueswir1 if check_define __arch64__ ; then 2613aa9bd6cSblueswir1 cpu="sparc64" 2623aa9bd6cSblueswir1 else 2633aa9bd6cSblueswir1 cpu="sparc" 2643aa9bd6cSblueswir1 fi 265fdf7ed96Smalcelif check_define _ARCH_PPC ; then 266fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 267fdf7ed96Smalc cpu="ppc64" 268ac0df51dSaliguori else 269fdf7ed96Smalc cpu="ppc" 270fdf7ed96Smalc fi 271afa05235SAurelien Jarnoelif check_define __mips__ ; then 272afa05235SAurelien Jarno cpu="mips" 273477ba620SAurelien Jarnoelif check_define __ia64__ ; then 274477ba620SAurelien Jarno cpu="ia64" 275d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then 276d66ed0eaSAurelien Jarno if check_define __s390x__ ; then 277d66ed0eaSAurelien Jarno cpu="s390x" 278d66ed0eaSAurelien Jarno else 279d66ed0eaSAurelien Jarno cpu="s390" 280d66ed0eaSAurelien Jarno fi 281fdf7ed96Smalcelse 282fdf7ed96Smalc cpu=`uname -m` 283ac0df51dSaliguorifi 284ac0df51dSaliguori 2857d13299dSbellardcase "$cpu" in 286*d2fbca94SGuan Xuetao alpha|cris|ia64|lm32|m68k|microblaze|ppc|ppc64|sparc64|unicore32) 287ea8f20f8SJuan Quintela cpu="$cpu" 288ea8f20f8SJuan Quintela ;; 2897d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 29097a847bcSbellard cpu="i386" 2917d13299dSbellard ;; 292aaa5fa14Saurel32 x86_64|amd64) 293aaa5fa14Saurel32 cpu="x86_64" 294aaa5fa14Saurel32 ;; 295ba68055eSbellard armv*b) 296808c4954Sbellard cpu="armv4b" 297808c4954Sbellard ;; 298ba68055eSbellard armv*l) 2997d13299dSbellard cpu="armv4l" 3007d13299dSbellard ;; 301f54b3f92Saurel32 parisc|parisc64) 302f54b3f92Saurel32 cpu="hppa" 303f54b3f92Saurel32 ;; 304afa05235SAurelien Jarno mips*) 305afa05235SAurelien Jarno cpu="mips" 306afa05235SAurelien Jarno ;; 30724e804ecSAlexander Graf s390) 308fb3e5849Sbellard cpu="s390" 309fb3e5849Sbellard ;; 31024e804ecSAlexander Graf s390x) 31124e804ecSAlexander Graf cpu="s390x" 31224e804ecSAlexander Graf ;; 3133142255cSblueswir1 sparc|sun4[cdmuv]) 314ae228531Sbellard cpu="sparc" 315ae228531Sbellard ;; 3167d13299dSbellard *) 317a447d4dcSPaolo Bonzini echo "Unsupported CPU = $cpu" 318a447d4dcSPaolo Bonzini exit 1 3197d13299dSbellard ;; 3207d13299dSbellardesac 321e2d52ad3SJuan Quintela 3227d13299dSbellard# OS specific 323ac0df51dSaliguoriif check_define __linux__ ; then 324ac0df51dSaliguori targetos="Linux" 325ac0df51dSaliguorielif check_define _WIN32 ; then 326ac0df51dSaliguori targetos='MINGW32' 327169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then 328169dc5d3Sblueswir1 targetos='OpenBSD' 329169dc5d3Sblueswir1elif check_define __sun__ ; then 330169dc5d3Sblueswir1 targetos='SunOS' 331179cf400SAndreas Färberelif check_define __HAIKU__ ; then 332179cf400SAndreas Färber targetos='Haiku' 333ac0df51dSaliguorielse 3347d13299dSbellard targetos=`uname -s` 335ac0df51dSaliguorifi 3360dbfc675SJuan Quintela 3377d13299dSbellardcase $targetos in 338c326e0afSbellardCYGWIN*) 339c326e0afSbellard mingw32="yes" 340a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 341d5631638Smalc audio_possible_drivers="winwave sdl" 342d5631638Smalc audio_drv_list="winwave" 343c326e0afSbellard;; 34467b915a5SbellardMINGW32*) 34567b915a5Sbellard mingw32="yes" 346d5631638Smalc audio_possible_drivers="winwave dsound sdl fmod" 347d5631638Smalc audio_drv_list="winwave" 34867b915a5Sbellard;; 3495c40d2bdSthsGNU/kFreeBSD) 350a167ba50SAurelien Jarno bsd="yes" 3510c58ac1cSmalc audio_drv_list="oss" 352f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 3535c40d2bdSths;; 3547d3505c5SbellardFreeBSD) 3557d3505c5Sbellard bsd="yes" 3560db4a067SPaolo Bonzini make="${MAKE-gmake}" 3570c58ac1cSmalc audio_drv_list="oss" 358f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 359f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 360f01576f1SJuergen Lock LIBS="-lutil $LIBS" 3617d3505c5Sbellard;; 362c5e97233Sblueswir1DragonFly) 363c5e97233Sblueswir1 bsd="yes" 3640db4a067SPaolo Bonzini make="${MAKE-gmake}" 365c5e97233Sblueswir1 audio_drv_list="oss" 366c5e97233Sblueswir1 audio_possible_drivers="oss sdl esd pa" 367c5e97233Sblueswir1;; 3687d3505c5SbellardNetBSD) 3697d3505c5Sbellard bsd="yes" 3700db4a067SPaolo Bonzini make="${MAKE-gmake}" 3710c58ac1cSmalc audio_drv_list="oss" 372c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3738ef92a88Sblueswir1 oss_lib="-lossaudio" 3747d3505c5Sbellard;; 3757d3505c5SbellardOpenBSD) 3767d3505c5Sbellard bsd="yes" 3770db4a067SPaolo Bonzini make="${MAKE-gmake}" 3780c58ac1cSmalc audio_drv_list="oss" 379c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3802f6a1ab0Sblueswir1 oss_lib="-lossaudio" 3817d3505c5Sbellard;; 38283fb7adfSbellardDarwin) 38383fb7adfSbellard bsd="yes" 38483fb7adfSbellard darwin="yes" 3850dbfc675SJuan Quintela # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can 3860dbfc675SJuan Quintela # run 64-bit userspace code 387aab8588aSmalc if [ "$cpu" = "i386" ] ; then 3881b0f9cc2Saliguori is_x86_64=`sysctl -n hw.optional.x86_64` 389aab8588aSmalc [ "$is_x86_64" = "1" ] && cpu=x86_64 3901b0f9cc2Saliguori fi 3911b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 392a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 3930c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 3941b0f9cc2Saliguori else 395a558ee17SJuan Quintela QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS" 3961b0f9cc2Saliguori fi 397831b7825Sths darwin_user="yes" 398fd677642Sths cocoa="yes" 3990c58ac1cSmalc audio_drv_list="coreaudio" 400c2de5c91Smalc audio_possible_drivers="coreaudio sdl fmod" 4010c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 4027973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 40383fb7adfSbellard;; 404ec530c81SbellardSunOS) 405ec530c81Sbellard solaris="yes" 4060db4a067SPaolo Bonzini make="${MAKE-gmake}" 4070db4a067SPaolo Bonzini install="${INSTALL-ginstall}" 408fa58948dSBlue Swirl ld="gld" 4090475a5caSths needs_libsunmath="no" 410c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 411ef18c883Sths # have to select again, because `uname -m` returns i86pc 412ef18c883Sths # even on an x86_64 box. 413ef18c883Sths solariscpu=`isainfo -k` 414ef18c883Sths if test "${solariscpu}" = "amd64" ; then 415ef18c883Sths cpu="x86_64" 416ef18c883Sths fi 417c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 4180475a5caSths if test "$solarisrev" -le 9 ; then 4190475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 4200475a5caSths needs_libsunmath="yes" 421f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 422f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 423f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 4240475a5caSths else 4250475a5caSths echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" 4260475a5caSths echo "libsunmath from the Sun Studio compilers tools, due to a lack of" 4270475a5caSths echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" 4280475a5caSths echo "Studio 11 can be downloaded from www.sun.com." 4290475a5caSths exit 1 4300475a5caSths fi 4310475a5caSths fi 43286b2bd93Sths fi 4336b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 4340c58ac1cSmalc audio_drv_list="oss" 4356b4d2ba1Sths fi 436c2de5c91Smalc audio_possible_drivers="oss sdl" 437d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 438d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 439d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 440d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 441a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 442e174c0bbSJuan Quintela LIBS="-lsocket -lnsl -lresolv $LIBS" 443ec530c81Sbellard;; 444b29fe3edSmalcAIX) 445b29fe3edSmalc aix="yes" 4460db4a067SPaolo Bonzini make="${MAKE-gmake}" 447b29fe3edSmalc;; 448179cf400SAndreas FärberHaiku) 449179cf400SAndreas Färber haiku="yes" 450179cf400SAndreas Färber QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" 451179cf400SAndreas Färber LIBS="-lposix_error_mapper -lnetwork $LIBS" 452179cf400SAndreas Färber;; 453fb065187Sbellard*) 4540c58ac1cSmalc audio_drv_list="oss" 455b8e59f18Smalc audio_possible_drivers="oss alsa sdl esd pa" 4565327cf48Sbellard linux="yes" 457831b7825Sths linux_user="yes" 45868063649Sblueswir1 usb="linux" 45907f4ddbfSbellard if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 460c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 461c9ec1fe4Sbellard fi 462fb065187Sbellard;; 4637d13299dSbellardesac 4647d13299dSbellard 4657d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 466b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 46768063649Sblueswir1 usb="bsd" 46883fb7adfSbellard fi 46984778508Sblueswir1 bsd_user="yes" 4707d3505c5Sbellardfi 4717d3505c5Sbellard 4720db4a067SPaolo Bonzini: ${make=${MAKE-make}} 4730db4a067SPaolo Bonzini: ${install=${INSTALL-install}} 4740db4a067SPaolo Bonzini 4753457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 4763457a3f8SJuan Quintela EXESUF=".exe" 477a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 478e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 479e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 48008f3896aSStefan Weil LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS" 481683035deSPaolo Bonzini prefix="c:/Program Files/Qemu" 482683035deSPaolo Bonzini mandir="\${prefix}" 483683035deSPaolo Bonzini datadir="\${prefix}" 484683035deSPaolo Bonzini docdir="\${prefix}" 485683035deSPaolo Bonzini bindir="\${prefix}" 486683035deSPaolo Bonzini sysconfdir="\${prefix}" 487683035deSPaolo Bonzini confsuffix="" 4883457a3f8SJuan Quintelafi 4893457a3f8SJuan Quintela 490487fefdbSAnthony Liguoriwerror="" 49185aa5189Sbellard 4927d13299dSbellardfor opt do 493a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 4947d13299dSbellard case "$opt" in 4952efc3265Sbellard --help|-h) show_help=yes 4962efc3265Sbellard ;; 49799123e13SMike Frysinger --version|-V) exec cat $source_path/VERSION 49899123e13SMike Frysinger ;; 499b1a550a0Spbrook --prefix=*) prefix="$optarg" 5007d13299dSbellard ;; 501b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 50232ce6337Sbellard ;; 503ca4deeb1SPaolo Bonzini --source-path=*) 5047d13299dSbellard ;; 505ac0df51dSaliguori --cross-prefix=*) 5067d13299dSbellard ;; 507ac0df51dSaliguori --cc=*) 5087d13299dSbellard ;; 509b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 51083469015Sbellard ;; 511b1a550a0Spbrook --make=*) make="$optarg" 5127d13299dSbellard ;; 5136a882643Spbrook --install=*) install="$optarg" 5146a882643Spbrook ;; 515e2a2ed06SJuan Quintela --extra-cflags=*) 5167d13299dSbellard ;; 517e2a2ed06SJuan Quintela --extra-ldflags=*) 5187d13299dSbellard ;; 5192ff6b91eSJuan Quintela --cpu=*) 5207d13299dSbellard ;; 521b1a550a0Spbrook --target-list=*) target_list="$optarg" 522de83cd02Sbellard ;; 52374242e0fSPaolo Bonzini --enable-trace-backend=*) trace_backend="$optarg" 52494a420b1SStefan Hajnoczi ;; 52574242e0fSPaolo Bonzini --with-trace-file=*) trace_file="$optarg" 5269410b56cSPrerna Saxena ;; 5277d13299dSbellard --enable-gprof) gprof="yes" 5287d13299dSbellard ;; 52979427693SLoïc Minier --static) 53079427693SLoïc Minier static="yes" 53179427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 53243ce4dfeSbellard ;; 5330b24e75fSPaolo Bonzini --mandir=*) mandir="$optarg" 5340b24e75fSPaolo Bonzini ;; 5350b24e75fSPaolo Bonzini --bindir=*) bindir="$optarg" 5360b24e75fSPaolo Bonzini ;; 5370b24e75fSPaolo Bonzini --datadir=*) datadir="$optarg" 5380b24e75fSPaolo Bonzini ;; 5390b24e75fSPaolo Bonzini --docdir=*) docdir="$optarg" 5400b24e75fSPaolo Bonzini ;; 541ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 54207381cc1SAnthony Liguori ;; 54397a847bcSbellard --disable-sdl) sdl="no" 54497a847bcSbellard ;; 545c4198157SJuan Quintela --enable-sdl) sdl="yes" 546c4198157SJuan Quintela ;; 547821601eaSJes Sorensen --disable-vnc) vnc="no" 548821601eaSJes Sorensen ;; 549821601eaSJes Sorensen --enable-vnc) vnc="yes" 550821601eaSJes Sorensen ;; 551b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 552102a52e4Sbellard ;; 553c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 554c2de5c91Smalc ;; 5552f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 5562f6a1ab0Sblueswir1 ;; 5572fa7d3bfSmalc --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` 5580c58ac1cSmalc ;; 5590c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 5600c58ac1cSmalc ;; 561eb852011SMarkus Armbruster --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 562eb852011SMarkus Armbruster ;; 563f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 564f8393946Saurel32 ;; 565f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 566f8393946Saurel32 ;; 567b4475aa2SLuiz Capitulino --enable-debug-mon) debug_mon="yes" 568b4475aa2SLuiz Capitulino ;; 569b4475aa2SLuiz Capitulino --disable-debug-mon) debug_mon="no" 570b4475aa2SLuiz Capitulino ;; 571f3d08ee6SPaul Brook --enable-debug) 572f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 573f3d08ee6SPaul Brook debug_tcg="yes" 574b4475aa2SLuiz Capitulino debug_mon="yes" 575f3d08ee6SPaul Brook debug="yes" 576f3d08ee6SPaul Brook strip_opt="no" 577f3d08ee6SPaul Brook ;; 57803b4fe7dSaliguori --enable-sparse) sparse="yes" 57903b4fe7dSaliguori ;; 58003b4fe7dSaliguori --disable-sparse) sparse="no" 58103b4fe7dSaliguori ;; 5821625af87Saliguori --disable-strip) strip_opt="no" 5831625af87Saliguori ;; 5848d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 5858d5d2d4cSths ;; 5861be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 5871be10ad2SJuan Quintela ;; 5882f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 5892f9606b3Saliguori ;; 590ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 591ea784e3bSJuan Quintela ;; 5922f6f5c7aSCorentin Chary --disable-vnc-jpeg) vnc_jpeg="no" 5932f6f5c7aSCorentin Chary ;; 5942f6f5c7aSCorentin Chary --enable-vnc-jpeg) vnc_jpeg="yes" 5952f6f5c7aSCorentin Chary ;; 596efe556adSCorentin Chary --disable-vnc-png) vnc_png="no" 597efe556adSCorentin Chary ;; 598efe556adSCorentin Chary --enable-vnc-png) vnc_png="yes" 599efe556adSCorentin Chary ;; 600bd023f95SCorentin Chary --disable-vnc-thread) vnc_thread="no" 601bd023f95SCorentin Chary ;; 602bd023f95SCorentin Chary --enable-vnc-thread) vnc_thread="yes" 603bd023f95SCorentin Chary ;; 604443f1376Sbellard --disable-slirp) slirp="no" 605c20709aaSbellard ;; 606ee682d27SStefan Weil --disable-uuid) uuid="no" 607ee682d27SStefan Weil ;; 608ee682d27SStefan Weil --enable-uuid) uuid="yes" 609ee682d27SStefan Weil ;; 610e0e6c8c0Saliguori --disable-vde) vde="no" 6118a16d273Sths ;; 612dfb278bdSJuan Quintela --enable-vde) vde="yes" 613dfb278bdSJuan Quintela ;; 614e37630caSaliguori --disable-xen) xen="no" 615e37630caSaliguori ;; 616fc321b4bSJuan Quintela --enable-xen) xen="yes" 617fc321b4bSJuan Quintela ;; 6182e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 6192e4d9fb1Saurel32 ;; 6204ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 6214ffcedb6SJuan Quintela ;; 622fb599c9aSbalrog --disable-bluez) bluez="no" 623fb599c9aSbalrog ;; 624a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 625a20a6f46SJuan Quintela ;; 6267ba1e619Saliguori --disable-kvm) kvm="no" 6277ba1e619Saliguori ;; 628b31a0277SJuan Quintela --enable-kvm) kvm="yes" 629b31a0277SJuan Quintela ;; 630cd4ec0b4SGerd Hoffmann --disable-spice) spice="no" 631cd4ec0b4SGerd Hoffmann ;; 632cd4ec0b4SGerd Hoffmann --enable-spice) spice="yes" 633cd4ec0b4SGerd Hoffmann ;; 63405c2a3e7Sbellard --enable-profiler) profiler="yes" 63505c2a3e7Sbellard ;; 636c2de5c91Smalc --enable-cocoa) 637c2de5c91Smalc cocoa="yes" ; 638c2de5c91Smalc sdl="no" ; 639c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 6405b0753e0Sbellard ;; 641cad25d69Spbrook --disable-system) softmmu="no" 6420a8e90f4Spbrook ;; 643cad25d69Spbrook --enable-system) softmmu="yes" 6440a8e90f4Spbrook ;; 6450953a80fSZachary Amsden --disable-user) 6460953a80fSZachary Amsden linux_user="no" ; 6470953a80fSZachary Amsden bsd_user="no" ; 6480953a80fSZachary Amsden darwin_user="no" 6490953a80fSZachary Amsden ;; 6500953a80fSZachary Amsden --enable-user) ;; 651831b7825Sths --disable-linux-user) linux_user="no" 6520a8e90f4Spbrook ;; 653831b7825Sths --enable-linux-user) linux_user="yes" 654831b7825Sths ;; 655831b7825Sths --disable-darwin-user) darwin_user="no" 656831b7825Sths ;; 657831b7825Sths --enable-darwin-user) darwin_user="yes" 6580a8e90f4Spbrook ;; 65984778508Sblueswir1 --disable-bsd-user) bsd_user="no" 66084778508Sblueswir1 ;; 66184778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 66284778508Sblueswir1 ;; 663379f6698SPaul Brook --enable-guest-base) guest_base="yes" 664379f6698SPaul Brook ;; 665379f6698SPaul Brook --disable-guest-base) guest_base="no" 666379f6698SPaul Brook ;; 66734005a00SKirill A. Shutemov --enable-user-pie) user_pie="yes" 66834005a00SKirill A. Shutemov ;; 66934005a00SKirill A. Shutemov --disable-user-pie) user_pie="no" 67034005a00SKirill A. Shutemov ;; 671c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 672c5937220Spbrook ;; 6733142255cSblueswir1 --sparc_cpu=*) 6743142255cSblueswir1 ;; 67585aa5189Sbellard --enable-werror) werror="yes" 67685aa5189Sbellard ;; 67785aa5189Sbellard --disable-werror) werror="no" 67885aa5189Sbellard ;; 6794d3b6f6eSbalrog --disable-curses) curses="no" 6804d3b6f6eSbalrog ;; 681c584a6d0SJuan Quintela --enable-curses) curses="yes" 682c584a6d0SJuan Quintela ;; 683769ce76dSAlexander Graf --disable-curl) curl="no" 684769ce76dSAlexander Graf ;; 685788c8196SJuan Quintela --enable-curl) curl="yes" 686788c8196SJuan Quintela ;; 6872df87df7SJuan Quintela --disable-fdt) fdt="no" 6882df87df7SJuan Quintela ;; 6892df87df7SJuan Quintela --enable-fdt) fdt="yes" 6902df87df7SJuan Quintela ;; 6915495ed11SLuiz Capitulino --disable-check-utests) check_utests="no" 6925495ed11SLuiz Capitulino ;; 6935495ed11SLuiz Capitulino --enable-check-utests) check_utests="yes" 6945495ed11SLuiz Capitulino ;; 695bd0c5661Spbrook --disable-nptl) nptl="no" 696bd0c5661Spbrook ;; 697b0a47e79SJuan Quintela --enable-nptl) nptl="yes" 698b0a47e79SJuan Quintela ;; 6998ff9cbf7Smalc --enable-mixemu) mixemu="yes" 7008ff9cbf7Smalc ;; 7015c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 7025c6c3a6cSChristoph Hellwig ;; 7035c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 7045c6c3a6cSChristoph Hellwig ;; 705758e8e38SVenkateswararao Jujjuri (JV) --disable-attr) attr="no" 706758e8e38SVenkateswararao Jujjuri (JV) ;; 707758e8e38SVenkateswararao Jujjuri (JV) --enable-attr) attr="yes" 708758e8e38SVenkateswararao Jujjuri (JV) ;; 709e5d355d1Saliguori --enable-io-thread) io_thread="yes" 710e5d355d1Saliguori ;; 71177755340Sths --disable-blobs) blobs="no" 71277755340Sths ;; 713eac30262Saliguori --kerneldir=*) kerneldir="$optarg" 714eac30262Saliguori ;; 7154a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 7164a19f1ecSpbrook ;; 717a25dba17SJuan Quintela --disable-docs) docs="no" 71870ec5dc0SAnthony Liguori ;; 719a25dba17SJuan Quintela --enable-docs) docs="yes" 72083a3ab8bSJuan Quintela ;; 721d5970055SMichael S. Tsirkin --disable-vhost-net) vhost_net="no" 722d5970055SMichael S. Tsirkin ;; 723d5970055SMichael S. Tsirkin --enable-vhost-net) vhost_net="yes" 724d5970055SMichael S. Tsirkin ;; 72520ff075bSMichael Walle --disable-opengl) opengl="no" 72620ff075bSMichael Walle ;; 72720ff075bSMichael Walle --enable-opengl) opengl="yes" 72820ff075bSMichael Walle ;; 7296bde81cbSPaolo Bonzini --*dir) 7306bde81cbSPaolo Bonzini ;; 731f27aaf4bSChristian Brunner --disable-rbd) rbd="no" 732f27aaf4bSChristian Brunner ;; 733f27aaf4bSChristian Brunner --enable-rbd) rbd="yes" 734f27aaf4bSChristian Brunner ;; 73536707144SAlon Levy --disable-smartcard) smartcard="no" 73636707144SAlon Levy ;; 73736707144SAlon Levy --enable-smartcard) smartcard="yes" 73836707144SAlon Levy ;; 739111a38b0SRobert Relyea --disable-smartcard-nss) smartcard_nss="no" 740111a38b0SRobert Relyea ;; 741111a38b0SRobert Relyea --enable-smartcard-nss) smartcard_nss="yes" 742111a38b0SRobert Relyea ;; 7437f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 7447f1559c6Sbalrog ;; 7457d13299dSbellard esac 7467d13299dSbellarddone 7477d13299dSbellard 7483142255cSblueswir1# 7493142255cSblueswir1# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right 750a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) 7513142255cSblueswir1# 752379f6698SPaul Brookhost_guest_base="no" 75340293e58Sbellardcase "$cpu" in 754ed968ff1SJuan Quintela sparc) case $sparc_cpu in 755ed968ff1SJuan Quintela v7|v8) 756a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 757ed968ff1SJuan Quintela ;; 758ed968ff1SJuan Quintela v8plus|v8plusa) 759a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 760ed968ff1SJuan Quintela ;; 761ed968ff1SJuan Quintela *) # sparc_cpu not defined in the command line 762a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" 763ed968ff1SJuan Quintela esac 7640c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 765a558ee17SJuan Quintela QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS" 766762e8230Sblueswir1 if test "$solaris" = "no" ; then 767a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS" 768c81da56eSJuan Quintela helper_cflags="-ffixed-i0" 769762e8230Sblueswir1 fi 7703142255cSblueswir1 ;; 771ed968ff1SJuan Quintela sparc64) 772a558ee17SJuan Quintela QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" 7730c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 774a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" 775ed968ff1SJuan Quintela if test "$solaris" != "no" ; then 776a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS" 777762e8230Sblueswir1 fi 7783142255cSblueswir1 ;; 77976d83bdeSths s390) 78028d7cc49SRichard Henderson QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS" 78128d7cc49SRichard Henderson LDFLAGS="-m31 $LDFLAGS" 78248bb3750SRichard Henderson host_guest_base="yes" 78328d7cc49SRichard Henderson ;; 78428d7cc49SRichard Henderson s390x) 78528d7cc49SRichard Henderson QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS" 78628d7cc49SRichard Henderson LDFLAGS="-m64 $LDFLAGS" 78748bb3750SRichard Henderson host_guest_base="yes" 78876d83bdeSths ;; 78940293e58Sbellard i386) 790a558ee17SJuan Quintela QEMU_CFLAGS="-m32 $QEMU_CFLAGS" 7910c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 7922b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 793c81da56eSJuan Quintela helper_cflags="-fomit-frame-pointer" 794379f6698SPaul Brook host_guest_base="yes" 79540293e58Sbellard ;; 79640293e58Sbellard x86_64) 797a558ee17SJuan Quintela QEMU_CFLAGS="-m64 $QEMU_CFLAGS" 7980c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 7992b2e59e6SPaolo Bonzini cc_i386='$(CC) -m32' 800379f6698SPaul Brook host_guest_base="yes" 801379f6698SPaul Brook ;; 802379f6698SPaul Brook arm*) 803379f6698SPaul Brook host_guest_base="yes" 80440293e58Sbellard ;; 805f6548c0aSmalc ppc*) 806f6548c0aSmalc host_guest_base="yes" 807f6548c0aSmalc ;; 808cc01cc8eSAurelien Jarno mips*) 809cc01cc8eSAurelien Jarno host_guest_base="yes" 810cc01cc8eSAurelien Jarno ;; 811477ba620SAurelien Jarno ia64*) 812477ba620SAurelien Jarno host_guest_base="yes" 813477ba620SAurelien Jarno ;; 814fd76e73aSRichard Henderson hppa*) 815fd76e73aSRichard Henderson host_guest_base="yes" 816fd76e73aSRichard Henderson ;; 817*d2fbca94SGuan Xuetao unicore32*) 818*d2fbca94SGuan Xuetao host_guest_base="yes" 819*d2fbca94SGuan Xuetao ;; 8203142255cSblueswir1esac 8213142255cSblueswir1 822379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base" 823379f6698SPaul Brook 824af5db58eSpbrookif test x"$show_help" = x"yes" ; then 825af5db58eSpbrookcat << EOF 826af5db58eSpbrook 827af5db58eSpbrookUsage: configure [options] 828af5db58eSpbrookOptions: [defaults in brackets after descriptions] 829af5db58eSpbrook 830af5db58eSpbrookEOF 831af5db58eSpbrookecho "Standard options:" 832af5db58eSpbrookecho " --help print this message" 833af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 834af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 835af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 836af5db58eSpbrookecho " --target-list=LIST set target list [$target_list]" 837af5db58eSpbrookecho "" 838af5db58eSpbrookecho "Advanced options (experts only):" 839af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 840af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 841af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 8420bfe8cc0SPaolo Bonziniecho " --host-cc=CC use C compiler CC [$host_cc] for code run at" 8430bfe8cc0SPaolo Bonziniecho " build time" 844a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 845e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 846af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 8476a882643Spbrookecho " --install=INSTALL use specified install [$install]" 848af5db58eSpbrookecho " --static enable static build [$static]" 8490b24e75fSPaolo Bonziniecho " --mandir=PATH install man pages in PATH" 8500b24e75fSPaolo Bonziniecho " --datadir=PATH install firmware in PATH" 8510b24e75fSPaolo Bonziniecho " --docdir=PATH install documentation in PATH" 8520b24e75fSPaolo Bonziniecho " --bindir=PATH install binaries in PATH" 8530b24e75fSPaolo Bonziniecho " --sysconfdir=PATH install config in PATH/qemu" 854f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 855f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 85609695a4aSStefan Weilecho " --enable-debug enable common debug build options" 857890b1658Saliguoriecho " --enable-sparse enable sparse checker" 858890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 8591625af87Saliguoriecho " --disable-strip disable stripping binaries" 86085aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 861fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 862c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 863821601eaSJes Sorensenecho " --disable-vnc disable VNC" 864821601eaSJes Sorensenecho " --enable-vnc enable VNC" 865af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 866c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 867c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 8684c9b53e3Smalcecho " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" 8694c9b53e3Smalcecho " Available cards: $audio_possible_cards" 870eb852011SMarkus Armbrusterecho " --block-drv-whitelist=L set block driver whitelist" 871eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 8728ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 873e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 874fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 8752e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 8764ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 8778d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 8781be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 8792f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 880ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 8812f6f5c7aSCorentin Charyecho " --disable-vnc-jpeg disable JPEG lossy compression for VNC server" 8822f6f5c7aSCorentin Charyecho " --enable-vnc-jpeg enable JPEG lossy compression for VNC server" 88396763cf9SCorentin Charyecho " --disable-vnc-png disable PNG compression for VNC server (default)" 884efe556adSCorentin Charyecho " --enable-vnc-png enable PNG compression for VNC server" 885bd023f95SCorentin Charyecho " --disable-vnc-thread disable threaded VNC server" 886bd023f95SCorentin Charyecho " --enable-vnc-thread enable threaded VNC server" 887af896aaaSpbrookecho " --disable-curses disable curses output" 888c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 889769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 890788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 8912df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 8922df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 8935495ed11SLuiz Capitulinoecho " --disable-check-utests disable check unit-tests" 8945495ed11SLuiz Capitulinoecho " --enable-check-utests enable check unit-tests" 895fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 896a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 8977ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 898b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 899bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 900e5934d33SAndre Przywaraecho " --enable-nptl enable usermode NPTL support" 901af5db58eSpbrookecho " --enable-system enable all system emulation targets" 902af5db58eSpbrookecho " --disable-system disable all system emulation targets" 9030953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 9040953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 905831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 906831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 907831b7825Sthsecho " --enable-darwin-user enable all darwin usermode emulation targets" 908831b7825Sthsecho " --disable-darwin-user disable all darwin usermode emulation targets" 90984778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 91084778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 911379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 912379f6698SPaul Brookecho " emulation targets" 913379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 91434005a00SKirill A. Shutemovecho " --enable-user-pie build usermode emulation targets as PIE" 91534005a00SKirill A. Shutemovecho " --disable-user-pie do not build usermode emulation targets as PIE" 916af5db58eSpbrookecho " --fmod-lib path to FMOD library" 917af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 9182f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 919c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 9203142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 921ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 922ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 923e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 924dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 9255c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 9265c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 927758e8e38SVenkateswararao Jujjuri (JV)echo " --disable-attr disables attr and xattr support" 928758e8e38SVenkateswararao Jujjuri (JV)echo " --enable-attr enable attr and xattr support" 929e5d355d1Saliguoriecho " --enable-io-thread enable IO thread" 93077755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 931eac30262Saliguoriecho " --kerneldir=PATH look for kernel includes in PATH" 932d2807bc9SDirk Ullrichecho " --enable-docs enable documentation build" 933d2807bc9SDirk Ullrichecho " --disable-docs disable documentation build" 934d5970055SMichael S. Tsirkinecho " --disable-vhost-net disable vhost-net acceleration support" 935d5970055SMichael S. Tsirkinecho " --enable-vhost-net enable vhost-net acceleration support" 936320fba2aSFabien Chouteauecho " --enable-trace-backend=B Set trace backend" 937320fba2aSFabien Chouteauecho " Available backends:" $("$source_path"/scripts/tracetool --list-backends) 93874242e0fSPaolo Bonziniecho " --with-trace-file=NAME Full PATH,NAME of file to store traces" 9399410b56cSPrerna Saxenaecho " Default:trace-<pid>" 940cd4ec0b4SGerd Hoffmannecho " --disable-spice disable spice" 941cd4ec0b4SGerd Hoffmannecho " --enable-spice enable spice" 942f27aaf4bSChristian Brunnerecho " --enable-rbd enable building the rados block device (rbd)" 94336707144SAlon Levyecho " --disable-smartcard disable smartcard support" 94436707144SAlon Levyecho " --enable-smartcard enable smartcard support" 945111a38b0SRobert Relyeaecho " --disable-smartcard-nss disable smartcard nss support" 946111a38b0SRobert Relyeaecho " --enable-smartcard-nss enable smartcard nss support" 947af5db58eSpbrookecho "" 9485bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 949af5db58eSpbrookexit 1 950af5db58eSpbrookfi 951af5db58eSpbrook 9528d05095cSPaolo Bonzini# check that the C compiler works. 9538d05095cSPaolo Bonzinicat > $TMPC <<EOF 9548d05095cSPaolo Bonziniint main(void) {} 9558d05095cSPaolo BonziniEOF 9568d05095cSPaolo Bonzini 9578d05095cSPaolo Bonziniif compile_object ; then 9588d05095cSPaolo Bonzini : C compiler works ok 9598d05095cSPaolo Bonzinielse 9608d05095cSPaolo Bonzini echo "ERROR: \"$cc\" either does not exist or does not work" 9618d05095cSPaolo Bonzini exit 1 9628d05095cSPaolo Bonzinifi 9638d05095cSPaolo Bonzini 9648d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" 9658d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" 9668d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" 9678d05095cSPaolo Bonzinigcc_flags="-fstack-protector-all $gcc_flags" 9688d05095cSPaolo Bonzinicat > $TMPC << EOF 9698d05095cSPaolo Bonziniint main(void) { return 0; } 9708d05095cSPaolo BonziniEOF 9718d05095cSPaolo Bonzinifor flag in $gcc_flags; do 9728d05095cSPaolo Bonzini if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then 9738d05095cSPaolo Bonzini QEMU_CFLAGS="$QEMU_CFLAGS $flag" 9748d05095cSPaolo Bonzini fi 9758d05095cSPaolo Bonzinidone 9768d05095cSPaolo Bonzini 977ec530c81Sbellard# 978ec530c81Sbellard# Solaris specific configure tool chain decisions 979ec530c81Sbellard# 980ec530c81Sbellardif test "$solaris" = "yes" ; then 9816792aa11SLoïc Minier if has $install; then 9826792aa11SLoïc Minier : 9836792aa11SLoïc Minier else 984ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 985ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 986ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 987ec530c81Sbellard exit 1 988ec530c81Sbellard fi 9896792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 990ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 991ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 992ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 993ec530c81Sbellard exit 1 994ec530c81Sbellard fi 9956792aa11SLoïc Minier if has ar; then 9966792aa11SLoïc Minier : 9976792aa11SLoïc Minier else 998ec530c81Sbellard echo "Error: No path includes ar" 999ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 1000ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 1001ec530c81Sbellard fi 1002ec530c81Sbellard exit 1 1003ec530c81Sbellard fi 1004ec530c81Sbellardfi 1005ec530c81Sbellard 1006ec530c81Sbellard 10075327cf48Sbellardif test -z "$target_list" ; then 10085327cf48Sbellard# these targets are portable 10090a8e90f4Spbrook if [ "$softmmu" = "yes" ] ; then 10102408a527Saurel32 target_list="\ 10112408a527Saurel32i386-softmmu \ 10122408a527Saurel32x86_64-softmmu \ 10132408a527Saurel32arm-softmmu \ 10142408a527Saurel32cris-softmmu \ 1015613a22c9SMichael Wallelm32-softmmu \ 10162408a527Saurel32m68k-softmmu \ 101772b675caSEdgar E. Iglesiasmicroblaze-softmmu \ 1018877fdc12SEdgar E. Iglesiasmicroblazeel-softmmu \ 10192408a527Saurel32mips-softmmu \ 10202408a527Saurel32mipsel-softmmu \ 10212408a527Saurel32mips64-softmmu \ 10222408a527Saurel32mips64el-softmmu \ 10232408a527Saurel32ppc-softmmu \ 10242408a527Saurel32ppcemb-softmmu \ 10252408a527Saurel32ppc64-softmmu \ 10262408a527Saurel32sh4-softmmu \ 10272408a527Saurel32sh4eb-softmmu \ 10282408a527Saurel32sparc-softmmu \ 10291b64fcaeSIgor V. Kovalenkosparc64-softmmu \ 10302408a527Saurel32" 10310a8e90f4Spbrook fi 10325327cf48Sbellard# the following are Linux specific 1033831b7825Sths if [ "$linux_user" = "yes" ] ; then 10342408a527Saurel32 target_list="${target_list}\ 10352408a527Saurel32i386-linux-user \ 10362408a527Saurel32x86_64-linux-user \ 10372408a527Saurel32alpha-linux-user \ 10382408a527Saurel32arm-linux-user \ 10392408a527Saurel32armeb-linux-user \ 10402408a527Saurel32cris-linux-user \ 10412408a527Saurel32m68k-linux-user \ 104272b675caSEdgar E. Iglesiasmicroblaze-linux-user \ 1043877fdc12SEdgar E. Iglesiasmicroblazeel-linux-user \ 10442408a527Saurel32mips-linux-user \ 10452408a527Saurel32mipsel-linux-user \ 10462408a527Saurel32ppc-linux-user \ 10472408a527Saurel32ppc64-linux-user \ 10482408a527Saurel32ppc64abi32-linux-user \ 10492408a527Saurel32sh4-linux-user \ 10502408a527Saurel32sh4eb-linux-user \ 10512408a527Saurel32sparc-linux-user \ 10522408a527Saurel32sparc64-linux-user \ 10532408a527Saurel32sparc32plus-linux-user \ 1054*d2fbca94SGuan Xuetaounicore32-linux-user \ 10552408a527Saurel32" 1056831b7825Sths fi 1057831b7825Sths# the following are Darwin specific 1058831b7825Sths if [ "$darwin_user" = "yes" ] ; then 10592408a527Saurel32 target_list="$target_list i386-darwin-user ppc-darwin-user " 10605327cf48Sbellard fi 106184778508Sblueswir1# the following are BSD specific 106284778508Sblueswir1 if [ "$bsd_user" = "yes" ] ; then 106384778508Sblueswir1 target_list="${target_list}\ 106431fc12dfSblueswir1i386-bsd-user \ 106531fc12dfSblueswir1x86_64-bsd-user \ 106631fc12dfSblueswir1sparc-bsd-user \ 106784778508Sblueswir1sparc64-bsd-user \ 106884778508Sblueswir1" 106984778508Sblueswir1 fi 10706e20a45fSbellardelse 1071b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 10725327cf48Sbellardfi 10730a8e90f4Spbrookif test -z "$target_list" ; then 10740a8e90f4Spbrook echo "No targets enabled" 10750a8e90f4Spbrook exit 1 10760a8e90f4Spbrookfi 1077f55fe278SPaolo Bonzini# see if system emulation was really requested 1078f55fe278SPaolo Bonzinicase " $target_list " in 1079f55fe278SPaolo Bonzini *"-softmmu "*) softmmu=yes 1080f55fe278SPaolo Bonzini ;; 1081f55fe278SPaolo Bonzini *) softmmu=no 1082f55fe278SPaolo Bonzini ;; 1083f55fe278SPaolo Bonziniesac 10845327cf48Sbellard 1085249247c9SJuan Quintelafeature_not_found() { 1086249247c9SJuan Quintela feature=$1 1087249247c9SJuan Quintela 1088249247c9SJuan Quintela echo "ERROR" 1089249247c9SJuan Quintela echo "ERROR: User requested feature $feature" 10909332f6a2SSebastian Herbszt echo "ERROR: configure was not able to find it" 1091249247c9SJuan Quintela echo "ERROR" 1092249247c9SJuan Quintela exit 1; 1093249247c9SJuan Quintela} 1094249247c9SJuan Quintela 10957d13299dSbellardif test -z "$cross_prefix" ; then 10967d13299dSbellard 10977d13299dSbellard# --- 10987d13299dSbellard# big/little endian test 10997d13299dSbellardcat > $TMPC << EOF 11007d13299dSbellard#include <inttypes.h> 11017d13299dSbellardint main(int argc, char ** argv){ 11027d13299dSbellard volatile uint32_t i=0x01234567; 11037d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 11047d13299dSbellard} 11057d13299dSbellardEOF 11067d13299dSbellard 110752166aa0SJuan Quintelaif compile_prog "" "" ; then 11087d13299dSbellard$TMPE && bigendian="yes" 11097d13299dSbellardelse 11107d13299dSbellardecho big/little test failed 11117d13299dSbellardfi 11127d13299dSbellard 11137d13299dSbellardelse 11147d13299dSbellard 11157d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 1116ea8f20f8SJuan Quintelacase "$cpu" in 111724e804ecSAlexander Graf armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 1118ea8f20f8SJuan Quintela bigendian=yes 1119ea8f20f8SJuan Quintela ;; 1120ea8f20f8SJuan Quintelaesac 11217d13299dSbellard 11227d13299dSbellardfi 11237d13299dSbellard 112470be1a2eSPaolo Bonzini# host long bits test, actually a pointer size test 112570be1a2eSPaolo Bonzinicat > $TMPC << EOF 112670be1a2eSPaolo Bonziniint sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1]; 112770be1a2eSPaolo BonziniEOF 112870be1a2eSPaolo Bonziniif compile_object; then 1129ea8f20f8SJuan Quintelahostlongbits=64 113070be1a2eSPaolo Bonzinielse 113170be1a2eSPaolo Bonzinihostlongbits=32 113270be1a2eSPaolo Bonzinifi 1133b6853697Sbellard 1134b0a47e79SJuan Quintela 1135b0a47e79SJuan Quintela########################################## 1136b0a47e79SJuan Quintela# NPTL probe 1137b0a47e79SJuan Quintela 1138b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then 1139bd0c5661Spbrook cat > $TMPC <<EOF 1140bd0c5661Spbrook#include <sched.h> 114130813ceaSpbrook#include <linux/futex.h> 1142bd0c5661Spbrookvoid foo() 1143bd0c5661Spbrook{ 1144bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 1145bd0c5661Spbrook#error bork 1146bd0c5661Spbrook#endif 1147bd0c5661Spbrook} 1148bd0c5661SpbrookEOF 1149bd0c5661Spbrook 115052166aa0SJuan Quintela if compile_object ; then 1151b0a47e79SJuan Quintela nptl=yes 1152bd0c5661Spbrook else 1153b0a47e79SJuan Quintela if test "$nptl" = "yes" ; then 1154b0a47e79SJuan Quintela feature_not_found "nptl" 1155b0a47e79SJuan Quintela fi 1156b0a47e79SJuan Quintela nptl=no 1157b0a47e79SJuan Quintela fi 1158bd0c5661Spbrookfi 1159bd0c5661Spbrook 116011d9f695Sbellard########################################## 1161ac62922eSbalrog# zlib check 1162ac62922eSbalrog 1163ac62922eSbalrogcat > $TMPC << EOF 1164ac62922eSbalrog#include <zlib.h> 1165ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 1166ac62922eSbalrogEOF 116752166aa0SJuan Quintelaif compile_prog "" "-lz" ; then 1168ac62922eSbalrog : 1169ac62922eSbalrogelse 1170ac62922eSbalrog echo 1171ac62922eSbalrog echo "Error: zlib check failed" 1172ac62922eSbalrog echo "Make sure to have the zlib libs and headers installed." 1173ac62922eSbalrog echo 1174ac62922eSbalrog exit 1 1175ac62922eSbalrogfi 1176ac62922eSbalrog 1177ac62922eSbalrog########################################## 1178e37630caSaliguori# xen probe 1179e37630caSaliguori 1180fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1181b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1182e37630caSaliguori cat > $TMPC <<EOF 1183e37630caSaliguori#include <xenctrl.h> 1184e37630caSaliguori#include <xs.h> 1185df7a607bSChristoph Eggerint main(void) { xs_daemon_open(); xc_interface_open(); return 0; } 1186e37630caSaliguoriEOF 118752166aa0SJuan Quintela if compile_prog "" "$xen_libs" ; then 1188fc321b4bSJuan Quintela xen=yes 11893efd632bSJuan Quintela libs_softmmu="$xen_libs $libs_softmmu" 1190e37630caSaliguori else 1191fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 1192fc321b4bSJuan Quintela feature_not_found "xen" 1193fc321b4bSJuan Quintela fi 1194fc321b4bSJuan Quintela xen=no 1195e37630caSaliguori fi 1196e37630caSaliguorifi 1197e37630caSaliguori 1198e37630caSaliguori########################################## 1199a8bd70adSPaolo Bonzini# pkg-config probe 1200f91672e5SPaolo Bonzini 1201a8bd70adSPaolo Bonziniif ! has $pkg_config; then 120208421541SPaolo Bonzini echo warning: proceeding without "$pkg_config" >&2 120308421541SPaolo Bonzini pkg_config=/bin/false 1204f91672e5SPaolo Bonzinifi 1205f91672e5SPaolo Bonzini 1206f91672e5SPaolo Bonzini########################################## 1207dfffc653SJuan Quintela# Sparse probe 1208dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 12090dba6195SLoïc Minier if has cgcc; then 1210dfffc653SJuan Quintela sparse=yes 1211dfffc653SJuan Quintela else 1212dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 1213dfffc653SJuan Quintela feature_not_found "sparse" 1214dfffc653SJuan Quintela fi 1215dfffc653SJuan Quintela sparse=no 1216dfffc653SJuan Quintela fi 1217dfffc653SJuan Quintelafi 1218dfffc653SJuan Quintela 1219dfffc653SJuan Quintela########################################## 122011d9f695Sbellard# SDL probe 122111d9f695Sbellard 12223ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config). Try 12233ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config. 12243ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then 12253ec87ffeSPaolo Bonzini sdl_config=sdl-config 12263ec87ffeSPaolo Bonzinifi 12273ec87ffeSPaolo Bonzini 12283ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then 1229a8bd70adSPaolo Bonzini sdlconfig="$pkg_config sdl" 1230fec0e3e8SStefan Weil _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 12313ec87ffeSPaolo Bonzinielif has ${sdl_config}; then 12323ec87ffeSPaolo Bonzini sdlconfig="$sdl_config" 12339316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1234a0dfd8a4SLoïc Minierelse 1235a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 1236a0dfd8a4SLoïc Minier feature_not_found "sdl" 1237a0dfd8a4SLoïc Minier fi 1238a0dfd8a4SLoïc Minier sdl=no 12399316f803SPaolo Bonzinifi 124029e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then 12413ec87ffeSPaolo Bonzini echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 12423ec87ffeSPaolo Bonzinifi 124311d9f695Sbellard 12449316f803SPaolo Bonzinisdl_too_old=no 1245c4198157SJuan Quintelaif test "$sdl" != "no" ; then 124611d9f695Sbellard cat > $TMPC << EOF 124711d9f695Sbellard#include <SDL.h> 124811d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 124911d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 125011d9f695SbellardEOF 12519316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 125274f42e18STeLeMan if test "$static" = "yes" ; then 125374f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 125474f42e18STeLeMan else 12559316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 125674f42e18STeLeMan fi 125752166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 125811d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 125911d9f695Sbellard sdl_too_old=yes 126011d9f695Sbellard else 1261fd677642Sths if test "$cocoa" = "no" ; then 126211d9f695Sbellard sdl=yes 126311d9f695Sbellard fi 1264fd677642Sths fi 12657c1f25b4Sbellard 126667c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 12671ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 126867c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 1269f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 1270f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 127111d9f695Sbellard fi 127252166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 12731ac88f28SJuan Quintela : 12741ac88f28SJuan Quintela else 12751ac88f28SJuan Quintela sdl=no 12767c1f25b4Sbellard fi 12777c1f25b4Sbellard fi # static link 1278c4198157SJuan Quintela else # sdl not found 1279c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1280c4198157SJuan Quintela feature_not_found "sdl" 1281c4198157SJuan Quintela fi 1282c4198157SJuan Quintela sdl=no 12837c1f25b4Sbellard fi # sdl compile test 1284fd677642Sthsfi 128511d9f695Sbellard 12865368a422Saliguoriif test "$sdl" = "yes" ; then 12875368a422Saliguori cat > $TMPC <<EOF 12885368a422Saliguori#include <SDL.h> 12895368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 12905368a422Saliguori#include <X11/XKBlib.h> 12915368a422Saliguori#else 12925368a422Saliguori#error No x11 support 12935368a422Saliguori#endif 12945368a422Saliguoriint main(void) { return 0; } 12955368a422SaliguoriEOF 129652166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1297681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 12985368a422Saliguori fi 129907d9ac44SJuan Quintela if test "$mingw32" = "yes" ; then 130007d9ac44SJuan Quintela sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole" 130107d9ac44SJuan Quintela fi 13020705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 13035368a422Saliguorifi 13045368a422Saliguori 13058f28f3fbSths########################################## 13068d5d2d4cSths# VNC TLS detection 1307821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then 1308ae6b5e5aSaliguori cat > $TMPC <<EOF 1309ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1310ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1311ae6b5e5aSaliguoriEOF 1312a8bd70adSPaolo Bonzini vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` 1313a8bd70adSPaolo Bonzini vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` 131452166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 13151be10ad2SJuan Quintela vnc_tls=yes 1316a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1317ae6b5e5aSaliguori else 13181be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 13191be10ad2SJuan Quintela feature_not_found "vnc-tls" 13201be10ad2SJuan Quintela fi 13211be10ad2SJuan Quintela vnc_tls=no 13228d5d2d4cSths fi 13238d5d2d4cSthsfi 13248d5d2d4cSths 13258d5d2d4cSths########################################## 13262f9606b3Saliguori# VNC SASL detection 1327821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then 13282f9606b3Saliguori cat > $TMPC <<EOF 13292f9606b3Saliguori#include <sasl/sasl.h> 13302f9606b3Saliguori#include <stdio.h> 13312f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 13322f9606b3SaliguoriEOF 13332f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 13342f9606b3Saliguori vnc_sasl_cflags="" 13352f9606b3Saliguori vnc_sasl_libs="-lsasl2" 133652166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1337ea784e3bSJuan Quintela vnc_sasl=yes 1338fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 13392f9606b3Saliguori else 1340ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1341ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1342ea784e3bSJuan Quintela fi 1343ea784e3bSJuan Quintela vnc_sasl=no 13442f9606b3Saliguori fi 13452f9606b3Saliguorifi 13462f9606b3Saliguori 13472f9606b3Saliguori########################################## 13482f6f5c7aSCorentin Chary# VNC JPEG detection 1349821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then 13502f6f5c7aSCorentin Charycat > $TMPC <<EOF 13512f6f5c7aSCorentin Chary#include <stdio.h> 13522f6f5c7aSCorentin Chary#include <jpeglib.h> 13532f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; } 13542f6f5c7aSCorentin CharyEOF 13552f6f5c7aSCorentin Chary vnc_jpeg_cflags="" 13562f6f5c7aSCorentin Chary vnc_jpeg_libs="-ljpeg" 13572f6f5c7aSCorentin Chary if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then 13582f6f5c7aSCorentin Chary vnc_jpeg=yes 13592f6f5c7aSCorentin Chary libs_softmmu="$vnc_jpeg_libs $libs_softmmu" 13602f6f5c7aSCorentin Chary else 13612f6f5c7aSCorentin Chary if test "$vnc_jpeg" = "yes" ; then 13622f6f5c7aSCorentin Chary feature_not_found "vnc-jpeg" 13632f6f5c7aSCorentin Chary fi 13642f6f5c7aSCorentin Chary vnc_jpeg=no 13652f6f5c7aSCorentin Chary fi 13662f6f5c7aSCorentin Charyfi 13672f6f5c7aSCorentin Chary 13682f6f5c7aSCorentin Chary########################################## 1369efe556adSCorentin Chary# VNC PNG detection 1370821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then 1371efe556adSCorentin Charycat > $TMPC <<EOF 1372efe556adSCorentin Chary//#include <stdio.h> 1373efe556adSCorentin Chary#include <png.h> 1374832ce9c2SScott Wood#include <stddef.h> 1375efe556adSCorentin Charyint main(void) { 1376efe556adSCorentin Chary png_structp png_ptr; 1377efe556adSCorentin Chary png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 1378efe556adSCorentin Chary return 0; 1379efe556adSCorentin Chary} 1380efe556adSCorentin CharyEOF 1381efe556adSCorentin Chary vnc_png_cflags="" 1382efe556adSCorentin Chary vnc_png_libs="-lpng" 1383efe556adSCorentin Chary if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then 1384efe556adSCorentin Chary vnc_png=yes 1385efe556adSCorentin Chary libs_softmmu="$vnc_png_libs $libs_softmmu" 1386efe556adSCorentin Chary else 1387efe556adSCorentin Chary if test "$vnc_png" = "yes" ; then 1388efe556adSCorentin Chary feature_not_found "vnc-png" 1389efe556adSCorentin Chary fi 1390efe556adSCorentin Chary vnc_png=no 1391efe556adSCorentin Chary fi 1392efe556adSCorentin Charyfi 1393efe556adSCorentin Chary 1394efe556adSCorentin Chary########################################## 139576655d6dSaliguori# fnmatch() probe, used for ACL routines 139676655d6dSaliguorifnmatch="no" 139776655d6dSaliguoricat > $TMPC << EOF 139876655d6dSaliguori#include <fnmatch.h> 139976655d6dSaliguoriint main(void) 140076655d6dSaliguori{ 140176655d6dSaliguori fnmatch("foo", "foo", 0); 140276655d6dSaliguori return 0; 140376655d6dSaliguori} 140476655d6dSaliguoriEOF 140552166aa0SJuan Quintelaif compile_prog "" "" ; then 140676655d6dSaliguori fnmatch="yes" 140776655d6dSaliguorifi 140876655d6dSaliguori 140976655d6dSaliguori########################################## 1410ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 1411ee682d27SStefan Weilif test "$uuid" != "no" ; then 1412ee682d27SStefan Weil uuid_libs="-luuid" 1413ee682d27SStefan Weil cat > $TMPC << EOF 1414ee682d27SStefan Weil#include <uuid/uuid.h> 1415ee682d27SStefan Weilint main(void) 1416ee682d27SStefan Weil{ 1417ee682d27SStefan Weil uuid_t my_uuid; 1418ee682d27SStefan Weil uuid_generate(my_uuid); 1419ee682d27SStefan Weil return 0; 1420ee682d27SStefan Weil} 1421ee682d27SStefan WeilEOF 1422ee682d27SStefan Weil if compile_prog "" "$uuid_libs" ; then 1423ee682d27SStefan Weil uuid="yes" 1424ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1425ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1426ee682d27SStefan Weil else 1427ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1428ee682d27SStefan Weil feature_not_found "uuid" 1429ee682d27SStefan Weil fi 1430ee682d27SStefan Weil uuid=no 1431ee682d27SStefan Weil fi 1432ee682d27SStefan Weilfi 1433ee682d27SStefan Weil 1434ee682d27SStefan Weil########################################## 1435dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix 1436dce512deSChristoph Hellwigif test "$xfs" != "no" ; then 1437dce512deSChristoph Hellwig cat > $TMPC << EOF 1438dce512deSChristoph Hellwig#include <xfs/xfs.h> 1439dce512deSChristoph Hellwigint main(void) 1440dce512deSChristoph Hellwig{ 1441dce512deSChristoph Hellwig xfsctl(NULL, 0, 0, NULL); 1442dce512deSChristoph Hellwig return 0; 1443dce512deSChristoph Hellwig} 1444dce512deSChristoph HellwigEOF 1445dce512deSChristoph Hellwig if compile_prog "" "" ; then 1446dce512deSChristoph Hellwig xfs="yes" 1447dce512deSChristoph Hellwig else 1448dce512deSChristoph Hellwig if test "$xfs" = "yes" ; then 1449dce512deSChristoph Hellwig feature_not_found "xfs" 1450dce512deSChristoph Hellwig fi 1451dce512deSChristoph Hellwig xfs=no 1452dce512deSChristoph Hellwig fi 1453dce512deSChristoph Hellwigfi 1454dce512deSChristoph Hellwig 1455dce512deSChristoph Hellwig########################################## 14568a16d273Sths# vde libraries probe 1457dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 14584baae0acSJuan Quintela vde_libs="-lvdeplug" 14598a16d273Sths cat > $TMPC << EOF 14608a16d273Sths#include <libvdeplug.h> 14614a7f0e06Spbrookint main(void) 14624a7f0e06Spbrook{ 14634a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 14644a7f0e06Spbrook vde_open("", "", &a); 14654a7f0e06Spbrook return 0; 14664a7f0e06Spbrook} 14678a16d273SthsEOF 146852166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 14694baae0acSJuan Quintela vde=yes 14708e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 14718e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 1472dfb278bdSJuan Quintela else 1473dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 1474dfb278bdSJuan Quintela feature_not_found "vde" 1475dfb278bdSJuan Quintela fi 1476dfb278bdSJuan Quintela vde=no 14778a16d273Sths fi 14788a16d273Sthsfi 14798a16d273Sths 14808a16d273Sths########################################## 1481c2de5c91Smalc# Sound support libraries probe 14828f28f3fbSths 1483c2de5c91Smalcaudio_drv_probe() 1484c2de5c91Smalc{ 1485c2de5c91Smalc drv=$1 1486c2de5c91Smalc hdr=$2 1487c2de5c91Smalc lib=$3 1488c2de5c91Smalc exp=$4 1489c2de5c91Smalc cfl=$5 14908f28f3fbSths cat > $TMPC << EOF 1491c2de5c91Smalc#include <$hdr> 1492c2de5c91Smalcint main(void) { $exp } 14938f28f3fbSthsEOF 149452166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 14958f28f3fbSths : 14968f28f3fbSths else 14978f28f3fbSths echo 1498c2de5c91Smalc echo "Error: $drv check failed" 1499c2de5c91Smalc echo "Make sure to have the $drv libs and headers installed." 15008f28f3fbSths echo 15018f28f3fbSths exit 1 15028f28f3fbSths fi 1503c2de5c91Smalc} 1504c2de5c91Smalc 15052fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 1506c2de5c91Smalcfor drv in $audio_drv_list; do 1507c2de5c91Smalc case $drv in 1508c2de5c91Smalc alsa) 1509c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 1510c2de5c91Smalc "snd_pcm_t **handle; return snd_pcm_close(*handle);" 1511a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 1512c2de5c91Smalc ;; 1513c2de5c91Smalc 1514c2de5c91Smalc fmod) 1515c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 1516c2de5c91Smalc echo 1517c2de5c91Smalc echo "Error: You must specify path to FMOD library and headers" 1518c2de5c91Smalc echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 1519c2de5c91Smalc echo 1520c2de5c91Smalc exit 1 15218f28f3fbSths fi 1522c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 1523a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 1524c2de5c91Smalc ;; 1525c2de5c91Smalc 1526c2de5c91Smalc esd) 1527c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 1528a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 152967f86e8eSJuan Quintela audio_pt_int="yes" 1530c2de5c91Smalc ;; 1531b8e59f18Smalc 1532b8e59f18Smalc pa) 1533493abda6SAurelien Jarno audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \ 1534b8e59f18Smalc "pa_simple *s = NULL; pa_simple_free(s); return 0;" 1535493abda6SAurelien Jarno libs_softmmu="-lpulse -lpulse-simple $libs_softmmu" 153667f86e8eSJuan Quintela audio_pt_int="yes" 1537b8e59f18Smalc ;; 1538b8e59f18Smalc 1539997e690aSJuan Quintela coreaudio) 1540997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 1541997e690aSJuan Quintela ;; 1542997e690aSJuan Quintela 1543a4bf6780SJuan Quintela dsound) 1544a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 1545d5631638Smalc audio_win_int="yes" 1546a4bf6780SJuan Quintela ;; 1547a4bf6780SJuan Quintela 1548a4bf6780SJuan Quintela oss) 1549a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 1550a4bf6780SJuan Quintela ;; 1551a4bf6780SJuan Quintela 1552a4bf6780SJuan Quintela sdl|wav) 15532f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 15542f6a1ab0Sblueswir1 ;; 15552f6a1ab0Sblueswir1 1556d5631638Smalc winwave) 1557d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 1558d5631638Smalc audio_win_int="yes" 1559d5631638Smalc ;; 1560d5631638Smalc 1561e4c63a6aSmalc *) 15621c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 1563e4c63a6aSmalc echo 1564e4c63a6aSmalc echo "Error: Unknown driver '$drv' selected" 1565e4c63a6aSmalc echo "Possible drivers are: $audio_possible_drivers" 1566e4c63a6aSmalc echo 1567e4c63a6aSmalc exit 1 1568e4c63a6aSmalc } 1569e4c63a6aSmalc ;; 1570c2de5c91Smalc esac 1571c2de5c91Smalcdone 15728f28f3fbSths 15734d3b6f6eSbalrog########################################## 15742e4d9fb1Saurel32# BrlAPI probe 15752e4d9fb1Saurel32 15764ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 1577eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 15782e4d9fb1Saurel32 cat > $TMPC << EOF 15792e4d9fb1Saurel32#include <brlapi.h> 1580832ce9c2SScott Wood#include <stddef.h> 15812e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 15822e4d9fb1Saurel32EOF 158352166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 15842e4d9fb1Saurel32 brlapi=yes 1585264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 15864ffcedb6SJuan Quintela else 15874ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 15884ffcedb6SJuan Quintela feature_not_found "brlapi" 15894ffcedb6SJuan Quintela fi 15904ffcedb6SJuan Quintela brlapi=no 1591eb82284fSJuan Quintela fi 1592eb82284fSJuan Quintelafi 15932e4d9fb1Saurel32 15942e4d9fb1Saurel32########################################## 15954d3b6f6eSbalrog# curses probe 1596e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then 1597e095e2f3SStefan Weil curses_list="-lpdcurses" 1598e095e2f3SStefan Weilelse 15994f78ef9aSJuan Quintela curses_list="-lncurses -lcurses" 1600e095e2f3SStefan Weilfi 16014d3b6f6eSbalrog 1602c584a6d0SJuan Quintelaif test "$curses" != "no" ; then 1603c584a6d0SJuan Quintela curses_found=no 16044d3b6f6eSbalrog cat > $TMPC << EOF 16054d3b6f6eSbalrog#include <curses.h> 16065a8ff3aaSblueswir1#ifdef __OpenBSD__ 16075a8ff3aaSblueswir1#define resize_term resizeterm 16085a8ff3aaSblueswir1#endif 16095a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); } 16104d3b6f6eSbalrogEOF 16114f78ef9aSJuan Quintela for curses_lib in $curses_list; do 16124f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 1613c584a6d0SJuan Quintela curses_found=yes 16144f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 16154f78ef9aSJuan Quintela break 16164d3b6f6eSbalrog fi 16174f78ef9aSJuan Quintela done 1618c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 1619c584a6d0SJuan Quintela curses=yes 1620c584a6d0SJuan Quintela else 1621c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 1622c584a6d0SJuan Quintela feature_not_found "curses" 1623c584a6d0SJuan Quintela fi 1624c584a6d0SJuan Quintela curses=no 1625c584a6d0SJuan Quintela fi 16264f78ef9aSJuan Quintelafi 16274d3b6f6eSbalrog 1628414f0dabSblueswir1########################################## 1629769ce76dSAlexander Graf# curl probe 1630769ce76dSAlexander Graf 1631a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then 1632a8bd70adSPaolo Bonzini curlconfig="$pkg_config libcurl" 16334e2b0658SPaolo Bonzinielse 16344e2b0658SPaolo Bonzini curlconfig=curl-config 16354e2b0658SPaolo Bonzinifi 16364e2b0658SPaolo Bonzini 1637788c8196SJuan Quintelaif test "$curl" != "no" ; then 1638769ce76dSAlexander Graf cat > $TMPC << EOF 1639769ce76dSAlexander Graf#include <curl/curl.h> 1640769ce76dSAlexander Grafint main(void) { return curl_easy_init(); } 1641769ce76dSAlexander GrafEOF 16424e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 16434e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 1644b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 1645769ce76dSAlexander Graf curl=yes 1646f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 1647f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 1648788c8196SJuan Quintela else 1649788c8196SJuan Quintela if test "$curl" = "yes" ; then 1650788c8196SJuan Quintela feature_not_found "curl" 1651788c8196SJuan Quintela fi 1652788c8196SJuan Quintela curl=no 1653769ce76dSAlexander Graf fi 1654769ce76dSAlexander Graffi # test "$curl" 1655769ce76dSAlexander Graf 1656769ce76dSAlexander Graf########################################## 16575495ed11SLuiz Capitulino# check framework probe 16585495ed11SLuiz Capitulino 16595495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then 16605495ed11SLuiz Capitulino cat > $TMPC << EOF 16615495ed11SLuiz Capitulino#include <check.h> 16625495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; } 16635495ed11SLuiz CapitulinoEOF 1664a8bd70adSPaolo Bonzini check_libs=`$pkg_config --libs check` 16655495ed11SLuiz Capitulino if compile_prog "" $check_libs ; then 16665495ed11SLuiz Capitulino check_utests=yes 16675495ed11SLuiz Capitulino libs_tools="$check_libs $libs_tools" 16685495ed11SLuiz Capitulino else 16695495ed11SLuiz Capitulino if test "$check_utests" = "yes" ; then 16705495ed11SLuiz Capitulino feature_not_found "check" 16715495ed11SLuiz Capitulino fi 16725495ed11SLuiz Capitulino check_utests=no 16735495ed11SLuiz Capitulino fi 16745495ed11SLuiz Capitulinofi # test "$check_utests" 16755495ed11SLuiz Capitulino 16765495ed11SLuiz Capitulino########################################## 1677fb599c9aSbalrog# bluez support probe 1678a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 1679e820e3f4Sbalrog cat > $TMPC << EOF 1680e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 1681e820e3f4Sbalrogint main(void) { return bt_error(0); } 1682e820e3f4SbalrogEOF 1683a8bd70adSPaolo Bonzini bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` 1684a8bd70adSPaolo Bonzini bluez_libs=`$pkg_config --libs bluez 2> /dev/null` 168552166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 1686a20a6f46SJuan Quintela bluez=yes 1687e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 1688e820e3f4Sbalrog else 1689a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 1690a20a6f46SJuan Quintela feature_not_found "bluez" 1691a20a6f46SJuan Quintela fi 1692e820e3f4Sbalrog bluez="no" 1693e820e3f4Sbalrog fi 1694fb599c9aSbalrogfi 1695fb599c9aSbalrog 1696fb599c9aSbalrog########################################## 16977ba1e619Saliguori# kvm probe 1698b31a0277SJuan Quintelaif test "$kvm" != "no" ; then 16997ba1e619Saliguori cat > $TMPC <<EOF 17007ba1e619Saliguori#include <linux/kvm.h> 17019fd8d8d7Saliguori#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12 17027ba1e619Saliguori#error Invalid KVM version 17037ba1e619Saliguori#endif 170494a8d39aSJan KiszkaEOF 170594a8d39aSJan Kiszka must_have_caps="KVM_CAP_USER_MEMORY \ 170694a8d39aSJan Kiszka KVM_CAP_DESTROY_MEMORY_REGION_WORKS \ 170794a8d39aSJan Kiszka KVM_CAP_COALESCED_MMIO \ 170894a8d39aSJan Kiszka KVM_CAP_SYNC_MMU \ 170994a8d39aSJan Kiszka " 171094a8d39aSJan Kiszka if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) ; then 171194a8d39aSJan Kiszka must_have_caps="$caps \ 171294a8d39aSJan Kiszka KVM_CAP_SET_TSS_ADDR \ 171394a8d39aSJan Kiszka KVM_CAP_EXT_CPUID \ 171494a8d39aSJan Kiszka KVM_CAP_CLOCKSOURCE \ 171594a8d39aSJan Kiszka KVM_CAP_NOP_IO_DELAY \ 171694a8d39aSJan Kiszka KVM_CAP_PV_MMU \ 171794a8d39aSJan Kiszka KVM_CAP_MP_STATE \ 171894a8d39aSJan Kiszka KVM_CAP_USER_NMI \ 171994a8d39aSJan Kiszka " 172094a8d39aSJan Kiszka fi 172194a8d39aSJan Kiszka for c in $must_have_caps ; do 172294a8d39aSJan Kiszka cat >> $TMPC <<EOF 172394a8d39aSJan Kiszka#if !defined($c) 172494a8d39aSJan Kiszka#error Missing KVM capability $c 17259fd8d8d7Saliguori#endif 172694a8d39aSJan KiszkaEOF 172794a8d39aSJan Kiszka done 172894a8d39aSJan Kiszka cat >> $TMPC <<EOF 17297ba1e619Saliguoriint main(void) { return 0; } 17307ba1e619SaliguoriEOF 1731eac30262Saliguori if test "$kerneldir" != "" ; then 1732eac30262Saliguori kvm_cflags=-I"$kerneldir"/include 17338444eb6eSaliguori if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \ 17348444eb6eSaliguori -a -d "$kerneldir/arch/x86/include" ; then 17358444eb6eSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include" 1736406b430dSaliguori elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then 1737406b430dSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include" 17380e60a699SAlexander Graf elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then 17390e60a699SAlexander Graf kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include" 17408444eb6eSaliguori elif test -d "$kerneldir/arch/$cpu/include" ; then 17418444eb6eSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include" 17428444eb6eSaliguori fi 1743eac30262Saliguori else 1744a8bd70adSPaolo Bonzini kvm_cflags=`$pkg_config --cflags kvm-kmod 2>/dev/null` 1745eac30262Saliguori fi 174652166aa0SJuan Quintela if compile_prog "$kvm_cflags" "" ; then 1747b31a0277SJuan Quintela kvm=yes 1748dae5079aSJan Kiszka cat > $TMPC <<EOF 1749dae5079aSJan Kiszka#include <linux/kvm_para.h> 1750dae5079aSJan Kiszkaint main(void) { return 0; } 1751dae5079aSJan KiszkaEOF 1752dae5079aSJan Kiszka if compile_prog "$kvm_cflags" "" ; then 1753dae5079aSJan Kiszka kvm_para=yes 1754dae5079aSJan Kiszka fi 17557ba1e619Saliguori else 1756b31a0277SJuan Quintela if test "$kvm" = "yes" ; then 17570dba6195SLoïc Minier if has awk && has grep; then 1758a558ee17SJuan Quintela kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \ 17599fd8d8d7Saliguori | grep "error: " \ 17609fd8d8d7Saliguori | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` 17619fd8d8d7Saliguori if test "$kvmerr" != "" ; then 1762b31a0277SJuan Quintela echo -e "${kvmerr}\n\ 1763168ccc11SJan KiszkaNOTE: To enable KVM support, update your kernel to 2.6.29+ or install \ 1764168ccc11SJan Kiszkarecent kvm-kmod from http://sourceforge.net/projects/kvm." 17659fd8d8d7Saliguori fi 17669fd8d8d7Saliguori fi 1767b31a0277SJuan Quintela feature_not_found "kvm" 1768b31a0277SJuan Quintela fi 1769b31a0277SJuan Quintela kvm=no 17707ba1e619Saliguori fi 17717ba1e619Saliguorifi 17727ba1e619Saliguori 17737ba1e619Saliguori########################################## 1774d5970055SMichael S. Tsirkin# test for vhost net 1775d5970055SMichael S. Tsirkin 1776d5970055SMichael S. Tsirkinif test "$vhost_net" != "no"; then 1777d5970055SMichael S. Tsirkin if test "$kvm" != "no"; then 1778d5970055SMichael S. Tsirkin cat > $TMPC <<EOF 1779d5970055SMichael S. Tsirkin #include <linux/vhost.h> 1780d5970055SMichael S. Tsirkin int main(void) { return 0; } 1781d5970055SMichael S. TsirkinEOF 1782d5970055SMichael S. Tsirkin if compile_prog "$kvm_cflags" "" ; then 1783d5970055SMichael S. Tsirkin vhost_net=yes 1784d5970055SMichael S. Tsirkin else 1785d5970055SMichael S. Tsirkin if test "$vhost_net" = "yes" ; then 1786d5970055SMichael S. Tsirkin feature_not_found "vhost-net" 1787d5970055SMichael S. Tsirkin fi 1788d5970055SMichael S. Tsirkin vhost_net=no 1789d5970055SMichael S. Tsirkin fi 1790d5970055SMichael S. Tsirkin else 1791d5970055SMichael S. Tsirkin if test "$vhost_net" = "yes" ; then 17924021d247SAurelien Jarno echo "NOTE: vhost-net feature requires KVM (--enable-kvm)." 1793d5970055SMichael S. Tsirkin feature_not_found "vhost-net" 1794d5970055SMichael S. Tsirkin fi 1795d5970055SMichael S. Tsirkin vhost_net=no 1796d5970055SMichael S. Tsirkin fi 1797d5970055SMichael S. Tsirkinfi 1798d5970055SMichael S. Tsirkin 1799d5970055SMichael S. Tsirkin########################################## 1800e5d355d1Saliguori# pthread probe 1801de65fe0fSSebastian HerbsztPTHREADLIBS_LIST="-lpthread -lpthreadGC2" 18023c529d93Saliguori 1803e5d355d1Saliguoripthread=no 1804414f0dabSblueswir1cat > $TMPC << EOF 18053c529d93Saliguori#include <pthread.h> 1806de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; } 1807414f0dabSblueswir1EOF 1808bd00d539SAndreas Färberif compile_prog "" "" ; then 1809bd00d539SAndreas Färber pthread=yes 1810bd00d539SAndreas Färberelse 1811de65fe0fSSebastian Herbszt for pthread_lib in $PTHREADLIBS_LIST; do 181252166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 1813e5d355d1Saliguori pthread=yes 18145572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 1815de65fe0fSSebastian Herbszt break 1816414f0dabSblueswir1 fi 1817de65fe0fSSebastian Herbszt done 1818bd00d539SAndreas Färberfi 1819414f0dabSblueswir1 18204617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 18214dd75c70SChristoph Hellwig echo 18224dd75c70SChristoph Hellwig echo "Error: pthread check failed" 18234dd75c70SChristoph Hellwig echo "Make sure to have the pthread libs and headers installed." 18244dd75c70SChristoph Hellwig echo 18254dd75c70SChristoph Hellwig exit 1 1826e5d355d1Saliguorifi 1827e5d355d1Saliguori 1828bf9298b9Saliguori########################################## 1829f27aaf4bSChristian Brunner# rbd probe 1830f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then 1831f27aaf4bSChristian Brunner cat > $TMPC <<EOF 1832f27aaf4bSChristian Brunner#include <stdio.h> 1833f27aaf4bSChristian Brunner#include <rados/librados.h> 1834f27aaf4bSChristian Brunnerint main(void) { rados_initialize(0, NULL); return 0; } 1835f27aaf4bSChristian BrunnerEOF 1836cc4e8741SAurelien Jarno rbd_libs="-lrados" 1837f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 1838f27aaf4bSChristian Brunner librados_too_old=no 1839f27aaf4bSChristian Brunner cat > $TMPC <<EOF 1840f27aaf4bSChristian Brunner#include <stdio.h> 1841f27aaf4bSChristian Brunner#include <rados/librados.h> 1842f27aaf4bSChristian Brunner#ifndef CEPH_OSD_TMAP_SET 1843f27aaf4bSChristian Brunner#error missing CEPH_OSD_TMAP_SET 1844f27aaf4bSChristian Brunner#endif 1845f27aaf4bSChristian Brunnerint main(void) { 1846f27aaf4bSChristian Brunner int (*func)(const rados_pool_t pool, uint64_t *snapid) = rados_selfmanaged_snap_create; 1847f27aaf4bSChristian Brunner rados_initialize(0, NULL); 1848f27aaf4bSChristian Brunner return 0; 1849f27aaf4bSChristian Brunner} 1850f27aaf4bSChristian BrunnerEOF 1851f27aaf4bSChristian Brunner if compile_prog "" "$rbd_libs" ; then 1852f27aaf4bSChristian Brunner rbd=yes 1853f27aaf4bSChristian Brunner libs_tools="$rbd_libs $libs_tools" 1854f27aaf4bSChristian Brunner libs_softmmu="$rbd_libs $libs_softmmu" 1855f27aaf4bSChristian Brunner else 1856f27aaf4bSChristian Brunner rbd=no 1857f27aaf4bSChristian Brunner librados_too_old=yes 1858f27aaf4bSChristian Brunner fi 1859f27aaf4bSChristian Brunner else 1860f27aaf4bSChristian Brunner if test "$rbd" = "yes" ; then 1861f27aaf4bSChristian Brunner feature_not_found "rados block device" 1862f27aaf4bSChristian Brunner fi 1863f27aaf4bSChristian Brunner rbd=no 1864f27aaf4bSChristian Brunner fi 1865f27aaf4bSChristian Brunner if test "$librados_too_old" = "yes" ; then 1866f27aaf4bSChristian Brunner echo "-> Your librados version is too old - upgrade needed to have rbd support" 1867f27aaf4bSChristian Brunner fi 1868f27aaf4bSChristian Brunnerfi 1869f27aaf4bSChristian Brunner 1870f27aaf4bSChristian Brunner########################################## 18715c6c3a6cSChristoph Hellwig# linux-aio probe 18725c6c3a6cSChristoph Hellwig 18735c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 18745c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 18755c6c3a6cSChristoph Hellwig#include <libaio.h> 18765c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 1877832ce9c2SScott Wood#include <stddef.h> 18785c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 18795c6c3a6cSChristoph HellwigEOF 18805c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 18815c6c3a6cSChristoph Hellwig linux_aio=yes 1882048d179fSPaul Brook libs_softmmu="$libs_softmmu -laio" 1883048d179fSPaul Brook libs_tools="$libs_tools -laio" 18845c6c3a6cSChristoph Hellwig else 18855c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 18865c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 18875c6c3a6cSChristoph Hellwig fi 18883cfcae3cSLuiz Capitulino linux_aio=no 18895c6c3a6cSChristoph Hellwig fi 18905c6c3a6cSChristoph Hellwigfi 18915c6c3a6cSChristoph Hellwig 18925c6c3a6cSChristoph Hellwig########################################## 1893758e8e38SVenkateswararao Jujjuri (JV)# attr probe 1894758e8e38SVenkateswararao Jujjuri (JV) 1895758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then 1896758e8e38SVenkateswararao Jujjuri (JV) cat > $TMPC <<EOF 1897758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h> 1898758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h> 1899758e8e38SVenkateswararao Jujjuri (JV)#include <attr/xattr.h> 1900758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; } 1901758e8e38SVenkateswararao Jujjuri (JV)EOF 1902758e8e38SVenkateswararao Jujjuri (JV) if compile_prog "" "-lattr" ; then 1903758e8e38SVenkateswararao Jujjuri (JV) attr=yes 1904758e8e38SVenkateswararao Jujjuri (JV) LIBS="-lattr $LIBS" 1905758e8e38SVenkateswararao Jujjuri (JV) else 1906758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 1907758e8e38SVenkateswararao Jujjuri (JV) feature_not_found "ATTR" 1908758e8e38SVenkateswararao Jujjuri (JV) fi 1909758e8e38SVenkateswararao Jujjuri (JV) attr=no 1910758e8e38SVenkateswararao Jujjuri (JV) fi 1911758e8e38SVenkateswararao Jujjuri (JV)fi 1912758e8e38SVenkateswararao Jujjuri (JV) 1913758e8e38SVenkateswararao Jujjuri (JV)########################################## 1914bf9298b9Saliguori# iovec probe 1915bf9298b9Saliguoricat > $TMPC <<EOF 1916db34f0b3Sblueswir1#include <sys/types.h> 1917bf9298b9Saliguori#include <sys/uio.h> 1918db34f0b3Sblueswir1#include <unistd.h> 1919bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; } 1920bf9298b9SaliguoriEOF 1921bf9298b9Saliguoriiovec=no 192252166aa0SJuan Quintelaif compile_prog "" "" ; then 1923bf9298b9Saliguori iovec=yes 1924bf9298b9Saliguorifi 1925bf9298b9Saliguori 1926f652e6afSaurel32########################################## 1927ceb42de8Saliguori# preadv probe 1928ceb42de8Saliguoricat > $TMPC <<EOF 1929ceb42de8Saliguori#include <sys/types.h> 1930ceb42de8Saliguori#include <sys/uio.h> 1931ceb42de8Saliguori#include <unistd.h> 1932ceb42de8Saliguoriint main(void) { preadv; } 1933ceb42de8SaliguoriEOF 1934ceb42de8Saliguoripreadv=no 193552166aa0SJuan Quintelaif compile_prog "" "" ; then 1936ceb42de8Saliguori preadv=yes 1937ceb42de8Saliguorifi 1938ceb42de8Saliguori 1939ceb42de8Saliguori########################################## 1940f652e6afSaurel32# fdt probe 19412df87df7SJuan Quintelaif test "$fdt" != "no" ; then 1942b41af4baSJuan Quintela fdt_libs="-lfdt" 1943f652e6afSaurel32 cat > $TMPC << EOF 1944f652e6afSaurel32int main(void) { return 0; } 1945f652e6afSaurel32EOF 194652166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 1947f652e6afSaurel32 fdt=yes 1948e4782985SJuan Quintela libs_softmmu="$fdt_libs $libs_softmmu" 19492df87df7SJuan Quintela else 19502df87df7SJuan Quintela if test "$fdt" = "yes" ; then 19512df87df7SJuan Quintela feature_not_found "fdt" 19522df87df7SJuan Quintela fi 19532df87df7SJuan Quintela fdt=no 1954f652e6afSaurel32 fi 1955f652e6afSaurel32fi 1956f652e6afSaurel32 195720ff075bSMichael Walle########################################## 195820ff075bSMichael Walle# opengl probe, used by milkymist-tmu2 195920ff075bSMichael Walleif test "$opengl" != "no" ; then 196020ff075bSMichael Walle opengl_libs="-lGL" 196120ff075bSMichael Walle cat > $TMPC << EOF 196220ff075bSMichael Walle#include <X11/Xlib.h> 196320ff075bSMichael Walle#include <GL/gl.h> 196420ff075bSMichael Walle#include <GL/glx.h> 196520ff075bSMichael Walleint main(void) { GL_VERSION; return 0; } 196620ff075bSMichael WalleEOF 196720ff075bSMichael Walle if compile_prog "" "-lGL" ; then 196820ff075bSMichael Walle opengl=yes 196920ff075bSMichael Walle libs_softmmu="$opengl_libs $libs_softmmu" 197020ff075bSMichael Walle else 197120ff075bSMichael Walle if test "$opengl" = "yes" ; then 197220ff075bSMichael Walle feature_not_found "opengl" 197320ff075bSMichael Walle fi 197420ff075bSMichael Walle opengl=no 197520ff075bSMichael Walle fi 197620ff075bSMichael Wallefi 197720ff075bSMichael Walle 19783b3f24adSaurel32# 19793b3f24adSaurel32# Check for xxxat() functions when we are building linux-user 19803b3f24adSaurel32# emulator. This is done because older glibc versions don't 19813b3f24adSaurel32# have syscall stubs for these implemented. 19823b3f24adSaurel32# 19833b3f24adSaurel32atfile=no 19843b3f24adSaurel32cat > $TMPC << EOF 19853b3f24adSaurel32#define _ATFILE_SOURCE 19863b3f24adSaurel32#include <sys/types.h> 19873b3f24adSaurel32#include <fcntl.h> 19883b3f24adSaurel32#include <unistd.h> 19893b3f24adSaurel32 19903b3f24adSaurel32int 19913b3f24adSaurel32main(void) 19923b3f24adSaurel32{ 19933b3f24adSaurel32 /* try to unlink nonexisting file */ 19943b3f24adSaurel32 return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); 19953b3f24adSaurel32} 19963b3f24adSaurel32EOF 199752166aa0SJuan Quintelaif compile_prog "" "" ; then 19983b3f24adSaurel32 atfile=yes 19993b3f24adSaurel32fi 20003b3f24adSaurel32 200139386ac7Saurel32# Check for inotify functions when we are building linux-user 20023b3f24adSaurel32# emulator. This is done because older glibc versions don't 20033b3f24adSaurel32# have syscall stubs for these implemented. In that case we 20043b3f24adSaurel32# don't provide them even if kernel supports them. 20053b3f24adSaurel32# 20063b3f24adSaurel32inotify=no 20073b3f24adSaurel32cat > $TMPC << EOF 20083b3f24adSaurel32#include <sys/inotify.h> 20093b3f24adSaurel32 20103b3f24adSaurel32int 20113b3f24adSaurel32main(void) 20123b3f24adSaurel32{ 20133b3f24adSaurel32 /* try to start inotify */ 20148690e420Saurel32 return inotify_init(); 20153b3f24adSaurel32} 20163b3f24adSaurel32EOF 201752166aa0SJuan Quintelaif compile_prog "" "" ; then 20183b3f24adSaurel32 inotify=yes 20193b3f24adSaurel32fi 20203b3f24adSaurel32 2021c05c7a73SRiku Voipioinotify1=no 2022c05c7a73SRiku Voipiocat > $TMPC << EOF 2023c05c7a73SRiku Voipio#include <sys/inotify.h> 2024c05c7a73SRiku Voipio 2025c05c7a73SRiku Voipioint 2026c05c7a73SRiku Voipiomain(void) 2027c05c7a73SRiku Voipio{ 2028c05c7a73SRiku Voipio /* try to start inotify */ 2029c05c7a73SRiku Voipio return inotify_init1(0); 2030c05c7a73SRiku Voipio} 2031c05c7a73SRiku VoipioEOF 2032c05c7a73SRiku Voipioif compile_prog "" "" ; then 2033c05c7a73SRiku Voipio inotify1=yes 2034c05c7a73SRiku Voipiofi 2035c05c7a73SRiku Voipio 2036ebc996f3SRiku Voipio# check if utimensat and futimens are supported 2037ebc996f3SRiku Voipioutimens=no 2038ebc996f3SRiku Voipiocat > $TMPC << EOF 2039ebc996f3SRiku Voipio#define _ATFILE_SOURCE 2040ebc996f3SRiku Voipio#include <stddef.h> 2041ebc996f3SRiku Voipio#include <fcntl.h> 2042ebc996f3SRiku Voipio 2043ebc996f3SRiku Voipioint main(void) 2044ebc996f3SRiku Voipio{ 2045ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 2046ebc996f3SRiku Voipio futimens(0, NULL); 2047ebc996f3SRiku Voipio return 0; 2048ebc996f3SRiku Voipio} 2049ebc996f3SRiku VoipioEOF 205052166aa0SJuan Quintelaif compile_prog "" "" ; then 2051ebc996f3SRiku Voipio utimens=yes 2052ebc996f3SRiku Voipiofi 2053ebc996f3SRiku Voipio 2054099d6b0fSRiku Voipio# check if pipe2 is there 2055099d6b0fSRiku Voipiopipe2=no 2056099d6b0fSRiku Voipiocat > $TMPC << EOF 2057099d6b0fSRiku Voipio#include <unistd.h> 2058099d6b0fSRiku Voipio#include <fcntl.h> 2059099d6b0fSRiku Voipio 2060099d6b0fSRiku Voipioint main(void) 2061099d6b0fSRiku Voipio{ 2062099d6b0fSRiku Voipio int pipefd[2]; 2063099d6b0fSRiku Voipio pipe2(pipefd, O_CLOEXEC); 2064099d6b0fSRiku Voipio return 0; 2065099d6b0fSRiku Voipio} 2066099d6b0fSRiku VoipioEOF 206752166aa0SJuan Quintelaif compile_prog "" "" ; then 2068099d6b0fSRiku Voipio pipe2=yes 2069099d6b0fSRiku Voipiofi 2070099d6b0fSRiku Voipio 207140ff6d7eSKevin Wolf# check if accept4 is there 207240ff6d7eSKevin Wolfaccept4=no 207340ff6d7eSKevin Wolfcat > $TMPC << EOF 207440ff6d7eSKevin Wolf#include <sys/socket.h> 207540ff6d7eSKevin Wolf#include <stddef.h> 207640ff6d7eSKevin Wolf 207740ff6d7eSKevin Wolfint main(void) 207840ff6d7eSKevin Wolf{ 207940ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 208040ff6d7eSKevin Wolf return 0; 208140ff6d7eSKevin Wolf} 208240ff6d7eSKevin WolfEOF 208340ff6d7eSKevin Wolfif compile_prog "" "" ; then 208440ff6d7eSKevin Wolf accept4=yes 208540ff6d7eSKevin Wolffi 208640ff6d7eSKevin Wolf 20873ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 20883ce34dfbSvibisreenivasansplice=no 20893ce34dfbSvibisreenivasancat > $TMPC << EOF 20903ce34dfbSvibisreenivasan#include <unistd.h> 20913ce34dfbSvibisreenivasan#include <fcntl.h> 20923ce34dfbSvibisreenivasan#include <limits.h> 20933ce34dfbSvibisreenivasan 20943ce34dfbSvibisreenivasanint main(void) 20953ce34dfbSvibisreenivasan{ 20963ce34dfbSvibisreenivasan int len, fd; 20973ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 20983ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 20993ce34dfbSvibisreenivasan return 0; 21003ce34dfbSvibisreenivasan} 21013ce34dfbSvibisreenivasanEOF 210252166aa0SJuan Quintelaif compile_prog "" "" ; then 21033ce34dfbSvibisreenivasan splice=yes 21043ce34dfbSvibisreenivasanfi 21053ce34dfbSvibisreenivasan 2106dcc38d1cSMarcelo Tosatti########################################## 2107dcc38d1cSMarcelo Tosatti# signalfd probe 2108dcc38d1cSMarcelo Tosattisignalfd="no" 2109dcc38d1cSMarcelo Tosatticat > $TMPC << EOF 2110dcc38d1cSMarcelo Tosatti#define _GNU_SOURCE 2111dcc38d1cSMarcelo Tosatti#include <unistd.h> 2112dcc38d1cSMarcelo Tosatti#include <sys/syscall.h> 2113dcc38d1cSMarcelo Tosatti#include <signal.h> 2114dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } 2115dcc38d1cSMarcelo TosattiEOF 2116dcc38d1cSMarcelo Tosatti 2117dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then 2118dcc38d1cSMarcelo Tosatti signalfd=yes 2119de758970SJan Kiszkaelif test "$kvm" = "yes" -a "$io_thread" != "yes"; then 2120de758970SJan Kiszka echo 2121de758970SJan Kiszka echo "ERROR: Host kernel lacks signalfd() support," 2122de758970SJan Kiszka echo "but KVM depends on it when the IO thread is disabled." 2123de758970SJan Kiszka echo 2124de758970SJan Kiszka exit 1 2125dcc38d1cSMarcelo Tosattifi 2126dcc38d1cSMarcelo Tosatti 2127c2882b96SRiku Voipio# check if eventfd is supported 2128c2882b96SRiku Voipioeventfd=no 2129c2882b96SRiku Voipiocat > $TMPC << EOF 2130c2882b96SRiku Voipio#include <sys/eventfd.h> 2131c2882b96SRiku Voipio 2132c2882b96SRiku Voipioint main(void) 2133c2882b96SRiku Voipio{ 2134c2882b96SRiku Voipio int efd = eventfd(0, 0); 2135c2882b96SRiku Voipio return 0; 2136c2882b96SRiku Voipio} 2137c2882b96SRiku VoipioEOF 2138c2882b96SRiku Voipioif compile_prog "" "" ; then 2139c2882b96SRiku Voipio eventfd=yes 2140c2882b96SRiku Voipiofi 2141c2882b96SRiku Voipio 2142d0927938SUlrich Hecht# check for fallocate 2143d0927938SUlrich Hechtfallocate=no 2144d0927938SUlrich Hechtcat > $TMPC << EOF 2145d0927938SUlrich Hecht#include <fcntl.h> 2146d0927938SUlrich Hecht 2147d0927938SUlrich Hechtint main(void) 2148d0927938SUlrich Hecht{ 2149d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 2150d0927938SUlrich Hecht return 0; 2151d0927938SUlrich Hecht} 2152d0927938SUlrich HechtEOF 2153be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then 2154d0927938SUlrich Hecht fallocate=yes 2155d0927938SUlrich Hechtfi 2156d0927938SUlrich Hecht 2157c727f47dSPeter Maydell# check for sync_file_range 2158c727f47dSPeter Maydellsync_file_range=no 2159c727f47dSPeter Maydellcat > $TMPC << EOF 2160c727f47dSPeter Maydell#include <fcntl.h> 2161c727f47dSPeter Maydell 2162c727f47dSPeter Maydellint main(void) 2163c727f47dSPeter Maydell{ 2164c727f47dSPeter Maydell sync_file_range(0, 0, 0, 0); 2165c727f47dSPeter Maydell return 0; 2166c727f47dSPeter Maydell} 2167c727f47dSPeter MaydellEOF 2168c727f47dSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2169c727f47dSPeter Maydell sync_file_range=yes 2170c727f47dSPeter Maydellfi 2171c727f47dSPeter Maydell 2172dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP 2173dace20dcSPeter Maydellfiemap=no 2174dace20dcSPeter Maydellcat > $TMPC << EOF 2175dace20dcSPeter Maydell#include <sys/ioctl.h> 2176dace20dcSPeter Maydell#include <linux/fs.h> 2177dace20dcSPeter Maydell#include <linux/fiemap.h> 2178dace20dcSPeter Maydell 2179dace20dcSPeter Maydellint main(void) 2180dace20dcSPeter Maydell{ 2181dace20dcSPeter Maydell ioctl(0, FS_IOC_FIEMAP, 0); 2182dace20dcSPeter Maydell return 0; 2183dace20dcSPeter Maydell} 2184dace20dcSPeter MaydellEOF 2185dace20dcSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 2186dace20dcSPeter Maydell fiemap=yes 2187dace20dcSPeter Maydellfi 2188dace20dcSPeter Maydell 2189d0927938SUlrich Hecht# check for dup3 2190d0927938SUlrich Hechtdup3=no 2191d0927938SUlrich Hechtcat > $TMPC << EOF 2192d0927938SUlrich Hecht#include <unistd.h> 2193d0927938SUlrich Hecht 2194d0927938SUlrich Hechtint main(void) 2195d0927938SUlrich Hecht{ 2196d0927938SUlrich Hecht dup3(0, 0, 0); 2197d0927938SUlrich Hecht return 0; 2198d0927938SUlrich Hecht} 2199d0927938SUlrich HechtEOF 220078f5d726SJan Kiszkaif compile_prog "" "" ; then 2201d0927938SUlrich Hecht dup3=yes 2202d0927938SUlrich Hechtfi 2203d0927938SUlrich Hecht 22043b6edd16SPeter Maydell# check for epoll support 22053b6edd16SPeter Maydellepoll=no 22063b6edd16SPeter Maydellcat > $TMPC << EOF 22073b6edd16SPeter Maydell#include <sys/epoll.h> 22083b6edd16SPeter Maydell 22093b6edd16SPeter Maydellint main(void) 22103b6edd16SPeter Maydell{ 22113b6edd16SPeter Maydell epoll_create(0); 22123b6edd16SPeter Maydell return 0; 22133b6edd16SPeter Maydell} 22143b6edd16SPeter MaydellEOF 22153b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 22163b6edd16SPeter Maydell epoll=yes 22173b6edd16SPeter Maydellfi 22183b6edd16SPeter Maydell 22193b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions 22203b6edd16SPeter Maydell# so we must check separately for their presence 22213b6edd16SPeter Maydellepoll_create1=no 22223b6edd16SPeter Maydellcat > $TMPC << EOF 22233b6edd16SPeter Maydell#include <sys/epoll.h> 22243b6edd16SPeter Maydell 22253b6edd16SPeter Maydellint main(void) 22263b6edd16SPeter Maydell{ 22273b6edd16SPeter Maydell epoll_create1(0); 22283b6edd16SPeter Maydell return 0; 22293b6edd16SPeter Maydell} 22303b6edd16SPeter MaydellEOF 22313b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 22323b6edd16SPeter Maydell epoll_create1=yes 22333b6edd16SPeter Maydellfi 22343b6edd16SPeter Maydell 22353b6edd16SPeter Maydellepoll_pwait=no 22363b6edd16SPeter Maydellcat > $TMPC << EOF 22373b6edd16SPeter Maydell#include <sys/epoll.h> 22383b6edd16SPeter Maydell 22393b6edd16SPeter Maydellint main(void) 22403b6edd16SPeter Maydell{ 22413b6edd16SPeter Maydell epoll_pwait(0, 0, 0, 0, 0); 22423b6edd16SPeter Maydell return 0; 22433b6edd16SPeter Maydell} 22443b6edd16SPeter MaydellEOF 22453b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then 22463b6edd16SPeter Maydell epoll_pwait=yes 22473b6edd16SPeter Maydellfi 22483b6edd16SPeter Maydell 2249cc8ae6deSpbrook# Check if tools are available to build documentation. 2250a25dba17SJuan Quintelaif test "$docs" != "no" ; then 225101668d98SStefan Weil if has makeinfo && has pod2man; then 2252a25dba17SJuan Quintela docs=yes 225383a3ab8bSJuan Quintela else 2254a25dba17SJuan Quintela if test "$docs" = "yes" ; then 2255a25dba17SJuan Quintela feature_not_found "docs" 225683a3ab8bSJuan Quintela fi 2257a25dba17SJuan Quintela docs=no 225883a3ab8bSJuan Quintela fi 2259cc8ae6deSpbrookfi 2260cc8ae6deSpbrook 2261f514f41cSStefan Weil# Search for bswap_32 function 22626ae9a1f4SJuan Quintelabyteswap_h=no 22636ae9a1f4SJuan Quintelacat > $TMPC << EOF 22646ae9a1f4SJuan Quintela#include <byteswap.h> 22656ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 22666ae9a1f4SJuan QuintelaEOF 226752166aa0SJuan Quintelaif compile_prog "" "" ; then 22686ae9a1f4SJuan Quintela byteswap_h=yes 22696ae9a1f4SJuan Quintelafi 22706ae9a1f4SJuan Quintela 2271f514f41cSStefan Weil# Search for bswap_32 function 22726ae9a1f4SJuan Quintelabswap_h=no 22736ae9a1f4SJuan Quintelacat > $TMPC << EOF 22746ae9a1f4SJuan Quintela#include <sys/endian.h> 22756ae9a1f4SJuan Quintela#include <sys/types.h> 22766ae9a1f4SJuan Quintela#include <machine/bswap.h> 22776ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 22786ae9a1f4SJuan QuintelaEOF 227952166aa0SJuan Quintelaif compile_prog "" "" ; then 22806ae9a1f4SJuan Quintela bswap_h=yes 22816ae9a1f4SJuan Quintelafi 22826ae9a1f4SJuan Quintela 2283da93a1fdSaliguori########################################## 2284da93a1fdSaliguori# Do we need librt 2285da93a1fdSaliguoricat > $TMPC <<EOF 2286da93a1fdSaliguori#include <signal.h> 2287da93a1fdSaliguori#include <time.h> 2288da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); } 2289da93a1fdSaliguoriEOF 2290da93a1fdSaliguori 229152166aa0SJuan Quintelaif compile_prog "" "" ; then 229207ffa4bdSJuan Quintela : 229352166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then 229407ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 2295da93a1fdSaliguorifi 2296da93a1fdSaliguori 229731ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 2298179cf400SAndreas Färber "$aix" != "yes" -a "$haiku" != "yes" ; then 22996362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 23006362a53fSJuan Quintelafi 23016362a53fSJuan Quintela 2302de5071c5SBlue Swirl########################################## 2303de5071c5SBlue Swirl# check if the compiler defines offsetof 2304de5071c5SBlue Swirl 2305de5071c5SBlue Swirlneed_offsetof=yes 2306de5071c5SBlue Swirlcat > $TMPC << EOF 2307de5071c5SBlue Swirl#include <stddef.h> 2308de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); } 2309de5071c5SBlue SwirlEOF 2310de5071c5SBlue Swirlif compile_prog "" "" ; then 2311de5071c5SBlue Swirl need_offsetof=no 2312de5071c5SBlue Swirlfi 2313de5071c5SBlue Swirl 23145f6b9e8fSBlue Swirl########################################## 2315747bbdf7SBlue Swirl# check if the compiler understands attribute warn_unused_result 2316747bbdf7SBlue Swirl# 2317747bbdf7SBlue Swirl# This could be smarter, but gcc -Werror does not error out even when warning 2318747bbdf7SBlue Swirl# about attribute warn_unused_result 2319747bbdf7SBlue Swirl 2320747bbdf7SBlue Swirlgcc_attribute_warn_unused_result=no 2321747bbdf7SBlue Swirlcat > $TMPC << EOF 2322747bbdf7SBlue Swirl#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4) 2323747bbdf7SBlue Swirl#error gcc 3.3 or older 2324747bbdf7SBlue Swirl#endif 2325747bbdf7SBlue Swirlint main(void) { return 0;} 2326747bbdf7SBlue SwirlEOF 2327747bbdf7SBlue Swirlif compile_prog "" ""; then 2328747bbdf7SBlue Swirl gcc_attribute_warn_unused_result=yes 2329747bbdf7SBlue Swirlfi 2330747bbdf7SBlue Swirl 2331cd4ec0b4SGerd Hoffmann# spice probe 2332cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then 2333cd4ec0b4SGerd Hoffmann cat > $TMPC << EOF 2334cd4ec0b4SGerd Hoffmann#include <spice.h> 2335cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; } 2336cd4ec0b4SGerd HoffmannEOF 2337710fc4f5SJiri Denemark spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) 2338710fc4f5SJiri Denemark spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) 2339710fc4f5SJiri Denemark if $pkg_config --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \ 2340cd4ec0b4SGerd Hoffmann compile_prog "$spice_cflags" "$spice_libs" ; then 2341cd4ec0b4SGerd Hoffmann spice="yes" 2342cd4ec0b4SGerd Hoffmann libs_softmmu="$libs_softmmu $spice_libs" 2343cd4ec0b4SGerd Hoffmann QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" 2344cd4ec0b4SGerd Hoffmann else 2345cd4ec0b4SGerd Hoffmann if test "$spice" = "yes" ; then 2346cd4ec0b4SGerd Hoffmann feature_not_found "spice" 2347cd4ec0b4SGerd Hoffmann fi 2348cd4ec0b4SGerd Hoffmann spice="no" 2349cd4ec0b4SGerd Hoffmann fi 2350cd4ec0b4SGerd Hoffmannfi 2351cd4ec0b4SGerd Hoffmann 2352111a38b0SRobert Relyea# check for libcacard for smartcard support 2353111a38b0SRobert Relyeaif test "$smartcard" != "no" ; then 2354111a38b0SRobert Relyea smartcard="yes" 2355111a38b0SRobert Relyea smartcard_cflags="" 2356111a38b0SRobert Relyea # TODO - what's the minimal nss version we support? 2357111a38b0SRobert Relyea if test "$smartcard_nss" != "no"; then 2358111a38b0SRobert Relyea if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 ; then 2359111a38b0SRobert Relyea smartcard_nss="yes" 2360111a38b0SRobert Relyea smartcard_cflags="-I\$(SRC_PATH)/libcacard" 2361111a38b0SRobert Relyea libcacard_libs=$($pkg_config --libs nss 2>/dev/null) 2362111a38b0SRobert Relyea libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null) 2363111a38b0SRobert Relyea QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags" 2364111a38b0SRobert Relyea LIBS="$libcacard_libs $LIBS" 2365111a38b0SRobert Relyea else 2366111a38b0SRobert Relyea if test "$smartcard_nss" = "yes"; then 2367111a38b0SRobert Relyea feature_not_found "nss" 2368111a38b0SRobert Relyea fi 2369111a38b0SRobert Relyea smartcard_nss="no" 2370111a38b0SRobert Relyea fi 2371111a38b0SRobert Relyea fi 2372111a38b0SRobert Relyeafi 2373111a38b0SRobert Relyeaif test "$smartcard" = "no" ; then 2374111a38b0SRobert Relyea smartcard_nss="no" 2375111a38b0SRobert Relyeafi 2376111a38b0SRobert Relyea 2377cd4ec0b4SGerd Hoffmann########################################## 2378cd4ec0b4SGerd Hoffmann 2379747bbdf7SBlue Swirl########################################## 23805f6b9e8fSBlue Swirl# check if we have fdatasync 23815f6b9e8fSBlue Swirl 23825f6b9e8fSBlue Swirlfdatasync=no 23835f6b9e8fSBlue Swirlcat > $TMPC << EOF 23845f6b9e8fSBlue Swirl#include <unistd.h> 23855f6b9e8fSBlue Swirlint main(void) { return fdatasync(0); } 23865f6b9e8fSBlue SwirlEOF 23875f6b9e8fSBlue Swirlif compile_prog "" "" ; then 23885f6b9e8fSBlue Swirl fdatasync=yes 23895f6b9e8fSBlue Swirlfi 23905f6b9e8fSBlue Swirl 239194a420b1SStefan Hajnoczi########################################## 2392e78815a5SAndreas Färber# check if we have madvise 2393e78815a5SAndreas Färber 2394e78815a5SAndreas Färbermadvise=no 2395e78815a5SAndreas Färbercat > $TMPC << EOF 2396e78815a5SAndreas Färber#include <sys/types.h> 2397e78815a5SAndreas Färber#include <sys/mman.h> 2398832ce9c2SScott Wood#include <stddef.h> 2399e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); } 2400e78815a5SAndreas FärberEOF 2401e78815a5SAndreas Färberif compile_prog "" "" ; then 2402e78815a5SAndreas Färber madvise=yes 2403e78815a5SAndreas Färberfi 2404e78815a5SAndreas Färber 2405e78815a5SAndreas Färber########################################## 2406e78815a5SAndreas Färber# check if we have posix_madvise 2407e78815a5SAndreas Färber 2408e78815a5SAndreas Färberposix_madvise=no 2409e78815a5SAndreas Färbercat > $TMPC << EOF 2410e78815a5SAndreas Färber#include <sys/mman.h> 2411832ce9c2SScott Wood#include <stddef.h> 2412e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); } 2413e78815a5SAndreas FärberEOF 2414e78815a5SAndreas Färberif compile_prog "" "" ; then 2415e78815a5SAndreas Färber posix_madvise=yes 2416e78815a5SAndreas Färberfi 2417e78815a5SAndreas Färber 2418e78815a5SAndreas Färber########################################## 241994a420b1SStefan Hajnoczi# check if trace backend exists 242094a420b1SStefan Hajnoczi 24214c3b5a48SBlue Swirlsh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null 242294a420b1SStefan Hajnocziif test "$?" -ne 0 ; then 242394a420b1SStefan Hajnoczi echo 242494a420b1SStefan Hajnoczi echo "Error: invalid trace backend" 242594a420b1SStefan Hajnoczi echo "Please choose a supported trace backend." 242694a420b1SStefan Hajnoczi echo 242794a420b1SStefan Hajnoczi exit 1 242894a420b1SStefan Hajnoczifi 242994a420b1SStefan Hajnoczi 24307e24e92aSStefan Hajnoczi########################################## 24317e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present 24327e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then 24337e24e92aSStefan Hajnoczi cat > $TMPC << EOF 24347e24e92aSStefan Hajnoczi#include <ust/tracepoint.h> 24357e24e92aSStefan Hajnoczi#include <ust/marker.h> 24367e24e92aSStefan Hajnocziint main(void) { return 0; } 24377e24e92aSStefan HajnocziEOF 24387e24e92aSStefan Hajnoczi if compile_prog "" "" ; then 24397e24e92aSStefan Hajnoczi LIBS="-lust $LIBS" 24407e24e92aSStefan Hajnoczi else 24417e24e92aSStefan Hajnoczi echo 24427e24e92aSStefan Hajnoczi echo "Error: Trace backend 'ust' missing libust header files" 24437e24e92aSStefan Hajnoczi echo 24447e24e92aSStefan Hajnoczi exit 1 24457e24e92aSStefan Hajnoczi fi 24467e24e92aSStefan Hajnoczifi 2447b3d08c02SDaniel P. Berrange 2448b3d08c02SDaniel P. Berrange########################################## 2449b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present 2450b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then 2451b3d08c02SDaniel P. Berrange if ! has 'dtrace' ; then 2452b3d08c02SDaniel P. Berrange echo 2453b3d08c02SDaniel P. Berrange echo "Error: dtrace command is not found in PATH $PATH" 2454b3d08c02SDaniel P. Berrange echo 2455b3d08c02SDaniel P. Berrange exit 1 2456b3d08c02SDaniel P. Berrange fi 2457c276b17dSDaniel P. Berrange trace_backend_stap="no" 2458c276b17dSDaniel P. Berrange if has 'stap' ; then 2459c276b17dSDaniel P. Berrange trace_backend_stap="yes" 2460c276b17dSDaniel P. Berrange fi 2461b3d08c02SDaniel P. Berrangefi 2462b3d08c02SDaniel P. Berrange 24637e24e92aSStefan Hajnoczi########################################## 2464e86ecd4bSJuan Quintela# End of CC checks 2465e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 2466e86ecd4bSJuan Quintela 2467e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then 24681156c669SJuan Quintela CFLAGS="-O2 $CFLAGS" 2469e86ecd4bSJuan Quintelafi 2470a316e378SJuan Quintela 2471e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror 2472e86ecd4bSJuan Quintela# by default. Only enable by default for git builds 2473e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION` 247420ff6c80SAnthony Liguori 247520ff6c80SAnthony Liguoriif test -z "$werror" ; then 2476e86ecd4bSJuan Quintela if test "$z_version" = "50" -a \ 2477e86ecd4bSJuan Quintela "$linux" = "yes" ; then 2478e86ecd4bSJuan Quintela werror="yes" 2479e86ecd4bSJuan Quintela else 2480e86ecd4bSJuan Quintela werror="no" 2481e86ecd4bSJuan Quintela fi 2482e86ecd4bSJuan Quintelafi 2483e86ecd4bSJuan Quintela 248420ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 248520ff6c80SAnthony Liguori# enable/disable 248620ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 248720ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 248820ff6c80SAnthony Liguori zero_malloc="no" 248920ff6c80SAnthony Liguori else 249020ff6c80SAnthony Liguori zero_malloc="yes" 249120ff6c80SAnthony Liguori fi 249220ff6c80SAnthony Liguorifi 249320ff6c80SAnthony Liguori 2494e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then 2495a558ee17SJuan Quintela QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 2496e86ecd4bSJuan Quintelafi 2497e86ecd4bSJuan Quintela 2498e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 2499e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 25001156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 2501e86ecd4bSJuan Quintela fi 2502e86ecd4bSJuan Quintelafi 2503e86ecd4bSJuan Quintela 2504952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available 2505952afb71SBlue Swirlif test "$mingw32" = "yes" ; then 2506952afb71SBlue Swirl for flag in --dynamicbase --no-seh --nxcompat; do 2507952afb71SBlue Swirl if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then 2508952afb71SBlue Swirl LDFLAGS="-Wl,$flag $LDFLAGS" 2509952afb71SBlue Swirl fi 2510952afb71SBlue Swirl done 2511952afb71SBlue Swirlfi 2512952afb71SBlue Swirl 2513190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix 25145a67135aSbellard 2515ca35f780SPaolo Bonzinitools= 2516ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then 2517ca35f780SPaolo Bonzini tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 2518ca35f780SPaolo Bonzini if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 2519ca35f780SPaolo Bonzini tools="qemu-nbd\$(EXESUF) $tools" 2520ca35f780SPaolo Bonzini if [ "$check_utests" = "yes" ]; then 2521ca35f780SPaolo Bonzini tools="check-qint check-qstring check-qdict check-qlist $tools" 2522ca35f780SPaolo Bonzini tools="check-qfloat check-qjson $tools" 2523ca35f780SPaolo Bonzini fi 2524ca35f780SPaolo Bonzini fi 2525ca35f780SPaolo Bonzinifi 2526ca35f780SPaolo Bonzini 2527ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler 2528ca35f780SPaolo Bonziniroms= 2529ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 2530ca35f780SPaolo Bonzini "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 2531ca35f780SPaolo Bonzini "$softmmu" = yes ; then 2532ca35f780SPaolo Bonzini roms="optionrom" 2533ca35f780SPaolo Bonzinifi 253439ac8455SDavid Gibsonif test "$cpu" = "ppc64" ; then 253539ac8455SDavid Gibson roms="$roms spapr-rtas" 253639ac8455SDavid Gibsonfi 2537ca35f780SPaolo Bonzini 25387d13299dSbellardecho "Install prefix $prefix" 2539f2b9e1e3SPaolo Bonziniecho "BIOS directory `eval echo $datadir`" 2540f2b9e1e3SPaolo Bonziniecho "binary directory `eval echo $bindir`" 25411c0fd160SAurelien Jarnoecho "config directory `eval echo $sysconfdir`" 254211d9f695Sbellardif test "$mingw32" = "no" ; then 2543f2b9e1e3SPaolo Bonziniecho "Manual directory `eval echo $mandir`" 254443ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 254511d9f695Sbellardfi 25465a67135aSbellardecho "Source path $source_path" 25477d13299dSbellardecho "C compiler $cc" 254883469015Sbellardecho "Host C compiler $host_cc" 25490c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 2550a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 25510c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 25527d13299dSbellardecho "make $make" 25536a882643Spbrookecho "install $install" 2554a98fd896Sbellardecho "host CPU $cpu" 2555de83cd02Sbellardecho "host big endian $bigendian" 255697a847bcSbellardecho "target list $target_list" 2557ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 2558b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon" 25597d13299dSbellardecho "gprof enabled $gprof" 256003b4fe7dSaliguoriecho "sparse enabled $sparse" 25611625af87Saliguoriecho "strip binaries $strip_opt" 256205c2a3e7Sbellardecho "profiler $profiler" 256343ce4dfeSbellardecho "static build $static" 256485aa5189Sbellardecho "-Werror enabled $werror" 25655b0753e0Sbellardif test "$darwin" = "yes" ; then 25665b0753e0Sbellard echo "Cocoa support $cocoa" 25675b0753e0Sbellardfi 256897a847bcSbellardecho "SDL support $sdl" 25694d3b6f6eSbalrogecho "curses support $curses" 2570769ce76dSAlexander Grafecho "curl support $curl" 25715495ed11SLuiz Capitulinoecho "check support $check_utests" 257267b915a5Sbellardecho "mingw32 support $mingw32" 25730c58ac1cSmalcecho "Audio drivers $audio_drv_list" 25740c58ac1cSmalcecho "Extra audio cards $audio_card_list" 2575eb852011SMarkus Armbrusterecho "Block whitelist $block_drv_whitelist" 25768ff9cbf7Smalcecho "Mixer emulation $mixemu" 2577821601eaSJes Sorensenecho "VNC support $vnc" 2578821601eaSJes Sorensenif test "$vnc" = "yes" ; then 25798d5d2d4cSths echo "VNC TLS support $vnc_tls" 25802f9606b3Saliguori echo "VNC SASL support $vnc_sasl" 25812f6f5c7aSCorentin Chary echo "VNC JPEG support $vnc_jpeg" 2582efe556adSCorentin Chary echo "VNC PNG support $vnc_png" 2583bd023f95SCorentin Chary echo "VNC thread $vnc_thread" 2584821601eaSJes Sorensenfi 25853142255cSblueswir1if test -n "$sparc_cpu"; then 25863142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 25873142255cSblueswir1fi 2588e37630caSaliguoriecho "xen support $xen" 25892e4d9fb1Saurel32echo "brlapi support $brlapi" 2590a20a6f46SJuan Quintelaecho "bluez support $bluez" 2591a25dba17SJuan Quintelaecho "Documentation $docs" 2592c5937220Spbrook[ ! -z "$uname_release" ] && \ 2593c5937220Spbrookecho "uname -r $uname_release" 2594bd0c5661Spbrookecho "NPTL support $nptl" 2595379f6698SPaul Brookecho "GUEST_BASE $guest_base" 259634005a00SKirill A. Shutemovecho "PIE user targets $user_pie" 25978a16d273Sthsecho "vde support $vde" 2598e5d355d1Saliguoriecho "IO thread $io_thread" 25995c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 2600758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr" 260177755340Sthsecho "Install blobs $blobs" 2602b31a0277SJuan Quintelaecho "KVM support $kvm" 2603f652e6afSaurel32echo "fdt support $fdt" 2604ceb42de8Saliguoriecho "preadv support $preadv" 26055f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 2606e78815a5SAndreas Färberecho "madvise $madvise" 2607e78815a5SAndreas Färberecho "posix_madvise $posix_madvise" 2608ee682d27SStefan Weilecho "uuid support $uuid" 2609d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net" 261094a420b1SStefan Hajnocziecho "Trace backend $trace_backend" 26119410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>" 2612cd4ec0b4SGerd Hoffmannecho "spice support $spice" 2613f27aaf4bSChristian Brunnerecho "rbd support $rbd" 2614dce512deSChristoph Hellwigecho "xfsctl support $xfs" 2615111a38b0SRobert Relyeaecho "nss used $smartcard_nss" 261620ff075bSMichael Walleecho "OpenGL support $opengl" 261767b915a5Sbellard 261897a847bcSbellardif test $sdl_too_old = "yes"; then 261924b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 2620e8cd23deSbellardfi 262197a847bcSbellard 262298ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 26234bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld" 262497a847bcSbellard 262598ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 262698ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 262798ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 262898ec69acSJuan Quintelaecho >> $config_host_mak 262998ec69acSJuan Quintela 2630e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak 263199d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak 263299d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak 263399d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak 263499d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak 263599d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak 263699d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak 26371dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak 2638804edf29SJuan Quintela 26392408a527Saurel32case "$cpu" in 2640*d2fbca94SGuan Xuetao i386|x86_64|alpha|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64|unicore32) 2641e0da9dd3SJuan Quintela ARCH=$cpu 26422408a527Saurel32 ;; 2643a302c32dSLaurent Desnogues armv4b|armv4l) 264416dbd14fSJuan Quintela ARCH=arm 26452408a527Saurel32 ;; 26462408a527Saurel32esac 264798ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 2648f8393946Saurel32if test "$debug_tcg" = "yes" ; then 26492358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 2650f8393946Saurel32fi 2651b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then 2652b4475aa2SLuiz Capitulino echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak 2653b4475aa2SLuiz Capitulinofi 2654f3d08ee6SPaul Brookif test "$debug" = "yes" ; then 26552358a494SJuan Quintela echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak 2656f3d08ee6SPaul Brookfi 26571625af87Saliguoriif test "$strip_opt" = "yes" ; then 265852ba784dSHollis Blanchard echo "STRIP=${strip}" >> $config_host_mak 26591625af87Saliguorifi 26607d13299dSbellardif test "$bigendian" = "yes" ; then 2661e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 266297a847bcSbellardfi 26632358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak 266467b915a5Sbellardif test "$mingw32" = "yes" ; then 266598ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 26669fe6de94SBlue Swirl rc_version=`cat $source_path/VERSION` 26679fe6de94SBlue Swirl version_major=${rc_version%%.*} 26689fe6de94SBlue Swirl rc_version=${rc_version#*.} 26699fe6de94SBlue Swirl version_minor=${rc_version%%.*} 26709fe6de94SBlue Swirl rc_version=${rc_version#*.} 26719fe6de94SBlue Swirl version_subminor=${rc_version%%.*} 26729fe6de94SBlue Swirl version_micro=0 26739fe6de94SBlue Swirl echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 26749fe6de94SBlue Swirl echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak 2675210fa556Spbrookelse 267635f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 2677210fa556Spbrookfi 2678128ab2ffSblueswir1 2679dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 2680dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 2681dffcb71cSMark McLoughlinfi 2682dffcb71cSMark McLoughlin 268383fb7adfSbellardif test "$darwin" = "yes" ; then 268498ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 268583fb7adfSbellardfi 2686b29fe3edSmalc 2687b29fe3edSmalcif test "$aix" = "yes" ; then 268898ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 2689b29fe3edSmalcfi 2690b29fe3edSmalc 2691ec530c81Sbellardif test "$solaris" = "yes" ; then 269298ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 26932358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 26940475a5caSths if test "$needs_libsunmath" = "yes" ; then 269575b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 26960475a5caSths fi 2697ec530c81Sbellardfi 2698179cf400SAndreas Färberif test "$haiku" = "yes" ; then 2699179cf400SAndreas Färber echo "CONFIG_HAIKU=y" >> $config_host_mak 2700179cf400SAndreas Färberfi 270197a847bcSbellardif test "$static" = "yes" ; then 270298ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 270397a847bcSbellardfi 270405c2a3e7Sbellardif test $profiler = "yes" ; then 27052358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 270605c2a3e7Sbellardfi 2707c20709aaSbellardif test "$slirp" = "yes" ; then 270898ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 2709f9728943SPaolo Bonzini QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES" 2710c20709aaSbellardfi 27118a16d273Sthsif test "$vde" = "yes" ; then 271298ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 27138a16d273Sthsfi 27140c58ac1cSmalcfor card in $audio_card_list; do 2715f6e5889eSpbrook def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` 271698ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 27170c58ac1cSmalcdone 27182358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 27190c58ac1cSmalcfor drv in $audio_drv_list; do 2720f6e5889eSpbrook def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` 272198ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 2722923e4521Smalc if test "$drv" = "fmod"; then 27237aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 2724fb065187Sbellard fi 27250c58ac1cSmalcdone 272667f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 272767f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 272867f86e8eSJuan Quintelafi 2729d5631638Smalcif test "$audio_win_int" = "yes" ; then 2730d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 2731d5631638Smalcfi 2732eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak 27338ff9cbf7Smalcif test "$mixemu" = "yes" ; then 273498ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 27358ff9cbf7Smalcfi 2736821601eaSJes Sorensenif test "$vnc" = "yes" ; then 2737821601eaSJes Sorensen echo "CONFIG_VNC=y" >> $config_host_mak 2738821601eaSJes Sorensenfi 27398d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 274098ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 2741525061bfSJuan Quintela echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak 27428d5d2d4cSthsfi 27432f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 274498ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 274560ddf533SJuan Quintela echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak 27462f9606b3Saliguorifi 2747821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then 27482f6f5c7aSCorentin Chary echo "CONFIG_VNC_JPEG=y" >> $config_host_mak 27492f6f5c7aSCorentin Chary echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak 27502f6f5c7aSCorentin Charyfi 2751821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then 2752efe556adSCorentin Chary echo "CONFIG_VNC_PNG=y" >> $config_host_mak 2753efe556adSCorentin Chary echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak 2754efe556adSCorentin Charyfi 2755821601eaSJes Sorensenif test "$vnc_thread" = "yes" ; then 2756bd023f95SCorentin Chary echo "CONFIG_VNC_THREAD=y" >> $config_host_mak 2757bd023f95SCorentin Charyfi 275876655d6dSaliguoriif test "$fnmatch" = "yes" ; then 27592358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 276076655d6dSaliguorifi 2761ee682d27SStefan Weilif test "$uuid" = "yes" ; then 2762ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 2763ee682d27SStefan Weilfi 2764dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then 2765dce512deSChristoph Hellwig echo "CONFIG_XFS=y" >> $config_host_mak 2766dce512deSChristoph Hellwigfi 2767b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 276898ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 27692358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 277098ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 277198ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 2772a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 277398ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 2774cc8ae6deSpbrookfi 27751ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 277698ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 27778ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 277849ecc3faSbellardfi 277949ecc3faSbellardif test "$cocoa" = "yes" ; then 278098ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 278149ecc3faSbellardfi 27824d3b6f6eSbalrogif test "$curses" = "yes" ; then 278398ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 2784ab4e5602SJan Kiszkafi 27853b3f24adSaurel32if test "$atfile" = "yes" ; then 27862358a494SJuan Quintela echo "CONFIG_ATFILE=y" >> $config_host_mak 27873b3f24adSaurel32fi 2788ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 27892358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 2790ebc996f3SRiku Voipiofi 2791099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 27922358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 2793099d6b0fSRiku Voipiofi 279440ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 279540ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 279640ff6d7eSKevin Wolffi 27973ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 27982358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 27993ce34dfbSvibisreenivasanfi 2800c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 2801c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 2802c2882b96SRiku Voipiofi 2803d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 2804d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 2805d0927938SUlrich Hechtfi 2806c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then 2807c727f47dSPeter Maydell echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak 2808c727f47dSPeter Maydellfi 2809dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then 2810dace20dcSPeter Maydell echo "CONFIG_FIEMAP=y" >> $config_host_mak 2811dace20dcSPeter Maydellfi 2812d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 2813d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 2814d0927938SUlrich Hechtfi 28153b6edd16SPeter Maydellif test "$epoll" = "yes" ; then 28163b6edd16SPeter Maydell echo "CONFIG_EPOLL=y" >> $config_host_mak 28173b6edd16SPeter Maydellfi 28183b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then 28193b6edd16SPeter Maydell echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak 28203b6edd16SPeter Maydellfi 28213b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then 28223b6edd16SPeter Maydell echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak 28233b6edd16SPeter Maydellfi 28243b3f24adSaurel32if test "$inotify" = "yes" ; then 28252358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 28263b3f24adSaurel32fi 2827c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 2828c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 2829c05c7a73SRiku Voipiofi 28306ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 28316ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 28326ae9a1f4SJuan Quintelafi 28336ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 28346ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 28356ae9a1f4SJuan Quintelafi 2836769ce76dSAlexander Grafif test "$curl" = "yes" ; then 283798ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 2838b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 2839769ce76dSAlexander Graffi 28402e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 284198ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 28422e4d9fb1Saurel32fi 2843fb599c9aSbalrogif test "$bluez" = "yes" ; then 284498ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 2845ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 2846fb599c9aSbalrogfi 2847e37630caSaliguoriif test "$xen" = "yes" ; then 28485647eb74SJuan Quintela echo "CONFIG_XEN=y" >> $config_host_mak 2849e37630caSaliguorifi 2850e5d355d1Saliguoriif test "$io_thread" = "yes" ; then 285198ec69acSJuan Quintela echo "CONFIG_IOTHREAD=y" >> $config_host_mak 2852e5d355d1Saliguorifi 28535c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 28545c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 28555c6c3a6cSChristoph Hellwigfi 2856758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then 2857758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_ATTR=y" >> $config_host_mak 2858758e8e38SVenkateswararao Jujjuri (JV)fi 2859758e8e38SVenkateswararao Jujjuri (JV)if test "$linux" = "yes" ; then 2860758e8e38SVenkateswararao Jujjuri (JV) if test "$attr" = "yes" ; then 2861758e8e38SVenkateswararao Jujjuri (JV) echo "CONFIG_VIRTFS=y" >> $config_host_mak 2862758e8e38SVenkateswararao Jujjuri (JV) fi 2863758e8e38SVenkateswararao Jujjuri (JV)fi 286477755340Sthsif test "$blobs" = "yes" ; then 286598ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 286677755340Sthsfi 2867bf9298b9Saliguoriif test "$iovec" = "yes" ; then 28682358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 2869bf9298b9Saliguorifi 2870ceb42de8Saliguoriif test "$preadv" = "yes" ; then 28712358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 2872ceb42de8Saliguorifi 2873f652e6afSaurel32if test "$fdt" = "yes" ; then 28743f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 2875f652e6afSaurel32fi 2876dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then 2877dcc38d1cSMarcelo Tosatti echo "CONFIG_SIGNALFD=y" >> $config_host_mak 2878dcc38d1cSMarcelo Tosattifi 2879de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then 2880de5071c5SBlue Swirl echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak 2881de5071c5SBlue Swirlfi 2882747bbdf7SBlue Swirlif test "$gcc_attribute_warn_unused_result" = "yes" ; then 2883747bbdf7SBlue Swirl echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak 2884747bbdf7SBlue Swirlfi 28855f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 28865f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 28875f6b9e8fSBlue Swirlfi 2888e78815a5SAndreas Färberif test "$madvise" = "yes" ; then 2889e78815a5SAndreas Färber echo "CONFIG_MADVISE=y" >> $config_host_mak 2890e78815a5SAndreas Färberfi 2891e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then 2892e78815a5SAndreas Färber echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak 2893e78815a5SAndreas Färberfi 289497a847bcSbellard 2895cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then 2896cd4ec0b4SGerd Hoffmann echo "CONFIG_SPICE=y" >> $config_host_mak 2897cd4ec0b4SGerd Hoffmannfi 2898cd4ec0b4SGerd Hoffmann 289936707144SAlon Levyif test "$smartcard" = "yes" ; then 290036707144SAlon Levy echo "CONFIG_SMARTCARD=y" >> $config_host_mak 290136707144SAlon Levyfi 290236707144SAlon Levy 2903111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 2904111a38b0SRobert Relyea echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak 2905111a38b0SRobert Relyeafi 2906111a38b0SRobert Relyea 290720ff075bSMichael Walleif test "$opengl" = "yes" ; then 290820ff075bSMichael Walle echo "CONFIG_OPENGL=y" >> $config_host_mak 290920ff075bSMichael Wallefi 291020ff075bSMichael Walle 291183fb7adfSbellard# XXX: suppress that 29127d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 29132358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 29147d3505c5Sbellardfi 29157d3505c5Sbellard 29162358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 2917c5937220Spbrook 291820ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 291920ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 292020ff6c80SAnthony Liguorifi 2921f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then 2922f27aaf4bSChristian Brunner echo "CONFIG_RBD=y" >> $config_host_mak 2923f27aaf4bSChristian Brunnerfi 292420ff6c80SAnthony Liguori 292568063649Sblueswir1# USB host support 292668063649Sblueswir1case "$usb" in 292768063649Sblueswir1linux) 292898ec69acSJuan Quintela echo "HOST_USB=linux" >> $config_host_mak 292968063649Sblueswir1;; 293068063649Sblueswir1bsd) 293198ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 293268063649Sblueswir1;; 293368063649Sblueswir1*) 293498ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 293568063649Sblueswir1;; 293668063649Sblueswir1esac 293768063649Sblueswir1 293894a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak 293922890ab5SPrerna Saxenaif test "$trace_backend" = "simple"; then 294022890ab5SPrerna Saxena echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak 294122890ab5SPrerna Saxenafi 29429410b56cSPrerna Saxena# Set the appropriate trace file. 29439410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then 29449410b56cSPrerna Saxena trace_file="\"$trace_file-%u\"" 29459410b56cSPrerna Saxenafi 2946c276b17dSDaniel P. Berrangeif test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then 2947c276b17dSDaniel P. Berrange echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak 2948c276b17dSDaniel P. Berrangefi 29499410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak 29509410b56cSPrerna Saxena 295198ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 295298ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 2953804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 2954804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 2955804edf29SJuan Quintelaecho "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak 2956804edf29SJuan Quintelaecho "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak 2957804edf29SJuan Quintelaecho "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak 2958804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 29592b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak 2960804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 2961804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 2962804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 2963804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 29649fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak 2965e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 2966a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 2967f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak 2968e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then 2969e39f0062SPaolo Bonzini echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 2970e39f0062SPaolo Bonzini echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 2971e39f0062SPaolo Bonzini echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 2972e39f0062SPaolo Bonzinifi 2973c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak 2974e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 2975a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak 2976a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak 297773da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 29783e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 2979804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 2980804edf29SJuan Quintela 29814bf6b55bSJuan Quintela# generate list of library paths for linker script 29824bf6b55bSJuan Quintela 29834bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} 29844bf6b55bSJuan Quintela 29854bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then 29864bf6b55bSJuan Quintela if cmp -s $config_host_ld ${config_host_ld}~ ; then 29874bf6b55bSJuan Quintela mv ${config_host_ld}~ $config_host_ld 29884bf6b55bSJuan Quintela else 29894bf6b55bSJuan Quintela rm ${config_host_ld}~ 29904bf6b55bSJuan Quintela fi 29914bf6b55bSJuan Quintelafi 29924bf6b55bSJuan Quintela 29934d904533SBlue Swirlfor d in libdis libdis-user; do 29944d904533SBlue Swirl mkdir -p $d 299511568d6dSPaolo Bonzini symlink $source_path/Makefile.dis $d/Makefile 29964d904533SBlue Swirl echo > $d/config.mak 29974d904533SBlue Swirldone 2998d44cff22SRichard Hendersonif test "$static" = "no" -a "$user_pie" = "yes" ; then 2999d44cff22SRichard Henderson echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak 3000d44cff22SRichard Hendersonfi 30014d904533SBlue Swirl 300297a847bcSbellardfor target in $target_list; do 300397a847bcSbellardtarget_dir="$target" 300425be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 3005600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1` 300697a847bcSbellardtarget_bigendian="no" 30071f3d3c8fSJuan Quintela 3008ea2d6a39SJuan Quintelacase "$target_arch2" in 3009613a22c9SMichael Walle armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus) 3010ea2d6a39SJuan Quintela target_bigendian=yes 3011ea2d6a39SJuan Quintela ;; 3012ea2d6a39SJuan Quintelaesac 301397a847bcSbellardtarget_softmmu="no" 3014997344f3Sbellardtarget_user_only="no" 3015831b7825Sthstarget_linux_user="no" 3016831b7825Sthstarget_darwin_user="no" 301784778508Sblueswir1target_bsd_user="no" 30189e407a85Spbrookcase "$target" in 3019600309b6SBlue Swirl ${target_arch2}-softmmu) 30209e407a85Spbrook target_softmmu="yes" 30219e407a85Spbrook ;; 3022600309b6SBlue Swirl ${target_arch2}-linux-user) 30239c7a4202SBlue Swirl if test "$linux" != "yes" ; then 30249c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Linux host" 30259c7a4202SBlue Swirl exit 1 30269c7a4202SBlue Swirl fi 30279e407a85Spbrook target_user_only="yes" 30289e407a85Spbrook target_linux_user="yes" 30299e407a85Spbrook ;; 3030600309b6SBlue Swirl ${target_arch2}-darwin-user) 30319c7a4202SBlue Swirl if test "$darwin" != "yes" ; then 30329c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Darwin host" 30339c7a4202SBlue Swirl exit 1 30349c7a4202SBlue Swirl fi 30359e407a85Spbrook target_user_only="yes" 3036831b7825Sths target_darwin_user="yes" 30379e407a85Spbrook ;; 3038600309b6SBlue Swirl ${target_arch2}-bsd-user) 30399cf55765SBlue Swirl if test "$bsd" != "yes" ; then 30409c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a BSD host" 30419c7a4202SBlue Swirl exit 1 30429c7a4202SBlue Swirl fi 304384778508Sblueswir1 target_user_only="yes" 304484778508Sblueswir1 target_bsd_user="yes" 304584778508Sblueswir1 ;; 30469e407a85Spbrook *) 30479e407a85Spbrook echo "ERROR: Target '$target' not recognised" 30489e407a85Spbrook exit 1 30499e407a85Spbrook ;; 30509e407a85Spbrookesac 3051831b7825Sths 305297a847bcSbellardmkdir -p $target_dir 3053158142c2Sbellardmkdir -p $target_dir/fpu 305457fec1feSbellardmkdir -p $target_dir/tcg 305559f2a787SGerd Hoffmannmkdir -p $target_dir/ide 305684778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then 305769de927cSbellard mkdir -p $target_dir/nwfpe 305869de927cSbellardfi 305911568d6dSPaolo Bonzinisymlink $source_path/Makefile.target $target_dir/Makefile 3060ec530c81Sbellard 306197a847bcSbellard 306225be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 306397a847bcSbellard 3064e5fe0c52Spbrookbflt="no" 3065bd0c5661Spbrooktarget_nptl="no" 3066600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` 30677ee2822cSPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 306856aebc89Spbrookgdb_xml_files="" 3069c2e3dee6SLaurent Viviertarget_short_alignment=2 3070c2e3dee6SLaurent Viviertarget_int_alignment=4 3071c2e3dee6SLaurent Viviertarget_long_alignment=4 3072c2e3dee6SLaurent Viviertarget_llong_alignment=8 30737ba1e619Saliguori 3074938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2" 30756acff7daSJuan QuintelaTARGET_BASE_ARCH="" 3076e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 3077e73aae67SJuan Quintela 3078600309b6SBlue Swirlcase "$target_arch2" in 30792408a527Saurel32 i386) 308071deff27SAurelien Jarno target_phys_bits=64 30812408a527Saurel32 ;; 30822408a527Saurel32 x86_64) 30836acff7daSJuan Quintela TARGET_BASE_ARCH=i386 30841ad2134fSPaul Brook target_phys_bits=64 3085c2e3dee6SLaurent Vivier target_long_alignment=8 30862408a527Saurel32 ;; 30872408a527Saurel32 alpha) 30881ad2134fSPaul Brook target_phys_bits=64 3089c2e3dee6SLaurent Vivier target_long_alignment=8 3090a4b388ffSRichard Henderson target_nptl="yes" 30912408a527Saurel32 ;; 30922408a527Saurel32 arm|armeb) 3093b498c8a0SJuan Quintela TARGET_ARCH=arm 3094e5fe0c52Spbrook bflt="yes" 3095bd0c5661Spbrook target_nptl="yes" 309656aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 30971ad2134fSPaul Brook target_phys_bits=32 3098c2e3dee6SLaurent Vivier target_llong_alignment=4 30992408a527Saurel32 ;; 31002408a527Saurel32 cris) 3101253bd7f8Sedgar_igl target_nptl="yes" 31021ad2134fSPaul Brook target_phys_bits=32 31032408a527Saurel32 ;; 3104613a22c9SMichael Walle lm32) 3105613a22c9SMichael Walle target_phys_bits=32 3106613a22c9SMichael Walle ;; 31072408a527Saurel32 m68k) 31080938cda5Saurel32 bflt="yes" 310956aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 31101ad2134fSPaul Brook target_phys_bits=32 3111c2e3dee6SLaurent Vivier target_int_alignment=2 3112c2e3dee6SLaurent Vivier target_long_alignment=2 3113c2e3dee6SLaurent Vivier target_llong_alignment=2 31142408a527Saurel32 ;; 3115877fdc12SEdgar E. Iglesias microblaze|microblazeel) 3116877fdc12SEdgar E. Iglesias TARGET_ARCH=microblaze 311772b675caSEdgar E. Iglesias bflt="yes" 311872b675caSEdgar E. Iglesias target_nptl="yes" 311972b675caSEdgar E. Iglesias target_phys_bits=32 312072b675caSEdgar E. Iglesias ;; 31212408a527Saurel32 mips|mipsel) 3122b498c8a0SJuan Quintela TARGET_ARCH=mips 312325be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 3124f04dc72fSPaul Brook target_nptl="yes" 31251ad2134fSPaul Brook target_phys_bits=64 31262408a527Saurel32 ;; 31272408a527Saurel32 mipsn32|mipsn32el) 3128b498c8a0SJuan Quintela TARGET_ARCH=mipsn32 31296acff7daSJuan Quintela TARGET_BASE_ARCH=mips 313025be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 31311ad2134fSPaul Brook target_phys_bits=64 31322408a527Saurel32 ;; 31332408a527Saurel32 mips64|mips64el) 3134b498c8a0SJuan Quintela TARGET_ARCH=mips64 31356acff7daSJuan Quintela TARGET_BASE_ARCH=mips 313625be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 31371ad2134fSPaul Brook target_phys_bits=64 3138c2e3dee6SLaurent Vivier target_long_alignment=8 31392408a527Saurel32 ;; 31402408a527Saurel32 ppc) 3141c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 31421ad2134fSPaul Brook target_phys_bits=32 3143d6630708SNathan Froyd target_nptl="yes" 31442408a527Saurel32 ;; 31452408a527Saurel32 ppcemb) 31466acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3147e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3148c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 31491ad2134fSPaul Brook target_phys_bits=64 3150d6630708SNathan Froyd target_nptl="yes" 31512408a527Saurel32 ;; 31522408a527Saurel32 ppc64) 31536acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3154e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 3155c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 31561ad2134fSPaul Brook target_phys_bits=64 3157c2e3dee6SLaurent Vivier target_long_alignment=8 31582408a527Saurel32 ;; 31592408a527Saurel32 ppc64abi32) 3160b498c8a0SJuan Quintela TARGET_ARCH=ppc64 31616acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 3162e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 316325be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 3164c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 31651ad2134fSPaul Brook target_phys_bits=64 31662408a527Saurel32 ;; 31672408a527Saurel32 sh4|sh4eb) 3168b498c8a0SJuan Quintela TARGET_ARCH=sh4 31694dbed897Spbrook bflt="yes" 31700b6d3ae0Saurel32 target_nptl="yes" 31711ad2134fSPaul Brook target_phys_bits=32 31722408a527Saurel32 ;; 31732408a527Saurel32 sparc) 31741ad2134fSPaul Brook target_phys_bits=64 31752408a527Saurel32 ;; 31762408a527Saurel32 sparc64) 31776acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 31781ad2134fSPaul Brook target_phys_bits=64 3179c2e3dee6SLaurent Vivier target_long_alignment=8 31802408a527Saurel32 ;; 31812408a527Saurel32 sparc32plus) 3182b498c8a0SJuan Quintela TARGET_ARCH=sparc64 31836acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 3184e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 318525be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 31861ad2134fSPaul Brook target_phys_bits=64 31872408a527Saurel32 ;; 318824e804ecSAlexander Graf s390x) 3189bc434676SUlrich Hecht target_nptl="yes" 319024e804ecSAlexander Graf target_phys_bits=64 31917b3da903SAlexander Graf target_long_alignment=8 319224e804ecSAlexander Graf ;; 3193*d2fbca94SGuan Xuetao unicore32) 3194*d2fbca94SGuan Xuetao target_phys_bits=32 3195*d2fbca94SGuan Xuetao ;; 31962408a527Saurel32 *) 3197de83cd02Sbellard echo "Unsupported target CPU" 3198de83cd02Sbellard exit 1 31992408a527Saurel32 ;; 32002408a527Saurel32esac 3201c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak 3202c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak 3203c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak 3204c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak 320525be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak 3206053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`" 320725be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 320825be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak 320942bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 32106acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then 32116acff7daSJuan Quintela TARGET_BASE_ARCH=$TARGET_ARCH 32126acff7daSJuan Quintelafi 321325be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 3214e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 3215e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 3216e6e91b9cSJuan Quintelafi 321725be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 32181b0c87fcSJuan Quintelacase "$target_arch2" in 32191b0c87fcSJuan Quintela i386|x86_64) 32201b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 322125be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 32221b0c87fcSJuan Quintela fi 32231b0c87fcSJuan Quintelaesac 3224c59249f9SJuan Quintelacase "$target_arch2" in 32250e60a699SAlexander Graf i386|x86_64|ppcemb|ppc|ppc64|s390x) 3226c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 3227c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 3228c59249f9SJuan Quintela \( "$target_arch2" = "$cpu" -o \ 3229c59249f9SJuan Quintela \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 32305f114bc6SAlexander Graf \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ 3231adf82011SRené Rebe \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \ 3232adf82011SRené Rebe \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ 3233c59249f9SJuan Quintela \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ 3234c59249f9SJuan Quintela \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then 323525be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 323625be210fSJuan Quintela echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak 3237dae5079aSJan Kiszka if test "$kvm_para" = "yes"; then 3238dae5079aSJan Kiszka echo "CONFIG_KVM_PARA=y" >> $config_target_mak 3239dae5079aSJan Kiszka fi 3240d5970055SMichael S. Tsirkin if test $vhost_net = "yes" ; then 3241d5970055SMichael S. Tsirkin echo "CONFIG_VHOST_NET=y" >> $config_target_mak 3242d5970055SMichael S. Tsirkin fi 3243c59249f9SJuan Quintela fi 3244c59249f9SJuan Quintelaesac 3245de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 324625be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 324797a847bcSbellardfi 324897a847bcSbellardif test "$target_softmmu" = "yes" ; then 3249b1aa27c4SPaul Brook echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak 325025be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 325125be210fSJuan Quintela echo "LIBS+=$libs_softmmu" >> $config_target_mak 32520e8c9214SAndreas Färber echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak 32535791f45bSKirill A. Shutemov echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak 3254de83cd02Sbellardfi 3255997344f3Sbellardif test "$target_user_only" = "yes" ; then 325625be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 3257997344f3Sbellardfi 3258831b7825Sthsif test "$target_linux_user" = "yes" ; then 325925be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 3260831b7825Sthsfi 3261831b7825Sthsif test "$target_darwin_user" = "yes" ; then 326225be210fSJuan Quintela echo "CONFIG_DARWIN_USER=y" >> $config_target_mak 3263831b7825Sthsfi 3264111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then 3265111a38b0SRobert Relyea echo "subdir-$target: subdir-libcacard" >> $config_host_mak 3266111a38b0SRobert Relyea echo "libcacard_libs=$libcacard_libs" >> $config_host_mak 3267111a38b0SRobert Relyea echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak 3268111a38b0SRobert Relyeafi 326956aebc89Spbrooklist="" 327056aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 327156aebc89Spbrook for x in $gdb_xml_files; do 327256aebc89Spbrook list="$list $source_path/gdb-xml/$x" 327356aebc89Spbrook done 327425be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 32753d0f1517SJuan Quintelafi 3276de83cd02Sbellard 3277f57975fbSJuan Quintelacase "$target_arch2" in 3278eb8f7776SAurelien Jarno i386|x86_64) 3279eb8f7776SAurelien Jarno echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak 3280f57975fbSJuan Quintela ;; 3281d6b38939SJuan Quintela *) 3282eb8f7776SAurelien Jarno echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak 3283d6b38939SJuan Quintela ;; 3284f57975fbSJuan Quintelaesac 3285f57975fbSJuan Quintela 3286e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 328725be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 3288e5fe0c52Spbrookfi 3289bd0c5661Spbrookif test "$target_user_only" = "yes" \ 3290bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 329125be210fSJuan Quintela echo "CONFIG_USE_NPTL=y" >> $config_target_mak 3292bd0c5661Spbrookfi 3293379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 329425be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 3295379f6698SPaul Brookfi 329684778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 329725be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 329884778508Sblueswir1fi 32995b0753e0Sbellard 33004afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 3301fa282484SJuan Quintela 33024afddb55SJuan Quintelacflags="" 3303f9728943SPaolo Bonziniincludes="" 3304fa282484SJuan Quintelaldflags="" 33059b8e111fSJuan Quintela 330657ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then 3307f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/sparc $includes" 330824e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then 3309f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/s390 $includes" 33105d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then 3311f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/i386 $includes" 331257ddfbf7SJuan Quintelaelse 3313f9728943SPaolo Bonzini includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes" 331457ddfbf7SJuan Quintelafi 3315f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes" 3316f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/fpu $includes" 331757ddfbf7SJuan Quintela 33184d904533SBlue Swirlif test "$target_user_only" = "yes" ; then 33194d904533SBlue Swirl libdis_config_mak=libdis-user/config.mak 33204d904533SBlue Swirlelse 33214d904533SBlue Swirl libdis_config_mak=libdis/config.mak 33224d904533SBlue Swirlfi 33234d904533SBlue Swirl 332464656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 332564656024SJuan Quintela case "$i" in 332664656024SJuan Quintela alpha) 332725be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 33284d904533SBlue Swirl echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak 332964656024SJuan Quintela ;; 333064656024SJuan Quintela arm) 333125be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 33324d904533SBlue Swirl echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak 333364656024SJuan Quintela ;; 333464656024SJuan Quintela cris) 333525be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 33364d904533SBlue Swirl echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak 333764656024SJuan Quintela ;; 333864656024SJuan Quintela hppa) 333925be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 33404d904533SBlue Swirl echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak 334164656024SJuan Quintela ;; 334264656024SJuan Quintela i386|x86_64) 334325be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 33444d904533SBlue Swirl echo "CONFIG_I386_DIS=y" >> $libdis_config_mak 334564656024SJuan Quintela ;; 3346903ec55cSAurelien Jarno ia64*) 3347903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $config_target_mak 3348903ec55cSAurelien Jarno echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak 3349903ec55cSAurelien Jarno ;; 335064656024SJuan Quintela m68k) 335125be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 33524d904533SBlue Swirl echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak 335364656024SJuan Quintela ;; 3354877fdc12SEdgar E. Iglesias microblaze*) 335525be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 33564d904533SBlue Swirl echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak 335764656024SJuan Quintela ;; 335864656024SJuan Quintela mips*) 335925be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 33604d904533SBlue Swirl echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak 336164656024SJuan Quintela ;; 336264656024SJuan Quintela ppc*) 336325be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 33644d904533SBlue Swirl echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak 336564656024SJuan Quintela ;; 336624e804ecSAlexander Graf s390*) 336725be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 33684d904533SBlue Swirl echo "CONFIG_S390_DIS=y" >> $libdis_config_mak 336964656024SJuan Quintela ;; 337064656024SJuan Quintela sh4) 337125be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 33724d904533SBlue Swirl echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak 337364656024SJuan Quintela ;; 337464656024SJuan Quintela sparc*) 337525be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 33764d904533SBlue Swirl echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak 337764656024SJuan Quintela ;; 337864656024SJuan Quintela esac 337964656024SJuan Quinteladone 338064656024SJuan Quintela 33816ee7126fSJuan Quintelacase "$ARCH" in 33826ee7126fSJuan Quintelaalpha) 33836ee7126fSJuan Quintela # Ensure there's only a single GP 33846ee7126fSJuan Quintela cflags="-msmall-data $cflags" 33856ee7126fSJuan Quintela;; 33866ee7126fSJuan Quintelaesac 33876ee7126fSJuan Quintela 338855d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then 338955d9c04bSJuan Quintela case "$TARGET_BASE_ARCH" in 339055d9c04bSJuan Quintela arm) 339155d9c04bSJuan Quintela cflags="-DHAS_AUDIO $cflags" 339255d9c04bSJuan Quintela ;; 339325a8bb96SMichael Walle lm32) 339425a8bb96SMichael Walle cflags="-DHAS_AUDIO $cflags" 339525a8bb96SMichael Walle ;; 339655d9c04bSJuan Quintela i386|mips|ppc) 339755d9c04bSJuan Quintela cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" 339855d9c04bSJuan Quintela ;; 339955d9c04bSJuan Quintela esac 340055d9c04bSJuan Quintelafi 340155d9c04bSJuan Quintela 340234005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \ 340334005a00SKirill A. Shutemov "$user_pie" = "yes" ; then 340434005a00SKirill A. Shutemov cflags="-fpie $cflags" 340534005a00SKirill A. Shutemov ldflags="-pie $ldflags" 340634005a00SKirill A. Shutemovfi 340734005a00SKirill A. Shutemov 3408471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \ 3409471857ddSJuan Quintela "$TARGET_ARCH" = "microblaze" -o \ 3410471857ddSJuan Quintela "$TARGET_ARCH" = "cris" \) ; then 341125be210fSJuan Quintela echo "CONFIG_NEED_MMU=y" >> $config_target_mak 3412471857ddSJuan Quintelafi 3413471857ddSJuan Quintela 3414d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 341525be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 3416d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 3417d02c1db3SJuan Quintela cflags="-p $cflags" 3418d02c1db3SJuan Quintela ldflags="-p $ldflags" 3419d02c1db3SJuan Quintela fi 3420d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 3421d02c1db3SJuan Quintela ldflags="-p $ldflags" 342225be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 3423d02c1db3SJuan Quintela fi 3424d02c1db3SJuan Quintelafi 3425d02c1db3SJuan Quintela 34266ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld" 34279b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 3428fa282484SJuan Quintela case "$ARCH" in 3429fa282484SJuan Quintela sparc) 3430fa282484SJuan Quintela # -static is used to avoid g1/g3 usage by the dynamic linker 3431322e5878SJuan Quintela ldflags="$linker_script -static $ldflags" 3432fa282484SJuan Quintela ;; 34334d58be06SRichard Henderson alpha | s390x) 34344d58be06SRichard Henderson # The default placement of the application is fine. 34354d58be06SRichard Henderson ;; 3436fd76e73aSRichard Henderson *) 3437322e5878SJuan Quintela ldflags="$linker_script $ldflags" 3438fa282484SJuan Quintela ;; 3439fa282484SJuan Quintela esac 3440fa282484SJuan Quintelafi 3441fa282484SJuan Quintela 344225be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 344325be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 3444f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak 3445fa282484SJuan Quintela 344697a847bcSbellarddone # for target in $targets 34477d13299dSbellard 3448d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory 3449e1144d00SMark McLoughlinDIRS="tests tests/cris slirp audio block net pc-bios/optionrom" 34502d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios" 34513e230dd2SCorentin CharyDIRS="$DIRS fsdev ui" 34527d13299dSbellardFILES="Makefile tests/Makefile" 3453e7daa605SthsFILES="$FILES tests/cris/Makefile tests/cris/.gdbinit" 3454ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" 34552d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 34567ea78b74SJan Kiszkafor bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do 34577ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 34587ea78b74SJan Kiszkadone 3459d1807a4fSPaolo Bonzinimkdir -p $DIRS 34607d13299dSbellardfor f in $FILES ; do 3461eae30c8fSAurelien Jarno test -e $f || symlink $source_path/$f $f 34627d13299dSbellarddone 34631ad2134fSPaul Brook 3464c34ebfdcSAnthony Liguori# temporary config to build submodules 34652d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 3466c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 346737116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 3468c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 3469c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 3470c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 3471c34ebfdcSAnthony Liguori echo "CPP=${cross_prefix}cpp" >> $config_mak 3472c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 3473c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 3474c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 3475c34ebfdcSAnthony Liguoridone 3476c34ebfdcSAnthony Liguori 34771ad2134fSPaul Brookfor hwlib in 32 64; do 34781ad2134fSPaul Brook d=libhw$hwlib 34791ad2134fSPaul Brook mkdir -p $d 34809953b2fcSBlue Swirl mkdir -p $d/ide 348111568d6dSPaolo Bonzini symlink $source_path/Makefile.hw $d/Makefile 348237116c89SStefan Weil echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak 34831ad2134fSPaul Brookdone 3484add16157SBlue Swirl 3485111a38b0SRobert Relyeaif [ "$source_path" != `pwd` ]; then 3486111a38b0SRobert Relyea # out of tree build 3487111a38b0SRobert Relyea mkdir -p libcacard 3488111a38b0SRobert Relyea rm -f libcacard/Makefile 3489111a38b0SRobert Relyea ln -s "$source_path/libcacard/Makefile" libcacard/Makefile 3490111a38b0SRobert Relyeafi 3491111a38b0SRobert Relyea 3492add16157SBlue Swirld=libuser 3493add16157SBlue Swirlmkdir -p $d 349411568d6dSPaolo Bonzinisymlink $source_path/Makefile.user $d/Makefile 3495299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then 3496299060a0SKirill A. Shutemov echo "QEMU_CFLAGS+=-fpie" > $d/config.mak 3497299060a0SKirill A. Shutemovfi 3498b40292e7SJan Kiszka 3499b40292e7SJan Kiszkaif test "$docs" = "yes" ; then 3500b40292e7SJan Kiszka mkdir -p QMP 3501b40292e7SJan Kiszkafi 3502