configure 139 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325
  1. #!/bin/sh
  2. #
  3. # qemu configure script (c) 2003 Fabrice Bellard
  4. #
  5. # Unset some variables known to interfere with behavior of common tools,
  6. # just as autoconf does.
  7. CLICOLOR_FORCE= GREP_OPTIONS=
  8. unset CLICOLOR_FORCE GREP_OPTIONS
  9. # Temporary directory used for files created while
  10. # configure runs. Since it is in the build directory
  11. # we can safely blow away any previous version of it
  12. # (and we need not jump through hoops to try to delete
  13. # it when configure exits.)
  14. TMPDIR1="config-temp"
  15. rm -rf "${TMPDIR1}"
  16. mkdir -p "${TMPDIR1}"
  17. if [ $? -ne 0 ]; then
  18. echo "ERROR: failed to create temporary directory"
  19. exit 1
  20. fi
  21. TMPB="qemu-conf"
  22. TMPC="${TMPDIR1}/${TMPB}.c"
  23. TMPO="${TMPDIR1}/${TMPB}.o"
  24. TMPCXX="${TMPDIR1}/${TMPB}.cxx"
  25. TMPL="${TMPDIR1}/${TMPB}.lo"
  26. TMPA="${TMPDIR1}/lib${TMPB}.la"
  27. TMPE="${TMPDIR1}/${TMPB}.exe"
  28. rm -f config.log
  29. # Print a helpful header at the top of config.log
  30. echo "# QEMU configure log $(date)" >> config.log
  31. printf "# Configured with:" >> config.log
  32. printf " '%s'" "$0" "$@" >> config.log
  33. echo >> config.log
  34. echo "#" >> config.log
  35. error_exit() {
  36. echo
  37. echo "ERROR: $1"
  38. while test -n "$2"; do
  39. echo " $2"
  40. shift
  41. done
  42. echo
  43. exit 1
  44. }
  45. do_compiler() {
  46. # Run the compiler, capturing its output to the log. First argument
  47. # is compiler binary to execute.
  48. local compiler="$1"
  49. shift
  50. echo $compiler "$@" >> config.log
  51. $compiler "$@" >> config.log 2>&1 || return $?
  52. # Test passed. If this is an --enable-werror build, rerun
  53. # the test with -Werror and bail out if it fails. This
  54. # makes warning-generating-errors in configure test code
  55. # obvious to developers.
  56. if test "$werror" != "yes"; then
  57. return 0
  58. fi
  59. # Don't bother rerunning the compile if we were already using -Werror
  60. case "$*" in
  61. *-Werror*)
  62. return 0
  63. ;;
  64. esac
  65. echo $compiler -Werror "$@" >> config.log
  66. $compiler -Werror "$@" >> config.log 2>&1 && return $?
  67. error_exit "configure test passed without -Werror but failed with -Werror." \
  68. "This is probably a bug in the configure script. The failing command" \
  69. "will be at the bottom of config.log." \
  70. "You can run configure with --disable-werror to bypass this check."
  71. }
  72. do_cc() {
  73. do_compiler "$cc" "$@"
  74. }
  75. do_cxx() {
  76. do_compiler "$cxx" "$@"
  77. }
  78. update_cxxflags() {
  79. # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
  80. # options which some versions of GCC's C++ compiler complain about
  81. # because they only make sense for C programs.
  82. QEMU_CXXFLAGS=
  83. for arg in $QEMU_CFLAGS; do
  84. case $arg in
  85. -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
  86. -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
  87. ;;
  88. *)
  89. QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
  90. ;;
  91. esac
  92. done
  93. }
  94. compile_object() {
  95. do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
  96. }
  97. compile_prog() {
  98. local_cflags="$1"
  99. local_ldflags="$2"
  100. do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
  101. }
  102. do_libtool() {
  103. local mode=$1
  104. shift
  105. # Run the compiler, capturing its output to the log.
  106. echo $libtool $mode --tag=CC $cc "$@" >> config.log
  107. $libtool $mode --tag=CC $cc "$@" >> config.log 2>&1 || return $?
  108. # Test passed. If this is an --enable-werror build, rerun
  109. # the test with -Werror and bail out if it fails. This
  110. # makes warning-generating-errors in configure test code
  111. # obvious to developers.
  112. if test "$werror" != "yes"; then
  113. return 0
  114. fi
  115. # Don't bother rerunning the compile if we were already using -Werror
  116. case "$*" in
  117. *-Werror*)
  118. return 0
  119. ;;
  120. esac
  121. echo $libtool $mode --tag=CC $cc -Werror "$@" >> config.log
  122. $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 2>&1 && return $?
  123. error_exit "configure test passed without -Werror but failed with -Werror." \
  124. "This is probably a bug in the configure script. The failing command" \
  125. "will be at the bottom of config.log." \
  126. "You can run configure with --disable-werror to bypass this check."
  127. }
  128. libtool_prog() {
  129. do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC || return $?
  130. do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib
  131. }
  132. # symbolically link $1 to $2. Portable version of "ln -sf".
  133. symlink() {
  134. rm -rf "$2"
  135. mkdir -p "$(dirname "$2")"
  136. ln -s "$1" "$2"
  137. }
  138. # check whether a command is available to this shell (may be either an
  139. # executable or a builtin)
  140. has() {
  141. type "$1" >/dev/null 2>&1
  142. }
  143. # search for an executable in PATH
  144. path_of() {
  145. local_command="$1"
  146. local_ifs="$IFS"
  147. local_dir=""
  148. # pathname has a dir component?
  149. if [ "${local_command#*/}" != "$local_command" ]; then
  150. if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
  151. echo "$local_command"
  152. return 0
  153. fi
  154. fi
  155. if [ -z "$local_command" ]; then
  156. return 1
  157. fi
  158. IFS=:
  159. for local_dir in $PATH; do
  160. if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
  161. echo "$local_dir/$local_command"
  162. IFS="${local_ifs:-$(printf ' \t\n')}"
  163. return 0
  164. fi
  165. done
  166. # not found
  167. IFS="${local_ifs:-$(printf ' \t\n')}"
  168. return 1
  169. }
  170. have_backend () {
  171. echo "$trace_backends" | grep "$1" >/dev/null
  172. }
  173. # default parameters
  174. source_path=`dirname "$0"`
  175. cpu=""
  176. iasl="iasl"
  177. interp_prefix="/usr/gnemul/qemu-%M"
  178. static="no"
  179. cross_prefix=""
  180. audio_drv_list=""
  181. block_drv_rw_whitelist=""
  182. block_drv_ro_whitelist=""
  183. host_cc="cc"
  184. libs_softmmu=""
  185. libs_tools=""
  186. audio_pt_int=""
  187. audio_win_int=""
  188. cc_i386=i386-pc-linux-gnu-gcc
  189. libs_qga=""
  190. debug_info="yes"
  191. stack_protector=""
  192. # Don't accept a target_list environment variable.
  193. unset target_list
  194. # Default value for a variable defining feature "foo".
  195. # * foo="no" feature will only be used if --enable-foo arg is given
  196. # * foo="" feature will be searched for, and if found, will be used
  197. # unless --disable-foo is given
  198. # * foo="yes" this value will only be set by --enable-foo flag.
  199. # feature will searched for,
  200. # if not found, configure exits with error
  201. #
  202. # Always add --enable-foo and --disable-foo command line args.
  203. # Distributions want to ensure that several features are compiled in, and it
  204. # is impossible without a --enable-foo that exits if a feature is not found.
  205. bluez=""
  206. brlapi=""
  207. curl=""
  208. curses=""
  209. docs=""
  210. fdt=""
  211. netmap="no"
  212. pixman=""
  213. sdl=""
  214. sdlabi="1.2"
  215. virtfs=""
  216. vnc="yes"
  217. sparse="no"
  218. uuid=""
  219. vde=""
  220. vnc_tls=""
  221. vnc_sasl=""
  222. vnc_jpeg=""
  223. vnc_png=""
  224. vnc_ws=""
  225. xen=""
  226. xen_ctrl_version=""
  227. xen_pci_passthrough=""
  228. linux_aio=""
  229. cap_ng=""
  230. attr=""
  231. libattr=""
  232. xfs=""
  233. vhost_net="no"
  234. vhost_scsi="no"
  235. kvm="no"
  236. rdma=""
  237. gprof="no"
  238. debug_tcg="no"
  239. debug="no"
  240. strip_opt="yes"
  241. tcg_interpreter="no"
  242. bigendian="no"
  243. mingw32="no"
  244. gcov="no"
  245. gcov_tool="gcov"
  246. EXESUF=""
  247. DSOSUF=".so"
  248. LDFLAGS_SHARED="-shared"
  249. modules="no"
  250. prefix="/usr/local"
  251. mandir="\${prefix}/share/man"
  252. datadir="\${prefix}/share"
  253. qemu_docdir="\${prefix}/share/doc/qemu"
  254. bindir="\${prefix}/bin"
  255. libdir="\${prefix}/lib"
  256. libexecdir="\${prefix}/libexec"
  257. includedir="\${prefix}/include"
  258. sysconfdir="\${prefix}/etc"
  259. local_statedir="\${prefix}/var"
  260. confsuffix="/qemu"
  261. slirp="yes"
  262. fmod_lib=""
  263. fmod_inc=""
  264. oss_lib=""
  265. bsd="no"
  266. linux="no"
  267. solaris="no"
  268. profiler="no"
  269. cocoa="no"
  270. softmmu="yes"
  271. linux_user="no"
  272. bsd_user="no"
  273. guest_base="yes"
  274. aix="no"
  275. blobs="yes"
  276. pkgversion=""
  277. pie=""
  278. zero_malloc=""
  279. qom_cast_debug="yes"
  280. trace_backends="nop"
  281. trace_file="trace"
  282. spice=""
  283. rbd=""
  284. smartcard_nss=""
  285. libusb=""
  286. usb_redir=""
  287. glx=""
  288. zlib="yes"
  289. lzo=""
  290. snappy=""
  291. guest_agent=""
  292. guest_agent_with_vss="no"
  293. vss_win32_sdk=""
  294. win_sdk="no"
  295. want_tools="yes"
  296. libiscsi=""
  297. libnfs=""
  298. coroutine=""
  299. coroutine_pool=""
  300. seccomp=""
  301. glusterfs=""
  302. glusterfs_discard="no"
  303. glusterfs_zerofill="no"
  304. virtio_blk_data_plane=""
  305. gtk=""
  306. gtkabi=""
  307. vte=""
  308. tpm="yes"
  309. libssh2=""
  310. vhdx=""
  311. quorum=""
  312. numa=""
  313. # parse CC options first
  314. for opt do
  315. optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
  316. case "$opt" in
  317. --cross-prefix=*) cross_prefix="$optarg"
  318. ;;
  319. --cc=*) CC="$optarg"
  320. ;;
  321. --cxx=*) CXX="$optarg"
  322. ;;
  323. --source-path=*) source_path="$optarg"
  324. ;;
  325. --cpu=*) cpu="$optarg"
  326. ;;
  327. --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
  328. EXTRA_CFLAGS="$optarg"
  329. ;;
  330. --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
  331. EXTRA_LDFLAGS="$optarg"
  332. ;;
  333. --enable-debug-info) debug_info="yes"
  334. ;;
  335. --disable-debug-info) debug_info="no"
  336. ;;
  337. esac
  338. done
  339. # OS specific
  340. # Using uname is really, really broken. Once we have the right set of checks
  341. # we can eliminate its usage altogether.
  342. # Preferred compiler:
  343. # ${CC} (if set)
  344. # ${cross_prefix}gcc (if cross-prefix specified)
  345. # system compiler
  346. if test -z "${CC}${cross_prefix}"; then
  347. cc="$host_cc"
  348. else
  349. cc="${CC-${cross_prefix}gcc}"
  350. fi
  351. if test -z "${CXX}${cross_prefix}"; then
  352. cxx="c++"
  353. else
  354. cxx="${CXX-${cross_prefix}g++}"
  355. fi
  356. ar="${AR-${cross_prefix}ar}"
  357. as="${AS-${cross_prefix}as}"
  358. cpp="${CPP-$cc -E}"
  359. objcopy="${OBJCOPY-${cross_prefix}objcopy}"
  360. ld="${LD-${cross_prefix}ld}"
  361. libtool="${LIBTOOL-${cross_prefix}libtool}"
  362. strip="${STRIP-${cross_prefix}strip}"
  363. windres="${WINDRES-${cross_prefix}windres}"
  364. pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
  365. query_pkg_config() {
  366. "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
  367. }
  368. pkg_config=query_pkg_config
  369. sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
  370. sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
  371. # If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
  372. ARFLAGS="${ARFLAGS-rv}"
  373. # default flags for all hosts
  374. QEMU_CFLAGS="-fno-strict-aliasing -fno-common $QEMU_CFLAGS"
  375. QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
  376. QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
  377. QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
  378. QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
  379. if test "$debug_info" = "yes"; then
  380. CFLAGS="-g $CFLAGS"
  381. LDFLAGS="-g $LDFLAGS"
  382. fi
  383. # make source path absolute
  384. source_path=`cd "$source_path"; pwd`
  385. # running configure in the source tree?
  386. # we know that's the case if configure is there.
  387. if test -f "./configure"; then
  388. pwd_is_source_path="y"
  389. else
  390. pwd_is_source_path="n"
  391. fi
  392. check_define() {
  393. cat > $TMPC <<EOF
  394. #if !defined($1)
  395. #error $1 not defined
  396. #endif
  397. int main(void) { return 0; }
  398. EOF
  399. compile_object
  400. }
  401. if check_define __linux__ ; then
  402. targetos="Linux"
  403. elif check_define _WIN32 ; then
  404. targetos='MINGW32'
  405. elif check_define __OpenBSD__ ; then
  406. targetos='OpenBSD'
  407. elif check_define __sun__ ; then
  408. targetos='SunOS'
  409. elif check_define __HAIKU__ ; then
  410. targetos='Haiku'
  411. else
  412. targetos=`uname -s`
  413. fi
  414. # Some host OSes need non-standard checks for which CPU to use.
  415. # Note that these checks are broken for cross-compilation: if you're
  416. # cross-compiling to one of these OSes then you'll need to specify
  417. # the correct CPU with the --cpu option.
  418. case $targetos in
  419. Darwin)
  420. # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
  421. # run 64-bit userspace code.
  422. # If the user didn't specify a CPU explicitly and the kernel says this is
  423. # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
  424. if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
  425. cpu="x86_64"
  426. fi
  427. ;;
  428. SunOS)
  429. # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
  430. if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
  431. cpu="x86_64"
  432. fi
  433. esac
  434. if test ! -z "$cpu" ; then
  435. # command line argument
  436. :
  437. elif check_define __i386__ ; then
  438. cpu="i386"
  439. elif check_define __x86_64__ ; then
  440. if check_define __ILP32__ ; then
  441. cpu="x32"
  442. else
  443. cpu="x86_64"
  444. fi
  445. elif check_define __sparc__ ; then
  446. if check_define __arch64__ ; then
  447. cpu="sparc64"
  448. else
  449. cpu="sparc"
  450. fi
  451. elif check_define _ARCH_PPC ; then
  452. if check_define _ARCH_PPC64 ; then
  453. cpu="ppc64"
  454. else
  455. cpu="ppc"
  456. fi
  457. elif check_define __mips__ ; then
  458. cpu="mips"
  459. elif check_define __ia64__ ; then
  460. cpu="ia64"
  461. elif check_define __s390__ ; then
  462. if check_define __s390x__ ; then
  463. cpu="s390x"
  464. else
  465. cpu="s390"
  466. fi
  467. elif check_define __arm__ ; then
  468. cpu="arm"
  469. elif check_define __aarch64__ ; then
  470. cpu="aarch64"
  471. elif check_define __hppa__ ; then
  472. cpu="hppa"
  473. else
  474. cpu=`uname -m`
  475. fi
  476. ARCH=
  477. # Normalise host CPU name and set ARCH.
  478. # Note that this case should only have supported host CPUs, not guests.
  479. case "$cpu" in
  480. ia64|ppc|ppc64|s390|s390x|sparc64|x32)
  481. cpu="$cpu"
  482. ;;
  483. i386|i486|i586|i686|i86pc|BePC)
  484. cpu="i386"
  485. ;;
  486. x86_64|amd64)
  487. cpu="x86_64"
  488. ;;
  489. armv*b|armv*l|arm)
  490. cpu="arm"
  491. ;;
  492. aarch64)
  493. cpu="aarch64"
  494. ;;
  495. mips*)
  496. cpu="mips"
  497. ;;
  498. sparc|sun4[cdmuv])
  499. cpu="sparc"
  500. ;;
  501. *)
  502. # This will result in either an error or falling back to TCI later
  503. ARCH=unknown
  504. ;;
  505. esac
  506. if test -z "$ARCH"; then
  507. ARCH="$cpu"
  508. fi
  509. # OS specific
  510. # host *BSD for user mode
  511. HOST_VARIANT_DIR=""
  512. case $targetos in
  513. CYGWIN*)
  514. mingw32="yes"
  515. QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
  516. audio_possible_drivers="winwave sdl"
  517. audio_drv_list="winwave"
  518. ;;
  519. MINGW32*)
  520. mingw32="yes"
  521. audio_possible_drivers="winwave dsound sdl fmod"
  522. audio_drv_list="winwave"
  523. ;;
  524. GNU/kFreeBSD)
  525. bsd="yes"
  526. audio_drv_list="oss"
  527. audio_possible_drivers="oss sdl esd pa"
  528. ;;
  529. FreeBSD)
  530. bsd="yes"
  531. make="${MAKE-gmake}"
  532. audio_drv_list="oss"
  533. audio_possible_drivers="oss sdl esd pa"
  534. # needed for kinfo_getvmmap(3) in libutil.h
  535. LIBS="-lutil $LIBS"
  536. netmap="" # enable netmap autodetect
  537. HOST_VARIANT_DIR="freebsd"
  538. ;;
  539. DragonFly)
  540. bsd="yes"
  541. make="${MAKE-gmake}"
  542. audio_drv_list="oss"
  543. audio_possible_drivers="oss sdl esd pa"
  544. HOST_VARIANT_DIR="dragonfly"
  545. ;;
  546. NetBSD)
  547. bsd="yes"
  548. make="${MAKE-gmake}"
  549. audio_drv_list="oss"
  550. audio_possible_drivers="oss sdl esd"
  551. oss_lib="-lossaudio"
  552. HOST_VARIANT_DIR="netbsd"
  553. ;;
  554. OpenBSD)
  555. bsd="yes"
  556. make="${MAKE-gmake}"
  557. audio_drv_list="sdl"
  558. audio_possible_drivers="sdl esd"
  559. HOST_VARIANT_DIR="openbsd"
  560. ;;
  561. Darwin)
  562. bsd="yes"
  563. darwin="yes"
  564. LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
  565. if [ "$cpu" = "x86_64" ] ; then
  566. QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
  567. LDFLAGS="-arch x86_64 $LDFLAGS"
  568. fi
  569. cocoa="yes"
  570. audio_drv_list="coreaudio"
  571. audio_possible_drivers="coreaudio sdl fmod"
  572. LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
  573. libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
  574. # Disable attempts to use ObjectiveC features in os/object.h since they
  575. # won't work when we're compiling with gcc as a C compiler.
  576. QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
  577. HOST_VARIANT_DIR="darwin"
  578. ;;
  579. SunOS)
  580. solaris="yes"
  581. make="${MAKE-gmake}"
  582. install="${INSTALL-ginstall}"
  583. ld="gld"
  584. smbd="${SMBD-/usr/sfw/sbin/smbd}"
  585. needs_libsunmath="no"
  586. solarisrev=`uname -r | cut -f2 -d.`
  587. if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
  588. if test "$solarisrev" -le 9 ; then
  589. if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
  590. needs_libsunmath="yes"
  591. QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
  592. LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
  593. LIBS="-lsunmath $LIBS"
  594. else
  595. error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
  596. "libsunmath from the Sun Studio compilers tools, due to a lack of" \
  597. "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
  598. "Studio 11 can be downloaded from www.sun.com."
  599. fi
  600. fi
  601. fi
  602. if test -f /usr/include/sys/soundcard.h ; then
  603. audio_drv_list="oss"
  604. fi
  605. audio_possible_drivers="oss sdl"
  606. # needed for CMSG_ macros in sys/socket.h
  607. QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
  608. # needed for TIOCWIN* defines in termios.h
  609. QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
  610. QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
  611. solarisnetlibs="-lsocket -lnsl -lresolv"
  612. LIBS="$solarisnetlibs $LIBS"
  613. libs_qga="$solarisnetlibs $libs_qga"
  614. ;;
  615. AIX)
  616. aix="yes"
  617. make="${MAKE-gmake}"
  618. ;;
  619. Haiku)
  620. haiku="yes"
  621. QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
  622. LIBS="-lposix_error_mapper -lnetwork $LIBS"
  623. ;;
  624. *)
  625. audio_drv_list="oss"
  626. audio_possible_drivers="oss alsa sdl esd pa"
  627. linux="yes"
  628. linux_user="yes"
  629. kvm="yes"
  630. vhost_net="yes"
  631. vhost_scsi="yes"
  632. if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
  633. audio_possible_drivers="$audio_possible_drivers fmod"
  634. fi
  635. QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
  636. ;;
  637. esac
  638. if [ "$bsd" = "yes" ] ; then
  639. if [ "$darwin" != "yes" ] ; then
  640. bsd_user="yes"
  641. fi
  642. fi
  643. : ${make=${MAKE-make}}
  644. : ${install=${INSTALL-install}}
  645. : ${python=${PYTHON-python}}
  646. : ${smbd=${SMBD-/usr/sbin/smbd}}
  647. # Default objcc to clang if available, otherwise use CC
  648. if has clang; then
  649. objcc=clang
  650. else
  651. objcc="$cc"
  652. fi
  653. if test "$mingw32" = "yes" ; then
  654. EXESUF=".exe"
  655. DSOSUF=".dll"
  656. QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
  657. # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
  658. QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
  659. LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
  660. cat > $TMPC << EOF
  661. int main(void) { return 0; }
  662. EOF
  663. if compile_prog "" "-liberty" ; then
  664. LIBS="-liberty $LIBS"
  665. fi
  666. prefix="c:/Program Files/QEMU"
  667. mandir="\${prefix}"
  668. datadir="\${prefix}"
  669. qemu_docdir="\${prefix}"
  670. bindir="\${prefix}"
  671. sysconfdir="\${prefix}"
  672. local_statedir=
  673. confsuffix=""
  674. libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
  675. fi
  676. werror=""
  677. for opt do
  678. optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
  679. case "$opt" in
  680. --help|-h) show_help=yes
  681. ;;
  682. --version|-V) exec cat $source_path/VERSION
  683. ;;
  684. --prefix=*) prefix="$optarg"
  685. ;;
  686. --interp-prefix=*) interp_prefix="$optarg"
  687. ;;
  688. --source-path=*)
  689. ;;
  690. --cross-prefix=*)
  691. ;;
  692. --cc=*)
  693. ;;
  694. --host-cc=*) host_cc="$optarg"
  695. ;;
  696. --cxx=*)
  697. ;;
  698. --iasl=*) iasl="$optarg"
  699. ;;
  700. --objcc=*) objcc="$optarg"
  701. ;;
  702. --make=*) make="$optarg"
  703. ;;
  704. --install=*) install="$optarg"
  705. ;;
  706. --python=*) python="$optarg"
  707. ;;
  708. --gcov=*) gcov_tool="$optarg"
  709. ;;
  710. --smbd=*) smbd="$optarg"
  711. ;;
  712. --extra-cflags=*)
  713. ;;
  714. --extra-ldflags=*)
  715. ;;
  716. --enable-debug-info)
  717. ;;
  718. --disable-debug-info)
  719. ;;
  720. --enable-modules)
  721. modules="yes"
  722. ;;
  723. --cpu=*)
  724. ;;
  725. --target-list=*) target_list="$optarg"
  726. ;;
  727. --enable-trace-backends=*) trace_backends="$optarg"
  728. ;;
  729. # XXX: backwards compatibility
  730. --enable-trace-backend=*) trace_backends="$optarg"
  731. ;;
  732. --with-trace-file=*) trace_file="$optarg"
  733. ;;
  734. --enable-gprof) gprof="yes"
  735. ;;
  736. --enable-gcov) gcov="yes"
  737. ;;
  738. --static)
  739. static="yes"
  740. LDFLAGS="-static $LDFLAGS"
  741. QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
  742. ;;
  743. --mandir=*) mandir="$optarg"
  744. ;;
  745. --bindir=*) bindir="$optarg"
  746. ;;
  747. --libdir=*) libdir="$optarg"
  748. ;;
  749. --libexecdir=*) libexecdir="$optarg"
  750. ;;
  751. --includedir=*) includedir="$optarg"
  752. ;;
  753. --datadir=*) datadir="$optarg"
  754. ;;
  755. --with-confsuffix=*) confsuffix="$optarg"
  756. ;;
  757. --docdir=*) qemu_docdir="$optarg"
  758. ;;
  759. --sysconfdir=*) sysconfdir="$optarg"
  760. ;;
  761. --localstatedir=*) local_statedir="$optarg"
  762. ;;
  763. --sbindir=*|--sharedstatedir=*|\
  764. --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
  765. --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
  766. # These switches are silently ignored, for compatibility with
  767. # autoconf-generated configure scripts. This allows QEMU's
  768. # configure to be used by RPM and similar macros that set
  769. # lots of directory switches by default.
  770. ;;
  771. --with-system-pixman) pixman="system"
  772. ;;
  773. --without-system-pixman) pixman="internal"
  774. ;;
  775. --without-pixman) pixman="none"
  776. ;;
  777. --disable-sdl) sdl="no"
  778. ;;
  779. --enable-sdl) sdl="yes"
  780. ;;
  781. --with-sdlabi=*) sdlabi="$optarg"
  782. ;;
  783. --disable-qom-cast-debug) qom_cast_debug="no"
  784. ;;
  785. --enable-qom-cast-debug) qom_cast_debug="yes"
  786. ;;
  787. --disable-virtfs) virtfs="no"
  788. ;;
  789. --enable-virtfs) virtfs="yes"
  790. ;;
  791. --disable-vnc) vnc="no"
  792. ;;
  793. --enable-vnc) vnc="yes"
  794. ;;
  795. --fmod-lib=*) fmod_lib="$optarg"
  796. ;;
  797. --fmod-inc=*) fmod_inc="$optarg"
  798. ;;
  799. --oss-lib=*) oss_lib="$optarg"
  800. ;;
  801. --audio-drv-list=*) audio_drv_list="$optarg"
  802. ;;
  803. --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
  804. ;;
  805. --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
  806. ;;
  807. --enable-debug-tcg) debug_tcg="yes"
  808. ;;
  809. --disable-debug-tcg) debug_tcg="no"
  810. ;;
  811. --enable-debug)
  812. # Enable debugging options that aren't excessively noisy
  813. debug_tcg="yes"
  814. debug="yes"
  815. strip_opt="no"
  816. ;;
  817. --enable-sparse) sparse="yes"
  818. ;;
  819. --disable-sparse) sparse="no"
  820. ;;
  821. --disable-strip) strip_opt="no"
  822. ;;
  823. --disable-vnc-tls) vnc_tls="no"
  824. ;;
  825. --enable-vnc-tls) vnc_tls="yes"
  826. ;;
  827. --disable-vnc-sasl) vnc_sasl="no"
  828. ;;
  829. --enable-vnc-sasl) vnc_sasl="yes"
  830. ;;
  831. --disable-vnc-jpeg) vnc_jpeg="no"
  832. ;;
  833. --enable-vnc-jpeg) vnc_jpeg="yes"
  834. ;;
  835. --disable-vnc-png) vnc_png="no"
  836. ;;
  837. --enable-vnc-png) vnc_png="yes"
  838. ;;
  839. --disable-vnc-ws) vnc_ws="no"
  840. ;;
  841. --enable-vnc-ws) vnc_ws="yes"
  842. ;;
  843. --disable-slirp) slirp="no"
  844. ;;
  845. --disable-uuid) uuid="no"
  846. ;;
  847. --enable-uuid) uuid="yes"
  848. ;;
  849. --disable-vde) vde="no"
  850. ;;
  851. --enable-vde) vde="yes"
  852. ;;
  853. --disable-netmap) netmap="no"
  854. ;;
  855. --enable-netmap) netmap="yes"
  856. ;;
  857. --disable-xen) xen="no"
  858. ;;
  859. --enable-xen) xen="yes"
  860. ;;
  861. --disable-xen-pci-passthrough) xen_pci_passthrough="no"
  862. ;;
  863. --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
  864. ;;
  865. --disable-brlapi) brlapi="no"
  866. ;;
  867. --enable-brlapi) brlapi="yes"
  868. ;;
  869. --disable-bluez) bluez="no"
  870. ;;
  871. --enable-bluez) bluez="yes"
  872. ;;
  873. --disable-kvm) kvm="no"
  874. ;;
  875. --enable-kvm) kvm="yes"
  876. ;;
  877. --disable-tcg-interpreter) tcg_interpreter="no"
  878. ;;
  879. --enable-tcg-interpreter) tcg_interpreter="yes"
  880. ;;
  881. --disable-cap-ng) cap_ng="no"
  882. ;;
  883. --enable-cap-ng) cap_ng="yes"
  884. ;;
  885. --disable-spice) spice="no"
  886. ;;
  887. --enable-spice) spice="yes"
  888. ;;
  889. --disable-libiscsi) libiscsi="no"
  890. ;;
  891. --enable-libiscsi) libiscsi="yes"
  892. ;;
  893. --disable-libnfs) libnfs="no"
  894. ;;
  895. --enable-libnfs) libnfs="yes"
  896. ;;
  897. --enable-profiler) profiler="yes"
  898. ;;
  899. --disable-cocoa) cocoa="no"
  900. ;;
  901. --enable-cocoa)
  902. cocoa="yes" ;
  903. sdl="no" ;
  904. audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
  905. ;;
  906. --disable-system) softmmu="no"
  907. ;;
  908. --enable-system) softmmu="yes"
  909. ;;
  910. --disable-user)
  911. linux_user="no" ;
  912. bsd_user="no" ;
  913. ;;
  914. --enable-user) ;;
  915. --disable-linux-user) linux_user="no"
  916. ;;
  917. --enable-linux-user) linux_user="yes"
  918. ;;
  919. --disable-bsd-user) bsd_user="no"
  920. ;;
  921. --enable-bsd-user) bsd_user="yes"
  922. ;;
  923. --enable-guest-base) guest_base="yes"
  924. ;;
  925. --disable-guest-base) guest_base="no"
  926. ;;
  927. --enable-pie) pie="yes"
  928. ;;
  929. --disable-pie) pie="no"
  930. ;;
  931. --enable-werror) werror="yes"
  932. ;;
  933. --disable-werror) werror="no"
  934. ;;
  935. --enable-stack-protector) stack_protector="yes"
  936. ;;
  937. --disable-stack-protector) stack_protector="no"
  938. ;;
  939. --disable-curses) curses="no"
  940. ;;
  941. --enable-curses) curses="yes"
  942. ;;
  943. --disable-curl) curl="no"
  944. ;;
  945. --enable-curl) curl="yes"
  946. ;;
  947. --disable-fdt) fdt="no"
  948. ;;
  949. --enable-fdt) fdt="yes"
  950. ;;
  951. --disable-linux-aio) linux_aio="no"
  952. ;;
  953. --enable-linux-aio) linux_aio="yes"
  954. ;;
  955. --disable-attr) attr="no"
  956. ;;
  957. --enable-attr) attr="yes"
  958. ;;
  959. --disable-blobs) blobs="no"
  960. ;;
  961. --with-pkgversion=*) pkgversion=" ($optarg)"
  962. ;;
  963. --with-coroutine=*) coroutine="$optarg"
  964. ;;
  965. --disable-coroutine-pool) coroutine_pool="no"
  966. ;;
  967. --enable-coroutine-pool) coroutine_pool="yes"
  968. ;;
  969. --disable-docs) docs="no"
  970. ;;
  971. --enable-docs) docs="yes"
  972. ;;
  973. --disable-vhost-net) vhost_net="no"
  974. ;;
  975. --enable-vhost-net) vhost_net="yes"
  976. ;;
  977. --disable-vhost-scsi) vhost_scsi="no"
  978. ;;
  979. --enable-vhost-scsi) vhost_scsi="yes"
  980. ;;
  981. --disable-glx) glx="no"
  982. ;;
  983. --enable-glx) glx="yes"
  984. ;;
  985. --disable-rbd) rbd="no"
  986. ;;
  987. --enable-rbd) rbd="yes"
  988. ;;
  989. --disable-xfsctl) xfs="no"
  990. ;;
  991. --enable-xfsctl) xfs="yes"
  992. ;;
  993. --disable-smartcard-nss) smartcard_nss="no"
  994. ;;
  995. --enable-smartcard-nss) smartcard_nss="yes"
  996. ;;
  997. --disable-libusb) libusb="no"
  998. ;;
  999. --enable-libusb) libusb="yes"
  1000. ;;
  1001. --disable-usb-redir) usb_redir="no"
  1002. ;;
  1003. --enable-usb-redir) usb_redir="yes"
  1004. ;;
  1005. --disable-zlib-test) zlib="no"
  1006. ;;
  1007. --disable-lzo) lzo="no"
  1008. ;;
  1009. --enable-lzo) lzo="yes"
  1010. ;;
  1011. --disable-snappy) snappy="no"
  1012. ;;
  1013. --enable-snappy) snappy="yes"
  1014. ;;
  1015. --enable-guest-agent) guest_agent="yes"
  1016. ;;
  1017. --disable-guest-agent) guest_agent="no"
  1018. ;;
  1019. --with-vss-sdk) vss_win32_sdk=""
  1020. ;;
  1021. --with-vss-sdk=*) vss_win32_sdk="$optarg"
  1022. ;;
  1023. --without-vss-sdk) vss_win32_sdk="no"
  1024. ;;
  1025. --with-win-sdk) win_sdk=""
  1026. ;;
  1027. --with-win-sdk=*) win_sdk="$optarg"
  1028. ;;
  1029. --without-win-sdk) win_sdk="no"
  1030. ;;
  1031. --enable-tools) want_tools="yes"
  1032. ;;
  1033. --disable-tools) want_tools="no"
  1034. ;;
  1035. --enable-seccomp) seccomp="yes"
  1036. ;;
  1037. --disable-seccomp) seccomp="no"
  1038. ;;
  1039. --disable-glusterfs) glusterfs="no"
  1040. ;;
  1041. --enable-glusterfs) glusterfs="yes"
  1042. ;;
  1043. --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
  1044. ;;
  1045. --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
  1046. ;;
  1047. --disable-gtk) gtk="no"
  1048. ;;
  1049. --enable-gtk) gtk="yes"
  1050. ;;
  1051. --enable-rdma) rdma="yes"
  1052. ;;
  1053. --disable-rdma) rdma="no"
  1054. ;;
  1055. --with-gtkabi=*) gtkabi="$optarg"
  1056. ;;
  1057. --disable-vte) vte="no"
  1058. ;;
  1059. --enable-vte) vte="yes"
  1060. ;;
  1061. --disable-tpm) tpm="no"
  1062. ;;
  1063. --enable-tpm) tpm="yes"
  1064. ;;
  1065. --disable-libssh2) libssh2="no"
  1066. ;;
  1067. --enable-libssh2) libssh2="yes"
  1068. ;;
  1069. --enable-vhdx) vhdx="yes"
  1070. ;;
  1071. --disable-vhdx) vhdx="no"
  1072. ;;
  1073. --disable-quorum) quorum="no"
  1074. ;;
  1075. --enable-quorum) quorum="yes"
  1076. ;;
  1077. --disable-numa) numa="no"
  1078. ;;
  1079. --enable-numa) numa="yes"
  1080. ;;
  1081. *)
  1082. echo "ERROR: unknown option $opt"
  1083. echo "Try '$0 --help' for more information"
  1084. exit 1
  1085. ;;
  1086. esac
  1087. done
  1088. if ! has $python; then
  1089. error_exit "Python not found. Use --python=/path/to/python"
  1090. fi
  1091. # Note that if the Python conditional here evaluates True we will exit
  1092. # with status 1 which is a shell 'false' value.
  1093. if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
  1094. error_exit "Cannot use '$python', Python 2.4 or later is required." \
  1095. "Note that Python 3 or later is not yet supported." \
  1096. "Use --python=/path/to/python to specify a supported Python."
  1097. fi
  1098. # The -B switch was added in Python 2.6.
  1099. # If it is supplied, compiled files are not written.
  1100. # Use it for Python versions which support it.
  1101. if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
  1102. python="$python -B"
  1103. fi
  1104. case "$cpu" in
  1105. ppc)
  1106. CPU_CFLAGS="-m32"
  1107. LDFLAGS="-m32 $LDFLAGS"
  1108. ;;
  1109. ppc64)
  1110. CPU_CFLAGS="-m64"
  1111. LDFLAGS="-m64 $LDFLAGS"
  1112. ;;
  1113. sparc)
  1114. LDFLAGS="-m32 $LDFLAGS"
  1115. CPU_CFLAGS="-m32 -mcpu=ultrasparc"
  1116. ;;
  1117. sparc64)
  1118. LDFLAGS="-m64 $LDFLAGS"
  1119. CPU_CFLAGS="-m64 -mcpu=ultrasparc"
  1120. ;;
  1121. s390)
  1122. CPU_CFLAGS="-m31"
  1123. LDFLAGS="-m31 $LDFLAGS"
  1124. ;;
  1125. s390x)
  1126. CPU_CFLAGS="-m64"
  1127. LDFLAGS="-m64 $LDFLAGS"
  1128. ;;
  1129. i386)
  1130. CPU_CFLAGS="-m32"
  1131. LDFLAGS="-m32 $LDFLAGS"
  1132. cc_i386='$(CC) -m32'
  1133. ;;
  1134. x86_64)
  1135. CPU_CFLAGS="-m64"
  1136. LDFLAGS="-m64 $LDFLAGS"
  1137. cc_i386='$(CC) -m32'
  1138. ;;
  1139. x32)
  1140. CPU_CFLAGS="-mx32"
  1141. LDFLAGS="-mx32 $LDFLAGS"
  1142. cc_i386='$(CC) -m32'
  1143. ;;
  1144. # No special flags required for other host CPUs
  1145. esac
  1146. QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
  1147. EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
  1148. default_target_list=""
  1149. mak_wilds=""
  1150. if [ "$softmmu" = "yes" ]; then
  1151. mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
  1152. fi
  1153. if [ "$linux_user" = "yes" ]; then
  1154. mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
  1155. fi
  1156. if [ "$bsd_user" = "yes" ]; then
  1157. mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
  1158. fi
  1159. for config in $mak_wilds; do
  1160. default_target_list="${default_target_list} $(basename "$config" .mak)"
  1161. done
  1162. if test x"$show_help" = x"yes" ; then
  1163. cat << EOF
  1164. Usage: configure [options]
  1165. Options: [defaults in brackets after descriptions]
  1166. Standard options:
  1167. --help print this message
  1168. --prefix=PREFIX install in PREFIX [$prefix]
  1169. --interp-prefix=PREFIX where to find shared libraries, etc.
  1170. use %M for cpu name [$interp_prefix]
  1171. --target-list=LIST set target list (default: build everything)
  1172. $(echo Available targets: $default_target_list | \
  1173. fold -s -w 53 | sed -e 's/^/ /')
  1174. Advanced options (experts only):
  1175. --source-path=PATH path of source code [$source_path]
  1176. --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
  1177. --cc=CC use C compiler CC [$cc]
  1178. --iasl=IASL use ACPI compiler IASL [$iasl]
  1179. --host-cc=CC use C compiler CC [$host_cc] for code run at
  1180. build time
  1181. --cxx=CXX use C++ compiler CXX [$cxx]
  1182. --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
  1183. --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
  1184. --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
  1185. --make=MAKE use specified make [$make]
  1186. --install=INSTALL use specified install [$install]
  1187. --python=PYTHON use specified python [$python]
  1188. --smbd=SMBD use specified smbd [$smbd]
  1189. --static enable static build [$static]
  1190. --mandir=PATH install man pages in PATH
  1191. --datadir=PATH install firmware in PATH$confsuffix
  1192. --docdir=PATH install documentation in PATH$confsuffix
  1193. --bindir=PATH install binaries in PATH
  1194. --libdir=PATH install libraries in PATH
  1195. --sysconfdir=PATH install config in PATH$confsuffix
  1196. --localstatedir=PATH install local state in PATH (set at runtime on win32)
  1197. --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
  1198. --enable-modules enable modules support
  1199. --enable-debug-tcg enable TCG debugging
  1200. --disable-debug-tcg disable TCG debugging (default)
  1201. --enable-debug-info enable debugging information (default)
  1202. --disable-debug-info disable debugging information
  1203. --enable-debug enable common debug build options
  1204. --enable-sparse enable sparse checker
  1205. --disable-sparse disable sparse checker (default)
  1206. --disable-strip disable stripping binaries
  1207. --disable-werror disable compilation abort on warning
  1208. --disable-stack-protector disable compiler-provided stack protection
  1209. --disable-sdl disable SDL
  1210. --enable-sdl enable SDL
  1211. --with-sdlabi select preferred SDL ABI 1.2 or 2.0
  1212. --disable-gtk disable gtk UI
  1213. --enable-gtk enable gtk UI
  1214. --with-gtkabi select preferred GTK ABI 2.0 or 3.0
  1215. --disable-virtfs disable VirtFS
  1216. --enable-virtfs enable VirtFS
  1217. --disable-vnc disable VNC
  1218. --enable-vnc enable VNC
  1219. --disable-cocoa disable Cocoa (Mac OS X only)
  1220. --enable-cocoa enable Cocoa (default on Mac OS X)
  1221. --audio-drv-list=LIST set audio drivers list:
  1222. Available drivers: $audio_possible_drivers
  1223. --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
  1224. --block-drv-rw-whitelist=L
  1225. set block driver read-write whitelist
  1226. (affects only QEMU, not qemu-img)
  1227. --block-drv-ro-whitelist=L
  1228. set block driver read-only whitelist
  1229. (affects only QEMU, not qemu-img)
  1230. --disable-xen disable xen backend driver support
  1231. --enable-xen enable xen backend driver support
  1232. --disable-xen-pci-passthrough
  1233. --enable-xen-pci-passthrough
  1234. --disable-brlapi disable BrlAPI
  1235. --enable-brlapi enable BrlAPI
  1236. --disable-vnc-tls disable TLS encryption for VNC server
  1237. --enable-vnc-tls enable TLS encryption for VNC server
  1238. --disable-vnc-sasl disable SASL encryption for VNC server
  1239. --enable-vnc-sasl enable SASL encryption for VNC server
  1240. --disable-vnc-jpeg disable JPEG lossy compression for VNC server
  1241. --enable-vnc-jpeg enable JPEG lossy compression for VNC server
  1242. --disable-vnc-png disable PNG compression for VNC server (default)
  1243. --enable-vnc-png enable PNG compression for VNC server
  1244. --disable-vnc-ws disable Websockets support for VNC server
  1245. --enable-vnc-ws enable Websockets support for VNC server
  1246. --disable-curses disable curses output
  1247. --enable-curses enable curses output
  1248. --disable-curl disable curl connectivity
  1249. --enable-curl enable curl connectivity
  1250. --disable-fdt disable fdt device tree
  1251. --enable-fdt enable fdt device tree
  1252. --disable-bluez disable bluez stack connectivity
  1253. --enable-bluez enable bluez stack connectivity
  1254. --disable-slirp disable SLIRP userspace network connectivity
  1255. --disable-kvm disable KVM acceleration support
  1256. --enable-kvm enable KVM acceleration support
  1257. --disable-rdma disable RDMA-based migration support
  1258. --enable-rdma enable RDMA-based migration support
  1259. --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
  1260. --enable-system enable all system emulation targets
  1261. --disable-system disable all system emulation targets
  1262. --enable-user enable supported user emulation targets
  1263. --disable-user disable all user emulation targets
  1264. --enable-linux-user enable all linux usermode emulation targets
  1265. --disable-linux-user disable all linux usermode emulation targets
  1266. --enable-bsd-user enable all BSD usermode emulation targets
  1267. --disable-bsd-user disable all BSD usermode emulation targets
  1268. --enable-guest-base enable GUEST_BASE support for usermode
  1269. emulation targets
  1270. --disable-guest-base disable GUEST_BASE support
  1271. --enable-pie build Position Independent Executables
  1272. --disable-pie do not build Position Independent Executables
  1273. --fmod-lib path to FMOD library
  1274. --fmod-inc path to FMOD includes
  1275. --oss-lib path to OSS library
  1276. --cpu=CPU Build for host CPU [$cpu]
  1277. --disable-uuid disable uuid support
  1278. --enable-uuid enable uuid support
  1279. --disable-vde disable support for vde network
  1280. --enable-vde enable support for vde network
  1281. --disable-netmap disable support for netmap network
  1282. --enable-netmap enable support for netmap network
  1283. --disable-linux-aio disable Linux AIO support
  1284. --enable-linux-aio enable Linux AIO support
  1285. --disable-cap-ng disable libcap-ng support
  1286. --enable-cap-ng enable libcap-ng support
  1287. --disable-attr disables attr and xattr support
  1288. --enable-attr enable attr and xattr support
  1289. --disable-blobs disable installing provided firmware blobs
  1290. --enable-docs enable documentation build
  1291. --disable-docs disable documentation build
  1292. --disable-vhost-net disable vhost-net acceleration support
  1293. --enable-vhost-net enable vhost-net acceleration support
  1294. --enable-trace-backends=B Set trace backend
  1295. Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
  1296. --with-trace-file=NAME Full PATH,NAME of file to store traces
  1297. Default:trace-<pid>
  1298. --disable-spice disable spice
  1299. --enable-spice enable spice
  1300. --enable-rbd enable building the rados block device (rbd)
  1301. --disable-libiscsi disable iscsi support
  1302. --enable-libiscsi enable iscsi support
  1303. --disable-libnfs disable nfs support
  1304. --enable-libnfs enable nfs support
  1305. --disable-smartcard-nss disable smartcard nss support
  1306. --enable-smartcard-nss enable smartcard nss support
  1307. --disable-libusb disable libusb (for usb passthrough)
  1308. --enable-libusb enable libusb (for usb passthrough)
  1309. --disable-usb-redir disable usb network redirection support
  1310. --enable-usb-redir enable usb network redirection support
  1311. --enable-lzo enable the support of lzo compression library
  1312. --enable-snappy enable the support of snappy compression library
  1313. --disable-guest-agent disable building of the QEMU Guest Agent
  1314. --enable-guest-agent enable building of the QEMU Guest Agent
  1315. --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
  1316. --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
  1317. --disable-seccomp disable seccomp support
  1318. --enable-seccomp enables seccomp support
  1319. --with-coroutine=BACKEND coroutine backend. Supported options:
  1320. gthread, ucontext, sigaltstack, windows
  1321. --disable-coroutine-pool disable coroutine freelist (worse performance)
  1322. --enable-coroutine-pool enable coroutine freelist (better performance)
  1323. --enable-glusterfs enable GlusterFS backend
  1324. --disable-glusterfs disable GlusterFS backend
  1325. --enable-gcov enable test coverage analysis with gcov
  1326. --gcov=GCOV use specified gcov [$gcov_tool]
  1327. --disable-tpm disable TPM support
  1328. --enable-tpm enable TPM support
  1329. --disable-libssh2 disable ssh block device support
  1330. --enable-libssh2 enable ssh block device support
  1331. --disable-vhdx disables support for the Microsoft VHDX image format
  1332. --enable-vhdx enable support for the Microsoft VHDX image format
  1333. --disable-quorum disable quorum block filter support
  1334. --enable-quorum enable quorum block filter support
  1335. --disable-numa disable libnuma support
  1336. --enable-numa enable libnuma support
  1337. NOTE: The object files are built at the place where configure is launched
  1338. EOF
  1339. exit 0
  1340. fi
  1341. # Now we have handled --enable-tcg-interpreter and know we're not just
  1342. # printing the help message, bail out if the host CPU isn't supported.
  1343. if test "$ARCH" = "unknown"; then
  1344. if test "$tcg_interpreter" = "yes" ; then
  1345. echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
  1346. ARCH=tci
  1347. else
  1348. error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
  1349. fi
  1350. fi
  1351. # Consult white-list to determine whether to enable werror
  1352. # by default. Only enable by default for git builds
  1353. z_version=`cut -f3 -d. $source_path/VERSION`
  1354. if test -z "$werror" ; then
  1355. if test -d "$source_path/.git" -a \
  1356. "$linux" = "yes" ; then
  1357. werror="yes"
  1358. else
  1359. werror="no"
  1360. fi
  1361. fi
  1362. # check that the C compiler works.
  1363. cat > $TMPC <<EOF
  1364. int main(void) { return 0; }
  1365. EOF
  1366. if compile_object ; then
  1367. : C compiler works ok
  1368. else
  1369. error_exit "\"$cc\" either does not exist or does not work"
  1370. fi
  1371. # Check that the C++ compiler exists and works with the C compiler
  1372. if has $cxx; then
  1373. cat > $TMPC <<EOF
  1374. int c_function(void);
  1375. int main(void) { return c_function(); }
  1376. EOF
  1377. compile_object
  1378. cat > $TMPCXX <<EOF
  1379. extern "C" {
  1380. int c_function(void);
  1381. }
  1382. int c_function(void) { return 42; }
  1383. EOF
  1384. update_cxxflags
  1385. if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
  1386. # C++ compiler $cxx works ok with C compiler $cc
  1387. :
  1388. else
  1389. echo "C++ compiler $cxx does not work with C compiler $cc"
  1390. echo "Disabling C++ specific optional code"
  1391. cxx=
  1392. fi
  1393. else
  1394. echo "No C++ compiler available; disabling C++ specific optional code"
  1395. cxx=
  1396. fi
  1397. gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
  1398. gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
  1399. gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
  1400. gcc_flags="-Wendif-labels $gcc_flags"
  1401. gcc_flags="-Wno-initializer-overrides $gcc_flags"
  1402. gcc_flags="-Wno-string-plus-int $gcc_flags"
  1403. # Note that we do not add -Werror to gcc_flags here, because that would
  1404. # enable it for all configure tests. If a configure test failed due
  1405. # to -Werror this would just silently disable some features,
  1406. # so it's too error prone.
  1407. cat > $TMPC << EOF
  1408. int main(void) { return 0; }
  1409. EOF
  1410. for flag in $gcc_flags; do
  1411. # Use the positive sense of the flag when testing for -Wno-wombat
  1412. # support (gcc will happily accept the -Wno- form of unknown
  1413. # warning options).
  1414. optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
  1415. if compile_prog "-Werror $optflag" "" ; then
  1416. QEMU_CFLAGS="$QEMU_CFLAGS $flag"
  1417. fi
  1418. done
  1419. if test "$stack_protector" != "no"; then
  1420. gcc_flags="-fstack-protector-strong -fstack-protector-all"
  1421. sp_on=0
  1422. for flag in $gcc_flags; do
  1423. # We need to check both a compile and a link, since some compiler
  1424. # setups fail only on a .c->.o compile and some only at link time
  1425. if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
  1426. compile_prog "-Werror $flag" ""; then
  1427. QEMU_CFLAGS="$QEMU_CFLAGS $flag"
  1428. LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,$flag"
  1429. sp_on=1
  1430. break
  1431. fi
  1432. done
  1433. if test "$stack_protector" = yes; then
  1434. if test $sp_on = 0; then
  1435. error_exit "Stack protector not supported"
  1436. fi
  1437. fi
  1438. fi
  1439. # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
  1440. # large functions that use global variables. The bug is in all releases of
  1441. # GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
  1442. # 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
  1443. cat > $TMPC << EOF
  1444. #if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
  1445. int main(void) { return 0; }
  1446. #else
  1447. #error No bug in this compiler.
  1448. #endif
  1449. EOF
  1450. if compile_prog "-Werror -fno-gcse" "" ; then
  1451. TRANSLATE_OPT_CFLAGS=-fno-gcse
  1452. fi
  1453. if test "$static" = "yes" ; then
  1454. if test "$modules" = "yes" ; then
  1455. error_exit "static and modules are mutually incompatible"
  1456. fi
  1457. if test "$pie" = "yes" ; then
  1458. error_exit "static and pie are mutually incompatible"
  1459. else
  1460. pie="no"
  1461. fi
  1462. fi
  1463. if test "$pie" = ""; then
  1464. case "$cpu-$targetos" in
  1465. i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
  1466. ;;
  1467. *)
  1468. pie="no"
  1469. ;;
  1470. esac
  1471. fi
  1472. if test "$pie" != "no" ; then
  1473. cat > $TMPC << EOF
  1474. #ifdef __linux__
  1475. # define THREAD __thread
  1476. #else
  1477. # define THREAD
  1478. #endif
  1479. static THREAD int tls_var;
  1480. int main(void) { return tls_var; }
  1481. EOF
  1482. if compile_prog "-fPIE -DPIE" "-pie"; then
  1483. QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
  1484. LDFLAGS="-pie $LDFLAGS"
  1485. pie="yes"
  1486. if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
  1487. LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
  1488. fi
  1489. else
  1490. if test "$pie" = "yes"; then
  1491. error_exit "PIE not available due to missing toolchain support"
  1492. else
  1493. echo "Disabling PIE due to missing toolchain support"
  1494. pie="no"
  1495. fi
  1496. fi
  1497. if compile_prog "-fno-pie" "-nopie"; then
  1498. CFLAGS_NOPIE="-fno-pie"
  1499. LDFLAGS_NOPIE="-nopie"
  1500. fi
  1501. fi
  1502. # check for broken gcc and libtool in RHEL5
  1503. if test -n "$libtool" -a "$pie" != "no" ; then
  1504. cat > $TMPC <<EOF
  1505. void *f(unsigned char *buf, int len);
  1506. void *g(unsigned char *buf, int len);
  1507. void *
  1508. f(unsigned char *buf, int len)
  1509. {
  1510. return (void*)0L;
  1511. }
  1512. void *
  1513. g(unsigned char *buf, int len)
  1514. {
  1515. return f(buf, len);
  1516. }
  1517. EOF
  1518. if ! libtool_prog; then
  1519. echo "Disabling libtool due to broken toolchain support"
  1520. libtool=
  1521. fi
  1522. fi
  1523. ##########################################
  1524. # __sync_fetch_and_and requires at least -march=i486. Many toolchains
  1525. # use i686 as default anyway, but for those that don't, an explicit
  1526. # specification is necessary
  1527. if test "$cpu" = "i386"; then
  1528. cat > $TMPC << EOF
  1529. static int sfaa(int *ptr)
  1530. {
  1531. return __sync_fetch_and_and(ptr, 0);
  1532. }
  1533. int main(void)
  1534. {
  1535. int val = 42;
  1536. val = __sync_val_compare_and_swap(&val, 0, 1);
  1537. sfaa(&val);
  1538. return val;
  1539. }
  1540. EOF
  1541. if ! compile_prog "" "" ; then
  1542. QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
  1543. fi
  1544. fi
  1545. #########################################
  1546. # Solaris specific configure tool chain decisions
  1547. if test "$solaris" = "yes" ; then
  1548. if has $install; then
  1549. :
  1550. else
  1551. error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
  1552. "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
  1553. "to get ginstall which is used by default (which lives in /opt/csw/bin)"
  1554. fi
  1555. if test "`path_of $install`" = "/usr/sbin/install" ; then
  1556. error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
  1557. "try ginstall from the GNU fileutils available from www.blastwave.org" \
  1558. "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
  1559. fi
  1560. if has ar; then
  1561. :
  1562. else
  1563. if test -f /usr/ccs/bin/ar ; then
  1564. error_exit "No path includes ar" \
  1565. "Add /usr/ccs/bin to your path and rerun configure"
  1566. fi
  1567. error_exit "No path includes ar"
  1568. fi
  1569. fi
  1570. if test -z "${target_list+xxx}" ; then
  1571. target_list="$default_target_list"
  1572. else
  1573. target_list=`echo "$target_list" | sed -e 's/,/ /g'`
  1574. fi
  1575. # Check that we recognised the target name; this allows a more
  1576. # friendly error message than if we let it fall through.
  1577. for target in $target_list; do
  1578. case " $default_target_list " in
  1579. *" $target "*)
  1580. ;;
  1581. *)
  1582. error_exit "Unknown target name '$target'"
  1583. ;;
  1584. esac
  1585. done
  1586. # see if system emulation was really requested
  1587. case " $target_list " in
  1588. *"-softmmu "*) softmmu=yes
  1589. ;;
  1590. *) softmmu=no
  1591. ;;
  1592. esac
  1593. feature_not_found() {
  1594. feature=$1
  1595. remedy=$2
  1596. error_exit "User requested feature $feature" \
  1597. "configure was not able to find it." \
  1598. "$remedy"
  1599. }
  1600. # ---
  1601. # big/little endian test
  1602. cat > $TMPC << EOF
  1603. short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
  1604. short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
  1605. extern int foo(short *, short *);
  1606. int main(int argc, char *argv[]) {
  1607. return foo(big_endian, little_endian);
  1608. }
  1609. EOF
  1610. if compile_object ; then
  1611. if grep -q BiGeNdIaN $TMPO ; then
  1612. bigendian="yes"
  1613. elif grep -q LiTtLeEnDiAn $TMPO ; then
  1614. bigendian="no"
  1615. else
  1616. echo big/little test failed
  1617. fi
  1618. else
  1619. echo big/little test failed
  1620. fi
  1621. ##########################################
  1622. # L2TPV3 probe
  1623. cat > $TMPC <<EOF
  1624. #include <sys/socket.h>
  1625. #include <linux/ip.h>
  1626. int main(void) { return sizeof(struct mmsghdr); }
  1627. EOF
  1628. if compile_prog "" "" ; then
  1629. l2tpv3=yes
  1630. else
  1631. l2tpv3=no
  1632. fi
  1633. ##########################################
  1634. # pkg-config probe
  1635. if ! has "$pkg_config_exe"; then
  1636. error_exit "pkg-config binary '$pkg_config_exe' not found"
  1637. fi
  1638. ##########################################
  1639. # NPTL probe
  1640. if test "$linux_user" = "yes"; then
  1641. cat > $TMPC <<EOF
  1642. #include <sched.h>
  1643. #include <linux/futex.h>
  1644. int main(void) {
  1645. #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
  1646. #error bork
  1647. #endif
  1648. return 0;
  1649. }
  1650. EOF
  1651. if ! compile_object ; then
  1652. feature_not_found "nptl" "Install glibc and linux kernel headers."
  1653. fi
  1654. fi
  1655. ##########################################
  1656. # zlib check
  1657. if test "$zlib" != "no" ; then
  1658. cat > $TMPC << EOF
  1659. #include <zlib.h>
  1660. int main(void) { zlibVersion(); return 0; }
  1661. EOF
  1662. if compile_prog "" "-lz" ; then
  1663. :
  1664. else
  1665. error_exit "zlib check failed" \
  1666. "Make sure to have the zlib libs and headers installed."
  1667. fi
  1668. fi
  1669. LIBS="$LIBS -lz"
  1670. ##########################################
  1671. # lzo check
  1672. if test "$lzo" != "no" ; then
  1673. cat > $TMPC << EOF
  1674. #include <lzo/lzo1x.h>
  1675. int main(void) { lzo_version(); return 0; }
  1676. EOF
  1677. if compile_prog "" "-llzo2" ; then
  1678. libs_softmmu="$libs_softmmu -llzo2"
  1679. lzo="yes"
  1680. else
  1681. if test "$lzo" = "yes"; then
  1682. feature_not_found "liblzo2" "Install liblzo2 devel"
  1683. fi
  1684. lzo="no"
  1685. fi
  1686. fi
  1687. ##########################################
  1688. # snappy check
  1689. if test "$snappy" != "no" ; then
  1690. cat > $TMPC << EOF
  1691. #include <snappy-c.h>
  1692. int main(void) { snappy_max_compressed_length(4096); return 0; }
  1693. EOF
  1694. if compile_prog "" "-lsnappy" ; then
  1695. libs_softmmu="$libs_softmmu -lsnappy"
  1696. snappy="yes"
  1697. else
  1698. if test "$snappy" = "yes"; then
  1699. feature_not_found "libsnappy" "Install libsnappy devel"
  1700. fi
  1701. snappy="no"
  1702. fi
  1703. fi
  1704. ##########################################
  1705. # libseccomp check
  1706. if test "$seccomp" != "no" ; then
  1707. if $pkg_config --atleast-version=2.1.0 libseccomp; then
  1708. libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
  1709. QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
  1710. seccomp="yes"
  1711. else
  1712. if test "$seccomp" = "yes"; then
  1713. feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0"
  1714. fi
  1715. seccomp="no"
  1716. fi
  1717. fi
  1718. ##########################################
  1719. # xen probe
  1720. if test "$xen" != "no" ; then
  1721. xen_libs="-lxenstore -lxenctrl -lxenguest"
  1722. # First we test whether Xen headers and libraries are available.
  1723. # If no, we are done and there is no Xen support.
  1724. # If yes, more tests are run to detect the Xen version.
  1725. # Xen (any)
  1726. cat > $TMPC <<EOF
  1727. #include <xenctrl.h>
  1728. int main(void) {
  1729. return 0;
  1730. }
  1731. EOF
  1732. if ! compile_prog "" "$xen_libs" ; then
  1733. # Xen not found
  1734. if test "$xen" = "yes" ; then
  1735. feature_not_found "xen" "Install xen devel"
  1736. fi
  1737. xen=no
  1738. # Xen unstable
  1739. elif
  1740. cat > $TMPC <<EOF &&
  1741. #include <xenctrl.h>
  1742. #include <xenstore.h>
  1743. #include <stdint.h>
  1744. #include <xen/hvm/hvm_info_table.h>
  1745. #if !defined(HVM_MAX_VCPUS)
  1746. # error HVM_MAX_VCPUS not defined
  1747. #endif
  1748. int main(void) {
  1749. xc_interface *xc;
  1750. xs_daemon_open();
  1751. xc = xc_interface_open(0, 0, 0);
  1752. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1753. xc_gnttab_open(NULL, 0);
  1754. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  1755. xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
  1756. return 0;
  1757. }
  1758. EOF
  1759. compile_prog "" "$xen_libs"
  1760. then
  1761. xen_ctrl_version=420
  1762. xen=yes
  1763. elif
  1764. cat > $TMPC <<EOF &&
  1765. #include <xenctrl.h>
  1766. #include <xs.h>
  1767. #include <stdint.h>
  1768. #include <xen/hvm/hvm_info_table.h>
  1769. #if !defined(HVM_MAX_VCPUS)
  1770. # error HVM_MAX_VCPUS not defined
  1771. #endif
  1772. int main(void) {
  1773. xs_daemon_open();
  1774. xc_interface_open(0, 0, 0);
  1775. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1776. xc_gnttab_open(NULL, 0);
  1777. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  1778. return 0;
  1779. }
  1780. EOF
  1781. compile_prog "" "$xen_libs"
  1782. then
  1783. xen_ctrl_version=410
  1784. xen=yes
  1785. # Xen 4.0.0
  1786. elif
  1787. cat > $TMPC <<EOF &&
  1788. #include <xenctrl.h>
  1789. #include <xs.h>
  1790. #include <stdint.h>
  1791. #include <xen/hvm/hvm_info_table.h>
  1792. #if !defined(HVM_MAX_VCPUS)
  1793. # error HVM_MAX_VCPUS not defined
  1794. #endif
  1795. int main(void) {
  1796. struct xen_add_to_physmap xatp = {
  1797. .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
  1798. };
  1799. xs_daemon_open();
  1800. xc_interface_open();
  1801. xc_gnttab_open();
  1802. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1803. xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
  1804. return 0;
  1805. }
  1806. EOF
  1807. compile_prog "" "$xen_libs"
  1808. then
  1809. xen_ctrl_version=400
  1810. xen=yes
  1811. # Xen 3.4.0
  1812. elif
  1813. cat > $TMPC <<EOF &&
  1814. #include <xenctrl.h>
  1815. #include <xs.h>
  1816. int main(void) {
  1817. struct xen_add_to_physmap xatp = {
  1818. .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
  1819. };
  1820. xs_daemon_open();
  1821. xc_interface_open();
  1822. xc_gnttab_open();
  1823. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1824. xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
  1825. return 0;
  1826. }
  1827. EOF
  1828. compile_prog "" "$xen_libs"
  1829. then
  1830. xen_ctrl_version=340
  1831. xen=yes
  1832. # Xen 3.3.0
  1833. elif
  1834. cat > $TMPC <<EOF &&
  1835. #include <xenctrl.h>
  1836. #include <xs.h>
  1837. int main(void) {
  1838. xs_daemon_open();
  1839. xc_interface_open();
  1840. xc_gnttab_open();
  1841. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1842. return 0;
  1843. }
  1844. EOF
  1845. compile_prog "" "$xen_libs"
  1846. then
  1847. xen_ctrl_version=330
  1848. xen=yes
  1849. # Xen version unsupported
  1850. else
  1851. if test "$xen" = "yes" ; then
  1852. feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
  1853. fi
  1854. xen=no
  1855. fi
  1856. if test "$xen" = yes; then
  1857. libs_softmmu="$xen_libs $libs_softmmu"
  1858. fi
  1859. fi
  1860. if test "$xen_pci_passthrough" != "no"; then
  1861. if test "$xen" = "yes" && test "$linux" = "yes" &&
  1862. test "$xen_ctrl_version" -ge 340; then
  1863. xen_pci_passthrough=yes
  1864. else
  1865. if test "$xen_pci_passthrough" = "yes"; then
  1866. if test "$xen_ctrl_version" -lt 340; then
  1867. error_exit "User requested feature Xen PCI Passthrough" \
  1868. "This feature does not work with Xen 3.3"
  1869. fi
  1870. error_exit "User requested feature Xen PCI Passthrough" \
  1871. " but this feature requires /sys from Linux"
  1872. fi
  1873. xen_pci_passthrough=no
  1874. fi
  1875. fi
  1876. ##########################################
  1877. # libtool probe
  1878. if ! has $libtool; then
  1879. libtool=
  1880. fi
  1881. # MacOSX ships with a libtool which isn't the GNU one; weed this
  1882. # out by checking whether libtool supports the --version switch
  1883. if test -n "$libtool"; then
  1884. if ! "$libtool" --version >/dev/null 2>&1; then
  1885. libtool=
  1886. fi
  1887. fi
  1888. ##########################################
  1889. # Sparse probe
  1890. if test "$sparse" != "no" ; then
  1891. if has cgcc; then
  1892. sparse=yes
  1893. else
  1894. if test "$sparse" = "yes" ; then
  1895. feature_not_found "sparse" "Install sparse binary"
  1896. fi
  1897. sparse=no
  1898. fi
  1899. fi
  1900. ##########################################
  1901. # GTK probe
  1902. if test "$gtkabi" = ""; then
  1903. # The GTK ABI was not specified explicitly, so try whether 2.0 is available.
  1904. # Use 3.0 as a fallback if that is available.
  1905. if $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
  1906. gtkabi=2.0
  1907. elif $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
  1908. gtkabi=3.0
  1909. else
  1910. gtkabi=2.0
  1911. fi
  1912. fi
  1913. if test "$gtk" != "no"; then
  1914. gtkpackage="gtk+-$gtkabi"
  1915. gtkx11package="gtk+-x11-$gtkabi"
  1916. if test "$gtkabi" = "3.0" ; then
  1917. gtkversion="3.0.0"
  1918. else
  1919. gtkversion="2.18.0"
  1920. fi
  1921. if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
  1922. gtk_cflags=`$pkg_config --cflags $gtkpackage`
  1923. gtk_libs=`$pkg_config --libs $gtkpackage`
  1924. if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
  1925. gtk_libs="$gtk_libs -lX11"
  1926. fi
  1927. libs_softmmu="$gtk_libs $libs_softmmu"
  1928. gtk="yes"
  1929. elif test "$gtk" = "yes"; then
  1930. feature_not_found "gtk" "Install gtk2 or gtk3 devel"
  1931. else
  1932. gtk="no"
  1933. fi
  1934. fi
  1935. ##########################################
  1936. # VTE probe
  1937. if test "$vte" != "no"; then
  1938. if test "$gtkabi" = "3.0"; then
  1939. vtepackage="vte-2.90"
  1940. vteversion="0.32.0"
  1941. else
  1942. vtepackage="vte"
  1943. vteversion="0.24.0"
  1944. fi
  1945. if $pkg_config --exists "$vtepackage >= $vteversion"; then
  1946. vte_cflags=`$pkg_config --cflags $vtepackage`
  1947. vte_libs=`$pkg_config --libs $vtepackage`
  1948. libs_softmmu="$vte_libs $libs_softmmu"
  1949. vte="yes"
  1950. elif test "$vte" = "yes"; then
  1951. if test "$gtkabi" = "3.0"; then
  1952. feature_not_found "vte" "Install libvte-2.90 devel"
  1953. else
  1954. feature_not_found "vte" "Install libvte devel"
  1955. fi
  1956. else
  1957. vte="no"
  1958. fi
  1959. fi
  1960. ##########################################
  1961. # SDL probe
  1962. # Look for sdl configuration program (pkg-config or sdl-config). Try
  1963. # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
  1964. if test $sdlabi = "2.0"; then
  1965. sdl_config=$sdl2_config
  1966. sdlname=sdl2
  1967. sdlconfigname=sdl2_config
  1968. else
  1969. sdlname=sdl
  1970. sdlconfigname=sdl_config
  1971. fi
  1972. if test "`basename $sdl_config`" != $sdlconfigname && ! has ${sdl_config}; then
  1973. sdl_config=$sdlconfigname
  1974. fi
  1975. if $pkg_config $sdlname --exists; then
  1976. sdlconfig="$pkg_config $sdlname"
  1977. _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
  1978. elif has ${sdl_config}; then
  1979. sdlconfig="$sdl_config"
  1980. _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
  1981. else
  1982. if test "$sdl" = "yes" ; then
  1983. feature_not_found "sdl" "Install SDL devel"
  1984. fi
  1985. sdl=no
  1986. fi
  1987. if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
  1988. echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
  1989. fi
  1990. sdl_too_old=no
  1991. if test "$sdl" != "no" ; then
  1992. cat > $TMPC << EOF
  1993. #include <SDL.h>
  1994. #undef main /* We don't want SDL to override our main() */
  1995. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  1996. EOF
  1997. sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
  1998. if test "$static" = "yes" ; then
  1999. sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
  2000. else
  2001. sdl_libs=`$sdlconfig --libs 2> /dev/null`
  2002. fi
  2003. if compile_prog "$sdl_cflags" "$sdl_libs" ; then
  2004. if test "$_sdlversion" -lt 121 ; then
  2005. sdl_too_old=yes
  2006. else
  2007. if test "$cocoa" = "no" ; then
  2008. sdl=yes
  2009. fi
  2010. fi
  2011. # static link with sdl ? (note: sdl.pc's --static --libs is broken)
  2012. if test "$sdl" = "yes" -a "$static" = "yes" ; then
  2013. if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
  2014. sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
  2015. sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
  2016. fi
  2017. if compile_prog "$sdl_cflags" "$sdl_libs" ; then
  2018. :
  2019. else
  2020. sdl=no
  2021. fi
  2022. fi # static link
  2023. else # sdl not found
  2024. if test "$sdl" = "yes" ; then
  2025. feature_not_found "sdl" "Install SDL devel"
  2026. fi
  2027. sdl=no
  2028. fi # sdl compile test
  2029. fi
  2030. if test "$sdl" = "yes" ; then
  2031. cat > $TMPC <<EOF
  2032. #include <SDL.h>
  2033. #if defined(SDL_VIDEO_DRIVER_X11)
  2034. #include <X11/XKBlib.h>
  2035. #else
  2036. #error No x11 support
  2037. #endif
  2038. int main(void) { return 0; }
  2039. EOF
  2040. if compile_prog "$sdl_cflags" "$sdl_libs" ; then
  2041. sdl_libs="$sdl_libs -lX11"
  2042. fi
  2043. libs_softmmu="$sdl_libs $libs_softmmu"
  2044. fi
  2045. ##########################################
  2046. # RDMA needs OpenFabrics libraries
  2047. if test "$rdma" != "no" ; then
  2048. cat > $TMPC <<EOF
  2049. #include <rdma/rdma_cma.h>
  2050. int main(void) { return 0; }
  2051. EOF
  2052. rdma_libs="-lrdmacm -libverbs"
  2053. if compile_prog "" "$rdma_libs" ; then
  2054. rdma="yes"
  2055. libs_softmmu="$libs_softmmu $rdma_libs"
  2056. else
  2057. if test "$rdma" = "yes" ; then
  2058. error_exit \
  2059. " OpenFabrics librdmacm/libibverbs not present." \
  2060. " Your options:" \
  2061. " (1) Fast: Install infiniband packages from your distro." \
  2062. " (2) Cleanest: Install libraries from www.openfabrics.org" \
  2063. " (3) Also: Install softiwarp if you don't have RDMA hardware"
  2064. fi
  2065. rdma="no"
  2066. fi
  2067. fi
  2068. ##########################################
  2069. # VNC TLS/WS detection
  2070. if test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
  2071. cat > $TMPC <<EOF
  2072. #include <gnutls/gnutls.h>
  2073. int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
  2074. EOF
  2075. vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
  2076. vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
  2077. if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
  2078. if test "$vnc_tls" != "no" ; then
  2079. vnc_tls=yes
  2080. fi
  2081. if test "$vnc_ws" != "no" ; then
  2082. vnc_ws=yes
  2083. fi
  2084. libs_softmmu="$vnc_tls_libs $libs_softmmu"
  2085. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
  2086. else
  2087. if test "$vnc_tls" = "yes" ; then
  2088. feature_not_found "vnc-tls" "Install gnutls devel"
  2089. fi
  2090. if test "$vnc_ws" = "yes" ; then
  2091. feature_not_found "vnc-ws" "Install gnutls devel"
  2092. fi
  2093. vnc_tls=no
  2094. vnc_ws=no
  2095. fi
  2096. fi
  2097. ##########################################
  2098. # Quorum probe (check for gnutls)
  2099. if test "$quorum" != "no" ; then
  2100. cat > $TMPC <<EOF
  2101. #include <gnutls/gnutls.h>
  2102. #include <gnutls/crypto.h>
  2103. int main(void) {char data[4096], digest[32];
  2104. gnutls_hash_fast(GNUTLS_DIG_SHA256, data, 4096, digest);
  2105. return 0;
  2106. }
  2107. EOF
  2108. quorum_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
  2109. quorum_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
  2110. if compile_prog "$quorum_tls_cflags" "$quorum_tls_libs" ; then
  2111. qcow_tls=yes
  2112. libs_softmmu="$quorum_tls_libs $libs_softmmu"
  2113. libs_tools="$quorum_tls_libs $libs_softmmu"
  2114. QEMU_CFLAGS="$QEMU_CFLAGS $quorum_tls_cflags"
  2115. quorum="yes"
  2116. else
  2117. if test "$quorum" = "yes"; then
  2118. feature_not_found "gnutls" "gnutls > 2.10.0 required to compile Quorum"
  2119. fi
  2120. quorum="no"
  2121. fi
  2122. fi
  2123. ##########################################
  2124. # VNC SASL detection
  2125. if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
  2126. cat > $TMPC <<EOF
  2127. #include <sasl/sasl.h>
  2128. #include <stdio.h>
  2129. int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
  2130. EOF
  2131. # Assuming Cyrus-SASL installed in /usr prefix
  2132. vnc_sasl_cflags=""
  2133. vnc_sasl_libs="-lsasl2"
  2134. if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
  2135. vnc_sasl=yes
  2136. libs_softmmu="$vnc_sasl_libs $libs_softmmu"
  2137. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
  2138. else
  2139. if test "$vnc_sasl" = "yes" ; then
  2140. feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
  2141. fi
  2142. vnc_sasl=no
  2143. fi
  2144. fi
  2145. ##########################################
  2146. # VNC JPEG detection
  2147. if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
  2148. cat > $TMPC <<EOF
  2149. #include <stdio.h>
  2150. #include <jpeglib.h>
  2151. int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
  2152. EOF
  2153. vnc_jpeg_cflags=""
  2154. vnc_jpeg_libs="-ljpeg"
  2155. if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
  2156. vnc_jpeg=yes
  2157. libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
  2158. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
  2159. else
  2160. if test "$vnc_jpeg" = "yes" ; then
  2161. feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
  2162. fi
  2163. vnc_jpeg=no
  2164. fi
  2165. fi
  2166. ##########################################
  2167. # VNC PNG detection
  2168. if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
  2169. cat > $TMPC <<EOF
  2170. //#include <stdio.h>
  2171. #include <png.h>
  2172. #include <stddef.h>
  2173. int main(void) {
  2174. png_structp png_ptr;
  2175. png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
  2176. return png_ptr != 0;
  2177. }
  2178. EOF
  2179. if $pkg_config libpng --exists; then
  2180. vnc_png_cflags=`$pkg_config libpng --cflags`
  2181. vnc_png_libs=`$pkg_config libpng --libs`
  2182. else
  2183. vnc_png_cflags=""
  2184. vnc_png_libs="-lpng"
  2185. fi
  2186. if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
  2187. vnc_png=yes
  2188. libs_softmmu="$vnc_png_libs $libs_softmmu"
  2189. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
  2190. else
  2191. if test "$vnc_png" = "yes" ; then
  2192. feature_not_found "vnc-png" "Install libpng devel"
  2193. fi
  2194. vnc_png=no
  2195. fi
  2196. fi
  2197. ##########################################
  2198. # fnmatch() probe, used for ACL routines
  2199. fnmatch="no"
  2200. cat > $TMPC << EOF
  2201. #include <fnmatch.h>
  2202. int main(void)
  2203. {
  2204. fnmatch("foo", "foo", 0);
  2205. return 0;
  2206. }
  2207. EOF
  2208. if compile_prog "" "" ; then
  2209. fnmatch="yes"
  2210. fi
  2211. ##########################################
  2212. # uuid_generate() probe, used for vdi block driver
  2213. # Note that on some systems (notably MacOSX) no extra library
  2214. # need be linked to get the uuid functions.
  2215. if test "$uuid" != "no" ; then
  2216. uuid_libs="-luuid"
  2217. cat > $TMPC << EOF
  2218. #include <uuid/uuid.h>
  2219. int main(void)
  2220. {
  2221. uuid_t my_uuid;
  2222. uuid_generate(my_uuid);
  2223. return 0;
  2224. }
  2225. EOF
  2226. if compile_prog "" "" ; then
  2227. uuid="yes"
  2228. elif compile_prog "" "$uuid_libs" ; then
  2229. uuid="yes"
  2230. libs_softmmu="$uuid_libs $libs_softmmu"
  2231. libs_tools="$uuid_libs $libs_tools"
  2232. else
  2233. if test "$uuid" = "yes" ; then
  2234. feature_not_found "uuid" "Install libuuid devel"
  2235. fi
  2236. uuid=no
  2237. fi
  2238. fi
  2239. if test "$vhdx" = "yes" ; then
  2240. if test "$uuid" = "no" ; then
  2241. error_exit "uuid required for VHDX support"
  2242. fi
  2243. elif test "$vhdx" != "no" ; then
  2244. if test "$uuid" = "yes" ; then
  2245. vhdx=yes
  2246. else
  2247. vhdx=no
  2248. fi
  2249. fi
  2250. ##########################################
  2251. # xfsctl() probe, used for raw-posix
  2252. if test "$xfs" != "no" ; then
  2253. cat > $TMPC << EOF
  2254. #include <stddef.h> /* NULL */
  2255. #include <xfs/xfs.h>
  2256. int main(void)
  2257. {
  2258. xfsctl(NULL, 0, 0, NULL);
  2259. return 0;
  2260. }
  2261. EOF
  2262. if compile_prog "" "" ; then
  2263. xfs="yes"
  2264. else
  2265. if test "$xfs" = "yes" ; then
  2266. feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
  2267. fi
  2268. xfs=no
  2269. fi
  2270. fi
  2271. ##########################################
  2272. # vde libraries probe
  2273. if test "$vde" != "no" ; then
  2274. vde_libs="-lvdeplug"
  2275. cat > $TMPC << EOF
  2276. #include <libvdeplug.h>
  2277. int main(void)
  2278. {
  2279. struct vde_open_args a = {0, 0, 0};
  2280. char s[] = "";
  2281. vde_open(s, s, &a);
  2282. return 0;
  2283. }
  2284. EOF
  2285. if compile_prog "" "$vde_libs" ; then
  2286. vde=yes
  2287. libs_softmmu="$vde_libs $libs_softmmu"
  2288. libs_tools="$vde_libs $libs_tools"
  2289. else
  2290. if test "$vde" = "yes" ; then
  2291. feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
  2292. fi
  2293. vde=no
  2294. fi
  2295. fi
  2296. ##########################################
  2297. # netmap support probe
  2298. # Apart from looking for netmap headers, we make sure that the host API version
  2299. # supports the netmap backend (>=11). The upper bound (15) is meant to simulate
  2300. # a minor/major version number. Minor new features will be marked with values up
  2301. # to 15, and if something happens that requires a change to the backend we will
  2302. # move above 15, submit the backend fixes and modify this two bounds.
  2303. if test "$netmap" != "no" ; then
  2304. cat > $TMPC << EOF
  2305. #include <inttypes.h>
  2306. #include <net/if.h>
  2307. #include <net/netmap.h>
  2308. #include <net/netmap_user.h>
  2309. #if (NETMAP_API < 11) || (NETMAP_API > 15)
  2310. #error
  2311. #endif
  2312. int main(void) { return 0; }
  2313. EOF
  2314. if compile_prog "" "" ; then
  2315. netmap=yes
  2316. else
  2317. if test "$netmap" = "yes" ; then
  2318. feature_not_found "netmap"
  2319. fi
  2320. netmap=no
  2321. fi
  2322. fi
  2323. ##########################################
  2324. # libcap-ng library probe
  2325. if test "$cap_ng" != "no" ; then
  2326. cap_libs="-lcap-ng"
  2327. cat > $TMPC << EOF
  2328. #include <cap-ng.h>
  2329. int main(void)
  2330. {
  2331. capng_capability_to_name(CAPNG_EFFECTIVE);
  2332. return 0;
  2333. }
  2334. EOF
  2335. if compile_prog "" "$cap_libs" ; then
  2336. cap_ng=yes
  2337. libs_tools="$cap_libs $libs_tools"
  2338. else
  2339. if test "$cap_ng" = "yes" ; then
  2340. feature_not_found "cap_ng" "Install libcap-ng devel"
  2341. fi
  2342. cap_ng=no
  2343. fi
  2344. fi
  2345. ##########################################
  2346. # Sound support libraries probe
  2347. audio_drv_probe()
  2348. {
  2349. drv=$1
  2350. hdr=$2
  2351. lib=$3
  2352. exp=$4
  2353. cfl=$5
  2354. cat > $TMPC << EOF
  2355. #include <$hdr>
  2356. int main(void) { $exp }
  2357. EOF
  2358. if compile_prog "$cfl" "$lib" ; then
  2359. :
  2360. else
  2361. error_exit "$drv check failed" \
  2362. "Make sure to have the $drv libs and headers installed."
  2363. fi
  2364. }
  2365. audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
  2366. for drv in $audio_drv_list; do
  2367. case $drv in
  2368. alsa)
  2369. audio_drv_probe $drv alsa/asoundlib.h -lasound \
  2370. "return snd_pcm_close((snd_pcm_t *)0);"
  2371. libs_softmmu="-lasound $libs_softmmu"
  2372. ;;
  2373. fmod)
  2374. if test -z $fmod_lib || test -z $fmod_inc; then
  2375. error_exit "You must specify path to FMOD library and headers" \
  2376. "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
  2377. fi
  2378. audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
  2379. libs_softmmu="$fmod_lib $libs_softmmu"
  2380. ;;
  2381. esd)
  2382. audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
  2383. libs_softmmu="-lesd $libs_softmmu"
  2384. audio_pt_int="yes"
  2385. ;;
  2386. pa)
  2387. audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
  2388. "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
  2389. libs_softmmu="-lpulse $libs_softmmu"
  2390. audio_pt_int="yes"
  2391. ;;
  2392. coreaudio)
  2393. libs_softmmu="-framework CoreAudio $libs_softmmu"
  2394. ;;
  2395. dsound)
  2396. libs_softmmu="-lole32 -ldxguid $libs_softmmu"
  2397. audio_win_int="yes"
  2398. ;;
  2399. oss)
  2400. libs_softmmu="$oss_lib $libs_softmmu"
  2401. ;;
  2402. sdl|wav)
  2403. # XXX: Probes for CoreAudio, DirectSound, SDL(?)
  2404. ;;
  2405. winwave)
  2406. libs_softmmu="-lwinmm $libs_softmmu"
  2407. audio_win_int="yes"
  2408. ;;
  2409. *)
  2410. echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
  2411. error_exit "Unknown driver '$drv' selected" \
  2412. "Possible drivers are: $audio_possible_drivers"
  2413. }
  2414. ;;
  2415. esac
  2416. done
  2417. ##########################################
  2418. # BrlAPI probe
  2419. if test "$brlapi" != "no" ; then
  2420. brlapi_libs="-lbrlapi"
  2421. cat > $TMPC << EOF
  2422. #include <brlapi.h>
  2423. #include <stddef.h>
  2424. int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
  2425. EOF
  2426. if compile_prog "" "$brlapi_libs" ; then
  2427. brlapi=yes
  2428. libs_softmmu="$brlapi_libs $libs_softmmu"
  2429. else
  2430. if test "$brlapi" = "yes" ; then
  2431. feature_not_found "brlapi" "Install brlapi devel"
  2432. fi
  2433. brlapi=no
  2434. fi
  2435. fi
  2436. ##########################################
  2437. # curses probe
  2438. if test "$curses" != "no" ; then
  2439. if test "$mingw32" = "yes" ; then
  2440. curses_list="-lpdcurses"
  2441. else
  2442. curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
  2443. fi
  2444. curses_found=no
  2445. cat > $TMPC << EOF
  2446. #include <curses.h>
  2447. int main(void) {
  2448. const char *s = curses_version();
  2449. resize_term(0, 0);
  2450. return s != 0;
  2451. }
  2452. EOF
  2453. IFS=:
  2454. for curses_lib in $curses_list; do
  2455. unset IFS
  2456. if compile_prog "" "$curses_lib" ; then
  2457. curses_found=yes
  2458. libs_softmmu="$curses_lib $libs_softmmu"
  2459. break
  2460. fi
  2461. done
  2462. unset IFS
  2463. if test "$curses_found" = "yes" ; then
  2464. curses=yes
  2465. else
  2466. if test "$curses" = "yes" ; then
  2467. feature_not_found "curses" "Install ncurses devel"
  2468. fi
  2469. curses=no
  2470. fi
  2471. fi
  2472. ##########################################
  2473. # curl probe
  2474. if test "$curl" != "no" ; then
  2475. if $pkg_config libcurl --exists; then
  2476. curlconfig="$pkg_config libcurl"
  2477. else
  2478. curlconfig=curl-config
  2479. fi
  2480. cat > $TMPC << EOF
  2481. #include <curl/curl.h>
  2482. int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
  2483. EOF
  2484. curl_cflags=`$curlconfig --cflags 2>/dev/null`
  2485. curl_libs=`$curlconfig --libs 2>/dev/null`
  2486. if compile_prog "$curl_cflags" "$curl_libs" ; then
  2487. curl=yes
  2488. else
  2489. if test "$curl" = "yes" ; then
  2490. feature_not_found "curl" "Install libcurl devel"
  2491. fi
  2492. curl=no
  2493. fi
  2494. fi # test "$curl"
  2495. ##########################################
  2496. # bluez support probe
  2497. if test "$bluez" != "no" ; then
  2498. cat > $TMPC << EOF
  2499. #include <bluetooth/bluetooth.h>
  2500. int main(void) { return bt_error(0); }
  2501. EOF
  2502. bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
  2503. bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
  2504. if compile_prog "$bluez_cflags" "$bluez_libs" ; then
  2505. bluez=yes
  2506. libs_softmmu="$bluez_libs $libs_softmmu"
  2507. else
  2508. if test "$bluez" = "yes" ; then
  2509. feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
  2510. fi
  2511. bluez="no"
  2512. fi
  2513. fi
  2514. ##########################################
  2515. # glib support probe
  2516. if test "$mingw32" = yes; then
  2517. # g_poll is required in order to integrate with the glib main loop.
  2518. glib_req_ver=2.20
  2519. else
  2520. glib_req_ver=2.12
  2521. fi
  2522. glib_modules=gthread-2.0
  2523. if test "$modules" = yes; then
  2524. glib_modules="$glib_modules gmodule-2.0"
  2525. fi
  2526. for i in $glib_modules; do
  2527. if $pkg_config --atleast-version=$glib_req_ver $i; then
  2528. glib_cflags=`$pkg_config --cflags $i`
  2529. glib_libs=`$pkg_config --libs $i`
  2530. CFLAGS="$glib_cflags $CFLAGS"
  2531. LIBS="$glib_libs $LIBS"
  2532. libs_qga="$glib_libs $libs_qga"
  2533. else
  2534. error_exit "glib-$glib_req_ver $i is required to compile QEMU"
  2535. fi
  2536. done
  2537. ##########################################
  2538. # SHA command probe for modules
  2539. if test "$modules" = yes; then
  2540. shacmd_probe="sha1sum sha1 shasum"
  2541. for c in $shacmd_probe; do
  2542. if which $c >/dev/null 2>&1; then
  2543. shacmd="$c"
  2544. break
  2545. fi
  2546. done
  2547. if test "$shacmd" = ""; then
  2548. error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
  2549. fi
  2550. fi
  2551. ##########################################
  2552. # pixman support probe
  2553. if test "$pixman" = ""; then
  2554. if test "$want_tools" = "no" -a "$softmmu" = "no"; then
  2555. pixman="none"
  2556. elif $pkg_config pixman-1 > /dev/null 2>&1; then
  2557. pixman="system"
  2558. else
  2559. pixman="internal"
  2560. fi
  2561. fi
  2562. if test "$pixman" = "none"; then
  2563. if test "$want_tools" != "no" -o "$softmmu" != "no"; then
  2564. error_exit "pixman disabled but system emulation or tools build" \
  2565. "enabled. You can turn off pixman only if you also" \
  2566. "disable all system emulation targets and the tools" \
  2567. "build with '--disable-tools --disable-system'."
  2568. fi
  2569. pixman_cflags=
  2570. pixman_libs=
  2571. elif test "$pixman" = "system"; then
  2572. pixman_cflags=`$pkg_config --cflags pixman-1`
  2573. pixman_libs=`$pkg_config --libs pixman-1`
  2574. else
  2575. if test ! -d ${source_path}/pixman/pixman; then
  2576. error_exit "pixman not present. Your options:" \
  2577. " (1) Preferred: Install the pixman devel package (any recent" \
  2578. " distro should have packages as Xorg needs pixman too)." \
  2579. " (2) Fetch the pixman submodule, using:" \
  2580. " git submodule update --init pixman"
  2581. fi
  2582. mkdir -p pixman/pixman
  2583. pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
  2584. pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
  2585. fi
  2586. ##########################################
  2587. # libcap probe
  2588. if test "$cap" != "no" ; then
  2589. cat > $TMPC <<EOF
  2590. #include <stdio.h>
  2591. #include <sys/capability.h>
  2592. int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
  2593. EOF
  2594. if compile_prog "" "-lcap" ; then
  2595. cap=yes
  2596. else
  2597. cap=no
  2598. fi
  2599. fi
  2600. ##########################################
  2601. # pthread probe
  2602. PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
  2603. pthread=no
  2604. cat > $TMPC << EOF
  2605. #include <pthread.h>
  2606. static void *f(void *p) { return NULL; }
  2607. int main(void) {
  2608. pthread_t thread;
  2609. pthread_create(&thread, 0, f, 0);
  2610. return 0;
  2611. }
  2612. EOF
  2613. if compile_prog "" "" ; then
  2614. pthread=yes
  2615. else
  2616. for pthread_lib in $PTHREADLIBS_LIST; do
  2617. if compile_prog "" "$pthread_lib" ; then
  2618. pthread=yes
  2619. found=no
  2620. for lib_entry in $LIBS; do
  2621. if test "$lib_entry" = "$pthread_lib"; then
  2622. found=yes
  2623. break
  2624. fi
  2625. done
  2626. if test "$found" = "no"; then
  2627. LIBS="$pthread_lib $LIBS"
  2628. fi
  2629. break
  2630. fi
  2631. done
  2632. fi
  2633. if test "$mingw32" != yes -a "$pthread" = no; then
  2634. error_exit "pthread check failed" \
  2635. "Make sure to have the pthread libs and headers installed."
  2636. fi
  2637. # check for pthread_setname_np
  2638. pthread_setname_np=no
  2639. cat > $TMPC << EOF
  2640. #include <pthread.h>
  2641. static void *f(void *p) { return NULL; }
  2642. int main(void)
  2643. {
  2644. pthread_t thread;
  2645. pthread_create(&thread, 0, f, 0);
  2646. pthread_setname_np(thread, "QEMU");
  2647. return 0;
  2648. }
  2649. EOF
  2650. if compile_prog "" "$pthread_lib" ; then
  2651. pthread_setname_np=yes
  2652. fi
  2653. ##########################################
  2654. # rbd probe
  2655. if test "$rbd" != "no" ; then
  2656. cat > $TMPC <<EOF
  2657. #include <stdio.h>
  2658. #include <rbd/librbd.h>
  2659. int main(void) {
  2660. rados_t cluster;
  2661. rados_create(&cluster, NULL);
  2662. return 0;
  2663. }
  2664. EOF
  2665. rbd_libs="-lrbd -lrados"
  2666. if compile_prog "" "$rbd_libs" ; then
  2667. rbd=yes
  2668. else
  2669. if test "$rbd" = "yes" ; then
  2670. feature_not_found "rados block device" "Install librbd/ceph devel"
  2671. fi
  2672. rbd=no
  2673. fi
  2674. fi
  2675. ##########################################
  2676. # libssh2 probe
  2677. min_libssh2_version=1.2.8
  2678. if test "$libssh2" != "no" ; then
  2679. if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
  2680. libssh2_cflags=`$pkg_config libssh2 --cflags`
  2681. libssh2_libs=`$pkg_config libssh2 --libs`
  2682. libssh2=yes
  2683. else
  2684. if test "$libssh2" = "yes" ; then
  2685. error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
  2686. fi
  2687. libssh2=no
  2688. fi
  2689. fi
  2690. ##########################################
  2691. # libssh2_sftp_fsync probe
  2692. if test "$libssh2" = "yes"; then
  2693. cat > $TMPC <<EOF
  2694. #include <stdio.h>
  2695. #include <libssh2.h>
  2696. #include <libssh2_sftp.h>
  2697. int main(void) {
  2698. LIBSSH2_SESSION *session;
  2699. LIBSSH2_SFTP *sftp;
  2700. LIBSSH2_SFTP_HANDLE *sftp_handle;
  2701. session = libssh2_session_init ();
  2702. sftp = libssh2_sftp_init (session);
  2703. sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
  2704. libssh2_sftp_fsync (sftp_handle);
  2705. return 0;
  2706. }
  2707. EOF
  2708. # libssh2_cflags/libssh2_libs defined in previous test.
  2709. if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
  2710. QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
  2711. fi
  2712. fi
  2713. ##########################################
  2714. # linux-aio probe
  2715. if test "$linux_aio" != "no" ; then
  2716. cat > $TMPC <<EOF
  2717. #include <libaio.h>
  2718. #include <sys/eventfd.h>
  2719. #include <stddef.h>
  2720. int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
  2721. EOF
  2722. if compile_prog "" "-laio" ; then
  2723. linux_aio=yes
  2724. else
  2725. if test "$linux_aio" = "yes" ; then
  2726. feature_not_found "linux AIO" "Install libaio devel"
  2727. fi
  2728. linux_aio=no
  2729. fi
  2730. fi
  2731. ##########################################
  2732. # TPM passthrough is only on x86 Linux
  2733. if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
  2734. tpm_passthrough=$tpm
  2735. else
  2736. tpm_passthrough=no
  2737. fi
  2738. ##########################################
  2739. # adjust virtio-blk-data-plane based on linux-aio
  2740. if test "$virtio_blk_data_plane" = "yes" -a \
  2741. "$linux_aio" != "yes" ; then
  2742. error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
  2743. elif test -z "$virtio_blk_data_plane" ; then
  2744. virtio_blk_data_plane=$linux_aio
  2745. fi
  2746. ##########################################
  2747. # attr probe
  2748. if test "$attr" != "no" ; then
  2749. cat > $TMPC <<EOF
  2750. #include <stdio.h>
  2751. #include <sys/types.h>
  2752. #ifdef CONFIG_LIBATTR
  2753. #include <attr/xattr.h>
  2754. #else
  2755. #include <sys/xattr.h>
  2756. #endif
  2757. int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
  2758. EOF
  2759. if compile_prog "" "" ; then
  2760. attr=yes
  2761. # Older distros have <attr/xattr.h>, and need -lattr:
  2762. elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
  2763. attr=yes
  2764. LIBS="-lattr $LIBS"
  2765. libattr=yes
  2766. else
  2767. if test "$attr" = "yes" ; then
  2768. feature_not_found "ATTR" "Install libc6 or libattr devel"
  2769. fi
  2770. attr=no
  2771. fi
  2772. fi
  2773. ##########################################
  2774. # iovec probe
  2775. cat > $TMPC <<EOF
  2776. #include <sys/types.h>
  2777. #include <sys/uio.h>
  2778. #include <unistd.h>
  2779. int main(void) { return sizeof(struct iovec); }
  2780. EOF
  2781. iovec=no
  2782. if compile_prog "" "" ; then
  2783. iovec=yes
  2784. fi
  2785. ##########################################
  2786. # preadv probe
  2787. cat > $TMPC <<EOF
  2788. #include <sys/types.h>
  2789. #include <sys/uio.h>
  2790. #include <unistd.h>
  2791. int main(void) { return preadv(0, 0, 0, 0); }
  2792. EOF
  2793. preadv=no
  2794. if compile_prog "" "" ; then
  2795. preadv=yes
  2796. fi
  2797. ##########################################
  2798. # fdt probe
  2799. # fdt support is mandatory for at least some target architectures,
  2800. # so insist on it if we're building those system emulators.
  2801. fdt_required=no
  2802. for target in $target_list; do
  2803. case $target in
  2804. aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
  2805. fdt_required=yes
  2806. ;;
  2807. esac
  2808. done
  2809. if test "$fdt_required" = "yes"; then
  2810. if test "$fdt" = "no"; then
  2811. error_exit "fdt disabled but some requested targets require it." \
  2812. "You can turn off fdt only if you also disable all the system emulation" \
  2813. "targets which need it (by specifying a cut down --target-list)."
  2814. fi
  2815. fdt=yes
  2816. fi
  2817. if test "$fdt" != "no" ; then
  2818. fdt_libs="-lfdt"
  2819. # explicitly check for libfdt_env.h as it is missing in some stable installs
  2820. cat > $TMPC << EOF
  2821. #include <libfdt_env.h>
  2822. int main(void) { return 0; }
  2823. EOF
  2824. if compile_prog "" "$fdt_libs" ; then
  2825. # system DTC is good - use it
  2826. fdt=yes
  2827. elif test -d ${source_path}/dtc/libfdt ; then
  2828. # have submodule DTC - use it
  2829. fdt=yes
  2830. dtc_internal="yes"
  2831. mkdir -p dtc
  2832. if [ "$pwd_is_source_path" != "y" ] ; then
  2833. symlink "$source_path/dtc/Makefile" "dtc/Makefile"
  2834. symlink "$source_path/dtc/scripts" "dtc/scripts"
  2835. fi
  2836. fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
  2837. fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
  2838. elif test "$fdt" = "yes" ; then
  2839. # have neither and want - prompt for system/submodule install
  2840. error_exit "DTC (libfdt) not present. Your options:" \
  2841. " (1) Preferred: Install the DTC (libfdt) devel package" \
  2842. " (2) Fetch the DTC submodule, using:" \
  2843. " git submodule update --init dtc"
  2844. else
  2845. # don't have and don't want
  2846. fdt_libs=
  2847. fdt=no
  2848. fi
  2849. fi
  2850. libs_softmmu="$libs_softmmu $fdt_libs"
  2851. ##########################################
  2852. # GLX probe, used by milkymist-tmu2
  2853. if test "$glx" != "no" ; then
  2854. glx_libs="-lGL -lX11"
  2855. cat > $TMPC << EOF
  2856. #include <X11/Xlib.h>
  2857. #include <GL/gl.h>
  2858. #include <GL/glx.h>
  2859. int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
  2860. EOF
  2861. if compile_prog "" "-lGL -lX11" ; then
  2862. glx=yes
  2863. else
  2864. if test "$glx" = "yes" ; then
  2865. feature_not_found "glx" "Install GL devel (e.g. MESA)"
  2866. fi
  2867. glx_libs=
  2868. glx=no
  2869. fi
  2870. fi
  2871. ##########################################
  2872. # glusterfs probe
  2873. if test "$glusterfs" != "no" ; then
  2874. if $pkg_config --atleast-version=3 glusterfs-api; then
  2875. glusterfs="yes"
  2876. glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
  2877. glusterfs_libs=`$pkg_config --libs glusterfs-api`
  2878. if $pkg_config --atleast-version=5 glusterfs-api; then
  2879. glusterfs_discard="yes"
  2880. fi
  2881. if $pkg_config --atleast-version=6 glusterfs-api; then
  2882. glusterfs_zerofill="yes"
  2883. fi
  2884. else
  2885. if test "$glusterfs" = "yes" ; then
  2886. feature_not_found "GlusterFS backend support" "Install glusterfs-api devel"
  2887. fi
  2888. glusterfs="no"
  2889. fi
  2890. fi
  2891. # Check for inotify functions when we are building linux-user
  2892. # emulator. This is done because older glibc versions don't
  2893. # have syscall stubs for these implemented. In that case we
  2894. # don't provide them even if kernel supports them.
  2895. #
  2896. inotify=no
  2897. cat > $TMPC << EOF
  2898. #include <sys/inotify.h>
  2899. int
  2900. main(void)
  2901. {
  2902. /* try to start inotify */
  2903. return inotify_init();
  2904. }
  2905. EOF
  2906. if compile_prog "" "" ; then
  2907. inotify=yes
  2908. fi
  2909. inotify1=no
  2910. cat > $TMPC << EOF
  2911. #include <sys/inotify.h>
  2912. int
  2913. main(void)
  2914. {
  2915. /* try to start inotify */
  2916. return inotify_init1(0);
  2917. }
  2918. EOF
  2919. if compile_prog "" "" ; then
  2920. inotify1=yes
  2921. fi
  2922. # check if utimensat and futimens are supported
  2923. utimens=no
  2924. cat > $TMPC << EOF
  2925. #define _ATFILE_SOURCE
  2926. #include <stddef.h>
  2927. #include <fcntl.h>
  2928. #include <sys/stat.h>
  2929. int main(void)
  2930. {
  2931. utimensat(AT_FDCWD, "foo", NULL, 0);
  2932. futimens(0, NULL);
  2933. return 0;
  2934. }
  2935. EOF
  2936. if compile_prog "" "" ; then
  2937. utimens=yes
  2938. fi
  2939. # check if pipe2 is there
  2940. pipe2=no
  2941. cat > $TMPC << EOF
  2942. #include <unistd.h>
  2943. #include <fcntl.h>
  2944. int main(void)
  2945. {
  2946. int pipefd[2];
  2947. return pipe2(pipefd, O_CLOEXEC);
  2948. }
  2949. EOF
  2950. if compile_prog "" "" ; then
  2951. pipe2=yes
  2952. fi
  2953. # check if accept4 is there
  2954. accept4=no
  2955. cat > $TMPC << EOF
  2956. #include <sys/socket.h>
  2957. #include <stddef.h>
  2958. int main(void)
  2959. {
  2960. accept4(0, NULL, NULL, SOCK_CLOEXEC);
  2961. return 0;
  2962. }
  2963. EOF
  2964. if compile_prog "" "" ; then
  2965. accept4=yes
  2966. fi
  2967. # check if tee/splice is there. vmsplice was added same time.
  2968. splice=no
  2969. cat > $TMPC << EOF
  2970. #include <unistd.h>
  2971. #include <fcntl.h>
  2972. #include <limits.h>
  2973. int main(void)
  2974. {
  2975. int len, fd = 0;
  2976. len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
  2977. splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
  2978. return 0;
  2979. }
  2980. EOF
  2981. if compile_prog "" "" ; then
  2982. splice=yes
  2983. fi
  2984. ##########################################
  2985. # libnuma probe
  2986. if test "$numa" != "no" ; then
  2987. cat > $TMPC << EOF
  2988. #include <numa.h>
  2989. int main(void) { return numa_available(); }
  2990. EOF
  2991. if compile_prog "" "-lnuma" ; then
  2992. numa=yes
  2993. libs_softmmu="-lnuma $libs_softmmu"
  2994. else
  2995. if test "$numa" = "yes" ; then
  2996. feature_not_found "numa" "install numactl devel"
  2997. fi
  2998. numa=no
  2999. fi
  3000. fi
  3001. ##########################################
  3002. # signalfd probe
  3003. signalfd="no"
  3004. cat > $TMPC << EOF
  3005. #include <unistd.h>
  3006. #include <sys/syscall.h>
  3007. #include <signal.h>
  3008. int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
  3009. EOF
  3010. if compile_prog "" "" ; then
  3011. signalfd=yes
  3012. fi
  3013. # check if eventfd is supported
  3014. eventfd=no
  3015. cat > $TMPC << EOF
  3016. #include <sys/eventfd.h>
  3017. int main(void)
  3018. {
  3019. return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
  3020. }
  3021. EOF
  3022. if compile_prog "" "" ; then
  3023. eventfd=yes
  3024. fi
  3025. # check for fallocate
  3026. fallocate=no
  3027. cat > $TMPC << EOF
  3028. #include <fcntl.h>
  3029. int main(void)
  3030. {
  3031. fallocate(0, 0, 0, 0);
  3032. return 0;
  3033. }
  3034. EOF
  3035. if compile_prog "" "" ; then
  3036. fallocate=yes
  3037. fi
  3038. # check for fallocate hole punching
  3039. fallocate_punch_hole=no
  3040. cat > $TMPC << EOF
  3041. #include <fcntl.h>
  3042. #include <linux/falloc.h>
  3043. int main(void)
  3044. {
  3045. fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
  3046. return 0;
  3047. }
  3048. EOF
  3049. if compile_prog "" "" ; then
  3050. fallocate_punch_hole=yes
  3051. fi
  3052. # check for sync_file_range
  3053. sync_file_range=no
  3054. cat > $TMPC << EOF
  3055. #include <fcntl.h>
  3056. int main(void)
  3057. {
  3058. sync_file_range(0, 0, 0, 0);
  3059. return 0;
  3060. }
  3061. EOF
  3062. if compile_prog "" "" ; then
  3063. sync_file_range=yes
  3064. fi
  3065. # check for linux/fiemap.h and FS_IOC_FIEMAP
  3066. fiemap=no
  3067. cat > $TMPC << EOF
  3068. #include <sys/ioctl.h>
  3069. #include <linux/fs.h>
  3070. #include <linux/fiemap.h>
  3071. int main(void)
  3072. {
  3073. ioctl(0, FS_IOC_FIEMAP, 0);
  3074. return 0;
  3075. }
  3076. EOF
  3077. if compile_prog "" "" ; then
  3078. fiemap=yes
  3079. fi
  3080. # check for dup3
  3081. dup3=no
  3082. cat > $TMPC << EOF
  3083. #include <unistd.h>
  3084. int main(void)
  3085. {
  3086. dup3(0, 0, 0);
  3087. return 0;
  3088. }
  3089. EOF
  3090. if compile_prog "" "" ; then
  3091. dup3=yes
  3092. fi
  3093. # check for ppoll support
  3094. ppoll=no
  3095. cat > $TMPC << EOF
  3096. #include <poll.h>
  3097. int main(void)
  3098. {
  3099. struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
  3100. ppoll(&pfd, 1, 0, 0);
  3101. return 0;
  3102. }
  3103. EOF
  3104. if compile_prog "" "" ; then
  3105. ppoll=yes
  3106. fi
  3107. # check for prctl(PR_SET_TIMERSLACK , ... ) support
  3108. prctl_pr_set_timerslack=no
  3109. cat > $TMPC << EOF
  3110. #include <sys/prctl.h>
  3111. int main(void)
  3112. {
  3113. prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
  3114. return 0;
  3115. }
  3116. EOF
  3117. if compile_prog "" "" ; then
  3118. prctl_pr_set_timerslack=yes
  3119. fi
  3120. # check for epoll support
  3121. epoll=no
  3122. cat > $TMPC << EOF
  3123. #include <sys/epoll.h>
  3124. int main(void)
  3125. {
  3126. epoll_create(0);
  3127. return 0;
  3128. }
  3129. EOF
  3130. if compile_prog "" "" ; then
  3131. epoll=yes
  3132. fi
  3133. # epoll_create1 and epoll_pwait are later additions
  3134. # so we must check separately for their presence
  3135. epoll_create1=no
  3136. cat > $TMPC << EOF
  3137. #include <sys/epoll.h>
  3138. int main(void)
  3139. {
  3140. /* Note that we use epoll_create1 as a value, not as
  3141. * a function being called. This is necessary so that on
  3142. * old SPARC glibc versions where the function was present in
  3143. * the library but not declared in the header file we will
  3144. * fail the configure check. (Otherwise we will get a compiler
  3145. * warning but not an error, and will proceed to fail the
  3146. * qemu compile where we compile with -Werror.)
  3147. */
  3148. return (int)(uintptr_t)&epoll_create1;
  3149. }
  3150. EOF
  3151. if compile_prog "" "" ; then
  3152. epoll_create1=yes
  3153. fi
  3154. epoll_pwait=no
  3155. cat > $TMPC << EOF
  3156. #include <sys/epoll.h>
  3157. int main(void)
  3158. {
  3159. epoll_pwait(0, 0, 0, 0, 0);
  3160. return 0;
  3161. }
  3162. EOF
  3163. if compile_prog "" "" ; then
  3164. epoll_pwait=yes
  3165. fi
  3166. # check for sendfile support
  3167. sendfile=no
  3168. cat > $TMPC << EOF
  3169. #include <sys/sendfile.h>
  3170. int main(void)
  3171. {
  3172. return sendfile(0, 0, 0, 0);
  3173. }
  3174. EOF
  3175. if compile_prog "" "" ; then
  3176. sendfile=yes
  3177. fi
  3178. # Check if tools are available to build documentation.
  3179. if test "$docs" != "no" ; then
  3180. if has makeinfo && has pod2man; then
  3181. docs=yes
  3182. else
  3183. if test "$docs" = "yes" ; then
  3184. feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
  3185. fi
  3186. docs=no
  3187. fi
  3188. fi
  3189. # Search for bswap_32 function
  3190. byteswap_h=no
  3191. cat > $TMPC << EOF
  3192. #include <byteswap.h>
  3193. int main(void) { return bswap_32(0); }
  3194. EOF
  3195. if compile_prog "" "" ; then
  3196. byteswap_h=yes
  3197. fi
  3198. # Search for bswap32 function
  3199. bswap_h=no
  3200. cat > $TMPC << EOF
  3201. #include <sys/endian.h>
  3202. #include <sys/types.h>
  3203. #include <machine/bswap.h>
  3204. int main(void) { return bswap32(0); }
  3205. EOF
  3206. if compile_prog "" "" ; then
  3207. bswap_h=yes
  3208. fi
  3209. ##########################################
  3210. # Do we have libiscsi >= 1.9.0
  3211. if test "$libiscsi" != "no" ; then
  3212. if $pkg_config --atleast-version=1.9.0 libiscsi; then
  3213. libiscsi="yes"
  3214. libiscsi_cflags=$($pkg_config --cflags libiscsi)
  3215. libiscsi_libs=$($pkg_config --libs libiscsi)
  3216. else
  3217. if test "$libiscsi" = "yes" ; then
  3218. feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
  3219. fi
  3220. libiscsi="no"
  3221. fi
  3222. fi
  3223. ##########################################
  3224. # Do we need libm
  3225. cat > $TMPC << EOF
  3226. #include <math.h>
  3227. int main(int argc, char **argv) { return isnan(sin((double)argc)); }
  3228. EOF
  3229. if compile_prog "" "" ; then
  3230. :
  3231. elif compile_prog "" "-lm" ; then
  3232. LIBS="-lm $LIBS"
  3233. libs_qga="-lm $libs_qga"
  3234. else
  3235. error_exit "libm check failed"
  3236. fi
  3237. ##########################################
  3238. # Do we need librt
  3239. # uClibc provides 2 versions of clock_gettime(), one with realtime
  3240. # support and one without. This means that the clock_gettime() don't
  3241. # need -lrt. We still need it for timer_create() so we check for this
  3242. # function in addition.
  3243. cat > $TMPC <<EOF
  3244. #include <signal.h>
  3245. #include <time.h>
  3246. int main(void) {
  3247. timer_create(CLOCK_REALTIME, NULL, NULL);
  3248. return clock_gettime(CLOCK_REALTIME, NULL);
  3249. }
  3250. EOF
  3251. if compile_prog "" "" ; then
  3252. :
  3253. # we need pthread for static linking. use previous pthread test result
  3254. elif compile_prog "" "$pthread_lib -lrt" ; then
  3255. LIBS="$LIBS -lrt"
  3256. libs_qga="$libs_qga -lrt"
  3257. fi
  3258. if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
  3259. "$aix" != "yes" -a "$haiku" != "yes" ; then
  3260. libs_softmmu="-lutil $libs_softmmu"
  3261. fi
  3262. ##########################################
  3263. # spice probe
  3264. if test "$spice" != "no" ; then
  3265. cat > $TMPC << EOF
  3266. #include <spice.h>
  3267. int main(void) { spice_server_new(); return 0; }
  3268. EOF
  3269. spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
  3270. spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
  3271. if $pkg_config --atleast-version=0.12.0 spice-server && \
  3272. $pkg_config --atleast-version=0.12.3 spice-protocol && \
  3273. compile_prog "$spice_cflags" "$spice_libs" ; then
  3274. spice="yes"
  3275. libs_softmmu="$libs_softmmu $spice_libs"
  3276. QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
  3277. spice_protocol_version=$($pkg_config --modversion spice-protocol)
  3278. spice_server_version=$($pkg_config --modversion spice-server)
  3279. else
  3280. if test "$spice" = "yes" ; then
  3281. feature_not_found "spice" "Install spice-server and spice-protocol devel"
  3282. fi
  3283. spice="no"
  3284. fi
  3285. fi
  3286. # check for libcacard for smartcard support
  3287. smartcard_cflags=""
  3288. # TODO - what's the minimal nss version we support?
  3289. if test "$smartcard_nss" != "no"; then
  3290. cat > $TMPC << EOF
  3291. #include <pk11pub.h>
  3292. int main(void) { PK11_FreeSlot(0); return 0; }
  3293. EOF
  3294. # FIXME: do not include $glib_* in here
  3295. nss_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
  3296. nss_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
  3297. test_cflags="$nss_cflags"
  3298. # The header files in nss < 3.13.3 have a bug which causes them to
  3299. # emit a warning. If we're going to compile QEMU with -Werror, then
  3300. # test that the headers don't have this bug. Otherwise we would pass
  3301. # the configure test but fail to compile QEMU later.
  3302. if test "$werror" = "yes"; then
  3303. test_cflags="-Werror $test_cflags"
  3304. fi
  3305. if test -n "$libtool" &&
  3306. $pkg_config --atleast-version=3.12.8 nss && \
  3307. compile_prog "$test_cflags" "$nss_libs"; then
  3308. smartcard_nss="yes"
  3309. else
  3310. if test "$smartcard_nss" = "yes"; then
  3311. feature_not_found "nss"
  3312. fi
  3313. smartcard_nss="no"
  3314. fi
  3315. fi
  3316. # check for libusb
  3317. if test "$libusb" != "no" ; then
  3318. if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
  3319. libusb="yes"
  3320. libusb_cflags=$($pkg_config --cflags libusb-1.0)
  3321. libusb_libs=$($pkg_config --libs libusb-1.0)
  3322. QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
  3323. libs_softmmu="$libs_softmmu $libusb_libs"
  3324. else
  3325. if test "$libusb" = "yes"; then
  3326. feature_not_found "libusb" "Install libusb devel"
  3327. fi
  3328. libusb="no"
  3329. fi
  3330. fi
  3331. # check for usbredirparser for usb network redirection support
  3332. if test "$usb_redir" != "no" ; then
  3333. if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
  3334. usb_redir="yes"
  3335. usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
  3336. usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
  3337. QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
  3338. libs_softmmu="$libs_softmmu $usb_redir_libs"
  3339. else
  3340. if test "$usb_redir" = "yes"; then
  3341. feature_not_found "usb-redir" "Install usbredir devel"
  3342. fi
  3343. usb_redir="no"
  3344. fi
  3345. fi
  3346. ##########################################
  3347. # check if we have VSS SDK headers for win
  3348. if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
  3349. case "$vss_win32_sdk" in
  3350. "") vss_win32_include="-I$source_path" ;;
  3351. *\ *) # The SDK is installed in "Program Files" by default, but we cannot
  3352. # handle path with spaces. So we symlink the headers into ".sdk/vss".
  3353. vss_win32_include="-I$source_path/.sdk/vss"
  3354. symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
  3355. ;;
  3356. *) vss_win32_include="-I$vss_win32_sdk"
  3357. esac
  3358. cat > $TMPC << EOF
  3359. #define __MIDL_user_allocate_free_DEFINED__
  3360. #include <inc/win2003/vss.h>
  3361. int main(void) { return VSS_CTX_BACKUP; }
  3362. EOF
  3363. if compile_prog "$vss_win32_include" "" ; then
  3364. guest_agent_with_vss="yes"
  3365. QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
  3366. libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
  3367. else
  3368. if test "$vss_win32_sdk" != "" ; then
  3369. echo "ERROR: Please download and install Microsoft VSS SDK:"
  3370. echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
  3371. echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
  3372. echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
  3373. echo "ERROR: The headers are extracted in the directory \`inc'."
  3374. feature_not_found "VSS support"
  3375. fi
  3376. guest_agent_with_vss="no"
  3377. fi
  3378. fi
  3379. ##########################################
  3380. # lookup Windows platform SDK (if not specified)
  3381. # The SDK is needed only to build .tlb (type library) file of guest agent
  3382. # VSS provider from the source. It is usually unnecessary because the
  3383. # pre-compiled .tlb file is included.
  3384. if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
  3385. if test -z "$win_sdk"; then
  3386. programfiles="$PROGRAMFILES"
  3387. test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
  3388. if test -n "$programfiles"; then
  3389. win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
  3390. else
  3391. feature_not_found "Windows SDK"
  3392. fi
  3393. elif test "$win_sdk" = "no"; then
  3394. win_sdk=""
  3395. fi
  3396. fi
  3397. ##########################################
  3398. ##########################################
  3399. # check if we have fdatasync
  3400. fdatasync=no
  3401. cat > $TMPC << EOF
  3402. #include <unistd.h>
  3403. int main(void) {
  3404. #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
  3405. return fdatasync(0);
  3406. #else
  3407. #error Not supported
  3408. #endif
  3409. }
  3410. EOF
  3411. if compile_prog "" "" ; then
  3412. fdatasync=yes
  3413. fi
  3414. ##########################################
  3415. # check if we have madvise
  3416. madvise=no
  3417. cat > $TMPC << EOF
  3418. #include <sys/types.h>
  3419. #include <sys/mman.h>
  3420. #include <stddef.h>
  3421. int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
  3422. EOF
  3423. if compile_prog "" "" ; then
  3424. madvise=yes
  3425. fi
  3426. ##########################################
  3427. # check if we have posix_madvise
  3428. posix_madvise=no
  3429. cat > $TMPC << EOF
  3430. #include <sys/mman.h>
  3431. #include <stddef.h>
  3432. int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
  3433. EOF
  3434. if compile_prog "" "" ; then
  3435. posix_madvise=yes
  3436. fi
  3437. ##########################################
  3438. # check if we have usable SIGEV_THREAD_ID
  3439. sigev_thread_id=no
  3440. cat > $TMPC << EOF
  3441. #include <signal.h>
  3442. int main(void) {
  3443. struct sigevent ev;
  3444. ev.sigev_notify = SIGEV_THREAD_ID;
  3445. ev._sigev_un._tid = 0;
  3446. asm volatile("" : : "g"(&ev));
  3447. return 0;
  3448. }
  3449. EOF
  3450. if compile_prog "" "" ; then
  3451. sigev_thread_id=yes
  3452. fi
  3453. ##########################################
  3454. # check if trace backend exists
  3455. $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null
  3456. if test "$?" -ne 0 ; then
  3457. error_exit "invalid trace backends" \
  3458. "Please choose supported trace backends."
  3459. fi
  3460. ##########################################
  3461. # For 'ust' backend, test if ust headers are present
  3462. if have_backend "ust"; then
  3463. cat > $TMPC << EOF
  3464. #include <lttng/tracepoint.h>
  3465. int main(void) { return 0; }
  3466. EOF
  3467. if compile_prog "" "" ; then
  3468. if $pkg_config lttng-ust --exists; then
  3469. lttng_ust_libs=`$pkg_config --libs lttng-ust`
  3470. else
  3471. lttng_ust_libs="-llttng-ust"
  3472. fi
  3473. if $pkg_config liburcu-bp --exists; then
  3474. urcu_bp_libs=`$pkg_config --libs liburcu-bp`
  3475. else
  3476. urcu_bp_libs="-lurcu-bp"
  3477. fi
  3478. LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
  3479. libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
  3480. else
  3481. error_exit "Trace backend 'ust' missing lttng-ust header files"
  3482. fi
  3483. fi
  3484. ##########################################
  3485. # For 'dtrace' backend, test if 'dtrace' command is present
  3486. if have_backend "dtrace"; then
  3487. if ! has 'dtrace' ; then
  3488. error_exit "dtrace command is not found in PATH $PATH"
  3489. fi
  3490. trace_backend_stap="no"
  3491. if has 'stap' ; then
  3492. trace_backend_stap="yes"
  3493. fi
  3494. fi
  3495. ##########################################
  3496. # check and set a backend for coroutine
  3497. # We prefer ucontext, but it's not always possible. The fallback
  3498. # is sigcontext. gthread is not selectable except explicitly, because
  3499. # it is not functional enough to run QEMU proper. (It is occasionally
  3500. # useful for debugging purposes.) On Windows the only valid backend
  3501. # is the Windows-specific one.
  3502. ucontext_works=no
  3503. if test "$darwin" != "yes"; then
  3504. cat > $TMPC << EOF
  3505. #include <ucontext.h>
  3506. #ifdef __stub_makecontext
  3507. #error Ignoring glibc stub makecontext which will always fail
  3508. #endif
  3509. int main(void) { makecontext(0, 0, 0); return 0; }
  3510. EOF
  3511. if compile_prog "" "" ; then
  3512. ucontext_works=yes
  3513. fi
  3514. fi
  3515. if test "$coroutine" = ""; then
  3516. if test "$mingw32" = "yes"; then
  3517. coroutine=win32
  3518. elif test "$ucontext_works" = "yes"; then
  3519. coroutine=ucontext
  3520. else
  3521. coroutine=sigaltstack
  3522. fi
  3523. else
  3524. case $coroutine in
  3525. windows)
  3526. if test "$mingw32" != "yes"; then
  3527. error_exit "'windows' coroutine backend only valid for Windows"
  3528. fi
  3529. # Unfortunately the user visible backend name doesn't match the
  3530. # coroutine-*.c filename for this case, so we have to adjust it here.
  3531. coroutine=win32
  3532. ;;
  3533. ucontext)
  3534. if test "$ucontext_works" != "yes"; then
  3535. feature_not_found "ucontext"
  3536. fi
  3537. ;;
  3538. gthread|sigaltstack)
  3539. if test "$mingw32" = "yes"; then
  3540. error_exit "only the 'windows' coroutine backend is valid for Windows"
  3541. fi
  3542. ;;
  3543. *)
  3544. error_exit "unknown coroutine backend $coroutine"
  3545. ;;
  3546. esac
  3547. fi
  3548. if test "$coroutine_pool" = ""; then
  3549. if test "$coroutine" = "gthread"; then
  3550. coroutine_pool=no
  3551. else
  3552. coroutine_pool=yes
  3553. fi
  3554. fi
  3555. if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
  3556. error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
  3557. fi
  3558. ##########################################
  3559. # check if we have open_by_handle_at
  3560. open_by_handle_at=no
  3561. cat > $TMPC << EOF
  3562. #include <fcntl.h>
  3563. #if !defined(AT_EMPTY_PATH)
  3564. # error missing definition
  3565. #else
  3566. int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
  3567. #endif
  3568. EOF
  3569. if compile_prog "" "" ; then
  3570. open_by_handle_at=yes
  3571. fi
  3572. ########################################
  3573. # check if we have linux/magic.h
  3574. linux_magic_h=no
  3575. cat > $TMPC << EOF
  3576. #include <linux/magic.h>
  3577. int main(void) {
  3578. return 0;
  3579. }
  3580. EOF
  3581. if compile_prog "" "" ; then
  3582. linux_magic_h=yes
  3583. fi
  3584. ########################################
  3585. # check whether we can disable warning option with a pragma (this is needed
  3586. # to silence warnings in the headers of some versions of external libraries).
  3587. # This test has to be compiled with -Werror as otherwise an unknown pragma is
  3588. # only a warning.
  3589. #
  3590. # If we can't selectively disable warning in the code, disable -Werror so that
  3591. # the build doesn't fail anyway.
  3592. pragma_disable_unused_but_set=no
  3593. cat > $TMPC << EOF
  3594. #pragma GCC diagnostic push
  3595. #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
  3596. #pragma GCC diagnostic ignored "-Wstrict-prototypes"
  3597. #pragma GCC diagnostic pop
  3598. int main(void) {
  3599. return 0;
  3600. }
  3601. EOF
  3602. if compile_prog "-Werror" "" ; then
  3603. pragma_diagnostic_available=yes
  3604. else
  3605. werror=no
  3606. fi
  3607. ########################################
  3608. # check if we have valgrind/valgrind.h and valgrind/memcheck.h
  3609. valgrind_h=no
  3610. cat > $TMPC << EOF
  3611. #include <valgrind/valgrind.h>
  3612. #include <valgrind/memcheck.h>
  3613. int main(void) {
  3614. return 0;
  3615. }
  3616. EOF
  3617. if compile_prog "" "" ; then
  3618. valgrind_h=yes
  3619. fi
  3620. ########################################
  3621. # check if environ is declared
  3622. has_environ=no
  3623. cat > $TMPC << EOF
  3624. #include <unistd.h>
  3625. int main(void) {
  3626. environ = 0;
  3627. return 0;
  3628. }
  3629. EOF
  3630. if compile_prog "" "" ; then
  3631. has_environ=yes
  3632. fi
  3633. ########################################
  3634. # check if cpuid.h is usable.
  3635. cpuid_h=no
  3636. cat > $TMPC << EOF
  3637. #include <cpuid.h>
  3638. int main(void) {
  3639. unsigned a, b, c, d;
  3640. int max = __get_cpuid_max(0, 0);
  3641. if (max >= 1) {
  3642. __cpuid(1, a, b, c, d);
  3643. }
  3644. if (max >= 7) {
  3645. __cpuid_count(7, 0, a, b, c, d);
  3646. }
  3647. return 0;
  3648. }
  3649. EOF
  3650. if compile_prog "" "" ; then
  3651. cpuid_h=yes
  3652. fi
  3653. ########################################
  3654. # check if __[u]int128_t is usable.
  3655. int128=no
  3656. cat > $TMPC << EOF
  3657. #if defined(__clang_major__) && defined(__clang_minor__)
  3658. # if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
  3659. # error __int128_t does not work in CLANG before 3.2
  3660. # endif
  3661. #endif
  3662. __int128_t a;
  3663. __uint128_t b;
  3664. int main (void) {
  3665. a = a + b;
  3666. b = a * b;
  3667. a = a * a;
  3668. return 0;
  3669. }
  3670. EOF
  3671. if compile_prog "" "" ; then
  3672. int128=yes
  3673. fi
  3674. ########################################
  3675. # check if getauxval is available.
  3676. getauxval=no
  3677. cat > $TMPC << EOF
  3678. #include <sys/auxv.h>
  3679. int main(void) {
  3680. return getauxval(AT_HWCAP) == 0;
  3681. }
  3682. EOF
  3683. if compile_prog "" "" ; then
  3684. getauxval=yes
  3685. fi
  3686. ##########################################
  3687. # End of CC checks
  3688. # After here, no more $cc or $ld runs
  3689. if test "$gcov" = "yes" ; then
  3690. CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
  3691. LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
  3692. elif test "$debug" = "no" ; then
  3693. CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
  3694. fi
  3695. ##########################################
  3696. # Do we have libnfs
  3697. if test "$libnfs" != "no" ; then
  3698. if $pkg_config --atleast-version=1.9.3 libnfs; then
  3699. libnfs="yes"
  3700. libnfs_libs=$($pkg_config --libs libnfs)
  3701. LIBS="$LIBS $libnfs_libs"
  3702. else
  3703. if test "$libnfs" = "yes" ; then
  3704. feature_not_found "libnfs"
  3705. fi
  3706. libnfs="no"
  3707. fi
  3708. fi
  3709. # Disable zero malloc errors for official releases unless explicitly told to
  3710. # enable/disable
  3711. if test -z "$zero_malloc" ; then
  3712. if test "$z_version" = "50" ; then
  3713. zero_malloc="no"
  3714. else
  3715. zero_malloc="yes"
  3716. fi
  3717. fi
  3718. # Now we've finished running tests it's OK to add -Werror to the compiler flags
  3719. if test "$werror" = "yes"; then
  3720. QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
  3721. fi
  3722. if test "$solaris" = "no" ; then
  3723. if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
  3724. LDFLAGS="-Wl,--warn-common $LDFLAGS"
  3725. fi
  3726. fi
  3727. # test if pod2man has --utf8 option
  3728. if pod2man --help | grep -q utf8; then
  3729. POD2MAN="pod2man --utf8"
  3730. else
  3731. POD2MAN="pod2man"
  3732. fi
  3733. # Use ASLR, no-SEH and DEP if available
  3734. if test "$mingw32" = "yes" ; then
  3735. for flag in --dynamicbase --no-seh --nxcompat; do
  3736. if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
  3737. LDFLAGS="-Wl,$flag $LDFLAGS"
  3738. fi
  3739. done
  3740. fi
  3741. qemu_confdir=$sysconfdir$confsuffix
  3742. qemu_moddir=$libdir$confsuffix
  3743. qemu_datadir=$datadir$confsuffix
  3744. qemu_localedir="$datadir/locale"
  3745. tools=""
  3746. if test "$want_tools" = "yes" ; then
  3747. tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
  3748. if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
  3749. tools="qemu-nbd\$(EXESUF) $tools"
  3750. fi
  3751. fi
  3752. if test "$softmmu" = yes ; then
  3753. if test "$virtfs" != no ; then
  3754. if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
  3755. virtfs=yes
  3756. tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
  3757. else
  3758. if test "$virtfs" = yes; then
  3759. error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
  3760. fi
  3761. virtfs=no
  3762. fi
  3763. fi
  3764. fi
  3765. if [ "$guest_agent" != "no" ]; then
  3766. if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
  3767. tools="qemu-ga\$(EXESUF) $tools"
  3768. if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
  3769. tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
  3770. fi
  3771. guest_agent=yes
  3772. elif [ "$guest_agent" != yes ]; then
  3773. guest_agent=no
  3774. else
  3775. error_exit "Guest agent is not supported on this platform"
  3776. fi
  3777. fi
  3778. # Mac OS X ships with a broken assembler
  3779. roms=
  3780. if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
  3781. "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
  3782. "$softmmu" = yes ; then
  3783. roms="optionrom"
  3784. fi
  3785. if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
  3786. roms="$roms spapr-rtas"
  3787. fi
  3788. if test "$cpu" = "s390x" ; then
  3789. roms="$roms s390-ccw"
  3790. fi
  3791. # Probe for the need for relocating the user-only binary.
  3792. if test "$pie" = "no" ; then
  3793. textseg_addr=
  3794. case "$cpu" in
  3795. arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
  3796. # ??? Rationale for choosing this address
  3797. textseg_addr=0x60000000
  3798. ;;
  3799. mips)
  3800. # A 256M aligned address, high in the address space, with enough
  3801. # room for the code_gen_buffer above it before the stack.
  3802. textseg_addr=0x60000000
  3803. ;;
  3804. esac
  3805. if [ -n "$textseg_addr" ]; then
  3806. cat > $TMPC <<EOF
  3807. int main(void) { return 0; }
  3808. EOF
  3809. textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
  3810. if ! compile_prog "" "$textseg_ldflags"; then
  3811. # In case ld does not support -Ttext-segment, edit the default linker
  3812. # script via sed to set the .text start addr. This is needed on FreeBSD
  3813. # at least.
  3814. $ld --verbose | sed \
  3815. -e '1,/==================================================/d' \
  3816. -e '/==================================================/,$d' \
  3817. -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
  3818. -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
  3819. textseg_ldflags="-Wl,-T../config-host.ld"
  3820. fi
  3821. fi
  3822. fi
  3823. # add pixman flags after all config tests are done
  3824. QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
  3825. libs_softmmu="$libs_softmmu $pixman_libs"
  3826. echo "Install prefix $prefix"
  3827. echo "BIOS directory `eval echo $qemu_datadir`"
  3828. echo "binary directory `eval echo $bindir`"
  3829. echo "library directory `eval echo $libdir`"
  3830. echo "module directory `eval echo $qemu_moddir`"
  3831. echo "libexec directory `eval echo $libexecdir`"
  3832. echo "include directory `eval echo $includedir`"
  3833. echo "config directory `eval echo $sysconfdir`"
  3834. if test "$mingw32" = "no" ; then
  3835. echo "local state directory `eval echo $local_statedir`"
  3836. echo "Manual directory `eval echo $mandir`"
  3837. echo "ELF interp prefix $interp_prefix"
  3838. else
  3839. echo "local state directory queried at runtime"
  3840. echo "Windows SDK $win_sdk"
  3841. fi
  3842. echo "Source path $source_path"
  3843. echo "C compiler $cc"
  3844. echo "Host C compiler $host_cc"
  3845. echo "C++ compiler $cxx"
  3846. echo "Objective-C compiler $objcc"
  3847. echo "ARFLAGS $ARFLAGS"
  3848. echo "CFLAGS $CFLAGS"
  3849. echo "QEMU_CFLAGS $QEMU_CFLAGS"
  3850. echo "LDFLAGS $LDFLAGS"
  3851. echo "make $make"
  3852. echo "install $install"
  3853. echo "python $python"
  3854. if test "$slirp" = "yes" ; then
  3855. echo "smbd $smbd"
  3856. fi
  3857. echo "module support $modules"
  3858. echo "host CPU $cpu"
  3859. echo "host big endian $bigendian"
  3860. echo "target list $target_list"
  3861. echo "tcg debug enabled $debug_tcg"
  3862. echo "gprof enabled $gprof"
  3863. echo "sparse enabled $sparse"
  3864. echo "strip binaries $strip_opt"
  3865. echo "profiler $profiler"
  3866. echo "static build $static"
  3867. if test "$darwin" = "yes" ; then
  3868. echo "Cocoa support $cocoa"
  3869. fi
  3870. echo "pixman $pixman"
  3871. echo "SDL support $sdl"
  3872. echo "GTK support $gtk"
  3873. echo "VTE support $vte"
  3874. echo "curses support $curses"
  3875. echo "curl support $curl"
  3876. echo "mingw32 support $mingw32"
  3877. echo "Audio drivers $audio_drv_list"
  3878. echo "Block whitelist (rw) $block_drv_rw_whitelist"
  3879. echo "Block whitelist (ro) $block_drv_ro_whitelist"
  3880. echo "VirtFS support $virtfs"
  3881. echo "VNC support $vnc"
  3882. if test "$vnc" = "yes" ; then
  3883. echo "VNC TLS support $vnc_tls"
  3884. echo "VNC SASL support $vnc_sasl"
  3885. echo "VNC JPEG support $vnc_jpeg"
  3886. echo "VNC PNG support $vnc_png"
  3887. echo "VNC WS support $vnc_ws"
  3888. fi
  3889. if test -n "$sparc_cpu"; then
  3890. echo "Target Sparc Arch $sparc_cpu"
  3891. fi
  3892. echo "xen support $xen"
  3893. echo "brlapi support $brlapi"
  3894. echo "bluez support $bluez"
  3895. echo "Documentation $docs"
  3896. echo "GUEST_BASE $guest_base"
  3897. echo "PIE $pie"
  3898. echo "vde support $vde"
  3899. echo "netmap support $netmap"
  3900. echo "Linux AIO support $linux_aio"
  3901. echo "ATTR/XATTR support $attr"
  3902. echo "Install blobs $blobs"
  3903. echo "KVM support $kvm"
  3904. echo "RDMA support $rdma"
  3905. echo "TCG interpreter $tcg_interpreter"
  3906. echo "fdt support $fdt"
  3907. echo "preadv support $preadv"
  3908. echo "fdatasync $fdatasync"
  3909. echo "madvise $madvise"
  3910. echo "posix_madvise $posix_madvise"
  3911. echo "sigev_thread_id $sigev_thread_id"
  3912. echo "uuid support $uuid"
  3913. echo "libcap-ng support $cap_ng"
  3914. echo "vhost-net support $vhost_net"
  3915. echo "vhost-scsi support $vhost_scsi"
  3916. echo "Trace backends $trace_backends"
  3917. if test "$trace_backend" = "simple"; then
  3918. echo "Trace output file $trace_file-<pid>"
  3919. fi
  3920. if test "$spice" = "yes"; then
  3921. echo "spice support $spice ($spice_protocol_version/$spice_server_version)"
  3922. else
  3923. echo "spice support $spice"
  3924. fi
  3925. echo "rbd support $rbd"
  3926. echo "xfsctl support $xfs"
  3927. echo "nss used $smartcard_nss"
  3928. echo "libusb $libusb"
  3929. echo "usb net redir $usb_redir"
  3930. echo "GLX support $glx"
  3931. echo "libiscsi support $libiscsi"
  3932. echo "libnfs support $libnfs"
  3933. echo "build guest agent $guest_agent"
  3934. echo "QGA VSS support $guest_agent_with_vss"
  3935. echo "seccomp support $seccomp"
  3936. echo "coroutine backend $coroutine"
  3937. echo "coroutine pool $coroutine_pool"
  3938. echo "GlusterFS support $glusterfs"
  3939. echo "virtio-blk-data-plane $virtio_blk_data_plane"
  3940. echo "gcov $gcov_tool"
  3941. echo "gcov enabled $gcov"
  3942. echo "TPM support $tpm"
  3943. echo "libssh2 support $libssh2"
  3944. echo "TPM passthrough $tpm_passthrough"
  3945. echo "QOM debugging $qom_cast_debug"
  3946. echo "vhdx $vhdx"
  3947. echo "Quorum $quorum"
  3948. echo "lzo support $lzo"
  3949. echo "snappy support $snappy"
  3950. echo "NUMA host support $numa"
  3951. if test "$sdl_too_old" = "yes"; then
  3952. echo "-> Your SDL version is too old - please upgrade to have SDL support"
  3953. fi
  3954. config_host_mak="config-host.mak"
  3955. echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
  3956. echo "# Automatically generated by configure - do not modify" > $config_host_mak
  3957. echo >> $config_host_mak
  3958. echo all: >> $config_host_mak
  3959. echo "prefix=$prefix" >> $config_host_mak
  3960. echo "bindir=$bindir" >> $config_host_mak
  3961. echo "libdir=$libdir" >> $config_host_mak
  3962. echo "libexecdir=$libexecdir" >> $config_host_mak
  3963. echo "includedir=$includedir" >> $config_host_mak
  3964. echo "mandir=$mandir" >> $config_host_mak
  3965. echo "sysconfdir=$sysconfdir" >> $config_host_mak
  3966. echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
  3967. echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
  3968. echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
  3969. echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
  3970. if test "$mingw32" = "no" ; then
  3971. echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
  3972. fi
  3973. echo "qemu_helperdir=$libexecdir" >> $config_host_mak
  3974. echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
  3975. echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
  3976. echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
  3977. echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
  3978. echo "ARCH=$ARCH" >> $config_host_mak
  3979. if test "$debug_tcg" = "yes" ; then
  3980. echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
  3981. fi
  3982. if test "$strip_opt" = "yes" ; then
  3983. echo "STRIP=${strip}" >> $config_host_mak
  3984. fi
  3985. if test "$bigendian" = "yes" ; then
  3986. echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
  3987. fi
  3988. if test "$mingw32" = "yes" ; then
  3989. echo "CONFIG_WIN32=y" >> $config_host_mak
  3990. rc_version=`cat $source_path/VERSION`
  3991. version_major=${rc_version%%.*}
  3992. rc_version=${rc_version#*.}
  3993. version_minor=${rc_version%%.*}
  3994. rc_version=${rc_version#*.}
  3995. version_subminor=${rc_version%%.*}
  3996. version_micro=0
  3997. echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
  3998. echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
  3999. if test "$guest_agent_with_vss" = "yes" ; then
  4000. echo "CONFIG_QGA_VSS=y" >> $config_host_mak
  4001. echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
  4002. fi
  4003. else
  4004. echo "CONFIG_POSIX=y" >> $config_host_mak
  4005. fi
  4006. if test "$linux" = "yes" ; then
  4007. echo "CONFIG_LINUX=y" >> $config_host_mak
  4008. fi
  4009. if test "$darwin" = "yes" ; then
  4010. echo "CONFIG_DARWIN=y" >> $config_host_mak
  4011. fi
  4012. if test "$aix" = "yes" ; then
  4013. echo "CONFIG_AIX=y" >> $config_host_mak
  4014. fi
  4015. if test "$solaris" = "yes" ; then
  4016. echo "CONFIG_SOLARIS=y" >> $config_host_mak
  4017. echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
  4018. if test "$needs_libsunmath" = "yes" ; then
  4019. echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
  4020. fi
  4021. fi
  4022. if test "$haiku" = "yes" ; then
  4023. echo "CONFIG_HAIKU=y" >> $config_host_mak
  4024. fi
  4025. if test "$static" = "yes" ; then
  4026. echo "CONFIG_STATIC=y" >> $config_host_mak
  4027. fi
  4028. if test "$profiler" = "yes" ; then
  4029. echo "CONFIG_PROFILER=y" >> $config_host_mak
  4030. fi
  4031. if test "$slirp" = "yes" ; then
  4032. echo "CONFIG_SLIRP=y" >> $config_host_mak
  4033. echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
  4034. fi
  4035. if test "$vde" = "yes" ; then
  4036. echo "CONFIG_VDE=y" >> $config_host_mak
  4037. fi
  4038. if test "$netmap" = "yes" ; then
  4039. echo "CONFIG_NETMAP=y" >> $config_host_mak
  4040. fi
  4041. if test "$l2tpv3" = "yes" ; then
  4042. echo "CONFIG_L2TPV3=y" >> $config_host_mak
  4043. fi
  4044. if test "$cap_ng" = "yes" ; then
  4045. echo "CONFIG_LIBCAP=y" >> $config_host_mak
  4046. fi
  4047. echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
  4048. for drv in $audio_drv_list; do
  4049. def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
  4050. echo "$def=y" >> $config_host_mak
  4051. if test "$drv" = "fmod"; then
  4052. echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
  4053. fi
  4054. done
  4055. if test "$audio_pt_int" = "yes" ; then
  4056. echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
  4057. fi
  4058. if test "$audio_win_int" = "yes" ; then
  4059. echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
  4060. fi
  4061. echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
  4062. echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
  4063. if test "$vnc" = "yes" ; then
  4064. echo "CONFIG_VNC=y" >> $config_host_mak
  4065. fi
  4066. if test "$vnc_tls" = "yes" ; then
  4067. echo "CONFIG_VNC_TLS=y" >> $config_host_mak
  4068. fi
  4069. if test "$vnc_sasl" = "yes" ; then
  4070. echo "CONFIG_VNC_SASL=y" >> $config_host_mak
  4071. fi
  4072. if test "$vnc_jpeg" = "yes" ; then
  4073. echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
  4074. fi
  4075. if test "$vnc_png" = "yes" ; then
  4076. echo "CONFIG_VNC_PNG=y" >> $config_host_mak
  4077. fi
  4078. if test "$vnc_ws" = "yes" ; then
  4079. echo "CONFIG_VNC_WS=y" >> $config_host_mak
  4080. echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
  4081. fi
  4082. if test "$fnmatch" = "yes" ; then
  4083. echo "CONFIG_FNMATCH=y" >> $config_host_mak
  4084. fi
  4085. if test "$uuid" = "yes" ; then
  4086. echo "CONFIG_UUID=y" >> $config_host_mak
  4087. fi
  4088. if test "$xfs" = "yes" ; then
  4089. echo "CONFIG_XFS=y" >> $config_host_mak
  4090. fi
  4091. qemu_version=`head $source_path/VERSION`
  4092. echo "VERSION=$qemu_version" >>$config_host_mak
  4093. echo "PKGVERSION=$pkgversion" >>$config_host_mak
  4094. echo "SRC_PATH=$source_path" >> $config_host_mak
  4095. echo "TARGET_DIRS=$target_list" >> $config_host_mak
  4096. if [ "$docs" = "yes" ] ; then
  4097. echo "BUILD_DOCS=yes" >> $config_host_mak
  4098. fi
  4099. if test "$modules" = "yes"; then
  4100. # $shacmd can generate a hash started with digit, which the compiler doesn't
  4101. # like as an symbol. So prefix it with an underscore
  4102. echo "CONFIG_STAMP=_`(echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ `" >> $config_host_mak
  4103. echo "CONFIG_MODULES=y" >> $config_host_mak
  4104. fi
  4105. if test "$sdl" = "yes" ; then
  4106. echo "CONFIG_SDL=y" >> $config_host_mak
  4107. echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
  4108. echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
  4109. fi
  4110. if test "$cocoa" = "yes" ; then
  4111. echo "CONFIG_COCOA=y" >> $config_host_mak
  4112. fi
  4113. if test "$curses" = "yes" ; then
  4114. echo "CONFIG_CURSES=y" >> $config_host_mak
  4115. fi
  4116. if test "$utimens" = "yes" ; then
  4117. echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
  4118. fi
  4119. if test "$pipe2" = "yes" ; then
  4120. echo "CONFIG_PIPE2=y" >> $config_host_mak
  4121. fi
  4122. if test "$accept4" = "yes" ; then
  4123. echo "CONFIG_ACCEPT4=y" >> $config_host_mak
  4124. fi
  4125. if test "$splice" = "yes" ; then
  4126. echo "CONFIG_SPLICE=y" >> $config_host_mak
  4127. fi
  4128. if test "$eventfd" = "yes" ; then
  4129. echo "CONFIG_EVENTFD=y" >> $config_host_mak
  4130. fi
  4131. if test "$fallocate" = "yes" ; then
  4132. echo "CONFIG_FALLOCATE=y" >> $config_host_mak
  4133. fi
  4134. if test "$fallocate_punch_hole" = "yes" ; then
  4135. echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
  4136. fi
  4137. if test "$sync_file_range" = "yes" ; then
  4138. echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
  4139. fi
  4140. if test "$fiemap" = "yes" ; then
  4141. echo "CONFIG_FIEMAP=y" >> $config_host_mak
  4142. fi
  4143. if test "$dup3" = "yes" ; then
  4144. echo "CONFIG_DUP3=y" >> $config_host_mak
  4145. fi
  4146. if test "$ppoll" = "yes" ; then
  4147. echo "CONFIG_PPOLL=y" >> $config_host_mak
  4148. fi
  4149. if test "$prctl_pr_set_timerslack" = "yes" ; then
  4150. echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
  4151. fi
  4152. if test "$epoll" = "yes" ; then
  4153. echo "CONFIG_EPOLL=y" >> $config_host_mak
  4154. fi
  4155. if test "$epoll_create1" = "yes" ; then
  4156. echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
  4157. fi
  4158. if test "$epoll_pwait" = "yes" ; then
  4159. echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
  4160. fi
  4161. if test "$sendfile" = "yes" ; then
  4162. echo "CONFIG_SENDFILE=y" >> $config_host_mak
  4163. fi
  4164. if test "$inotify" = "yes" ; then
  4165. echo "CONFIG_INOTIFY=y" >> $config_host_mak
  4166. fi
  4167. if test "$inotify1" = "yes" ; then
  4168. echo "CONFIG_INOTIFY1=y" >> $config_host_mak
  4169. fi
  4170. if test "$byteswap_h" = "yes" ; then
  4171. echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
  4172. fi
  4173. if test "$bswap_h" = "yes" ; then
  4174. echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
  4175. fi
  4176. if test "$curl" = "yes" ; then
  4177. echo "CONFIG_CURL=m" >> $config_host_mak
  4178. echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
  4179. echo "CURL_LIBS=$curl_libs" >> $config_host_mak
  4180. fi
  4181. if test "$brlapi" = "yes" ; then
  4182. echo "CONFIG_BRLAPI=y" >> $config_host_mak
  4183. fi
  4184. if test "$bluez" = "yes" ; then
  4185. echo "CONFIG_BLUEZ=y" >> $config_host_mak
  4186. echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
  4187. fi
  4188. echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
  4189. if test "$gtk" = "yes" ; then
  4190. echo "CONFIG_GTK=y" >> $config_host_mak
  4191. echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
  4192. echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
  4193. fi
  4194. if test "$vte" = "yes" ; then
  4195. echo "CONFIG_VTE=y" >> $config_host_mak
  4196. echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
  4197. fi
  4198. if test "$xen" = "yes" ; then
  4199. echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
  4200. echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
  4201. fi
  4202. if test "$linux_aio" = "yes" ; then
  4203. echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
  4204. fi
  4205. if test "$attr" = "yes" ; then
  4206. echo "CONFIG_ATTR=y" >> $config_host_mak
  4207. fi
  4208. if test "$libattr" = "yes" ; then
  4209. echo "CONFIG_LIBATTR=y" >> $config_host_mak
  4210. fi
  4211. if test "$virtfs" = "yes" ; then
  4212. echo "CONFIG_VIRTFS=y" >> $config_host_mak
  4213. fi
  4214. if test "$vhost_scsi" = "yes" ; then
  4215. echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
  4216. fi
  4217. if test "$vhost_net" = "yes" ; then
  4218. echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
  4219. fi
  4220. if test "$blobs" = "yes" ; then
  4221. echo "INSTALL_BLOBS=yes" >> $config_host_mak
  4222. fi
  4223. if test "$iovec" = "yes" ; then
  4224. echo "CONFIG_IOVEC=y" >> $config_host_mak
  4225. fi
  4226. if test "$preadv" = "yes" ; then
  4227. echo "CONFIG_PREADV=y" >> $config_host_mak
  4228. fi
  4229. if test "$fdt" = "yes" ; then
  4230. echo "CONFIG_FDT=y" >> $config_host_mak
  4231. fi
  4232. if test "$signalfd" = "yes" ; then
  4233. echo "CONFIG_SIGNALFD=y" >> $config_host_mak
  4234. fi
  4235. if test "$tcg_interpreter" = "yes" ; then
  4236. echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
  4237. fi
  4238. if test "$fdatasync" = "yes" ; then
  4239. echo "CONFIG_FDATASYNC=y" >> $config_host_mak
  4240. fi
  4241. if test "$madvise" = "yes" ; then
  4242. echo "CONFIG_MADVISE=y" >> $config_host_mak
  4243. fi
  4244. if test "$posix_madvise" = "yes" ; then
  4245. echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
  4246. fi
  4247. if test "$sigev_thread_id" = "yes" ; then
  4248. echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
  4249. fi
  4250. if test "$spice" = "yes" ; then
  4251. echo "CONFIG_SPICE=y" >> $config_host_mak
  4252. fi
  4253. if test "$smartcard_nss" = "yes" ; then
  4254. echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
  4255. echo "NSS_LIBS=$nss_libs" >> $config_host_mak
  4256. echo "NSS_CFLAGS=$nss_cflags" >> $config_host_mak
  4257. fi
  4258. if test "$libusb" = "yes" ; then
  4259. echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
  4260. fi
  4261. if test "$usb_redir" = "yes" ; then
  4262. echo "CONFIG_USB_REDIR=y" >> $config_host_mak
  4263. fi
  4264. if test "$glx" = "yes" ; then
  4265. echo "CONFIG_GLX=y" >> $config_host_mak
  4266. echo "GLX_LIBS=$glx_libs" >> $config_host_mak
  4267. fi
  4268. if test "$lzo" = "yes" ; then
  4269. echo "CONFIG_LZO=y" >> $config_host_mak
  4270. fi
  4271. if test "$snappy" = "yes" ; then
  4272. echo "CONFIG_SNAPPY=y" >> $config_host_mak
  4273. fi
  4274. if test "$libiscsi" = "yes" ; then
  4275. echo "CONFIG_LIBISCSI=m" >> $config_host_mak
  4276. echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
  4277. echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
  4278. fi
  4279. if test "$libnfs" = "yes" ; then
  4280. echo "CONFIG_LIBNFS=y" >> $config_host_mak
  4281. fi
  4282. if test "$seccomp" = "yes"; then
  4283. echo "CONFIG_SECCOMP=y" >> $config_host_mak
  4284. fi
  4285. # XXX: suppress that
  4286. if [ "$bsd" = "yes" ] ; then
  4287. echo "CONFIG_BSD=y" >> $config_host_mak
  4288. fi
  4289. if test "$zero_malloc" = "yes" ; then
  4290. echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
  4291. fi
  4292. if test "$qom_cast_debug" = "yes" ; then
  4293. echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
  4294. fi
  4295. if test "$rbd" = "yes" ; then
  4296. echo "CONFIG_RBD=m" >> $config_host_mak
  4297. echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
  4298. echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
  4299. fi
  4300. echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
  4301. if test "$coroutine_pool" = "yes" ; then
  4302. echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
  4303. else
  4304. echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
  4305. fi
  4306. if test "$open_by_handle_at" = "yes" ; then
  4307. echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
  4308. fi
  4309. if test "$linux_magic_h" = "yes" ; then
  4310. echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
  4311. fi
  4312. if test "$pragma_diagnostic_available" = "yes" ; then
  4313. echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
  4314. fi
  4315. if test "$valgrind_h" = "yes" ; then
  4316. echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
  4317. fi
  4318. if test "$has_environ" = "yes" ; then
  4319. echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
  4320. fi
  4321. if test "$cpuid_h" = "yes" ; then
  4322. echo "CONFIG_CPUID_H=y" >> $config_host_mak
  4323. fi
  4324. if test "$int128" = "yes" ; then
  4325. echo "CONFIG_INT128=y" >> $config_host_mak
  4326. fi
  4327. if test "$getauxval" = "yes" ; then
  4328. echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
  4329. fi
  4330. if test "$glusterfs" = "yes" ; then
  4331. echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
  4332. echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
  4333. echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
  4334. fi
  4335. if test "$glusterfs_discard" = "yes" ; then
  4336. echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
  4337. fi
  4338. if test "$glusterfs_zerofill" = "yes" ; then
  4339. echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
  4340. fi
  4341. if test "$libssh2" = "yes" ; then
  4342. echo "CONFIG_LIBSSH2=m" >> $config_host_mak
  4343. echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
  4344. echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
  4345. fi
  4346. if test "$quorum" = "yes" ; then
  4347. echo "CONFIG_QUORUM=y" >> $config_host_mak
  4348. fi
  4349. if test "$virtio_blk_data_plane" = "yes" ; then
  4350. echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
  4351. fi
  4352. if test "$vhdx" = "yes" ; then
  4353. echo "CONFIG_VHDX=y" >> $config_host_mak
  4354. fi
  4355. # USB host support
  4356. if test "$libusb" = "yes"; then
  4357. echo "HOST_USB=libusb legacy" >> $config_host_mak
  4358. else
  4359. echo "HOST_USB=stub" >> $config_host_mak
  4360. fi
  4361. # TPM passthrough support?
  4362. if test "$tpm" = "yes"; then
  4363. echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
  4364. if test "$tpm_passthrough" = "yes"; then
  4365. echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
  4366. fi
  4367. fi
  4368. echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
  4369. if have_backend "nop"; then
  4370. echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
  4371. fi
  4372. if have_backend "simple"; then
  4373. echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
  4374. # Set the appropriate trace file.
  4375. trace_file="\"$trace_file-\" FMT_pid"
  4376. fi
  4377. if have_backend "stderr"; then
  4378. echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
  4379. fi
  4380. if have_backend "ust"; then
  4381. echo "CONFIG_TRACE_UST=y" >> $config_host_mak
  4382. fi
  4383. if have_backend "dtrace"; then
  4384. echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
  4385. if test "$trace_backend_stap" = "yes" ; then
  4386. echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
  4387. fi
  4388. fi
  4389. if have_backend "ftrace"; then
  4390. if test "$linux" = "yes" ; then
  4391. echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
  4392. else
  4393. feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
  4394. fi
  4395. fi
  4396. echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
  4397. if test "$rdma" = "yes" ; then
  4398. echo "CONFIG_RDMA=y" >> $config_host_mak
  4399. fi
  4400. # Hold two types of flag:
  4401. # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
  4402. # a thread we have a handle to
  4403. # CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
  4404. # platform
  4405. if test "$pthread_setname_np" = "yes" ; then
  4406. echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
  4407. echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
  4408. fi
  4409. if test "$tcg_interpreter" = "yes"; then
  4410. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
  4411. elif test "$ARCH" = "sparc64" ; then
  4412. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
  4413. elif test "$ARCH" = "s390x" ; then
  4414. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
  4415. elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
  4416. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
  4417. elif test "$ARCH" = "ppc64" ; then
  4418. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
  4419. else
  4420. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
  4421. fi
  4422. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
  4423. echo "TOOLS=$tools" >> $config_host_mak
  4424. echo "ROMS=$roms" >> $config_host_mak
  4425. echo "MAKE=$make" >> $config_host_mak
  4426. echo "INSTALL=$install" >> $config_host_mak
  4427. echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
  4428. echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
  4429. if test -n "$libtool"; then
  4430. echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
  4431. echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
  4432. else
  4433. echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
  4434. echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
  4435. fi
  4436. echo "PYTHON=$python" >> $config_host_mak
  4437. echo "CC=$cc" >> $config_host_mak
  4438. if $iasl -h > /dev/null 2>&1; then
  4439. echo "IASL=$iasl" >> $config_host_mak
  4440. fi
  4441. echo "CC_I386=$cc_i386" >> $config_host_mak
  4442. echo "HOST_CC=$host_cc" >> $config_host_mak
  4443. echo "CXX=$cxx" >> $config_host_mak
  4444. echo "OBJCC=$objcc" >> $config_host_mak
  4445. echo "AR=$ar" >> $config_host_mak
  4446. echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
  4447. echo "AS=$as" >> $config_host_mak
  4448. echo "CPP=$cpp" >> $config_host_mak
  4449. echo "OBJCOPY=$objcopy" >> $config_host_mak
  4450. echo "LD=$ld" >> $config_host_mak
  4451. echo "WINDRES=$windres" >> $config_host_mak
  4452. echo "LIBTOOL=$libtool" >> $config_host_mak
  4453. echo "CFLAGS=$CFLAGS" >> $config_host_mak
  4454. echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
  4455. echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
  4456. echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
  4457. if test "$sparse" = "yes" ; then
  4458. echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
  4459. echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
  4460. echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
  4461. fi
  4462. if test "$cross_prefix" != ""; then
  4463. echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
  4464. else
  4465. echo "AUTOCONF_HOST := " >> $config_host_mak
  4466. fi
  4467. echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
  4468. echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
  4469. echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
  4470. echo "LIBS+=$LIBS" >> $config_host_mak
  4471. echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
  4472. echo "EXESUF=$EXESUF" >> $config_host_mak
  4473. echo "DSOSUF=$DSOSUF" >> $config_host_mak
  4474. echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
  4475. echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
  4476. echo "POD2MAN=$POD2MAN" >> $config_host_mak
  4477. echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
  4478. if test "$gcov" = "yes" ; then
  4479. echo "CONFIG_GCOV=y" >> $config_host_mak
  4480. echo "GCOV=$gcov_tool" >> $config_host_mak
  4481. fi
  4482. # use included Linux headers
  4483. if test "$linux" = "yes" ; then
  4484. mkdir -p linux-headers
  4485. case "$cpu" in
  4486. i386|x86_64|x32)
  4487. linux_arch=x86
  4488. ;;
  4489. ppcemb|ppc|ppc64)
  4490. linux_arch=powerpc
  4491. ;;
  4492. s390x)
  4493. linux_arch=s390
  4494. ;;
  4495. aarch64)
  4496. linux_arch=arm64
  4497. ;;
  4498. mips64)
  4499. linux_arch=mips
  4500. ;;
  4501. *)
  4502. # For most CPUs the kernel architecture name and QEMU CPU name match.
  4503. linux_arch="$cpu"
  4504. ;;
  4505. esac
  4506. # For non-KVM architectures we will not have asm headers
  4507. if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
  4508. symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
  4509. fi
  4510. fi
  4511. for target in $target_list; do
  4512. target_dir="$target"
  4513. config_target_mak=$target_dir/config-target.mak
  4514. target_name=`echo $target | cut -d '-' -f 1`
  4515. target_bigendian="no"
  4516. case "$target_name" in
  4517. armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
  4518. target_bigendian=yes
  4519. ;;
  4520. esac
  4521. target_softmmu="no"
  4522. target_user_only="no"
  4523. target_linux_user="no"
  4524. target_bsd_user="no"
  4525. case "$target" in
  4526. ${target_name}-softmmu)
  4527. target_softmmu="yes"
  4528. ;;
  4529. ${target_name}-linux-user)
  4530. if test "$linux" != "yes" ; then
  4531. error_exit "Target '$target' is only available on a Linux host"
  4532. fi
  4533. target_user_only="yes"
  4534. target_linux_user="yes"
  4535. ;;
  4536. ${target_name}-bsd-user)
  4537. if test "$bsd" != "yes" ; then
  4538. error_exit "Target '$target' is only available on a BSD host"
  4539. fi
  4540. target_user_only="yes"
  4541. target_bsd_user="yes"
  4542. ;;
  4543. *)
  4544. error_exit "Target '$target' not recognised"
  4545. exit 1
  4546. ;;
  4547. esac
  4548. mkdir -p $target_dir
  4549. echo "# Automatically generated by configure - do not modify" > $config_target_mak
  4550. bflt="no"
  4551. interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
  4552. gdb_xml_files=""
  4553. TARGET_ARCH="$target_name"
  4554. TARGET_BASE_ARCH=""
  4555. TARGET_ABI_DIR=""
  4556. case "$target_name" in
  4557. i386)
  4558. ;;
  4559. x86_64)
  4560. TARGET_BASE_ARCH=i386
  4561. ;;
  4562. alpha)
  4563. ;;
  4564. arm|armeb)
  4565. TARGET_ARCH=arm
  4566. bflt="yes"
  4567. gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
  4568. ;;
  4569. aarch64)
  4570. TARGET_BASE_ARCH=arm
  4571. bflt="yes"
  4572. gdb_xml_files="aarch64-core.xml aarch64-fpu.xml"
  4573. ;;
  4574. cris)
  4575. ;;
  4576. lm32)
  4577. ;;
  4578. m68k)
  4579. bflt="yes"
  4580. gdb_xml_files="cf-core.xml cf-fp.xml"
  4581. ;;
  4582. microblaze|microblazeel)
  4583. TARGET_ARCH=microblaze
  4584. bflt="yes"
  4585. ;;
  4586. mips|mipsel)
  4587. TARGET_ARCH=mips
  4588. echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
  4589. ;;
  4590. mipsn32|mipsn32el)
  4591. TARGET_ARCH=mips64
  4592. TARGET_BASE_ARCH=mips
  4593. echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
  4594. echo "TARGET_ABI32=y" >> $config_target_mak
  4595. ;;
  4596. mips64|mips64el)
  4597. TARGET_ARCH=mips64
  4598. TARGET_BASE_ARCH=mips
  4599. echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
  4600. ;;
  4601. moxie)
  4602. ;;
  4603. or32)
  4604. TARGET_ARCH=openrisc
  4605. TARGET_BASE_ARCH=openrisc
  4606. ;;
  4607. ppc)
  4608. gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  4609. ;;
  4610. ppcemb)
  4611. TARGET_BASE_ARCH=ppc
  4612. TARGET_ABI_DIR=ppc
  4613. gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  4614. ;;
  4615. ppc64)
  4616. TARGET_BASE_ARCH=ppc
  4617. TARGET_ABI_DIR=ppc
  4618. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  4619. ;;
  4620. ppc64le)
  4621. TARGET_ARCH=ppc64
  4622. TARGET_BASE_ARCH=ppc
  4623. TARGET_ABI_DIR=ppc
  4624. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  4625. ;;
  4626. ppc64abi32)
  4627. TARGET_ARCH=ppc64
  4628. TARGET_BASE_ARCH=ppc
  4629. TARGET_ABI_DIR=ppc
  4630. echo "TARGET_ABI32=y" >> $config_target_mak
  4631. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  4632. ;;
  4633. sh4|sh4eb)
  4634. TARGET_ARCH=sh4
  4635. bflt="yes"
  4636. ;;
  4637. sparc)
  4638. ;;
  4639. sparc64)
  4640. TARGET_BASE_ARCH=sparc
  4641. ;;
  4642. sparc32plus)
  4643. TARGET_ARCH=sparc64
  4644. TARGET_BASE_ARCH=sparc
  4645. TARGET_ABI_DIR=sparc
  4646. echo "TARGET_ABI32=y" >> $config_target_mak
  4647. ;;
  4648. s390x)
  4649. ;;
  4650. unicore32)
  4651. ;;
  4652. xtensa|xtensaeb)
  4653. TARGET_ARCH=xtensa
  4654. ;;
  4655. *)
  4656. error_exit "Unsupported target CPU"
  4657. ;;
  4658. esac
  4659. # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
  4660. if [ "$TARGET_BASE_ARCH" = "" ]; then
  4661. TARGET_BASE_ARCH=$TARGET_ARCH
  4662. fi
  4663. symlink "$source_path/Makefile.target" "$target_dir/Makefile"
  4664. upper() {
  4665. echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
  4666. }
  4667. target_arch_name="`upper $TARGET_ARCH`"
  4668. echo "TARGET_$target_arch_name=y" >> $config_target_mak
  4669. echo "TARGET_NAME=$target_name" >> $config_target_mak
  4670. echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
  4671. if [ "$TARGET_ABI_DIR" = "" ]; then
  4672. TARGET_ABI_DIR=$TARGET_ARCH
  4673. fi
  4674. echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
  4675. if [ "$HOST_VARIANT_DIR" != "" ]; then
  4676. echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
  4677. fi
  4678. case "$target_name" in
  4679. i386|x86_64)
  4680. if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
  4681. echo "CONFIG_XEN=y" >> $config_target_mak
  4682. if test "$xen_pci_passthrough" = yes; then
  4683. echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
  4684. fi
  4685. fi
  4686. ;;
  4687. *)
  4688. esac
  4689. case "$target_name" in
  4690. aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x|mipsel|mips)
  4691. # Make sure the target and host cpus are compatible
  4692. if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
  4693. \( "$target_name" = "$cpu" -o \
  4694. \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
  4695. \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \
  4696. \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \
  4697. \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
  4698. \( "$target_name" = "mipsel" -a "$cpu" = "mips" \) -o \
  4699. \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \
  4700. \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) \) ; then
  4701. echo "CONFIG_KVM=y" >> $config_target_mak
  4702. if test "$vhost_net" = "yes" ; then
  4703. echo "CONFIG_VHOST_NET=y" >> $config_target_mak
  4704. fi
  4705. fi
  4706. esac
  4707. if test "$target_bigendian" = "yes" ; then
  4708. echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
  4709. fi
  4710. if test "$target_softmmu" = "yes" ; then
  4711. echo "CONFIG_SOFTMMU=y" >> $config_target_mak
  4712. fi
  4713. if test "$target_user_only" = "yes" ; then
  4714. echo "CONFIG_USER_ONLY=y" >> $config_target_mak
  4715. echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
  4716. fi
  4717. if test "$target_linux_user" = "yes" ; then
  4718. echo "CONFIG_LINUX_USER=y" >> $config_target_mak
  4719. fi
  4720. list=""
  4721. if test ! -z "$gdb_xml_files" ; then
  4722. for x in $gdb_xml_files; do
  4723. list="$list $source_path/gdb-xml/$x"
  4724. done
  4725. echo "TARGET_XML_FILES=$list" >> $config_target_mak
  4726. fi
  4727. if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
  4728. echo "TARGET_HAS_BFLT=y" >> $config_target_mak
  4729. fi
  4730. if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
  4731. echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
  4732. fi
  4733. if test "$target_bsd_user" = "yes" ; then
  4734. echo "CONFIG_BSD_USER=y" >> $config_target_mak
  4735. fi
  4736. # generate QEMU_CFLAGS/LDFLAGS for targets
  4737. cflags=""
  4738. ldflags=""
  4739. for i in $ARCH $TARGET_BASE_ARCH ; do
  4740. case "$i" in
  4741. alpha)
  4742. echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
  4743. echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak
  4744. ;;
  4745. aarch64)
  4746. if test -n "${cxx}"; then
  4747. echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
  4748. echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
  4749. fi
  4750. ;;
  4751. arm)
  4752. echo "CONFIG_ARM_DIS=y" >> $config_target_mak
  4753. echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak
  4754. if test -n "${cxx}"; then
  4755. echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
  4756. echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
  4757. fi
  4758. ;;
  4759. cris)
  4760. echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
  4761. echo "CONFIG_CRIS_DIS=y" >> config-all-disas.mak
  4762. ;;
  4763. hppa)
  4764. echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
  4765. echo "CONFIG_HPPA_DIS=y" >> config-all-disas.mak
  4766. ;;
  4767. i386|x86_64|x32)
  4768. echo "CONFIG_I386_DIS=y" >> $config_target_mak
  4769. echo "CONFIG_I386_DIS=y" >> config-all-disas.mak
  4770. ;;
  4771. ia64*)
  4772. echo "CONFIG_IA64_DIS=y" >> $config_target_mak
  4773. echo "CONFIG_IA64_DIS=y" >> config-all-disas.mak
  4774. ;;
  4775. lm32)
  4776. echo "CONFIG_LM32_DIS=y" >> $config_target_mak
  4777. echo "CONFIG_LM32_DIS=y" >> config-all-disas.mak
  4778. ;;
  4779. m68k)
  4780. echo "CONFIG_M68K_DIS=y" >> $config_target_mak
  4781. echo "CONFIG_M68K_DIS=y" >> config-all-disas.mak
  4782. ;;
  4783. microblaze*)
  4784. echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
  4785. echo "CONFIG_MICROBLAZE_DIS=y" >> config-all-disas.mak
  4786. ;;
  4787. mips*)
  4788. echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
  4789. echo "CONFIG_MIPS_DIS=y" >> config-all-disas.mak
  4790. ;;
  4791. moxie*)
  4792. echo "CONFIG_MOXIE_DIS=y" >> $config_target_mak
  4793. echo "CONFIG_MOXIE_DIS=y" >> config-all-disas.mak
  4794. ;;
  4795. or32)
  4796. echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak
  4797. echo "CONFIG_OPENRISC_DIS=y" >> config-all-disas.mak
  4798. ;;
  4799. ppc*)
  4800. echo "CONFIG_PPC_DIS=y" >> $config_target_mak
  4801. echo "CONFIG_PPC_DIS=y" >> config-all-disas.mak
  4802. ;;
  4803. s390*)
  4804. echo "CONFIG_S390_DIS=y" >> $config_target_mak
  4805. echo "CONFIG_S390_DIS=y" >> config-all-disas.mak
  4806. ;;
  4807. sh4)
  4808. echo "CONFIG_SH4_DIS=y" >> $config_target_mak
  4809. echo "CONFIG_SH4_DIS=y" >> config-all-disas.mak
  4810. ;;
  4811. sparc*)
  4812. echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
  4813. echo "CONFIG_SPARC_DIS=y" >> config-all-disas.mak
  4814. ;;
  4815. xtensa*)
  4816. echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
  4817. echo "CONFIG_XTENSA_DIS=y" >> config-all-disas.mak
  4818. ;;
  4819. esac
  4820. done
  4821. if test "$tcg_interpreter" = "yes" ; then
  4822. echo "CONFIG_TCI_DIS=y" >> $config_target_mak
  4823. echo "CONFIG_TCI_DIS=y" >> config-all-disas.mak
  4824. fi
  4825. case "$ARCH" in
  4826. alpha)
  4827. # Ensure there's only a single GP
  4828. cflags="-msmall-data $cflags"
  4829. ;;
  4830. esac
  4831. if test "$gprof" = "yes" ; then
  4832. echo "TARGET_GPROF=yes" >> $config_target_mak
  4833. if test "$target_linux_user" = "yes" ; then
  4834. cflags="-p $cflags"
  4835. ldflags="-p $ldflags"
  4836. fi
  4837. if test "$target_softmmu" = "yes" ; then
  4838. ldflags="-p $ldflags"
  4839. echo "GPROF_CFLAGS=-p" >> $config_target_mak
  4840. fi
  4841. fi
  4842. if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
  4843. ldflags="$ldflags $textseg_ldflags"
  4844. fi
  4845. echo "LDFLAGS+=$ldflags" >> $config_target_mak
  4846. echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
  4847. done # for target in $targets
  4848. if [ "$pixman" = "internal" ]; then
  4849. echo "config-host.h: subdir-pixman" >> $config_host_mak
  4850. fi
  4851. if test "$rdma" = "yes" ; then
  4852. echo "CONFIG_RDMA=y" >> $config_host_mak
  4853. fi
  4854. if [ "$dtc_internal" = "yes" ]; then
  4855. echo "config-host.h: subdir-dtc" >> $config_host_mak
  4856. fi
  4857. if test "$numa" = "yes"; then
  4858. echo "CONFIG_NUMA=y" >> $config_host_mak
  4859. fi
  4860. # build tree in object directory in case the source is not in the current directory
  4861. DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
  4862. DIRS="$DIRS fsdev"
  4863. DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
  4864. DIRS="$DIRS roms/seabios roms/vgabios"
  4865. DIRS="$DIRS qapi-generated"
  4866. FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
  4867. FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
  4868. FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
  4869. FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
  4870. FILES="$FILES pc-bios/spapr-rtas/Makefile"
  4871. FILES="$FILES pc-bios/s390-ccw/Makefile"
  4872. FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
  4873. FILES="$FILES pc-bios/qemu-icon.bmp"
  4874. for bios_file in \
  4875. $source_path/pc-bios/*.bin \
  4876. $source_path/pc-bios/*.aml \
  4877. $source_path/pc-bios/*.rom \
  4878. $source_path/pc-bios/*.dtb \
  4879. $source_path/pc-bios/*.img \
  4880. $source_path/pc-bios/openbios-* \
  4881. $source_path/pc-bios/u-boot.* \
  4882. $source_path/pc-bios/palcode-*
  4883. do
  4884. FILES="$FILES pc-bios/`basename $bios_file`"
  4885. done
  4886. for test_file in `find $source_path/tests/acpi-test-data -type f`
  4887. do
  4888. FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`"
  4889. done
  4890. mkdir -p $DIRS
  4891. for f in $FILES ; do
  4892. if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
  4893. symlink "$source_path/$f" "$f"
  4894. fi
  4895. done
  4896. # temporary config to build submodules
  4897. for rom in seabios vgabios ; do
  4898. config_mak=roms/$rom/config.mak
  4899. echo "# Automatically generated by configure - do not modify" > $config_mak
  4900. echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
  4901. echo "AS=$as" >> $config_mak
  4902. echo "CC=$cc" >> $config_mak
  4903. echo "BCC=bcc" >> $config_mak
  4904. echo "CPP=$cpp" >> $config_mak
  4905. echo "OBJCOPY=objcopy" >> $config_mak
  4906. echo "IASL=$iasl" >> $config_mak
  4907. echo "LD=$ld" >> $config_mak
  4908. done
  4909. if test "$docs" = "yes" ; then
  4910. mkdir -p QMP
  4911. fi
  4912. # set up qemu-iotests in this build directory
  4913. iotests_common_env="tests/qemu-iotests/common.env"
  4914. iotests_check="tests/qemu-iotests/check"
  4915. echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
  4916. echo >> "$iotests_common_env"
  4917. echo "export PYTHON='$python'" >> "$iotests_common_env"
  4918. if [ ! -e "$iotests_check" ]; then
  4919. symlink "$source_path/$iotests_check" "$iotests_check"
  4920. fi
  4921. # Save the configure command line for later reuse.
  4922. cat <<EOD >config.status
  4923. #!/bin/sh
  4924. # Generated by configure.
  4925. # Run this file to recreate the current configuration.
  4926. # Compiler output produced by configure, useful for debugging
  4927. # configure, is in config.log if it exists.
  4928. EOD
  4929. printf "exec" >>config.status
  4930. printf " '%s'" "$0" "$@" >>config.status
  4931. echo >>config.status
  4932. chmod +x config.status
  4933. rm -r "$TMPDIR1"