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 1802d5467eSmalctrap "rm -f $TMPC $TMPO $TMPE ; exit" 0 2 3 15 199ac81bbbSmalc 2052166aa0SJuan Quintelacompile_object() { 21a558ee17SJuan Quintela $cc $QEMU_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null 2252166aa0SJuan Quintela} 2352166aa0SJuan Quintela 2452166aa0SJuan Quintelacompile_prog() { 2552166aa0SJuan Quintela local_cflags="$1" 2652166aa0SJuan Quintela local_ldflags="$2" 27a558ee17SJuan Quintela $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags > /dev/null 2> /dev/null 2852166aa0SJuan Quintela} 2952166aa0SJuan Quintela 300dba6195SLoïc Minier# check whether a command is available to this shell (may be either an 310dba6195SLoïc Minier# executable or a builtin) 320dba6195SLoïc Minierhas() { 330dba6195SLoïc Minier type "$1" >/dev/null 2>&1 340dba6195SLoïc Minier} 350dba6195SLoïc Minier 360dba6195SLoïc Minier# search for an executable in PATH 370dba6195SLoïc Minierpath_of() { 380dba6195SLoïc Minier local_command="$1" 390dba6195SLoïc Minier local_ifs="$IFS" 400dba6195SLoïc Minier local_dir="" 410dba6195SLoïc Minier 420dba6195SLoïc Minier # pathname has a dir component? 430dba6195SLoïc Minier if [ "${local_command#*/}" != "$local_command" ]; then 440dba6195SLoïc Minier if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then 450dba6195SLoïc Minier echo "$local_command" 460dba6195SLoïc Minier return 0 470dba6195SLoïc Minier fi 480dba6195SLoïc Minier fi 490dba6195SLoïc Minier if [ -z "$local_command" ]; then 500dba6195SLoïc Minier return 1 510dba6195SLoïc Minier fi 520dba6195SLoïc Minier 530dba6195SLoïc Minier IFS=: 540dba6195SLoïc Minier for local_dir in $PATH; do 550dba6195SLoïc Minier if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then 560dba6195SLoïc Minier echo "$local_dir/$local_command" 570dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 580dba6195SLoïc Minier return 0 590dba6195SLoïc Minier fi 600dba6195SLoïc Minier done 610dba6195SLoïc Minier # not found 620dba6195SLoïc Minier IFS="${local_ifs:-$(printf ' \t\n')}" 630dba6195SLoïc Minier return 1 640dba6195SLoïc Minier} 650dba6195SLoïc Minier 667d13299dSbellard# default parameters 672ff6b91eSJuan Quintelacpu="" 6811d9f695Sbellardprefix="" 691e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M" 7043ce4dfeSbellardstatic="no" 7107381cc1SAnthony Liguorisysconfdir="" 72ed968ff1SJuan Quintelasparc_cpu="" 737d13299dSbellardcross_prefix="" 747d13299dSbellardcc="gcc" 750c58ac1cSmalcaudio_drv_list="" 764c9b53e3Smalcaudio_card_list="ac97 es1370 sb16" 774c9b53e3Smalcaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus" 78eb852011SMarkus Armbrusterblock_drv_whitelist="" 797d13299dSbellardhost_cc="gcc" 807d13299dSbellardar="ar" 817d13299dSbellardmake="make" 826a882643Spbrookinstall="install" 837aa486feSAnthony Liguoriobjcopy="objcopy" 847aa486feSAnthony Liguorild="ld" 85c81da56eSJuan Quintelahelper_cflags="" 8673da375eSJuan Quintelalibs_softmmu="" 873e2e0e6bSJuan Quintelalibs_tools="" 8867f86e8eSJuan Quintelaaudio_pt_int="" 89d5631638Smalcaudio_win_int="" 90ac0df51dSaliguori 91ac0df51dSaliguori# parse CC options first 92ac0df51dSaliguorifor opt do 93ac0df51dSaliguori optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 94ac0df51dSaliguori case "$opt" in 95ac0df51dSaliguori --cross-prefix=*) cross_prefix="$optarg" 96ac0df51dSaliguori ;; 97ac0df51dSaliguori --cc=*) cc="$optarg" 98ac0df51dSaliguori ;; 992ff6b91eSJuan Quintela --cpu=*) cpu="$optarg" 1002ff6b91eSJuan Quintela ;; 101a558ee17SJuan Quintela --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" 102e2a2ed06SJuan Quintela ;; 103e2a2ed06SJuan Quintela --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" 104e2a2ed06SJuan Quintela ;; 10550e7b1a0SJuan Quintela --sparc_cpu=*) 10650e7b1a0SJuan Quintela sparc_cpu="$optarg" 10750e7b1a0SJuan Quintela case $sparc_cpu in 108ed968ff1SJuan Quintela v7|v8|v8plus|v8plusa) 10950e7b1a0SJuan Quintela cpu="sparc" 11050e7b1a0SJuan Quintela ;; 11150e7b1a0SJuan Quintela v9) 11250e7b1a0SJuan Quintela cpu="sparc64" 11350e7b1a0SJuan Quintela ;; 11450e7b1a0SJuan Quintela *) 11550e7b1a0SJuan Quintela echo "undefined SPARC architecture. Exiting"; 11650e7b1a0SJuan Quintela exit 1 11750e7b1a0SJuan Quintela ;; 11850e7b1a0SJuan Quintela esac 11950e7b1a0SJuan Quintela ;; 120ac0df51dSaliguori esac 121ac0df51dSaliguoridone 122ac0df51dSaliguori# OS specific 123ac0df51dSaliguori# Using uname is really, really broken. Once we have the right set of checks 124ac0df51dSaliguori# we can eliminate it's usage altogether 125ac0df51dSaliguori 126ac0df51dSaliguoricc="${cross_prefix}${cc}" 127ac0df51dSaliguoriar="${cross_prefix}${ar}" 1287aa486feSAnthony Liguoriobjcopy="${cross_prefix}${objcopy}" 1297aa486feSAnthony Liguorild="${cross_prefix}${ld}" 130ac0df51dSaliguori 131be17dc90SMichael S. Tsirkin# default flags for all hosts 132be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" 133be17dc90SMichael S. TsirkinCFLAGS="-g $CFLAGS" 134be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" 135be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" 136be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" 13784958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" 138be17dc90SMichael S. TsirkinQEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS" 139be17dc90SMichael S. TsirkinLDFLAGS="-g $LDFLAGS" 140be17dc90SMichael S. Tsirkin 141a0f291fcSJuan Quintelagcc_flags="-Wold-style-declaration -Wold-style-definition -fstack-protector-all" 142be17dc90SMichael S. Tsirkincat > $TMPC << EOF 143aa527b65SAurelien Jarnoint main(void) { return 0; } 144be17dc90SMichael S. TsirkinEOF 145be17dc90SMichael S. Tsirkinfor flag in $gcc_flags; do 146aa527b65SAurelien Jarno if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then 147be17dc90SMichael S. Tsirkin QEMU_CFLAGS="$flag $QEMU_CFLAGS" 148be17dc90SMichael S. Tsirkin fi 149be17dc90SMichael S. Tsirkindone 150be17dc90SMichael S. Tsirkin 151ac0df51dSaliguori# check that the C compiler works. 152ac0df51dSaliguoricat > $TMPC <<EOF 153ac0df51dSaliguoriint main(void) {} 154ac0df51dSaliguoriEOF 155ac0df51dSaliguori 15652166aa0SJuan Quintelaif compile_object ; then 157ac0df51dSaliguori : C compiler works ok 158ac0df51dSaliguorielse 159ac0df51dSaliguori echo "ERROR: \"$cc\" either does not exist or does not work" 160ac0df51dSaliguori exit 1 161ac0df51dSaliguorifi 162ac0df51dSaliguori 163ac0df51dSaliguoricheck_define() { 164ac0df51dSaliguoricat > $TMPC <<EOF 165ac0df51dSaliguori#if !defined($1) 166ac0df51dSaliguori#error Not defined 167ac0df51dSaliguori#endif 168ac0df51dSaliguoriint main(void) { return 0; } 169ac0df51dSaliguoriEOF 17052166aa0SJuan Quintela compile_object 171ac0df51dSaliguori} 172ac0df51dSaliguori 1732ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then 1742ff6b91eSJuan Quintela # command line argument 1752ff6b91eSJuan Quintela : 1762ff6b91eSJuan Quintelaelif check_define __i386__ ; then 177ac0df51dSaliguori cpu="i386" 178ac0df51dSaliguorielif check_define __x86_64__ ; then 179ac0df51dSaliguori cpu="x86_64" 1803aa9bd6cSblueswir1elif check_define __sparc__ ; then 1813aa9bd6cSblueswir1 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA 1823aa9bd6cSblueswir1 # They must be specified using --sparc_cpu 1833aa9bd6cSblueswir1 if check_define __arch64__ ; then 1843aa9bd6cSblueswir1 cpu="sparc64" 1853aa9bd6cSblueswir1 else 1863aa9bd6cSblueswir1 cpu="sparc" 1873aa9bd6cSblueswir1 fi 188fdf7ed96Smalcelif check_define _ARCH_PPC ; then 189fdf7ed96Smalc if check_define _ARCH_PPC64 ; then 190fdf7ed96Smalc cpu="ppc64" 191ac0df51dSaliguori else 192fdf7ed96Smalc cpu="ppc" 193fdf7ed96Smalc fi 194afa05235SAurelien Jarnoelif check_define __mips__ ; then 195afa05235SAurelien Jarno cpu="mips" 196fdf7ed96Smalcelse 197fdf7ed96Smalc cpu=`uname -m` 198ac0df51dSaliguorifi 199ac0df51dSaliguori 2005327cf48Sbellardtarget_list="" 2017d13299dSbellardcase "$cpu" in 202afa05235SAurelien Jarno alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64) 203ea8f20f8SJuan Quintela cpu="$cpu" 204ea8f20f8SJuan Quintela ;; 2057d13299dSbellard i386|i486|i586|i686|i86pc|BePC) 20697a847bcSbellard cpu="i386" 2077d13299dSbellard ;; 208aaa5fa14Saurel32 x86_64|amd64) 209aaa5fa14Saurel32 cpu="x86_64" 210aaa5fa14Saurel32 ;; 211ba68055eSbellard armv*b) 212808c4954Sbellard cpu="armv4b" 213808c4954Sbellard ;; 214ba68055eSbellard armv*l) 2157d13299dSbellard cpu="armv4l" 2167d13299dSbellard ;; 217f54b3f92Saurel32 parisc|parisc64) 218f54b3f92Saurel32 cpu="hppa" 219f54b3f92Saurel32 ;; 220afa05235SAurelien Jarno mips*) 221afa05235SAurelien Jarno cpu="mips" 222afa05235SAurelien Jarno ;; 22324e804ecSAlexander Graf s390) 224fb3e5849Sbellard cpu="s390" 225fb3e5849Sbellard ;; 22624e804ecSAlexander Graf s390x) 22724e804ecSAlexander Graf cpu="s390x" 22824e804ecSAlexander Graf ;; 2293142255cSblueswir1 sparc|sun4[cdmuv]) 230ae228531Sbellard cpu="sparc" 231ae228531Sbellard ;; 2327d13299dSbellard *) 2337d13299dSbellard cpu="unknown" 2347d13299dSbellard ;; 2357d13299dSbellardesac 236e2d52ad3SJuan Quintela 2373a3fb96dSStefan Weil# Default value for a variable defining feature "foo". 2383a3fb96dSStefan Weil# * foo="no" feature will only be used if --enable-foo arg is given 2393a3fb96dSStefan Weil# * foo="" feature will be searched for, and if found, will be used 2403a3fb96dSStefan Weil# unless --disable-foo is given 2413a3fb96dSStefan Weil# * foo="yes" this value will only be set by --enable-foo flag. 2423a3fb96dSStefan Weil# feature will searched for, 2433a3fb96dSStefan Weil# if not found, configure exits with error 244e2d52ad3SJuan Quintela# 2453a3fb96dSStefan Weil# Always add --enable-foo and --disable-foo command line args. 2463a3fb96dSStefan Weil# Distributions want to ensure that several features are compiled in, and it 2473a3fb96dSStefan Weil# is impossible without a --enable-foo that exits if a feature is not found. 248e2d52ad3SJuan Quintela 249a20a6f46SJuan Quintelabluez="" 2504ffcedb6SJuan Quintelabrlapi="" 251788c8196SJuan Quintelacurl="" 252c584a6d0SJuan Quintelacurses="" 253a25dba17SJuan Quinteladocs="" 2542df87df7SJuan Quintelafdt="" 255b31a0277SJuan Quintelakvm="" 256dae5079aSJan Kiszkakvm_para="" 257b0a47e79SJuan Quintelanptl="" 258c4198157SJuan Quintelasdl="" 259dfffc653SJuan Quintelasparse="no" 260ee682d27SStefan Weiluuid="" 261dfb278bdSJuan Quintelavde="" 2621be10ad2SJuan Quintelavnc_tls="" 263ea784e3bSJuan Quintelavnc_sasl="" 264fc321b4bSJuan Quintelaxen="" 2655c6c3a6cSChristoph Hellwiglinux_aio="" 266dfb278bdSJuan Quintela 2677d13299dSbellardgprof="no" 268f8393946Saurel32debug_tcg="no" 269b4475aa2SLuiz Capitulinodebug_mon="no" 270f3d08ee6SPaul Brookdebug="no" 2711625af87Saliguoristrip_opt="yes" 2727d13299dSbellardbigendian="no" 27367b915a5Sbellardmingw32="no" 27467b915a5SbellardEXESUF="" 275443f1376Sbellardslirp="yes" 276102a52e4Sbellardfmod_lib="" 277102a52e4Sbellardfmod_inc="" 2782f6a1ab0Sblueswir1oss_lib="" 279b1a550a0Spbrookbsd="no" 2805327cf48Sbellardlinux="no" 281d2c7c9b8Sblueswir1solaris="no" 28205c2a3e7Sbellardprofiler="no" 2835b0753e0Sbellardcocoa="no" 2840a8e90f4Spbrooksoftmmu="yes" 285831b7825Sthslinux_user="no" 286831b7825Sthsdarwin_user="no" 28784778508Sblueswir1bsd_user="no" 288379f6698SPaul Brookguest_base="" 289c5937220Spbrookuname_release="" 290e5d355d1Saliguoriio_thread="no" 2918ff9cbf7Smalcmixemu="no" 292eac30262Saliguorikerneldir="" 293b29fe3edSmalcaix="no" 29477755340Sthsblobs="yes" 2954a19f1ecSpbrookpkgversion="" 2965495ed11SLuiz Capitulinocheck_utests="no" 29734005a00SKirill A. Shutemovuser_pie="no" 29820ff6c80SAnthony Liguorizero_malloc="" 2997d13299dSbellard 3007d13299dSbellard# OS specific 301ac0df51dSaliguoriif check_define __linux__ ; then 302ac0df51dSaliguori targetos="Linux" 303ac0df51dSaliguorielif check_define _WIN32 ; then 304ac0df51dSaliguori targetos='MINGW32' 305169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then 306169dc5d3Sblueswir1 targetos='OpenBSD' 307169dc5d3Sblueswir1elif check_define __sun__ ; then 308169dc5d3Sblueswir1 targetos='SunOS' 309ac0df51dSaliguorielse 3107d13299dSbellard targetos=`uname -s` 311ac0df51dSaliguorifi 3120dbfc675SJuan Quintela 3137d13299dSbellardcase $targetos in 314c326e0afSbellardCYGWIN*) 315c326e0afSbellard mingw32="yes" 316a558ee17SJuan Quintela QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS" 317d5631638Smalc audio_possible_drivers="winwave sdl" 318d5631638Smalc audio_drv_list="winwave" 319c326e0afSbellard;; 32067b915a5SbellardMINGW32*) 32167b915a5Sbellard mingw32="yes" 322d5631638Smalc audio_possible_drivers="winwave dsound sdl fmod" 323d5631638Smalc audio_drv_list="winwave" 32467b915a5Sbellard;; 3255c40d2bdSthsGNU/kFreeBSD) 326a167ba50SAurelien Jarno bsd="yes" 3270c58ac1cSmalc audio_drv_list="oss" 328f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 3295c40d2bdSths;; 3307d3505c5SbellardFreeBSD) 3317d3505c5Sbellard bsd="yes" 332a167ba50SAurelien Jarno make="gmake" 3330c58ac1cSmalc audio_drv_list="oss" 334f34af52cSaurel32 audio_possible_drivers="oss sdl esd pa" 335*f01576f1SJuergen Lock # needed for kinfo_getvmmap(3) in libutil.h 336*f01576f1SJuergen Lock LIBS="-lutil $LIBS" 3377d3505c5Sbellard;; 338c5e97233Sblueswir1DragonFly) 339c5e97233Sblueswir1 bsd="yes" 340a167ba50SAurelien Jarno make="gmake" 341c5e97233Sblueswir1 audio_drv_list="oss" 342c5e97233Sblueswir1 audio_possible_drivers="oss sdl esd pa" 343c5e97233Sblueswir1;; 3447d3505c5SbellardNetBSD) 3457d3505c5Sbellard bsd="yes" 346a167ba50SAurelien Jarno make="gmake" 3470c58ac1cSmalc audio_drv_list="oss" 348c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3498ef92a88Sblueswir1 oss_lib="-lossaudio" 3507d3505c5Sbellard;; 3517d3505c5SbellardOpenBSD) 3527d3505c5Sbellard bsd="yes" 353a167ba50SAurelien Jarno make="gmake" 3540c58ac1cSmalc audio_drv_list="oss" 355c2de5c91Smalc audio_possible_drivers="oss sdl esd" 3562f6a1ab0Sblueswir1 oss_lib="-lossaudio" 3577d3505c5Sbellard;; 35883fb7adfSbellardDarwin) 35983fb7adfSbellard bsd="yes" 36083fb7adfSbellard darwin="yes" 3610dbfc675SJuan Quintela # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can 3620dbfc675SJuan Quintela # run 64-bit userspace code 363aab8588aSmalc if [ "$cpu" = "i386" ] ; then 3641b0f9cc2Saliguori is_x86_64=`sysctl -n hw.optional.x86_64` 365aab8588aSmalc [ "$is_x86_64" = "1" ] && cpu=x86_64 3661b0f9cc2Saliguori fi 3671b0f9cc2Saliguori if [ "$cpu" = "x86_64" ] ; then 368a558ee17SJuan Quintela QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS" 3690c439cbfSJuan Quintela LDFLAGS="-arch x86_64 $LDFLAGS" 3701b0f9cc2Saliguori else 371a558ee17SJuan Quintela QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS" 3721b0f9cc2Saliguori fi 373831b7825Sths darwin_user="yes" 374fd677642Sths cocoa="yes" 3750c58ac1cSmalc audio_drv_list="coreaudio" 376c2de5c91Smalc audio_possible_drivers="coreaudio sdl fmod" 3770c439cbfSJuan Quintela LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS" 3787973f21cSJuan Quintela libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu" 37983fb7adfSbellard;; 380ec530c81SbellardSunOS) 381ec530c81Sbellard solaris="yes" 382c2b84fabSths make="gmake" 383c2b84fabSths install="ginstall" 384fa58948dSBlue Swirl ld="gld" 3850475a5caSths needs_libsunmath="no" 386c2b84fabSths solarisrev=`uname -r | cut -f2 -d.` 387ef18c883Sths # have to select again, because `uname -m` returns i86pc 388ef18c883Sths # even on an x86_64 box. 389ef18c883Sths solariscpu=`isainfo -k` 390ef18c883Sths if test "${solariscpu}" = "amd64" ; then 391ef18c883Sths cpu="x86_64" 392ef18c883Sths fi 393c2b84fabSths if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 3940475a5caSths if test "$solarisrev" -le 9 ; then 3950475a5caSths if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then 3960475a5caSths needs_libsunmath="yes" 397f14bfdf9SJuan Quintela QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS" 398f14bfdf9SJuan Quintela LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS" 399f14bfdf9SJuan Quintela LIBS="-lsunmath $LIBS" 4000475a5caSths else 4010475a5caSths echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" 4020475a5caSths echo "libsunmath from the Sun Studio compilers tools, due to a lack of" 4030475a5caSths echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" 4040475a5caSths echo "Studio 11 can be downloaded from www.sun.com." 4050475a5caSths exit 1 4060475a5caSths fi 4070475a5caSths fi 40886b2bd93Sths fi 4096b4d2ba1Sths if test -f /usr/include/sys/soundcard.h ; then 4100c58ac1cSmalc audio_drv_list="oss" 4116b4d2ba1Sths fi 412c2de5c91Smalc audio_possible_drivers="oss sdl" 413d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h 414d741429aSBlue Swirl QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" 415d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h 416d741429aSBlue Swirl QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" 417a558ee17SJuan Quintela QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS" 418e174c0bbSJuan Quintela LIBS="-lsocket -lnsl -lresolv $LIBS" 419ec530c81Sbellard;; 420b29fe3edSmalcAIX) 421b29fe3edSmalc aix="yes" 422b29fe3edSmalc make="gmake" 423b29fe3edSmalc;; 424fb065187Sbellard*) 4250c58ac1cSmalc audio_drv_list="oss" 426b8e59f18Smalc audio_possible_drivers="oss alsa sdl esd pa" 4275327cf48Sbellard linux="yes" 428831b7825Sths linux_user="yes" 42968063649Sblueswir1 usb="linux" 43007f4ddbfSbellard if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 431c2de5c91Smalc audio_possible_drivers="$audio_possible_drivers fmod" 432c9ec1fe4Sbellard fi 433fb065187Sbellard;; 4347d13299dSbellardesac 4357d13299dSbellard 4367d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 437b1a550a0Spbrook if [ "$darwin" != "yes" ] ; then 43868063649Sblueswir1 usb="bsd" 43983fb7adfSbellard fi 44084778508Sblueswir1 bsd_user="yes" 4417d3505c5Sbellardfi 4427d3505c5Sbellard 4433457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then 4443457a3f8SJuan Quintela EXESUF=".exe" 445a558ee17SJuan Quintela QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" 446e94a7936SStefan Weil # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) 447e94a7936SStefan Weil QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" 448884044aaSJuan Quintela LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" 4493457a3f8SJuan Quintelafi 4503457a3f8SJuan Quintela 4517d13299dSbellard# find source path 452ad064840Spbrooksource_path=`dirname "$0"` 45359faef3aSbalrogsource_path_used="no" 45459faef3aSbalrogworkdir=`pwd` 455ad064840Spbrookif [ -z "$source_path" ]; then 45659faef3aSbalrog source_path=$workdir 457ad064840Spbrookelse 458ad064840Spbrook source_path=`cd "$source_path"; pwd` 4597d13299dSbellardfi 460724db118Spbrook[ -f "$workdir/vl.c" ] || source_path_used="yes" 4617d13299dSbellard 462487fefdbSAnthony Liguoriwerror="" 46385aa5189Sbellard 4647d13299dSbellardfor opt do 465a46e4035Spbrook optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 4667d13299dSbellard case "$opt" in 4672efc3265Sbellard --help|-h) show_help=yes 4682efc3265Sbellard ;; 469b1a550a0Spbrook --prefix=*) prefix="$optarg" 4707d13299dSbellard ;; 471b1a550a0Spbrook --interp-prefix=*) interp_prefix="$optarg" 47232ce6337Sbellard ;; 473b1a550a0Spbrook --source-path=*) source_path="$optarg" 474ad064840Spbrook source_path_used="yes" 4757d13299dSbellard ;; 476ac0df51dSaliguori --cross-prefix=*) 4777d13299dSbellard ;; 478ac0df51dSaliguori --cc=*) 4797d13299dSbellard ;; 480b1a550a0Spbrook --host-cc=*) host_cc="$optarg" 48183469015Sbellard ;; 482b1a550a0Spbrook --make=*) make="$optarg" 4837d13299dSbellard ;; 4846a882643Spbrook --install=*) install="$optarg" 4856a882643Spbrook ;; 486e2a2ed06SJuan Quintela --extra-cflags=*) 4877d13299dSbellard ;; 488e2a2ed06SJuan Quintela --extra-ldflags=*) 4897d13299dSbellard ;; 4902ff6b91eSJuan Quintela --cpu=*) 4917d13299dSbellard ;; 492b1a550a0Spbrook --target-list=*) target_list="$optarg" 493de83cd02Sbellard ;; 4947d13299dSbellard --enable-gprof) gprof="yes" 4957d13299dSbellard ;; 49679427693SLoïc Minier --static) 49779427693SLoïc Minier static="yes" 49879427693SLoïc Minier LDFLAGS="-static $LDFLAGS" 49943ce4dfeSbellard ;; 500ca2fb938SAndre Przywara --sysconfdir=*) sysconfdir="$optarg" 50107381cc1SAnthony Liguori ;; 50297a847bcSbellard --disable-sdl) sdl="no" 50397a847bcSbellard ;; 504c4198157SJuan Quintela --enable-sdl) sdl="yes" 505c4198157SJuan Quintela ;; 506b1a550a0Spbrook --fmod-lib=*) fmod_lib="$optarg" 507102a52e4Sbellard ;; 508c2de5c91Smalc --fmod-inc=*) fmod_inc="$optarg" 509c2de5c91Smalc ;; 5102f6a1ab0Sblueswir1 --oss-lib=*) oss_lib="$optarg" 5112f6a1ab0Sblueswir1 ;; 5122fa7d3bfSmalc --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'` 5130c58ac1cSmalc ;; 5140c58ac1cSmalc --audio-drv-list=*) audio_drv_list="$optarg" 5150c58ac1cSmalc ;; 516eb852011SMarkus Armbruster --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'` 517eb852011SMarkus Armbruster ;; 518f8393946Saurel32 --enable-debug-tcg) debug_tcg="yes" 519f8393946Saurel32 ;; 520f8393946Saurel32 --disable-debug-tcg) debug_tcg="no" 521f8393946Saurel32 ;; 522b4475aa2SLuiz Capitulino --enable-debug-mon) debug_mon="yes" 523b4475aa2SLuiz Capitulino ;; 524b4475aa2SLuiz Capitulino --disable-debug-mon) debug_mon="no" 525b4475aa2SLuiz Capitulino ;; 526f3d08ee6SPaul Brook --enable-debug) 527f3d08ee6SPaul Brook # Enable debugging options that aren't excessively noisy 528f3d08ee6SPaul Brook debug_tcg="yes" 529b4475aa2SLuiz Capitulino debug_mon="yes" 530f3d08ee6SPaul Brook debug="yes" 531f3d08ee6SPaul Brook strip_opt="no" 532f3d08ee6SPaul Brook ;; 53303b4fe7dSaliguori --enable-sparse) sparse="yes" 53403b4fe7dSaliguori ;; 53503b4fe7dSaliguori --disable-sparse) sparse="no" 53603b4fe7dSaliguori ;; 5371625af87Saliguori --disable-strip) strip_opt="no" 5381625af87Saliguori ;; 5398d5d2d4cSths --disable-vnc-tls) vnc_tls="no" 5408d5d2d4cSths ;; 5411be10ad2SJuan Quintela --enable-vnc-tls) vnc_tls="yes" 5421be10ad2SJuan Quintela ;; 5432f9606b3Saliguori --disable-vnc-sasl) vnc_sasl="no" 5442f9606b3Saliguori ;; 545ea784e3bSJuan Quintela --enable-vnc-sasl) vnc_sasl="yes" 546ea784e3bSJuan Quintela ;; 547443f1376Sbellard --disable-slirp) slirp="no" 548c20709aaSbellard ;; 549ee682d27SStefan Weil --disable-uuid) uuid="no" 550ee682d27SStefan Weil ;; 551ee682d27SStefan Weil --enable-uuid) uuid="yes" 552ee682d27SStefan Weil ;; 553e0e6c8c0Saliguori --disable-vde) vde="no" 5548a16d273Sths ;; 555dfb278bdSJuan Quintela --enable-vde) vde="yes" 556dfb278bdSJuan Quintela ;; 557e37630caSaliguori --disable-xen) xen="no" 558e37630caSaliguori ;; 559fc321b4bSJuan Quintela --enable-xen) xen="yes" 560fc321b4bSJuan Quintela ;; 5612e4d9fb1Saurel32 --disable-brlapi) brlapi="no" 5622e4d9fb1Saurel32 ;; 5634ffcedb6SJuan Quintela --enable-brlapi) brlapi="yes" 5644ffcedb6SJuan Quintela ;; 565fb599c9aSbalrog --disable-bluez) bluez="no" 566fb599c9aSbalrog ;; 567a20a6f46SJuan Quintela --enable-bluez) bluez="yes" 568a20a6f46SJuan Quintela ;; 5697ba1e619Saliguori --disable-kvm) kvm="no" 5707ba1e619Saliguori ;; 571b31a0277SJuan Quintela --enable-kvm) kvm="yes" 572b31a0277SJuan Quintela ;; 57305c2a3e7Sbellard --enable-profiler) profiler="yes" 57405c2a3e7Sbellard ;; 575c2de5c91Smalc --enable-cocoa) 576c2de5c91Smalc cocoa="yes" ; 577c2de5c91Smalc sdl="no" ; 578c2de5c91Smalc audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`" 5795b0753e0Sbellard ;; 580cad25d69Spbrook --disable-system) softmmu="no" 5810a8e90f4Spbrook ;; 582cad25d69Spbrook --enable-system) softmmu="yes" 5830a8e90f4Spbrook ;; 5840953a80fSZachary Amsden --disable-user) 5850953a80fSZachary Amsden linux_user="no" ; 5860953a80fSZachary Amsden bsd_user="no" ; 5870953a80fSZachary Amsden darwin_user="no" 5880953a80fSZachary Amsden ;; 5890953a80fSZachary Amsden --enable-user) ;; 590831b7825Sths --disable-linux-user) linux_user="no" 5910a8e90f4Spbrook ;; 592831b7825Sths --enable-linux-user) linux_user="yes" 593831b7825Sths ;; 594831b7825Sths --disable-darwin-user) darwin_user="no" 595831b7825Sths ;; 596831b7825Sths --enable-darwin-user) darwin_user="yes" 5970a8e90f4Spbrook ;; 59884778508Sblueswir1 --disable-bsd-user) bsd_user="no" 59984778508Sblueswir1 ;; 60084778508Sblueswir1 --enable-bsd-user) bsd_user="yes" 60184778508Sblueswir1 ;; 602379f6698SPaul Brook --enable-guest-base) guest_base="yes" 603379f6698SPaul Brook ;; 604379f6698SPaul Brook --disable-guest-base) guest_base="no" 605379f6698SPaul Brook ;; 60634005a00SKirill A. Shutemov --enable-user-pie) user_pie="yes" 60734005a00SKirill A. Shutemov ;; 60834005a00SKirill A. Shutemov --disable-user-pie) user_pie="no" 60934005a00SKirill A. Shutemov ;; 610c5937220Spbrook --enable-uname-release=*) uname_release="$optarg" 611c5937220Spbrook ;; 6123142255cSblueswir1 --sparc_cpu=*) 6133142255cSblueswir1 ;; 61485aa5189Sbellard --enable-werror) werror="yes" 61585aa5189Sbellard ;; 61685aa5189Sbellard --disable-werror) werror="no" 61785aa5189Sbellard ;; 6184d3b6f6eSbalrog --disable-curses) curses="no" 6194d3b6f6eSbalrog ;; 620c584a6d0SJuan Quintela --enable-curses) curses="yes" 621c584a6d0SJuan Quintela ;; 622769ce76dSAlexander Graf --disable-curl) curl="no" 623769ce76dSAlexander Graf ;; 624788c8196SJuan Quintela --enable-curl) curl="yes" 625788c8196SJuan Quintela ;; 6262df87df7SJuan Quintela --disable-fdt) fdt="no" 6272df87df7SJuan Quintela ;; 6282df87df7SJuan Quintela --enable-fdt) fdt="yes" 6292df87df7SJuan Quintela ;; 6305495ed11SLuiz Capitulino --disable-check-utests) check_utests="no" 6315495ed11SLuiz Capitulino ;; 6325495ed11SLuiz Capitulino --enable-check-utests) check_utests="yes" 6335495ed11SLuiz Capitulino ;; 634bd0c5661Spbrook --disable-nptl) nptl="no" 635bd0c5661Spbrook ;; 636b0a47e79SJuan Quintela --enable-nptl) nptl="yes" 637b0a47e79SJuan Quintela ;; 6388ff9cbf7Smalc --enable-mixemu) mixemu="yes" 6398ff9cbf7Smalc ;; 6405c6c3a6cSChristoph Hellwig --disable-linux-aio) linux_aio="no" 6415c6c3a6cSChristoph Hellwig ;; 6425c6c3a6cSChristoph Hellwig --enable-linux-aio) linux_aio="yes" 6435c6c3a6cSChristoph Hellwig ;; 644e5d355d1Saliguori --enable-io-thread) io_thread="yes" 645e5d355d1Saliguori ;; 64677755340Sths --disable-blobs) blobs="no" 64777755340Sths ;; 648eac30262Saliguori --kerneldir=*) kerneldir="$optarg" 649eac30262Saliguori ;; 6504a19f1ecSpbrook --with-pkgversion=*) pkgversion=" ($optarg)" 6514a19f1ecSpbrook ;; 652a25dba17SJuan Quintela --disable-docs) docs="no" 65370ec5dc0SAnthony Liguori ;; 654a25dba17SJuan Quintela --enable-docs) docs="yes" 65583a3ab8bSJuan Quintela ;; 6567f1559c6Sbalrog *) echo "ERROR: unknown option $opt"; show_help="yes" 6577f1559c6Sbalrog ;; 6587d13299dSbellard esac 6597d13299dSbellarddone 6607d13299dSbellard 6613142255cSblueswir1# 6623142255cSblueswir1# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right 663a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) 6643142255cSblueswir1# 665379f6698SPaul Brookhost_guest_base="no" 66640293e58Sbellardcase "$cpu" in 667ed968ff1SJuan Quintela sparc) case $sparc_cpu in 668ed968ff1SJuan Quintela v7|v8) 669a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 670ed968ff1SJuan Quintela ;; 671ed968ff1SJuan Quintela v8plus|v8plusa) 672a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS" 673ed968ff1SJuan Quintela ;; 674ed968ff1SJuan Quintela *) # sparc_cpu not defined in the command line 675a558ee17SJuan Quintela QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS" 676ed968ff1SJuan Quintela esac 6770c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 678a558ee17SJuan Quintela QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS" 679762e8230Sblueswir1 if test "$solaris" = "no" ; then 680a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS" 681c81da56eSJuan Quintela helper_cflags="-ffixed-i0" 682762e8230Sblueswir1 fi 6833142255cSblueswir1 ;; 684ed968ff1SJuan Quintela sparc64) 685a558ee17SJuan Quintela QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS" 6860c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 687a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS" 688ed968ff1SJuan Quintela if test "$solaris" != "no" ; then 689a558ee17SJuan Quintela QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS" 690762e8230Sblueswir1 fi 6913142255cSblueswir1 ;; 69276d83bdeSths s390) 693a558ee17SJuan Quintela QEMU_CFLAGS="-march=z900 $QEMU_CFLAGS" 69476d83bdeSths ;; 69540293e58Sbellard i386) 696a558ee17SJuan Quintela QEMU_CFLAGS="-m32 $QEMU_CFLAGS" 6970c439cbfSJuan Quintela LDFLAGS="-m32 $LDFLAGS" 698c81da56eSJuan Quintela helper_cflags="-fomit-frame-pointer" 699379f6698SPaul Brook host_guest_base="yes" 70040293e58Sbellard ;; 70140293e58Sbellard x86_64) 702a558ee17SJuan Quintela QEMU_CFLAGS="-m64 $QEMU_CFLAGS" 7030c439cbfSJuan Quintela LDFLAGS="-m64 $LDFLAGS" 704379f6698SPaul Brook host_guest_base="yes" 705379f6698SPaul Brook ;; 706379f6698SPaul Brook arm*) 707379f6698SPaul Brook host_guest_base="yes" 70840293e58Sbellard ;; 709f6548c0aSmalc ppc*) 710f6548c0aSmalc host_guest_base="yes" 711f6548c0aSmalc ;; 712cc01cc8eSAurelien Jarno mips*) 713cc01cc8eSAurelien Jarno host_guest_base="yes" 714cc01cc8eSAurelien Jarno ;; 7153142255cSblueswir1esac 7163142255cSblueswir1 717379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base" 718379f6698SPaul Brook 719af5db58eSpbrookif test x"$show_help" = x"yes" ; then 720af5db58eSpbrookcat << EOF 721af5db58eSpbrook 722af5db58eSpbrookUsage: configure [options] 723af5db58eSpbrookOptions: [defaults in brackets after descriptions] 724af5db58eSpbrook 725af5db58eSpbrookEOF 726af5db58eSpbrookecho "Standard options:" 727af5db58eSpbrookecho " --help print this message" 728af5db58eSpbrookecho " --prefix=PREFIX install in PREFIX [$prefix]" 729af5db58eSpbrookecho " --interp-prefix=PREFIX where to find shared libraries, etc." 730af5db58eSpbrookecho " use %M for cpu name [$interp_prefix]" 731af5db58eSpbrookecho " --target-list=LIST set target list [$target_list]" 732af5db58eSpbrookecho "" 733af5db58eSpbrookecho "Advanced options (experts only):" 734af5db58eSpbrookecho " --source-path=PATH path of source code [$source_path]" 735af5db58eSpbrookecho " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" 736af5db58eSpbrookecho " --cc=CC use C compiler CC [$cc]" 737af5db58eSpbrookecho " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc." 738a558ee17SJuan Quintelaecho " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" 739e3fc14c3SJan Kiszkaecho " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" 740af5db58eSpbrookecho " --make=MAKE use specified make [$make]" 7416a882643Spbrookecho " --install=INSTALL use specified install [$install]" 742af5db58eSpbrookecho " --static enable static build [$static]" 74307381cc1SAnthony Liguoriecho " --sysconfdir=PATH install config in PATH" 744f8393946Saurel32echo " --enable-debug-tcg enable TCG debugging" 745f8393946Saurel32echo " --disable-debug-tcg disable TCG debugging (default)" 74609695a4aSStefan Weilecho " --enable-debug enable common debug build options" 747890b1658Saliguoriecho " --enable-sparse enable sparse checker" 748890b1658Saliguoriecho " --disable-sparse disable sparse checker (default)" 7491625af87Saliguoriecho " --disable-strip disable stripping binaries" 75085aa5189Sbellardecho " --disable-werror disable compilation abort on warning" 751fe8f78e4Sbalrogecho " --disable-sdl disable SDL" 752c4198157SJuan Quintelaecho " --enable-sdl enable SDL" 753af5db58eSpbrookecho " --enable-cocoa enable COCOA (Mac OS X only)" 754c2de5c91Smalcecho " --audio-drv-list=LIST set audio drivers list:" 755c2de5c91Smalcecho " Available drivers: $audio_possible_drivers" 7564c9b53e3Smalcecho " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]" 7574c9b53e3Smalcecho " Available cards: $audio_possible_cards" 758eb852011SMarkus Armbrusterecho " --block-drv-whitelist=L set block driver whitelist" 759eb852011SMarkus Armbrusterecho " (affects only QEMU, not qemu-img)" 7608ff9cbf7Smalcecho " --enable-mixemu enable mixer emulation" 761e37630caSaliguoriecho " --disable-xen disable xen backend driver support" 762fc321b4bSJuan Quintelaecho " --enable-xen enable xen backend driver support" 7632e4d9fb1Saurel32echo " --disable-brlapi disable BrlAPI" 7644ffcedb6SJuan Quintelaecho " --enable-brlapi enable BrlAPI" 7658d5d2d4cSthsecho " --disable-vnc-tls disable TLS encryption for VNC server" 7661be10ad2SJuan Quintelaecho " --enable-vnc-tls enable TLS encryption for VNC server" 7672f9606b3Saliguoriecho " --disable-vnc-sasl disable SASL encryption for VNC server" 768ea784e3bSJuan Quintelaecho " --enable-vnc-sasl enable SASL encryption for VNC server" 769af896aaaSpbrookecho " --disable-curses disable curses output" 770c584a6d0SJuan Quintelaecho " --enable-curses enable curses output" 771769ce76dSAlexander Grafecho " --disable-curl disable curl connectivity" 772788c8196SJuan Quintelaecho " --enable-curl enable curl connectivity" 7732df87df7SJuan Quintelaecho " --disable-fdt disable fdt device tree" 7742df87df7SJuan Quintelaecho " --enable-fdt enable fdt device tree" 7755495ed11SLuiz Capitulinoecho " --disable-check-utests disable check unit-tests" 7765495ed11SLuiz Capitulinoecho " --enable-check-utests enable check unit-tests" 777fb599c9aSbalrogecho " --disable-bluez disable bluez stack connectivity" 778a20a6f46SJuan Quintelaecho " --enable-bluez enable bluez stack connectivity" 7797ba1e619Saliguoriecho " --disable-kvm disable KVM acceleration support" 780b31a0277SJuan Quintelaecho " --enable-kvm enable KVM acceleration support" 781bd0c5661Spbrookecho " --disable-nptl disable usermode NPTL support" 782e5934d33SAndre Przywaraecho " --enable-nptl enable usermode NPTL support" 783af5db58eSpbrookecho " --enable-system enable all system emulation targets" 784af5db58eSpbrookecho " --disable-system disable all system emulation targets" 7850953a80fSZachary Amsdenecho " --enable-user enable supported user emulation targets" 7860953a80fSZachary Amsdenecho " --disable-user disable all user emulation targets" 787831b7825Sthsecho " --enable-linux-user enable all linux usermode emulation targets" 788831b7825Sthsecho " --disable-linux-user disable all linux usermode emulation targets" 789831b7825Sthsecho " --enable-darwin-user enable all darwin usermode emulation targets" 790831b7825Sthsecho " --disable-darwin-user disable all darwin usermode emulation targets" 79184778508Sblueswir1echo " --enable-bsd-user enable all BSD usermode emulation targets" 79284778508Sblueswir1echo " --disable-bsd-user disable all BSD usermode emulation targets" 793379f6698SPaul Brookecho " --enable-guest-base enable GUEST_BASE support for usermode" 794379f6698SPaul Brookecho " emulation targets" 795379f6698SPaul Brookecho " --disable-guest-base disable GUEST_BASE support" 79634005a00SKirill A. Shutemovecho " --enable-user-pie build usermode emulation targets as PIE" 79734005a00SKirill A. Shutemovecho " --disable-user-pie do not build usermode emulation targets as PIE" 798af5db58eSpbrookecho " --fmod-lib path to FMOD library" 799af5db58eSpbrookecho " --fmod-inc path to FMOD includes" 8002f6a1ab0Sblueswir1echo " --oss-lib path to OSS library" 801c5937220Spbrookecho " --enable-uname-release=R Return R for uname -r in usermode emulation" 8023142255cSblueswir1echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" 803ee682d27SStefan Weilecho " --disable-uuid disable uuid support" 804ee682d27SStefan Weilecho " --enable-uuid enable uuid support" 805e0e6c8c0Saliguoriecho " --disable-vde disable support for vde network" 806dfb278bdSJuan Quintelaecho " --enable-vde enable support for vde network" 8075c6c3a6cSChristoph Hellwigecho " --disable-linux-aio disable Linux AIO support" 8085c6c3a6cSChristoph Hellwigecho " --enable-linux-aio enable Linux AIO support" 809e5d355d1Saliguoriecho " --enable-io-thread enable IO thread" 81077755340Sthsecho " --disable-blobs disable installing provided firmware blobs" 811eac30262Saliguoriecho " --kerneldir=PATH look for kernel includes in PATH" 812d2807bc9SDirk Ullrichecho " --enable-docs enable documentation build" 813d2807bc9SDirk Ullrichecho " --disable-docs disable documentation build" 814af5db58eSpbrookecho "" 8155bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched" 816af5db58eSpbrookexit 1 817af5db58eSpbrookfi 818af5db58eSpbrook 819ec530c81Sbellard# 820ec530c81Sbellard# Solaris specific configure tool chain decisions 821ec530c81Sbellard# 822ec530c81Sbellardif test "$solaris" = "yes" ; then 8236792aa11SLoïc Minier if has $install; then 8246792aa11SLoïc Minier : 8256792aa11SLoïc Minier else 826ec530c81Sbellard echo "Solaris install program not found. Use --install=/usr/ucb/install or" 827ec530c81Sbellard echo "install fileutils from www.blastwave.org using pkg-get -i fileutils" 828ec530c81Sbellard echo "to get ginstall which is used by default (which lives in /opt/csw/bin)" 829ec530c81Sbellard exit 1 830ec530c81Sbellard fi 8316792aa11SLoïc Minier if test "`path_of $install`" = "/usr/sbin/install" ; then 832ec530c81Sbellard echo "Error: Solaris /usr/sbin/install is not an appropriate install program." 833ec530c81Sbellard echo "try ginstall from the GNU fileutils available from www.blastwave.org" 834ec530c81Sbellard echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install" 835ec530c81Sbellard exit 1 836ec530c81Sbellard fi 8376792aa11SLoïc Minier if has ar; then 8386792aa11SLoïc Minier : 8396792aa11SLoïc Minier else 840ec530c81Sbellard echo "Error: No path includes ar" 841ec530c81Sbellard if test -f /usr/ccs/bin/ar ; then 842ec530c81Sbellard echo "Add /usr/ccs/bin to your path and rerun configure" 843ec530c81Sbellard fi 844ec530c81Sbellard exit 1 845ec530c81Sbellard fi 846ec530c81Sbellardfi 847ec530c81Sbellard 848ec530c81Sbellard 8495327cf48Sbellardif test -z "$target_list" ; then 8505327cf48Sbellard# these targets are portable 8510a8e90f4Spbrook if [ "$softmmu" = "yes" ] ; then 8522408a527Saurel32 target_list="\ 8532408a527Saurel32i386-softmmu \ 8542408a527Saurel32x86_64-softmmu \ 8552408a527Saurel32arm-softmmu \ 8562408a527Saurel32cris-softmmu \ 8572408a527Saurel32m68k-softmmu \ 85872b675caSEdgar E. Iglesiasmicroblaze-softmmu \ 8592408a527Saurel32mips-softmmu \ 8602408a527Saurel32mipsel-softmmu \ 8612408a527Saurel32mips64-softmmu \ 8622408a527Saurel32mips64el-softmmu \ 8632408a527Saurel32ppc-softmmu \ 8642408a527Saurel32ppcemb-softmmu \ 8652408a527Saurel32ppc64-softmmu \ 8662408a527Saurel32sh4-softmmu \ 8672408a527Saurel32sh4eb-softmmu \ 8682408a527Saurel32sparc-softmmu \ 8691b64fcaeSIgor V. Kovalenkosparc64-softmmu \ 8702408a527Saurel32" 8710a8e90f4Spbrook fi 8725327cf48Sbellard# the following are Linux specific 873831b7825Sths if [ "$linux_user" = "yes" ] ; then 8742408a527Saurel32 target_list="${target_list}\ 8752408a527Saurel32i386-linux-user \ 8762408a527Saurel32x86_64-linux-user \ 8772408a527Saurel32alpha-linux-user \ 8782408a527Saurel32arm-linux-user \ 8792408a527Saurel32armeb-linux-user \ 8802408a527Saurel32cris-linux-user \ 8812408a527Saurel32m68k-linux-user \ 88272b675caSEdgar E. Iglesiasmicroblaze-linux-user \ 8832408a527Saurel32mips-linux-user \ 8842408a527Saurel32mipsel-linux-user \ 8852408a527Saurel32ppc-linux-user \ 8862408a527Saurel32ppc64-linux-user \ 8872408a527Saurel32ppc64abi32-linux-user \ 8882408a527Saurel32sh4-linux-user \ 8892408a527Saurel32sh4eb-linux-user \ 8902408a527Saurel32sparc-linux-user \ 8912408a527Saurel32sparc64-linux-user \ 8922408a527Saurel32sparc32plus-linux-user \ 8932408a527Saurel32" 894831b7825Sths fi 895831b7825Sths# the following are Darwin specific 896831b7825Sths if [ "$darwin_user" = "yes" ] ; then 8972408a527Saurel32 target_list="$target_list i386-darwin-user ppc-darwin-user " 8985327cf48Sbellard fi 89984778508Sblueswir1# the following are BSD specific 90084778508Sblueswir1 if [ "$bsd_user" = "yes" ] ; then 90184778508Sblueswir1 target_list="${target_list}\ 90231fc12dfSblueswir1i386-bsd-user \ 90331fc12dfSblueswir1x86_64-bsd-user \ 90431fc12dfSblueswir1sparc-bsd-user \ 90584778508Sblueswir1sparc64-bsd-user \ 90684778508Sblueswir1" 90784778508Sblueswir1 fi 9086e20a45fSbellardelse 909b1a550a0Spbrook target_list=`echo "$target_list" | sed -e 's/,/ /g'` 9105327cf48Sbellardfi 9110a8e90f4Spbrookif test -z "$target_list" ; then 9120a8e90f4Spbrook echo "No targets enabled" 9130a8e90f4Spbrook exit 1 9140a8e90f4Spbrookfi 9155327cf48Sbellard 916249247c9SJuan Quintelafeature_not_found() { 917249247c9SJuan Quintela feature=$1 918249247c9SJuan Quintela 919249247c9SJuan Quintela echo "ERROR" 920249247c9SJuan Quintela echo "ERROR: User requested feature $feature" 9219332f6a2SSebastian Herbszt echo "ERROR: configure was not able to find it" 922249247c9SJuan Quintela echo "ERROR" 923249247c9SJuan Quintela exit 1; 924249247c9SJuan Quintela} 925249247c9SJuan Quintela 9267d13299dSbellardif test -z "$cross_prefix" ; then 9277d13299dSbellard 9287d13299dSbellard# --- 9297d13299dSbellard# big/little endian test 9307d13299dSbellardcat > $TMPC << EOF 9317d13299dSbellard#include <inttypes.h> 9327d13299dSbellardint main(int argc, char ** argv){ 9337d13299dSbellard volatile uint32_t i=0x01234567; 9347d13299dSbellard return (*((uint8_t*)(&i))) == 0x67; 9357d13299dSbellard} 9367d13299dSbellardEOF 9377d13299dSbellard 93852166aa0SJuan Quintelaif compile_prog "" "" ; then 9397d13299dSbellard$TMPE && bigendian="yes" 9407d13299dSbellardelse 9417d13299dSbellardecho big/little test failed 9427d13299dSbellardfi 9437d13299dSbellard 9447d13299dSbellardelse 9457d13299dSbellard 9467d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess 947ea8f20f8SJuan Quintelacase "$cpu" in 94824e804ecSAlexander Graf armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 949ea8f20f8SJuan Quintela bigendian=yes 950ea8f20f8SJuan Quintela ;; 951ea8f20f8SJuan Quintelaesac 9527d13299dSbellard 9537d13299dSbellardfi 9547d13299dSbellard 955b6853697Sbellard# host long bits test 956b6853697Sbellardhostlongbits="32" 957ea8f20f8SJuan Quintelacase "$cpu" in 95824e804ecSAlexander Graf x86_64|alpha|ia64|sparc64|ppc64|s390x) 959ea8f20f8SJuan Quintela hostlongbits=64 960ea8f20f8SJuan Quintela ;; 961ea8f20f8SJuan Quintelaesac 962b6853697Sbellard 963b0a47e79SJuan Quintela 964b0a47e79SJuan Quintela########################################## 965b0a47e79SJuan Quintela# NPTL probe 966b0a47e79SJuan Quintela 967b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then 968bd0c5661Spbrook cat > $TMPC <<EOF 969bd0c5661Spbrook#include <sched.h> 97030813ceaSpbrook#include <linux/futex.h> 971bd0c5661Spbrookvoid foo() 972bd0c5661Spbrook{ 973bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT) 974bd0c5661Spbrook#error bork 975bd0c5661Spbrook#endif 976bd0c5661Spbrook} 977bd0c5661SpbrookEOF 978bd0c5661Spbrook 97952166aa0SJuan Quintela if compile_object ; then 980b0a47e79SJuan Quintela nptl=yes 981bd0c5661Spbrook else 982b0a47e79SJuan Quintela if test "$nptl" = "yes" ; then 983b0a47e79SJuan Quintela feature_not_found "nptl" 984b0a47e79SJuan Quintela fi 985b0a47e79SJuan Quintela nptl=no 986b0a47e79SJuan Quintela fi 987bd0c5661Spbrookfi 988bd0c5661Spbrook 98911d9f695Sbellard########################################## 990ac62922eSbalrog# zlib check 991ac62922eSbalrog 992ac62922eSbalrogcat > $TMPC << EOF 993ac62922eSbalrog#include <zlib.h> 994ac62922eSbalrogint main(void) { zlibVersion(); return 0; } 995ac62922eSbalrogEOF 99652166aa0SJuan Quintelaif compile_prog "" "-lz" ; then 997ac62922eSbalrog : 998ac62922eSbalrogelse 999ac62922eSbalrog echo 1000ac62922eSbalrog echo "Error: zlib check failed" 1001ac62922eSbalrog echo "Make sure to have the zlib libs and headers installed." 1002ac62922eSbalrog echo 1003ac62922eSbalrog exit 1 1004ac62922eSbalrogfi 1005ac62922eSbalrog 1006ac62922eSbalrog########################################## 1007e37630caSaliguori# xen probe 1008e37630caSaliguori 1009fc321b4bSJuan Quintelaif test "$xen" != "no" ; then 1010b2266beeSJuan Quintela xen_libs="-lxenstore -lxenctrl -lxenguest" 1011e37630caSaliguori cat > $TMPC <<EOF 1012e37630caSaliguori#include <xenctrl.h> 1013e37630caSaliguori#include <xs.h> 1014df7a607bSChristoph Eggerint main(void) { xs_daemon_open(); xc_interface_open(); return 0; } 1015e37630caSaliguoriEOF 101652166aa0SJuan Quintela if compile_prog "" "$xen_libs" ; then 1017fc321b4bSJuan Quintela xen=yes 10183efd632bSJuan Quintela libs_softmmu="$xen_libs $libs_softmmu" 1019e37630caSaliguori else 1020fc321b4bSJuan Quintela if test "$xen" = "yes" ; then 1021fc321b4bSJuan Quintela feature_not_found "xen" 1022fc321b4bSJuan Quintela fi 1023fc321b4bSJuan Quintela xen=no 1024e37630caSaliguori fi 1025e37630caSaliguorifi 1026e37630caSaliguori 1027e37630caSaliguori########################################## 1028f91672e5SPaolo Bonzini# pkgconfig probe 1029f91672e5SPaolo Bonzini 1030f91672e5SPaolo Bonzinipkgconfig="${cross_prefix}pkg-config" 10310dba6195SLoïc Minierif ! has $pkgconfig; then 1032f91672e5SPaolo Bonzini # likely not cross compiling, or hope for the best 1033f91672e5SPaolo Bonzini pkgconfig=pkg-config 1034f91672e5SPaolo Bonzinifi 1035f91672e5SPaolo Bonzini 1036f91672e5SPaolo Bonzini########################################## 1037dfffc653SJuan Quintela# Sparse probe 1038dfffc653SJuan Quintelaif test "$sparse" != "no" ; then 10390dba6195SLoïc Minier if has cgcc; then 1040dfffc653SJuan Quintela sparse=yes 1041dfffc653SJuan Quintela else 1042dfffc653SJuan Quintela if test "$sparse" = "yes" ; then 1043dfffc653SJuan Quintela feature_not_found "sparse" 1044dfffc653SJuan Quintela fi 1045dfffc653SJuan Quintela sparse=no 1046dfffc653SJuan Quintela fi 1047dfffc653SJuan Quintelafi 1048dfffc653SJuan Quintela 1049dfffc653SJuan Quintela########################################## 105011d9f695Sbellard# SDL probe 105111d9f695Sbellard 10529316f803SPaolo Bonziniif $pkgconfig sdl --modversion >/dev/null 2>&1; then 10539316f803SPaolo Bonzini sdlconfig="$pkgconfig sdl" 10549316f803SPaolo Bonzini _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` 10550dba6195SLoïc Minierelif has sdl-config; then 10569316f803SPaolo Bonzini sdlconfig='sdl-config' 10579316f803SPaolo Bonzini _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` 1058a0dfd8a4SLoïc Minierelse 1059a0dfd8a4SLoïc Minier if test "$sdl" = "yes" ; then 1060a0dfd8a4SLoïc Minier feature_not_found "sdl" 1061a0dfd8a4SLoïc Minier fi 1062a0dfd8a4SLoïc Minier sdl=no 10639316f803SPaolo Bonzinifi 106411d9f695Sbellard 10659316f803SPaolo Bonzinisdl_too_old=no 1066c4198157SJuan Quintelaif test "$sdl" != "no" ; then 106711d9f695Sbellard cat > $TMPC << EOF 106811d9f695Sbellard#include <SDL.h> 106911d9f695Sbellard#undef main /* We don't want SDL to override our main() */ 107011d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); } 107111d9f695SbellardEOF 10729316f803SPaolo Bonzini sdl_cflags=`$sdlconfig --cflags 2> /dev/null` 107374f42e18STeLeMan if test "$static" = "yes" ; then 107474f42e18STeLeMan sdl_libs=`$sdlconfig --static-libs 2>/dev/null` 107574f42e18STeLeMan else 10769316f803SPaolo Bonzini sdl_libs=`$sdlconfig --libs 2> /dev/null` 107774f42e18STeLeMan fi 107852166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 107911d9f695Sbellard if test "$_sdlversion" -lt 121 ; then 108011d9f695Sbellard sdl_too_old=yes 108111d9f695Sbellard else 1082fd677642Sths if test "$cocoa" = "no" ; then 108311d9f695Sbellard sdl=yes 108411d9f695Sbellard fi 1085fd677642Sths fi 10867c1f25b4Sbellard 108767c274d3SPaolo Bonzini # static link with sdl ? (note: sdl.pc's --static --libs is broken) 10881ac88f28SJuan Quintela if test "$sdl" = "yes" -a "$static" = "yes" ; then 108967c274d3SPaolo Bonzini if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then 1090f8aa6c7bSStefan Weil sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`" 1091f8aa6c7bSStefan Weil sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`" 109211d9f695Sbellard fi 109352166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 10941ac88f28SJuan Quintela : 10951ac88f28SJuan Quintela else 10961ac88f28SJuan Quintela sdl=no 10977c1f25b4Sbellard fi 10987c1f25b4Sbellard fi # static link 1099c4198157SJuan Quintela else # sdl not found 1100c4198157SJuan Quintela if test "$sdl" = "yes" ; then 1101c4198157SJuan Quintela feature_not_found "sdl" 1102c4198157SJuan Quintela fi 1103c4198157SJuan Quintela sdl=no 11047c1f25b4Sbellard fi # sdl compile test 1105fd677642Sthsfi 110611d9f695Sbellard 11075368a422Saliguoriif test "$sdl" = "yes" ; then 11085368a422Saliguori cat > $TMPC <<EOF 11095368a422Saliguori#include <SDL.h> 11105368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11) 11115368a422Saliguori#include <X11/XKBlib.h> 11125368a422Saliguori#else 11135368a422Saliguori#error No x11 support 11145368a422Saliguori#endif 11155368a422Saliguoriint main(void) { return 0; } 11165368a422SaliguoriEOF 111752166aa0SJuan Quintela if compile_prog "$sdl_cflags" "$sdl_libs" ; then 1118681306dfSJuan Quintela sdl_libs="$sdl_libs -lX11" 11195368a422Saliguori fi 112007d9ac44SJuan Quintela if test "$mingw32" = "yes" ; then 112107d9ac44SJuan Quintela sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole" 112207d9ac44SJuan Quintela fi 11230705667eSJuan Quintela libs_softmmu="$sdl_libs $libs_softmmu" 11245368a422Saliguorifi 11255368a422Saliguori 11268f28f3fbSths########################################## 11278d5d2d4cSths# VNC TLS detection 11281be10ad2SJuan Quintelaif test "$vnc_tls" != "no" ; then 1129ae6b5e5aSaliguori cat > $TMPC <<EOF 1130ae6b5e5aSaliguori#include <gnutls/gnutls.h> 1131ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } 1132ae6b5e5aSaliguoriEOF 1133f91672e5SPaolo Bonzini vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null` 1134f91672e5SPaolo Bonzini vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null` 113552166aa0SJuan Quintela if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then 11361be10ad2SJuan Quintela vnc_tls=yes 1137a5e32cc9SJuan Quintela libs_softmmu="$vnc_tls_libs $libs_softmmu" 1138ae6b5e5aSaliguori else 11391be10ad2SJuan Quintela if test "$vnc_tls" = "yes" ; then 11401be10ad2SJuan Quintela feature_not_found "vnc-tls" 11411be10ad2SJuan Quintela fi 11421be10ad2SJuan Quintela vnc_tls=no 11438d5d2d4cSths fi 11448d5d2d4cSthsfi 11458d5d2d4cSths 11468d5d2d4cSths########################################## 11472f9606b3Saliguori# VNC SASL detection 11483aefa744SJuan Quintelaif test "$vnc_sasl" != "no" ; then 11492f9606b3Saliguori cat > $TMPC <<EOF 11502f9606b3Saliguori#include <sasl/sasl.h> 11512f9606b3Saliguori#include <stdio.h> 11522f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; } 11532f9606b3SaliguoriEOF 11542f9606b3Saliguori # Assuming Cyrus-SASL installed in /usr prefix 11552f9606b3Saliguori vnc_sasl_cflags="" 11562f9606b3Saliguori vnc_sasl_libs="-lsasl2" 115752166aa0SJuan Quintela if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then 1158ea784e3bSJuan Quintela vnc_sasl=yes 1159fa838301SJuan Quintela libs_softmmu="$vnc_sasl_libs $libs_softmmu" 11602f9606b3Saliguori else 1161ea784e3bSJuan Quintela if test "$vnc_sasl" = "yes" ; then 1162ea784e3bSJuan Quintela feature_not_found "vnc-sasl" 1163ea784e3bSJuan Quintela fi 1164ea784e3bSJuan Quintela vnc_sasl=no 11652f9606b3Saliguori fi 11662f9606b3Saliguorifi 11672f9606b3Saliguori 11682f9606b3Saliguori########################################## 116976655d6dSaliguori# fnmatch() probe, used for ACL routines 117076655d6dSaliguorifnmatch="no" 117176655d6dSaliguoricat > $TMPC << EOF 117276655d6dSaliguori#include <fnmatch.h> 117376655d6dSaliguoriint main(void) 117476655d6dSaliguori{ 117576655d6dSaliguori fnmatch("foo", "foo", 0); 117676655d6dSaliguori return 0; 117776655d6dSaliguori} 117876655d6dSaliguoriEOF 117952166aa0SJuan Quintelaif compile_prog "" "" ; then 118076655d6dSaliguori fnmatch="yes" 118176655d6dSaliguorifi 118276655d6dSaliguori 118376655d6dSaliguori########################################## 1184ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver 1185ee682d27SStefan Weilif test "$uuid" != "no" ; then 1186ee682d27SStefan Weil uuid_libs="-luuid" 1187ee682d27SStefan Weil cat > $TMPC << EOF 1188ee682d27SStefan Weil#include <uuid/uuid.h> 1189ee682d27SStefan Weilint main(void) 1190ee682d27SStefan Weil{ 1191ee682d27SStefan Weil uuid_t my_uuid; 1192ee682d27SStefan Weil uuid_generate(my_uuid); 1193ee682d27SStefan Weil return 0; 1194ee682d27SStefan Weil} 1195ee682d27SStefan WeilEOF 1196ee682d27SStefan Weil if compile_prog "" "$uuid_libs" ; then 1197ee682d27SStefan Weil uuid="yes" 1198ee682d27SStefan Weil libs_softmmu="$uuid_libs $libs_softmmu" 1199ee682d27SStefan Weil libs_tools="$uuid_libs $libs_tools" 1200ee682d27SStefan Weil else 1201ee682d27SStefan Weil if test "$uuid" = "yes" ; then 1202ee682d27SStefan Weil feature_not_found "uuid" 1203ee682d27SStefan Weil fi 1204ee682d27SStefan Weil uuid=no 1205ee682d27SStefan Weil fi 1206ee682d27SStefan Weilfi 1207ee682d27SStefan Weil 1208ee682d27SStefan Weil########################################## 12098a16d273Sths# vde libraries probe 1210dfb278bdSJuan Quintelaif test "$vde" != "no" ; then 12114baae0acSJuan Quintela vde_libs="-lvdeplug" 12128a16d273Sths cat > $TMPC << EOF 12138a16d273Sths#include <libvdeplug.h> 12144a7f0e06Spbrookint main(void) 12154a7f0e06Spbrook{ 12164a7f0e06Spbrook struct vde_open_args a = {0, 0, 0}; 12174a7f0e06Spbrook vde_open("", "", &a); 12184a7f0e06Spbrook return 0; 12194a7f0e06Spbrook} 12208a16d273SthsEOF 122152166aa0SJuan Quintela if compile_prog "" "$vde_libs" ; then 12224baae0acSJuan Quintela vde=yes 12238e02e54cSJuan Quintela libs_softmmu="$vde_libs $libs_softmmu" 12248e02e54cSJuan Quintela libs_tools="$vde_libs $libs_tools" 1225dfb278bdSJuan Quintela else 1226dfb278bdSJuan Quintela if test "$vde" = "yes" ; then 1227dfb278bdSJuan Quintela feature_not_found "vde" 1228dfb278bdSJuan Quintela fi 1229dfb278bdSJuan Quintela vde=no 12308a16d273Sths fi 12318a16d273Sthsfi 12328a16d273Sths 12338a16d273Sths########################################## 1234c2de5c91Smalc# Sound support libraries probe 12358f28f3fbSths 1236c2de5c91Smalcaudio_drv_probe() 1237c2de5c91Smalc{ 1238c2de5c91Smalc drv=$1 1239c2de5c91Smalc hdr=$2 1240c2de5c91Smalc lib=$3 1241c2de5c91Smalc exp=$4 1242c2de5c91Smalc cfl=$5 12438f28f3fbSths cat > $TMPC << EOF 1244c2de5c91Smalc#include <$hdr> 1245c2de5c91Smalcint main(void) { $exp } 12468f28f3fbSthsEOF 124752166aa0SJuan Quintela if compile_prog "$cfl" "$lib" ; then 12488f28f3fbSths : 12498f28f3fbSths else 12508f28f3fbSths echo 1251c2de5c91Smalc echo "Error: $drv check failed" 1252c2de5c91Smalc echo "Make sure to have the $drv libs and headers installed." 12538f28f3fbSths echo 12548f28f3fbSths exit 1 12558f28f3fbSths fi 1256c2de5c91Smalc} 1257c2de5c91Smalc 12582fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'` 1259c2de5c91Smalcfor drv in $audio_drv_list; do 1260c2de5c91Smalc case $drv in 1261c2de5c91Smalc alsa) 1262c2de5c91Smalc audio_drv_probe $drv alsa/asoundlib.h -lasound \ 1263c2de5c91Smalc "snd_pcm_t **handle; return snd_pcm_close(*handle);" 1264a4bf6780SJuan Quintela libs_softmmu="-lasound $libs_softmmu" 1265c2de5c91Smalc ;; 1266c2de5c91Smalc 1267c2de5c91Smalc fmod) 1268c2de5c91Smalc if test -z $fmod_lib || test -z $fmod_inc; then 1269c2de5c91Smalc echo 1270c2de5c91Smalc echo "Error: You must specify path to FMOD library and headers" 1271c2de5c91Smalc echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" 1272c2de5c91Smalc echo 1273c2de5c91Smalc exit 1 12748f28f3fbSths fi 1275c2de5c91Smalc audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" 1276a4bf6780SJuan Quintela libs_softmmu="$fmod_lib $libs_softmmu" 1277c2de5c91Smalc ;; 1278c2de5c91Smalc 1279c2de5c91Smalc esd) 1280c2de5c91Smalc audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' 1281a4bf6780SJuan Quintela libs_softmmu="-lesd $libs_softmmu" 128267f86e8eSJuan Quintela audio_pt_int="yes" 1283c2de5c91Smalc ;; 1284b8e59f18Smalc 1285b8e59f18Smalc pa) 1286493abda6SAurelien Jarno audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \ 1287b8e59f18Smalc "pa_simple *s = NULL; pa_simple_free(s); return 0;" 1288493abda6SAurelien Jarno libs_softmmu="-lpulse -lpulse-simple $libs_softmmu" 128967f86e8eSJuan Quintela audio_pt_int="yes" 1290b8e59f18Smalc ;; 1291b8e59f18Smalc 1292997e690aSJuan Quintela coreaudio) 1293997e690aSJuan Quintela libs_softmmu="-framework CoreAudio $libs_softmmu" 1294997e690aSJuan Quintela ;; 1295997e690aSJuan Quintela 1296a4bf6780SJuan Quintela dsound) 1297a4bf6780SJuan Quintela libs_softmmu="-lole32 -ldxguid $libs_softmmu" 1298d5631638Smalc audio_win_int="yes" 1299a4bf6780SJuan Quintela ;; 1300a4bf6780SJuan Quintela 1301a4bf6780SJuan Quintela oss) 1302a4bf6780SJuan Quintela libs_softmmu="$oss_lib $libs_softmmu" 1303a4bf6780SJuan Quintela ;; 1304a4bf6780SJuan Quintela 1305a4bf6780SJuan Quintela sdl|wav) 13062f6a1ab0Sblueswir1 # XXX: Probes for CoreAudio, DirectSound, SDL(?) 13072f6a1ab0Sblueswir1 ;; 13082f6a1ab0Sblueswir1 1309d5631638Smalc winwave) 1310d5631638Smalc libs_softmmu="-lwinmm $libs_softmmu" 1311d5631638Smalc audio_win_int="yes" 1312d5631638Smalc ;; 1313d5631638Smalc 1314e4c63a6aSmalc *) 13151c9b2a52Smalc echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { 1316e4c63a6aSmalc echo 1317e4c63a6aSmalc echo "Error: Unknown driver '$drv' selected" 1318e4c63a6aSmalc echo "Possible drivers are: $audio_possible_drivers" 1319e4c63a6aSmalc echo 1320e4c63a6aSmalc exit 1 1321e4c63a6aSmalc } 1322e4c63a6aSmalc ;; 1323c2de5c91Smalc esac 1324c2de5c91Smalcdone 13258f28f3fbSths 13264d3b6f6eSbalrog########################################## 13272e4d9fb1Saurel32# BrlAPI probe 13282e4d9fb1Saurel32 13294ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then 1330eb82284fSJuan Quintela brlapi_libs="-lbrlapi" 13312e4d9fb1Saurel32 cat > $TMPC << EOF 13322e4d9fb1Saurel32#include <brlapi.h> 13332e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } 13342e4d9fb1Saurel32EOF 133552166aa0SJuan Quintela if compile_prog "" "$brlapi_libs" ; then 13362e4d9fb1Saurel32 brlapi=yes 1337264606b3SJuan Quintela libs_softmmu="$brlapi_libs $libs_softmmu" 13384ffcedb6SJuan Quintela else 13394ffcedb6SJuan Quintela if test "$brlapi" = "yes" ; then 13404ffcedb6SJuan Quintela feature_not_found "brlapi" 13414ffcedb6SJuan Quintela fi 13424ffcedb6SJuan Quintela brlapi=no 1343eb82284fSJuan Quintela fi 1344eb82284fSJuan Quintelafi 13452e4d9fb1Saurel32 13462e4d9fb1Saurel32########################################## 13474d3b6f6eSbalrog# curses probe 13484f78ef9aSJuan Quintelacurses_list="-lncurses -lcurses" 13494d3b6f6eSbalrog 1350c584a6d0SJuan Quintelaif test "$curses" != "no" ; then 1351c584a6d0SJuan Quintela curses_found=no 13524d3b6f6eSbalrog cat > $TMPC << EOF 13534d3b6f6eSbalrog#include <curses.h> 13545a8ff3aaSblueswir1#ifdef __OpenBSD__ 13555a8ff3aaSblueswir1#define resize_term resizeterm 13565a8ff3aaSblueswir1#endif 13575a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); } 13584d3b6f6eSbalrogEOF 13594f78ef9aSJuan Quintela for curses_lib in $curses_list; do 13604f78ef9aSJuan Quintela if compile_prog "" "$curses_lib" ; then 1361c584a6d0SJuan Quintela curses_found=yes 13624f78ef9aSJuan Quintela libs_softmmu="$curses_lib $libs_softmmu" 13634f78ef9aSJuan Quintela break 13644d3b6f6eSbalrog fi 13654f78ef9aSJuan Quintela done 1366c584a6d0SJuan Quintela if test "$curses_found" = "yes" ; then 1367c584a6d0SJuan Quintela curses=yes 1368c584a6d0SJuan Quintela else 1369c584a6d0SJuan Quintela if test "$curses" = "yes" ; then 1370c584a6d0SJuan Quintela feature_not_found "curses" 1371c584a6d0SJuan Quintela fi 1372c584a6d0SJuan Quintela curses=no 1373c584a6d0SJuan Quintela fi 13744f78ef9aSJuan Quintelafi 13754d3b6f6eSbalrog 1376414f0dabSblueswir1########################################## 1377769ce76dSAlexander Graf# curl probe 1378769ce76dSAlexander Graf 13794e2b0658SPaolo Bonziniif $pkgconfig libcurl --modversion >/dev/null 2>&1; then 13804e2b0658SPaolo Bonzini curlconfig="$pkgconfig libcurl" 13814e2b0658SPaolo Bonzinielse 13824e2b0658SPaolo Bonzini curlconfig=curl-config 13834e2b0658SPaolo Bonzinifi 13844e2b0658SPaolo Bonzini 1385788c8196SJuan Quintelaif test "$curl" != "no" ; then 1386769ce76dSAlexander Graf cat > $TMPC << EOF 1387769ce76dSAlexander Graf#include <curl/curl.h> 1388769ce76dSAlexander Grafint main(void) { return curl_easy_init(); } 1389769ce76dSAlexander GrafEOF 13904e2b0658SPaolo Bonzini curl_cflags=`$curlconfig --cflags 2>/dev/null` 13914e2b0658SPaolo Bonzini curl_libs=`$curlconfig --libs 2>/dev/null` 1392b1d5a277SJuan Quintela if compile_prog "$curl_cflags" "$curl_libs" ; then 1393769ce76dSAlexander Graf curl=yes 1394f0302935SJuan Quintela libs_tools="$curl_libs $libs_tools" 1395f0302935SJuan Quintela libs_softmmu="$curl_libs $libs_softmmu" 1396788c8196SJuan Quintela else 1397788c8196SJuan Quintela if test "$curl" = "yes" ; then 1398788c8196SJuan Quintela feature_not_found "curl" 1399788c8196SJuan Quintela fi 1400788c8196SJuan Quintela curl=no 1401769ce76dSAlexander Graf fi 1402769ce76dSAlexander Graffi # test "$curl" 1403769ce76dSAlexander Graf 1404769ce76dSAlexander Graf########################################## 14055495ed11SLuiz Capitulino# check framework probe 14065495ed11SLuiz Capitulino 14075495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then 14085495ed11SLuiz Capitulino cat > $TMPC << EOF 14095495ed11SLuiz Capitulino#include <check.h> 14105495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; } 14115495ed11SLuiz CapitulinoEOF 1412f91672e5SPaolo Bonzini check_libs=`$pkgconfig --libs check` 14135495ed11SLuiz Capitulino if compile_prog "" $check_libs ; then 14145495ed11SLuiz Capitulino check_utests=yes 14155495ed11SLuiz Capitulino libs_tools="$check_libs $libs_tools" 14165495ed11SLuiz Capitulino else 14175495ed11SLuiz Capitulino if test "$check_utests" = "yes" ; then 14185495ed11SLuiz Capitulino feature_not_found "check" 14195495ed11SLuiz Capitulino fi 14205495ed11SLuiz Capitulino check_utests=no 14215495ed11SLuiz Capitulino fi 14225495ed11SLuiz Capitulinofi # test "$check_utests" 14235495ed11SLuiz Capitulino 14245495ed11SLuiz Capitulino########################################## 1425fb599c9aSbalrog# bluez support probe 1426a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then 1427e820e3f4Sbalrog cat > $TMPC << EOF 1428e820e3f4Sbalrog#include <bluetooth/bluetooth.h> 1429e820e3f4Sbalrogint main(void) { return bt_error(0); } 1430e820e3f4SbalrogEOF 1431f91672e5SPaolo Bonzini bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null` 1432f91672e5SPaolo Bonzini bluez_libs=`$pkgconfig --libs bluez 2> /dev/null` 143352166aa0SJuan Quintela if compile_prog "$bluez_cflags" "$bluez_libs" ; then 1434a20a6f46SJuan Quintela bluez=yes 1435e482d56aSJuan Quintela libs_softmmu="$bluez_libs $libs_softmmu" 1436e820e3f4Sbalrog else 1437a20a6f46SJuan Quintela if test "$bluez" = "yes" ; then 1438a20a6f46SJuan Quintela feature_not_found "bluez" 1439a20a6f46SJuan Quintela fi 1440e820e3f4Sbalrog bluez="no" 1441e820e3f4Sbalrog fi 1442fb599c9aSbalrogfi 1443fb599c9aSbalrog 1444fb599c9aSbalrog########################################## 14457ba1e619Saliguori# kvm probe 1446b31a0277SJuan Quintelaif test "$kvm" != "no" ; then 14477ba1e619Saliguori cat > $TMPC <<EOF 14487ba1e619Saliguori#include <linux/kvm.h> 14499fd8d8d7Saliguori#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12 14507ba1e619Saliguori#error Invalid KVM version 14517ba1e619Saliguori#endif 14529fd8d8d7Saliguori#if !defined(KVM_CAP_USER_MEMORY) 14539fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_USER_MEMORY 14549fd8d8d7Saliguori#endif 14559fd8d8d7Saliguori#if !defined(KVM_CAP_SET_TSS_ADDR) 14569fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_SET_TSS_ADDR 14579fd8d8d7Saliguori#endif 14589fd8d8d7Saliguori#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS) 14599fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS 14609fd8d8d7Saliguori#endif 14617ba1e619Saliguoriint main(void) { return 0; } 14627ba1e619SaliguoriEOF 1463eac30262Saliguori if test "$kerneldir" != "" ; then 1464eac30262Saliguori kvm_cflags=-I"$kerneldir"/include 14658444eb6eSaliguori if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \ 14668444eb6eSaliguori -a -d "$kerneldir/arch/x86/include" ; then 14678444eb6eSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include" 1468406b430dSaliguori elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then 1469406b430dSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include" 14700e60a699SAlexander Graf elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then 14710e60a699SAlexander Graf kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include" 14728444eb6eSaliguori elif test -d "$kerneldir/arch/$cpu/include" ; then 14738444eb6eSaliguori kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include" 14748444eb6eSaliguori fi 1475eac30262Saliguori else 1476ffd8b67fSJan Kiszka kvm_cflags=`pkg-config --cflags kvm-kmod 2> /dev/null` 1477eac30262Saliguori fi 147852166aa0SJuan Quintela if compile_prog "$kvm_cflags" "" ; then 1479b31a0277SJuan Quintela kvm=yes 1480dae5079aSJan Kiszka cat > $TMPC <<EOF 1481dae5079aSJan Kiszka#include <linux/kvm_para.h> 1482dae5079aSJan Kiszkaint main(void) { return 0; } 1483dae5079aSJan KiszkaEOF 1484dae5079aSJan Kiszka if compile_prog "$kvm_cflags" "" ; then 1485dae5079aSJan Kiszka kvm_para=yes 1486dae5079aSJan Kiszka fi 14877ba1e619Saliguori else 1488b31a0277SJuan Quintela if test "$kvm" = "yes" ; then 14890dba6195SLoïc Minier if has awk && has grep; then 1490a558ee17SJuan Quintela kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \ 14919fd8d8d7Saliguori | grep "error: " \ 14929fd8d8d7Saliguori | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` 14939fd8d8d7Saliguori if test "$kvmerr" != "" ; then 1494b31a0277SJuan Quintela echo -e "${kvmerr}\n\ 1495168ccc11SJan Kiszka NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \ 1496168ccc11SJan Kiszka recent kvm-kmod from http://sourceforge.net/projects/kvm." 14979fd8d8d7Saliguori fi 14989fd8d8d7Saliguori fi 1499b31a0277SJuan Quintela feature_not_found "kvm" 1500b31a0277SJuan Quintela fi 1501b31a0277SJuan Quintela kvm=no 15027ba1e619Saliguori fi 15037ba1e619Saliguorifi 15047ba1e619Saliguori 15057ba1e619Saliguori########################################## 1506e5d355d1Saliguori# pthread probe 1507de65fe0fSSebastian HerbsztPTHREADLIBS_LIST="-lpthread -lpthreadGC2" 15083c529d93Saliguori 1509e5d355d1Saliguoripthread=no 1510414f0dabSblueswir1cat > $TMPC << EOF 15113c529d93Saliguori#include <pthread.h> 1512de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; } 1513414f0dabSblueswir1EOF 1514de65fe0fSSebastian Herbsztfor pthread_lib in $PTHREADLIBS_LIST; do 151552166aa0SJuan Quintela if compile_prog "" "$pthread_lib" ; then 1516e5d355d1Saliguori pthread=yes 15175572b539SJuan Quintela LIBS="$pthread_lib $LIBS" 1518de65fe0fSSebastian Herbszt break 1519414f0dabSblueswir1 fi 1520de65fe0fSSebastian Herbsztdone 1521414f0dabSblueswir1 15224617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then 15234dd75c70SChristoph Hellwig echo 15244dd75c70SChristoph Hellwig echo "Error: pthread check failed" 15254dd75c70SChristoph Hellwig echo "Make sure to have the pthread libs and headers installed." 15264dd75c70SChristoph Hellwig echo 15274dd75c70SChristoph Hellwig exit 1 1528e5d355d1Saliguorifi 1529e5d355d1Saliguori 1530bf9298b9Saliguori########################################## 15315c6c3a6cSChristoph Hellwig# linux-aio probe 15325c6c3a6cSChristoph Hellwig 15335c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then 15345c6c3a6cSChristoph Hellwig cat > $TMPC <<EOF 15355c6c3a6cSChristoph Hellwig#include <libaio.h> 15365c6c3a6cSChristoph Hellwig#include <sys/eventfd.h> 15375c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; } 15385c6c3a6cSChristoph HellwigEOF 15395c6c3a6cSChristoph Hellwig if compile_prog "" "-laio" ; then 15405c6c3a6cSChristoph Hellwig linux_aio=yes 15415c6c3a6cSChristoph Hellwig LIBS="$LIBS -laio" 15425c6c3a6cSChristoph Hellwig else 15435c6c3a6cSChristoph Hellwig if test "$linux_aio" = "yes" ; then 15445c6c3a6cSChristoph Hellwig feature_not_found "linux AIO" 15455c6c3a6cSChristoph Hellwig fi 15463cfcae3cSLuiz Capitulino linux_aio=no 15475c6c3a6cSChristoph Hellwig fi 15485c6c3a6cSChristoph Hellwigfi 15495c6c3a6cSChristoph Hellwig 15505c6c3a6cSChristoph Hellwig########################################## 1551bf9298b9Saliguori# iovec probe 1552bf9298b9Saliguoricat > $TMPC <<EOF 1553db34f0b3Sblueswir1#include <sys/types.h> 1554bf9298b9Saliguori#include <sys/uio.h> 1555db34f0b3Sblueswir1#include <unistd.h> 1556bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; } 1557bf9298b9SaliguoriEOF 1558bf9298b9Saliguoriiovec=no 155952166aa0SJuan Quintelaif compile_prog "" "" ; then 1560bf9298b9Saliguori iovec=yes 1561bf9298b9Saliguorifi 1562bf9298b9Saliguori 1563f652e6afSaurel32########################################## 1564ceb42de8Saliguori# preadv probe 1565ceb42de8Saliguoricat > $TMPC <<EOF 1566ceb42de8Saliguori#include <sys/types.h> 1567ceb42de8Saliguori#include <sys/uio.h> 1568ceb42de8Saliguori#include <unistd.h> 1569ceb42de8Saliguoriint main(void) { preadv; } 1570ceb42de8SaliguoriEOF 1571ceb42de8Saliguoripreadv=no 157252166aa0SJuan Quintelaif compile_prog "" "" ; then 1573ceb42de8Saliguori preadv=yes 1574ceb42de8Saliguorifi 1575ceb42de8Saliguori 1576ceb42de8Saliguori########################################## 1577f652e6afSaurel32# fdt probe 15782df87df7SJuan Quintelaif test "$fdt" != "no" ; then 1579b41af4baSJuan Quintela fdt_libs="-lfdt" 1580f652e6afSaurel32 cat > $TMPC << EOF 1581f652e6afSaurel32int main(void) { return 0; } 1582f652e6afSaurel32EOF 158352166aa0SJuan Quintela if compile_prog "" "$fdt_libs" ; then 1584f652e6afSaurel32 fdt=yes 1585e4782985SJuan Quintela libs_softmmu="$fdt_libs $libs_softmmu" 15862df87df7SJuan Quintela else 15872df87df7SJuan Quintela if test "$fdt" = "yes" ; then 15882df87df7SJuan Quintela feature_not_found "fdt" 15892df87df7SJuan Quintela fi 15902df87df7SJuan Quintela fdt=no 1591f652e6afSaurel32 fi 1592f652e6afSaurel32fi 1593f652e6afSaurel32 15943b3f24adSaurel32# 15953b3f24adSaurel32# Check for xxxat() functions when we are building linux-user 15963b3f24adSaurel32# emulator. This is done because older glibc versions don't 15973b3f24adSaurel32# have syscall stubs for these implemented. 15983b3f24adSaurel32# 15993b3f24adSaurel32atfile=no 16003b3f24adSaurel32cat > $TMPC << EOF 16013b3f24adSaurel32#define _ATFILE_SOURCE 16023b3f24adSaurel32#include <sys/types.h> 16033b3f24adSaurel32#include <fcntl.h> 16043b3f24adSaurel32#include <unistd.h> 16053b3f24adSaurel32 16063b3f24adSaurel32int 16073b3f24adSaurel32main(void) 16083b3f24adSaurel32{ 16093b3f24adSaurel32 /* try to unlink nonexisting file */ 16103b3f24adSaurel32 return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); 16113b3f24adSaurel32} 16123b3f24adSaurel32EOF 161352166aa0SJuan Quintelaif compile_prog "" "" ; then 16143b3f24adSaurel32 atfile=yes 16153b3f24adSaurel32fi 16163b3f24adSaurel32 161739386ac7Saurel32# Check for inotify functions when we are building linux-user 16183b3f24adSaurel32# emulator. This is done because older glibc versions don't 16193b3f24adSaurel32# have syscall stubs for these implemented. In that case we 16203b3f24adSaurel32# don't provide them even if kernel supports them. 16213b3f24adSaurel32# 16223b3f24adSaurel32inotify=no 16233b3f24adSaurel32cat > $TMPC << EOF 16243b3f24adSaurel32#include <sys/inotify.h> 16253b3f24adSaurel32 16263b3f24adSaurel32int 16273b3f24adSaurel32main(void) 16283b3f24adSaurel32{ 16293b3f24adSaurel32 /* try to start inotify */ 16308690e420Saurel32 return inotify_init(); 16313b3f24adSaurel32} 16323b3f24adSaurel32EOF 163352166aa0SJuan Quintelaif compile_prog "" "" ; then 16343b3f24adSaurel32 inotify=yes 16353b3f24adSaurel32fi 16363b3f24adSaurel32 1637c05c7a73SRiku Voipioinotify1=no 1638c05c7a73SRiku Voipiocat > $TMPC << EOF 1639c05c7a73SRiku Voipio#include <sys/inotify.h> 1640c05c7a73SRiku Voipio 1641c05c7a73SRiku Voipioint 1642c05c7a73SRiku Voipiomain(void) 1643c05c7a73SRiku Voipio{ 1644c05c7a73SRiku Voipio /* try to start inotify */ 1645c05c7a73SRiku Voipio return inotify_init1(0); 1646c05c7a73SRiku Voipio} 1647c05c7a73SRiku VoipioEOF 1648c05c7a73SRiku Voipioif compile_prog "" "" ; then 1649c05c7a73SRiku Voipio inotify1=yes 1650c05c7a73SRiku Voipiofi 1651c05c7a73SRiku Voipio 1652ebc996f3SRiku Voipio# check if utimensat and futimens are supported 1653ebc996f3SRiku Voipioutimens=no 1654ebc996f3SRiku Voipiocat > $TMPC << EOF 1655ebc996f3SRiku Voipio#define _ATFILE_SOURCE 1656ebc996f3SRiku Voipio#define _GNU_SOURCE 1657ebc996f3SRiku Voipio#include <stddef.h> 1658ebc996f3SRiku Voipio#include <fcntl.h> 1659ebc996f3SRiku Voipio 1660ebc996f3SRiku Voipioint main(void) 1661ebc996f3SRiku Voipio{ 1662ebc996f3SRiku Voipio utimensat(AT_FDCWD, "foo", NULL, 0); 1663ebc996f3SRiku Voipio futimens(0, NULL); 1664ebc996f3SRiku Voipio return 0; 1665ebc996f3SRiku Voipio} 1666ebc996f3SRiku VoipioEOF 166752166aa0SJuan Quintelaif compile_prog "" "" ; then 1668ebc996f3SRiku Voipio utimens=yes 1669ebc996f3SRiku Voipiofi 1670ebc996f3SRiku Voipio 1671099d6b0fSRiku Voipio# check if pipe2 is there 1672099d6b0fSRiku Voipiopipe2=no 1673099d6b0fSRiku Voipiocat > $TMPC << EOF 1674099d6b0fSRiku Voipio#define _GNU_SOURCE 1675099d6b0fSRiku Voipio#include <unistd.h> 1676099d6b0fSRiku Voipio#include <fcntl.h> 1677099d6b0fSRiku Voipio 1678099d6b0fSRiku Voipioint main(void) 1679099d6b0fSRiku Voipio{ 1680099d6b0fSRiku Voipio int pipefd[2]; 1681099d6b0fSRiku Voipio pipe2(pipefd, O_CLOEXEC); 1682099d6b0fSRiku Voipio return 0; 1683099d6b0fSRiku Voipio} 1684099d6b0fSRiku VoipioEOF 168552166aa0SJuan Quintelaif compile_prog "" "" ; then 1686099d6b0fSRiku Voipio pipe2=yes 1687099d6b0fSRiku Voipiofi 1688099d6b0fSRiku Voipio 168940ff6d7eSKevin Wolf# check if accept4 is there 169040ff6d7eSKevin Wolfaccept4=no 169140ff6d7eSKevin Wolfcat > $TMPC << EOF 169240ff6d7eSKevin Wolf#define _GNU_SOURCE 169340ff6d7eSKevin Wolf#include <sys/socket.h> 169440ff6d7eSKevin Wolf#include <stddef.h> 169540ff6d7eSKevin Wolf 169640ff6d7eSKevin Wolfint main(void) 169740ff6d7eSKevin Wolf{ 169840ff6d7eSKevin Wolf accept4(0, NULL, NULL, SOCK_CLOEXEC); 169940ff6d7eSKevin Wolf return 0; 170040ff6d7eSKevin Wolf} 170140ff6d7eSKevin WolfEOF 170240ff6d7eSKevin Wolfif compile_prog "" "" ; then 170340ff6d7eSKevin Wolf accept4=yes 170440ff6d7eSKevin Wolffi 170540ff6d7eSKevin Wolf 17063ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time. 17073ce34dfbSvibisreenivasansplice=no 17083ce34dfbSvibisreenivasancat > $TMPC << EOF 17093ce34dfbSvibisreenivasan#define _GNU_SOURCE 17103ce34dfbSvibisreenivasan#include <unistd.h> 17113ce34dfbSvibisreenivasan#include <fcntl.h> 17123ce34dfbSvibisreenivasan#include <limits.h> 17133ce34dfbSvibisreenivasan 17143ce34dfbSvibisreenivasanint main(void) 17153ce34dfbSvibisreenivasan{ 17163ce34dfbSvibisreenivasan int len, fd; 17173ce34dfbSvibisreenivasan len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK); 17183ce34dfbSvibisreenivasan splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE); 17193ce34dfbSvibisreenivasan return 0; 17203ce34dfbSvibisreenivasan} 17213ce34dfbSvibisreenivasanEOF 172252166aa0SJuan Quintelaif compile_prog "" "" ; then 17233ce34dfbSvibisreenivasan splice=yes 17243ce34dfbSvibisreenivasanfi 17253ce34dfbSvibisreenivasan 1726c2882b96SRiku Voipio# check if eventfd is supported 1727c2882b96SRiku Voipioeventfd=no 1728c2882b96SRiku Voipiocat > $TMPC << EOF 1729c2882b96SRiku Voipio#include <sys/eventfd.h> 1730c2882b96SRiku Voipio 1731c2882b96SRiku Voipioint main(void) 1732c2882b96SRiku Voipio{ 1733c2882b96SRiku Voipio int efd = eventfd(0, 0); 1734c2882b96SRiku Voipio return 0; 1735c2882b96SRiku Voipio} 1736c2882b96SRiku VoipioEOF 1737c2882b96SRiku Voipioif compile_prog "" "" ; then 1738c2882b96SRiku Voipio eventfd=yes 1739c2882b96SRiku Voipiofi 1740c2882b96SRiku Voipio 1741d0927938SUlrich Hecht# check for fallocate 1742d0927938SUlrich Hechtfallocate=no 1743d0927938SUlrich Hechtcat > $TMPC << EOF 1744d0927938SUlrich Hecht#include <fcntl.h> 1745d0927938SUlrich Hecht 1746d0927938SUlrich Hechtint main(void) 1747d0927938SUlrich Hecht{ 1748d0927938SUlrich Hecht fallocate(0, 0, 0, 0); 1749d0927938SUlrich Hecht return 0; 1750d0927938SUlrich Hecht} 1751d0927938SUlrich HechtEOF 1752be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then 1753d0927938SUlrich Hecht fallocate=yes 1754d0927938SUlrich Hechtfi 1755d0927938SUlrich Hecht 1756d0927938SUlrich Hecht# check for dup3 1757d0927938SUlrich Hechtdup3=no 1758d0927938SUlrich Hechtcat > $TMPC << EOF 1759d0927938SUlrich Hecht#include <unistd.h> 1760d0927938SUlrich Hecht 1761d0927938SUlrich Hechtint main(void) 1762d0927938SUlrich Hecht{ 1763d0927938SUlrich Hecht dup3(0, 0, 0); 1764d0927938SUlrich Hecht return 0; 1765d0927938SUlrich Hecht} 1766d0927938SUlrich HechtEOF 176778f5d726SJan Kiszkaif compile_prog "" "" ; then 1768d0927938SUlrich Hecht dup3=yes 1769d0927938SUlrich Hechtfi 1770d0927938SUlrich Hecht 1771cc8ae6deSpbrook# Check if tools are available to build documentation. 1772a25dba17SJuan Quintelaif test "$docs" != "no" ; then 177301668d98SStefan Weil if has makeinfo && has pod2man; then 1774a25dba17SJuan Quintela docs=yes 177583a3ab8bSJuan Quintela else 1776a25dba17SJuan Quintela if test "$docs" = "yes" ; then 1777a25dba17SJuan Quintela feature_not_found "docs" 177883a3ab8bSJuan Quintela fi 1779a25dba17SJuan Quintela docs=no 178083a3ab8bSJuan Quintela fi 1781cc8ae6deSpbrookfi 1782cc8ae6deSpbrook 1783f514f41cSStefan Weil# Search for bswap_32 function 17846ae9a1f4SJuan Quintelabyteswap_h=no 17856ae9a1f4SJuan Quintelacat > $TMPC << EOF 17866ae9a1f4SJuan Quintela#include <byteswap.h> 17876ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); } 17886ae9a1f4SJuan QuintelaEOF 178952166aa0SJuan Quintelaif compile_prog "" "" ; then 17906ae9a1f4SJuan Quintela byteswap_h=yes 17916ae9a1f4SJuan Quintelafi 17926ae9a1f4SJuan Quintela 1793f514f41cSStefan Weil# Search for bswap_32 function 17946ae9a1f4SJuan Quintelabswap_h=no 17956ae9a1f4SJuan Quintelacat > $TMPC << EOF 17966ae9a1f4SJuan Quintela#include <sys/endian.h> 17976ae9a1f4SJuan Quintela#include <sys/types.h> 17986ae9a1f4SJuan Quintela#include <machine/bswap.h> 17996ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); } 18006ae9a1f4SJuan QuintelaEOF 180152166aa0SJuan Quintelaif compile_prog "" "" ; then 18026ae9a1f4SJuan Quintela bswap_h=yes 18036ae9a1f4SJuan Quintelafi 18046ae9a1f4SJuan Quintela 1805da93a1fdSaliguori########################################## 1806da93a1fdSaliguori# Do we need librt 1807da93a1fdSaliguoricat > $TMPC <<EOF 1808da93a1fdSaliguori#include <signal.h> 1809da93a1fdSaliguori#include <time.h> 1810da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); } 1811da93a1fdSaliguoriEOF 1812da93a1fdSaliguori 181352166aa0SJuan Quintelaif compile_prog "" "" ; then 181407ffa4bdSJuan Quintela : 181552166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then 181607ffa4bdSJuan Quintela LIBS="-lrt $LIBS" 1817da93a1fdSaliguorifi 1818da93a1fdSaliguori 181931ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ 18206362a53fSJuan Quintela "$aix" != "yes" ; then 18216362a53fSJuan Quintela libs_softmmu="-lutil $libs_softmmu" 18226362a53fSJuan Quintelafi 18236362a53fSJuan Quintela 1824de5071c5SBlue Swirl########################################## 1825de5071c5SBlue Swirl# check if the compiler defines offsetof 1826de5071c5SBlue Swirl 1827de5071c5SBlue Swirlneed_offsetof=yes 1828de5071c5SBlue Swirlcat > $TMPC << EOF 1829de5071c5SBlue Swirl#include <stddef.h> 1830de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); } 1831de5071c5SBlue SwirlEOF 1832de5071c5SBlue Swirlif compile_prog "" "" ; then 1833de5071c5SBlue Swirl need_offsetof=no 1834de5071c5SBlue Swirlfi 1835de5071c5SBlue Swirl 18365f6b9e8fSBlue Swirl########################################## 1837747bbdf7SBlue Swirl# check if the compiler understands attribute warn_unused_result 1838747bbdf7SBlue Swirl# 1839747bbdf7SBlue Swirl# This could be smarter, but gcc -Werror does not error out even when warning 1840747bbdf7SBlue Swirl# about attribute warn_unused_result 1841747bbdf7SBlue Swirl 1842747bbdf7SBlue Swirlgcc_attribute_warn_unused_result=no 1843747bbdf7SBlue Swirlcat > $TMPC << EOF 1844747bbdf7SBlue Swirl#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4) 1845747bbdf7SBlue Swirl#error gcc 3.3 or older 1846747bbdf7SBlue Swirl#endif 1847747bbdf7SBlue Swirlint main(void) { return 0;} 1848747bbdf7SBlue SwirlEOF 1849747bbdf7SBlue Swirlif compile_prog "" ""; then 1850747bbdf7SBlue Swirl gcc_attribute_warn_unused_result=yes 1851747bbdf7SBlue Swirlfi 1852747bbdf7SBlue Swirl 1853747bbdf7SBlue Swirl########################################## 18545f6b9e8fSBlue Swirl# check if we have fdatasync 18555f6b9e8fSBlue Swirl 18565f6b9e8fSBlue Swirlfdatasync=no 18575f6b9e8fSBlue Swirlcat > $TMPC << EOF 18585f6b9e8fSBlue Swirl#include <unistd.h> 18595f6b9e8fSBlue Swirlint main(void) { return fdatasync(0); } 18605f6b9e8fSBlue SwirlEOF 18615f6b9e8fSBlue Swirlif compile_prog "" "" ; then 18625f6b9e8fSBlue Swirl fdatasync=yes 18635f6b9e8fSBlue Swirlfi 18645f6b9e8fSBlue Swirl 1865e86ecd4bSJuan Quintela# End of CC checks 1866e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs 1867e86ecd4bSJuan Quintela 1868e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then 18691156c669SJuan Quintela CFLAGS="-O2 $CFLAGS" 1870e86ecd4bSJuan Quintelafi 1871a316e378SJuan Quintela 1872e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror 1873e86ecd4bSJuan Quintela# by default. Only enable by default for git builds 1874e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION` 187520ff6c80SAnthony Liguori 187620ff6c80SAnthony Liguoriif test -z "$werror" ; then 1877e86ecd4bSJuan Quintela if test "$z_version" = "50" -a \ 1878e86ecd4bSJuan Quintela "$linux" = "yes" ; then 1879e86ecd4bSJuan Quintela werror="yes" 1880e86ecd4bSJuan Quintela else 1881e86ecd4bSJuan Quintela werror="no" 1882e86ecd4bSJuan Quintela fi 1883e86ecd4bSJuan Quintelafi 1884e86ecd4bSJuan Quintela 188520ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to 188620ff6c80SAnthony Liguori# enable/disable 188720ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then 188820ff6c80SAnthony Liguori if test "$z_version" = "50" ; then 188920ff6c80SAnthony Liguori zero_malloc="no" 189020ff6c80SAnthony Liguori else 189120ff6c80SAnthony Liguori zero_malloc="yes" 189220ff6c80SAnthony Liguori fi 189320ff6c80SAnthony Liguorifi 189420ff6c80SAnthony Liguori 1895e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then 1896a558ee17SJuan Quintela QEMU_CFLAGS="-Werror $QEMU_CFLAGS" 1897e86ecd4bSJuan Quintelafi 1898e86ecd4bSJuan Quintela 1899e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then 1900e86ecd4bSJuan Quintela if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then 19011156c669SJuan Quintela LDFLAGS="-Wl,--warn-common $LDFLAGS" 1902e86ecd4bSJuan Quintela fi 1903e86ecd4bSJuan Quintelafi 1904e86ecd4bSJuan Quintela 190511d9f695Sbellardif test "$mingw32" = "yes" ; then 190611d9f695Sbellard if test -z "$prefix" ; then 190755418b96SStefan Weil prefix="c:/Program Files/Qemu" 190811d9f695Sbellard fi 1909308c3593Spbrook mansuffix="" 1910308c3593Spbrook datasuffix="" 191107381cc1SAnthony Liguori confsuffix="" 1912308c3593Spbrook docsuffix="" 1913308c3593Spbrook binsuffix="" 191407381cc1SAnthony Liguori if test -z "$sysconfdir" ; then 191507381cc1SAnthony Liguori sysconfdir="${prefix}" 191607381cc1SAnthony Liguori fi 191711d9f695Sbellardelse 191811d9f695Sbellard if test -z "$prefix" ; then 191911d9f695Sbellard prefix="/usr/local" 192011d9f695Sbellard fi 1921308c3593Spbrook mansuffix="/share/man" 1922308c3593Spbrook datasuffix="/share/qemu" 1923308c3593Spbrook docsuffix="/share/doc/qemu" 1924308c3593Spbrook binsuffix="/bin" 192507381cc1SAnthony Liguori if test -z "$sysconfdir" ; then 192607381cc1SAnthony Liguori sysconfdir="${prefix}/etc" 192707381cc1SAnthony Liguori fi 192811d9f695Sbellardfi 19295a67135aSbellard 19307d13299dSbellardecho "Install prefix $prefix" 1931308c3593Spbrookecho "BIOS directory $prefix$datasuffix" 1932308c3593Spbrookecho "binary directory $prefix$binsuffix" 193311d9f695Sbellardif test "$mingw32" = "no" ; then 1934308c3593Spbrookecho "Manual directory $prefix$mansuffix" 193543ce4dfeSbellardecho "ELF interp prefix $interp_prefix" 193611d9f695Sbellardfi 19375a67135aSbellardecho "Source path $source_path" 19387d13299dSbellardecho "C compiler $cc" 193983469015Sbellardecho "Host C compiler $host_cc" 19400c439cbfSJuan Quintelaecho "CFLAGS $CFLAGS" 1941a558ee17SJuan Quintelaecho "QEMU_CFLAGS $QEMU_CFLAGS" 19420c439cbfSJuan Quintelaecho "LDFLAGS $LDFLAGS" 19437d13299dSbellardecho "make $make" 19446a882643Spbrookecho "install $install" 1945a98fd896Sbellardecho "host CPU $cpu" 1946de83cd02Sbellardecho "host big endian $bigendian" 194797a847bcSbellardecho "target list $target_list" 1948ade25b0dSaurel32echo "tcg debug enabled $debug_tcg" 1949b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon" 19507d13299dSbellardecho "gprof enabled $gprof" 195103b4fe7dSaliguoriecho "sparse enabled $sparse" 19521625af87Saliguoriecho "strip binaries $strip_opt" 195305c2a3e7Sbellardecho "profiler $profiler" 195443ce4dfeSbellardecho "static build $static" 195585aa5189Sbellardecho "-Werror enabled $werror" 19565b0753e0Sbellardif test "$darwin" = "yes" ; then 19575b0753e0Sbellard echo "Cocoa support $cocoa" 19585b0753e0Sbellardfi 195997a847bcSbellardecho "SDL support $sdl" 19604d3b6f6eSbalrogecho "curses support $curses" 1961769ce76dSAlexander Grafecho "curl support $curl" 19625495ed11SLuiz Capitulinoecho "check support $check_utests" 196367b915a5Sbellardecho "mingw32 support $mingw32" 19640c58ac1cSmalcecho "Audio drivers $audio_drv_list" 19650c58ac1cSmalcecho "Extra audio cards $audio_card_list" 1966eb852011SMarkus Armbrusterecho "Block whitelist $block_drv_whitelist" 19678ff9cbf7Smalcecho "Mixer emulation $mixemu" 19688d5d2d4cSthsecho "VNC TLS support $vnc_tls" 19692f9606b3Saliguoriecho "VNC SASL support $vnc_sasl" 19703142255cSblueswir1if test -n "$sparc_cpu"; then 19713142255cSblueswir1 echo "Target Sparc Arch $sparc_cpu" 19723142255cSblueswir1fi 1973e37630caSaliguoriecho "xen support $xen" 19742e4d9fb1Saurel32echo "brlapi support $brlapi" 1975a20a6f46SJuan Quintelaecho "bluez support $bluez" 1976a25dba17SJuan Quintelaecho "Documentation $docs" 1977c5937220Spbrook[ ! -z "$uname_release" ] && \ 1978c5937220Spbrookecho "uname -r $uname_release" 1979bd0c5661Spbrookecho "NPTL support $nptl" 1980379f6698SPaul Brookecho "GUEST_BASE $guest_base" 198134005a00SKirill A. Shutemovecho "PIE user targets $user_pie" 19828a16d273Sthsecho "vde support $vde" 1983e5d355d1Saliguoriecho "IO thread $io_thread" 19845c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio" 198577755340Sthsecho "Install blobs $blobs" 1986b31a0277SJuan Quintelaecho "KVM support $kvm" 1987f652e6afSaurel32echo "fdt support $fdt" 1988ceb42de8Saliguoriecho "preadv support $preadv" 19895f6b9e8fSBlue Swirlecho "fdatasync $fdatasync" 1990ee682d27SStefan Weilecho "uuid support $uuid" 199167b915a5Sbellard 199297a847bcSbellardif test $sdl_too_old = "yes"; then 199324b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support" 1994e8cd23deSbellardfi 199597a847bcSbellard 199698ec69acSJuan Quintelaconfig_host_mak="config-host.mak" 19974bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld" 199897a847bcSbellard 199998ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak 200098ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak 200198ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak 200298ec69acSJuan Quintelaecho >> $config_host_mak 200398ec69acSJuan Quintela 20042358a494SJuan Quintelaecho "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak 200507381cc1SAnthony Liguoriif test "$mingw32" = "yes" ; then 200607381cc1SAnthony Liguori echo "CONFIG_QEMU_CONFDIR=\"$sysconfdir\"" >> $config_host_mak 200707381cc1SAnthony Liguorielse 200807381cc1SAnthony Liguori echo "CONFIG_QEMU_CONFDIR=\"${sysconfdir}/qemu\"" >> $config_host_mak 200907381cc1SAnthony Liguorifi 2010804edf29SJuan Quintela 20112408a527Saurel32case "$cpu" in 201224e804ecSAlexander Graf i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) 2013e0da9dd3SJuan Quintela ARCH=$cpu 20142408a527Saurel32 ;; 2015a302c32dSLaurent Desnogues armv4b|armv4l) 201616dbd14fSJuan Quintela ARCH=arm 20172408a527Saurel32 ;; 20182408a527Saurel32 *) 20193142255cSblueswir1 echo "Unsupported CPU = $cpu" 20207d13299dSbellard exit 1 20212408a527Saurel32 ;; 20222408a527Saurel32esac 202398ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak 2024f8393946Saurel32if test "$debug_tcg" = "yes" ; then 20252358a494SJuan Quintela echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak 2026f8393946Saurel32fi 2027b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then 2028b4475aa2SLuiz Capitulino echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak 2029b4475aa2SLuiz Capitulinofi 2030f3d08ee6SPaul Brookif test "$debug" = "yes" ; then 20312358a494SJuan Quintela echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak 2032f3d08ee6SPaul Brookfi 20331625af87Saliguoriif test "$strip_opt" = "yes" ; then 203498ec69acSJuan Quintela echo "STRIP_OPT=-s" >> $config_host_mak 20351625af87Saliguorifi 20367d13299dSbellardif test "$bigendian" = "yes" ; then 2037e2542fe2SJuan Quintela echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak 203897a847bcSbellardfi 20392358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak 204067b915a5Sbellardif test "$mingw32" = "yes" ; then 204198ec69acSJuan Quintela echo "CONFIG_WIN32=y" >> $config_host_mak 2042210fa556Spbrookelse 204335f4df27SJuan Quintela echo "CONFIG_POSIX=y" >> $config_host_mak 2044210fa556Spbrookfi 2045128ab2ffSblueswir1 2046dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then 2047dffcb71cSMark McLoughlin echo "CONFIG_LINUX=y" >> $config_host_mak 2048dffcb71cSMark McLoughlinfi 2049dffcb71cSMark McLoughlin 205083fb7adfSbellardif test "$darwin" = "yes" ; then 205198ec69acSJuan Quintela echo "CONFIG_DARWIN=y" >> $config_host_mak 205283fb7adfSbellardfi 2053b29fe3edSmalc 2054b29fe3edSmalcif test "$aix" = "yes" ; then 205598ec69acSJuan Quintela echo "CONFIG_AIX=y" >> $config_host_mak 2056b29fe3edSmalcfi 2057b29fe3edSmalc 2058ec530c81Sbellardif test "$solaris" = "yes" ; then 205998ec69acSJuan Quintela echo "CONFIG_SOLARIS=y" >> $config_host_mak 20602358a494SJuan Quintela echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak 20610475a5caSths if test "$needs_libsunmath" = "yes" ; then 206275b5a697SJuan Quintela echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak 20630475a5caSths fi 2064ec530c81Sbellardfi 206597a847bcSbellardif test "$static" = "yes" ; then 206698ec69acSJuan Quintela echo "CONFIG_STATIC=y" >> $config_host_mak 206797a847bcSbellardfi 206805c2a3e7Sbellardif test $profiler = "yes" ; then 20692358a494SJuan Quintela echo "CONFIG_PROFILER=y" >> $config_host_mak 207005c2a3e7Sbellardfi 2071c20709aaSbellardif test "$slirp" = "yes" ; then 207298ec69acSJuan Quintela echo "CONFIG_SLIRP=y" >> $config_host_mak 2073b6e31c12SJuan Quintela QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS" 2074c20709aaSbellardfi 20758a16d273Sthsif test "$vde" = "yes" ; then 207698ec69acSJuan Quintela echo "CONFIG_VDE=y" >> $config_host_mak 20778a16d273Sthsfi 20780c58ac1cSmalcfor card in $audio_card_list; do 2079f6e5889eSpbrook def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` 208098ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 20810c58ac1cSmalcdone 20822358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak 20830c58ac1cSmalcfor drv in $audio_drv_list; do 2084f6e5889eSpbrook def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` 208598ec69acSJuan Quintela echo "$def=y" >> $config_host_mak 2086923e4521Smalc if test "$drv" = "fmod"; then 20877aac6cb1SJuan Quintela echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak 2088fb065187Sbellard fi 20890c58ac1cSmalcdone 209067f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then 209167f86e8eSJuan Quintela echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak 209267f86e8eSJuan Quintelafi 2093d5631638Smalcif test "$audio_win_int" = "yes" ; then 2094d5631638Smalc echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak 2095d5631638Smalcfi 2096eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak 20978ff9cbf7Smalcif test "$mixemu" = "yes" ; then 209898ec69acSJuan Quintela echo "CONFIG_MIXEMU=y" >> $config_host_mak 20998ff9cbf7Smalcfi 21008d5d2d4cSthsif test "$vnc_tls" = "yes" ; then 210198ec69acSJuan Quintela echo "CONFIG_VNC_TLS=y" >> $config_host_mak 2102525061bfSJuan Quintela echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak 21038d5d2d4cSthsfi 21042f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then 210598ec69acSJuan Quintela echo "CONFIG_VNC_SASL=y" >> $config_host_mak 210660ddf533SJuan Quintela echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak 21072f9606b3Saliguorifi 210876655d6dSaliguoriif test "$fnmatch" = "yes" ; then 21092358a494SJuan Quintela echo "CONFIG_FNMATCH=y" >> $config_host_mak 211076655d6dSaliguorifi 2111ee682d27SStefan Weilif test "$uuid" = "yes" ; then 2112ee682d27SStefan Weil echo "CONFIG_UUID=y" >> $config_host_mak 2113ee682d27SStefan Weilfi 2114b1a550a0Spbrookqemu_version=`head $source_path/VERSION` 211598ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak 21162358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak 211798ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak 211898ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak 2119a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then 212098ec69acSJuan Quintela echo "BUILD_DOCS=yes" >> $config_host_mak 2121cc8ae6deSpbrookfi 21221ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then 212398ec69acSJuan Quintela echo "CONFIG_SDL=y" >> $config_host_mak 21248ad3a7ddSJuan Quintela echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak 212549ecc3faSbellardfi 212649ecc3faSbellardif test "$cocoa" = "yes" ; then 212798ec69acSJuan Quintela echo "CONFIG_COCOA=y" >> $config_host_mak 212849ecc3faSbellardfi 21294d3b6f6eSbalrogif test "$curses" = "yes" ; then 213098ec69acSJuan Quintela echo "CONFIG_CURSES=y" >> $config_host_mak 2131ab4e5602SJan Kiszkafi 21323b3f24adSaurel32if test "$atfile" = "yes" ; then 21332358a494SJuan Quintela echo "CONFIG_ATFILE=y" >> $config_host_mak 21343b3f24adSaurel32fi 2135ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then 21362358a494SJuan Quintela echo "CONFIG_UTIMENSAT=y" >> $config_host_mak 2137ebc996f3SRiku Voipiofi 2138099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then 21392358a494SJuan Quintela echo "CONFIG_PIPE2=y" >> $config_host_mak 2140099d6b0fSRiku Voipiofi 214140ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then 214240ff6d7eSKevin Wolf echo "CONFIG_ACCEPT4=y" >> $config_host_mak 214340ff6d7eSKevin Wolffi 21443ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then 21452358a494SJuan Quintela echo "CONFIG_SPLICE=y" >> $config_host_mak 21463ce34dfbSvibisreenivasanfi 2147c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then 2148c2882b96SRiku Voipio echo "CONFIG_EVENTFD=y" >> $config_host_mak 2149c2882b96SRiku Voipiofi 2150d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then 2151d0927938SUlrich Hecht echo "CONFIG_FALLOCATE=y" >> $config_host_mak 2152d0927938SUlrich Hechtfi 2153d0927938SUlrich Hechtif test "$dup3" = "yes" ; then 2154d0927938SUlrich Hecht echo "CONFIG_DUP3=y" >> $config_host_mak 2155d0927938SUlrich Hechtfi 21563b3f24adSaurel32if test "$inotify" = "yes" ; then 21572358a494SJuan Quintela echo "CONFIG_INOTIFY=y" >> $config_host_mak 21583b3f24adSaurel32fi 2159c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then 2160c05c7a73SRiku Voipio echo "CONFIG_INOTIFY1=y" >> $config_host_mak 2161c05c7a73SRiku Voipiofi 21626ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then 21636ae9a1f4SJuan Quintela echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak 21646ae9a1f4SJuan Quintelafi 21656ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then 21666ae9a1f4SJuan Quintela echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak 21676ae9a1f4SJuan Quintelafi 2168769ce76dSAlexander Grafif test "$curl" = "yes" ; then 216998ec69acSJuan Quintela echo "CONFIG_CURL=y" >> $config_host_mak 2170b1d5a277SJuan Quintela echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak 2171769ce76dSAlexander Graffi 21722e4d9fb1Saurel32if test "$brlapi" = "yes" ; then 217398ec69acSJuan Quintela echo "CONFIG_BRLAPI=y" >> $config_host_mak 21742e4d9fb1Saurel32fi 2175fb599c9aSbalrogif test "$bluez" = "yes" ; then 217698ec69acSJuan Quintela echo "CONFIG_BLUEZ=y" >> $config_host_mak 2177ef7635ecSJuan Quintela echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak 2178fb599c9aSbalrogfi 2179e37630caSaliguoriif test "$xen" = "yes" ; then 21805647eb74SJuan Quintela echo "CONFIG_XEN=y" >> $config_host_mak 2181e37630caSaliguorifi 2182e5d355d1Saliguoriif test "$io_thread" = "yes" ; then 218398ec69acSJuan Quintela echo "CONFIG_IOTHREAD=y" >> $config_host_mak 2184e5d355d1Saliguorifi 21855c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then 21865c6c3a6cSChristoph Hellwig echo "CONFIG_LINUX_AIO=y" >> $config_host_mak 21875c6c3a6cSChristoph Hellwigfi 218877755340Sthsif test "$blobs" = "yes" ; then 218998ec69acSJuan Quintela echo "INSTALL_BLOBS=yes" >> $config_host_mak 219077755340Sthsfi 2191bf9298b9Saliguoriif test "$iovec" = "yes" ; then 21922358a494SJuan Quintela echo "CONFIG_IOVEC=y" >> $config_host_mak 2193bf9298b9Saliguorifi 2194ceb42de8Saliguoriif test "$preadv" = "yes" ; then 21952358a494SJuan Quintela echo "CONFIG_PREADV=y" >> $config_host_mak 2196ceb42de8Saliguorifi 2197f652e6afSaurel32if test "$fdt" = "yes" ; then 21983f0855b1SJuan Quintela echo "CONFIG_FDT=y" >> $config_host_mak 2199f652e6afSaurel32fi 2200de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then 2201de5071c5SBlue Swirl echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak 2202de5071c5SBlue Swirlfi 2203747bbdf7SBlue Swirlif test "$gcc_attribute_warn_unused_result" = "yes" ; then 2204747bbdf7SBlue Swirl echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak 2205747bbdf7SBlue Swirlfi 22065f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then 22075f6b9e8fSBlue Swirl echo "CONFIG_FDATASYNC=y" >> $config_host_mak 22085f6b9e8fSBlue Swirlfi 220997a847bcSbellard 221083fb7adfSbellard# XXX: suppress that 22117d3505c5Sbellardif [ "$bsd" = "yes" ] ; then 22122358a494SJuan Quintela echo "CONFIG_BSD=y" >> $config_host_mak 22137d3505c5Sbellardfi 22147d3505c5Sbellard 22152358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak 2216c5937220Spbrook 221720ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then 221820ff6c80SAnthony Liguori echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak 221920ff6c80SAnthony Liguorifi 222020ff6c80SAnthony Liguori 222168063649Sblueswir1# USB host support 222268063649Sblueswir1case "$usb" in 222368063649Sblueswir1linux) 222498ec69acSJuan Quintela echo "HOST_USB=linux" >> $config_host_mak 222568063649Sblueswir1;; 222668063649Sblueswir1bsd) 222798ec69acSJuan Quintela echo "HOST_USB=bsd" >> $config_host_mak 222868063649Sblueswir1;; 222968063649Sblueswir1*) 223098ec69acSJuan Quintela echo "HOST_USB=stub" >> $config_host_mak 223168063649Sblueswir1;; 223268063649Sblueswir1esac 223368063649Sblueswir1 2234c39e3338Spbrooktools= 2235c39e3338Spbrookif test `expr "$target_list" : ".*softmmu.*"` != 0 ; then 223686355e07SAurelien Jarno tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" 22372bff4b6fSBlue Swirl if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then 223886355e07SAurelien Jarno tools="qemu-nbd\$(EXESUF) $tools" 22395495ed11SLuiz Capitulino if [ "$check_utests" = "yes" ]; then 22403aa3dcffSLuiz Capitulino tools="check-qint check-qstring check-qdict check-qlist $tools" 2241422c46a8SAnthony Liguori tools="check-qfloat check-qjson $tools" 22425495ed11SLuiz Capitulino fi 22437a5ca864Sbellard fi 2244c39e3338Spbrookfi 224598ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak 2246c39e3338Spbrook 2247161294d8SJuan Quintela# Mac OS X ships with a broken assembler 2248253d0942SAlexander Grafroms= 2249161294d8SJuan Quintelaif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ 2250ea5ad306SAndreas Faerber "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ 2251b461cdc9SBlue Swirl `expr "$target_list" : ".*softmmu.*"` != 0 ; then 2252c05ac895SPaul Brook roms="optionrom" 2253253d0942SAlexander Graffi 225498ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak 2255253d0942SAlexander Graf 2256804edf29SJuan Quintelaecho "prefix=$prefix" >> $config_host_mak 2257804edf29SJuan Quintelaecho "bindir=\${prefix}$binsuffix" >> $config_host_mak 2258804edf29SJuan Quintelaecho "mandir=\${prefix}$mansuffix" >> $config_host_mak 2259804edf29SJuan Quintelaecho "datadir=\${prefix}$datasuffix" >> $config_host_mak 226007381cc1SAnthony Liguoriecho "sysconfdir=$sysconfdir" >> $config_host_mak 2261804edf29SJuan Quintelaecho "docdir=\${prefix}$docsuffix" >> $config_host_mak 2262804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak 2263804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak 2264804edf29SJuan Quintelaecho "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak 2265804edf29SJuan Quintelaecho "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak 2266804edf29SJuan Quintelaecho "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak 2267804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak 2268804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak 2269804edf29SJuan Quintelaif test "$sparse" = "yes" ; then 2270804edf29SJuan Quintela echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak 2271804edf29SJuan Quintela echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak 2272a558ee17SJuan Quintela echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak 2273804edf29SJuan Quintelafi 2274804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak 2275804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak 2276804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak 2277e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak 2278a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak 2279c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak 2280e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak 2281a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak 2282a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak 228373da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak 22843e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak 2285804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak 2286804edf29SJuan Quintela 22874bf6b55bSJuan Quintela# generate list of library paths for linker script 22884bf6b55bSJuan Quintela 22894bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld} 22904bf6b55bSJuan Quintela 22914bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then 22924bf6b55bSJuan Quintela if cmp -s $config_host_ld ${config_host_ld}~ ; then 22934bf6b55bSJuan Quintela mv ${config_host_ld}~ $config_host_ld 22944bf6b55bSJuan Quintela else 22954bf6b55bSJuan Quintela rm ${config_host_ld}~ 22964bf6b55bSJuan Quintela fi 22974bf6b55bSJuan Quintelafi 22984bf6b55bSJuan Quintela 22994d904533SBlue Swirlfor d in libdis libdis-user; do 23004d904533SBlue Swirl mkdir -p $d 23014d904533SBlue Swirl rm -f $d/Makefile 23024d904533SBlue Swirl ln -s $source_path/Makefile.dis $d/Makefile 23034d904533SBlue Swirl echo > $d/config.mak 23044d904533SBlue Swirldone 23054d904533SBlue Swirl 230697a847bcSbellardfor target in $target_list; do 230797a847bcSbellardtarget_dir="$target" 230825be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak 2309600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1` 231097a847bcSbellardtarget_bigendian="no" 23111f3d3c8fSJuan Quintela 2312ea2d6a39SJuan Quintelacase "$target_arch2" in 231324e804ecSAlexander Graf armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus) 2314ea2d6a39SJuan Quintela target_bigendian=yes 2315ea2d6a39SJuan Quintela ;; 2316ea2d6a39SJuan Quintelaesac 231797a847bcSbellardtarget_softmmu="no" 2318997344f3Sbellardtarget_user_only="no" 2319831b7825Sthstarget_linux_user="no" 2320831b7825Sthstarget_darwin_user="no" 232184778508Sblueswir1target_bsd_user="no" 23229e407a85Spbrookcase "$target" in 2323600309b6SBlue Swirl ${target_arch2}-softmmu) 23249e407a85Spbrook target_softmmu="yes" 23259e407a85Spbrook ;; 2326600309b6SBlue Swirl ${target_arch2}-linux-user) 23279c7a4202SBlue Swirl if test "$linux" != "yes" ; then 23289c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Linux host" 23299c7a4202SBlue Swirl exit 1 23309c7a4202SBlue Swirl fi 23319e407a85Spbrook target_user_only="yes" 23329e407a85Spbrook target_linux_user="yes" 23339e407a85Spbrook ;; 2334600309b6SBlue Swirl ${target_arch2}-darwin-user) 23359c7a4202SBlue Swirl if test "$darwin" != "yes" ; then 23369c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a Darwin host" 23379c7a4202SBlue Swirl exit 1 23389c7a4202SBlue Swirl fi 23399e407a85Spbrook target_user_only="yes" 2340831b7825Sths target_darwin_user="yes" 23419e407a85Spbrook ;; 2342600309b6SBlue Swirl ${target_arch2}-bsd-user) 23439cf55765SBlue Swirl if test "$bsd" != "yes" ; then 23449c7a4202SBlue Swirl echo "ERROR: Target '$target' is only available on a BSD host" 23459c7a4202SBlue Swirl exit 1 23469c7a4202SBlue Swirl fi 234784778508Sblueswir1 target_user_only="yes" 234884778508Sblueswir1 target_bsd_user="yes" 234984778508Sblueswir1 ;; 23509e407a85Spbrook *) 23519e407a85Spbrook echo "ERROR: Target '$target' not recognised" 23529e407a85Spbrook exit 1 23539e407a85Spbrook ;; 23549e407a85Spbrookesac 2355831b7825Sths 235697a847bcSbellardmkdir -p $target_dir 2357158142c2Sbellardmkdir -p $target_dir/fpu 235857fec1feSbellardmkdir -p $target_dir/tcg 235959f2a787SGerd Hoffmannmkdir -p $target_dir/ide 236084778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then 236169de927cSbellard mkdir -p $target_dir/nwfpe 236269de927cSbellardfi 236369de927cSbellard 2364ec530c81Sbellard# 2365ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link 2366ec530c81Sbellard# 2367ec530c81Sbellardrm -f $target_dir/Makefile 2368ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile 2369ec530c81Sbellard 237097a847bcSbellard 237125be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak 237297a847bcSbellard 2373e5fe0c52Spbrookbflt="no" 2374cb33da57Sblueswir1elfload32="no" 2375bd0c5661Spbrooktarget_nptl="no" 2376600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"` 237725be210fSJuan Quintelaecho "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_target_mak 237856aebc89Spbrookgdb_xml_files="" 23797ba1e619Saliguori 2380938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2" 23816acff7daSJuan QuintelaTARGET_BASE_ARCH="" 2382e6e91b9cSJuan QuintelaTARGET_ABI_DIR="" 2383e73aae67SJuan Quintela 2384600309b6SBlue Swirlcase "$target_arch2" in 23852408a527Saurel32 i386) 23861ad2134fSPaul Brook target_phys_bits=32 23872408a527Saurel32 ;; 23882408a527Saurel32 x86_64) 23896acff7daSJuan Quintela TARGET_BASE_ARCH=i386 23901ad2134fSPaul Brook target_phys_bits=64 23912408a527Saurel32 ;; 23922408a527Saurel32 alpha) 23931ad2134fSPaul Brook target_phys_bits=64 23942408a527Saurel32 ;; 23952408a527Saurel32 arm|armeb) 2396b498c8a0SJuan Quintela TARGET_ARCH=arm 2397e5fe0c52Spbrook bflt="yes" 2398bd0c5661Spbrook target_nptl="yes" 239956aebc89Spbrook gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" 24001ad2134fSPaul Brook target_phys_bits=32 24012408a527Saurel32 ;; 24022408a527Saurel32 cris) 2403253bd7f8Sedgar_igl target_nptl="yes" 24041ad2134fSPaul Brook target_phys_bits=32 24052408a527Saurel32 ;; 24062408a527Saurel32 m68k) 24070938cda5Saurel32 bflt="yes" 240856aebc89Spbrook gdb_xml_files="cf-core.xml cf-fp.xml" 24091ad2134fSPaul Brook target_phys_bits=32 24102408a527Saurel32 ;; 241172b675caSEdgar E. Iglesias microblaze) 241272b675caSEdgar E. Iglesias bflt="yes" 241372b675caSEdgar E. Iglesias target_nptl="yes" 241472b675caSEdgar E. Iglesias target_phys_bits=32 241572b675caSEdgar E. Iglesias ;; 24162408a527Saurel32 mips|mipsel) 2417b498c8a0SJuan Quintela TARGET_ARCH=mips 241825be210fSJuan Quintela echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak 2419f04dc72fSPaul Brook target_nptl="yes" 24201ad2134fSPaul Brook target_phys_bits=64 24212408a527Saurel32 ;; 24222408a527Saurel32 mipsn32|mipsn32el) 2423b498c8a0SJuan Quintela TARGET_ARCH=mipsn32 24246acff7daSJuan Quintela TARGET_BASE_ARCH=mips 242525be210fSJuan Quintela echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak 24261ad2134fSPaul Brook target_phys_bits=64 24272408a527Saurel32 ;; 24282408a527Saurel32 mips64|mips64el) 2429b498c8a0SJuan Quintela TARGET_ARCH=mips64 24306acff7daSJuan Quintela TARGET_BASE_ARCH=mips 243125be210fSJuan Quintela echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak 24321ad2134fSPaul Brook target_phys_bits=64 24332408a527Saurel32 ;; 24342408a527Saurel32 ppc) 2435c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 24361ad2134fSPaul Brook target_phys_bits=32 2437d6630708SNathan Froyd target_nptl="yes" 24382408a527Saurel32 ;; 24392408a527Saurel32 ppcemb) 24406acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 2441e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 2442c8b3532dSaurel32 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 24431ad2134fSPaul Brook target_phys_bits=64 2444d6630708SNathan Froyd target_nptl="yes" 24452408a527Saurel32 ;; 24462408a527Saurel32 ppc64) 24476acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 2448e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 2449c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 24501ad2134fSPaul Brook target_phys_bits=64 24512408a527Saurel32 ;; 24522408a527Saurel32 ppc64abi32) 2453b498c8a0SJuan Quintela TARGET_ARCH=ppc64 24546acff7daSJuan Quintela TARGET_BASE_ARCH=ppc 2455e6e91b9cSJuan Quintela TARGET_ABI_DIR=ppc 245625be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 2457c8b3532dSaurel32 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" 24581ad2134fSPaul Brook target_phys_bits=64 24592408a527Saurel32 ;; 24602408a527Saurel32 sh4|sh4eb) 2461b498c8a0SJuan Quintela TARGET_ARCH=sh4 24624dbed897Spbrook bflt="yes" 24630b6d3ae0Saurel32 target_nptl="yes" 24641ad2134fSPaul Brook target_phys_bits=32 24652408a527Saurel32 ;; 24662408a527Saurel32 sparc) 24671ad2134fSPaul Brook target_phys_bits=64 24682408a527Saurel32 ;; 24692408a527Saurel32 sparc64) 24706acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 24710938cda5Saurel32 elfload32="yes" 24721ad2134fSPaul Brook target_phys_bits=64 24732408a527Saurel32 ;; 24742408a527Saurel32 sparc32plus) 2475b498c8a0SJuan Quintela TARGET_ARCH=sparc64 24766acff7daSJuan Quintela TARGET_BASE_ARCH=sparc 2477e6e91b9cSJuan Quintela TARGET_ABI_DIR=sparc 247825be210fSJuan Quintela echo "TARGET_ABI32=y" >> $config_target_mak 24791ad2134fSPaul Brook target_phys_bits=64 24802408a527Saurel32 ;; 248124e804ecSAlexander Graf s390x) 248224e804ecSAlexander Graf target_phys_bits=64 248324e804ecSAlexander Graf ;; 24842408a527Saurel32 *) 2485de83cd02Sbellard echo "Unsupported target CPU" 2486de83cd02Sbellard exit 1 24872408a527Saurel32 ;; 24882408a527Saurel32esac 248925be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak 2490053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`" 249125be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak 249225be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak 249342bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH 24946acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then 24956acff7daSJuan Quintela TARGET_BASE_ARCH=$TARGET_ARCH 24966acff7daSJuan Quintelafi 249725be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak 2498e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then 2499e6e91b9cSJuan Quintela TARGET_ABI_DIR=$TARGET_ARCH 2500e6e91b9cSJuan Quintelafi 250125be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak 25021ad2134fSPaul Brookif [ $target_phys_bits -lt $hostlongbits ] ; then 25031ad2134fSPaul Brook target_phys_bits=$hostlongbits 25041ad2134fSPaul Brookfi 25051b0c87fcSJuan Quintelacase "$target_arch2" in 25061b0c87fcSJuan Quintela i386|x86_64) 25071b0c87fcSJuan Quintela if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then 250825be210fSJuan Quintela echo "CONFIG_XEN=y" >> $config_target_mak 25091b0c87fcSJuan Quintela fi 25101b0c87fcSJuan Quintelaesac 2511c59249f9SJuan Quintelacase "$target_arch2" in 25120e60a699SAlexander Graf i386|x86_64|ppcemb|ppc|ppc64|s390x) 2513c59249f9SJuan Quintela # Make sure the target and host cpus are compatible 2514c59249f9SJuan Quintela if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \ 2515c59249f9SJuan Quintela \( "$target_arch2" = "$cpu" -o \ 2516c59249f9SJuan Quintela \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \ 25175f114bc6SAlexander Graf \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \ 2518c59249f9SJuan Quintela \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \ 2519c59249f9SJuan Quintela \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then 252025be210fSJuan Quintela echo "CONFIG_KVM=y" >> $config_target_mak 252125be210fSJuan Quintela echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak 2522dae5079aSJan Kiszka if test "$kvm_para" = "yes"; then 2523dae5079aSJan Kiszka echo "CONFIG_KVM_PARA=y" >> $config_target_mak 2524dae5079aSJan Kiszka fi 2525c59249f9SJuan Quintela fi 2526c59249f9SJuan Quintelaesac 2527de83cd02Sbellardif test "$target_bigendian" = "yes" ; then 252825be210fSJuan Quintela echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak 252997a847bcSbellardfi 253097a847bcSbellardif test "$target_softmmu" = "yes" ; then 2531b1aa27c4SPaul Brook echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak 253225be210fSJuan Quintela echo "CONFIG_SOFTMMU=y" >> $config_target_mak 253325be210fSJuan Quintela echo "LIBS+=$libs_softmmu" >> $config_target_mak 25340e8c9214SAndreas Färber echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak 25355791f45bSKirill A. Shutemov echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak 2536de83cd02Sbellardfi 2537997344f3Sbellardif test "$target_user_only" = "yes" ; then 253825be210fSJuan Quintela echo "CONFIG_USER_ONLY=y" >> $config_target_mak 2539997344f3Sbellardfi 2540831b7825Sthsif test "$target_linux_user" = "yes" ; then 254125be210fSJuan Quintela echo "CONFIG_LINUX_USER=y" >> $config_target_mak 2542831b7825Sthsfi 2543831b7825Sthsif test "$target_darwin_user" = "yes" ; then 254425be210fSJuan Quintela echo "CONFIG_DARWIN_USER=y" >> $config_target_mak 2545831b7825Sthsfi 254656aebc89Spbrooklist="" 254756aebc89Spbrookif test ! -z "$gdb_xml_files" ; then 254856aebc89Spbrook for x in $gdb_xml_files; do 254956aebc89Spbrook list="$list $source_path/gdb-xml/$x" 255056aebc89Spbrook done 255125be210fSJuan Quintela echo "TARGET_XML_FILES=$list" >> $config_target_mak 25523d0f1517SJuan Quintelafi 2553de83cd02Sbellard 2554f57975fbSJuan Quintelacase "$target_arch2" in 2555990b3e19SRichard Henderson alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus) 255625be210fSJuan Quintela echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak 2557f57975fbSJuan Quintela ;; 2558d6b38939SJuan Quintela *) 255925be210fSJuan Quintela echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak 2560d6b38939SJuan Quintela ;; 2561f57975fbSJuan Quintelaesac 2562f57975fbSJuan Quintela 2563e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then 256425be210fSJuan Quintela echo "TARGET_HAS_BFLT=y" >> $config_target_mak 2565e5fe0c52Spbrookfi 2566bd0c5661Spbrookif test "$target_user_only" = "yes" \ 2567bd0c5661Spbrook -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then 256825be210fSJuan Quintela echo "CONFIG_USE_NPTL=y" >> $config_target_mak 2569bd0c5661Spbrookfi 2570cb33da57Sblueswir1# 32 bit ELF loader in addition to native 64 bit loader? 2571cb33da57Sblueswir1if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then 257225be210fSJuan Quintela echo "TARGET_HAS_ELFLOAD32=y" >> $config_target_mak 2573cb33da57Sblueswir1fi 2574379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then 257525be210fSJuan Quintela echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak 2576379f6698SPaul Brookfi 257784778508Sblueswir1if test "$target_bsd_user" = "yes" ; then 257825be210fSJuan Quintela echo "CONFIG_BSD_USER=y" >> $config_target_mak 257984778508Sblueswir1fi 25805b0753e0Sbellard 25814afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets 2582fa282484SJuan Quintela 25834afddb55SJuan Quintelacflags="" 2584fa282484SJuan Quintelaldflags="" 25859b8e111fSJuan Quintela 258657ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then 258757ddfbf7SJuan Quintela cflags="-I\$(SRC_PATH)/tcg/sparc $cflags" 258824e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then 258924e804ecSAlexander Graf cflags="-I\$(SRC_PATH)/tcg/s390 $cflags" 259057ddfbf7SJuan Quintelaelse 259157ddfbf7SJuan Quintela cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags" 259257ddfbf7SJuan Quintelafi 259357ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/tcg $cflags" 259457ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/fpu $cflags" 259557ddfbf7SJuan Quintela 25964d904533SBlue Swirlif test "$target_user_only" = "yes" ; then 25974d904533SBlue Swirl libdis_config_mak=libdis-user/config.mak 25984d904533SBlue Swirlelse 25994d904533SBlue Swirl libdis_config_mak=libdis/config.mak 26004d904533SBlue Swirlfi 26014d904533SBlue Swirl 260264656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do 260364656024SJuan Quintela case "$i" in 260464656024SJuan Quintela alpha) 260525be210fSJuan Quintela echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak 26064d904533SBlue Swirl echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak 260764656024SJuan Quintela ;; 260864656024SJuan Quintela arm) 260925be210fSJuan Quintela echo "CONFIG_ARM_DIS=y" >> $config_target_mak 26104d904533SBlue Swirl echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak 261164656024SJuan Quintela ;; 261264656024SJuan Quintela cris) 261325be210fSJuan Quintela echo "CONFIG_CRIS_DIS=y" >> $config_target_mak 26144d904533SBlue Swirl echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak 261564656024SJuan Quintela ;; 261664656024SJuan Quintela hppa) 261725be210fSJuan Quintela echo "CONFIG_HPPA_DIS=y" >> $config_target_mak 26184d904533SBlue Swirl echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak 261964656024SJuan Quintela ;; 262064656024SJuan Quintela i386|x86_64) 262125be210fSJuan Quintela echo "CONFIG_I386_DIS=y" >> $config_target_mak 26224d904533SBlue Swirl echo "CONFIG_I386_DIS=y" >> $libdis_config_mak 262364656024SJuan Quintela ;; 262464656024SJuan Quintela m68k) 262525be210fSJuan Quintela echo "CONFIG_M68K_DIS=y" >> $config_target_mak 26264d904533SBlue Swirl echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak 262764656024SJuan Quintela ;; 262864656024SJuan Quintela microblaze) 262925be210fSJuan Quintela echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak 26304d904533SBlue Swirl echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak 263164656024SJuan Quintela ;; 263264656024SJuan Quintela mips*) 263325be210fSJuan Quintela echo "CONFIG_MIPS_DIS=y" >> $config_target_mak 26344d904533SBlue Swirl echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak 263564656024SJuan Quintela ;; 263664656024SJuan Quintela ppc*) 263725be210fSJuan Quintela echo "CONFIG_PPC_DIS=y" >> $config_target_mak 26384d904533SBlue Swirl echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak 263964656024SJuan Quintela ;; 264024e804ecSAlexander Graf s390*) 264125be210fSJuan Quintela echo "CONFIG_S390_DIS=y" >> $config_target_mak 26424d904533SBlue Swirl echo "CONFIG_S390_DIS=y" >> $libdis_config_mak 264364656024SJuan Quintela ;; 264464656024SJuan Quintela sh4) 264525be210fSJuan Quintela echo "CONFIG_SH4_DIS=y" >> $config_target_mak 26464d904533SBlue Swirl echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak 264764656024SJuan Quintela ;; 264864656024SJuan Quintela sparc*) 264925be210fSJuan Quintela echo "CONFIG_SPARC_DIS=y" >> $config_target_mak 26504d904533SBlue Swirl echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak 265164656024SJuan Quintela ;; 265264656024SJuan Quintela esac 265364656024SJuan Quinteladone 265464656024SJuan Quintela 26556ee7126fSJuan Quintelacase "$ARCH" in 26566ee7126fSJuan Quintelaalpha) 26576ee7126fSJuan Quintela # Ensure there's only a single GP 26586ee7126fSJuan Quintela cflags="-msmall-data $cflags" 26596ee7126fSJuan Quintela;; 2660c60d0afaSJuan Quintelaia64) 2661c60d0afaSJuan Quintela cflags="-mno-sdata $cflags" 2662c60d0afaSJuan Quintela;; 26636ee7126fSJuan Quintelaesac 26646ee7126fSJuan Quintela 266555d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then 266655d9c04bSJuan Quintela case "$TARGET_BASE_ARCH" in 266755d9c04bSJuan Quintela arm) 266855d9c04bSJuan Quintela cflags="-DHAS_AUDIO $cflags" 266955d9c04bSJuan Quintela ;; 267055d9c04bSJuan Quintela i386|mips|ppc) 267155d9c04bSJuan Quintela cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags" 267255d9c04bSJuan Quintela ;; 267355d9c04bSJuan Quintela esac 267455d9c04bSJuan Quintelafi 267555d9c04bSJuan Quintela 267634005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \ 267734005a00SKirill A. Shutemov "$user_pie" = "yes" ; then 267834005a00SKirill A. Shutemov cflags="-fpie $cflags" 267934005a00SKirill A. Shutemov ldflags="-pie $ldflags" 268034005a00SKirill A. Shutemovfi 268134005a00SKirill A. Shutemov 2682471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \ 2683471857ddSJuan Quintela "$TARGET_ARCH" = "microblaze" -o \ 2684471857ddSJuan Quintela "$TARGET_ARCH" = "cris" \) ; then 268525be210fSJuan Quintela echo "CONFIG_NEED_MMU=y" >> $config_target_mak 2686471857ddSJuan Quintelafi 2687471857ddSJuan Quintela 2688d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then 268925be210fSJuan Quintela echo "TARGET_GPROF=yes" >> $config_target_mak 2690d02c1db3SJuan Quintela if test "$target_linux_user" = "yes" ; then 2691d02c1db3SJuan Quintela cflags="-p $cflags" 2692d02c1db3SJuan Quintela ldflags="-p $ldflags" 2693d02c1db3SJuan Quintela fi 2694d02c1db3SJuan Quintela if test "$target_softmmu" = "yes" ; then 2695d02c1db3SJuan Quintela ldflags="-p $ldflags" 269625be210fSJuan Quintela echo "GPROF_CFLAGS=-p" >> $config_target_mak 2697d02c1db3SJuan Quintela fi 2698d02c1db3SJuan Quintelafi 2699d02c1db3SJuan Quintela 27006ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld" 27019b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then 2702fa282484SJuan Quintela case "$ARCH" in 2703fa282484SJuan Quintela sparc) 2704fa282484SJuan Quintela # -static is used to avoid g1/g3 usage by the dynamic linker 2705322e5878SJuan Quintela ldflags="$linker_script -static $ldflags" 2706fa282484SJuan Quintela ;; 2707fa282484SJuan Quintela ia64) 2708322e5878SJuan Quintela ldflags="-Wl,-G0 $linker_script -static $ldflags" 2709fa282484SJuan Quintela ;; 2710df70204dSKirill A. Shutemov i386|x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64) 2711322e5878SJuan Quintela ldflags="$linker_script $ldflags" 2712fa282484SJuan Quintela ;; 2713fa282484SJuan Quintela esac 2714fa282484SJuan Quintelafi 2715fa282484SJuan Quintelaif test "$target_softmmu" = "yes" ; then 2716fa282484SJuan Quintela case "$ARCH" in 2717fa282484SJuan Quintela ia64) 2718322e5878SJuan Quintela ldflags="-Wl,-G0 $linker_script -static $ldflags" 2719fa282484SJuan Quintela ;; 2720fa282484SJuan Quintela esac 2721fa282484SJuan Quintelafi 2722fa282484SJuan Quintela 272325be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak 272425be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak 2725fa282484SJuan Quintela 272697a847bcSbellarddone # for target in $targets 27277d13299dSbellard 27287d13299dSbellard# build tree in object directory if source path is different from current one 27297d13299dSbellardif test "$source_path_used" = "yes" ; then 2730e1144d00SMark McLoughlin DIRS="tests tests/cris slirp audio block net pc-bios/optionrom" 27312d9f27d2SAnthony Liguori DIRS="$DIRS roms/seabios roms/vgabios" 27327d13299dSbellard FILES="Makefile tests/Makefile" 2733e7daa605Sths FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit" 2734e1ffb0f1Sedgar_igl FILES="$FILES tests/test-mmap.c" 27357ea78b74SJan Kiszka FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x" 27362d9f27d2SAnthony Liguori FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" 27377ea78b74SJan Kiszka for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do 27387ea78b74SJan Kiszka FILES="$FILES pc-bios/`basename $bios_file`" 27397ea78b74SJan Kiszka done 27407d13299dSbellard for dir in $DIRS ; do 27417d13299dSbellard mkdir -p $dir 27427d13299dSbellard done 2743ec530c81Sbellard # remove the link and recreate it, as not all "ln -sf" overwrite the link 27447d13299dSbellard for f in $FILES ; do 2745ec530c81Sbellard rm -f $f 2746ec530c81Sbellard ln -s $source_path/$f $f 27477d13299dSbellard done 27487d13299dSbellardfi 27491ad2134fSPaul Brook 2750c34ebfdcSAnthony Liguori# temporary config to build submodules 27512d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do 2752c34ebfdcSAnthony Liguori config_mak=roms/$rom/config.mak 275337116c89SStefan Weil echo "# Automatically generated by configure - do not modify" > $config_mak 2754c34ebfdcSAnthony Liguori echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak 2755c34ebfdcSAnthony Liguori echo "CC=$cc" >> $config_mak 2756c34ebfdcSAnthony Liguori echo "BCC=bcc" >> $config_mak 2757c34ebfdcSAnthony Liguori echo "CPP=${cross_prefix}cpp" >> $config_mak 2758c34ebfdcSAnthony Liguori echo "OBJCOPY=objcopy" >> $config_mak 2759c34ebfdcSAnthony Liguori echo "IASL=iasl" >> $config_mak 2760c34ebfdcSAnthony Liguori echo "HOST_CC=$host_cc" >> $config_mak 2761c34ebfdcSAnthony Liguori echo "LD=$ld" >> $config_mak 2762c34ebfdcSAnthony Liguoridone 2763c34ebfdcSAnthony Liguori 27641ad2134fSPaul Brookfor hwlib in 32 64; do 27651ad2134fSPaul Brook d=libhw$hwlib 27661ad2134fSPaul Brook mkdir -p $d 27679953b2fcSBlue Swirl mkdir -p $d/ide 27681ad2134fSPaul Brook rm -f $d/Makefile 27691ad2134fSPaul Brook ln -s $source_path/Makefile.hw $d/Makefile 277037116c89SStefan Weil echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak 27711ad2134fSPaul Brookdone 2772add16157SBlue Swirl 2773add16157SBlue Swirld=libuser 2774add16157SBlue Swirlmkdir -p $d 2775add16157SBlue Swirlrm -f $d/Makefile 2776add16157SBlue Swirlln -s $source_path/Makefile.user $d/Makefile 2777299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then 2778299060a0SKirill A. Shutemov echo "QEMU_CFLAGS+=-fpie" > $d/config.mak 2779299060a0SKirill A. Shutemovfi 2780