configure 137 KB

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