configure 226 KB

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