You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure 204KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917
  1. #!/bin/sh
  2. #
  3. # qemu configure script (c) 2003 Fabrice Bellard
  4. #
  5. # Unset some variables known to interfere with behavior of common tools,
  6. # just as autoconf does.
  7. CLICOLOR_FORCE= GREP_OPTIONS=
  8. unset CLICOLOR_FORCE GREP_OPTIONS
  9. # Don't allow CCACHE, if present, to use cached results of compile tests!
  10. export CCACHE_RECACHE=yes
  11. # Temporary directory used for files created while
  12. # configure runs. Since it is in the build directory
  13. # we can safely blow away any previous version of it
  14. # (and we need not jump through hoops to try to delete
  15. # it when configure exits.)
  16. TMPDIR1="config-temp"
  17. rm -rf "${TMPDIR1}"
  18. mkdir -p "${TMPDIR1}"
  19. if [ $? -ne 0 ]; then
  20. echo "ERROR: failed to create temporary directory"
  21. exit 1
  22. fi
  23. TMPB="qemu-conf"
  24. TMPC="${TMPDIR1}/${TMPB}.c"
  25. TMPO="${TMPDIR1}/${TMPB}.o"
  26. TMPCXX="${TMPDIR1}/${TMPB}.cxx"
  27. TMPE="${TMPDIR1}/${TMPB}.exe"
  28. TMPMO="${TMPDIR1}/${TMPB}.mo"
  29. rm -f config.log
  30. # Print a helpful header at the top of config.log
  31. echo "# QEMU configure log $(date)" >> config.log
  32. printf "# Configured with:" >> config.log
  33. printf " '%s'" "$0" "$@" >> config.log
  34. echo >> config.log
  35. echo "#" >> config.log
  36. print_error() {
  37. (echo
  38. echo "ERROR: $1"
  39. while test -n "$2"; do
  40. echo " $2"
  41. shift
  42. done
  43. echo) >&2
  44. }
  45. error_exit() {
  46. print_error "$@"
  47. exit 1
  48. }
  49. do_compiler() {
  50. # Run the compiler, capturing its output to the log. First argument
  51. # is compiler binary to execute.
  52. local compiler="$1"
  53. shift
  54. if test -n "$BASH_VERSION"; then eval '
  55. echo >>config.log "
  56. funcs: ${FUNCNAME[*]}
  57. lines: ${BASH_LINENO[*]}"
  58. '; fi
  59. echo $compiler "$@" >> config.log
  60. $compiler "$@" >> config.log 2>&1 || return $?
  61. # Test passed. If this is an --enable-werror build, rerun
  62. # the test with -Werror and bail out if it fails. This
  63. # makes warning-generating-errors in configure test code
  64. # obvious to developers.
  65. if test "$werror" != "yes"; then
  66. return 0
  67. fi
  68. # Don't bother rerunning the compile if we were already using -Werror
  69. case "$*" in
  70. *-Werror*)
  71. return 0
  72. ;;
  73. esac
  74. echo $compiler -Werror "$@" >> config.log
  75. $compiler -Werror "$@" >> config.log 2>&1 && return $?
  76. error_exit "configure test passed without -Werror but failed with -Werror." \
  77. "This is probably a bug in the configure script. The failing command" \
  78. "will be at the bottom of config.log." \
  79. "You can run configure with --disable-werror to bypass this check."
  80. }
  81. do_cc() {
  82. do_compiler "$cc" "$@"
  83. }
  84. do_cxx() {
  85. do_compiler "$cxx" "$@"
  86. }
  87. update_cxxflags() {
  88. # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
  89. # options which some versions of GCC's C++ compiler complain about
  90. # because they only make sense for C programs.
  91. QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS"
  92. for arg in $QEMU_CFLAGS; do
  93. case $arg in
  94. -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
  95. -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
  96. ;;
  97. -std=gnu99)
  98. QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }"-std=gnu++98"
  99. ;;
  100. *)
  101. QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
  102. ;;
  103. esac
  104. done
  105. }
  106. compile_object() {
  107. local_cflags="$1"
  108. do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
  109. }
  110. compile_prog() {
  111. local_cflags="$1"
  112. local_ldflags="$2"
  113. do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
  114. }
  115. # symbolically link $1 to $2. Portable version of "ln -sf".
  116. symlink() {
  117. rm -rf "$2"
  118. mkdir -p "$(dirname "$2")"
  119. ln -s "$1" "$2"
  120. }
  121. # check whether a command is available to this shell (may be either an
  122. # executable or a builtin)
  123. has() {
  124. type "$1" >/dev/null 2>&1
  125. }
  126. # search for an executable in PATH
  127. path_of() {
  128. local_command="$1"
  129. local_ifs="$IFS"
  130. local_dir=""
  131. # pathname has a dir component?
  132. if [ "${local_command#*/}" != "$local_command" ]; then
  133. if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
  134. echo "$local_command"
  135. return 0
  136. fi
  137. fi
  138. if [ -z "$local_command" ]; then
  139. return 1
  140. fi
  141. IFS=:
  142. for local_dir in $PATH; do
  143. if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
  144. echo "$local_dir/$local_command"
  145. IFS="${local_ifs:-$(printf ' \t\n')}"
  146. return 0
  147. fi
  148. done
  149. # not found
  150. IFS="${local_ifs:-$(printf ' \t\n')}"
  151. return 1
  152. }
  153. have_backend () {
  154. echo "$trace_backends" | grep "$1" >/dev/null
  155. }
  156. glob() {
  157. eval test -z '"${1#'"$2"'}"'
  158. }
  159. supported_hax_target() {
  160. test "$hax" = "yes" || return 1
  161. glob "$1" "*-softmmu" || return 1
  162. case "${1%-softmmu}" in
  163. i386|x86_64)
  164. return 0
  165. ;;
  166. esac
  167. return 1
  168. }
  169. supported_kvm_target() {
  170. test "$kvm" = "yes" || return 1
  171. glob "$1" "*-softmmu" || return 1
  172. case "${1%-softmmu}:$cpu" in
  173. arm:arm | aarch64:aarch64 | \
  174. i386:i386 | i386:x86_64 | i386:x32 | \
  175. x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \
  176. mips:mips | mipsel:mips | \
  177. ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | ppc64:ppc64le | \
  178. s390x:s390x)
  179. return 0
  180. ;;
  181. esac
  182. return 1
  183. }
  184. supported_xen_target() {
  185. test "$xen" = "yes" || return 1
  186. glob "$1" "*-softmmu" || return 1
  187. # Only i386 and x86_64 provide the xenpv machine.
  188. case "${1%-softmmu}" in
  189. i386|x86_64)
  190. return 0
  191. ;;
  192. esac
  193. return 1
  194. }
  195. supported_hvf_target() {
  196. test "$hvf" = "yes" || return 1
  197. glob "$1" "*-softmmu" || return 1
  198. case "${1%-softmmu}" in
  199. x86_64)
  200. return 0
  201. ;;
  202. esac
  203. return 1
  204. }
  205. supported_whpx_target() {
  206. test "$whpx" = "yes" || return 1
  207. glob "$1" "*-softmmu" || return 1
  208. case "${1%-softmmu}" in
  209. i386|x86_64)
  210. return 0
  211. ;;
  212. esac
  213. return 1
  214. }
  215. supported_target() {
  216. case "$1" in
  217. *-softmmu)
  218. ;;
  219. *-linux-user)
  220. if test "$linux" != "yes"; then
  221. print_error "Target '$target' is only available on a Linux host"
  222. return 1
  223. fi
  224. ;;
  225. *-bsd-user)
  226. if test "$bsd" != "yes"; then
  227. print_error "Target '$target' is only available on a BSD host"
  228. return 1
  229. fi
  230. ;;
  231. *)
  232. print_error "Invalid target name '$target'"
  233. return 1
  234. ;;
  235. esac
  236. test "$tcg" = "yes" && return 0
  237. supported_kvm_target "$1" && return 0
  238. supported_xen_target "$1" && return 0
  239. supported_hax_target "$1" && return 0
  240. supported_hvf_target "$1" && return 0
  241. supported_whpx_target "$1" && return 0
  242. print_error "TCG disabled, but hardware accelerator not available for '$target'"
  243. return 1
  244. }
  245. ld_has() {
  246. $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
  247. }
  248. # make source path absolute
  249. source_path=$(cd "$(dirname -- "$0")"; pwd)
  250. if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]";
  251. then
  252. error_exit "main directory cannot contain spaces nor colons"
  253. fi
  254. # default parameters
  255. cpu=""
  256. iasl="iasl"
  257. interp_prefix="/usr/gnemul/qemu-%M"
  258. static="no"
  259. cross_prefix=""
  260. audio_drv_list=""
  261. block_drv_rw_whitelist=""
  262. block_drv_ro_whitelist=""
  263. host_cc="cc"
  264. libs_cpu=""
  265. libs_softmmu=""
  266. libs_tools=""
  267. audio_pt_int=""
  268. audio_win_int=""
  269. libs_qga=""
  270. debug_info="yes"
  271. stack_protector=""
  272. if test -e "$source_path/.git"
  273. then
  274. git_update=yes
  275. git_submodules="ui/keycodemapdb"
  276. git_submodules="$git_submodules tests/fp/berkeley-testfloat-3"
  277. git_submodules="$git_submodules tests/fp/berkeley-softfloat-3"
  278. else
  279. git_update=no
  280. git_submodules=""
  281. if ! test -f "$source_path/ui/keycodemapdb/README"
  282. then
  283. echo
  284. echo "ERROR: missing file $source_path/ui/keycodemapdb/README"
  285. echo
  286. echo "This is not a GIT checkout but module content appears to"
  287. echo "be missing. Do not use 'git archive' or GitHub download links"
  288. echo "to acquire QEMU source archives. Non-GIT builds are only"
  289. echo "supported with source archives linked from:"
  290. echo
  291. echo " https://www.qemu.org/download/#source"
  292. echo
  293. echo "Developers working with GIT can use scripts/archive-source.sh"
  294. echo "if they need to create valid source archives."
  295. echo
  296. exit 1
  297. fi
  298. fi
  299. git="git"
  300. # Don't accept a target_list environment variable.
  301. unset target_list
  302. unset target_list_exclude
  303. # Default value for a variable defining feature "foo".
  304. # * foo="no" feature will only be used if --enable-foo arg is given
  305. # * foo="" feature will be searched for, and if found, will be used
  306. # unless --disable-foo is given
  307. # * foo="yes" this value will only be set by --enable-foo flag.
  308. # feature will searched for,
  309. # if not found, configure exits with error
  310. #
  311. # Always add --enable-foo and --disable-foo command line args.
  312. # Distributions want to ensure that several features are compiled in, and it
  313. # is impossible without a --enable-foo that exits if a feature is not found.
  314. bluez=""
  315. brlapi=""
  316. curl=""
  317. curses=""
  318. docs=""
  319. fdt=""
  320. netmap="no"
  321. sdl=""
  322. sdl_image=""
  323. virtfs=""
  324. mpath=""
  325. vnc="yes"
  326. sparse="no"
  327. vde=""
  328. vnc_sasl=""
  329. vnc_jpeg=""
  330. vnc_png=""
  331. xkbcommon=""
  332. xen=""
  333. xen_ctrl_version=""
  334. xen_pci_passthrough=""
  335. linux_aio=""
  336. cap_ng=""
  337. attr=""
  338. libattr=""
  339. xfs=""
  340. tcg="yes"
  341. membarrier=""
  342. vhost_net=""
  343. vhost_crypto=""
  344. vhost_scsi=""
  345. vhost_vsock=""
  346. vhost_user=""
  347. kvm="no"
  348. hax="no"
  349. hvf="no"
  350. whpx="no"
  351. rdma=""
  352. pvrdma=""
  353. gprof="no"
  354. debug_tcg="no"
  355. debug="no"
  356. sanitizers="no"
  357. fortify_source=""
  358. strip_opt="yes"
  359. tcg_interpreter="no"
  360. bigendian="no"
  361. mingw32="no"
  362. gcov="no"
  363. gcov_tool="gcov"
  364. EXESUF=""
  365. DSOSUF=".so"
  366. LDFLAGS_SHARED="-shared"
  367. modules="no"
  368. prefix="/usr/local"
  369. mandir="\${prefix}/share/man"
  370. datadir="\${prefix}/share"
  371. firmwarepath="\${prefix}/share/qemu-firmware"
  372. qemu_docdir="\${prefix}/share/doc/qemu"
  373. bindir="\${prefix}/bin"
  374. libdir="\${prefix}/lib"
  375. libexecdir="\${prefix}/libexec"
  376. includedir="\${prefix}/include"
  377. sysconfdir="\${prefix}/etc"
  378. local_statedir="\${prefix}/var"
  379. confsuffix="/qemu"
  380. slirp=""
  381. oss_lib=""
  382. bsd="no"
  383. linux="no"
  384. solaris="no"
  385. profiler="no"
  386. cocoa="no"
  387. softmmu="yes"
  388. linux_user="no"
  389. bsd_user="no"
  390. blobs="yes"
  391. pkgversion=""
  392. pie=""
  393. qom_cast_debug="yes"
  394. trace_backends="log"
  395. trace_file="trace"
  396. spice=""
  397. rbd=""
  398. smartcard=""
  399. libusb=""
  400. usb_redir=""
  401. opengl=""
  402. opengl_dmabuf="no"
  403. cpuid_h="no"
  404. avx2_opt=""
  405. zlib="yes"
  406. capstone=""
  407. lzo=""
  408. snappy=""
  409. bzip2=""
  410. lzfse=""
  411. guest_agent=""
  412. guest_agent_with_vss="no"
  413. guest_agent_ntddscsi="no"
  414. guest_agent_msi=""
  415. vss_win32_sdk=""
  416. win_sdk="no"
  417. want_tools="yes"
  418. libiscsi=""
  419. libnfs=""
  420. coroutine=""
  421. coroutine_pool=""
  422. debug_stack_usage="no"
  423. crypto_afalg="no"
  424. seccomp=""
  425. glusterfs=""
  426. glusterfs_xlator_opt="no"
  427. glusterfs_discard="no"
  428. glusterfs_fallocate="no"
  429. glusterfs_zerofill="no"
  430. glusterfs_ftruncate_has_stat="no"
  431. glusterfs_iocb_has_stat="no"
  432. gtk=""
  433. gtk_gl="no"
  434. tls_priority="NORMAL"
  435. gnutls=""
  436. nettle=""
  437. gcrypt=""
  438. gcrypt_hmac="no"
  439. auth_pam=""
  440. vte=""
  441. virglrenderer=""
  442. tpm=""
  443. libssh=""
  444. live_block_migration="yes"
  445. numa=""
  446. tcmalloc="no"
  447. jemalloc="no"
  448. replication="yes"
  449. vxhs=""
  450. bochs="yes"
  451. cloop="yes"
  452. dmg="yes"
  453. qcow1="yes"
  454. vdi="yes"
  455. vvfat="yes"
  456. qed="yes"
  457. parallels="yes"
  458. sheepdog="yes"
  459. libxml2=""
  460. debug_mutex="no"
  461. libpmem=""
  462. default_devices="yes"
  463. supported_cpu="no"
  464. supported_os="no"
  465. bogus_os="no"
  466. malloc_trim=""
  467. # parse CC options first
  468. for opt do
  469. optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
  470. case "$opt" in
  471. --cross-prefix=*) cross_prefix="$optarg"
  472. ;;
  473. --cc=*) CC="$optarg"
  474. ;;
  475. --cxx=*) CXX="$optarg"
  476. ;;
  477. --cpu=*) cpu="$optarg"
  478. ;;
  479. --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
  480. ;;
  481. --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
  482. ;;
  483. --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
  484. EXTRA_LDFLAGS="$optarg"
  485. ;;
  486. --enable-debug-info) debug_info="yes"
  487. ;;
  488. --disable-debug-info) debug_info="no"
  489. ;;
  490. --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option"
  491. ;;
  492. --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*}
  493. eval "cross_cc_cflags_${cc_arch}=\$optarg"
  494. cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}"
  495. ;;
  496. --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*}
  497. cc_archs="$cc_archs $cc_arch"
  498. eval "cross_cc_${cc_arch}=\$optarg"
  499. cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}"
  500. ;;
  501. esac
  502. done
  503. # OS specific
  504. # Using uname is really, really broken. Once we have the right set of checks
  505. # we can eliminate its usage altogether.
  506. # Preferred compiler:
  507. # ${CC} (if set)
  508. # ${cross_prefix}gcc (if cross-prefix specified)
  509. # system compiler
  510. if test -z "${CC}${cross_prefix}"; then
  511. cc="$host_cc"
  512. else
  513. cc="${CC-${cross_prefix}gcc}"
  514. fi
  515. if test -z "${CXX}${cross_prefix}"; then
  516. cxx="c++"
  517. else
  518. cxx="${CXX-${cross_prefix}g++}"
  519. fi
  520. ar="${AR-${cross_prefix}ar}"
  521. as="${AS-${cross_prefix}as}"
  522. ccas="${CCAS-$cc}"
  523. cpp="${CPP-$cc -E}"
  524. objcopy="${OBJCOPY-${cross_prefix}objcopy}"
  525. ld="${LD-${cross_prefix}ld}"
  526. ranlib="${RANLIB-${cross_prefix}ranlib}"
  527. nm="${NM-${cross_prefix}nm}"
  528. strip="${STRIP-${cross_prefix}strip}"
  529. windres="${WINDRES-${cross_prefix}windres}"
  530. pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
  531. query_pkg_config() {
  532. "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
  533. }
  534. pkg_config=query_pkg_config
  535. sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
  536. # If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
  537. ARFLAGS="${ARFLAGS-rv}"
  538. # default flags for all hosts
  539. # We use -fwrapv to tell the compiler that we require a C dialect where
  540. # left shift of signed integers is well defined and has the expected
  541. # 2s-complement style results. (Both clang and gcc agree that it
  542. # provides these semantics.)
  543. QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv -std=gnu99 $QEMU_CFLAGS"
  544. QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
  545. QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
  546. QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
  547. QEMU_INCLUDES="-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel/tcg -iquote \$(SRC_PATH)/include"
  548. if test "$debug_info" = "yes"; then
  549. CFLAGS="-g $CFLAGS"
  550. LDFLAGS="-g $LDFLAGS"
  551. fi
  552. # running configure in the source tree?
  553. # we know that's the case if configure is there.
  554. if test -f "./configure"; then
  555. pwd_is_source_path="y"
  556. else
  557. pwd_is_source_path="n"
  558. fi
  559. check_define() {
  560. cat > $TMPC <<EOF
  561. #if !defined($1)
  562. #error $1 not defined
  563. #endif
  564. int main(void) { return 0; }
  565. EOF
  566. compile_object
  567. }
  568. check_include() {
  569. cat > $TMPC <<EOF
  570. #include <$1>
  571. int main(void) { return 0; }
  572. EOF
  573. compile_object
  574. }
  575. write_c_skeleton() {
  576. cat > $TMPC <<EOF
  577. int main(void) { return 0; }
  578. EOF
  579. }
  580. if check_define __linux__ ; then
  581. targetos="Linux"
  582. elif check_define _WIN32 ; then
  583. targetos='MINGW32'
  584. elif check_define __OpenBSD__ ; then
  585. targetos='OpenBSD'
  586. elif check_define __sun__ ; then
  587. targetos='SunOS'
  588. elif check_define __HAIKU__ ; then
  589. targetos='Haiku'
  590. elif check_define __FreeBSD__ ; then
  591. targetos='FreeBSD'
  592. elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then
  593. targetos='GNU/kFreeBSD'
  594. elif check_define __DragonFly__ ; then
  595. targetos='DragonFly'
  596. elif check_define __NetBSD__; then
  597. targetos='NetBSD'
  598. elif check_define __APPLE__; then
  599. targetos='Darwin'
  600. else
  601. # This is a fatal error, but don't report it yet, because we
  602. # might be going to just print the --help text, or it might
  603. # be the result of a missing compiler.
  604. targetos='bogus'
  605. bogus_os='yes'
  606. fi
  607. # Some host OSes need non-standard checks for which CPU to use.
  608. # Note that these checks are broken for cross-compilation: if you're
  609. # cross-compiling to one of these OSes then you'll need to specify
  610. # the correct CPU with the --cpu option.
  611. case $targetos in
  612. Darwin)
  613. # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
  614. # run 64-bit userspace code.
  615. # If the user didn't specify a CPU explicitly and the kernel says this is
  616. # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
  617. if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
  618. cpu="x86_64"
  619. fi
  620. ;;
  621. SunOS)
  622. # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
  623. if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
  624. cpu="x86_64"
  625. fi
  626. esac
  627. if test ! -z "$cpu" ; then
  628. # command line argument
  629. :
  630. elif check_define __i386__ ; then
  631. cpu="i386"
  632. elif check_define __x86_64__ ; then
  633. if check_define __ILP32__ ; then
  634. cpu="x32"
  635. else
  636. cpu="x86_64"
  637. fi
  638. elif check_define __sparc__ ; then
  639. if check_define __arch64__ ; then
  640. cpu="sparc64"
  641. else
  642. cpu="sparc"
  643. fi
  644. elif check_define _ARCH_PPC ; then
  645. if check_define _ARCH_PPC64 ; then
  646. if check_define _LITTLE_ENDIAN ; then
  647. cpu="ppc64le"
  648. else
  649. cpu="ppc64"
  650. fi
  651. else
  652. cpu="ppc"
  653. fi
  654. elif check_define __mips__ ; then
  655. cpu="mips"
  656. elif check_define __s390__ ; then
  657. if check_define __s390x__ ; then
  658. cpu="s390x"
  659. else
  660. cpu="s390"
  661. fi
  662. elif check_define __riscv ; then
  663. if check_define _LP64 ; then
  664. cpu="riscv64"
  665. else
  666. cpu="riscv32"
  667. fi
  668. elif check_define __arm__ ; then
  669. cpu="arm"
  670. elif check_define __aarch64__ ; then
  671. cpu="aarch64"
  672. else
  673. cpu=$(uname -m)
  674. fi
  675. ARCH=
  676. # Normalise host CPU name and set ARCH.
  677. # Note that this case should only have supported host CPUs, not guests.
  678. case "$cpu" in
  679. ppc|ppc64|s390|s390x|sparc64|x32|riscv32|riscv64)
  680. supported_cpu="yes"
  681. ;;
  682. ppc64le)
  683. ARCH="ppc64"
  684. supported_cpu="yes"
  685. ;;
  686. i386|i486|i586|i686|i86pc|BePC)
  687. cpu="i386"
  688. supported_cpu="yes"
  689. ;;
  690. x86_64|amd64)
  691. cpu="x86_64"
  692. supported_cpu="yes"
  693. ;;
  694. armv*b|armv*l|arm)
  695. cpu="arm"
  696. supported_cpu="yes"
  697. ;;
  698. aarch64)
  699. cpu="aarch64"
  700. supported_cpu="yes"
  701. ;;
  702. mips*)
  703. cpu="mips"
  704. supported_cpu="yes"
  705. ;;
  706. sparc|sun4[cdmuv])
  707. cpu="sparc"
  708. supported_cpu="yes"
  709. ;;
  710. *)
  711. # This will result in either an error or falling back to TCI later
  712. ARCH=unknown
  713. ;;
  714. esac
  715. if test -z "$ARCH"; then
  716. ARCH="$cpu"
  717. fi
  718. # OS specific
  719. # host *BSD for user mode
  720. HOST_VARIANT_DIR=""
  721. case $targetos in
  722. MINGW32*)
  723. mingw32="yes"
  724. hax="yes"
  725. vhost_user="no"
  726. audio_possible_drivers="dsound sdl"
  727. if check_include dsound.h; then
  728. audio_drv_list="dsound"
  729. else
  730. audio_drv_list=""
  731. fi
  732. supported_os="yes"
  733. ;;
  734. GNU/kFreeBSD)
  735. bsd="yes"
  736. audio_drv_list="oss try-sdl"
  737. audio_possible_drivers="oss sdl pa"
  738. ;;
  739. FreeBSD)
  740. bsd="yes"
  741. make="${MAKE-gmake}"
  742. audio_drv_list="oss try-sdl"
  743. audio_possible_drivers="oss sdl pa"
  744. # needed for kinfo_getvmmap(3) in libutil.h
  745. LIBS="-lutil $LIBS"
  746. # needed for kinfo_getproc
  747. libs_qga="-lutil $libs_qga"
  748. netmap="" # enable netmap autodetect
  749. HOST_VARIANT_DIR="freebsd"
  750. supported_os="yes"
  751. ;;
  752. DragonFly)
  753. bsd="yes"
  754. make="${MAKE-gmake}"
  755. audio_drv_list="oss try-sdl"
  756. audio_possible_drivers="oss sdl pa"
  757. HOST_VARIANT_DIR="dragonfly"
  758. ;;
  759. NetBSD)
  760. bsd="yes"
  761. hax="yes"
  762. make="${MAKE-gmake}"
  763. audio_drv_list="oss try-sdl"
  764. audio_possible_drivers="oss sdl"
  765. oss_lib="-lossaudio"
  766. HOST_VARIANT_DIR="netbsd"
  767. supported_os="yes"
  768. ;;
  769. OpenBSD)
  770. bsd="yes"
  771. make="${MAKE-gmake}"
  772. audio_drv_list="try-sdl"
  773. audio_possible_drivers="sdl"
  774. HOST_VARIANT_DIR="openbsd"
  775. supported_os="yes"
  776. ;;
  777. Darwin)
  778. bsd="yes"
  779. darwin="yes"
  780. hax="yes"
  781. hvf="yes"
  782. LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
  783. if [ "$cpu" = "x86_64" ] ; then
  784. QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
  785. LDFLAGS="-arch x86_64 $LDFLAGS"
  786. fi
  787. cocoa="yes"
  788. audio_drv_list="coreaudio try-sdl"
  789. audio_possible_drivers="coreaudio sdl"
  790. LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
  791. libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
  792. # Disable attempts to use ObjectiveC features in os/object.h since they
  793. # won't work when we're compiling with gcc as a C compiler.
  794. QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
  795. HOST_VARIANT_DIR="darwin"
  796. supported_os="yes"
  797. ;;
  798. SunOS)
  799. solaris="yes"
  800. make="${MAKE-gmake}"
  801. install="${INSTALL-ginstall}"
  802. smbd="${SMBD-/usr/sfw/sbin/smbd}"
  803. if test -f /usr/include/sys/soundcard.h ; then
  804. audio_drv_list="oss try-sdl"
  805. fi
  806. audio_possible_drivers="oss sdl"
  807. # needed for CMSG_ macros in sys/socket.h
  808. QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
  809. # needed for TIOCWIN* defines in termios.h
  810. QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
  811. QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
  812. solarisnetlibs="-lsocket -lnsl -lresolv"
  813. LIBS="$solarisnetlibs $LIBS"
  814. libs_qga="$solarisnetlibs $libs_qga"
  815. ;;
  816. Haiku)
  817. haiku="yes"
  818. QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
  819. LIBS="-lposix_error_mapper -lnetwork $LIBS"
  820. ;;
  821. Linux)
  822. audio_drv_list="try-pa oss"
  823. audio_possible_drivers="oss alsa sdl pa"
  824. linux="yes"
  825. linux_user="yes"
  826. kvm="yes"
  827. QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$PWD/linux-headers $QEMU_INCLUDES"
  828. supported_os="yes"
  829. libudev="yes"
  830. ;;
  831. esac
  832. if [ "$bsd" = "yes" ] ; then
  833. if [ "$darwin" != "yes" ] ; then
  834. bsd_user="yes"
  835. fi
  836. fi
  837. : ${make=${MAKE-make}}
  838. : ${install=${INSTALL-install}}
  839. # We prefer python 3.x. A bare 'python' is traditionally
  840. # python 2.x, but some distros have it as python 3.x, so
  841. # we check that before python2
  842. python=
  843. for binary in "${PYTHON-python3}" python python2
  844. do
  845. if has "$binary"
  846. then
  847. python="$binary"
  848. break
  849. fi
  850. done
  851. : ${smbd=${SMBD-/usr/sbin/smbd}}
  852. # Default objcc to clang if available, otherwise use CC
  853. if has clang; then
  854. objcc=clang
  855. else
  856. objcc="$cc"
  857. fi
  858. if test "$mingw32" = "yes" ; then
  859. EXESUF=".exe"
  860. DSOSUF=".dll"
  861. # MinGW needs -mthreads for TLS and macro _MT.
  862. QEMU_CFLAGS="-mthreads $QEMU_CFLAGS"
  863. LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
  864. write_c_skeleton;
  865. if compile_prog "" "-liberty" ; then
  866. LIBS="-liberty $LIBS"
  867. fi
  868. prefix="c:/Program Files/QEMU"
  869. mandir="\${prefix}"
  870. datadir="\${prefix}"
  871. qemu_docdir="\${prefix}"
  872. bindir="\${prefix}"
  873. sysconfdir="\${prefix}"
  874. local_statedir=
  875. confsuffix=""
  876. libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga"
  877. fi
  878. werror=""
  879. for opt do
  880. optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
  881. case "$opt" in
  882. --help|-h) show_help=yes
  883. ;;
  884. --version|-V) exec cat $source_path/VERSION
  885. ;;
  886. --prefix=*) prefix="$optarg"
  887. ;;
  888. --interp-prefix=*) interp_prefix="$optarg"
  889. ;;
  890. --cross-prefix=*)
  891. ;;
  892. --cc=*)
  893. ;;
  894. --host-cc=*) host_cc="$optarg"
  895. ;;
  896. --cxx=*)
  897. ;;
  898. --iasl=*) iasl="$optarg"
  899. ;;
  900. --objcc=*) objcc="$optarg"
  901. ;;
  902. --make=*) make="$optarg"
  903. ;;
  904. --install=*) install="$optarg"
  905. ;;
  906. --python=*) python="$optarg"
  907. ;;
  908. --gcov=*) gcov_tool="$optarg"
  909. ;;
  910. --smbd=*) smbd="$optarg"
  911. ;;
  912. --extra-cflags=*)
  913. ;;
  914. --extra-cxxflags=*)
  915. ;;
  916. --extra-ldflags=*)
  917. ;;
  918. --enable-debug-info)
  919. ;;
  920. --disable-debug-info)
  921. ;;
  922. --cross-cc-*)
  923. ;;
  924. --enable-modules)
  925. modules="yes"
  926. ;;
  927. --disable-modules)
  928. modules="no"
  929. ;;
  930. --cpu=*)
  931. ;;
  932. --target-list=*) target_list="$optarg"
  933. if test "$target_list_exclude"; then
  934. error_exit "Can't mix --target-list with --target-list-exclude"
  935. fi
  936. ;;
  937. --target-list-exclude=*) target_list_exclude="$optarg"
  938. if test "$target_list"; then
  939. error_exit "Can't mix --target-list-exclude with --target-list"
  940. fi
  941. ;;
  942. --enable-trace-backends=*) trace_backends="$optarg"
  943. ;;
  944. # XXX: backwards compatibility
  945. --enable-trace-backend=*) trace_backends="$optarg"
  946. ;;
  947. --with-trace-file=*) trace_file="$optarg"
  948. ;;
  949. --with-default-devices) default_devices="yes"
  950. ;;
  951. --without-default-devices) default_devices="no"
  952. ;;
  953. --enable-gprof) gprof="yes"
  954. ;;
  955. --enable-gcov) gcov="yes"
  956. ;;
  957. --static)
  958. static="yes"
  959. LDFLAGS="-static $LDFLAGS"
  960. QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
  961. ;;
  962. --mandir=*) mandir="$optarg"
  963. ;;
  964. --bindir=*) bindir="$optarg"
  965. ;;
  966. --libdir=*) libdir="$optarg"
  967. ;;
  968. --libexecdir=*) libexecdir="$optarg"
  969. ;;
  970. --includedir=*) includedir="$optarg"
  971. ;;
  972. --datadir=*) datadir="$optarg"
  973. ;;
  974. --with-confsuffix=*) confsuffix="$optarg"
  975. ;;
  976. --docdir=*) qemu_docdir="$optarg"
  977. ;;
  978. --sysconfdir=*) sysconfdir="$optarg"
  979. ;;
  980. --localstatedir=*) local_statedir="$optarg"
  981. ;;
  982. --firmwarepath=*) firmwarepath="$optarg"
  983. ;;
  984. --host=*|--build=*|\
  985. --disable-dependency-tracking|\
  986. --sbindir=*|--sharedstatedir=*|\
  987. --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
  988. --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
  989. # These switches are silently ignored, for compatibility with
  990. # autoconf-generated configure scripts. This allows QEMU's
  991. # configure to be used by RPM and similar macros that set
  992. # lots of directory switches by default.
  993. ;;
  994. --disable-sdl) sdl="no"
  995. ;;
  996. --enable-sdl) sdl="yes"
  997. ;;
  998. --disable-sdl-image) sdl_image="no"
  999. ;;
  1000. --enable-sdl-image) sdl_image="yes"
  1001. ;;
  1002. --disable-qom-cast-debug) qom_cast_debug="no"
  1003. ;;
  1004. --enable-qom-cast-debug) qom_cast_debug="yes"
  1005. ;;
  1006. --disable-virtfs) virtfs="no"
  1007. ;;
  1008. --enable-virtfs) virtfs="yes"
  1009. ;;
  1010. --disable-mpath) mpath="no"
  1011. ;;
  1012. --enable-mpath) mpath="yes"
  1013. ;;
  1014. --disable-vnc) vnc="no"
  1015. ;;
  1016. --enable-vnc) vnc="yes"
  1017. ;;
  1018. --oss-lib=*) oss_lib="$optarg"
  1019. ;;
  1020. --audio-drv-list=*) audio_drv_list="$optarg"
  1021. ;;
  1022. --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
  1023. ;;
  1024. --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
  1025. ;;
  1026. --enable-debug-tcg) debug_tcg="yes"
  1027. ;;
  1028. --disable-debug-tcg) debug_tcg="no"
  1029. ;;
  1030. --enable-debug)
  1031. # Enable debugging options that aren't excessively noisy
  1032. debug_tcg="yes"
  1033. debug_mutex="yes"
  1034. debug="yes"
  1035. strip_opt="no"
  1036. fortify_source="no"
  1037. ;;
  1038. --enable-sanitizers) sanitizers="yes"
  1039. ;;
  1040. --disable-sanitizers) sanitizers="no"
  1041. ;;
  1042. --enable-sparse) sparse="yes"
  1043. ;;
  1044. --disable-sparse) sparse="no"
  1045. ;;
  1046. --disable-strip) strip_opt="no"
  1047. ;;
  1048. --disable-vnc-sasl) vnc_sasl="no"
  1049. ;;
  1050. --enable-vnc-sasl) vnc_sasl="yes"
  1051. ;;
  1052. --disable-vnc-jpeg) vnc_jpeg="no"
  1053. ;;
  1054. --enable-vnc-jpeg) vnc_jpeg="yes"
  1055. ;;
  1056. --disable-vnc-png) vnc_png="no"
  1057. ;;
  1058. --enable-vnc-png) vnc_png="yes"
  1059. ;;
  1060. --disable-slirp) slirp="no"
  1061. ;;
  1062. --enable-slirp=git) slirp="git"
  1063. ;;
  1064. --enable-slirp=system) slirp="system"
  1065. ;;
  1066. --disable-vde) vde="no"
  1067. ;;
  1068. --enable-vde) vde="yes"
  1069. ;;
  1070. --disable-netmap) netmap="no"
  1071. ;;
  1072. --enable-netmap) netmap="yes"
  1073. ;;
  1074. --disable-xen) xen="no"
  1075. ;;
  1076. --enable-xen) xen="yes"
  1077. ;;
  1078. --disable-xen-pci-passthrough) xen_pci_passthrough="no"
  1079. ;;
  1080. --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
  1081. ;;
  1082. --disable-brlapi) brlapi="no"
  1083. ;;
  1084. --enable-brlapi) brlapi="yes"
  1085. ;;
  1086. --disable-bluez) bluez="no"
  1087. ;;
  1088. --enable-bluez) bluez="yes"
  1089. ;;
  1090. --disable-kvm) kvm="no"
  1091. ;;
  1092. --enable-kvm) kvm="yes"
  1093. ;;
  1094. --disable-hax) hax="no"
  1095. ;;
  1096. --enable-hax) hax="yes"
  1097. ;;
  1098. --disable-hvf) hvf="no"
  1099. ;;
  1100. --enable-hvf) hvf="yes"
  1101. ;;
  1102. --disable-whpx) whpx="no"
  1103. ;;
  1104. --enable-whpx) whpx="yes"
  1105. ;;
  1106. --disable-tcg-interpreter) tcg_interpreter="no"
  1107. ;;
  1108. --enable-tcg-interpreter) tcg_interpreter="yes"
  1109. ;;
  1110. --disable-cap-ng) cap_ng="no"
  1111. ;;
  1112. --enable-cap-ng) cap_ng="yes"
  1113. ;;
  1114. --disable-tcg) tcg="no"
  1115. ;;
  1116. --enable-tcg) tcg="yes"
  1117. ;;
  1118. --disable-malloc-trim) malloc_trim="no"
  1119. ;;
  1120. --enable-malloc-trim) malloc_trim="yes"
  1121. ;;
  1122. --disable-spice) spice="no"
  1123. ;;
  1124. --enable-spice) spice="yes"
  1125. ;;
  1126. --disable-libiscsi) libiscsi="no"
  1127. ;;
  1128. --enable-libiscsi) libiscsi="yes"
  1129. ;;
  1130. --disable-libnfs) libnfs="no"
  1131. ;;
  1132. --enable-libnfs) libnfs="yes"
  1133. ;;
  1134. --enable-profiler) profiler="yes"
  1135. ;;
  1136. --disable-cocoa) cocoa="no"
  1137. ;;
  1138. --enable-cocoa)
  1139. cocoa="yes" ;
  1140. audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
  1141. ;;
  1142. --disable-system) softmmu="no"
  1143. ;;
  1144. --enable-system) softmmu="yes"
  1145. ;;
  1146. --disable-user)
  1147. linux_user="no" ;
  1148. bsd_user="no" ;
  1149. ;;
  1150. --enable-user) ;;
  1151. --disable-linux-user) linux_user="no"
  1152. ;;
  1153. --enable-linux-user) linux_user="yes"
  1154. ;;
  1155. --disable-bsd-user) bsd_user="no"
  1156. ;;
  1157. --enable-bsd-user) bsd_user="yes"
  1158. ;;
  1159. --enable-pie) pie="yes"
  1160. ;;
  1161. --disable-pie) pie="no"
  1162. ;;
  1163. --enable-werror) werror="yes"
  1164. ;;
  1165. --disable-werror) werror="no"
  1166. ;;
  1167. --enable-stack-protector) stack_protector="yes"
  1168. ;;
  1169. --disable-stack-protector) stack_protector="no"
  1170. ;;
  1171. --disable-curses) curses="no"
  1172. ;;
  1173. --enable-curses) curses="yes"
  1174. ;;
  1175. --disable-iconv) iconv="no"
  1176. ;;
  1177. --enable-iconv) iconv="yes"
  1178. ;;
  1179. --disable-curl) curl="no"
  1180. ;;
  1181. --enable-curl) curl="yes"
  1182. ;;
  1183. --disable-fdt) fdt="no"
  1184. ;;
  1185. --enable-fdt) fdt="yes"
  1186. ;;
  1187. --disable-linux-aio) linux_aio="no"
  1188. ;;
  1189. --enable-linux-aio) linux_aio="yes"
  1190. ;;
  1191. --disable-attr) attr="no"
  1192. ;;
  1193. --enable-attr) attr="yes"
  1194. ;;
  1195. --disable-membarrier) membarrier="no"
  1196. ;;
  1197. --enable-membarrier) membarrier="yes"
  1198. ;;
  1199. --disable-blobs) blobs="no"
  1200. ;;
  1201. --with-pkgversion=*) pkgversion="$optarg"
  1202. ;;
  1203. --with-coroutine=*) coroutine="$optarg"
  1204. ;;
  1205. --disable-coroutine-pool) coroutine_pool="no"
  1206. ;;
  1207. --enable-coroutine-pool) coroutine_pool="yes"
  1208. ;;
  1209. --enable-debug-stack-usage) debug_stack_usage="yes"
  1210. ;;
  1211. --enable-crypto-afalg) crypto_afalg="yes"
  1212. ;;
  1213. --disable-crypto-afalg) crypto_afalg="no"
  1214. ;;
  1215. --disable-docs) docs="no"
  1216. ;;
  1217. --enable-docs) docs="yes"
  1218. ;;
  1219. --disable-vhost-net) vhost_net="no"
  1220. ;;
  1221. --enable-vhost-net) vhost_net="yes"
  1222. ;;
  1223. --disable-vhost-crypto) vhost_crypto="no"
  1224. ;;
  1225. --enable-vhost-crypto) vhost_crypto="yes"
  1226. ;;
  1227. --disable-vhost-scsi) vhost_scsi="no"
  1228. ;;
  1229. --enable-vhost-scsi) vhost_scsi="yes"
  1230. ;;
  1231. --disable-vhost-vsock) vhost_vsock="no"
  1232. ;;
  1233. --enable-vhost-vsock) vhost_vsock="yes"
  1234. ;;
  1235. --disable-opengl) opengl="no"
  1236. ;;
  1237. --enable-opengl) opengl="yes"
  1238. ;;
  1239. --disable-rbd) rbd="no"
  1240. ;;
  1241. --enable-rbd) rbd="yes"
  1242. ;;
  1243. --disable-xfsctl) xfs="no"
  1244. ;;
  1245. --enable-xfsctl) xfs="yes"
  1246. ;;
  1247. --disable-smartcard) smartcard="no"
  1248. ;;
  1249. --enable-smartcard) smartcard="yes"
  1250. ;;
  1251. --disable-libusb) libusb="no"
  1252. ;;
  1253. --enable-libusb) libusb="yes"
  1254. ;;
  1255. --disable-usb-redir) usb_redir="no"
  1256. ;;
  1257. --enable-usb-redir) usb_redir="yes"
  1258. ;;
  1259. --disable-zlib-test) zlib="no"
  1260. ;;
  1261. --disable-lzo) lzo="no"
  1262. ;;
  1263. --enable-lzo) lzo="yes"
  1264. ;;
  1265. --disable-snappy) snappy="no"
  1266. ;;
  1267. --enable-snappy) snappy="yes"
  1268. ;;
  1269. --disable-bzip2) bzip2="no"
  1270. ;;
  1271. --enable-bzip2) bzip2="yes"
  1272. ;;
  1273. --enable-lzfse) lzfse="yes"
  1274. ;;
  1275. --disable-lzfse) lzfse="no"
  1276. ;;
  1277. --enable-guest-agent) guest_agent="yes"
  1278. ;;
  1279. --disable-guest-agent) guest_agent="no"
  1280. ;;
  1281. --enable-guest-agent-msi) guest_agent_msi="yes"
  1282. ;;
  1283. --disable-guest-agent-msi) guest_agent_msi="no"
  1284. ;;
  1285. --with-vss-sdk) vss_win32_sdk=""
  1286. ;;
  1287. --with-vss-sdk=*) vss_win32_sdk="$optarg"
  1288. ;;
  1289. --without-vss-sdk) vss_win32_sdk="no"
  1290. ;;
  1291. --with-win-sdk) win_sdk=""
  1292. ;;
  1293. --with-win-sdk=*) win_sdk="$optarg"
  1294. ;;
  1295. --without-win-sdk) win_sdk="no"
  1296. ;;
  1297. --enable-tools) want_tools="yes"
  1298. ;;
  1299. --disable-tools) want_tools="no"
  1300. ;;
  1301. --enable-seccomp) seccomp="yes"
  1302. ;;
  1303. --disable-seccomp) seccomp="no"
  1304. ;;
  1305. --disable-glusterfs) glusterfs="no"
  1306. ;;
  1307. --disable-avx2) avx2_opt="no"
  1308. ;;
  1309. --enable-avx2) avx2_opt="yes"
  1310. ;;
  1311. --enable-glusterfs) glusterfs="yes"
  1312. ;;
  1313. --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
  1314. echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
  1315. ;;
  1316. --enable-vhdx|--disable-vhdx)
  1317. echo "$0: $opt is obsolete, VHDX driver is always built" >&2
  1318. ;;
  1319. --enable-uuid|--disable-uuid)
  1320. echo "$0: $opt is obsolete, UUID support is always built" >&2
  1321. ;;
  1322. --disable-gtk) gtk="no"
  1323. ;;
  1324. --enable-gtk) gtk="yes"
  1325. ;;
  1326. --tls-priority=*) tls_priority="$optarg"
  1327. ;;
  1328. --disable-gnutls) gnutls="no"
  1329. ;;
  1330. --enable-gnutls) gnutls="yes"
  1331. ;;
  1332. --disable-nettle) nettle="no"
  1333. ;;
  1334. --enable-nettle) nettle="yes"
  1335. ;;
  1336. --disable-gcrypt) gcrypt="no"
  1337. ;;
  1338. --enable-gcrypt) gcrypt="yes"
  1339. ;;
  1340. --disable-auth-pam) auth_pam="no"
  1341. ;;
  1342. --enable-auth-pam) auth_pam="yes"
  1343. ;;
  1344. --enable-rdma) rdma="yes"
  1345. ;;
  1346. --disable-rdma) rdma="no"
  1347. ;;
  1348. --enable-pvrdma) pvrdma="yes"
  1349. ;;
  1350. --disable-pvrdma) pvrdma="no"
  1351. ;;
  1352. --disable-vte) vte="no"
  1353. ;;
  1354. --enable-vte) vte="yes"
  1355. ;;
  1356. --disable-virglrenderer) virglrenderer="no"
  1357. ;;
  1358. --enable-virglrenderer) virglrenderer="yes"
  1359. ;;
  1360. --disable-tpm) tpm="no"
  1361. ;;
  1362. --enable-tpm) tpm="yes"
  1363. ;;
  1364. --disable-libssh) libssh="no"
  1365. ;;
  1366. --enable-libssh) libssh="yes"
  1367. ;;
  1368. --disable-live-block-migration) live_block_migration="no"
  1369. ;;
  1370. --enable-live-block-migration) live_block_migration="yes"
  1371. ;;
  1372. --disable-numa) numa="no"
  1373. ;;
  1374. --enable-numa) numa="yes"
  1375. ;;
  1376. --disable-libxml2) libxml2="no"
  1377. ;;
  1378. --enable-libxml2) libxml2="yes"
  1379. ;;
  1380. --disable-tcmalloc) tcmalloc="no"
  1381. ;;
  1382. --enable-tcmalloc) tcmalloc="yes"
  1383. ;;
  1384. --disable-jemalloc) jemalloc="no"
  1385. ;;
  1386. --enable-jemalloc) jemalloc="yes"
  1387. ;;
  1388. --disable-replication) replication="no"
  1389. ;;
  1390. --enable-replication) replication="yes"
  1391. ;;
  1392. --disable-vxhs) vxhs="no"
  1393. ;;
  1394. --enable-vxhs) vxhs="yes"
  1395. ;;
  1396. --disable-bochs) bochs="no"
  1397. ;;
  1398. --enable-bochs) bochs="yes"
  1399. ;;
  1400. --disable-cloop) cloop="no"
  1401. ;;
  1402. --enable-cloop) cloop="yes"
  1403. ;;
  1404. --disable-dmg) dmg="no"
  1405. ;;
  1406. --enable-dmg) dmg="yes"
  1407. ;;
  1408. --disable-qcow1) qcow1="no"
  1409. ;;
  1410. --enable-qcow1) qcow1="yes"
  1411. ;;
  1412. --disable-vdi) vdi="no"
  1413. ;;
  1414. --enable-vdi) vdi="yes"
  1415. ;;
  1416. --disable-vvfat) vvfat="no"
  1417. ;;
  1418. --enable-vvfat) vvfat="yes"
  1419. ;;
  1420. --disable-qed) qed="no"
  1421. ;;
  1422. --enable-qed) qed="yes"
  1423. ;;
  1424. --disable-parallels) parallels="no"
  1425. ;;
  1426. --enable-parallels) parallels="yes"
  1427. ;;
  1428. --disable-sheepdog) sheepdog="no"
  1429. ;;
  1430. --enable-sheepdog) sheepdog="yes"
  1431. ;;
  1432. --disable-vhost-user) vhost_user="no"
  1433. ;;
  1434. --enable-vhost-user) vhost_user="yes"
  1435. ;;
  1436. --disable-vhost-kernel) vhost_kernel="no"
  1437. ;;
  1438. --enable-vhost-kernel) vhost_kernel="yes"
  1439. ;;
  1440. --disable-capstone) capstone="no"
  1441. ;;
  1442. --enable-capstone) capstone="yes"
  1443. ;;
  1444. --enable-capstone=git) capstone="git"
  1445. ;;
  1446. --enable-capstone=system) capstone="system"
  1447. ;;
  1448. --with-git=*) git="$optarg"
  1449. ;;
  1450. --enable-git-update) git_update=yes
  1451. ;;
  1452. --disable-git-update) git_update=no
  1453. ;;
  1454. --enable-debug-mutex) debug_mutex=yes
  1455. ;;
  1456. --disable-debug-mutex) debug_mutex=no
  1457. ;;
  1458. --enable-libpmem) libpmem=yes
  1459. ;;
  1460. --disable-libpmem) libpmem=no
  1461. ;;
  1462. *)
  1463. echo "ERROR: unknown option $opt"
  1464. echo "Try '$0 --help' for more information"
  1465. exit 1
  1466. ;;
  1467. esac
  1468. done
  1469. case "$cpu" in
  1470. ppc)
  1471. CPU_CFLAGS="-m32"
  1472. LDFLAGS="-m32 $LDFLAGS"
  1473. ;;
  1474. ppc64)
  1475. CPU_CFLAGS="-m64"
  1476. LDFLAGS="-m64 $LDFLAGS"
  1477. ;;
  1478. sparc)
  1479. CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc"
  1480. LDFLAGS="-m32 -mv8plus $LDFLAGS"
  1481. ;;
  1482. sparc64)
  1483. CPU_CFLAGS="-m64 -mcpu=ultrasparc"
  1484. LDFLAGS="-m64 $LDFLAGS"
  1485. ;;
  1486. s390)
  1487. CPU_CFLAGS="-m31"
  1488. LDFLAGS="-m31 $LDFLAGS"
  1489. ;;
  1490. s390x)
  1491. CPU_CFLAGS="-m64"
  1492. LDFLAGS="-m64 $LDFLAGS"
  1493. ;;
  1494. i386)
  1495. CPU_CFLAGS="-m32"
  1496. LDFLAGS="-m32 $LDFLAGS"
  1497. ;;
  1498. x86_64)
  1499. # ??? Only extremely old AMD cpus do not have cmpxchg16b.
  1500. # If we truly care, we should simply detect this case at
  1501. # runtime and generate the fallback to serial emulation.
  1502. CPU_CFLAGS="-m64 -mcx16"
  1503. LDFLAGS="-m64 $LDFLAGS"
  1504. ;;
  1505. x32)
  1506. CPU_CFLAGS="-mx32"
  1507. LDFLAGS="-mx32 $LDFLAGS"
  1508. ;;
  1509. # No special flags required for other host CPUs
  1510. esac
  1511. eval "cross_cc_${cpu}=\$host_cc"
  1512. cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
  1513. QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
  1514. # For user-mode emulation the host arch has to be one we explicitly
  1515. # support, even if we're using TCI.
  1516. if [ "$ARCH" = "unknown" ]; then
  1517. bsd_user="no"
  1518. linux_user="no"
  1519. fi
  1520. default_target_list=""
  1521. mak_wilds=""
  1522. if [ "$softmmu" = "yes" ]; then
  1523. mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
  1524. fi
  1525. if [ "$linux_user" = "yes" ]; then
  1526. mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
  1527. fi
  1528. if [ "$bsd_user" = "yes" ]; then
  1529. mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
  1530. fi
  1531. if test -z "$target_list_exclude"; then
  1532. for config in $mak_wilds; do
  1533. default_target_list="${default_target_list} $(basename "$config" .mak)"
  1534. done
  1535. else
  1536. exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
  1537. for config in $mak_wilds; do
  1538. target="$(basename "$config" .mak)"
  1539. exclude="no"
  1540. for excl in $exclude_list; do
  1541. if test "$excl" = "$target"; then
  1542. exclude="yes"
  1543. break;
  1544. fi
  1545. done
  1546. if test "$exclude" = "no"; then
  1547. default_target_list="${default_target_list} $target"
  1548. fi
  1549. done
  1550. fi
  1551. # Enumerate public trace backends for --help output
  1552. trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/'))
  1553. if test x"$show_help" = x"yes" ; then
  1554. cat << EOF
  1555. Usage: configure [options]
  1556. Options: [defaults in brackets after descriptions]
  1557. Standard options:
  1558. --help print this message
  1559. --prefix=PREFIX install in PREFIX [$prefix]
  1560. --interp-prefix=PREFIX where to find shared libraries, etc.
  1561. use %M for cpu name [$interp_prefix]
  1562. --target-list=LIST set target list (default: build everything)
  1563. $(echo Available targets: $default_target_list | \
  1564. fold -s -w 53 | sed -e 's/^/ /')
  1565. --target-list-exclude=LIST exclude a set of targets from the default target-list
  1566. Advanced options (experts only):
  1567. --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
  1568. --cc=CC use C compiler CC [$cc]
  1569. --iasl=IASL use ACPI compiler IASL [$iasl]
  1570. --host-cc=CC use C compiler CC [$host_cc] for code run at
  1571. build time
  1572. --cxx=CXX use C++ compiler CXX [$cxx]
  1573. --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
  1574. --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
  1575. --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS
  1576. --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
  1577. --cross-cc-ARCH=CC use compiler when building ARCH guest test cases
  1578. --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests
  1579. --make=MAKE use specified make [$make]
  1580. --install=INSTALL use specified install [$install]
  1581. --python=PYTHON use specified python [$python]
  1582. --smbd=SMBD use specified smbd [$smbd]
  1583. --with-git=GIT use specified git [$git]
  1584. --static enable static build [$static]
  1585. --mandir=PATH install man pages in PATH
  1586. --datadir=PATH install firmware in PATH$confsuffix
  1587. --docdir=PATH install documentation in PATH$confsuffix
  1588. --bindir=PATH install binaries in PATH
  1589. --libdir=PATH install libraries in PATH
  1590. --libexecdir=PATH install helper binaries in PATH
  1591. --sysconfdir=PATH install config in PATH$confsuffix
  1592. --localstatedir=PATH install local state in PATH (set at runtime on win32)
  1593. --firmwarepath=PATH search PATH for firmware files
  1594. --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
  1595. --with-pkgversion=VERS use specified string as sub-version of the package
  1596. --enable-debug enable common debug build options
  1597. --enable-sanitizers enable default sanitizers
  1598. --disable-strip disable stripping binaries
  1599. --disable-werror disable compilation abort on warning
  1600. --disable-stack-protector disable compiler-provided stack protection
  1601. --audio-drv-list=LIST set audio drivers list:
  1602. Available drivers: $audio_possible_drivers
  1603. --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
  1604. --block-drv-rw-whitelist=L
  1605. set block driver read-write whitelist
  1606. (affects only QEMU, not qemu-img)
  1607. --block-drv-ro-whitelist=L
  1608. set block driver read-only whitelist
  1609. (affects only QEMU, not qemu-img)
  1610. --enable-trace-backends=B Set trace backend
  1611. Available backends: $trace_backend_list
  1612. --with-trace-file=NAME Full PATH,NAME of file to store traces
  1613. Default:trace-<pid>
  1614. --disable-slirp disable SLIRP userspace network connectivity
  1615. --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
  1616. --enable-malloc-trim enable libc malloc_trim() for memory optimization
  1617. --oss-lib path to OSS library
  1618. --cpu=CPU Build for host CPU [$cpu]
  1619. --with-coroutine=BACKEND coroutine backend. Supported options:
  1620. ucontext, sigaltstack, windows
  1621. --enable-gcov enable test coverage analysis with gcov
  1622. --gcov=GCOV use specified gcov [$gcov_tool]
  1623. --disable-blobs disable installing provided firmware blobs
  1624. --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
  1625. --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
  1626. --tls-priority default TLS protocol/cipher priority string
  1627. --enable-gprof QEMU profiling with gprof
  1628. --enable-profiler profiler support
  1629. --enable-debug-stack-usage
  1630. track the maximum stack usage of stacks created by qemu_alloc_stack
  1631. Optional features, enabled with --enable-FEATURE and
  1632. disabled with --disable-FEATURE, default is enabled if available:
  1633. system all system emulation targets
  1634. user supported user emulation targets
  1635. linux-user all linux usermode emulation targets
  1636. bsd-user all BSD usermode emulation targets
  1637. docs build documentation
  1638. guest-agent build the QEMU Guest Agent
  1639. guest-agent-msi build guest agent Windows MSI installation package
  1640. pie Position Independent Executables
  1641. modules modules support (non-Windows)
  1642. debug-tcg TCG debugging (default is disabled)
  1643. debug-info debugging information
  1644. sparse sparse checker
  1645. gnutls GNUTLS cryptography support
  1646. nettle nettle cryptography support
  1647. gcrypt libgcrypt cryptography support
  1648. auth-pam PAM access control
  1649. sdl SDL UI
  1650. sdl-image SDL Image support for icons
  1651. gtk gtk UI
  1652. vte vte support for the gtk UI
  1653. curses curses UI
  1654. iconv font glyph conversion support
  1655. vnc VNC UI support
  1656. vnc-sasl SASL encryption for VNC server
  1657. vnc-jpeg JPEG lossy compression for VNC server
  1658. vnc-png PNG compression for VNC server
  1659. cocoa Cocoa UI (Mac OS X only)
  1660. virtfs VirtFS
  1661. mpath Multipath persistent reservation passthrough
  1662. xen xen backend driver support
  1663. xen-pci-passthrough PCI passthrough support for Xen
  1664. brlapi BrlAPI (Braile)
  1665. curl curl connectivity
  1666. membarrier membarrier system call (for Linux 4.14+ or Windows)
  1667. fdt fdt device tree
  1668. bluez bluez stack connectivity
  1669. kvm KVM acceleration support
  1670. hax HAX acceleration support
  1671. hvf Hypervisor.framework acceleration support
  1672. whpx Windows Hypervisor Platform acceleration support
  1673. rdma Enable RDMA-based migration
  1674. pvrdma Enable PVRDMA support
  1675. vde support for vde network
  1676. netmap support for netmap network
  1677. linux-aio Linux AIO support
  1678. cap-ng libcap-ng support
  1679. attr attr and xattr support
  1680. vhost-net vhost-net kernel acceleration support
  1681. vhost-vsock virtio sockets device support
  1682. vhost-scsi vhost-scsi kernel target support
  1683. vhost-crypto vhost-user-crypto backend support
  1684. vhost-kernel vhost kernel backend support
  1685. vhost-user vhost-user backend support
  1686. spice spice
  1687. rbd rados block device (rbd)
  1688. libiscsi iscsi support
  1689. libnfs nfs support
  1690. smartcard smartcard support (libcacard)
  1691. libusb libusb (for usb passthrough)
  1692. live-block-migration Block migration in the main migration stream
  1693. usb-redir usb network redirection support
  1694. lzo support of lzo compression library
  1695. snappy support of snappy compression library
  1696. bzip2 support of bzip2 compression library
  1697. (for reading bzip2-compressed dmg images)
  1698. lzfse support of lzfse compression library
  1699. (for reading lzfse-compressed dmg images)
  1700. seccomp seccomp support
  1701. coroutine-pool coroutine freelist (better performance)
  1702. glusterfs GlusterFS backend
  1703. tpm TPM support
  1704. libssh ssh block device support
  1705. numa libnuma support
  1706. libxml2 for Parallels image format
  1707. tcmalloc tcmalloc support
  1708. jemalloc jemalloc support
  1709. avx2 AVX2 optimization support
  1710. replication replication support
  1711. opengl opengl support
  1712. virglrenderer virgl rendering support
  1713. xfsctl xfsctl support
  1714. qom-cast-debug cast debugging support
  1715. tools build qemu-io, qemu-nbd and qemu-img tools
  1716. vxhs Veritas HyperScale vDisk backend support
  1717. bochs bochs image format support
  1718. cloop cloop image format support
  1719. dmg dmg image format support
  1720. qcow1 qcow v1 image format support
  1721. vdi vdi image format support
  1722. vvfat vvfat image format support
  1723. qed qed image format support
  1724. parallels parallels image format support
  1725. sheepdog sheepdog block driver support
  1726. crypto-afalg Linux AF_ALG crypto backend driver
  1727. capstone capstone disassembler support
  1728. debug-mutex mutex debugging support
  1729. libpmem libpmem support
  1730. NOTE: The object files are built at the place where configure is launched
  1731. EOF
  1732. exit 0
  1733. fi
  1734. # Remove old dependency files to make sure that they get properly regenerated
  1735. rm -f */config-devices.mak.d
  1736. if test -z "$python"
  1737. then
  1738. error_exit "Python not found. Use --python=/path/to/python"
  1739. fi
  1740. # Note that if the Python conditional here evaluates True we will exit
  1741. # with status 1 which is a shell 'false' value.
  1742. if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then
  1743. error_exit "Cannot use '$python', Python 2 >= 2.7 or Python 3 is required." \
  1744. "Use --python=/path/to/python to specify a supported Python."
  1745. fi
  1746. # Preserve python version since some functionality is dependent on it
  1747. python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev/null)
  1748. # Suppress writing compiled files
  1749. python="$python -B"
  1750. # Check that the C compiler works. Doing this here before testing
  1751. # the host CPU ensures that we had a valid CC to autodetect the
  1752. # $cpu var (and we should bail right here if that's not the case).
  1753. # It also allows the help message to be printed without a CC.
  1754. write_c_skeleton;
  1755. if compile_object ; then
  1756. : C compiler works ok
  1757. else
  1758. error_exit "\"$cc\" either does not exist or does not work"
  1759. fi
  1760. if ! compile_prog ; then
  1761. error_exit "\"$cc\" cannot build an executable (is your linker broken?)"
  1762. fi
  1763. # Now we have handled --enable-tcg-interpreter and know we're not just
  1764. # printing the help message, bail out if the host CPU isn't supported.
  1765. if test "$ARCH" = "unknown"; then
  1766. if test "$tcg_interpreter" = "yes" ; then
  1767. echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
  1768. else
  1769. error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
  1770. fi
  1771. fi
  1772. # Consult white-list to determine whether to enable werror
  1773. # by default. Only enable by default for git builds
  1774. if test -z "$werror" ; then
  1775. if test -e "$source_path/.git" && \
  1776. { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then
  1777. werror="yes"
  1778. else
  1779. werror="no"
  1780. fi
  1781. fi
  1782. if test "$bogus_os" = "yes"; then
  1783. # Now that we know that we're not printing the help and that
  1784. # the compiler works (so the results of the check_defines we used
  1785. # to identify the OS are reliable), if we didn't recognize the
  1786. # host OS we should stop now.
  1787. error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
  1788. fi
  1789. # Check whether the compiler matches our minimum requirements:
  1790. cat > $TMPC << EOF
  1791. #if defined(__clang_major__) && defined(__clang_minor__)
  1792. # ifdef __apple_build_version__
  1793. # if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1)
  1794. # error You need at least XCode Clang v5.1 to compile QEMU
  1795. # endif
  1796. # else
  1797. # if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4)
  1798. # error You need at least Clang v3.4 to compile QEMU
  1799. # endif
  1800. # endif
  1801. #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
  1802. # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
  1803. # error You need at least GCC v4.8 to compile QEMU
  1804. # endif
  1805. #else
  1806. # error You either need GCC or Clang to compiler QEMU
  1807. #endif
  1808. int main (void) { return 0; }
  1809. EOF
  1810. if ! compile_prog "" "" ; then
  1811. error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)"
  1812. fi
  1813. gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
  1814. gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
  1815. gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
  1816. gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
  1817. gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags"
  1818. gcc_flags="-Wno-string-plus-int -Wno-typedef-redefinition $gcc_flags"
  1819. # Note that we do not add -Werror to gcc_flags here, because that would
  1820. # enable it for all configure tests. If a configure test failed due
  1821. # to -Werror this would just silently disable some features,
  1822. # so it's too error prone.
  1823. cc_has_warning_flag() {
  1824. write_c_skeleton;
  1825. # Use the positive sense of the flag when testing for -Wno-wombat
  1826. # support (gcc will happily accept the -Wno- form of unknown
  1827. # warning options).
  1828. optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
  1829. compile_prog "-Werror $optflag" ""
  1830. }
  1831. for flag in $gcc_flags; do
  1832. if cc_has_warning_flag $flag ; then
  1833. QEMU_CFLAGS="$QEMU_CFLAGS $flag"
  1834. fi
  1835. done
  1836. if test "$stack_protector" != "no"; then
  1837. cat > $TMPC << EOF
  1838. int main(int argc, char *argv[])
  1839. {
  1840. char arr[64], *p = arr, *c = argv[0];
  1841. while (*c) {
  1842. *p++ = *c++;
  1843. }
  1844. return 0;
  1845. }
  1846. EOF
  1847. gcc_flags="-fstack-protector-strong -fstack-protector-all"
  1848. sp_on=0
  1849. for flag in $gcc_flags; do
  1850. # We need to check both a compile and a link, since some compiler
  1851. # setups fail only on a .c->.o compile and some only at link time
  1852. if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
  1853. compile_prog "-Werror $flag" ""; then
  1854. QEMU_CFLAGS="$QEMU_CFLAGS $flag"
  1855. sp_on=1
  1856. break
  1857. fi
  1858. done
  1859. if test "$stack_protector" = yes; then
  1860. if test $sp_on = 0; then
  1861. error_exit "Stack protector not supported"
  1862. fi
  1863. fi
  1864. fi
  1865. # Disable -Wmissing-braces on older compilers that warn even for
  1866. # the "universal" C zero initializer {0}.
  1867. cat > $TMPC << EOF
  1868. struct {
  1869. int a[2];
  1870. } x = {0};
  1871. EOF
  1872. if compile_object "-Werror" "" ; then
  1873. :
  1874. else
  1875. QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces"
  1876. fi
  1877. # Our module code doesn't support Windows
  1878. if test "$modules" = "yes" && test "$mingw32" = "yes" ; then
  1879. error_exit "Modules are not available for Windows"
  1880. fi
  1881. # Static linking is not possible with modules or PIE
  1882. if test "$static" = "yes" ; then
  1883. if test "$modules" = "yes" ; then
  1884. error_exit "static and modules are mutually incompatible"
  1885. fi
  1886. if test "$pie" = "yes" ; then
  1887. error_exit "static and pie are mutually incompatible"
  1888. else
  1889. pie="no"
  1890. fi
  1891. fi
  1892. # Unconditional check for compiler __thread support
  1893. cat > $TMPC << EOF
  1894. static __thread int tls_var;
  1895. int main(void) { return tls_var; }
  1896. EOF
  1897. if ! compile_prog "-Werror" "" ; then
  1898. error_exit "Your compiler does not support the __thread specifier for " \
  1899. "Thread-Local Storage (TLS). Please upgrade to a version that does."
  1900. fi
  1901. if test "$pie" = ""; then
  1902. case "$cpu-$targetos" in
  1903. i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
  1904. ;;
  1905. *)
  1906. pie="no"
  1907. ;;
  1908. esac
  1909. fi
  1910. if test "$pie" != "no" ; then
  1911. cat > $TMPC << EOF
  1912. #ifdef __linux__
  1913. # define THREAD __thread
  1914. #else
  1915. # define THREAD
  1916. #endif
  1917. static THREAD int tls_var;
  1918. int main(void) { return tls_var; }
  1919. EOF
  1920. # check we support --no-pie first...
  1921. if compile_prog "-Werror -fno-pie" "-no-pie"; then
  1922. CFLAGS_NOPIE="-fno-pie"
  1923. LDFLAGS_NOPIE="-nopie"
  1924. fi
  1925. if compile_prog "-fPIE -DPIE" "-pie"; then
  1926. QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
  1927. LDFLAGS="-pie $LDFLAGS"
  1928. pie="yes"
  1929. if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
  1930. LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
  1931. fi
  1932. else
  1933. if test "$pie" = "yes"; then
  1934. error_exit "PIE not available due to missing toolchain support"
  1935. else
  1936. echo "Disabling PIE due to missing toolchain support"
  1937. pie="no"
  1938. fi
  1939. fi
  1940. fi
  1941. ##########################################
  1942. # __sync_fetch_and_and requires at least -march=i486. Many toolchains
  1943. # use i686 as default anyway, but for those that don't, an explicit
  1944. # specification is necessary
  1945. if test "$cpu" = "i386"; then
  1946. cat > $TMPC << EOF
  1947. static int sfaa(int *ptr)
  1948. {
  1949. return __sync_fetch_and_and(ptr, 0);
  1950. }
  1951. int main(void)
  1952. {
  1953. int val = 42;
  1954. val = __sync_val_compare_and_swap(&val, 0, 1);
  1955. sfaa(&val);
  1956. return val;
  1957. }
  1958. EOF
  1959. if ! compile_prog "" "" ; then
  1960. QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
  1961. fi
  1962. fi
  1963. #########################################
  1964. # Solaris specific configure tool chain decisions
  1965. if test "$solaris" = "yes" ; then
  1966. if has $install; then
  1967. :
  1968. else
  1969. error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
  1970. "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
  1971. "to get ginstall which is used by default (which lives in /opt/csw/bin)"
  1972. fi
  1973. if test "$(path_of $install)" = "/usr/sbin/install" ; then
  1974. error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
  1975. "try ginstall from the GNU fileutils available from www.blastwave.org" \
  1976. "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
  1977. fi
  1978. if has ar; then
  1979. :
  1980. else
  1981. if test -f /usr/ccs/bin/ar ; then
  1982. error_exit "No path includes ar" \
  1983. "Add /usr/ccs/bin to your path and rerun configure"
  1984. fi
  1985. error_exit "No path includes ar"
  1986. fi
  1987. fi
  1988. if test -z "${target_list+xxx}" ; then
  1989. for target in $default_target_list; do
  1990. supported_target $target 2>/dev/null && \
  1991. target_list="$target_list $target"
  1992. done
  1993. target_list="${target_list# }"
  1994. else
  1995. target_list=$(echo "$target_list" | sed -e 's/,/ /g')
  1996. for target in $target_list; do
  1997. # Check that we recognised the target name; this allows a more
  1998. # friendly error message than if we let it fall through.
  1999. case " $default_target_list " in
  2000. *" $target "*)
  2001. ;;
  2002. *)
  2003. error_exit "Unknown target name '$target'"
  2004. ;;
  2005. esac
  2006. supported_target $target || exit 1
  2007. done
  2008. fi
  2009. # see if system emulation was really requested
  2010. case " $target_list " in
  2011. *"-softmmu "*) softmmu=yes
  2012. ;;
  2013. *) softmmu=no
  2014. ;;
  2015. esac
  2016. feature_not_found() {
  2017. feature=$1
  2018. remedy=$2
  2019. error_exit "User requested feature $feature" \
  2020. "configure was not able to find it." \
  2021. "$remedy"
  2022. }
  2023. # ---
  2024. # big/little endian test
  2025. cat > $TMPC << EOF
  2026. short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
  2027. short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
  2028. extern int foo(short *, short *);
  2029. int main(int argc, char *argv[]) {
  2030. return foo(big_endian, little_endian);
  2031. }
  2032. EOF
  2033. if compile_object ; then
  2034. if strings -a $TMPO | grep -q BiGeNdIaN ; then
  2035. bigendian="yes"
  2036. elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
  2037. bigendian="no"
  2038. else
  2039. echo big/little test failed
  2040. fi
  2041. else
  2042. echo big/little test failed
  2043. fi
  2044. ##########################################
  2045. # cocoa implies not SDL or GTK
  2046. # (the cocoa UI code currently assumes it is always the active UI
  2047. # and doesn't interact well with other UI frontend code)
  2048. if test "$cocoa" = "yes"; then
  2049. if test "$sdl" = "yes"; then
  2050. error_exit "Cocoa and SDL UIs cannot both be enabled at once"
  2051. fi
  2052. if test "$gtk" = "yes"; then
  2053. error_exit "Cocoa and GTK UIs cannot both be enabled at once"
  2054. fi
  2055. gtk=no
  2056. sdl=no
  2057. fi
  2058. # Some versions of Mac OS X incorrectly define SIZE_MAX
  2059. cat > $TMPC << EOF
  2060. #include <stdint.h>
  2061. #include <stdio.h>
  2062. int main(int argc, char *argv[]) {
  2063. return printf("%zu", SIZE_MAX);
  2064. }
  2065. EOF
  2066. have_broken_size_max=no
  2067. if ! compile_object -Werror ; then
  2068. have_broken_size_max=yes
  2069. fi
  2070. ##########################################
  2071. # L2TPV3 probe
  2072. cat > $TMPC <<EOF
  2073. #include <sys/socket.h>
  2074. #include <linux/ip.h>
  2075. int main(void) { return sizeof(struct mmsghdr); }
  2076. EOF
  2077. if compile_prog "" "" ; then
  2078. l2tpv3=yes
  2079. else
  2080. l2tpv3=no
  2081. fi
  2082. #########################################
  2083. # vhost interdependencies and host support
  2084. # vhost backends
  2085. test "$vhost_user" = "" && vhost_user=yes
  2086. if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then
  2087. error_exit "vhost-user isn't available on win32"
  2088. fi
  2089. test "$vhost_kernel" = "" && vhost_kernel=$linux
  2090. if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then
  2091. error_exit "vhost-kernel is only available on Linux"
  2092. fi
  2093. # vhost-kernel devices
  2094. test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel
  2095. if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then
  2096. error_exit "--enable-vhost-scsi requires --enable-vhost-kernel"
  2097. fi
  2098. test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel
  2099. if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then
  2100. error_exit "--enable-vhost-vsock requires --enable-vhost-kernel"
  2101. fi
  2102. # vhost-user backends
  2103. test "$vhost_net_user" = "" && vhost_net_user=$vhost_user
  2104. if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then
  2105. error_exit "--enable-vhost-net-user requires --enable-vhost-user"
  2106. fi
  2107. test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
  2108. if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
  2109. error_exit "--enable-vhost-crypto requires --enable-vhost-user"
  2110. fi
  2111. # OR the vhost-kernel and vhost-user values for simplicity
  2112. if test "$vhost_net" = ""; then
  2113. test "$vhost_net_user" = "yes" && vhost_net=yes
  2114. test "$vhost_kernel" = "yes" && vhost_net=yes
  2115. fi
  2116. ##########################################
  2117. # MinGW / Mingw-w64 localtime_r/gmtime_r check
  2118. if test "$mingw32" = "yes"; then
  2119. # Some versions of MinGW / Mingw-w64 lack localtime_r
  2120. # and gmtime_r entirely.
  2121. #
  2122. # Some versions of Mingw-w64 define a macro for
  2123. # localtime_r/gmtime_r.
  2124. #
  2125. # Some versions of Mingw-w64 will define functions
  2126. # for localtime_r/gmtime_r, but only if you have
  2127. # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun
  2128. # though, unistd.h and pthread.h both define
  2129. # that for you.
  2130. #
  2131. # So this #undef localtime_r and #include <unistd.h>
  2132. # are not in fact redundant.
  2133. cat > $TMPC << EOF
  2134. #include <unistd.h>
  2135. #include <time.h>
  2136. #undef localtime_r
  2137. int main(void) { localtime_r(NULL, NULL); return 0; }
  2138. EOF
  2139. if compile_prog "" "" ; then
  2140. localtime_r="yes"
  2141. else
  2142. localtime_r="no"
  2143. fi
  2144. fi
  2145. ##########################################
  2146. # pkg-config probe
  2147. if ! has "$pkg_config_exe"; then
  2148. error_exit "pkg-config binary '$pkg_config_exe' not found"
  2149. fi
  2150. ##########################################
  2151. # NPTL probe
  2152. if test "$linux_user" = "yes"; then
  2153. cat > $TMPC <<EOF
  2154. #include <sched.h>
  2155. #include <linux/futex.h>
  2156. int main(void) {
  2157. #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
  2158. #error bork
  2159. #endif
  2160. return 0;
  2161. }
  2162. EOF
  2163. if ! compile_object ; then
  2164. feature_not_found "nptl" "Install glibc and linux kernel headers."
  2165. fi
  2166. fi
  2167. ##########################################
  2168. # lzo check
  2169. if test "$lzo" != "no" ; then
  2170. cat > $TMPC << EOF
  2171. #include <lzo/lzo1x.h>
  2172. int main(void) { lzo_version(); return 0; }
  2173. EOF
  2174. if compile_prog "" "-llzo2" ; then
  2175. libs_softmmu="$libs_softmmu -llzo2"
  2176. lzo="yes"
  2177. else
  2178. if test "$lzo" = "yes"; then
  2179. feature_not_found "liblzo2" "Install liblzo2 devel"
  2180. fi
  2181. lzo="no"
  2182. fi
  2183. fi
  2184. ##########################################
  2185. # snappy check
  2186. if test "$snappy" != "no" ; then
  2187. cat > $TMPC << EOF
  2188. #include <snappy-c.h>
  2189. int main(void) { snappy_max_compressed_length(4096); return 0; }
  2190. EOF
  2191. if compile_prog "" "-lsnappy" ; then
  2192. libs_softmmu="$libs_softmmu -lsnappy"
  2193. snappy="yes"
  2194. else
  2195. if test "$snappy" = "yes"; then
  2196. feature_not_found "libsnappy" "Install libsnappy devel"
  2197. fi
  2198. snappy="no"
  2199. fi
  2200. fi
  2201. ##########################################
  2202. # bzip2 check
  2203. if test "$bzip2" != "no" ; then
  2204. cat > $TMPC << EOF
  2205. #include <bzlib.h>
  2206. int main(void) { BZ2_bzlibVersion(); return 0; }
  2207. EOF
  2208. if compile_prog "" "-lbz2" ; then
  2209. bzip2="yes"
  2210. else
  2211. if test "$bzip2" = "yes"; then
  2212. feature_not_found "libbzip2" "Install libbzip2 devel"
  2213. fi
  2214. bzip2="no"
  2215. fi
  2216. fi
  2217. ##########################################
  2218. # lzfse check
  2219. if test "$lzfse" != "no" ; then
  2220. cat > $TMPC << EOF
  2221. #include <lzfse.h>
  2222. int main(void) { lzfse_decode_scratch_size(); return 0; }
  2223. EOF
  2224. if compile_prog "" "-llzfse" ; then
  2225. lzfse="yes"
  2226. else
  2227. if test "$lzfse" = "yes"; then
  2228. feature_not_found "lzfse" "Install lzfse devel"
  2229. fi
  2230. lzfse="no"
  2231. fi
  2232. fi
  2233. ##########################################
  2234. # libseccomp check
  2235. if test "$seccomp" != "no" ; then
  2236. libseccomp_minver="2.3.0"
  2237. if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
  2238. seccomp_cflags="$($pkg_config --cflags libseccomp)"
  2239. seccomp_libs="$($pkg_config --libs libseccomp)"
  2240. seccomp="yes"
  2241. else
  2242. if test "$seccomp" = "yes" ; then
  2243. feature_not_found "libseccomp" \
  2244. "Install libseccomp devel >= $libseccomp_minver"
  2245. fi
  2246. seccomp="no"
  2247. fi
  2248. fi
  2249. ##########################################
  2250. # xen probe
  2251. if test "$xen" != "no" ; then
  2252. # Check whether Xen library path is specified via --extra-ldflags to avoid
  2253. # overriding this setting with pkg-config output. If not, try pkg-config
  2254. # to obtain all needed flags.
  2255. if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \
  2256. $pkg_config --exists xencontrol ; then
  2257. xen_ctrl_version="$(printf '%d%02d%02d' \
  2258. $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
  2259. xen=yes
  2260. xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
  2261. xen_pc="$xen_pc xenevtchn xendevicemodel"
  2262. if $pkg_config --exists xentoolcore; then
  2263. xen_pc="$xen_pc xentoolcore"
  2264. fi
  2265. QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
  2266. libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
  2267. else
  2268. xen_libs="-lxenstore -lxenctrl -lxenguest"
  2269. xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
  2270. # First we test whether Xen headers and libraries are available.
  2271. # If no, we are done and there is no Xen support.
  2272. # If yes, more tests are run to detect the Xen version.
  2273. # Xen (any)
  2274. cat > $TMPC <<EOF
  2275. #include <xenctrl.h>
  2276. int main(void) {
  2277. return 0;
  2278. }
  2279. EOF
  2280. if ! compile_prog "" "$xen_libs" ; then
  2281. # Xen not found
  2282. if test "$xen" = "yes" ; then
  2283. feature_not_found "xen" "Install xen devel"
  2284. fi
  2285. xen=no
  2286. # Xen unstable
  2287. elif
  2288. cat > $TMPC <<EOF &&
  2289. #undef XC_WANT_COMPAT_DEVICEMODEL_API
  2290. #define __XEN_TOOLS__
  2291. #include <xendevicemodel.h>
  2292. #include <xenforeignmemory.h>
  2293. int main(void) {
  2294. xendevicemodel_handle *xd;
  2295. xenforeignmemory_handle *xfmem;
  2296. xd = xendevicemodel_open(0, 0);
  2297. xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0);
  2298. xfmem = xenforeignmemory_open(0, 0);
  2299. xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0);
  2300. return 0;
  2301. }
  2302. EOF
  2303. compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
  2304. then
  2305. xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
  2306. xen_ctrl_version=41100
  2307. xen=yes
  2308. elif
  2309. cat > $TMPC <<EOF &&
  2310. #undef XC_WANT_COMPAT_MAP_FOREIGN_API
  2311. #include <xenforeignmemory.h>
  2312. #include <xentoolcore.h>
  2313. int main(void) {
  2314. xenforeignmemory_handle *xfmem;
  2315. xfmem = xenforeignmemory_open(0, 0);
  2316. xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0);
  2317. xentoolcore_restrict_all(0);
  2318. return 0;
  2319. }
  2320. EOF
  2321. compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
  2322. then
  2323. xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
  2324. xen_ctrl_version=41000
  2325. xen=yes
  2326. elif
  2327. cat > $TMPC <<EOF &&
  2328. #undef XC_WANT_COMPAT_DEVICEMODEL_API
  2329. #define __XEN_TOOLS__
  2330. #include <xendevicemodel.h>
  2331. int main(void) {
  2332. xendevicemodel_handle *xd;
  2333. xd = xendevicemodel_open(0, 0);
  2334. xendevicemodel_close(xd);
  2335. return 0;
  2336. }
  2337. EOF
  2338. compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
  2339. then
  2340. xen_stable_libs="-lxendevicemodel $xen_stable_libs"
  2341. xen_ctrl_version=40900
  2342. xen=yes
  2343. elif
  2344. cat > $TMPC <<EOF &&
  2345. /*
  2346. * If we have stable libs the we don't want the libxc compat
  2347. * layers, regardless of what CFLAGS we may have been given.
  2348. *
  2349. * Also, check if xengnttab_grant_copy_segment_t is defined and
  2350. * grant copy operation is implemented.
  2351. */
  2352. #undef XC_WANT_COMPAT_EVTCHN_API
  2353. #undef XC_WANT_COMPAT_GNTTAB_API
  2354. #undef XC_WANT_COMPAT_MAP_FOREIGN_API
  2355. #include <xenctrl.h>
  2356. #include <xenstore.h>
  2357. #include <xenevtchn.h>
  2358. #include <xengnttab.h>
  2359. #include <xenforeignmemory.h>
  2360. #include <stdint.h>
  2361. #include <xen/hvm/hvm_info_table.h>
  2362. #if !defined(HVM_MAX_VCPUS)
  2363. # error HVM_MAX_VCPUS not defined
  2364. #endif
  2365. int main(void) {
  2366. xc_interface *xc = NULL;
  2367. xenforeignmemory_handle *xfmem;
  2368. xenevtchn_handle *xe;
  2369. xengnttab_handle *xg;
  2370. xengnttab_grant_copy_segment_t* seg = NULL;
  2371. xs_daemon_open();
  2372. xc = xc_interface_open(0, 0, 0);
  2373. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  2374. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  2375. xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
  2376. xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
  2377. xfmem = xenforeignmemory_open(0, 0);
  2378. xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
  2379. xe = xenevtchn_open(0, 0);
  2380. xenevtchn_fd(xe);
  2381. xg = xengnttab_open(0, 0);
  2382. xengnttab_grant_copy(xg, 0, seg);
  2383. return 0;
  2384. }
  2385. EOF
  2386. compile_prog "" "$xen_libs $xen_stable_libs"
  2387. then
  2388. xen_ctrl_version=40800
  2389. xen=yes
  2390. elif
  2391. cat > $TMPC <<EOF &&
  2392. /*
  2393. * If we have stable libs the we don't want the libxc compat
  2394. * layers, regardless of what CFLAGS we may have been given.
  2395. */
  2396. #undef XC_WANT_COMPAT_EVTCHN_API
  2397. #undef XC_WANT_COMPAT_GNTTAB_API
  2398. #undef XC_WANT_COMPAT_MAP_FOREIGN_API
  2399. #include <xenctrl.h>
  2400. #include <xenstore.h>
  2401. #include <xenevtchn.h>
  2402. #include <xengnttab.h>
  2403. #include <xenforeignmemory.h>
  2404. #include <stdint.h>
  2405. #include <xen/hvm/hvm_info_table.h>
  2406. #if !defined(HVM_MAX_VCPUS)
  2407. # error HVM_MAX_VCPUS not defined
  2408. #endif
  2409. int main(void) {
  2410. xc_interface *xc = NULL;
  2411. xenforeignmemory_handle *xfmem;
  2412. xenevtchn_handle *xe;
  2413. xengnttab_handle *xg;
  2414. xs_daemon_open();
  2415. xc = xc_interface_open(0, 0, 0);
  2416. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  2417. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  2418. xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
  2419. xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
  2420. xfmem = xenforeignmemory_open(0, 0);
  2421. xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
  2422. xe = xenevtchn_open(0, 0);
  2423. xenevtchn_fd(xe);
  2424. xg = xengnttab_open(0, 0);
  2425. xengnttab_map_grant_ref(xg, 0, 0, 0);
  2426. return 0;
  2427. }
  2428. EOF
  2429. compile_prog "" "$xen_libs $xen_stable_libs"
  2430. then
  2431. xen_ctrl_version=40701
  2432. xen=yes
  2433. # Xen 4.6
  2434. elif
  2435. cat > $TMPC <<EOF &&
  2436. #include <xenctrl.h>
  2437. #include <xenstore.h>
  2438. #include <stdint.h>
  2439. #include <xen/hvm/hvm_info_table.h>
  2440. #if !defined(HVM_MAX_VCPUS)
  2441. # error HVM_MAX_VCPUS not defined
  2442. #endif
  2443. int main(void) {
  2444. xc_interface *xc;
  2445. xs_daemon_open();
  2446. xc = xc_interface_open(0, 0, 0);
  2447. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  2448. xc_gnttab_open(NULL, 0);
  2449. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  2450. xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
  2451. xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
  2452. xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
  2453. return 0;
  2454. }
  2455. EOF
  2456. compile_prog "" "$xen_libs"
  2457. then
  2458. xen_ctrl_version=40600
  2459. xen=yes
  2460. # Xen 4.5
  2461. elif
  2462. cat > $TMPC <<EOF &&
  2463. #include <xenctrl.h>
  2464. #include <xenstore.h>
  2465. #include <stdint.h>
  2466. #include <xen/hvm/hvm_info_table.h>
  2467. #if !defined(HVM_MAX_VCPUS)
  2468. # error HVM_MAX_VCPUS not defined
  2469. #endif
  2470. int main(void) {
  2471. xc_interface *xc;
  2472. xs_daemon_open();
  2473. xc = xc_interface_open(0, 0, 0);
  2474. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  2475. xc_gnttab_open(NULL, 0);
  2476. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  2477. xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
  2478. xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
  2479. return 0;
  2480. }
  2481. EOF
  2482. compile_prog "" "$xen_libs"
  2483. then
  2484. xen_ctrl_version=40500
  2485. xen=yes
  2486. elif
  2487. cat > $TMPC <<EOF &&
  2488. #include <xenctrl.h>
  2489. #include <xenstore.h>
  2490. #include <stdint.h>
  2491. #include <xen/hvm/hvm_info_table.h>
  2492. #if !defined(HVM_MAX_VCPUS)
  2493. # error HVM_MAX_VCPUS not defined
  2494. #endif
  2495. int main(void) {
  2496. xc_interface *xc;
  2497. xs_daemon_open();
  2498. xc = xc_interface_open(0, 0, 0);
  2499. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  2500. xc_gnttab_open(NULL, 0);
  2501. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  2502. xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
  2503. return 0;
  2504. }
  2505. EOF
  2506. compile_prog "" "$xen_libs"
  2507. then
  2508. xen_ctrl_version=40200
  2509. xen=yes
  2510. else
  2511. if test "$xen" = "yes" ; then
  2512. feature_not_found "xen (unsupported version)" \
  2513. "Install a supported xen (xen 4.2 or newer)"
  2514. fi
  2515. xen=no
  2516. fi
  2517. if test "$xen" = yes; then
  2518. if test $xen_ctrl_version -ge 40701 ; then
  2519. libs_softmmu="$xen_stable_libs $libs_softmmu"
  2520. fi
  2521. libs_softmmu="$xen_libs $libs_softmmu"
  2522. fi
  2523. fi
  2524. fi
  2525. if test "$xen_pci_passthrough" != "no"; then
  2526. if test "$xen" = "yes" && test "$linux" = "yes"; then
  2527. xen_pci_passthrough=yes
  2528. else
  2529. if test "$xen_pci_passthrough" = "yes"; then
  2530. error_exit "User requested feature Xen PCI Passthrough" \
  2531. " but this feature requires /sys from Linux"
  2532. fi
  2533. xen_pci_passthrough=no
  2534. fi
  2535. fi
  2536. ##########################################
  2537. # Windows Hypervisor Platform accelerator (WHPX) check
  2538. if test "$whpx" != "no" ; then
  2539. if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then
  2540. whpx="yes"
  2541. else
  2542. if test "$whpx" = "yes"; then
  2543. feature_not_found "WinHvPlatform" "WinHvEmulation is not installed"
  2544. fi
  2545. whpx="no"
  2546. fi
  2547. fi
  2548. ##########################################
  2549. # Sparse probe
  2550. if test "$sparse" != "no" ; then
  2551. if has cgcc; then
  2552. sparse=yes
  2553. else
  2554. if test "$sparse" = "yes" ; then
  2555. feature_not_found "sparse" "Install sparse binary"
  2556. fi
  2557. sparse=no
  2558. fi
  2559. fi
  2560. ##########################################
  2561. # X11 probe
  2562. if $pkg_config --exists "x11"; then
  2563. have_x11=yes
  2564. x11_cflags=$($pkg_config --cflags x11)
  2565. x11_libs=$($pkg_config --libs x11)
  2566. fi
  2567. ##########################################
  2568. # GTK probe
  2569. if test "$gtk" != "no"; then
  2570. gtkpackage="gtk+-3.0"
  2571. gtkx11package="gtk+-x11-3.0"
  2572. gtkversion="3.14.0"
  2573. if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
  2574. gtk_cflags=$($pkg_config --cflags $gtkpackage)
  2575. gtk_libs=$($pkg_config --libs $gtkpackage)
  2576. gtk_version=$($pkg_config --modversion $gtkpackage)
  2577. if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
  2578. need_x11=yes
  2579. gtk_cflags="$gtk_cflags $x11_cflags"
  2580. gtk_libs="$gtk_libs $x11_libs"
  2581. fi
  2582. gtk="yes"
  2583. elif test "$gtk" = "yes"; then
  2584. feature_not_found "gtk" "Install gtk3-devel"
  2585. else
  2586. gtk="no"
  2587. fi
  2588. fi
  2589. ##########################################
  2590. # GNUTLS probe
  2591. if test "$gnutls" != "no"; then
  2592. pass="no"
  2593. if $pkg_config --exists "gnutls >= 3.1.18"; then
  2594. gnutls_cflags=$($pkg_config --cflags gnutls)
  2595. gnutls_libs=$($pkg_config --libs gnutls)
  2596. # Packaging for the static libraries is not always correct.
  2597. # At least ubuntu 18.04 ships only shared libraries.
  2598. write_c_skeleton
  2599. if compile_prog "" "$gnutls_libs" ; then
  2600. LIBS="$gnutls_libs $LIBS"
  2601. QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
  2602. pass="yes"
  2603. fi
  2604. fi
  2605. if test "$pass" = "no" && test "$gnutls" = "yes"; then
  2606. feature_not_found "gnutls" "Install gnutls devel >= 3.1.18"
  2607. else
  2608. gnutls="$pass"
  2609. fi
  2610. fi
  2611. # If user didn't give a --disable/enable-gcrypt flag,
  2612. # then mark as disabled if user requested nettle
  2613. # explicitly
  2614. if test -z "$gcrypt"
  2615. then
  2616. if test "$nettle" = "yes"
  2617. then
  2618. gcrypt="no"
  2619. fi
  2620. fi
  2621. # If user didn't give a --disable/enable-nettle flag,
  2622. # then mark as disabled if user requested gcrypt
  2623. # explicitly
  2624. if test -z "$nettle"
  2625. then
  2626. if test "$gcrypt" = "yes"
  2627. then
  2628. nettle="no"
  2629. fi
  2630. fi
  2631. has_libgcrypt() {
  2632. if ! has "libgcrypt-config"
  2633. then
  2634. return 1
  2635. fi
  2636. if test -n "$cross_prefix"
  2637. then
  2638. host=$(libgcrypt-config --host)
  2639. if test "$host-" != $cross_prefix
  2640. then
  2641. return 1
  2642. fi
  2643. fi
  2644. maj=`libgcrypt-config --version | awk -F . '{print $1}'`
  2645. min=`libgcrypt-config --version | awk -F . '{print $2}'`
  2646. if test $maj != 1 || test $min -lt 5
  2647. then
  2648. return 1
  2649. fi
  2650. return 0
  2651. }
  2652. if test "$nettle" != "no"; then
  2653. pass="no"
  2654. if $pkg_config --exists "nettle >= 2.7.1"; then
  2655. nettle_cflags=$($pkg_config --cflags nettle)
  2656. nettle_libs=$($pkg_config --libs nettle)
  2657. nettle_version=$($pkg_config --modversion nettle)
  2658. # Link test to make sure the given libraries work (e.g for static).
  2659. write_c_skeleton
  2660. if compile_prog "" "$nettle_libs" ; then
  2661. LIBS="$nettle_libs $LIBS"
  2662. QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
  2663. if test -z "$gcrypt"; then
  2664. gcrypt="no"
  2665. fi
  2666. pass="yes"
  2667. fi
  2668. fi
  2669. if test "$pass" = "no" && test "$nettle" = "yes"; then
  2670. feature_not_found "nettle" "Install nettle devel >= 2.7.1"
  2671. else
  2672. nettle="$pass"
  2673. fi
  2674. fi
  2675. if test "$gcrypt" != "no"; then
  2676. pass="no"
  2677. if has_libgcrypt; then
  2678. gcrypt_cflags=$(libgcrypt-config --cflags)
  2679. gcrypt_libs=$(libgcrypt-config --libs)
  2680. # Debian has removed -lgpg-error from libgcrypt-config
  2681. # as it "spreads unnecessary dependencies" which in
  2682. # turn breaks static builds...
  2683. if test "$static" = "yes"
  2684. then
  2685. gcrypt_libs="$gcrypt_libs -lgpg-error"
  2686. fi
  2687. # Link test to make sure the given libraries work (e.g for static).
  2688. write_c_skeleton
  2689. if compile_prog "" "$gcrypt_libs" ; then
  2690. LIBS="$gcrypt_libs $LIBS"
  2691. QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
  2692. pass="yes"
  2693. fi
  2694. fi
  2695. if test "$pass" = "yes"; then
  2696. gcrypt="yes"
  2697. cat > $TMPC << EOF
  2698. #include <gcrypt.h>
  2699. int main(void) {
  2700. gcry_mac_hd_t handle;
  2701. gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5,
  2702. GCRY_MAC_FLAG_SECURE, NULL);
  2703. return 0;
  2704. }
  2705. EOF
  2706. if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
  2707. gcrypt_hmac=yes
  2708. fi
  2709. elif test "$gcrypt" = "yes"; then
  2710. feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0"
  2711. else
  2712. gcrypt="no"
  2713. fi
  2714. fi
  2715. if test "$gcrypt" = "yes" && test "$nettle" = "yes"
  2716. then
  2717. error_exit "Only one of gcrypt & nettle can be enabled"
  2718. fi
  2719. ##########################################
  2720. # libtasn1 - only for the TLS creds/session test suite
  2721. tasn1=yes
  2722. tasn1_cflags=""
  2723. tasn1_libs=""
  2724. if $pkg_config --exists "libtasn1"; then
  2725. tasn1_cflags=$($pkg_config --cflags libtasn1)
  2726. tasn1_libs=$($pkg_config --libs libtasn1)
  2727. else
  2728. tasn1=no
  2729. fi
  2730. ##########################################
  2731. # PAM probe
  2732. if test "$auth_pam" != "no"; then
  2733. cat > $TMPC <<EOF
  2734. #include <security/pam_appl.h>
  2735. #include <stdio.h>
  2736. int main(void) {
  2737. const char *service_name = "qemu";
  2738. const char *user = "frank";
  2739. const struct pam_conv pam_conv = { 0 };
  2740. pam_handle_t *pamh = NULL;
  2741. pam_start(service_name, user, &pam_conv, &pamh);
  2742. return 0;
  2743. }
  2744. EOF
  2745. if compile_prog "" "-lpam" ; then
  2746. auth_pam=yes
  2747. else
  2748. if test "$auth_pam" = "yes"; then
  2749. feature_not_found "PAM" "Install PAM development package"
  2750. else
  2751. auth_pam=no
  2752. fi
  2753. fi
  2754. fi
  2755. ##########################################
  2756. # getifaddrs (for tests/test-io-channel-socket )
  2757. have_ifaddrs_h=yes
  2758. if ! check_include "ifaddrs.h" ; then
  2759. have_ifaddrs_h=no
  2760. fi
  2761. ##########################################
  2762. # VTE probe
  2763. if test "$vte" != "no"; then
  2764. vteminversion="0.32.0"
  2765. if $pkg_config --exists "vte-2.91"; then
  2766. vtepackage="vte-2.91"
  2767. else
  2768. vtepackage="vte-2.90"
  2769. fi
  2770. if $pkg_config --exists "$vtepackage >= $vteminversion"; then
  2771. vte_cflags=$($pkg_config --cflags $vtepackage)
  2772. vte_libs=$($pkg_config --libs $vtepackage)
  2773. vteversion=$($pkg_config --modversion $vtepackage)
  2774. vte="yes"
  2775. elif test "$vte" = "yes"; then
  2776. feature_not_found "vte" "Install libvte-2.90/2.91 devel"
  2777. else
  2778. vte="no"
  2779. fi
  2780. fi
  2781. ##########################################
  2782. # SDL probe
  2783. # Look for sdl configuration program (pkg-config or sdl2-config). Try
  2784. # sdl2-config even without cross prefix, and favour pkg-config over sdl2-config.
  2785. sdl_probe ()
  2786. {
  2787. if $pkg_config sdl2 --exists; then
  2788. sdlconfig="$pkg_config sdl2"
  2789. sdlversion=$($sdlconfig --modversion 2>/dev/null)
  2790. elif has "$sdl2_config"; then
  2791. sdlconfig="$sdl2_config"
  2792. sdlversion=$($sdlconfig --version)
  2793. else
  2794. if test "$sdl" = "yes" ; then
  2795. feature_not_found "sdl" "Install SDL2-devel"
  2796. fi
  2797. sdl=no
  2798. # no need to do the rest
  2799. return
  2800. fi
  2801. if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl2-config; then
  2802. echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
  2803. fi
  2804. cat > $TMPC << EOF
  2805. #include <SDL.h>
  2806. #undef main /* We don't want SDL to override our main() */
  2807. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  2808. EOF
  2809. sdl_cflags=$($sdlconfig --cflags 2>/dev/null)
  2810. sdl_cflags="$sdl_cflags -Wno-undef" # workaround 2.0.8 bug
  2811. if test "$static" = "yes" ; then
  2812. if $pkg_config sdl2 --exists; then
  2813. sdl_libs=$($pkg_config sdl2 --static --libs 2>/dev/null)
  2814. else
  2815. sdl_libs=$($sdlconfig --static-libs 2>/dev/null)
  2816. fi
  2817. else
  2818. sdl_libs=$($sdlconfig --libs 2>/dev/null)
  2819. fi
  2820. if compile_prog "$sdl_cflags" "$sdl_libs" ; then
  2821. sdl=yes
  2822. # static link with sdl ? (note: sdl.pc's --static --libs is broken)
  2823. if test "$sdl" = "yes" && test "$static" = "yes" ; then
  2824. if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
  2825. sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)"
  2826. sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)"
  2827. fi
  2828. if compile_prog "$sdl_cflags" "$sdl_libs" ; then
  2829. :
  2830. else
  2831. sdl=no
  2832. fi
  2833. fi # static link
  2834. else # sdl not found
  2835. if test "$sdl" = "yes" ; then
  2836. feature_not_found "sdl" "Install SDL2 devel"
  2837. fi
  2838. sdl=no
  2839. fi # sdl compile test
  2840. }
  2841. sdl_image_probe ()
  2842. {
  2843. if test "$sdl_image" != "no" ; then
  2844. if $pkg_config SDL2_image --exists; then
  2845. if test "$static" = "yes"; then
  2846. sdl_image_libs=$($pkg_config SDL2_image --libs --static 2>/dev/null)
  2847. else
  2848. sdl_image_libs=$($pkg_config SDL2_image --libs 2>/dev/null)
  2849. fi
  2850. sdl_image_cflags=$($pkg_config SDL2_image --cflags 2>/dev/null)
  2851. sdl_image=yes
  2852. sdl_cflags="$sdl_cflags $sdl_image_cflags"
  2853. sdl_libs="$sdl_libs $sdl_image_libs"
  2854. else
  2855. if test "$sdl_image" = "yes" ; then
  2856. feature_not_found "sdl_image" "Install SDL Image devel"
  2857. else
  2858. sdl_image=no
  2859. fi
  2860. fi
  2861. fi
  2862. }
  2863. if test "$sdl" != "no" ; then
  2864. sdl_probe
  2865. fi
  2866. if test "$sdl" = "yes" ; then
  2867. sdl_image_probe
  2868. else
  2869. if test "$sdl_image" = "yes"; then
  2870. echo "warning: SDL Image requested, but SDL is not available, disabling"
  2871. fi
  2872. sdl_image=no
  2873. fi
  2874. if test "$sdl" = "yes" ; then
  2875. cat > $TMPC <<EOF
  2876. #include <SDL.h>
  2877. #if defined(SDL_VIDEO_DRIVER_X11)
  2878. #include <X11/XKBlib.h>
  2879. #else
  2880. #error No x11 support
  2881. #endif
  2882. int main(void) { return 0; }
  2883. EOF
  2884. if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then
  2885. need_x11=yes
  2886. sdl_cflags="$sdl_cflags $x11_cflags"
  2887. sdl_libs="$sdl_libs $x11_libs"
  2888. fi
  2889. fi
  2890. ##########################################
  2891. # RDMA needs OpenFabrics libraries
  2892. if test "$rdma" != "no" ; then
  2893. cat > $TMPC <<EOF
  2894. #include <rdma/rdma_cma.h>
  2895. int main(void) { return 0; }
  2896. EOF
  2897. rdma_libs="-lrdmacm -libverbs -libumad"
  2898. if compile_prog "" "$rdma_libs" ; then
  2899. rdma="yes"
  2900. libs_softmmu="$libs_softmmu $rdma_libs"
  2901. else
  2902. if test "$rdma" = "yes" ; then
  2903. error_exit \
  2904. " OpenFabrics librdmacm/libibverbs/libibumad not present." \
  2905. " Your options:" \
  2906. " (1) Fast: Install infiniband packages (devel) from your distro." \
  2907. " (2) Cleanest: Install libraries from www.openfabrics.org" \
  2908. " (3) Also: Install softiwarp if you don't have RDMA hardware"
  2909. fi
  2910. rdma="no"
  2911. fi
  2912. fi
  2913. ##########################################
  2914. # PVRDMA detection
  2915. cat > $TMPC <<EOF &&
  2916. #include <sys/mman.h>
  2917. int
  2918. main(void)
  2919. {
  2920. char buf = 0;
  2921. void *addr = &buf;
  2922. addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED);
  2923. return 0;
  2924. }
  2925. EOF
  2926. if test "$rdma" = "yes" ; then
  2927. case "$pvrdma" in
  2928. "")
  2929. if compile_prog "" ""; then
  2930. pvrdma="yes"
  2931. else
  2932. pvrdma="no"
  2933. fi
  2934. ;;
  2935. "yes")
  2936. if ! compile_prog "" ""; then
  2937. error_exit "PVRDMA is not supported since mremap is not implemented"
  2938. fi
  2939. pvrdma="yes"
  2940. ;;
  2941. "no")
  2942. pvrdma="no"
  2943. ;;
  2944. esac
  2945. else
  2946. if test "$pvrdma" = "yes" ; then
  2947. error_exit "PVRDMA requires rdma suppport"
  2948. fi
  2949. pvrdma="no"
  2950. fi
  2951. ##########################################
  2952. # VNC SASL detection
  2953. if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then
  2954. cat > $TMPC <<EOF
  2955. #include <sasl/sasl.h>
  2956. #include <stdio.h>
  2957. int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
  2958. EOF
  2959. # Assuming Cyrus-SASL installed in /usr prefix
  2960. vnc_sasl_cflags=""
  2961. vnc_sasl_libs="-lsasl2"
  2962. if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
  2963. vnc_sasl=yes
  2964. libs_softmmu="$vnc_sasl_libs $libs_softmmu"
  2965. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
  2966. else
  2967. if test "$vnc_sasl" = "yes" ; then
  2968. feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
  2969. fi
  2970. vnc_sasl=no
  2971. fi
  2972. fi
  2973. ##########################################
  2974. # VNC JPEG detection
  2975. if test "$vnc" = "yes" && test "$vnc_jpeg" != "no" ; then
  2976. cat > $TMPC <<EOF
  2977. #include <stdio.h>
  2978. #include <jpeglib.h>
  2979. int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
  2980. EOF
  2981. vnc_jpeg_cflags=""
  2982. vnc_jpeg_libs="-ljpeg"
  2983. if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
  2984. vnc_jpeg=yes
  2985. libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
  2986. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
  2987. else
  2988. if test "$vnc_jpeg" = "yes" ; then
  2989. feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
  2990. fi
  2991. vnc_jpeg=no
  2992. fi
  2993. fi
  2994. ##########################################
  2995. # VNC PNG detection
  2996. if test "$vnc" = "yes" && test "$vnc_png" != "no" ; then
  2997. cat > $TMPC <<EOF
  2998. //#include <stdio.h>
  2999. #include <png.h>
  3000. #include <stddef.h>
  3001. int main(void) {
  3002. png_structp png_ptr;
  3003. png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
  3004. return png_ptr != 0;
  3005. }
  3006. EOF
  3007. if $pkg_config libpng --exists; then
  3008. vnc_png_cflags=$($pkg_config libpng --cflags)
  3009. vnc_png_libs=$($pkg_config libpng --libs)
  3010. else
  3011. vnc_png_cflags=""
  3012. vnc_png_libs="-lpng"
  3013. fi
  3014. if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
  3015. vnc_png=yes
  3016. libs_softmmu="$vnc_png_libs $libs_softmmu"
  3017. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
  3018. else
  3019. if test "$vnc_png" = "yes" ; then
  3020. feature_not_found "vnc-png" "Install libpng devel"
  3021. fi
  3022. vnc_png=no
  3023. fi
  3024. fi
  3025. ##########################################
  3026. # xkbcommon probe
  3027. if test "$xkbcommon" != "no" ; then
  3028. if $pkg_config xkbcommon --exists; then
  3029. xkbcommon_cflags=$($pkg_config xkbcommon --cflags)
  3030. xkbcommon_libs=$($pkg_config xkbcommon --libs)
  3031. xkbcommon=yes
  3032. else
  3033. if test "$xkbcommon" = "yes" ; then
  3034. feature_not_found "xkbcommon" "Install libxkbcommon-devel"
  3035. fi
  3036. xkbcommon=no
  3037. fi
  3038. fi
  3039. ##########################################
  3040. # xfsctl() probe, used for file-posix.c
  3041. if test "$xfs" != "no" ; then
  3042. cat > $TMPC << EOF
  3043. #include <stddef.h> /* NULL */
  3044. #include <xfs/xfs.h>
  3045. int main(void)
  3046. {
  3047. xfsctl(NULL, 0, 0, NULL);
  3048. return 0;
  3049. }
  3050. EOF
  3051. if compile_prog "" "" ; then
  3052. xfs="yes"
  3053. else
  3054. if test "$xfs" = "yes" ; then
  3055. feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
  3056. fi
  3057. xfs=no
  3058. fi
  3059. fi
  3060. ##########################################
  3061. # vde libraries probe
  3062. if test "$vde" != "no" ; then
  3063. vde_libs="-lvdeplug"
  3064. cat > $TMPC << EOF
  3065. #include <libvdeplug.h>
  3066. int main(void)
  3067. {
  3068. struct vde_open_args a = {0, 0, 0};
  3069. char s[] = "";
  3070. vde_open(s, s, &a);
  3071. return 0;
  3072. }
  3073. EOF
  3074. if compile_prog "" "$vde_libs" ; then
  3075. vde=yes
  3076. else
  3077. if test "$vde" = "yes" ; then
  3078. feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
  3079. fi
  3080. vde=no
  3081. fi
  3082. fi
  3083. ##########################################
  3084. # netmap support probe
  3085. # Apart from looking for netmap headers, we make sure that the host API version
  3086. # supports the netmap backend (>=11). The upper bound (15) is meant to simulate
  3087. # a minor/major version number. Minor new features will be marked with values up
  3088. # to 15, and if something happens that requires a change to the backend we will
  3089. # move above 15, submit the backend fixes and modify this two bounds.
  3090. if test "$netmap" != "no" ; then
  3091. cat > $TMPC << EOF
  3092. #include <inttypes.h>
  3093. #include <net/if.h>
  3094. #include <net/netmap.h>
  3095. #include <net/netmap_user.h>
  3096. #if (NETMAP_API < 11) || (NETMAP_API > 15)
  3097. #error
  3098. #endif
  3099. int main(void) { return 0; }
  3100. EOF
  3101. if compile_prog "" "" ; then
  3102. netmap=yes
  3103. else
  3104. if test "$netmap" = "yes" ; then
  3105. feature_not_found "netmap"
  3106. fi
  3107. netmap=no
  3108. fi
  3109. fi
  3110. ##########################################
  3111. # libcap-ng library probe
  3112. if test "$cap_ng" != "no" ; then
  3113. cap_libs="-lcap-ng"
  3114. cat > $TMPC << EOF
  3115. #include <cap-ng.h>
  3116. int main(void)
  3117. {
  3118. capng_capability_to_name(CAPNG_EFFECTIVE);
  3119. return 0;
  3120. }
  3121. EOF
  3122. if compile_prog "" "$cap_libs" ; then
  3123. cap_ng=yes
  3124. libs_tools="$cap_libs $libs_tools"
  3125. else
  3126. if test "$cap_ng" = "yes" ; then
  3127. feature_not_found "cap_ng" "Install libcap-ng devel"
  3128. fi
  3129. cap_ng=no
  3130. fi
  3131. fi
  3132. ##########################################
  3133. # Sound support libraries probe
  3134. audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g')
  3135. for drv in $audio_drv_list; do
  3136. case $drv in
  3137. alsa | try-alsa)
  3138. if $pkg_config alsa --exists; then
  3139. alsa_libs=$($pkg_config alsa --libs)
  3140. if test "$drv" = "try-alsa"; then
  3141. audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa/alsa/')
  3142. fi
  3143. else
  3144. if test "$drv" = "try-alsa"; then
  3145. audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-alsa//')
  3146. else
  3147. error_exit "$drv check failed" \
  3148. "Make sure to have the $drv libs and headers installed."
  3149. fi
  3150. fi
  3151. ;;
  3152. pa | try-pa)
  3153. if $pkg_config libpulse --exists; then
  3154. pulse_libs=$($pkg_config libpulse --libs)
  3155. audio_pt_int="yes"
  3156. if test "$drv" = "try-pa"; then
  3157. audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa/pa/')
  3158. fi
  3159. else
  3160. if test "$drv" = "try-pa"; then
  3161. audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-pa//')
  3162. else
  3163. error_exit "$drv check failed" \
  3164. "Make sure to have the $drv libs and headers installed."
  3165. fi
  3166. fi
  3167. ;;
  3168. sdl)
  3169. if test "$sdl" = "no"; then
  3170. error_exit "sdl not found or disabled, can not use sdl audio driver"
  3171. fi
  3172. ;;
  3173. try-sdl)
  3174. if test "$sdl" = "no"; then
  3175. audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl//')
  3176. else
  3177. audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-sdl/sdl/')
  3178. fi
  3179. ;;
  3180. coreaudio)
  3181. coreaudio_libs="-framework CoreAudio"
  3182. ;;
  3183. dsound)
  3184. dsound_libs="-lole32 -ldxguid"
  3185. audio_win_int="yes"
  3186. ;;
  3187. oss)
  3188. oss_libs="$oss_lib"
  3189. ;;
  3190. *)
  3191. echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
  3192. error_exit "Unknown driver '$drv' selected" \
  3193. "Possible drivers are: $audio_possible_drivers"
  3194. }
  3195. ;;
  3196. esac
  3197. done
  3198. ##########################################
  3199. # BrlAPI probe
  3200. if test "$brlapi" != "no" ; then
  3201. brlapi_libs="-lbrlapi"
  3202. cat > $TMPC << EOF
  3203. #include <brlapi.h>
  3204. #include <stddef.h>
  3205. int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
  3206. EOF
  3207. if compile_prog "" "$brlapi_libs" ; then
  3208. brlapi=yes
  3209. else
  3210. if test "$brlapi" = "yes" ; then
  3211. feature_not_found "brlapi" "Install brlapi devel"
  3212. fi
  3213. brlapi=no
  3214. fi
  3215. fi
  3216. ##########################################
  3217. # iconv probe
  3218. if test "$iconv" != "no" ; then
  3219. cat > $TMPC << EOF
  3220. #include <iconv.h>
  3221. int main(void) {
  3222. iconv_t conv = iconv_open("WCHAR_T", "UCS-2");
  3223. return conv != (iconv_t) -1;
  3224. }
  3225. EOF
  3226. iconv_prefix_list="/usr/local:/usr"
  3227. iconv_lib_list=":-liconv"
  3228. IFS=:
  3229. for iconv_prefix in $iconv_prefix_list; do
  3230. IFS=:
  3231. iconv_cflags="-I$iconv_prefix/include"
  3232. iconv_ldflags="-L$iconv_prefix/lib"
  3233. for iconv_link in $iconv_lib_list; do
  3234. unset IFS
  3235. iconv_lib="$iconv_ldflags $iconv_link"
  3236. echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> config.log
  3237. if compile_prog "$iconv_cflags" "$iconv_lib" ; then
  3238. iconv_found=yes
  3239. break
  3240. fi
  3241. done
  3242. if test "$iconv_found" = yes ; then
  3243. break
  3244. fi
  3245. done
  3246. if test "$iconv_found" = "yes" ; then
  3247. iconv=yes
  3248. else
  3249. if test "$iconv" = "yes" ; then
  3250. feature_not_found "iconv" "Install iconv devel"
  3251. fi
  3252. iconv=no
  3253. fi
  3254. fi
  3255. ##########################################
  3256. # curses probe
  3257. if test "$iconv" = "no" ; then
  3258. # curses will need iconv
  3259. curses=no
  3260. fi
  3261. if test "$curses" != "no" ; then
  3262. if test "$mingw32" = "yes" ; then
  3263. curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
  3264. curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
  3265. else
  3266. curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
  3267. curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
  3268. fi
  3269. curses_found=no
  3270. cat > $TMPC << EOF
  3271. #include <locale.h>
  3272. #include <curses.h>
  3273. #include <wchar.h>
  3274. #include <langinfo.h>
  3275. int main(void) {
  3276. const char *codeset;
  3277. wchar_t wch = L'w';
  3278. setlocale(LC_ALL, "");
  3279. resize_term(0, 0);
  3280. addwstr(L"wide chars\n");
  3281. addnwstr(&wch, 1);
  3282. add_wch(WACS_DEGREE);
  3283. codeset = nl_langinfo(CODESET);
  3284. return codeset != 0;
  3285. }
  3286. EOF
  3287. IFS=:
  3288. for curses_inc in $curses_inc_list; do
  3289. # Make sure we get the wide character prototypes
  3290. curses_inc="-DNCURSES_WIDECHAR $curses_inc"
  3291. IFS=:
  3292. for curses_lib in $curses_lib_list; do
  3293. unset IFS
  3294. if compile_prog "$curses_inc" "$curses_lib" ; then
  3295. curses_found=yes
  3296. break
  3297. fi
  3298. done
  3299. if test "$curses_found" = yes ; then
  3300. break
  3301. fi
  3302. done
  3303. unset IFS
  3304. if test "$curses_found" = "yes" ; then
  3305. curses=yes
  3306. else
  3307. if test "$curses" = "yes" ; then
  3308. feature_not_found "curses" "Install ncurses devel"
  3309. fi
  3310. curses=no
  3311. fi
  3312. fi
  3313. ##########################################
  3314. # curl probe
  3315. if test "$curl" != "no" ; then
  3316. if $pkg_config libcurl --exists; then
  3317. curlconfig="$pkg_config libcurl"
  3318. else
  3319. curlconfig=curl-config
  3320. fi
  3321. cat > $TMPC << EOF
  3322. #include <curl/curl.h>
  3323. int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
  3324. EOF
  3325. curl_cflags=$($curlconfig --cflags 2>/dev/null)
  3326. curl_libs=$($curlconfig --libs 2>/dev/null)
  3327. if compile_prog "$curl_cflags" "$curl_libs" ; then
  3328. curl=yes
  3329. else
  3330. if test "$curl" = "yes" ; then
  3331. feature_not_found "curl" "Install libcurl devel"
  3332. fi
  3333. curl=no
  3334. fi
  3335. fi # test "$curl"
  3336. ##########################################
  3337. # bluez support probe
  3338. if test "$bluez" != "no" ; then
  3339. cat > $TMPC << EOF
  3340. #include <bluetooth/bluetooth.h>
  3341. int main(void) { return bt_error(0); }
  3342. EOF
  3343. bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null)
  3344. bluez_libs=$($pkg_config --libs bluez 2>/dev/null)
  3345. if compile_prog "$bluez_cflags" "$bluez_libs" ; then
  3346. bluez=yes
  3347. libs_softmmu="$bluez_libs $libs_softmmu"
  3348. else
  3349. if test "$bluez" = "yes" ; then
  3350. feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
  3351. fi
  3352. bluez="no"
  3353. fi
  3354. fi
  3355. ##########################################
  3356. # glib support probe
  3357. glib_req_ver=2.48
  3358. glib_modules=gthread-2.0
  3359. if test "$modules" = yes; then
  3360. glib_modules="$glib_modules gmodule-export-2.0"
  3361. fi
  3362. # This workaround is required due to a bug in pkg-config file for glib as it
  3363. # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
  3364. if test "$static" = yes && test "$mingw32" = yes; then
  3365. QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS"
  3366. fi
  3367. for i in $glib_modules; do
  3368. if $pkg_config --atleast-version=$glib_req_ver $i; then
  3369. glib_cflags=$($pkg_config --cflags $i)
  3370. glib_libs=$($pkg_config --libs $i)
  3371. QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS"
  3372. LIBS="$glib_libs $LIBS"
  3373. libs_qga="$glib_libs $libs_qga"
  3374. else
  3375. error_exit "glib-$glib_req_ver $i is required to compile QEMU"
  3376. fi
  3377. done
  3378. if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
  3379. gio=yes
  3380. gio_cflags=$($pkg_config --cflags gio-2.0)
  3381. gio_libs=$($pkg_config --libs gio-2.0)
  3382. else
  3383. gio=no
  3384. fi
  3385. # Sanity check that the current size_t matches the
  3386. # size that glib thinks it should be. This catches
  3387. # problems on multi-arch where people try to build
  3388. # 32-bit QEMU while pointing at 64-bit glib headers
  3389. cat > $TMPC <<EOF
  3390. #include <glib.h>
  3391. #include <unistd.h>
  3392. #define QEMU_BUILD_BUG_ON(x) \
  3393. typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
  3394. int main(void) {
  3395. QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T);
  3396. return 0;
  3397. }
  3398. EOF
  3399. if ! compile_prog "$CFLAGS" "$LIBS" ; then
  3400. error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
  3401. "You probably need to set PKG_CONFIG_LIBDIR"\
  3402. "to point to the right pkg-config files for your"\
  3403. "build target"
  3404. fi
  3405. # Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage
  3406. cat > $TMPC << EOF
  3407. #include <glib.h>
  3408. int main(void) { return 0; }
  3409. EOF
  3410. if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
  3411. if cc_has_warning_flag "-Wno-unknown-attributes"; then
  3412. glib_cflags="-Wno-unknown-attributes $glib_cflags"
  3413. CFLAGS="-Wno-unknown-attributes $CFLAGS"
  3414. fi
  3415. fi
  3416. #########################################
  3417. # zlib check
  3418. if test "$zlib" != "no" ; then
  3419. if $pkg_config --exists zlib; then
  3420. zlib_cflags=$($pkg_config --cflags zlib)
  3421. zlib_libs=$($pkg_config --libs zlib)
  3422. QEMU_CFLAGS="$zlib_cflags $QEMU_CFLAGS"
  3423. LIBS="$zlib_libs $LIBS"
  3424. else
  3425. cat > $TMPC << EOF
  3426. #include <zlib.h>
  3427. int main(void) { zlibVersion(); return 0; }
  3428. EOF
  3429. if compile_prog "" "-lz" ; then
  3430. LIBS="$LIBS -lz"
  3431. else
  3432. error_exit "zlib check failed" \
  3433. "Make sure to have the zlib libs and headers installed."
  3434. fi
  3435. fi
  3436. fi
  3437. ##########################################
  3438. # SHA command probe for modules
  3439. if test "$modules" = yes; then
  3440. shacmd_probe="sha1sum sha1 shasum"
  3441. for c in $shacmd_probe; do
  3442. if has $c; then
  3443. shacmd="$c"
  3444. break
  3445. fi
  3446. done
  3447. if test "$shacmd" = ""; then
  3448. error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
  3449. fi
  3450. fi
  3451. ##########################################
  3452. # pixman support probe
  3453. if test "$want_tools" = "no" && test "$softmmu" = "no"; then
  3454. pixman_cflags=
  3455. pixman_libs=
  3456. elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
  3457. pixman_cflags=$($pkg_config --cflags pixman-1)
  3458. pixman_libs=$($pkg_config --libs pixman-1)
  3459. else
  3460. error_exit "pixman >= 0.21.8 not present." \
  3461. "Please install the pixman devel package."
  3462. fi
  3463. ##########################################
  3464. # libmpathpersist probe
  3465. if test "$mpath" != "no" ; then
  3466. # probe for the new API
  3467. cat > $TMPC <<EOF
  3468. #include <libudev.h>
  3469. #include <mpath_persist.h>
  3470. unsigned mpath_mx_alloc_len = 1024;
  3471. int logsink;
  3472. static struct config *multipath_conf;
  3473. extern struct udev *udev;
  3474. extern struct config *get_multipath_config(void);
  3475. extern void put_multipath_config(struct config *conf);
  3476. struct udev *udev;
  3477. struct config *get_multipath_config(void) { return multipath_conf; }
  3478. void put_multipath_config(struct config *conf) { }
  3479. int main(void) {
  3480. udev = udev_new();
  3481. multipath_conf = mpath_lib_init();
  3482. return 0;
  3483. }
  3484. EOF
  3485. if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then
  3486. mpathpersist=yes
  3487. mpathpersist_new_api=yes
  3488. else
  3489. # probe for the old API
  3490. cat > $TMPC <<EOF
  3491. #include <libudev.h>
  3492. #include <mpath_persist.h>
  3493. unsigned mpath_mx_alloc_len = 1024;
  3494. int logsink;
  3495. int main(void) {
  3496. struct udev *udev = udev_new();
  3497. mpath_lib_init(udev);
  3498. return 0;
  3499. }
  3500. EOF
  3501. if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then
  3502. mpathpersist=yes
  3503. mpathpersist_new_api=no
  3504. else
  3505. mpathpersist=no
  3506. fi
  3507. fi
  3508. else
  3509. mpathpersist=no
  3510. fi
  3511. ##########################################
  3512. # libcap probe
  3513. if test "$cap" != "no" ; then
  3514. cat > $TMPC <<EOF
  3515. #include <stdio.h>
  3516. #include <sys/capability.h>
  3517. int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
  3518. EOF
  3519. if compile_prog "" "-lcap" ; then
  3520. cap=yes
  3521. else
  3522. cap=no
  3523. fi
  3524. fi
  3525. ##########################################
  3526. # pthread probe
  3527. PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
  3528. pthread=no
  3529. cat > $TMPC << EOF
  3530. #include <pthread.h>
  3531. static void *f(void *p) { return NULL; }
  3532. int main(void) {
  3533. pthread_t thread;
  3534. pthread_create(&thread, 0, f, 0);
  3535. return 0;
  3536. }
  3537. EOF
  3538. if compile_prog "" "" ; then
  3539. pthread=yes
  3540. else
  3541. for pthread_lib in $PTHREADLIBS_LIST; do
  3542. if compile_prog "" "$pthread_lib" ; then
  3543. pthread=yes
  3544. found=no
  3545. for lib_entry in $LIBS; do
  3546. if test "$lib_entry" = "$pthread_lib"; then
  3547. found=yes
  3548. break
  3549. fi
  3550. done
  3551. if test "$found" = "no"; then
  3552. LIBS="$pthread_lib $LIBS"
  3553. libs_qga="$pthread_lib $libs_qga"
  3554. fi
  3555. PTHREAD_LIB="$pthread_lib"
  3556. break
  3557. fi
  3558. done
  3559. fi
  3560. if test "$mingw32" != yes && test "$pthread" = no; then
  3561. error_exit "pthread check failed" \
  3562. "Make sure to have the pthread libs and headers installed."
  3563. fi
  3564. # check for pthread_setname_np with thread id
  3565. pthread_setname_np_w_tid=no
  3566. cat > $TMPC << EOF
  3567. #include <pthread.h>
  3568. static void *f(void *p) { return NULL; }
  3569. int main(void)
  3570. {
  3571. pthread_t thread;
  3572. pthread_create(&thread, 0, f, 0);
  3573. pthread_setname_np(thread, "QEMU");
  3574. return 0;
  3575. }
  3576. EOF
  3577. if compile_prog "" "$pthread_lib" ; then
  3578. pthread_setname_np_w_tid=yes
  3579. fi
  3580. # check for pthread_setname_np without thread id
  3581. pthread_setname_np_wo_tid=no
  3582. cat > $TMPC << EOF
  3583. #include <pthread.h>
  3584. static void *f(void *p) { pthread_setname_np("QEMU"); }
  3585. int main(void)
  3586. {
  3587. pthread_t thread;
  3588. pthread_create(&thread, 0, f, 0);
  3589. return 0;
  3590. }
  3591. EOF
  3592. if compile_prog "" "$pthread_lib" ; then
  3593. pthread_setname_np_wo_tid=yes
  3594. fi
  3595. ##########################################
  3596. # rbd probe
  3597. if test "$rbd" != "no" ; then
  3598. cat > $TMPC <<EOF
  3599. #include <stdio.h>
  3600. #include <rbd/librbd.h>
  3601. int main(void) {
  3602. rados_t cluster;
  3603. rados_create(&cluster, NULL);
  3604. return 0;
  3605. }
  3606. EOF
  3607. rbd_libs="-lrbd -lrados"
  3608. if compile_prog "" "$rbd_libs" ; then
  3609. rbd=yes
  3610. else
  3611. if test "$rbd" = "yes" ; then
  3612. feature_not_found "rados block device" "Install librbd/ceph devel"
  3613. fi
  3614. rbd=no
  3615. fi
  3616. fi
  3617. ##########################################
  3618. # libssh probe
  3619. if test "$libssh" != "no" ; then
  3620. if $pkg_config --exists libssh; then
  3621. libssh_cflags=$($pkg_config libssh --cflags)
  3622. libssh_libs=$($pkg_config libssh --libs)
  3623. libssh=yes
  3624. else
  3625. if test "$libssh" = "yes" ; then
  3626. error_exit "libssh required for --enable-libssh"
  3627. fi
  3628. libssh=no
  3629. fi
  3630. fi
  3631. ##########################################
  3632. # Check for libssh 0.8
  3633. # This is done like this instead of using the LIBSSH_VERSION_* and
  3634. # SSH_VERSION_* macros because some distributions in the past shipped
  3635. # snapshots of the future 0.8 from Git, and those snapshots did not
  3636. # have updated version numbers (still referring to 0.7.0).
  3637. if test "$libssh" = "yes"; then
  3638. cat > $TMPC <<EOF
  3639. #include <libssh/libssh.h>
  3640. int main(void) { return ssh_get_server_publickey(NULL, NULL); }
  3641. EOF
  3642. if compile_prog "$libssh_cflags" "$libssh_libs"; then
  3643. libssh_cflags="-DHAVE_LIBSSH_0_8 $libssh_cflags"
  3644. fi
  3645. fi
  3646. ##########################################
  3647. # linux-aio probe
  3648. if test "$linux_aio" != "no" ; then
  3649. cat > $TMPC <<EOF
  3650. #include <libaio.h>
  3651. #include <sys/eventfd.h>
  3652. #include <stddef.h>
  3653. int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
  3654. EOF
  3655. if compile_prog "" "-laio" ; then
  3656. linux_aio=yes
  3657. else
  3658. if test "$linux_aio" = "yes" ; then
  3659. feature_not_found "linux AIO" "Install libaio devel"
  3660. fi
  3661. linux_aio=no
  3662. fi
  3663. fi
  3664. ##########################################
  3665. # TPM emulation is only on POSIX
  3666. if test "$tpm" = ""; then
  3667. if test "$mingw32" = "yes"; then
  3668. tpm=no
  3669. else
  3670. tpm=yes
  3671. fi
  3672. elif test "$tpm" = "yes"; then
  3673. if test "$mingw32" = "yes" ; then
  3674. error_exit "TPM emulation only available on POSIX systems"
  3675. fi
  3676. fi
  3677. ##########################################
  3678. # attr probe
  3679. if test "$attr" != "no" ; then
  3680. cat > $TMPC <<EOF
  3681. #include <stdio.h>
  3682. #include <sys/types.h>
  3683. #ifdef CONFIG_LIBATTR
  3684. #include <attr/xattr.h>
  3685. #else
  3686. #include <sys/xattr.h>
  3687. #endif
  3688. int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
  3689. EOF
  3690. if compile_prog "" "" ; then
  3691. attr=yes
  3692. # Older distros have <attr/xattr.h>, and need -lattr:
  3693. elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
  3694. attr=yes
  3695. LIBS="-lattr $LIBS"
  3696. libattr=yes
  3697. else
  3698. if test "$attr" = "yes" ; then
  3699. feature_not_found "ATTR" "Install libc6 or libattr devel"
  3700. fi
  3701. attr=no
  3702. fi
  3703. fi
  3704. ##########################################
  3705. # iovec probe
  3706. cat > $TMPC <<EOF
  3707. #include <sys/types.h>
  3708. #include <sys/uio.h>
  3709. #include <unistd.h>
  3710. int main(void) { return sizeof(struct iovec); }
  3711. EOF
  3712. iovec=no
  3713. if compile_prog "" "" ; then
  3714. iovec=yes
  3715. fi
  3716. ##########################################
  3717. # preadv probe
  3718. cat > $TMPC <<EOF
  3719. #include <sys/types.h>
  3720. #include <sys/uio.h>
  3721. #include <unistd.h>
  3722. int main(void) { return preadv(0, 0, 0, 0); }
  3723. EOF
  3724. preadv=no
  3725. if compile_prog "" "" ; then
  3726. preadv=yes
  3727. fi
  3728. ##########################################
  3729. # fdt probe
  3730. # fdt support is mandatory for at least some target architectures,
  3731. # so insist on it if we're building those system emulators.
  3732. fdt_required=no
  3733. for target in $target_list; do
  3734. case $target in
  3735. aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu|riscv*-softmmu)
  3736. fdt_required=yes
  3737. ;;
  3738. esac
  3739. done
  3740. if test "$fdt_required" = "yes"; then
  3741. if test "$fdt" = "no"; then
  3742. error_exit "fdt disabled but some requested targets require it." \
  3743. "You can turn off fdt only if you also disable all the system emulation" \
  3744. "targets which need it (by specifying a cut down --target-list)."
  3745. fi
  3746. fdt=yes
  3747. fi
  3748. if test "$fdt" != "no" ; then
  3749. fdt_libs="-lfdt"
  3750. # explicitly check for libfdt_env.h as it is missing in some stable installs
  3751. # and test for required functions to make sure we are on a version >= 1.4.2
  3752. cat > $TMPC << EOF
  3753. #include <libfdt.h>
  3754. #include <libfdt_env.h>
  3755. int main(void) { fdt_check_full(NULL, 0); return 0; }
  3756. EOF
  3757. if compile_prog "" "$fdt_libs" ; then
  3758. # system DTC is good - use it
  3759. fdt=system
  3760. else
  3761. # have GIT checkout, so activate dtc submodule
  3762. if test -e "${source_path}/.git" ; then
  3763. git_submodules="${git_submodules} dtc"
  3764. fi
  3765. if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
  3766. fdt=git
  3767. mkdir -p dtc
  3768. if [ "$pwd_is_source_path" != "y" ] ; then
  3769. symlink "$source_path/dtc/Makefile" "dtc/Makefile"
  3770. symlink "$source_path/dtc/scripts" "dtc/scripts"
  3771. fi
  3772. fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
  3773. fdt_ldflags="-L\$(BUILD_DIR)/dtc/libfdt"
  3774. fdt_libs="$fdt_libs"
  3775. elif test "$fdt" = "yes" ; then
  3776. # Not a git build & no libfdt found, prompt for system install
  3777. error_exit "DTC (libfdt) version >= 1.4.2 not present." \
  3778. "Please install the DTC (libfdt) devel package"
  3779. else
  3780. # don't have and don't want
  3781. fdt_libs=
  3782. fdt=no
  3783. fi
  3784. fi
  3785. fi
  3786. libs_softmmu="$libs_softmmu $fdt_libs"
  3787. ##########################################
  3788. # opengl probe (for sdl2, gtk, milkymist-tmu2)
  3789. gbm="no"
  3790. if $pkg_config gbm; then
  3791. gbm_cflags="$($pkg_config --cflags gbm)"
  3792. gbm_libs="$($pkg_config --libs gbm)"
  3793. gbm="yes"
  3794. fi
  3795. if test "$opengl" != "no" ; then
  3796. opengl_pkgs="epoxy gbm"
  3797. if $pkg_config $opengl_pkgs; then
  3798. opengl_cflags="$($pkg_config --cflags $opengl_pkgs)"
  3799. opengl_libs="$($pkg_config --libs $opengl_pkgs)"
  3800. opengl=yes
  3801. if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
  3802. gtk_gl="yes"
  3803. fi
  3804. QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
  3805. else
  3806. if test "$opengl" = "yes" ; then
  3807. feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
  3808. fi
  3809. opengl_cflags=""
  3810. opengl_libs=""
  3811. opengl=no
  3812. fi
  3813. fi
  3814. if test "$opengl" = "yes"; then
  3815. cat > $TMPC << EOF
  3816. #include <epoxy/egl.h>
  3817. #ifndef EGL_MESA_image_dma_buf_export
  3818. # error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
  3819. #endif
  3820. int main(void) { return 0; }
  3821. EOF
  3822. if compile_prog "" "" ; then
  3823. opengl_dmabuf=yes
  3824. fi
  3825. fi
  3826. if test "$opengl" = "yes" && test "$have_x11" = "yes"; then
  3827. for target in $target_list; do
  3828. case $target in
  3829. lm32-softmmu) # milkymist-tmu2 requires X11 and OpenGL
  3830. need_x11=yes
  3831. ;;
  3832. esac
  3833. done
  3834. fi
  3835. ##########################################
  3836. # libxml2 probe
  3837. if test "$libxml2" != "no" ; then
  3838. if $pkg_config --exists libxml-2.0; then
  3839. libxml2="yes"
  3840. libxml2_cflags=$($pkg_config --cflags libxml-2.0)
  3841. libxml2_libs=$($pkg_config --libs libxml-2.0)
  3842. else
  3843. if test "$libxml2" = "yes"; then
  3844. feature_not_found "libxml2" "Install libxml2 devel"
  3845. fi
  3846. libxml2="no"
  3847. fi
  3848. fi
  3849. ##########################################
  3850. # glusterfs probe
  3851. if test "$glusterfs" != "no" ; then
  3852. if $pkg_config --atleast-version=3 glusterfs-api; then
  3853. glusterfs="yes"
  3854. glusterfs_cflags=$($pkg_config --cflags glusterfs-api)
  3855. glusterfs_libs=$($pkg_config --libs glusterfs-api)
  3856. if $pkg_config --atleast-version=4 glusterfs-api; then
  3857. glusterfs_xlator_opt="yes"
  3858. fi
  3859. if $pkg_config --atleast-version=5 glusterfs-api; then
  3860. glusterfs_discard="yes"
  3861. fi
  3862. if $pkg_config --atleast-version=6 glusterfs-api; then
  3863. glusterfs_fallocate="yes"
  3864. glusterfs_zerofill="yes"
  3865. fi
  3866. cat > $TMPC << EOF
  3867. #include <glusterfs/api/glfs.h>
  3868. int
  3869. main(void)
  3870. {
  3871. /* new glfs_ftruncate() passes two additional args */
  3872. return glfs_ftruncate(NULL, 0, NULL, NULL);
  3873. }
  3874. EOF
  3875. if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
  3876. glusterfs_ftruncate_has_stat="yes"
  3877. fi
  3878. cat > $TMPC << EOF
  3879. #include <glusterfs/api/glfs.h>
  3880. /* new glfs_io_cbk() passes two additional glfs_stat structs */
  3881. static void
  3882. glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data)
  3883. {}
  3884. int
  3885. main(void)
  3886. {
  3887. glfs_io_cbk iocb = &glusterfs_iocb;
  3888. iocb(NULL, 0 , NULL, NULL, NULL);
  3889. return 0;
  3890. }
  3891. EOF
  3892. if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
  3893. glusterfs_iocb_has_stat="yes"
  3894. fi
  3895. else
  3896. if test "$glusterfs" = "yes" ; then
  3897. feature_not_found "GlusterFS backend support" \
  3898. "Install glusterfs-api devel >= 3"
  3899. fi
  3900. glusterfs="no"
  3901. fi
  3902. fi
  3903. # Check for inotify functions when we are building linux-user
  3904. # emulator. This is done because older glibc versions don't
  3905. # have syscall stubs for these implemented. In that case we
  3906. # don't provide them even if kernel supports them.
  3907. #
  3908. inotify=no
  3909. cat > $TMPC << EOF
  3910. #include <sys/inotify.h>
  3911. int
  3912. main(void)
  3913. {
  3914. /* try to start inotify */
  3915. return inotify_init();
  3916. }
  3917. EOF
  3918. if compile_prog "" "" ; then
  3919. inotify=yes
  3920. fi
  3921. inotify1=no
  3922. cat > $TMPC << EOF
  3923. #include <sys/inotify.h>
  3924. int
  3925. main(void)
  3926. {
  3927. /* try to start inotify */
  3928. return inotify_init1(0);
  3929. }
  3930. EOF
  3931. if compile_prog "" "" ; then
  3932. inotify1=yes
  3933. fi
  3934. # check if pipe2 is there
  3935. pipe2=no
  3936. cat > $TMPC << EOF
  3937. #include <unistd.h>
  3938. #include <fcntl.h>
  3939. int main(void)
  3940. {
  3941. int pipefd[2];
  3942. return pipe2(pipefd, O_CLOEXEC);
  3943. }
  3944. EOF
  3945. if compile_prog "" "" ; then
  3946. pipe2=yes
  3947. fi
  3948. # check if accept4 is there
  3949. accept4=no
  3950. cat > $TMPC << EOF
  3951. #include <sys/socket.h>
  3952. #include <stddef.h>
  3953. int main(void)
  3954. {
  3955. accept4(0, NULL, NULL, SOCK_CLOEXEC);
  3956. return 0;
  3957. }
  3958. EOF
  3959. if compile_prog "" "" ; then
  3960. accept4=yes
  3961. fi
  3962. # check if tee/splice is there. vmsplice was added same time.
  3963. splice=no
  3964. cat > $TMPC << EOF
  3965. #include <unistd.h>
  3966. #include <fcntl.h>
  3967. #include <limits.h>
  3968. int main(void)
  3969. {
  3970. int len, fd = 0;
  3971. len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
  3972. splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
  3973. return 0;
  3974. }
  3975. EOF
  3976. if compile_prog "" "" ; then
  3977. splice=yes
  3978. fi
  3979. ##########################################
  3980. # libnuma probe
  3981. if test "$numa" != "no" ; then
  3982. cat > $TMPC << EOF
  3983. #include <numa.h>
  3984. int main(void) { return numa_available(); }
  3985. EOF
  3986. if compile_prog "" "-lnuma" ; then
  3987. numa=yes
  3988. libs_softmmu="-lnuma $libs_softmmu"
  3989. else
  3990. if test "$numa" = "yes" ; then
  3991. feature_not_found "numa" "install numactl devel"
  3992. fi
  3993. numa=no
  3994. fi
  3995. fi
  3996. if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then
  3997. echo "ERROR: tcmalloc && jemalloc can't be used at the same time"
  3998. exit 1
  3999. fi
  4000. # Even if malloc_trim() is available, these non-libc memory allocators
  4001. # do not support it.
  4002. if test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then
  4003. if test "$malloc_trim" = "yes" ; then
  4004. echo "Disabling malloc_trim with non-libc memory allocator"
  4005. fi
  4006. malloc_trim="no"
  4007. fi
  4008. #######################################
  4009. # malloc_trim
  4010. if test "$malloc_trim" != "no" ; then
  4011. cat > $TMPC << EOF
  4012. #include <malloc.h>
  4013. int main(void) { malloc_trim(0); return 0; }
  4014. EOF
  4015. if compile_prog "" "" ; then
  4016. malloc_trim="yes"
  4017. else
  4018. malloc_trim="no"
  4019. fi
  4020. fi
  4021. ##########################################
  4022. # tcmalloc probe
  4023. if test "$tcmalloc" = "yes" ; then
  4024. cat > $TMPC << EOF
  4025. #include <stdlib.h>
  4026. int main(void) { malloc(1); return 0; }
  4027. EOF
  4028. if compile_prog "" "-ltcmalloc" ; then
  4029. LIBS="-ltcmalloc $LIBS"
  4030. else
  4031. feature_not_found "tcmalloc" "install gperftools devel"
  4032. fi
  4033. fi
  4034. ##########################################
  4035. # jemalloc probe
  4036. if test "$jemalloc" = "yes" ; then
  4037. cat > $TMPC << EOF
  4038. #include <stdlib.h>
  4039. int main(void) { malloc(1); return 0; }
  4040. EOF
  4041. if compile_prog "" "-ljemalloc" ; then
  4042. LIBS="-ljemalloc $LIBS"
  4043. else
  4044. feature_not_found "jemalloc" "install jemalloc devel"
  4045. fi
  4046. fi
  4047. ##########################################
  4048. # signalfd probe
  4049. signalfd="no"
  4050. cat > $TMPC << EOF
  4051. #include <unistd.h>
  4052. #include <sys/syscall.h>
  4053. #include <signal.h>
  4054. int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
  4055. EOF
  4056. if compile_prog "" "" ; then
  4057. signalfd=yes
  4058. fi
  4059. # check if optreset global is declared by <getopt.h>
  4060. optreset="no"
  4061. cat > $TMPC << EOF
  4062. #include <getopt.h>
  4063. int main(void) { return optreset; }
  4064. EOF
  4065. if compile_prog "" "" ; then
  4066. optreset=yes
  4067. fi
  4068. # check if eventfd is supported
  4069. eventfd=no
  4070. cat > $TMPC << EOF
  4071. #include <sys/eventfd.h>
  4072. int main(void)
  4073. {
  4074. return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
  4075. }
  4076. EOF
  4077. if compile_prog "" "" ; then
  4078. eventfd=yes
  4079. fi
  4080. # check if memfd is supported
  4081. memfd=no
  4082. cat > $TMPC << EOF
  4083. #include <sys/mman.h>
  4084. int main(void)
  4085. {
  4086. return memfd_create("foo", MFD_ALLOW_SEALING);
  4087. }
  4088. EOF
  4089. if compile_prog "" "" ; then
  4090. memfd=yes
  4091. fi
  4092. # check for usbfs
  4093. have_usbfs=no
  4094. if test "$linux_user" = "yes"; then
  4095. cat > $TMPC << EOF
  4096. #include <linux/usbdevice_fs.h>
  4097. #ifndef USBDEVFS_GET_CAPABILITIES
  4098. #error "USBDEVFS_GET_CAPABILITIES undefined"
  4099. #endif
  4100. #ifndef USBDEVFS_DISCONNECT_CLAIM
  4101. #error "USBDEVFS_DISCONNECT_CLAIM undefined"
  4102. #endif
  4103. int main(void)
  4104. {
  4105. return 0;
  4106. }
  4107. EOF
  4108. if compile_prog "" ""; then
  4109. have_usbfs=yes
  4110. fi
  4111. fi
  4112. # check for fallocate
  4113. fallocate=no
  4114. cat > $TMPC << EOF
  4115. #include <fcntl.h>
  4116. int main(void)
  4117. {
  4118. fallocate(0, 0, 0, 0);
  4119. return 0;
  4120. }
  4121. EOF
  4122. if compile_prog "" "" ; then
  4123. fallocate=yes
  4124. fi
  4125. # check for fallocate hole punching
  4126. fallocate_punch_hole=no
  4127. cat > $TMPC << EOF
  4128. #include <fcntl.h>
  4129. #include <linux/falloc.h>
  4130. int main(void)
  4131. {
  4132. fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
  4133. return 0;
  4134. }
  4135. EOF
  4136. if compile_prog "" "" ; then
  4137. fallocate_punch_hole=yes
  4138. fi
  4139. # check that fallocate supports range zeroing inside the file
  4140. fallocate_zero_range=no
  4141. cat > $TMPC << EOF
  4142. #include <fcntl.h>
  4143. #include <linux/falloc.h>
  4144. int main(void)
  4145. {
  4146. fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0);
  4147. return 0;
  4148. }
  4149. EOF
  4150. if compile_prog "" "" ; then
  4151. fallocate_zero_range=yes
  4152. fi
  4153. # check for posix_fallocate
  4154. posix_fallocate=no
  4155. cat > $TMPC << EOF
  4156. #include <fcntl.h>
  4157. int main(void)
  4158. {
  4159. posix_fallocate(0, 0, 0);
  4160. return 0;
  4161. }
  4162. EOF
  4163. if compile_prog "" "" ; then
  4164. posix_fallocate=yes
  4165. fi
  4166. # check for sync_file_range
  4167. sync_file_range=no
  4168. cat > $TMPC << EOF
  4169. #include <fcntl.h>
  4170. int main(void)
  4171. {
  4172. sync_file_range(0, 0, 0, 0);
  4173. return 0;
  4174. }
  4175. EOF
  4176. if compile_prog "" "" ; then
  4177. sync_file_range=yes
  4178. fi
  4179. # check for linux/fiemap.h and FS_IOC_FIEMAP
  4180. fiemap=no
  4181. cat > $TMPC << EOF
  4182. #include <sys/ioctl.h>
  4183. #include <linux/fs.h>
  4184. #include <linux/fiemap.h>
  4185. int main(void)
  4186. {
  4187. ioctl(0, FS_IOC_FIEMAP, 0);
  4188. return 0;
  4189. }
  4190. EOF
  4191. if compile_prog "" "" ; then
  4192. fiemap=yes
  4193. fi
  4194. # check for dup3
  4195. dup3=no
  4196. cat > $TMPC << EOF
  4197. #include <unistd.h>
  4198. int main(void)
  4199. {
  4200. dup3(0, 0, 0);
  4201. return 0;
  4202. }
  4203. EOF
  4204. if compile_prog "" "" ; then
  4205. dup3=yes
  4206. fi
  4207. # check for ppoll support
  4208. ppoll=no
  4209. cat > $TMPC << EOF
  4210. #include <poll.h>
  4211. int main(void)
  4212. {
  4213. struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
  4214. ppoll(&pfd, 1, 0, 0);
  4215. return 0;
  4216. }
  4217. EOF
  4218. if compile_prog "" "" ; then
  4219. ppoll=yes
  4220. fi
  4221. # check for prctl(PR_SET_TIMERSLACK , ... ) support
  4222. prctl_pr_set_timerslack=no
  4223. cat > $TMPC << EOF
  4224. #include <sys/prctl.h>
  4225. int main(void)
  4226. {
  4227. prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
  4228. return 0;
  4229. }
  4230. EOF
  4231. if compile_prog "" "" ; then
  4232. prctl_pr_set_timerslack=yes
  4233. fi
  4234. # check for epoll support
  4235. epoll=no
  4236. cat > $TMPC << EOF
  4237. #include <sys/epoll.h>
  4238. int main(void)
  4239. {
  4240. epoll_create(0);
  4241. return 0;
  4242. }
  4243. EOF
  4244. if compile_prog "" "" ; then
  4245. epoll=yes
  4246. fi
  4247. # epoll_create1 is a later addition
  4248. # so we must check separately for its presence
  4249. epoll_create1=no
  4250. cat > $TMPC << EOF
  4251. #include <sys/epoll.h>
  4252. int main(void)
  4253. {
  4254. /* Note that we use epoll_create1 as a value, not as
  4255. * a function being called. This is necessary so that on
  4256. * old SPARC glibc versions where the function was present in
  4257. * the library but not declared in the header file we will
  4258. * fail the configure check. (Otherwise we will get a compiler
  4259. * warning but not an error, and will proceed to fail the
  4260. * qemu compile where we compile with -Werror.)
  4261. */
  4262. return (int)(uintptr_t)&epoll_create1;
  4263. }
  4264. EOF
  4265. if compile_prog "" "" ; then
  4266. epoll_create1=yes
  4267. fi
  4268. # check for sendfile support
  4269. sendfile=no
  4270. cat > $TMPC << EOF
  4271. #include <sys/sendfile.h>
  4272. int main(void)
  4273. {
  4274. return sendfile(0, 0, 0, 0);
  4275. }
  4276. EOF
  4277. if compile_prog "" "" ; then
  4278. sendfile=yes
  4279. fi
  4280. # check for timerfd support (glibc 2.8 and newer)
  4281. timerfd=no
  4282. cat > $TMPC << EOF
  4283. #include <sys/timerfd.h>
  4284. int main(void)
  4285. {
  4286. return(timerfd_create(CLOCK_REALTIME, 0));
  4287. }
  4288. EOF
  4289. if compile_prog "" "" ; then
  4290. timerfd=yes
  4291. fi
  4292. # check for setns and unshare support
  4293. setns=no
  4294. cat > $TMPC << EOF
  4295. #include <sched.h>
  4296. int main(void)
  4297. {
  4298. int ret;
  4299. ret = setns(0, 0);
  4300. ret = unshare(0);
  4301. return ret;
  4302. }
  4303. EOF
  4304. if compile_prog "" "" ; then
  4305. setns=yes
  4306. fi
  4307. # clock_adjtime probe
  4308. clock_adjtime=no
  4309. cat > $TMPC <<EOF
  4310. #include <time.h>
  4311. int main(void)
  4312. {
  4313. return clock_adjtime(0, 0);
  4314. }
  4315. EOF
  4316. clock_adjtime=no
  4317. if compile_prog "" "" ; then
  4318. clock_adjtime=yes
  4319. fi
  4320. # syncfs probe
  4321. syncfs=no
  4322. cat > $TMPC <<EOF
  4323. #include <unistd.h>
  4324. int main(void)
  4325. {
  4326. return syncfs(0);
  4327. }
  4328. EOF
  4329. syncfs=no
  4330. if compile_prog "" "" ; then
  4331. syncfs=yes
  4332. fi
  4333. # Check we have a new enough version of sphinx-build
  4334. has_sphinx_build() {
  4335. # This is a bit awkward but works: create a trivial document and
  4336. # try to run it with our configuration file (which enforces a
  4337. # version requirement). This will fail if either
  4338. # sphinx-build doesn't exist at all or if it is too old.
  4339. mkdir -p "$TMPDIR1/sphinx"
  4340. touch "$TMPDIR1/sphinx/index.rst"
  4341. sphinx-build -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1
  4342. }
  4343. # Check if tools are available to build documentation.
  4344. if test "$docs" != "no" ; then
  4345. if has makeinfo && has pod2man && has_sphinx_build; then
  4346. docs=yes
  4347. else
  4348. if test "$docs" = "yes" ; then
  4349. feature_not_found "docs" "Install texinfo, Perl/perl-podlators and python-sphinx"
  4350. fi
  4351. docs=no
  4352. fi
  4353. fi
  4354. # Search for bswap_32 function
  4355. byteswap_h=no
  4356. cat > $TMPC << EOF
  4357. #include <byteswap.h>
  4358. int main(void) { return bswap_32(0); }
  4359. EOF
  4360. if compile_prog "" "" ; then
  4361. byteswap_h=yes
  4362. fi
  4363. # Search for bswap32 function
  4364. bswap_h=no
  4365. cat > $TMPC << EOF
  4366. #include <sys/endian.h>
  4367. #include <sys/types.h>
  4368. #include <machine/bswap.h>
  4369. int main(void) { return bswap32(0); }
  4370. EOF
  4371. if compile_prog "" "" ; then
  4372. bswap_h=yes
  4373. fi
  4374. ##########################################
  4375. # Do we have libiscsi >= 1.9.0
  4376. if test "$libiscsi" != "no" ; then
  4377. if $pkg_config --atleast-version=1.9.0 libiscsi; then
  4378. libiscsi="yes"
  4379. libiscsi_cflags=$($pkg_config --cflags libiscsi)
  4380. libiscsi_libs=$($pkg_config --libs libiscsi)
  4381. else
  4382. if test "$libiscsi" = "yes" ; then
  4383. feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
  4384. fi
  4385. libiscsi="no"
  4386. fi
  4387. fi
  4388. ##########################################
  4389. # Do we need libm
  4390. cat > $TMPC << EOF
  4391. #include <math.h>
  4392. int main(int argc, char **argv) { return isnan(sin((double)argc)); }
  4393. EOF
  4394. if compile_prog "" "" ; then
  4395. :
  4396. elif compile_prog "" "-lm" ; then
  4397. LIBS="-lm $LIBS"
  4398. libs_qga="-lm $libs_qga"
  4399. else
  4400. error_exit "libm check failed"
  4401. fi
  4402. ##########################################
  4403. # Do we need librt
  4404. # uClibc provides 2 versions of clock_gettime(), one with realtime
  4405. # support and one without. This means that the clock_gettime() don't
  4406. # need -lrt. We still need it for timer_create() so we check for this
  4407. # function in addition.
  4408. cat > $TMPC <<EOF
  4409. #include <signal.h>
  4410. #include <time.h>
  4411. int main(void) {
  4412. timer_create(CLOCK_REALTIME, NULL, NULL);
  4413. return clock_gettime(CLOCK_REALTIME, NULL);
  4414. }
  4415. EOF
  4416. if compile_prog "" "" ; then
  4417. :
  4418. # we need pthread for static linking. use previous pthread test result
  4419. elif compile_prog "" "$pthread_lib -lrt" ; then
  4420. LIBS="$LIBS -lrt"
  4421. libs_qga="$libs_qga -lrt"
  4422. fi
  4423. # Check whether we need to link libutil for openpty()
  4424. cat > $TMPC << EOF
  4425. extern int openpty(int *am, int *as, char *name, void *termp, void *winp);
  4426. int main(void) { return openpty(0, 0, 0, 0, 0); }
  4427. EOF
  4428. if ! compile_prog "" "" ; then
  4429. if compile_prog "" "-lutil" ; then
  4430. libs_softmmu="-lutil $libs_softmmu"
  4431. libs_tools="-lutil $libs_tools"
  4432. fi
  4433. fi
  4434. ##########################################
  4435. # spice probe
  4436. if test "$spice" != "no" ; then
  4437. cat > $TMPC << EOF
  4438. #include <spice.h>
  4439. int main(void) { spice_server_new(); return 0; }
  4440. EOF
  4441. spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
  4442. spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
  4443. if $pkg_config --atleast-version=0.12.5 spice-server && \
  4444. $pkg_config --atleast-version=0.12.3 spice-protocol && \
  4445. compile_prog "$spice_cflags" "$spice_libs" ; then
  4446. spice="yes"
  4447. libs_softmmu="$libs_softmmu $spice_libs"
  4448. QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
  4449. spice_protocol_version=$($pkg_config --modversion spice-protocol)
  4450. spice_server_version=$($pkg_config --modversion spice-server)
  4451. else
  4452. if test "$spice" = "yes" ; then
  4453. feature_not_found "spice" \
  4454. "Install spice-server(>=0.12.5) and spice-protocol(>=0.12.3) devel"
  4455. fi
  4456. spice="no"
  4457. fi
  4458. fi
  4459. # check for smartcard support
  4460. if test "$smartcard" != "no"; then
  4461. if $pkg_config --atleast-version=2.5.1 libcacard; then
  4462. libcacard_cflags=$($pkg_config --cflags libcacard)
  4463. libcacard_libs=$($pkg_config --libs libcacard)
  4464. smartcard="yes"
  4465. else
  4466. if test "$smartcard" = "yes"; then
  4467. feature_not_found "smartcard" "Install libcacard devel"
  4468. fi
  4469. smartcard="no"
  4470. fi
  4471. fi
  4472. # check for libusb
  4473. if test "$libusb" != "no" ; then
  4474. if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
  4475. libusb="yes"
  4476. libusb_cflags=$($pkg_config --cflags libusb-1.0)
  4477. libusb_libs=$($pkg_config --libs libusb-1.0)
  4478. else
  4479. if test "$libusb" = "yes"; then
  4480. feature_not_found "libusb" "Install libusb devel >= 1.0.13"
  4481. fi
  4482. libusb="no"
  4483. fi
  4484. fi
  4485. # check for usbredirparser for usb network redirection support
  4486. if test "$usb_redir" != "no" ; then
  4487. if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
  4488. usb_redir="yes"
  4489. usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
  4490. usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
  4491. else
  4492. if test "$usb_redir" = "yes"; then
  4493. feature_not_found "usb-redir" "Install usbredir devel"
  4494. fi
  4495. usb_redir="no"
  4496. fi
  4497. fi
  4498. ##########################################
  4499. # check if we have VSS SDK headers for win
  4500. if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \
  4501. test "$vss_win32_sdk" != "no" ; then
  4502. case "$vss_win32_sdk" in
  4503. "") vss_win32_include="-isystem $source_path" ;;
  4504. *\ *) # The SDK is installed in "Program Files" by default, but we cannot
  4505. # handle path with spaces. So we symlink the headers into ".sdk/vss".
  4506. vss_win32_include="-isystem $source_path/.sdk/vss"
  4507. symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
  4508. ;;
  4509. *) vss_win32_include="-isystem $vss_win32_sdk"
  4510. esac
  4511. cat > $TMPC << EOF
  4512. #define __MIDL_user_allocate_free_DEFINED__
  4513. #include <inc/win2003/vss.h>
  4514. int main(void) { return VSS_CTX_BACKUP; }
  4515. EOF
  4516. if compile_prog "$vss_win32_include" "" ; then
  4517. guest_agent_with_vss="yes"
  4518. QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
  4519. libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
  4520. qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
  4521. else
  4522. if test "$vss_win32_sdk" != "" ; then
  4523. echo "ERROR: Please download and install Microsoft VSS SDK:"
  4524. echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
  4525. echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
  4526. echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
  4527. echo "ERROR: The headers are extracted in the directory \`inc'."
  4528. feature_not_found "VSS support"
  4529. fi
  4530. guest_agent_with_vss="no"
  4531. fi
  4532. fi
  4533. ##########################################
  4534. # lookup Windows platform SDK (if not specified)
  4535. # The SDK is needed only to build .tlb (type library) file of guest agent
  4536. # VSS provider from the source. It is usually unnecessary because the
  4537. # pre-compiled .tlb file is included.
  4538. if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \
  4539. test "$guest_agent_with_vss" = "yes" ; then
  4540. if test -z "$win_sdk"; then
  4541. programfiles="$PROGRAMFILES"
  4542. test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
  4543. if test -n "$programfiles"; then
  4544. win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
  4545. else
  4546. feature_not_found "Windows SDK"
  4547. fi
  4548. elif test "$win_sdk" = "no"; then
  4549. win_sdk=""
  4550. fi
  4551. fi
  4552. ##########################################
  4553. # check if mingw environment provides a recent ntddscsi.h
  4554. if test "$mingw32" = "yes" && test "$guest_agent" != "no"; then
  4555. cat > $TMPC << EOF
  4556. #include <windows.h>
  4557. #include <ntddscsi.h>
  4558. int main(void) {
  4559. #if !defined(IOCTL_SCSI_GET_ADDRESS)
  4560. #error Missing required ioctl definitions
  4561. #endif
  4562. SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
  4563. return addr.Lun;
  4564. }
  4565. EOF
  4566. if compile_prog "" "" ; then
  4567. guest_agent_ntddscsi=yes
  4568. libs_qga="-lsetupapi -lcfgmgr32 $libs_qga"
  4569. fi
  4570. fi
  4571. ##########################################
  4572. # virgl renderer probe
  4573. if test "$virglrenderer" != "no" ; then
  4574. cat > $TMPC << EOF
  4575. #include <virglrenderer.h>
  4576. int main(void) { virgl_renderer_poll(); return 0; }
  4577. EOF
  4578. virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null)
  4579. virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null)
  4580. virgl_version=$($pkg_config --modversion virglrenderer 2>/dev/null)
  4581. if $pkg_config virglrenderer >/dev/null 2>&1 && \
  4582. compile_prog "$virgl_cflags" "$virgl_libs" ; then
  4583. virglrenderer="yes"
  4584. else
  4585. if test "$virglrenderer" = "yes" ; then
  4586. feature_not_found "virglrenderer"
  4587. fi
  4588. virglrenderer="no"
  4589. fi
  4590. fi
  4591. ##########################################
  4592. # capstone
  4593. case "$capstone" in
  4594. "" | yes)
  4595. if $pkg_config capstone; then
  4596. capstone=system
  4597. elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
  4598. capstone=git
  4599. elif test -e "${source_path}/capstone/Makefile" ; then
  4600. capstone=internal
  4601. elif test -z "$capstone" ; then
  4602. capstone=no
  4603. else
  4604. feature_not_found "capstone" "Install capstone devel or git submodule"
  4605. fi
  4606. ;;
  4607. system)
  4608. if ! $pkg_config capstone; then
  4609. feature_not_found "capstone" "Install capstone devel"
  4610. fi
  4611. ;;
  4612. esac
  4613. case "$capstone" in
  4614. git | internal)
  4615. if test "$capstone" = git; then
  4616. git_submodules="${git_submodules} capstone"
  4617. fi
  4618. mkdir -p capstone
  4619. QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include"
  4620. if test "$mingw32" = "yes"; then
  4621. LIBCAPSTONE=capstone.lib
  4622. else
  4623. LIBCAPSTONE=libcapstone.a
  4624. fi
  4625. libs_cpu="-L\$(BUILD_DIR)/capstone -lcapstone $libs_cpu"
  4626. ;;
  4627. system)
  4628. QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)"
  4629. libs_cpu="$($pkg_config --libs capstone) $libs_cpu"
  4630. ;;
  4631. no)
  4632. ;;
  4633. *)
  4634. error_exit "Unknown state for capstone: $capstone"
  4635. ;;
  4636. esac
  4637. ##########################################
  4638. # check if we have fdatasync
  4639. fdatasync=no
  4640. cat > $TMPC << EOF
  4641. #include <unistd.h>
  4642. int main(void) {
  4643. #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
  4644. return fdatasync(0);
  4645. #else
  4646. #error Not supported
  4647. #endif
  4648. }
  4649. EOF
  4650. if compile_prog "" "" ; then
  4651. fdatasync=yes
  4652. fi
  4653. ##########################################
  4654. # check if we have madvise
  4655. madvise=no
  4656. cat > $TMPC << EOF
  4657. #include <sys/types.h>
  4658. #include <sys/mman.h>
  4659. #include <stddef.h>
  4660. int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
  4661. EOF
  4662. if compile_prog "" "" ; then
  4663. madvise=yes
  4664. fi
  4665. ##########################################
  4666. # check if we have posix_madvise
  4667. posix_madvise=no
  4668. cat > $TMPC << EOF
  4669. #include <sys/mman.h>
  4670. #include <stddef.h>
  4671. int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
  4672. EOF
  4673. if compile_prog "" "" ; then
  4674. posix_madvise=yes
  4675. fi
  4676. ##########################################
  4677. # check if we have posix_memalign()
  4678. posix_memalign=no
  4679. cat > $TMPC << EOF
  4680. #include <stdlib.h>
  4681. int main(void) {
  4682. void *p;
  4683. return posix_memalign(&p, 8, 8);
  4684. }
  4685. EOF
  4686. if compile_prog "" "" ; then
  4687. posix_memalign=yes
  4688. fi
  4689. ##########################################
  4690. # check if we have posix_syslog
  4691. posix_syslog=no
  4692. cat > $TMPC << EOF
  4693. #include <syslog.h>
  4694. int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; }
  4695. EOF
  4696. if compile_prog "" "" ; then
  4697. posix_syslog=yes
  4698. fi
  4699. ##########################################
  4700. # check if we have sem_timedwait
  4701. sem_timedwait=no
  4702. cat > $TMPC << EOF
  4703. #include <semaphore.h>
  4704. int main(void) { sem_t s; struct timespec t = {0}; return sem_timedwait(&s, &t); }
  4705. EOF
  4706. if compile_prog "" "" ; then
  4707. sem_timedwait=yes
  4708. fi
  4709. ##########################################
  4710. # check if we have strchrnul
  4711. strchrnul=no
  4712. cat > $TMPC << EOF
  4713. #include <string.h>
  4714. int main(void);
  4715. // Use a haystack that the compiler shouldn't be able to constant fold
  4716. char *haystack = (char*)&main;
  4717. int main(void) { return strchrnul(haystack, 'x') != &haystack[6]; }
  4718. EOF
  4719. if compile_prog "" "" ; then
  4720. strchrnul=yes
  4721. fi
  4722. ##########################################
  4723. # check if trace backend exists
  4724. $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null
  4725. if test "$?" -ne 0 ; then
  4726. error_exit "invalid trace backends" \
  4727. "Please choose supported trace backends."
  4728. fi
  4729. ##########################################
  4730. # For 'ust' backend, test if ust headers are present
  4731. if have_backend "ust"; then
  4732. cat > $TMPC << EOF
  4733. #include <lttng/tracepoint.h>
  4734. int main(void) { return 0; }
  4735. EOF
  4736. if compile_prog "" "-Wl,--no-as-needed -ldl" ; then
  4737. if $pkg_config lttng-ust --exists; then
  4738. lttng_ust_libs=$($pkg_config --libs lttng-ust)
  4739. else
  4740. lttng_ust_libs="-llttng-ust -ldl"
  4741. fi
  4742. if $pkg_config liburcu-bp --exists; then
  4743. urcu_bp_libs=$($pkg_config --libs liburcu-bp)
  4744. else
  4745. urcu_bp_libs="-lurcu-bp"
  4746. fi
  4747. LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
  4748. libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
  4749. else
  4750. error_exit "Trace backend 'ust' missing lttng-ust header files"
  4751. fi
  4752. fi
  4753. ##########################################
  4754. # For 'dtrace' backend, test if 'dtrace' command is present
  4755. if have_backend "dtrace"; then
  4756. if ! has 'dtrace' ; then
  4757. error_exit "dtrace command is not found in PATH $PATH"
  4758. fi
  4759. trace_backend_stap="no"
  4760. if has 'stap' ; then
  4761. trace_backend_stap="yes"
  4762. fi
  4763. fi
  4764. ##########################################
  4765. # check and set a backend for coroutine
  4766. # We prefer ucontext, but it's not always possible. The fallback
  4767. # is sigcontext. On Windows the only valid backend is the Windows
  4768. # specific one.
  4769. ucontext_works=no
  4770. if test "$darwin" != "yes"; then
  4771. cat > $TMPC << EOF
  4772. #include <ucontext.h>
  4773. #ifdef __stub_makecontext
  4774. #error Ignoring glibc stub makecontext which will always fail
  4775. #endif
  4776. int main(void) { makecontext(0, 0, 0); return 0; }
  4777. EOF
  4778. if compile_prog "" "" ; then
  4779. ucontext_works=yes
  4780. fi
  4781. fi
  4782. if test "$coroutine" = ""; then
  4783. if test "$mingw32" = "yes"; then
  4784. coroutine=win32
  4785. elif test "$ucontext_works" = "yes"; then
  4786. coroutine=ucontext
  4787. else
  4788. coroutine=sigaltstack
  4789. fi
  4790. else
  4791. case $coroutine in
  4792. windows)
  4793. if test "$mingw32" != "yes"; then
  4794. error_exit "'windows' coroutine backend only valid for Windows"
  4795. fi
  4796. # Unfortunately the user visible backend name doesn't match the
  4797. # coroutine-*.c filename for this case, so we have to adjust it here.
  4798. coroutine=win32
  4799. ;;
  4800. ucontext)
  4801. if test "$ucontext_works" != "yes"; then
  4802. feature_not_found "ucontext"
  4803. fi
  4804. ;;
  4805. sigaltstack)
  4806. if test "$mingw32" = "yes"; then
  4807. error_exit "only the 'windows' coroutine backend is valid for Windows"
  4808. fi
  4809. ;;
  4810. *)
  4811. error_exit "unknown coroutine backend $coroutine"
  4812. ;;
  4813. esac
  4814. fi
  4815. if test "$coroutine_pool" = ""; then
  4816. coroutine_pool=yes
  4817. fi
  4818. if test "$debug_stack_usage" = "yes"; then
  4819. if test "$coroutine_pool" = "yes"; then
  4820. echo "WARN: disabling coroutine pool for stack usage debugging"
  4821. coroutine_pool=no
  4822. fi
  4823. fi
  4824. ##########################################
  4825. # check if we have open_by_handle_at
  4826. open_by_handle_at=no
  4827. cat > $TMPC << EOF
  4828. #include <fcntl.h>
  4829. #if !defined(AT_EMPTY_PATH)
  4830. # error missing definition
  4831. #else
  4832. int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
  4833. #endif
  4834. EOF
  4835. if compile_prog "" "" ; then
  4836. open_by_handle_at=yes
  4837. fi
  4838. ########################################
  4839. # check if we have linux/magic.h
  4840. linux_magic_h=no
  4841. cat > $TMPC << EOF
  4842. #include <linux/magic.h>
  4843. int main(void) {
  4844. return 0;
  4845. }
  4846. EOF
  4847. if compile_prog "" "" ; then
  4848. linux_magic_h=yes
  4849. fi
  4850. ########################################
  4851. # check whether we can disable warning option with a pragma (this is needed
  4852. # to silence warnings in the headers of some versions of external libraries).
  4853. # This test has to be compiled with -Werror as otherwise an unknown pragma is
  4854. # only a warning.
  4855. #
  4856. # If we can't selectively disable warning in the code, disable -Werror so that
  4857. # the build doesn't fail anyway.
  4858. pragma_disable_unused_but_set=no
  4859. cat > $TMPC << EOF
  4860. #pragma GCC diagnostic push
  4861. #pragma GCC diagnostic ignored "-Wstrict-prototypes"
  4862. #pragma GCC diagnostic pop
  4863. int main(void) {
  4864. return 0;
  4865. }
  4866. EOF
  4867. if compile_prog "-Werror" "" ; then
  4868. pragma_diagnostic_available=yes
  4869. else
  4870. werror=no
  4871. fi
  4872. ########################################
  4873. # check if we have valgrind/valgrind.h
  4874. valgrind_h=no
  4875. cat > $TMPC << EOF
  4876. #include <valgrind/valgrind.h>
  4877. int main(void) {
  4878. return 0;
  4879. }
  4880. EOF
  4881. if compile_prog "" "" ; then
  4882. valgrind_h=yes
  4883. fi
  4884. ########################################
  4885. # check if environ is declared
  4886. has_environ=no
  4887. cat > $TMPC << EOF
  4888. #include <unistd.h>
  4889. int main(void) {
  4890. environ = 0;
  4891. return 0;
  4892. }
  4893. EOF
  4894. if compile_prog "" "" ; then
  4895. has_environ=yes
  4896. fi
  4897. ########################################
  4898. # check if cpuid.h is usable.
  4899. cat > $TMPC << EOF
  4900. #include <cpuid.h>
  4901. int main(void) {
  4902. unsigned a, b, c, d;
  4903. int max = __get_cpuid_max(0, 0);
  4904. if (max >= 1) {
  4905. __cpuid(1, a, b, c, d);
  4906. }
  4907. if (max >= 7) {
  4908. __cpuid_count(7, 0, a, b, c, d);
  4909. }
  4910. return 0;
  4911. }
  4912. EOF
  4913. if compile_prog "" "" ; then
  4914. cpuid_h=yes
  4915. fi
  4916. ##########################################
  4917. # avx2 optimization requirement check
  4918. #
  4919. # There is no point enabling this if cpuid.h is not usable,
  4920. # since we won't be able to select the new routines.
  4921. if test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then
  4922. cat > $TMPC << EOF
  4923. #pragma GCC push_options
  4924. #pragma GCC target("avx2")
  4925. #include <cpuid.h>
  4926. #include <immintrin.h>
  4927. static int bar(void *a) {
  4928. __m256i x = *(__m256i *)a;
  4929. return _mm256_testz_si256(x, x);
  4930. }
  4931. int main(int argc, char *argv[]) { return bar(argv[0]); }
  4932. EOF
  4933. if compile_object "" ; then
  4934. avx2_opt="yes"
  4935. else
  4936. avx2_opt="no"
  4937. fi
  4938. fi
  4939. ########################################
  4940. # check if __[u]int128_t is usable.
  4941. int128=no
  4942. cat > $TMPC << EOF
  4943. __int128_t a;
  4944. __uint128_t b;
  4945. int main (void) {
  4946. a = a + b;
  4947. b = a * b;
  4948. a = a * a;
  4949. return 0;
  4950. }
  4951. EOF
  4952. if compile_prog "" "" ; then
  4953. int128=yes
  4954. fi
  4955. #########################################
  4956. # See if 128-bit atomic operations are supported.
  4957. atomic128=no
  4958. if test "$int128" = "yes"; then
  4959. cat > $TMPC << EOF
  4960. int main(void)
  4961. {
  4962. unsigned __int128 x = 0, y = 0;
  4963. y = __atomic_load_16(&x, 0);
  4964. __atomic_store_16(&x, y, 0);
  4965. __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0);
  4966. return 0;
  4967. }
  4968. EOF
  4969. if compile_prog "" "" ; then
  4970. atomic128=yes
  4971. fi
  4972. fi
  4973. cmpxchg128=no
  4974. if test "$int128" = yes && test "$atomic128" = no; then
  4975. cat > $TMPC << EOF
  4976. int main(void)
  4977. {
  4978. unsigned __int128 x = 0, y = 0;
  4979. __sync_val_compare_and_swap_16(&x, y, x);
  4980. return 0;
  4981. }
  4982. EOF
  4983. if compile_prog "" "" ; then
  4984. cmpxchg128=yes
  4985. fi
  4986. fi
  4987. #########################################
  4988. # See if 64-bit atomic operations are supported.
  4989. # Note that without __atomic builtins, we can only
  4990. # assume atomic loads/stores max at pointer size.
  4991. cat > $TMPC << EOF
  4992. #include <stdint.h>
  4993. int main(void)
  4994. {
  4995. uint64_t x = 0, y = 0;
  4996. #ifdef __ATOMIC_RELAXED
  4997. y = __atomic_load_8(&x, 0);
  4998. __atomic_store_8(&x, y, 0);
  4999. __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0);
  5000. __atomic_exchange_8(&x, y, 0);
  5001. __atomic_fetch_add_8(&x, y, 0);
  5002. #else
  5003. typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1];
  5004. __sync_lock_test_and_set(&x, y);
  5005. __sync_val_compare_and_swap(&x, y, 0);
  5006. __sync_fetch_and_add(&x, y);
  5007. #endif
  5008. return 0;
  5009. }
  5010. EOF
  5011. if compile_prog "" "" ; then
  5012. atomic64=yes
  5013. fi
  5014. ########################################
  5015. # See if 16-byte vector operations are supported.
  5016. # Even without a vector unit the compiler may expand these.
  5017. # There is a bug in old GCC for PPC that crashes here.
  5018. # Unfortunately it's the system compiler for Centos 7.
  5019. cat > $TMPC << EOF
  5020. typedef unsigned char U1 __attribute__((vector_size(16)));
  5021. typedef unsigned short U2 __attribute__((vector_size(16)));
  5022. typedef unsigned int U4 __attribute__((vector_size(16)));
  5023. typedef unsigned long long U8 __attribute__((vector_size(16)));
  5024. typedef signed char S1 __attribute__((vector_size(16)));
  5025. typedef signed short S2 __attribute__((vector_size(16)));
  5026. typedef signed int S4 __attribute__((vector_size(16)));
  5027. typedef signed long long S8 __attribute__((vector_size(16)));
  5028. static U1 a1, b1;
  5029. static U2 a2, b2;
  5030. static U4 a4, b4;
  5031. static U8 a8, b8;
  5032. static S1 c1;
  5033. static S2 c2;
  5034. static S4 c4;
  5035. static S8 c8;
  5036. static int i;
  5037. void helper(void *d, void *a, int shift, int i);
  5038. void helper(void *d, void *a, int shift, int i)
  5039. {
  5040. *(U1 *)(d + i) = *(U1 *)(a + i) << shift;
  5041. *(U2 *)(d + i) = *(U2 *)(a + i) << shift;
  5042. *(U4 *)(d + i) = *(U4 *)(a + i) << shift;
  5043. *(U8 *)(d + i) = *(U8 *)(a + i) << shift;
  5044. }
  5045. int main(void)
  5046. {
  5047. a1 += b1; a2 += b2; a4 += b4; a8 += b8;
  5048. a1 -= b1; a2 -= b2; a4 -= b4; a8 -= b8;
  5049. a1 *= b1; a2 *= b2; a4 *= b4; a8 *= b8;
  5050. a1 &= b1; a2 &= b2; a4 &= b4; a8 &= b8;
  5051. a1 |= b1; a2 |= b2; a4 |= b4; a8 |= b8;
  5052. a1 ^= b1; a2 ^= b2; a4 ^= b4; a8 ^= b8;
  5053. a1 <<= i; a2 <<= i; a4 <<= i; a8 <<= i;
  5054. a1 >>= i; a2 >>= i; a4 >>= i; a8 >>= i;
  5055. c1 >>= i; c2 >>= i; c4 >>= i; c8 >>= i;
  5056. return 0;
  5057. }
  5058. EOF
  5059. vector16=no
  5060. if compile_prog "" "" ; then
  5061. vector16=yes
  5062. fi
  5063. ########################################
  5064. # check if getauxval is available.
  5065. getauxval=no
  5066. cat > $TMPC << EOF
  5067. #include <sys/auxv.h>
  5068. int main(void) {
  5069. return getauxval(AT_HWCAP) == 0;
  5070. }
  5071. EOF
  5072. if compile_prog "" "" ; then
  5073. getauxval=yes
  5074. fi
  5075. ########################################
  5076. # check if ccache is interfering with
  5077. # semantic analysis of macros
  5078. unset CCACHE_CPP2
  5079. ccache_cpp2=no
  5080. cat > $TMPC << EOF
  5081. static const int Z = 1;
  5082. #define fn() ({ Z; })
  5083. #define TAUT(X) ((X) == Z)
  5084. #define PAREN(X, Y) (X == Y)
  5085. #define ID(X) (X)
  5086. int main(int argc, char *argv[])
  5087. {
  5088. int x = 0, y = 0;
  5089. x = ID(x);
  5090. x = fn();
  5091. fn();
  5092. if (PAREN(x, y)) return 0;
  5093. if (TAUT(Z)) return 0;
  5094. return 0;
  5095. }
  5096. EOF
  5097. if ! compile_object "-Werror"; then
  5098. ccache_cpp2=yes
  5099. fi
  5100. #################################################
  5101. # clang does not support glibc + FORTIFY_SOURCE.
  5102. if test "$fortify_source" != "no"; then
  5103. if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then
  5104. fortify_source="no";
  5105. elif test -n "$cxx" && has $cxx &&
  5106. echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then
  5107. fortify_source="no";
  5108. else
  5109. fortify_source="yes"
  5110. fi
  5111. fi
  5112. ###############################################
  5113. # Check if copy_file_range is provided by glibc
  5114. have_copy_file_range=no
  5115. cat > $TMPC << EOF
  5116. #include <unistd.h>
  5117. int main(void) {
  5118. copy_file_range(0, NULL, 0, NULL, 0, 0);
  5119. return 0;
  5120. }
  5121. EOF
  5122. if compile_prog "" "" ; then
  5123. have_copy_file_range=yes
  5124. fi
  5125. ##########################################
  5126. # check if struct fsxattr is available via linux/fs.h
  5127. have_fsxattr=no
  5128. cat > $TMPC << EOF
  5129. #include <linux/fs.h>
  5130. struct fsxattr foo;
  5131. int main(void) {
  5132. return 0;
  5133. }
  5134. EOF
  5135. if compile_prog "" "" ; then
  5136. have_fsxattr=yes
  5137. fi
  5138. ##########################################
  5139. # check for usable membarrier system call
  5140. if test "$membarrier" = "yes"; then
  5141. have_membarrier=no
  5142. if test "$mingw32" = "yes" ; then
  5143. have_membarrier=yes
  5144. elif test "$linux" = "yes" ; then
  5145. cat > $TMPC << EOF
  5146. #include <linux/membarrier.h>
  5147. #include <sys/syscall.h>
  5148. #include <unistd.h>
  5149. #include <stdlib.h>
  5150. int main(void) {
  5151. syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0);
  5152. syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0);
  5153. exit(0);
  5154. }
  5155. EOF
  5156. if compile_prog "" "" ; then
  5157. have_membarrier=yes
  5158. fi
  5159. fi
  5160. if test "$have_membarrier" = "no"; then
  5161. feature_not_found "membarrier" "membarrier system call not available"
  5162. fi
  5163. else
  5164. # Do not enable it by default even for Mingw32, because it doesn't
  5165. # work on Wine.
  5166. membarrier=no
  5167. fi
  5168. ##########################################
  5169. # check if rtnetlink.h exists and is useful
  5170. have_rtnetlink=no
  5171. cat > $TMPC << EOF
  5172. #include <linux/rtnetlink.h>
  5173. int main(void) {
  5174. return IFLA_PROTO_DOWN;
  5175. }
  5176. EOF
  5177. if compile_prog "" "" ; then
  5178. have_rtnetlink=yes
  5179. fi
  5180. ##########################################
  5181. # check for usable AF_VSOCK environment
  5182. have_af_vsock=no
  5183. cat > $TMPC << EOF
  5184. #include <errno.h>
  5185. #include <sys/types.h>
  5186. #include <sys/socket.h>
  5187. #if !defined(AF_VSOCK)
  5188. # error missing AF_VSOCK flag
  5189. #endif
  5190. #include <linux/vm_sockets.h>
  5191. int main(void) {
  5192. int sock, ret;
  5193. struct sockaddr_vm svm;
  5194. socklen_t len = sizeof(svm);
  5195. sock = socket(AF_VSOCK, SOCK_STREAM, 0);
  5196. ret = getpeername(sock, (struct sockaddr *)&svm, &len);
  5197. if ((ret == -1) && (errno == ENOTCONN)) {
  5198. return 0;
  5199. }
  5200. return -1;
  5201. }
  5202. EOF
  5203. if compile_prog "" "" ; then
  5204. have_af_vsock=yes
  5205. fi
  5206. ##########################################
  5207. # check for usable AF_ALG environment
  5208. hava_afalg=no
  5209. cat > $TMPC << EOF
  5210. #include <errno.h>
  5211. #include <sys/types.h>
  5212. #include <sys/socket.h>
  5213. #include <linux/if_alg.h>
  5214. int main(void) {
  5215. int sock;
  5216. sock = socket(AF_ALG, SOCK_SEQPACKET, 0);
  5217. return sock;
  5218. }
  5219. EOF
  5220. if compile_prog "" "" ; then
  5221. have_afalg=yes
  5222. fi
  5223. if test "$crypto_afalg" = "yes"
  5224. then
  5225. if test "$have_afalg" != "yes"
  5226. then
  5227. error_exit "AF_ALG requested but could not be detected"
  5228. fi
  5229. fi
  5230. #################################################
  5231. # Check to see if we have the Hypervisor framework
  5232. if [ "$darwin" = "yes" ] ; then
  5233. cat > $TMPC << EOF
  5234. #include <Hypervisor/hv.h>
  5235. int main() { return 0;}
  5236. EOF
  5237. if ! compile_object ""; then
  5238. hvf='no'
  5239. else
  5240. hvf='yes'
  5241. LDFLAGS="-framework Hypervisor $LDFLAGS"
  5242. fi
  5243. fi
  5244. #################################################
  5245. # Sparc implicitly links with --relax, which is
  5246. # incompatible with -r, so --no-relax should be
  5247. # given. It does no harm to give it on other
  5248. # platforms too.
  5249. # Note: the prototype is needed since QEMU_CFLAGS
  5250. # contains -Wmissing-prototypes
  5251. cat > $TMPC << EOF
  5252. extern int foo(void);
  5253. int foo(void) { return 0; }
  5254. EOF
  5255. if ! compile_object ""; then
  5256. error_exit "Failed to compile object file for LD_REL_FLAGS test"
  5257. fi
  5258. for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do
  5259. if do_cc -nostdlib $i -o $TMPMO $TMPO; then
  5260. LD_REL_FLAGS=$i
  5261. break
  5262. fi
  5263. done
  5264. if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then
  5265. feature_not_found "modules" "Cannot find how to build relocatable objects"
  5266. fi
  5267. ##########################################
  5268. # check for sysmacros.h
  5269. have_sysmacros=no
  5270. cat > $TMPC << EOF
  5271. #include <sys/sysmacros.h>
  5272. int main(void) {
  5273. return makedev(0, 0);
  5274. }
  5275. EOF
  5276. if compile_prog "" "" ; then
  5277. have_sysmacros=yes
  5278. fi
  5279. ##########################################
  5280. # Veritas HyperScale block driver VxHS
  5281. # Check if libvxhs is installed
  5282. if test "$vxhs" != "no" ; then
  5283. cat > $TMPC <<EOF
  5284. #include <stdint.h>
  5285. #include <qnio/qnio_api.h>
  5286. void *vxhs_callback;
  5287. int main(void) {
  5288. iio_init(QNIO_VERSION, vxhs_callback);
  5289. return 0;
  5290. }
  5291. EOF
  5292. vxhs_libs="-lvxhs -lssl"
  5293. if compile_prog "" "$vxhs_libs" ; then
  5294. vxhs=yes
  5295. else
  5296. if test "$vxhs" = "yes" ; then
  5297. feature_not_found "vxhs block device" "Install libvxhs See github"
  5298. fi
  5299. vxhs=no
  5300. fi
  5301. fi
  5302. ##########################################
  5303. # check for _Static_assert()
  5304. have_static_assert=no
  5305. cat > $TMPC << EOF
  5306. _Static_assert(1, "success");
  5307. int main(void) {
  5308. return 0;
  5309. }
  5310. EOF
  5311. if compile_prog "" "" ; then
  5312. have_static_assert=yes
  5313. fi
  5314. ##########################################
  5315. # check for utmpx.h, it is missing e.g. on OpenBSD
  5316. have_utmpx=no
  5317. cat > $TMPC << EOF
  5318. #include <utmpx.h>
  5319. struct utmpx user_info;
  5320. int main(void) {
  5321. return 0;
  5322. }
  5323. EOF
  5324. if compile_prog "" "" ; then
  5325. have_utmpx=yes
  5326. fi
  5327. ##########################################
  5328. # check for getrandom()
  5329. have_getrandom=no
  5330. cat > $TMPC << EOF
  5331. #include <sys/random.h>
  5332. int main(void) {
  5333. return getrandom(0, 0, GRND_NONBLOCK);
  5334. }
  5335. EOF
  5336. if compile_prog "" "" ; then
  5337. have_getrandom=yes
  5338. fi
  5339. ##########################################
  5340. # checks for sanitizers
  5341. have_asan=no
  5342. have_ubsan=no
  5343. have_asan_iface_h=no
  5344. have_asan_iface_fiber=no
  5345. if test "$sanitizers" = "yes" ; then
  5346. write_c_skeleton
  5347. if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" ""; then
  5348. have_asan=yes
  5349. fi
  5350. # we could use a simple skeleton for flags checks, but this also
  5351. # detect the static linking issue of ubsan, see also:
  5352. # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
  5353. cat > $TMPC << EOF
  5354. #include <stdlib.h>
  5355. int main(void) {
  5356. void *tmp = malloc(10);
  5357. return *(int *)(tmp + 2);
  5358. }
  5359. EOF
  5360. if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
  5361. have_ubsan=yes
  5362. fi
  5363. if check_include "sanitizer/asan_interface.h" ; then
  5364. have_asan_iface_h=yes
  5365. fi
  5366. cat > $TMPC << EOF
  5367. #include <sanitizer/asan_interface.h>
  5368. int main(void) {
  5369. __sanitizer_start_switch_fiber(0, 0, 0);
  5370. return 0;
  5371. }
  5372. EOF
  5373. if compile_prog "$CPU_CFLAGS -Werror -fsanitize=address" "" ; then
  5374. have_asan_iface_fiber=yes
  5375. fi
  5376. fi
  5377. ##########################################
  5378. # check for libpmem
  5379. if test "$libpmem" != "no"; then
  5380. if $pkg_config --exists "libpmem"; then
  5381. libpmem="yes"
  5382. libpmem_libs=$($pkg_config --libs libpmem)
  5383. libpmem_cflags=$($pkg_config --cflags libpmem)
  5384. libs_softmmu="$libs_softmmu $libpmem_libs"
  5385. QEMU_CFLAGS="$QEMU_CFLAGS $libpmem_cflags"
  5386. else
  5387. if test "$libpmem" = "yes" ; then
  5388. feature_not_found "libpmem" "Install nvml or pmdk"
  5389. fi
  5390. libpmem="no"
  5391. fi
  5392. fi
  5393. ##########################################
  5394. # check for slirp
  5395. case "$slirp" in
  5396. "" | yes)
  5397. if $pkg_config slirp; then
  5398. slirp=system
  5399. elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
  5400. slirp=git
  5401. elif test -e "${source_path}/slirp/Makefile" ; then
  5402. slirp=internal
  5403. elif test -z "$slirp" ; then
  5404. slirp=no
  5405. else
  5406. feature_not_found "slirp" "Install slirp devel or git submodule"
  5407. fi
  5408. ;;
  5409. system)
  5410. if ! $pkg_config slirp; then
  5411. feature_not_found "slirp" "Install slirp devel"
  5412. fi
  5413. ;;
  5414. esac
  5415. case "$slirp" in
  5416. git | internal)
  5417. if test "$slirp" = git; then
  5418. git_submodules="${git_submodules} slirp"
  5419. fi
  5420. mkdir -p slirp
  5421. slirp_cflags="-I\$(SRC_PATH)/slirp/src -I\$(BUILD_DIR)/slirp/src"
  5422. slirp_libs="-L\$(BUILD_DIR)/slirp -lslirp"
  5423. ;;
  5424. system)
  5425. slirp_version=$($pkg_config --modversion slirp 2>/dev/null)
  5426. slirp_cflags=$($pkg_config --cflags slirp 2>/dev/null)
  5427. slirp_libs=$($pkg_config --libs slirp 2>/dev/null)
  5428. ;;
  5429. no)
  5430. ;;
  5431. *)
  5432. error_exit "Unknown state for slirp: $slirp"
  5433. ;;
  5434. esac
  5435. ##########################################
  5436. # End of CC checks
  5437. # After here, no more $cc or $ld runs
  5438. write_c_skeleton
  5439. if test "$gcov" = "yes" ; then
  5440. CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
  5441. LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
  5442. elif test "$fortify_source" = "yes" ; then
  5443. CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
  5444. elif test "$debug" = "no"; then
  5445. CFLAGS="-O2 $CFLAGS"
  5446. fi
  5447. if test "$have_asan" = "yes"; then
  5448. CFLAGS="-fsanitize=address $CFLAGS"
  5449. if test "$have_asan_iface_h" = "no" ; then
  5450. echo "ASAN build enabled, but ASAN header missing." \
  5451. "Without code annotation, the report may be inferior."
  5452. elif test "$have_asan_iface_fiber" = "no" ; then
  5453. echo "ASAN build enabled, but ASAN header is too old." \
  5454. "Without code annotation, the report may be inferior."
  5455. fi
  5456. fi
  5457. if test "$have_ubsan" = "yes"; then
  5458. CFLAGS="-fsanitize=undefined $CFLAGS"
  5459. fi
  5460. ##########################################
  5461. # Do we have libnfs
  5462. if test "$libnfs" != "no" ; then
  5463. if $pkg_config --atleast-version=1.9.3 libnfs; then
  5464. libnfs="yes"
  5465. libnfs_libs=$($pkg_config --libs libnfs)
  5466. else
  5467. if test "$libnfs" = "yes" ; then
  5468. feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
  5469. fi
  5470. libnfs="no"
  5471. fi
  5472. fi
  5473. ##########################################
  5474. # Do we have libudev
  5475. if test "$libudev" != "no" ; then
  5476. if $pkg_config libudev && test "$static" != "yes"; then
  5477. libudev="yes"
  5478. libudev_libs=$($pkg_config --libs libudev)
  5479. else
  5480. libudev="no"
  5481. fi
  5482. fi
  5483. # Now we've finished running tests it's OK to add -Werror to the compiler flags
  5484. if test "$werror" = "yes"; then
  5485. QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
  5486. fi
  5487. if test "$solaris" = "no" ; then
  5488. if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
  5489. LDFLAGS="-Wl,--warn-common $LDFLAGS"
  5490. fi
  5491. fi
  5492. # test if pod2man has --utf8 option
  5493. if pod2man --help | grep -q utf8; then
  5494. POD2MAN="pod2man --utf8"
  5495. else
  5496. POD2MAN="pod2man"
  5497. fi
  5498. # Use ASLR, no-SEH and DEP if available
  5499. if test "$mingw32" = "yes" ; then
  5500. for flag in --dynamicbase --no-seh --nxcompat; do
  5501. if ld_has $flag ; then
  5502. LDFLAGS="-Wl,$flag $LDFLAGS"
  5503. fi
  5504. done
  5505. fi
  5506. # Disable OpenBSD W^X if available
  5507. if test "$tcg" = "yes" && test "$targetos" = "OpenBSD"; then
  5508. cat > $TMPC <<EOF
  5509. int main(void) { return 0; }
  5510. EOF
  5511. wx_ldflags="-Wl,-z,wxneeded"
  5512. if compile_prog "" "$wx_ldflags"; then
  5513. QEMU_LDFLAGS="$QEMU_LDFLAGS $wx_ldflags"
  5514. fi
  5515. fi
  5516. qemu_confdir=$sysconfdir$confsuffix
  5517. qemu_moddir=$libdir$confsuffix
  5518. qemu_datadir=$datadir$confsuffix
  5519. qemu_localedir="$datadir/locale"
  5520. qemu_icondir="$datadir/icons"
  5521. qemu_desktopdir="$datadir/applications"
  5522. # We can only support ivshmem if we have eventfd
  5523. if [ "$eventfd" = "yes" ]; then
  5524. ivshmem=yes
  5525. fi
  5526. tools=""
  5527. if test "$want_tools" = "yes" ; then
  5528. tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) qemu-edid\$(EXESUF) $tools"
  5529. if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
  5530. tools="qemu-nbd\$(EXESUF) $tools"
  5531. fi
  5532. if [ "$ivshmem" = "yes" ]; then
  5533. tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools"
  5534. fi
  5535. if [ "$curl" = "yes" ]; then
  5536. tools="elf2dmp\$(EXESUF) $tools"
  5537. fi
  5538. fi
  5539. if test "$softmmu" = yes ; then
  5540. if test "$linux" = yes; then
  5541. if test "$virtfs" != no && test "$cap" = yes && test "$attr" = yes ; then
  5542. virtfs=yes
  5543. tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
  5544. else
  5545. if test "$virtfs" = yes; then
  5546. error_exit "VirtFS requires libcap devel and libattr devel"
  5547. fi
  5548. virtfs=no
  5549. fi
  5550. if test "$mpath" != no && test "$mpathpersist" = yes ; then
  5551. mpath=yes
  5552. else
  5553. if test "$mpath" = yes; then
  5554. error_exit "Multipath requires libmpathpersist devel"
  5555. fi
  5556. mpath=no
  5557. fi
  5558. tools="$tools scsi/qemu-pr-helper\$(EXESUF)"
  5559. else
  5560. if test "$virtfs" = yes; then
  5561. error_exit "VirtFS is supported only on Linux"
  5562. fi
  5563. virtfs=no
  5564. if test "$mpath" = yes; then
  5565. error_exit "Multipath is supported only on Linux"
  5566. fi
  5567. mpath=no
  5568. fi
  5569. if test "$xkbcommon" = "yes"; then
  5570. tools="qemu-keymap\$(EXESUF) $tools"
  5571. fi
  5572. fi
  5573. # Probe for guest agent support/options
  5574. if [ "$guest_agent" != "no" ]; then
  5575. if [ "$softmmu" = no -a "$want_tools" = no ] ; then
  5576. guest_agent=no
  5577. elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
  5578. tools="qemu-ga\$(EXESUF) $tools"
  5579. guest_agent=yes
  5580. elif [ "$guest_agent" != yes ]; then
  5581. guest_agent=no
  5582. else
  5583. error_exit "Guest agent is not supported on this platform"
  5584. fi
  5585. fi
  5586. # Guest agent Window MSI package
  5587. if test "$guest_agent" != yes; then
  5588. if test "$guest_agent_msi" = yes; then
  5589. error_exit "MSI guest agent package requires guest agent enabled"
  5590. fi
  5591. guest_agent_msi=no
  5592. elif test "$mingw32" != "yes"; then
  5593. if test "$guest_agent_msi" = "yes"; then
  5594. error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation"
  5595. fi
  5596. guest_agent_msi=no
  5597. elif ! has wixl; then
  5598. if test "$guest_agent_msi" = "yes"; then
  5599. error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )"
  5600. fi
  5601. guest_agent_msi=no
  5602. else
  5603. # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't
  5604. # disabled explicitly
  5605. if test "$guest_agent_msi" != "no"; then
  5606. guest_agent_msi=yes
  5607. fi
  5608. fi
  5609. if test "$guest_agent_msi" = "yes"; then
  5610. if test "$guest_agent_with_vss" = "yes"; then
  5611. QEMU_GA_MSI_WITH_VSS="-D InstallVss"
  5612. fi
  5613. if test "$QEMU_GA_MANUFACTURER" = ""; then
  5614. QEMU_GA_MANUFACTURER=QEMU
  5615. fi
  5616. if test "$QEMU_GA_DISTRO" = ""; then
  5617. QEMU_GA_DISTRO=Linux
  5618. fi
  5619. if test "$QEMU_GA_VERSION" = ""; then
  5620. QEMU_GA_VERSION=$(cat $source_path/VERSION)
  5621. fi
  5622. QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin"
  5623. case "$cpu" in
  5624. x86_64)
  5625. QEMU_GA_MSI_ARCH="-a x64 -D Arch=64"
  5626. ;;
  5627. i386)
  5628. QEMU_GA_MSI_ARCH="-D Arch=32"
  5629. ;;
  5630. *)
  5631. error_exit "CPU $cpu not supported for building installation package"
  5632. ;;
  5633. esac
  5634. fi
  5635. # Mac OS X ships with a broken assembler
  5636. roms=
  5637. if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \
  5638. test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \
  5639. test "$softmmu" = yes ; then
  5640. # Different host OS linkers have different ideas about the name of the ELF
  5641. # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd
  5642. # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
  5643. for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do
  5644. if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
  5645. ld_i386_emulation="$emu"
  5646. roms="optionrom"
  5647. break
  5648. fi
  5649. done
  5650. fi
  5651. if test "$ARCH" = "ppc64" && test "$targetos" != "Darwin" ; then
  5652. roms="$roms spapr-rtas"
  5653. fi
  5654. # Only build s390-ccw bios if we're on s390x and the compiler has -march=z900
  5655. if test "$cpu" = "s390x" ; then
  5656. write_c_skeleton
  5657. if compile_prog "-march=z900" ""; then
  5658. roms="$roms s390-ccw"
  5659. fi
  5660. fi
  5661. # Probe for the need for relocating the user-only binary.
  5662. if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then
  5663. textseg_addr=
  5664. case "$cpu" in
  5665. arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
  5666. # ??? Rationale for choosing this address
  5667. textseg_addr=0x60000000
  5668. ;;
  5669. mips)
  5670. # A 256M aligned address, high in the address space, with enough
  5671. # room for the code_gen_buffer above it before the stack.
  5672. textseg_addr=0x60000000
  5673. ;;
  5674. esac
  5675. if [ -n "$textseg_addr" ]; then
  5676. cat > $TMPC <<EOF
  5677. int main(void) { return 0; }
  5678. EOF
  5679. textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
  5680. if ! compile_prog "" "$textseg_ldflags"; then
  5681. # In case ld does not support -Ttext-segment, edit the default linker
  5682. # script via sed to set the .text start addr. This is needed on FreeBSD
  5683. # at least.
  5684. if ! $ld --verbose >/dev/null 2>&1; then
  5685. error_exit \
  5686. "We need to link the QEMU user mode binaries at a" \
  5687. "specific text address. Unfortunately your linker" \
  5688. "doesn't support either the -Ttext-segment option or" \
  5689. "printing the default linker script with --verbose." \
  5690. "If you don't want the user mode binaries, pass the" \
  5691. "--disable-user option to configure."
  5692. fi
  5693. $ld --verbose | sed \
  5694. -e '1,/==================================================/d' \
  5695. -e '/==================================================/,$d' \
  5696. -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
  5697. -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
  5698. textseg_ldflags="-Wl,-T../config-host.ld"
  5699. fi
  5700. fi
  5701. fi
  5702. # Check that the C++ compiler exists and works with the C compiler.
  5703. # All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added.
  5704. if has $cxx; then
  5705. cat > $TMPC <<EOF
  5706. int c_function(void);
  5707. int main(void) { return c_function(); }
  5708. EOF
  5709. compile_object
  5710. cat > $TMPCXX <<EOF
  5711. extern "C" {
  5712. int c_function(void);
  5713. }
  5714. int c_function(void) { return 42; }
  5715. EOF
  5716. update_cxxflags
  5717. if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
  5718. # C++ compiler $cxx works ok with C compiler $cc
  5719. :
  5720. else
  5721. echo "C++ compiler $cxx does not work with C compiler $cc"
  5722. echo "Disabling C++ specific optional code"
  5723. cxx=
  5724. fi
  5725. else
  5726. echo "No C++ compiler available; disabling C++ specific optional code"
  5727. cxx=
  5728. fi
  5729. echo_version() {
  5730. if test "$1" = "yes" ; then
  5731. echo "($2)"
  5732. fi
  5733. }
  5734. # prepend pixman and ftd flags after all config tests are done
  5735. QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
  5736. QEMU_LDFLAGS="$fdt_ldflags $QEMU_LDFLAGS"
  5737. libs_softmmu="$pixman_libs $libs_softmmu"
  5738. echo "Install prefix $prefix"
  5739. echo "BIOS directory $(eval echo $qemu_datadir)"
  5740. echo "firmware path $(eval echo $firmwarepath)"
  5741. echo "binary directory $(eval echo $bindir)"
  5742. echo "library directory $(eval echo $libdir)"
  5743. echo "module directory $(eval echo $qemu_moddir)"
  5744. echo "libexec directory $(eval echo $libexecdir)"
  5745. echo "include directory $(eval echo $includedir)"
  5746. echo "config directory $(eval echo $sysconfdir)"
  5747. if test "$mingw32" = "no" ; then
  5748. echo "local state directory $(eval echo $local_statedir)"
  5749. echo "Manual directory $(eval echo $mandir)"
  5750. echo "ELF interp prefix $interp_prefix"
  5751. else
  5752. echo "local state directory queried at runtime"
  5753. echo "Windows SDK $win_sdk"
  5754. fi
  5755. echo "Source path $source_path"
  5756. echo "GIT binary $git"
  5757. echo "GIT submodules $git_submodules"
  5758. echo "C compiler $cc"
  5759. echo "Host C compiler $host_cc"
  5760. echo "C++ compiler $cxx"
  5761. echo "Objective-C compiler $objcc"
  5762. echo "ARFLAGS $ARFLAGS"
  5763. echo "CFLAGS $CFLAGS"
  5764. echo "QEMU_CFLAGS $QEMU_CFLAGS"
  5765. echo "LDFLAGS $LDFLAGS"
  5766. echo "QEMU_LDFLAGS $QEMU_LDFLAGS"
  5767. echo "make $make"
  5768. echo "install $install"
  5769. echo "python $python ($python_version)"
  5770. echo "slirp support $slirp $(echo_version $slirp $slirp_version)"
  5771. if test "$slirp" != "no" ; then
  5772. echo "smbd $smbd"
  5773. fi
  5774. echo "module support $modules"
  5775. echo "host CPU $cpu"
  5776. echo "host big endian $bigendian"
  5777. echo "target list $target_list"
  5778. echo "gprof enabled $gprof"
  5779. echo "sparse enabled $sparse"
  5780. echo "strip binaries $strip_opt"
  5781. echo "profiler $profiler"
  5782. echo "static build $static"
  5783. if test "$darwin" = "yes" ; then
  5784. echo "Cocoa support $cocoa"
  5785. fi
  5786. echo "SDL support $sdl $(echo_version $sdl $sdlversion)"
  5787. echo "SDL image support $sdl_image"
  5788. echo "GTK support $gtk $(echo_version $gtk $gtk_version)"
  5789. echo "GTK GL support $gtk_gl"
  5790. echo "VTE support $vte $(echo_version $vte $vteversion)"
  5791. echo "TLS priority $tls_priority"
  5792. echo "GNUTLS support $gnutls"
  5793. echo "libgcrypt $gcrypt"
  5794. echo "nettle $nettle $(echo_version $nettle $nettle_version)"
  5795. echo "libtasn1 $tasn1"
  5796. echo "PAM $auth_pam"
  5797. echo "iconv support $iconv"
  5798. echo "curses support $curses"
  5799. echo "virgl support $virglrenderer $(echo_version $virglrenderer $virgl_version)"
  5800. echo "curl support $curl"
  5801. echo "mingw32 support $mingw32"
  5802. echo "Audio drivers $audio_drv_list"
  5803. echo "Block whitelist (rw) $block_drv_rw_whitelist"
  5804. echo "Block whitelist (ro) $block_drv_ro_whitelist"
  5805. echo "VirtFS support $virtfs"
  5806. echo "Multipath support $mpath"
  5807. echo "VNC support $vnc"
  5808. if test "$vnc" = "yes" ; then
  5809. echo "VNC SASL support $vnc_sasl"
  5810. echo "VNC JPEG support $vnc_jpeg"
  5811. echo "VNC PNG support $vnc_png"
  5812. fi
  5813. echo "xen support $xen"
  5814. if test "$xen" = "yes" ; then
  5815. echo "xen ctrl version $xen_ctrl_version"
  5816. fi
  5817. echo "brlapi support $brlapi"
  5818. echo "bluez support $bluez"
  5819. echo "Documentation $docs"
  5820. echo "PIE $pie"
  5821. echo "vde support $vde"
  5822. echo "netmap support $netmap"
  5823. echo "Linux AIO support $linux_aio"
  5824. echo "ATTR/XATTR support $attr"
  5825. echo "Install blobs $blobs"
  5826. echo "KVM support $kvm"
  5827. echo "HAX support $hax"
  5828. echo "HVF support $hvf"
  5829. echo "WHPX support $whpx"
  5830. echo "TCG support $tcg"
  5831. if test "$tcg" = "yes" ; then
  5832. echo "TCG debug enabled $debug_tcg"
  5833. echo "TCG interpreter $tcg_interpreter"
  5834. fi
  5835. echo "malloc trim support $malloc_trim"
  5836. echo "RDMA support $rdma"
  5837. echo "PVRDMA support $pvrdma"
  5838. echo "fdt support $fdt"
  5839. echo "membarrier $membarrier"
  5840. echo "preadv support $preadv"
  5841. echo "fdatasync $fdatasync"
  5842. echo "madvise $madvise"
  5843. echo "posix_madvise $posix_madvise"
  5844. echo "posix_memalign $posix_memalign"
  5845. echo "libcap-ng support $cap_ng"
  5846. echo "vhost-net support $vhost_net"
  5847. echo "vhost-crypto support $vhost_crypto"
  5848. echo "vhost-scsi support $vhost_scsi"
  5849. echo "vhost-vsock support $vhost_vsock"
  5850. echo "vhost-user support $vhost_user"
  5851. echo "Trace backends $trace_backends"
  5852. if have_backend "simple"; then
  5853. echo "Trace output file $trace_file-<pid>"
  5854. fi
  5855. echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)"
  5856. echo "rbd support $rbd"
  5857. echo "xfsctl support $xfs"
  5858. echo "smartcard support $smartcard"
  5859. echo "libusb $libusb"
  5860. echo "usb net redir $usb_redir"
  5861. echo "OpenGL support $opengl"
  5862. echo "OpenGL dmabufs $opengl_dmabuf"
  5863. echo "libiscsi support $libiscsi"
  5864. echo "libnfs support $libnfs"
  5865. echo "build guest agent $guest_agent"
  5866. echo "QGA VSS support $guest_agent_with_vss"
  5867. echo "QGA w32 disk info $guest_agent_ntddscsi"
  5868. echo "QGA MSI support $guest_agent_msi"
  5869. echo "seccomp support $seccomp"
  5870. echo "coroutine backend $coroutine"
  5871. echo "coroutine pool $coroutine_pool"
  5872. echo "debug stack usage $debug_stack_usage"
  5873. echo "mutex debugging $debug_mutex"
  5874. echo "crypto afalg $crypto_afalg"
  5875. echo "GlusterFS support $glusterfs"
  5876. echo "gcov $gcov_tool"
  5877. echo "gcov enabled $gcov"
  5878. echo "TPM support $tpm"
  5879. echo "libssh support $libssh"
  5880. echo "QOM debugging $qom_cast_debug"
  5881. echo "Live block migration $live_block_migration"
  5882. echo "lzo support $lzo"
  5883. echo "snappy support $snappy"
  5884. echo "bzip2 support $bzip2"
  5885. echo "lzfse support $lzfse"
  5886. echo "NUMA host support $numa"
  5887. echo "libxml2 $libxml2"
  5888. echo "tcmalloc support $tcmalloc"
  5889. echo "jemalloc support $jemalloc"
  5890. echo "avx2 optimization $avx2_opt"
  5891. echo "replication support $replication"
  5892. echo "VxHS block device $vxhs"
  5893. echo "bochs support $bochs"
  5894. echo "cloop support $cloop"
  5895. echo "dmg support $dmg"
  5896. echo "qcow v1 support $qcow1"
  5897. echo "vdi support $vdi"
  5898. echo "vvfat support $vvfat"
  5899. echo "qed support $qed"
  5900. echo "parallels support $parallels"
  5901. echo "sheepdog support $sheepdog"
  5902. echo "capstone $capstone"
  5903. echo "libpmem support $libpmem"
  5904. echo "libudev $libudev"
  5905. echo "default devices $default_devices"
  5906. if test "$supported_cpu" = "no"; then
  5907. echo
  5908. echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!"
  5909. echo
  5910. echo "CPU host architecture $cpu support is not currently maintained."
  5911. echo "The QEMU project intends to remove support for this host CPU in"
  5912. echo "a future release if nobody volunteers to maintain it and to"
  5913. echo "provide a build host for our continuous integration setup."
  5914. echo "configure has succeeded and you can continue to build, but"
  5915. echo "if you care about QEMU on this platform you should contact"
  5916. echo "us upstream at qemu-devel@nongnu.org."
  5917. fi
  5918. if test "$supported_os" = "no"; then
  5919. echo
  5920. echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!"
  5921. echo
  5922. echo "Host OS $targetos support is not currently maintained."
  5923. echo "The QEMU project intends to remove support for this host OS in"
  5924. echo "a future release if nobody volunteers to maintain it and to"
  5925. echo "provide a build host for our continuous integration setup."
  5926. echo "configure has succeeded and you can continue to build, but"
  5927. echo "if you care about QEMU on this platform you should contact"
  5928. echo "us upstream at qemu-devel@nongnu.org."
  5929. fi
  5930. # Note that if the Python conditional here evaluates True we will exit
  5931. # with status 1 which is a shell 'false' value.
  5932. if ! $python -c 'import sys; sys.exit(sys.version_info < (3,0))'; then
  5933. echo
  5934. echo "warning: Python 2 support is deprecated" >&2
  5935. echo "warning: Python 3 will be required for building future versions of QEMU" >&2
  5936. python2="y"
  5937. fi
  5938. config_host_mak="config-host.mak"
  5939. echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
  5940. echo "# Automatically generated by configure - do not modify" > $config_host_mak
  5941. echo >> $config_host_mak
  5942. echo all: >> $config_host_mak
  5943. echo "prefix=$prefix" >> $config_host_mak
  5944. echo "bindir=$bindir" >> $config_host_mak
  5945. echo "libdir=$libdir" >> $config_host_mak
  5946. echo "libexecdir=$libexecdir" >> $config_host_mak
  5947. echo "includedir=$includedir" >> $config_host_mak
  5948. echo "mandir=$mandir" >> $config_host_mak
  5949. echo "sysconfdir=$sysconfdir" >> $config_host_mak
  5950. echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
  5951. echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
  5952. echo "qemu_firmwarepath=$firmwarepath" >> $config_host_mak
  5953. echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
  5954. echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
  5955. if test "$mingw32" = "no" ; then
  5956. echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
  5957. fi
  5958. echo "qemu_helperdir=$libexecdir" >> $config_host_mak
  5959. echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
  5960. echo "qemu_icondir=$qemu_icondir" >> $config_host_mak
  5961. echo "qemu_desktopdir=$qemu_desktopdir" >> $config_host_mak
  5962. echo "libs_cpu=$libs_cpu" >> $config_host_mak
  5963. echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
  5964. echo "GIT=$git" >> $config_host_mak
  5965. echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
  5966. echo "GIT_UPDATE=$git_update" >> $config_host_mak
  5967. echo "ARCH=$ARCH" >> $config_host_mak
  5968. if test "$default_devices" = "yes" ; then
  5969. echo "CONFIG_MINIKCONF_MODE=--defconfig" >> $config_host_mak
  5970. else
  5971. echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak
  5972. fi
  5973. if test "$debug_tcg" = "yes" ; then
  5974. echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
  5975. fi
  5976. if test "$strip_opt" = "yes" ; then
  5977. echo "STRIP=${strip}" >> $config_host_mak
  5978. fi
  5979. if test "$bigendian" = "yes" ; then
  5980. echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
  5981. fi
  5982. if test "$mingw32" = "yes" ; then
  5983. echo "CONFIG_WIN32=y" >> $config_host_mak
  5984. rc_version=$(cat $source_path/VERSION)
  5985. version_major=${rc_version%%.*}
  5986. rc_version=${rc_version#*.}
  5987. version_minor=${rc_version%%.*}
  5988. rc_version=${rc_version#*.}
  5989. version_subminor=${rc_version%%.*}
  5990. version_micro=0
  5991. echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
  5992. echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
  5993. if test "$guest_agent_with_vss" = "yes" ; then
  5994. echo "CONFIG_QGA_VSS=y" >> $config_host_mak
  5995. echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak
  5996. echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
  5997. fi
  5998. if test "$guest_agent_ntddscsi" = "yes" ; then
  5999. echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak
  6000. fi
  6001. if test "$guest_agent_msi" = "yes"; then
  6002. echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
  6003. echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
  6004. echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
  6005. echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak
  6006. echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
  6007. echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
  6008. echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
  6009. fi
  6010. else
  6011. echo "CONFIG_POSIX=y" >> $config_host_mak
  6012. fi
  6013. if test "$linux" = "yes" ; then
  6014. echo "CONFIG_LINUX=y" >> $config_host_mak
  6015. fi
  6016. if test "$darwin" = "yes" ; then
  6017. echo "CONFIG_DARWIN=y" >> $config_host_mak
  6018. fi
  6019. if test "$solaris" = "yes" ; then
  6020. echo "CONFIG_SOLARIS=y" >> $config_host_mak
  6021. fi
  6022. if test "$haiku" = "yes" ; then
  6023. echo "CONFIG_HAIKU=y" >> $config_host_mak
  6024. fi
  6025. if test "$static" = "yes" ; then
  6026. echo "CONFIG_STATIC=y" >> $config_host_mak
  6027. fi
  6028. if test "$profiler" = "yes" ; then
  6029. echo "CONFIG_PROFILER=y" >> $config_host_mak
  6030. fi
  6031. if test "$want_tools" = "yes" ; then
  6032. echo "CONFIG_TOOLS=y" >> $config_host_mak
  6033. fi
  6034. if test "$slirp" != "no"; then
  6035. echo "CONFIG_SLIRP=y" >> $config_host_mak
  6036. echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
  6037. echo "SLIRP_CFLAGS=$slirp_cflags" >> $config_host_mak
  6038. echo "SLIRP_LIBS=$slirp_libs" >> $config_host_mak
  6039. fi
  6040. if [ "$slirp" = "git" -o "$slirp" = "internal" ]; then
  6041. echo "config-host.h: slirp/all" >> $config_host_mak
  6042. fi
  6043. if test "$vde" = "yes" ; then
  6044. echo "CONFIG_VDE=y" >> $config_host_mak
  6045. echo "VDE_LIBS=$vde_libs" >> $config_host_mak
  6046. fi
  6047. if test "$netmap" = "yes" ; then
  6048. echo "CONFIG_NETMAP=y" >> $config_host_mak
  6049. fi
  6050. if test "$l2tpv3" = "yes" ; then
  6051. echo "CONFIG_L2TPV3=y" >> $config_host_mak
  6052. fi
  6053. if test "$cap_ng" = "yes" ; then
  6054. echo "CONFIG_LIBCAP=y" >> $config_host_mak
  6055. fi
  6056. echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
  6057. for drv in $audio_drv_list; do
  6058. def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
  6059. case "$drv" in
  6060. alsa | oss | pa | sdl)
  6061. echo "$def=m" >> $config_host_mak ;;
  6062. *)
  6063. echo "$def=y" >> $config_host_mak ;;
  6064. esac
  6065. done
  6066. echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak
  6067. echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak
  6068. echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak
  6069. echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak
  6070. echo "OSS_LIBS=$oss_libs" >> $config_host_mak
  6071. if test "$audio_pt_int" = "yes" ; then
  6072. echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
  6073. fi
  6074. if test "$audio_win_int" = "yes" ; then
  6075. echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
  6076. fi
  6077. echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
  6078. echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
  6079. if test "$vnc" = "yes" ; then
  6080. echo "CONFIG_VNC=y" >> $config_host_mak
  6081. fi
  6082. if test "$vnc_sasl" = "yes" ; then
  6083. echo "CONFIG_VNC_SASL=y" >> $config_host_mak
  6084. fi
  6085. if test "$vnc_jpeg" = "yes" ; then
  6086. echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
  6087. fi
  6088. if test "$vnc_png" = "yes" ; then
  6089. echo "CONFIG_VNC_PNG=y" >> $config_host_mak
  6090. fi
  6091. if test "$xkbcommon" = "yes" ; then
  6092. echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak
  6093. echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak
  6094. fi
  6095. if test "$xfs" = "yes" ; then
  6096. echo "CONFIG_XFS=y" >> $config_host_mak
  6097. fi
  6098. qemu_version=$(head $source_path/VERSION)
  6099. echo "VERSION=$qemu_version" >>$config_host_mak
  6100. echo "PKGVERSION=$pkgversion" >>$config_host_mak
  6101. echo "SRC_PATH=$source_path" >> $config_host_mak
  6102. echo "TARGET_DIRS=$target_list" >> $config_host_mak
  6103. if [ "$docs" = "yes" ] ; then
  6104. echo "BUILD_DOCS=yes" >> $config_host_mak
  6105. fi
  6106. if test "$modules" = "yes"; then
  6107. # $shacmd can generate a hash started with digit, which the compiler doesn't
  6108. # like as an symbol. So prefix it with an underscore
  6109. echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
  6110. echo "CONFIG_MODULES=y" >> $config_host_mak
  6111. fi
  6112. if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then
  6113. echo "CONFIG_X11=y" >> $config_host_mak
  6114. echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak
  6115. echo "X11_LIBS=$x11_libs" >> $config_host_mak
  6116. fi
  6117. if test "$sdl" = "yes" ; then
  6118. echo "CONFIG_SDL=m" >> $config_host_mak
  6119. echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
  6120. echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
  6121. if test "$sdl_image" = "yes" ; then
  6122. echo "CONFIG_SDL_IMAGE=y" >> $config_host_mak
  6123. fi
  6124. fi
  6125. if test "$cocoa" = "yes" ; then
  6126. echo "CONFIG_COCOA=y" >> $config_host_mak
  6127. fi
  6128. if test "$iconv" = "yes" ; then
  6129. echo "CONFIG_ICONV=y" >> $config_host_mak
  6130. echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak
  6131. echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak
  6132. fi
  6133. if test "$curses" = "yes" ; then
  6134. echo "CONFIG_CURSES=m" >> $config_host_mak
  6135. echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak
  6136. echo "CURSES_LIBS=$curses_lib" >> $config_host_mak
  6137. fi
  6138. if test "$pipe2" = "yes" ; then
  6139. echo "CONFIG_PIPE2=y" >> $config_host_mak
  6140. fi
  6141. if test "$accept4" = "yes" ; then
  6142. echo "CONFIG_ACCEPT4=y" >> $config_host_mak
  6143. fi
  6144. if test "$splice" = "yes" ; then
  6145. echo "CONFIG_SPLICE=y" >> $config_host_mak
  6146. fi
  6147. if test "$eventfd" = "yes" ; then
  6148. echo "CONFIG_EVENTFD=y" >> $config_host_mak
  6149. fi
  6150. if test "$memfd" = "yes" ; then
  6151. echo "CONFIG_MEMFD=y" >> $config_host_mak
  6152. fi
  6153. if test "$have_usbfs" = "yes" ; then
  6154. echo "CONFIG_USBFS=y" >> $config_host_mak
  6155. fi
  6156. if test "$fallocate" = "yes" ; then
  6157. echo "CONFIG_FALLOCATE=y" >> $config_host_mak
  6158. fi
  6159. if test "$fallocate_punch_hole" = "yes" ; then
  6160. echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
  6161. fi
  6162. if test "$fallocate_zero_range" = "yes" ; then
  6163. echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak
  6164. fi
  6165. if test "$posix_fallocate" = "yes" ; then
  6166. echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
  6167. fi
  6168. if test "$sync_file_range" = "yes" ; then
  6169. echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
  6170. fi
  6171. if test "$fiemap" = "yes" ; then
  6172. echo "CONFIG_FIEMAP=y" >> $config_host_mak
  6173. fi
  6174. if test "$dup3" = "yes" ; then
  6175. echo "CONFIG_DUP3=y" >> $config_host_mak
  6176. fi
  6177. if test "$ppoll" = "yes" ; then
  6178. echo "CONFIG_PPOLL=y" >> $config_host_mak
  6179. fi
  6180. if test "$prctl_pr_set_timerslack" = "yes" ; then
  6181. echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
  6182. fi
  6183. if test "$epoll" = "yes" ; then
  6184. echo "CONFIG_EPOLL=y" >> $config_host_mak
  6185. fi
  6186. if test "$epoll_create1" = "yes" ; then
  6187. echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
  6188. fi
  6189. if test "$sendfile" = "yes" ; then
  6190. echo "CONFIG_SENDFILE=y" >> $config_host_mak
  6191. fi
  6192. if test "$timerfd" = "yes" ; then
  6193. echo "CONFIG_TIMERFD=y" >> $config_host_mak
  6194. fi
  6195. if test "$setns" = "yes" ; then
  6196. echo "CONFIG_SETNS=y" >> $config_host_mak
  6197. fi
  6198. if test "$clock_adjtime" = "yes" ; then
  6199. echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak
  6200. fi
  6201. if test "$syncfs" = "yes" ; then
  6202. echo "CONFIG_SYNCFS=y" >> $config_host_mak
  6203. fi
  6204. if test "$inotify" = "yes" ; then
  6205. echo "CONFIG_INOTIFY=y" >> $config_host_mak
  6206. fi
  6207. if test "$inotify1" = "yes" ; then
  6208. echo "CONFIG_INOTIFY1=y" >> $config_host_mak
  6209. fi
  6210. if test "$sem_timedwait" = "yes" ; then
  6211. echo "CONFIG_SEM_TIMEDWAIT=y" >> $config_host_mak
  6212. fi
  6213. if test "$strchrnul" = "yes" ; then
  6214. echo "HAVE_STRCHRNUL=y" >> $config_host_mak
  6215. fi
  6216. if test "$byteswap_h" = "yes" ; then
  6217. echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
  6218. fi
  6219. if test "$bswap_h" = "yes" ; then
  6220. echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
  6221. fi
  6222. if test "$curl" = "yes" ; then
  6223. echo "CONFIG_CURL=m" >> $config_host_mak
  6224. echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
  6225. echo "CURL_LIBS=$curl_libs" >> $config_host_mak
  6226. fi
  6227. if test "$brlapi" = "yes" ; then
  6228. echo "CONFIG_BRLAPI=y" >> $config_host_mak
  6229. echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
  6230. fi
  6231. if test "$bluez" = "yes" ; then
  6232. echo "CONFIG_BLUEZ=y" >> $config_host_mak
  6233. echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
  6234. fi
  6235. if test "$gtk" = "yes" ; then
  6236. echo "CONFIG_GTK=m" >> $config_host_mak
  6237. echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
  6238. echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
  6239. if test "$gtk_gl" = "yes" ; then
  6240. echo "CONFIG_GTK_GL=y" >> $config_host_mak
  6241. fi
  6242. fi
  6243. if test "$gio" = "yes" ; then
  6244. echo "CONFIG_GIO=y" >> $config_host_mak
  6245. echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak
  6246. echo "GIO_LIBS=$gio_libs" >> $config_host_mak
  6247. fi
  6248. echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
  6249. if test "$gnutls" = "yes" ; then
  6250. echo "CONFIG_GNUTLS=y" >> $config_host_mak
  6251. fi
  6252. if test "$gcrypt" = "yes" ; then
  6253. echo "CONFIG_GCRYPT=y" >> $config_host_mak
  6254. if test "$gcrypt_hmac" = "yes" ; then
  6255. echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak
  6256. fi
  6257. fi
  6258. if test "$nettle" = "yes" ; then
  6259. echo "CONFIG_NETTLE=y" >> $config_host_mak
  6260. echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak
  6261. fi
  6262. if test "$tasn1" = "yes" ; then
  6263. echo "CONFIG_TASN1=y" >> $config_host_mak
  6264. fi
  6265. if test "$auth_pam" = "yes" ; then
  6266. echo "CONFIG_AUTH_PAM=y" >> $config_host_mak
  6267. fi
  6268. if test "$have_ifaddrs_h" = "yes" ; then
  6269. echo "HAVE_IFADDRS_H=y" >> $config_host_mak
  6270. fi
  6271. if test "$have_broken_size_max" = "yes" ; then
  6272. echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
  6273. fi
  6274. # Work around a system header bug with some kernel/XFS header
  6275. # versions where they both try to define 'struct fsxattr':
  6276. # xfs headers will not try to redefine structs from linux headers
  6277. # if this macro is set.
  6278. if test "$have_fsxattr" = "yes" ; then
  6279. echo "HAVE_FSXATTR=y" >> $config_host_mak
  6280. fi
  6281. if test "$have_copy_file_range" = "yes" ; then
  6282. echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak
  6283. fi
  6284. if test "$vte" = "yes" ; then
  6285. echo "CONFIG_VTE=y" >> $config_host_mak
  6286. echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
  6287. echo "VTE_LIBS=$vte_libs" >> $config_host_mak
  6288. fi
  6289. if test "$virglrenderer" = "yes" ; then
  6290. echo "CONFIG_VIRGL=y" >> $config_host_mak
  6291. echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak
  6292. echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak
  6293. fi
  6294. if test "$xen" = "yes" ; then
  6295. echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
  6296. echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
  6297. fi
  6298. if test "$linux_aio" = "yes" ; then
  6299. echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
  6300. fi
  6301. if test "$attr" = "yes" ; then
  6302. echo "CONFIG_ATTR=y" >> $config_host_mak
  6303. fi
  6304. if test "$libattr" = "yes" ; then
  6305. echo "CONFIG_LIBATTR=y" >> $config_host_mak
  6306. fi
  6307. if test "$virtfs" = "yes" ; then
  6308. echo "CONFIG_VIRTFS=y" >> $config_host_mak
  6309. fi
  6310. if test "$mpath" = "yes" ; then
  6311. echo "CONFIG_MPATH=y" >> $config_host_mak
  6312. if test "$mpathpersist_new_api" = "yes"; then
  6313. echo "CONFIG_MPATH_NEW_API=y" >> $config_host_mak
  6314. fi
  6315. fi
  6316. if test "$vhost_scsi" = "yes" ; then
  6317. echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
  6318. fi
  6319. if test "$vhost_net" = "yes" ; then
  6320. echo "CONFIG_VHOST_NET=y" >> $config_host_mak
  6321. fi
  6322. if test "$vhost_net_user" = "yes" ; then
  6323. echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak
  6324. fi
  6325. if test "$vhost_crypto" = "yes" ; then
  6326. echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
  6327. fi
  6328. if test "$vhost_vsock" = "yes" ; then
  6329. echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
  6330. fi
  6331. if test "$vhost_kernel" = "yes" ; then
  6332. echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak
  6333. fi
  6334. if test "$vhost_user" = "yes" ; then
  6335. echo "CONFIG_VHOST_USER=y" >> $config_host_mak
  6336. fi
  6337. if test "$blobs" = "yes" ; then
  6338. echo "INSTALL_BLOBS=yes" >> $config_host_mak
  6339. fi
  6340. if test "$iovec" = "yes" ; then
  6341. echo "CONFIG_IOVEC=y" >> $config_host_mak
  6342. fi
  6343. if test "$preadv" = "yes" ; then
  6344. echo "CONFIG_PREADV=y" >> $config_host_mak
  6345. fi
  6346. if test "$fdt" != "no" ; then
  6347. echo "CONFIG_FDT=y" >> $config_host_mak
  6348. fi
  6349. if test "$membarrier" = "yes" ; then
  6350. echo "CONFIG_MEMBARRIER=y" >> $config_host_mak
  6351. fi
  6352. if test "$signalfd" = "yes" ; then
  6353. echo "CONFIG_SIGNALFD=y" >> $config_host_mak
  6354. fi
  6355. if test "$optreset" = "yes" ; then
  6356. echo "HAVE_OPTRESET=y" >> $config_host_mak
  6357. fi
  6358. if test "$tcg" = "yes"; then
  6359. echo "CONFIG_TCG=y" >> $config_host_mak
  6360. if test "$tcg_interpreter" = "yes" ; then
  6361. echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
  6362. fi
  6363. fi
  6364. if test "$fdatasync" = "yes" ; then
  6365. echo "CONFIG_FDATASYNC=y" >> $config_host_mak
  6366. fi
  6367. if test "$madvise" = "yes" ; then
  6368. echo "CONFIG_MADVISE=y" >> $config_host_mak
  6369. fi
  6370. if test "$posix_madvise" = "yes" ; then
  6371. echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
  6372. fi
  6373. if test "$posix_memalign" = "yes" ; then
  6374. echo "CONFIG_POSIX_MEMALIGN=y" >> $config_host_mak
  6375. fi
  6376. if test "$spice" = "yes" ; then
  6377. echo "CONFIG_SPICE=y" >> $config_host_mak
  6378. fi
  6379. if test "$smartcard" = "yes" ; then
  6380. echo "CONFIG_SMARTCARD=y" >> $config_host_mak
  6381. echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak
  6382. echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak
  6383. fi
  6384. if test "$libusb" = "yes" ; then
  6385. echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
  6386. echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak
  6387. echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak
  6388. fi
  6389. if test "$usb_redir" = "yes" ; then
  6390. echo "CONFIG_USB_REDIR=y" >> $config_host_mak
  6391. echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak
  6392. echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak
  6393. fi
  6394. if test "$opengl" = "yes" ; then
  6395. echo "CONFIG_OPENGL=y" >> $config_host_mak
  6396. echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
  6397. if test "$opengl_dmabuf" = "yes" ; then
  6398. echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
  6399. fi
  6400. fi
  6401. if test "$gbm" = "yes" ; then
  6402. echo "CONFIG_GBM=y" >> $config_host_mak
  6403. echo "GBM_LIBS=$gbm_libs" >> $config_host_mak
  6404. echo "GBM_CFLAGS=$gbm_cflags" >> $config_host_mak
  6405. fi
  6406. if test "$malloc_trim" = "yes" ; then
  6407. echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak
  6408. fi
  6409. if test "$avx2_opt" = "yes" ; then
  6410. echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
  6411. fi
  6412. if test "$lzo" = "yes" ; then
  6413. echo "CONFIG_LZO=y" >> $config_host_mak
  6414. fi
  6415. if test "$snappy" = "yes" ; then
  6416. echo "CONFIG_SNAPPY=y" >> $config_host_mak
  6417. fi
  6418. if test "$bzip2" = "yes" ; then
  6419. echo "CONFIG_BZIP2=y" >> $config_host_mak
  6420. echo "BZIP2_LIBS=-lbz2" >> $config_host_mak
  6421. fi
  6422. if test "$lzfse" = "yes" ; then
  6423. echo "CONFIG_LZFSE=y" >> $config_host_mak
  6424. echo "LZFSE_LIBS=-llzfse" >> $config_host_mak
  6425. fi
  6426. if test "$libiscsi" = "yes" ; then
  6427. echo "CONFIG_LIBISCSI=m" >> $config_host_mak
  6428. echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
  6429. echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
  6430. fi
  6431. if test "$libnfs" = "yes" ; then
  6432. echo "CONFIG_LIBNFS=m" >> $config_host_mak
  6433. echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
  6434. fi
  6435. if test "$seccomp" = "yes"; then
  6436. echo "CONFIG_SECCOMP=y" >> $config_host_mak
  6437. echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak
  6438. echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak
  6439. fi
  6440. # XXX: suppress that
  6441. if [ "$bsd" = "yes" ] ; then
  6442. echo "CONFIG_BSD=y" >> $config_host_mak
  6443. fi
  6444. if test "$localtime_r" = "yes" ; then
  6445. echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak
  6446. fi
  6447. if test "$qom_cast_debug" = "yes" ; then
  6448. echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
  6449. fi
  6450. if test "$rbd" = "yes" ; then
  6451. echo "CONFIG_RBD=m" >> $config_host_mak
  6452. echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
  6453. echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
  6454. fi
  6455. echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
  6456. if test "$coroutine_pool" = "yes" ; then
  6457. echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
  6458. else
  6459. echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
  6460. fi
  6461. if test "$debug_stack_usage" = "yes" ; then
  6462. echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak
  6463. fi
  6464. if test "$crypto_afalg" = "yes" ; then
  6465. echo "CONFIG_AF_ALG=y" >> $config_host_mak
  6466. fi
  6467. if test "$open_by_handle_at" = "yes" ; then
  6468. echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
  6469. fi
  6470. if test "$linux_magic_h" = "yes" ; then
  6471. echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
  6472. fi
  6473. if test "$pragma_diagnostic_available" = "yes" ; then
  6474. echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
  6475. fi
  6476. if test "$valgrind_h" = "yes" ; then
  6477. echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
  6478. fi
  6479. if test "$have_asan_iface_fiber" = "yes" ; then
  6480. echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak
  6481. fi
  6482. if test "$has_environ" = "yes" ; then
  6483. echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
  6484. fi
  6485. if test "$cpuid_h" = "yes" ; then
  6486. echo "CONFIG_CPUID_H=y" >> $config_host_mak
  6487. fi
  6488. if test "$int128" = "yes" ; then
  6489. echo "CONFIG_INT128=y" >> $config_host_mak
  6490. fi
  6491. if test "$atomic128" = "yes" ; then
  6492. echo "CONFIG_ATOMIC128=y" >> $config_host_mak
  6493. fi
  6494. if test "$cmpxchg128" = "yes" ; then
  6495. echo "CONFIG_CMPXCHG128=y" >> $config_host_mak
  6496. fi
  6497. if test "$atomic64" = "yes" ; then
  6498. echo "CONFIG_ATOMIC64=y" >> $config_host_mak
  6499. fi
  6500. if test "$vector16" = "yes" ; then
  6501. echo "CONFIG_VECTOR16=y" >> $config_host_mak
  6502. fi
  6503. if test "$getauxval" = "yes" ; then
  6504. echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
  6505. fi
  6506. if test "$glusterfs" = "yes" ; then
  6507. echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
  6508. echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
  6509. echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
  6510. fi
  6511. if test "$glusterfs_xlator_opt" = "yes" ; then
  6512. echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak
  6513. fi
  6514. if test "$glusterfs_discard" = "yes" ; then
  6515. echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
  6516. fi
  6517. if test "$glusterfs_fallocate" = "yes" ; then
  6518. echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak
  6519. fi
  6520. if test "$glusterfs_zerofill" = "yes" ; then
  6521. echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
  6522. fi
  6523. if test "$glusterfs_ftruncate_has_stat" = "yes" ; then
  6524. echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak
  6525. fi
  6526. if test "$glusterfs_iocb_has_stat" = "yes" ; then
  6527. echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak
  6528. fi
  6529. if test "$libssh" = "yes" ; then
  6530. echo "CONFIG_LIBSSH=m" >> $config_host_mak
  6531. echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak
  6532. echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak
  6533. fi
  6534. if test "$live_block_migration" = "yes" ; then
  6535. echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
  6536. fi
  6537. if test "$tpm" = "yes"; then
  6538. echo 'CONFIG_TPM=y' >> $config_host_mak
  6539. fi
  6540. echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
  6541. if have_backend "nop"; then
  6542. echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
  6543. fi
  6544. if have_backend "simple"; then
  6545. echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
  6546. # Set the appropriate trace file.
  6547. trace_file="\"$trace_file-\" FMT_pid"
  6548. fi
  6549. if have_backend "log"; then
  6550. echo "CONFIG_TRACE_LOG=y" >> $config_host_mak
  6551. fi
  6552. if have_backend "ust"; then
  6553. echo "CONFIG_TRACE_UST=y" >> $config_host_mak
  6554. fi
  6555. if have_backend "dtrace"; then
  6556. echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
  6557. if test "$trace_backend_stap" = "yes" ; then
  6558. echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
  6559. fi
  6560. fi
  6561. if have_backend "ftrace"; then
  6562. if test "$linux" = "yes" ; then
  6563. echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
  6564. else
  6565. feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
  6566. fi
  6567. fi
  6568. if have_backend "syslog"; then
  6569. if test "$posix_syslog" = "yes" ; then
  6570. echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak
  6571. else
  6572. feature_not_found "syslog(trace backend)" "syslog not available"
  6573. fi
  6574. fi
  6575. echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
  6576. if test "$rdma" = "yes" ; then
  6577. echo "CONFIG_RDMA=y" >> $config_host_mak
  6578. echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
  6579. fi
  6580. if test "$pvrdma" = "yes" ; then
  6581. echo "CONFIG_PVRDMA=y" >> $config_host_mak
  6582. fi
  6583. if test "$have_rtnetlink" = "yes" ; then
  6584. echo "CONFIG_RTNETLINK=y" >> $config_host_mak
  6585. fi
  6586. if test "$libxml2" = "yes" ; then
  6587. echo "CONFIG_LIBXML2=y" >> $config_host_mak
  6588. echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak
  6589. echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak
  6590. fi
  6591. if test "$replication" = "yes" ; then
  6592. echo "CONFIG_REPLICATION=y" >> $config_host_mak
  6593. fi
  6594. if test "$have_af_vsock" = "yes" ; then
  6595. echo "CONFIG_AF_VSOCK=y" >> $config_host_mak
  6596. fi
  6597. if test "$have_sysmacros" = "yes" ; then
  6598. echo "CONFIG_SYSMACROS=y" >> $config_host_mak
  6599. fi
  6600. if test "$have_static_assert" = "yes" ; then
  6601. echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak
  6602. fi
  6603. if test "$have_utmpx" = "yes" ; then
  6604. echo "HAVE_UTMPX=y" >> $config_host_mak
  6605. fi
  6606. if test "$have_getrandom" = "yes" ; then
  6607. echo "CONFIG_GETRANDOM=y" >> $config_host_mak
  6608. fi
  6609. if test "$ivshmem" = "yes" ; then
  6610. echo "CONFIG_IVSHMEM=y" >> $config_host_mak
  6611. fi
  6612. if test "$capstone" != "no" ; then
  6613. echo "CONFIG_CAPSTONE=y" >> $config_host_mak
  6614. fi
  6615. if test "$debug_mutex" = "yes" ; then
  6616. echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak
  6617. fi
  6618. # Hold two types of flag:
  6619. # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
  6620. # a thread we have a handle to
  6621. # CONFIG_PTHREAD_SETNAME_NP_W_TID - A way of doing it on a particular
  6622. # platform
  6623. if test "$pthread_setname_np_w_tid" = "yes" ; then
  6624. echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
  6625. echo "CONFIG_PTHREAD_SETNAME_NP_W_TID=y" >> $config_host_mak
  6626. elif test "$pthread_setname_np_wo_tid" = "yes" ; then
  6627. echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
  6628. echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=y" >> $config_host_mak
  6629. fi
  6630. if test "$vxhs" = "yes" ; then
  6631. echo "CONFIG_VXHS=y" >> $config_host_mak
  6632. echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
  6633. fi
  6634. if test "$libpmem" = "yes" ; then
  6635. echo "CONFIG_LIBPMEM=y" >> $config_host_mak
  6636. fi
  6637. if test "$bochs" = "yes" ; then
  6638. echo "CONFIG_BOCHS=y" >> $config_host_mak
  6639. fi
  6640. if test "$cloop" = "yes" ; then
  6641. echo "CONFIG_CLOOP=y" >> $config_host_mak
  6642. fi
  6643. if test "$dmg" = "yes" ; then
  6644. echo "CONFIG_DMG=y" >> $config_host_mak
  6645. fi
  6646. if test "$qcow1" = "yes" ; then
  6647. echo "CONFIG_QCOW1=y" >> $config_host_mak
  6648. fi
  6649. if test "$vdi" = "yes" ; then
  6650. echo "CONFIG_VDI=y" >> $config_host_mak
  6651. fi
  6652. if test "$vvfat" = "yes" ; then
  6653. echo "CONFIG_VVFAT=y" >> $config_host_mak
  6654. fi
  6655. if test "$qed" = "yes" ; then
  6656. echo "CONFIG_QED=y" >> $config_host_mak
  6657. fi
  6658. if test "$parallels" = "yes" ; then
  6659. echo "CONFIG_PARALLELS=y" >> $config_host_mak
  6660. fi
  6661. if test "$sheepdog" = "yes" ; then
  6662. echo "CONFIG_SHEEPDOG=y" >> $config_host_mak
  6663. fi
  6664. if test "$tcg_interpreter" = "yes"; then
  6665. QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
  6666. elif test "$ARCH" = "sparc64" ; then
  6667. QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
  6668. elif test "$ARCH" = "s390x" ; then
  6669. QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
  6670. elif test "$ARCH" = "x86_64" || test "$ARCH" = "x32" ; then
  6671. QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
  6672. elif test "$ARCH" = "ppc64" ; then
  6673. QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
  6674. elif test "$ARCH" = "riscv32" || test "$ARCH" = "riscv64" ; then
  6675. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/riscv $QEMU_INCLUDES"
  6676. else
  6677. QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
  6678. fi
  6679. QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg $QEMU_INCLUDES"
  6680. echo "TOOLS=$tools" >> $config_host_mak
  6681. echo "ROMS=$roms" >> $config_host_mak
  6682. echo "MAKE=$make" >> $config_host_mak
  6683. echo "INSTALL=$install" >> $config_host_mak
  6684. echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
  6685. echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
  6686. echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
  6687. echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
  6688. echo "PYTHON=$python" >> $config_host_mak
  6689. echo "PYTHON2=$python2" >> $config_host_mak
  6690. echo "CC=$cc" >> $config_host_mak
  6691. if $iasl -h > /dev/null 2>&1; then
  6692. echo "IASL=$iasl" >> $config_host_mak
  6693. fi
  6694. echo "HOST_CC=$host_cc" >> $config_host_mak
  6695. echo "CXX=$cxx" >> $config_host_mak
  6696. echo "OBJCC=$objcc" >> $config_host_mak
  6697. echo "AR=$ar" >> $config_host_mak
  6698. echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
  6699. echo "AS=$as" >> $config_host_mak
  6700. echo "CCAS=$ccas" >> $config_host_mak
  6701. echo "CPP=$cpp" >> $config_host_mak
  6702. echo "OBJCOPY=$objcopy" >> $config_host_mak
  6703. echo "LD=$ld" >> $config_host_mak
  6704. echo "RANLIB=$ranlib" >> $config_host_mak
  6705. echo "NM=$nm" >> $config_host_mak
  6706. echo "WINDRES=$windres" >> $config_host_mak
  6707. echo "CFLAGS=$CFLAGS" >> $config_host_mak
  6708. echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
  6709. echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
  6710. echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
  6711. echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
  6712. if test "$sparse" = "yes" ; then
  6713. echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
  6714. echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak
  6715. echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
  6716. echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
  6717. echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
  6718. fi
  6719. echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
  6720. echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
  6721. echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
  6722. echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
  6723. echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
  6724. echo "LIBS+=$LIBS" >> $config_host_mak
  6725. echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
  6726. echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak
  6727. echo "EXESUF=$EXESUF" >> $config_host_mak
  6728. echo "DSOSUF=$DSOSUF" >> $config_host_mak
  6729. echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
  6730. echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
  6731. echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak
  6732. echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
  6733. echo "POD2MAN=$POD2MAN" >> $config_host_mak
  6734. if test "$gcov" = "yes" ; then
  6735. echo "CONFIG_GCOV=y" >> $config_host_mak
  6736. echo "GCOV=$gcov_tool" >> $config_host_mak
  6737. fi
  6738. if test "$libudev" != "no"; then
  6739. echo "CONFIG_LIBUDEV=y" >> $config_host_mak
  6740. echo "LIBUDEV_LIBS=$libudev_libs" >> $config_host_mak
  6741. fi
  6742. # use included Linux headers
  6743. if test "$linux" = "yes" ; then
  6744. mkdir -p linux-headers
  6745. case "$cpu" in
  6746. i386|x86_64|x32)
  6747. linux_arch=x86
  6748. ;;
  6749. ppc|ppc64|ppc64le)
  6750. linux_arch=powerpc
  6751. ;;
  6752. s390x)
  6753. linux_arch=s390
  6754. ;;
  6755. aarch64)
  6756. linux_arch=arm64
  6757. ;;
  6758. mips64)
  6759. linux_arch=mips
  6760. ;;
  6761. *)
  6762. # For most CPUs the kernel architecture name and QEMU CPU name match.
  6763. linux_arch="$cpu"
  6764. ;;
  6765. esac
  6766. # For non-KVM architectures we will not have asm headers
  6767. if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
  6768. symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
  6769. fi
  6770. fi
  6771. for target in $target_list; do
  6772. target_dir="$target"
  6773. config_target_mak=$target_dir/config-target.mak
  6774. target_name=$(echo $target | cut -d '-' -f 1)
  6775. target_aligned_only="no"
  6776. case "$target_name" in
  6777. alpha|hppa|mips64el|mips64|mipsel|mips|mipsn32|mipsn32el|sh4|sh4eb|sparc|sparc64|sparc32plus|xtensa|xtensaeb)
  6778. target_aligned_only="yes"
  6779. ;;
  6780. esac
  6781. target_bigendian="no"
  6782. case "$target_name" in
  6783. armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
  6784. target_bigendian="yes"
  6785. ;;
  6786. esac
  6787. target_softmmu="no"
  6788. target_user_only="no"
  6789. target_linux_user="no"
  6790. target_bsd_user="no"
  6791. case "$target" in
  6792. ${target_name}-softmmu)
  6793. target_softmmu="yes"
  6794. ;;
  6795. ${target_name}-linux-user)
  6796. target_user_only="yes"
  6797. target_linux_user="yes"
  6798. ;;
  6799. ${target_name}-bsd-user)
  6800. target_user_only="yes"
  6801. target_bsd_user="yes"
  6802. ;;
  6803. *)
  6804. error_exit "Target '$target' not recognised"
  6805. exit 1
  6806. ;;
  6807. esac
  6808. mkdir -p $target_dir
  6809. echo "# Automatically generated by configure - do not modify" > $config_target_mak
  6810. bflt="no"
  6811. mttcg="no"
  6812. interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g")
  6813. gdb_xml_files=""
  6814. TARGET_ARCH="$target_name"
  6815. TARGET_BASE_ARCH=""
  6816. TARGET_ABI_DIR=""
  6817. case "$target_name" in
  6818. i386)
  6819. mttcg="yes"
  6820. gdb_xml_files="i386-32bit.xml"
  6821. ;;
  6822. x86_64)
  6823. TARGET_BASE_ARCH=i386
  6824. mttcg="yes"
  6825. gdb_xml_files="i386-64bit.xml"
  6826. ;;
  6827. alpha)
  6828. mttcg="yes"
  6829. ;;
  6830. arm|armeb)
  6831. TARGET_ARCH=arm
  6832. bflt="yes"
  6833. mttcg="yes"
  6834. gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
  6835. ;;
  6836. aarch64|aarch64_be)
  6837. TARGET_ARCH=aarch64
  6838. TARGET_BASE_ARCH=arm
  6839. bflt="yes"
  6840. mttcg="yes"
  6841. gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
  6842. ;;
  6843. cris)
  6844. ;;
  6845. hppa)
  6846. mttcg="yes"
  6847. ;;
  6848. lm32)
  6849. ;;
  6850. m68k)
  6851. bflt="yes"
  6852. gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml"
  6853. ;;
  6854. microblaze|microblazeel)
  6855. TARGET_ARCH=microblaze
  6856. bflt="yes"
  6857. echo "TARGET_ABI32=y" >> $config_target_mak
  6858. ;;
  6859. mips|mipsel)
  6860. mttcg="yes"
  6861. TARGET_ARCH=mips
  6862. echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
  6863. ;;
  6864. mipsn32|mipsn32el)
  6865. mttcg="yes"
  6866. TARGET_ARCH=mips64
  6867. TARGET_BASE_ARCH=mips
  6868. echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
  6869. echo "TARGET_ABI32=y" >> $config_target_mak
  6870. ;;
  6871. mips64|mips64el)
  6872. mttcg="yes"
  6873. TARGET_ARCH=mips64
  6874. TARGET_BASE_ARCH=mips
  6875. echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
  6876. ;;
  6877. moxie)
  6878. ;;
  6879. nios2)
  6880. ;;
  6881. or1k)
  6882. TARGET_ARCH=openrisc
  6883. TARGET_BASE_ARCH=openrisc
  6884. ;;
  6885. ppc)
  6886. gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  6887. ;;
  6888. ppc64)
  6889. TARGET_BASE_ARCH=ppc
  6890. TARGET_ABI_DIR=ppc
  6891. mttcg=yes
  6892. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
  6893. ;;
  6894. ppc64le)
  6895. TARGET_ARCH=ppc64
  6896. TARGET_BASE_ARCH=ppc
  6897. TARGET_ABI_DIR=ppc
  6898. mttcg=yes
  6899. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
  6900. ;;
  6901. ppc64abi32)
  6902. TARGET_ARCH=ppc64
  6903. TARGET_BASE_ARCH=ppc
  6904. TARGET_ABI_DIR=ppc
  6905. echo "TARGET_ABI32=y" >> $config_target_mak
  6906. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
  6907. ;;
  6908. riscv32)
  6909. TARGET_BASE_ARCH=riscv
  6910. TARGET_ABI_DIR=riscv
  6911. mttcg=yes
  6912. gdb_xml_files="riscv-32bit-cpu.xml riscv-32bit-fpu.xml riscv-32bit-csr.xml"
  6913. ;;
  6914. riscv64)
  6915. TARGET_BASE_ARCH=riscv
  6916. TARGET_ABI_DIR=riscv
  6917. mttcg=yes
  6918. gdb_xml_files="riscv-64bit-cpu.xml riscv-64bit-fpu.xml riscv-64bit-csr.xml"
  6919. ;;
  6920. sh4|sh4eb)
  6921. TARGET_ARCH=sh4
  6922. bflt="yes"
  6923. ;;
  6924. sparc)
  6925. ;;
  6926. sparc64)
  6927. TARGET_BASE_ARCH=sparc
  6928. ;;
  6929. sparc32plus)
  6930. TARGET_ARCH=sparc64
  6931. TARGET_BASE_ARCH=sparc
  6932. TARGET_ABI_DIR=sparc
  6933. echo "TARGET_ABI32=y" >> $config_target_mak
  6934. ;;
  6935. s390x)
  6936. mttcg=yes
  6937. gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml"
  6938. ;;
  6939. tilegx)
  6940. ;;
  6941. tricore)
  6942. ;;
  6943. unicore32)
  6944. ;;
  6945. xtensa|xtensaeb)
  6946. TARGET_ARCH=xtensa
  6947. bflt="yes"
  6948. mttcg="yes"
  6949. ;;
  6950. *)
  6951. error_exit "Unsupported target CPU"
  6952. ;;
  6953. esac
  6954. # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
  6955. if [ "$TARGET_BASE_ARCH" = "" ]; then
  6956. TARGET_BASE_ARCH=$TARGET_ARCH
  6957. fi
  6958. symlink "$source_path/Makefile.target" "$target_dir/Makefile"
  6959. upper() {
  6960. echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
  6961. }
  6962. target_arch_name="$(upper $TARGET_ARCH)"
  6963. echo "TARGET_$target_arch_name=y" >> $config_target_mak
  6964. echo "TARGET_NAME=$target_name" >> $config_target_mak
  6965. echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
  6966. if [ "$TARGET_ABI_DIR" = "" ]; then
  6967. TARGET_ABI_DIR=$TARGET_ARCH
  6968. fi
  6969. echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
  6970. if [ "$HOST_VARIANT_DIR" != "" ]; then
  6971. echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
  6972. fi
  6973. if supported_xen_target $target; then
  6974. echo "CONFIG_XEN=y" >> $config_target_mak
  6975. echo "$target/config-devices.mak: CONFIG_XEN=y" >> $config_host_mak
  6976. if test "$xen_pci_passthrough" = yes; then
  6977. echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
  6978. fi
  6979. else
  6980. echo "$target/config-devices.mak: CONFIG_XEN=n" >> $config_host_mak
  6981. fi
  6982. if supported_kvm_target $target; then
  6983. echo "CONFIG_KVM=y" >> $config_target_mak
  6984. echo "$target/config-devices.mak: CONFIG_KVM=y" >> $config_host_mak
  6985. else
  6986. echo "$target/config-devices.mak: CONFIG_KVM=n" >> $config_host_mak
  6987. fi
  6988. if supported_hax_target $target; then
  6989. echo "CONFIG_HAX=y" >> $config_target_mak
  6990. fi
  6991. if supported_hvf_target $target; then
  6992. echo "CONFIG_HVF=y" >> $config_target_mak
  6993. fi
  6994. if supported_whpx_target $target; then
  6995. echo "CONFIG_WHPX=y" >> $config_target_mak
  6996. fi
  6997. if test "$target_aligned_only" = "yes" ; then
  6998. echo "TARGET_ALIGNED_ONLY=y" >> $config_target_mak
  6999. fi
  7000. if test "$target_bigendian" = "yes" ; then
  7001. echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
  7002. fi
  7003. if test "$target_softmmu" = "yes" ; then
  7004. echo "CONFIG_SOFTMMU=y" >> $config_target_mak
  7005. if test "$mttcg" = "yes" ; then
  7006. echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak
  7007. fi
  7008. fi
  7009. if test "$target_user_only" = "yes" ; then
  7010. echo "CONFIG_USER_ONLY=y" >> $config_target_mak
  7011. echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
  7012. fi
  7013. if test "$target_linux_user" = "yes" ; then
  7014. echo "CONFIG_LINUX_USER=y" >> $config_target_mak
  7015. fi
  7016. list=""
  7017. if test ! -z "$gdb_xml_files" ; then
  7018. for x in $gdb_xml_files; do
  7019. list="$list $source_path/gdb-xml/$x"
  7020. done
  7021. echo "TARGET_XML_FILES=$list" >> $config_target_mak
  7022. fi
  7023. if test "$target_user_only" = "yes" && test "$bflt" = "yes"; then
  7024. echo "TARGET_HAS_BFLT=y" >> $config_target_mak
  7025. fi
  7026. if test "$target_bsd_user" = "yes" ; then
  7027. echo "CONFIG_BSD_USER=y" >> $config_target_mak
  7028. fi
  7029. # generate QEMU_CFLAGS/LDFLAGS for targets
  7030. cflags=""
  7031. ldflags=""
  7032. disas_config() {
  7033. echo "CONFIG_${1}_DIS=y" >> $config_target_mak
  7034. echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak
  7035. }
  7036. for i in $ARCH $TARGET_BASE_ARCH ; do
  7037. case "$i" in
  7038. alpha)
  7039. disas_config "ALPHA"
  7040. ;;
  7041. aarch64)
  7042. if test -n "${cxx}"; then
  7043. disas_config "ARM_A64"
  7044. fi
  7045. ;;
  7046. arm)
  7047. disas_config "ARM"
  7048. if test -n "${cxx}"; then
  7049. disas_config "ARM_A64"
  7050. fi
  7051. ;;
  7052. cris)
  7053. disas_config "CRIS"
  7054. ;;
  7055. hppa)
  7056. disas_config "HPPA"
  7057. ;;
  7058. i386|x86_64|x32)
  7059. disas_config "I386"
  7060. ;;
  7061. lm32)
  7062. disas_config "LM32"
  7063. ;;
  7064. m68k)
  7065. disas_config "M68K"
  7066. ;;
  7067. microblaze*)
  7068. disas_config "MICROBLAZE"
  7069. ;;
  7070. mips*)
  7071. disas_config "MIPS"
  7072. if test -n "${cxx}"; then
  7073. disas_config "NANOMIPS"
  7074. fi
  7075. ;;
  7076. moxie*)
  7077. disas_config "MOXIE"
  7078. ;;
  7079. nios2)
  7080. disas_config "NIOS2"
  7081. ;;
  7082. or1k)
  7083. disas_config "OPENRISC"
  7084. ;;
  7085. ppc*)
  7086. disas_config "PPC"
  7087. ;;
  7088. riscv*)
  7089. disas_config "RISCV"
  7090. ;;
  7091. s390*)
  7092. disas_config "S390"
  7093. ;;
  7094. sh4)
  7095. disas_config "SH4"
  7096. ;;
  7097. sparc*)
  7098. disas_config "SPARC"
  7099. ;;
  7100. xtensa*)
  7101. disas_config "XTENSA"
  7102. ;;
  7103. esac
  7104. done
  7105. if test "$tcg_interpreter" = "yes" ; then
  7106. disas_config "TCI"
  7107. fi
  7108. case "$ARCH" in
  7109. alpha)
  7110. # Ensure there's only a single GP
  7111. cflags="-msmall-data $cflags"
  7112. ;;
  7113. esac
  7114. if test "$gprof" = "yes" ; then
  7115. echo "TARGET_GPROF=y" >> $config_target_mak
  7116. if test "$target_linux_user" = "yes" ; then
  7117. cflags="-p $cflags"
  7118. ldflags="-p $ldflags"
  7119. fi
  7120. if test "$target_softmmu" = "yes" ; then
  7121. ldflags="-p $ldflags"
  7122. echo "GPROF_CFLAGS=-p" >> $config_target_mak
  7123. fi
  7124. fi
  7125. if test "$target_linux_user" = "yes" || test "$target_bsd_user" = "yes" ; then
  7126. ldflags="$ldflags $textseg_ldflags"
  7127. fi
  7128. # Newer kernels on s390 check for an S390_PGSTE program header and
  7129. # enable the pgste page table extensions in that case. This makes
  7130. # the vm.allocate_pgste sysctl unnecessary. We enable this program
  7131. # header if
  7132. # - we build on s390x
  7133. # - we build the system emulation for s390x (qemu-system-s390x)
  7134. # - KVM is enabled
  7135. # - the linker supports --s390-pgste
  7136. if test "$TARGET_ARCH" = "s390x" && test "$target_softmmu" = "yes" && \
  7137. test "$ARCH" = "s390x" && test "$kvm" = "yes"; then
  7138. if ld_has --s390-pgste ; then
  7139. ldflags="-Wl,--s390-pgste $ldflags"
  7140. fi
  7141. fi
  7142. echo "LDFLAGS+=$ldflags" >> $config_target_mak
  7143. echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
  7144. done # for target in $targets
  7145. echo "PIXMAN_CFLAGS=$pixman_cflags" >> $config_host_mak
  7146. echo "PIXMAN_LIBS=$pixman_libs" >> $config_host_mak
  7147. if [ "$fdt" = "git" ]; then
  7148. echo "config-host.h: dtc/all" >> $config_host_mak
  7149. fi
  7150. if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then
  7151. echo "config-host.h: capstone/all" >> $config_host_mak
  7152. fi
  7153. if test -n "$LIBCAPSTONE"; then
  7154. echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak
  7155. fi
  7156. if test "$numa" = "yes"; then
  7157. echo "CONFIG_NUMA=y" >> $config_host_mak
  7158. fi
  7159. if test "$ccache_cpp2" = "yes"; then
  7160. echo "export CCACHE_CPP2=y" >> $config_host_mak
  7161. fi
  7162. # If we're using a separate build tree, set it up now.
  7163. # DIRS are directories which we simply mkdir in the build tree;
  7164. # LINKS are things to symlink back into the source tree
  7165. # (these can be both files and directories).
  7166. # Caution: do not add files or directories here using wildcards. This
  7167. # will result in problems later if a new file matching the wildcard is
  7168. # added to the source tree -- nothing will cause configure to be rerun
  7169. # so the build tree will be missing the link back to the new file, and
  7170. # tests might fail. Prefer to keep the relevant files in their own
  7171. # directory and symlink the directory instead.
  7172. DIRS="tests tests/tcg tests/tcg/lm32 tests/libqos tests/qapi-schema tests/qemu-iotests tests/vm"
  7173. DIRS="$DIRS tests/fp tests/qgraph"
  7174. DIRS="$DIRS docs docs/interop fsdev scsi"
  7175. DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
  7176. DIRS="$DIRS roms/seabios roms/vgabios"
  7177. LINKS="Makefile"
  7178. LINKS="$LINKS tests/tcg/lm32/Makefile po/Makefile"
  7179. LINKS="$LINKS tests/tcg/Makefile.target tests/fp/Makefile"
  7180. LINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps"
  7181. LINKS="$LINKS pc-bios/spapr-rtas/Makefile"
  7182. LINKS="$LINKS pc-bios/s390-ccw/Makefile"
  7183. LINKS="$LINKS roms/seabios/Makefile roms/vgabios/Makefile"
  7184. LINKS="$LINKS pc-bios/qemu-icon.bmp"
  7185. LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
  7186. LINKS="$LINKS tests/acceptance tests/data"
  7187. LINKS="$LINKS tests/qemu-iotests/check"
  7188. LINKS="$LINKS python"
  7189. for bios_file in \
  7190. $source_path/pc-bios/*.bin \
  7191. $source_path/pc-bios/*.lid \
  7192. $source_path/pc-bios/*.rom \
  7193. $source_path/pc-bios/*.dtb \
  7194. $source_path/pc-bios/*.img \
  7195. $source_path/pc-bios/openbios-* \
  7196. $source_path/pc-bios/u-boot.* \
  7197. $source_path/pc-bios/edk2-*.fd.bz2 \
  7198. $source_path/pc-bios/palcode-*
  7199. do
  7200. LINKS="$LINKS pc-bios/$(basename $bios_file)"
  7201. done
  7202. mkdir -p $DIRS
  7203. for f in $LINKS ; do
  7204. if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
  7205. symlink "$source_path/$f" "$f"
  7206. fi
  7207. done
  7208. (for i in $cross_cc_vars; do
  7209. export $i
  7210. done
  7211. export target_list source_path
  7212. $source_path/tests/tcg/configure.sh)
  7213. # temporary config to build submodules
  7214. for rom in seabios vgabios ; do
  7215. config_mak=roms/$rom/config.mak
  7216. echo "# Automatically generated by configure - do not modify" > $config_mak
  7217. echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
  7218. echo "AS=$as" >> $config_mak
  7219. echo "CCAS=$ccas" >> $config_mak
  7220. echo "CC=$cc" >> $config_mak
  7221. echo "BCC=bcc" >> $config_mak
  7222. echo "CPP=$cpp" >> $config_mak
  7223. echo "OBJCOPY=objcopy" >> $config_mak
  7224. echo "IASL=$iasl" >> $config_mak
  7225. echo "LD=$ld" >> $config_mak
  7226. echo "RANLIB=$ranlib" >> $config_mak
  7227. done
  7228. # set up qemu-iotests in this build directory
  7229. iotests_common_env="tests/qemu-iotests/common.env"
  7230. echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
  7231. echo >> "$iotests_common_env"
  7232. echo "export PYTHON='$python'" >> "$iotests_common_env"
  7233. # Save the configure command line for later reuse.
  7234. cat <<EOD >config.status
  7235. #!/bin/sh
  7236. # Generated by configure.
  7237. # Run this file to recreate the current configuration.
  7238. # Compiler output produced by configure, useful for debugging
  7239. # configure, is in config.log if it exists.
  7240. EOD
  7241. preserve_env() {
  7242. envname=$1
  7243. eval envval=\$$envname
  7244. if test -n "$envval"
  7245. then
  7246. echo "$envname='$envval'" >> config.status
  7247. echo "export $envname" >> config.status
  7248. else
  7249. echo "unset $envname" >> config.status
  7250. fi
  7251. }
  7252. # Preserve various env variables that influence what
  7253. # features/build target configure will detect
  7254. preserve_env AR
  7255. preserve_env AS
  7256. preserve_env CC
  7257. preserve_env CPP
  7258. preserve_env CXX
  7259. preserve_env INSTALL
  7260. preserve_env LD
  7261. preserve_env LD_LIBRARY_PATH
  7262. preserve_env LIBTOOL
  7263. preserve_env MAKE
  7264. preserve_env NM
  7265. preserve_env OBJCOPY
  7266. preserve_env PATH
  7267. preserve_env PKG_CONFIG
  7268. preserve_env PKG_CONFIG_LIBDIR
  7269. preserve_env PKG_CONFIG_PATH
  7270. preserve_env PYTHON
  7271. preserve_env SDL2_CONFIG
  7272. preserve_env SMBD
  7273. preserve_env STRIP
  7274. preserve_env WINDRES
  7275. printf "exec" >>config.status
  7276. printf " '%s'" "$0" "$@" >>config.status
  7277. echo ' "$@"' >>config.status
  7278. chmod +x config.status
  7279. rm -r "$TMPDIR1"