configure 212 KB

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