configure 165 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449
  1. #!/bin/sh
  2. #
  3. # qemu configure script (c) 2003 Fabrice Bellard
  4. #
  5. # Unset some variables known to interfere with behavior of common tools,
  6. # just as autoconf does.
  7. CLICOLOR_FORCE= GREP_OPTIONS=
  8. unset CLICOLOR_FORCE GREP_OPTIONS
  9. # Don't allow CCACHE, if present, to use cached results of compile tests!
  10. export CCACHE_RECACHE=yes
  11. # Temporary directory used for files created while
  12. # configure runs. Since it is in the build directory
  13. # we can safely blow away any previous version of it
  14. # (and we need not jump through hoops to try to delete
  15. # it when configure exits.)
  16. TMPDIR1="config-temp"
  17. rm -rf "${TMPDIR1}"
  18. mkdir -p "${TMPDIR1}"
  19. if [ $? -ne 0 ]; then
  20. echo "ERROR: failed to create temporary directory"
  21. exit 1
  22. fi
  23. TMPB="qemu-conf"
  24. TMPC="${TMPDIR1}/${TMPB}.c"
  25. TMPO="${TMPDIR1}/${TMPB}.o"
  26. TMPCXX="${TMPDIR1}/${TMPB}.cxx"
  27. TMPE="${TMPDIR1}/${TMPB}.exe"
  28. TMPMO="${TMPDIR1}/${TMPB}.mo"
  29. rm -f config.log
  30. # Print a helpful header at the top of config.log
  31. echo "# QEMU configure log $(date)" >> config.log
  32. printf "# Configured with:" >> config.log
  33. printf " '%s'" "$0" "$@" >> config.log
  34. echo >> config.log
  35. echo "#" >> config.log
  36. error_exit() {
  37. echo
  38. echo "ERROR: $1"
  39. while test -n "$2"; do
  40. echo " $2"
  41. shift
  42. done
  43. echo
  44. exit 1
  45. }
  46. do_compiler() {
  47. # Run the compiler, capturing its output to the log. First argument
  48. # is compiler binary to execute.
  49. local compiler="$1"
  50. shift
  51. echo $compiler "$@" >> config.log
  52. $compiler "$@" >> config.log 2>&1 || return $?
  53. # Test passed. If this is an --enable-werror build, rerun
  54. # the test with -Werror and bail out if it fails. This
  55. # makes warning-generating-errors in configure test code
  56. # obvious to developers.
  57. if test "$werror" != "yes"; then
  58. return 0
  59. fi
  60. # Don't bother rerunning the compile if we were already using -Werror
  61. case "$*" in
  62. *-Werror*)
  63. return 0
  64. ;;
  65. esac
  66. echo $compiler -Werror "$@" >> config.log
  67. $compiler -Werror "$@" >> config.log 2>&1 && return $?
  68. error_exit "configure test passed without -Werror but failed with -Werror." \
  69. "This is probably a bug in the configure script. The failing command" \
  70. "will be at the bottom of config.log." \
  71. "You can run configure with --disable-werror to bypass this check."
  72. }
  73. do_cc() {
  74. do_compiler "$cc" "$@"
  75. }
  76. do_cxx() {
  77. do_compiler "$cxx" "$@"
  78. }
  79. update_cxxflags() {
  80. # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
  81. # options which some versions of GCC's C++ compiler complain about
  82. # because they only make sense for C programs.
  83. QEMU_CXXFLAGS=
  84. for arg in $QEMU_CFLAGS; do
  85. case $arg in
  86. -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
  87. -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
  88. ;;
  89. *)
  90. QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
  91. ;;
  92. esac
  93. done
  94. }
  95. compile_object() {
  96. local_cflags="$1"
  97. do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
  98. }
  99. compile_prog() {
  100. local_cflags="$1"
  101. local_ldflags="$2"
  102. do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
  103. }
  104. # symbolically link $1 to $2. Portable version of "ln -sf".
  105. symlink() {
  106. rm -rf "$2"
  107. mkdir -p "$(dirname "$2")"
  108. ln -s "$1" "$2"
  109. }
  110. # check whether a command is available to this shell (may be either an
  111. # executable or a builtin)
  112. has() {
  113. type "$1" >/dev/null 2>&1
  114. }
  115. # search for an executable in PATH
  116. path_of() {
  117. local_command="$1"
  118. local_ifs="$IFS"
  119. local_dir=""
  120. # pathname has a dir component?
  121. if [ "${local_command#*/}" != "$local_command" ]; then
  122. if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
  123. echo "$local_command"
  124. return 0
  125. fi
  126. fi
  127. if [ -z "$local_command" ]; then
  128. return 1
  129. fi
  130. IFS=:
  131. for local_dir in $PATH; do
  132. if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
  133. echo "$local_dir/$local_command"
  134. IFS="${local_ifs:-$(printf ' \t\n')}"
  135. return 0
  136. fi
  137. done
  138. # not found
  139. IFS="${local_ifs:-$(printf ' \t\n')}"
  140. return 1
  141. }
  142. have_backend () {
  143. echo "$trace_backends" | grep "$1" >/dev/null
  144. }
  145. # default parameters
  146. source_path=$(dirname "$0")
  147. cpu=""
  148. iasl="iasl"
  149. interp_prefix="/usr/gnemul/qemu-%M"
  150. static="no"
  151. cross_prefix=""
  152. audio_drv_list=""
  153. block_drv_rw_whitelist=""
  154. block_drv_ro_whitelist=""
  155. host_cc="cc"
  156. libs_softmmu=""
  157. libs_tools=""
  158. audio_pt_int=""
  159. audio_win_int=""
  160. cc_i386=i386-pc-linux-gnu-gcc
  161. libs_qga=""
  162. debug_info="yes"
  163. stack_protector=""
  164. # Don't accept a target_list environment variable.
  165. unset target_list
  166. # Default value for a variable defining feature "foo".
  167. # * foo="no" feature will only be used if --enable-foo arg is given
  168. # * foo="" feature will be searched for, and if found, will be used
  169. # unless --disable-foo is given
  170. # * foo="yes" this value will only be set by --enable-foo flag.
  171. # feature will searched for,
  172. # if not found, configure exits with error
  173. #
  174. # Always add --enable-foo and --disable-foo command line args.
  175. # Distributions want to ensure that several features are compiled in, and it
  176. # is impossible without a --enable-foo that exits if a feature is not found.
  177. bluez=""
  178. brlapi=""
  179. curl=""
  180. curses=""
  181. docs=""
  182. fdt=""
  183. netmap="no"
  184. pixman=""
  185. sdl=""
  186. sdlabi=""
  187. virtfs=""
  188. vnc="yes"
  189. sparse="no"
  190. vde=""
  191. vnc_sasl=""
  192. vnc_jpeg=""
  193. vnc_png=""
  194. xen=""
  195. xen_ctrl_version=""
  196. xen_pv_domain_build="no"
  197. xen_pci_passthrough=""
  198. linux_aio=""
  199. cap_ng=""
  200. attr=""
  201. libattr=""
  202. xfs=""
  203. vhost_net="no"
  204. vhost_scsi="no"
  205. vhost_vsock="no"
  206. kvm="no"
  207. hax="no"
  208. rdma=""
  209. gprof="no"
  210. debug_tcg="no"
  211. debug="no"
  212. fortify_source=""
  213. strip_opt="yes"
  214. tcg_interpreter="no"
  215. bigendian="no"
  216. mingw32="no"
  217. gcov="no"
  218. gcov_tool="gcov"
  219. EXESUF=""
  220. DSOSUF=".so"
  221. LDFLAGS_SHARED="-shared"
  222. modules="no"
  223. prefix="/usr/local"
  224. mandir="\${prefix}/share/man"
  225. datadir="\${prefix}/share"
  226. qemu_docdir="\${prefix}/share/doc/qemu"
  227. bindir="\${prefix}/bin"
  228. libdir="\${prefix}/lib"
  229. libexecdir="\${prefix}/libexec"
  230. includedir="\${prefix}/include"
  231. sysconfdir="\${prefix}/etc"
  232. local_statedir="\${prefix}/var"
  233. confsuffix="/qemu"
  234. slirp="yes"
  235. oss_lib=""
  236. bsd="no"
  237. linux="no"
  238. solaris="no"
  239. profiler="no"
  240. cocoa="no"
  241. softmmu="yes"
  242. linux_user="no"
  243. bsd_user="no"
  244. aix="no"
  245. blobs="yes"
  246. pkgversion=""
  247. pie=""
  248. qom_cast_debug="yes"
  249. trace_backends="log"
  250. trace_file="trace"
  251. spice=""
  252. rbd=""
  253. smartcard=""
  254. libusb=""
  255. usb_redir=""
  256. opengl=""
  257. opengl_dmabuf="no"
  258. avx2_opt="no"
  259. zlib="yes"
  260. lzo=""
  261. snappy=""
  262. bzip2=""
  263. guest_agent=""
  264. guest_agent_with_vss="no"
  265. guest_agent_ntddscsi="no"
  266. guest_agent_msi=""
  267. vss_win32_sdk=""
  268. win_sdk="no"
  269. want_tools="yes"
  270. libiscsi=""
  271. libnfs=""
  272. coroutine=""
  273. coroutine_pool=""
  274. debug_stack_usage="no"
  275. seccomp=""
  276. glusterfs=""
  277. glusterfs_xlator_opt="no"
  278. glusterfs_discard="no"
  279. glusterfs_fallocate="no"
  280. glusterfs_zerofill="no"
  281. gtk=""
  282. gtkabi=""
  283. gtk_gl="no"
  284. tls_priority="NORMAL"
  285. gnutls=""
  286. gnutls_rnd=""
  287. nettle=""
  288. nettle_kdf="no"
  289. gcrypt=""
  290. gcrypt_hmac="no"
  291. gcrypt_kdf="no"
  292. vte=""
  293. virglrenderer=""
  294. tpm="yes"
  295. libssh2=""
  296. live_block_migration="yes"
  297. numa=""
  298. tcmalloc="no"
  299. jemalloc="no"
  300. replication="yes"
  301. vxhs=""
  302. supported_cpu="no"
  303. supported_os="no"
  304. bogus_os="no"
  305. # parse CC options first
  306. for opt do
  307. optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
  308. case "$opt" in
  309. --cross-prefix=*) cross_prefix="$optarg"
  310. ;;
  311. --cc=*) CC="$optarg"
  312. ;;
  313. --cxx=*) CXX="$optarg"
  314. ;;
  315. --source-path=*) source_path="$optarg"
  316. ;;
  317. --cpu=*) cpu="$optarg"
  318. ;;
  319. --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
  320. EXTRA_CFLAGS="$optarg"
  321. ;;
  322. --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
  323. EXTRA_LDFLAGS="$optarg"
  324. ;;
  325. --enable-debug-info) debug_info="yes"
  326. ;;
  327. --disable-debug-info) debug_info="no"
  328. ;;
  329. esac
  330. done
  331. # OS specific
  332. # Using uname is really, really broken. Once we have the right set of checks
  333. # we can eliminate its usage altogether.
  334. # Preferred compiler:
  335. # ${CC} (if set)
  336. # ${cross_prefix}gcc (if cross-prefix specified)
  337. # system compiler
  338. if test -z "${CC}${cross_prefix}"; then
  339. cc="$host_cc"
  340. else
  341. cc="${CC-${cross_prefix}gcc}"
  342. fi
  343. if test -z "${CXX}${cross_prefix}"; then
  344. cxx="c++"
  345. else
  346. cxx="${CXX-${cross_prefix}g++}"
  347. fi
  348. ar="${AR-${cross_prefix}ar}"
  349. as="${AS-${cross_prefix}as}"
  350. ccas="${CCAS-$cc}"
  351. cpp="${CPP-$cc -E}"
  352. objcopy="${OBJCOPY-${cross_prefix}objcopy}"
  353. ld="${LD-${cross_prefix}ld}"
  354. nm="${NM-${cross_prefix}nm}"
  355. strip="${STRIP-${cross_prefix}strip}"
  356. windres="${WINDRES-${cross_prefix}windres}"
  357. pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
  358. query_pkg_config() {
  359. "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
  360. }
  361. pkg_config=query_pkg_config
  362. sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
  363. sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
  364. # If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
  365. ARFLAGS="${ARFLAGS-rv}"
  366. # default flags for all hosts
  367. # We use -fwrapv to tell the compiler that we require a C dialect where
  368. # left shift of signed integers is well defined and has the expected
  369. # 2s-complement style results. (Both clang and gcc agree that it
  370. # provides these semantics.)
  371. QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
  372. QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
  373. QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
  374. QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
  375. QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
  376. if test "$debug_info" = "yes"; then
  377. CFLAGS="-g $CFLAGS"
  378. LDFLAGS="-g $LDFLAGS"
  379. fi
  380. # make source path absolute
  381. source_path=$(cd "$source_path"; pwd)
  382. # running configure in the source tree?
  383. # we know that's the case if configure is there.
  384. if test -f "./configure"; then
  385. pwd_is_source_path="y"
  386. else
  387. pwd_is_source_path="n"
  388. fi
  389. check_define() {
  390. cat > $TMPC <<EOF
  391. #if !defined($1)
  392. #error $1 not defined
  393. #endif
  394. int main(void) { return 0; }
  395. EOF
  396. compile_object
  397. }
  398. check_include() {
  399. cat > $TMPC <<EOF
  400. #include <$1>
  401. int main(void) { return 0; }
  402. EOF
  403. compile_object
  404. }
  405. write_c_skeleton() {
  406. cat > $TMPC <<EOF
  407. int main(void) { return 0; }
  408. EOF
  409. }
  410. if check_define __linux__ ; then
  411. targetos="Linux"
  412. elif check_define _WIN32 ; then
  413. targetos='MINGW32'
  414. elif check_define __OpenBSD__ ; then
  415. targetos='OpenBSD'
  416. elif check_define __sun__ ; then
  417. targetos='SunOS'
  418. elif check_define __HAIKU__ ; then
  419. targetos='Haiku'
  420. else
  421. targetos=$(uname -s)
  422. fi
  423. # Some host OSes need non-standard checks for which CPU to use.
  424. # Note that these checks are broken for cross-compilation: if you're
  425. # cross-compiling to one of these OSes then you'll need to specify
  426. # the correct CPU with the --cpu option.
  427. case $targetos in
  428. Darwin)
  429. # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
  430. # run 64-bit userspace code.
  431. # If the user didn't specify a CPU explicitly and the kernel says this is
  432. # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
  433. if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
  434. cpu="x86_64"
  435. fi
  436. ;;
  437. SunOS)
  438. # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
  439. if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
  440. cpu="x86_64"
  441. fi
  442. esac
  443. if test ! -z "$cpu" ; then
  444. # command line argument
  445. :
  446. elif check_define __i386__ ; then
  447. cpu="i386"
  448. elif check_define __x86_64__ ; then
  449. if check_define __ILP32__ ; then
  450. cpu="x32"
  451. else
  452. cpu="x86_64"
  453. fi
  454. elif check_define __sparc__ ; then
  455. if check_define __arch64__ ; then
  456. cpu="sparc64"
  457. else
  458. cpu="sparc"
  459. fi
  460. elif check_define _ARCH_PPC ; then
  461. if check_define _ARCH_PPC64 ; then
  462. cpu="ppc64"
  463. else
  464. cpu="ppc"
  465. fi
  466. elif check_define __mips__ ; then
  467. cpu="mips"
  468. elif check_define __ia64__ ; then
  469. cpu="ia64"
  470. elif check_define __s390__ ; then
  471. if check_define __s390x__ ; then
  472. cpu="s390x"
  473. else
  474. cpu="s390"
  475. fi
  476. elif check_define __arm__ ; then
  477. cpu="arm"
  478. elif check_define __aarch64__ ; then
  479. cpu="aarch64"
  480. else
  481. cpu=$(uname -m)
  482. fi
  483. ARCH=
  484. # Normalise host CPU name and set ARCH.
  485. # Note that this case should only have supported host CPUs, not guests.
  486. case "$cpu" in
  487. ppc|ppc64|s390|s390x|sparc64|x32)
  488. cpu="$cpu"
  489. supported_cpu="yes"
  490. ;;
  491. ia64)
  492. cpu="$cpu"
  493. ;;
  494. i386|i486|i586|i686|i86pc|BePC)
  495. cpu="i386"
  496. supported_cpu="yes"
  497. ;;
  498. x86_64|amd64)
  499. cpu="x86_64"
  500. supported_cpu="yes"
  501. ;;
  502. armv*b|armv*l|arm)
  503. cpu="arm"
  504. supported_cpu="yes"
  505. ;;
  506. aarch64)
  507. cpu="aarch64"
  508. supported_cpu="yes"
  509. ;;
  510. mips*)
  511. cpu="mips"
  512. supported_cpu="yes"
  513. ;;
  514. sparc|sun4[cdmuv])
  515. cpu="sparc"
  516. supported_cpu="yes"
  517. ;;
  518. *)
  519. # This will result in either an error or falling back to TCI later
  520. ARCH=unknown
  521. ;;
  522. esac
  523. if test -z "$ARCH"; then
  524. ARCH="$cpu"
  525. fi
  526. # OS specific
  527. # host *BSD for user mode
  528. HOST_VARIANT_DIR=""
  529. case $targetos in
  530. MINGW32*)
  531. mingw32="yes"
  532. hax="yes"
  533. audio_possible_drivers="dsound sdl"
  534. if check_include dsound.h; then
  535. audio_drv_list="dsound"
  536. else
  537. audio_drv_list=""
  538. fi
  539. supported_os="yes"
  540. ;;
  541. GNU/kFreeBSD)
  542. bsd="yes"
  543. audio_drv_list="oss"
  544. audio_possible_drivers="oss sdl pa"
  545. ;;
  546. FreeBSD)
  547. bsd="yes"
  548. make="${MAKE-gmake}"
  549. audio_drv_list="oss"
  550. audio_possible_drivers="oss sdl pa"
  551. # needed for kinfo_getvmmap(3) in libutil.h
  552. LIBS="-lutil $LIBS"
  553. # needed for kinfo_getproc
  554. libs_qga="-lutil $libs_qga"
  555. netmap="" # enable netmap autodetect
  556. HOST_VARIANT_DIR="freebsd"
  557. supported_os="yes"
  558. ;;
  559. DragonFly)
  560. bsd="yes"
  561. make="${MAKE-gmake}"
  562. audio_drv_list="oss"
  563. audio_possible_drivers="oss sdl pa"
  564. HOST_VARIANT_DIR="dragonfly"
  565. ;;
  566. NetBSD)
  567. bsd="yes"
  568. make="${MAKE-gmake}"
  569. audio_drv_list="oss"
  570. audio_possible_drivers="oss sdl"
  571. oss_lib="-lossaudio"
  572. HOST_VARIANT_DIR="netbsd"
  573. supported_os="yes"
  574. ;;
  575. OpenBSD)
  576. bsd="yes"
  577. make="${MAKE-gmake}"
  578. audio_drv_list="sdl"
  579. audio_possible_drivers="sdl"
  580. HOST_VARIANT_DIR="openbsd"
  581. ;;
  582. Darwin)
  583. bsd="yes"
  584. darwin="yes"
  585. hax="yes"
  586. LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
  587. if [ "$cpu" = "x86_64" ] ; then
  588. QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
  589. LDFLAGS="-arch x86_64 $LDFLAGS"
  590. fi
  591. cocoa="yes"
  592. audio_drv_list="coreaudio"
  593. audio_possible_drivers="coreaudio sdl"
  594. LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
  595. libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
  596. # Disable attempts to use ObjectiveC features in os/object.h since they
  597. # won't work when we're compiling with gcc as a C compiler.
  598. QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
  599. HOST_VARIANT_DIR="darwin"
  600. supported_os="yes"
  601. ;;
  602. SunOS)
  603. solaris="yes"
  604. make="${MAKE-gmake}"
  605. install="${INSTALL-ginstall}"
  606. ld="gld"
  607. smbd="${SMBD-/usr/sfw/sbin/smbd}"
  608. needs_libsunmath="no"
  609. solarisrev=$(uname -r | cut -f2 -d.)
  610. if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
  611. if test "$solarisrev" -le 9 ; then
  612. if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
  613. needs_libsunmath="yes"
  614. QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
  615. LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
  616. LIBS="-lsunmath $LIBS"
  617. else
  618. error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
  619. "libsunmath from the Sun Studio compilers tools, due to a lack of" \
  620. "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
  621. "Studio 11 can be downloaded from www.sun.com."
  622. fi
  623. fi
  624. fi
  625. if test -f /usr/include/sys/soundcard.h ; then
  626. audio_drv_list="oss"
  627. fi
  628. audio_possible_drivers="oss sdl"
  629. # needed for CMSG_ macros in sys/socket.h
  630. QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
  631. # needed for TIOCWIN* defines in termios.h
  632. QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
  633. QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
  634. solarisnetlibs="-lsocket -lnsl -lresolv"
  635. LIBS="$solarisnetlibs $LIBS"
  636. libs_qga="$solarisnetlibs $libs_qga"
  637. ;;
  638. AIX)
  639. aix="yes"
  640. make="${MAKE-gmake}"
  641. ;;
  642. Haiku)
  643. haiku="yes"
  644. QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
  645. LIBS="-lposix_error_mapper -lnetwork $LIBS"
  646. ;;
  647. Linux)
  648. audio_drv_list="oss"
  649. audio_possible_drivers="oss alsa sdl pa"
  650. linux="yes"
  651. linux_user="yes"
  652. kvm="yes"
  653. vhost_net="yes"
  654. vhost_scsi="yes"
  655. vhost_vsock="yes"
  656. QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
  657. supported_os="yes"
  658. ;;
  659. *)
  660. # This is a fatal error, but don't report it yet, because we
  661. # might be going to just print the --help text, or it might
  662. # be the result of a missing compiler.
  663. bogus_os="yes"
  664. ;;
  665. esac
  666. if [ "$bsd" = "yes" ] ; then
  667. if [ "$darwin" != "yes" ] ; then
  668. bsd_user="yes"
  669. fi
  670. fi
  671. : ${make=${MAKE-make}}
  672. : ${install=${INSTALL-install}}
  673. : ${python=${PYTHON-python}}
  674. : ${smbd=${SMBD-/usr/sbin/smbd}}
  675. # Default objcc to clang if available, otherwise use CC
  676. if has clang; then
  677. objcc=clang
  678. else
  679. objcc="$cc"
  680. fi
  681. if test "$mingw32" = "yes" ; then
  682. EXESUF=".exe"
  683. DSOSUF=".dll"
  684. QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
  685. # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
  686. QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
  687. # MinGW needs -mthreads for TLS and macro _MT.
  688. QEMU_CFLAGS="-mthreads $QEMU_CFLAGS"
  689. LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
  690. write_c_skeleton;
  691. if compile_prog "" "-liberty" ; then
  692. LIBS="-liberty $LIBS"
  693. fi
  694. prefix="c:/Program Files/QEMU"
  695. mandir="\${prefix}"
  696. datadir="\${prefix}"
  697. qemu_docdir="\${prefix}"
  698. bindir="\${prefix}"
  699. sysconfdir="\${prefix}"
  700. local_statedir=
  701. confsuffix=""
  702. libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -liphlpapi -lnetapi32 $libs_qga"
  703. fi
  704. werror=""
  705. for opt do
  706. optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
  707. case "$opt" in
  708. --help|-h) show_help=yes
  709. ;;
  710. --version|-V) exec cat $source_path/VERSION
  711. ;;
  712. --prefix=*) prefix="$optarg"
  713. ;;
  714. --interp-prefix=*) interp_prefix="$optarg"
  715. ;;
  716. --source-path=*)
  717. ;;
  718. --cross-prefix=*)
  719. ;;
  720. --cc=*)
  721. ;;
  722. --host-cc=*) host_cc="$optarg"
  723. ;;
  724. --cxx=*)
  725. ;;
  726. --iasl=*) iasl="$optarg"
  727. ;;
  728. --objcc=*) objcc="$optarg"
  729. ;;
  730. --make=*) make="$optarg"
  731. ;;
  732. --install=*) install="$optarg"
  733. ;;
  734. --python=*) python="$optarg"
  735. ;;
  736. --gcov=*) gcov_tool="$optarg"
  737. ;;
  738. --smbd=*) smbd="$optarg"
  739. ;;
  740. --extra-cflags=*)
  741. ;;
  742. --extra-ldflags=*)
  743. ;;
  744. --enable-debug-info)
  745. ;;
  746. --disable-debug-info)
  747. ;;
  748. --enable-modules)
  749. modules="yes"
  750. ;;
  751. --disable-modules)
  752. modules="no"
  753. ;;
  754. --cpu=*)
  755. ;;
  756. --target-list=*) target_list="$optarg"
  757. ;;
  758. --enable-trace-backends=*) trace_backends="$optarg"
  759. ;;
  760. # XXX: backwards compatibility
  761. --enable-trace-backend=*) trace_backends="$optarg"
  762. ;;
  763. --with-trace-file=*) trace_file="$optarg"
  764. ;;
  765. --enable-gprof) gprof="yes"
  766. ;;
  767. --enable-gcov) gcov="yes"
  768. ;;
  769. --static)
  770. static="yes"
  771. LDFLAGS="-static $LDFLAGS"
  772. QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
  773. ;;
  774. --mandir=*) mandir="$optarg"
  775. ;;
  776. --bindir=*) bindir="$optarg"
  777. ;;
  778. --libdir=*) libdir="$optarg"
  779. ;;
  780. --libexecdir=*) libexecdir="$optarg"
  781. ;;
  782. --includedir=*) includedir="$optarg"
  783. ;;
  784. --datadir=*) datadir="$optarg"
  785. ;;
  786. --with-confsuffix=*) confsuffix="$optarg"
  787. ;;
  788. --docdir=*) qemu_docdir="$optarg"
  789. ;;
  790. --sysconfdir=*) sysconfdir="$optarg"
  791. ;;
  792. --localstatedir=*) local_statedir="$optarg"
  793. ;;
  794. --sbindir=*|--sharedstatedir=*|\
  795. --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
  796. --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
  797. # These switches are silently ignored, for compatibility with
  798. # autoconf-generated configure scripts. This allows QEMU's
  799. # configure to be used by RPM and similar macros that set
  800. # lots of directory switches by default.
  801. ;;
  802. --with-system-pixman) pixman="system"
  803. ;;
  804. --without-system-pixman) pixman="internal"
  805. ;;
  806. --without-pixman) pixman="none"
  807. ;;
  808. --disable-sdl) sdl="no"
  809. ;;
  810. --enable-sdl) sdl="yes"
  811. ;;
  812. --with-sdlabi=*) sdlabi="$optarg"
  813. ;;
  814. --disable-qom-cast-debug) qom_cast_debug="no"
  815. ;;
  816. --enable-qom-cast-debug) qom_cast_debug="yes"
  817. ;;
  818. --disable-virtfs) virtfs="no"
  819. ;;
  820. --enable-virtfs) virtfs="yes"
  821. ;;
  822. --disable-vnc) vnc="no"
  823. ;;
  824. --enable-vnc) vnc="yes"
  825. ;;
  826. --oss-lib=*) oss_lib="$optarg"
  827. ;;
  828. --audio-drv-list=*) audio_drv_list="$optarg"
  829. ;;
  830. --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
  831. ;;
  832. --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
  833. ;;
  834. --enable-debug-tcg) debug_tcg="yes"
  835. ;;
  836. --disable-debug-tcg) debug_tcg="no"
  837. ;;
  838. --enable-debug)
  839. # Enable debugging options that aren't excessively noisy
  840. debug_tcg="yes"
  841. debug="yes"
  842. strip_opt="no"
  843. fortify_source="no"
  844. ;;
  845. --enable-sparse) sparse="yes"
  846. ;;
  847. --disable-sparse) sparse="no"
  848. ;;
  849. --disable-strip) strip_opt="no"
  850. ;;
  851. --disable-vnc-sasl) vnc_sasl="no"
  852. ;;
  853. --enable-vnc-sasl) vnc_sasl="yes"
  854. ;;
  855. --disable-vnc-jpeg) vnc_jpeg="no"
  856. ;;
  857. --enable-vnc-jpeg) vnc_jpeg="yes"
  858. ;;
  859. --disable-vnc-png) vnc_png="no"
  860. ;;
  861. --enable-vnc-png) vnc_png="yes"
  862. ;;
  863. --disable-slirp) slirp="no"
  864. ;;
  865. --disable-vde) vde="no"
  866. ;;
  867. --enable-vde) vde="yes"
  868. ;;
  869. --disable-netmap) netmap="no"
  870. ;;
  871. --enable-netmap) netmap="yes"
  872. ;;
  873. --disable-xen) xen="no"
  874. ;;
  875. --enable-xen) xen="yes"
  876. ;;
  877. --disable-xen-pci-passthrough) xen_pci_passthrough="no"
  878. ;;
  879. --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
  880. ;;
  881. --disable-xen-pv-domain-build) xen_pv_domain_build="no"
  882. ;;
  883. --enable-xen-pv-domain-build) xen_pv_domain_build="yes"
  884. ;;
  885. --disable-brlapi) brlapi="no"
  886. ;;
  887. --enable-brlapi) brlapi="yes"
  888. ;;
  889. --disable-bluez) bluez="no"
  890. ;;
  891. --enable-bluez) bluez="yes"
  892. ;;
  893. --disable-kvm) kvm="no"
  894. ;;
  895. --enable-kvm) kvm="yes"
  896. ;;
  897. --disable-hax) hax="no"
  898. ;;
  899. --enable-hax) hax="yes"
  900. ;;
  901. --disable-tcg-interpreter) tcg_interpreter="no"
  902. ;;
  903. --enable-tcg-interpreter) tcg_interpreter="yes"
  904. ;;
  905. --disable-cap-ng) cap_ng="no"
  906. ;;
  907. --enable-cap-ng) cap_ng="yes"
  908. ;;
  909. --disable-spice) spice="no"
  910. ;;
  911. --enable-spice) spice="yes"
  912. ;;
  913. --disable-libiscsi) libiscsi="no"
  914. ;;
  915. --enable-libiscsi) libiscsi="yes"
  916. ;;
  917. --disable-libnfs) libnfs="no"
  918. ;;
  919. --enable-libnfs) libnfs="yes"
  920. ;;
  921. --enable-profiler) profiler="yes"
  922. ;;
  923. --disable-cocoa) cocoa="no"
  924. ;;
  925. --enable-cocoa)
  926. cocoa="yes" ;
  927. audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
  928. ;;
  929. --disable-system) softmmu="no"
  930. ;;
  931. --enable-system) softmmu="yes"
  932. ;;
  933. --disable-user)
  934. linux_user="no" ;
  935. bsd_user="no" ;
  936. ;;
  937. --enable-user) ;;
  938. --disable-linux-user) linux_user="no"
  939. ;;
  940. --enable-linux-user) linux_user="yes"
  941. ;;
  942. --disable-bsd-user) bsd_user="no"
  943. ;;
  944. --enable-bsd-user) bsd_user="yes"
  945. ;;
  946. --enable-pie) pie="yes"
  947. ;;
  948. --disable-pie) pie="no"
  949. ;;
  950. --enable-werror) werror="yes"
  951. ;;
  952. --disable-werror) werror="no"
  953. ;;
  954. --enable-stack-protector) stack_protector="yes"
  955. ;;
  956. --disable-stack-protector) stack_protector="no"
  957. ;;
  958. --disable-curses) curses="no"
  959. ;;
  960. --enable-curses) curses="yes"
  961. ;;
  962. --disable-curl) curl="no"
  963. ;;
  964. --enable-curl) curl="yes"
  965. ;;
  966. --disable-fdt) fdt="no"
  967. ;;
  968. --enable-fdt) fdt="yes"
  969. ;;
  970. --disable-linux-aio) linux_aio="no"
  971. ;;
  972. --enable-linux-aio) linux_aio="yes"
  973. ;;
  974. --disable-attr) attr="no"
  975. ;;
  976. --enable-attr) attr="yes"
  977. ;;
  978. --disable-blobs) blobs="no"
  979. ;;
  980. --with-pkgversion=*) pkgversion=" ($optarg)"
  981. ;;
  982. --with-coroutine=*) coroutine="$optarg"
  983. ;;
  984. --disable-coroutine-pool) coroutine_pool="no"
  985. ;;
  986. --enable-coroutine-pool) coroutine_pool="yes"
  987. ;;
  988. --enable-debug-stack-usage) debug_stack_usage="yes"
  989. ;;
  990. --disable-docs) docs="no"
  991. ;;
  992. --enable-docs) docs="yes"
  993. ;;
  994. --disable-vhost-net) vhost_net="no"
  995. ;;
  996. --enable-vhost-net) vhost_net="yes"
  997. ;;
  998. --disable-vhost-scsi) vhost_scsi="no"
  999. ;;
  1000. --enable-vhost-scsi) vhost_scsi="yes"
  1001. ;;
  1002. --disable-vhost-vsock) vhost_vsock="no"
  1003. ;;
  1004. --enable-vhost-vsock) vhost_vsock="yes"
  1005. ;;
  1006. --disable-opengl) opengl="no"
  1007. ;;
  1008. --enable-opengl) opengl="yes"
  1009. ;;
  1010. --disable-rbd) rbd="no"
  1011. ;;
  1012. --enable-rbd) rbd="yes"
  1013. ;;
  1014. --disable-xfsctl) xfs="no"
  1015. ;;
  1016. --enable-xfsctl) xfs="yes"
  1017. ;;
  1018. --disable-smartcard) smartcard="no"
  1019. ;;
  1020. --enable-smartcard) smartcard="yes"
  1021. ;;
  1022. --disable-libusb) libusb="no"
  1023. ;;
  1024. --enable-libusb) libusb="yes"
  1025. ;;
  1026. --disable-usb-redir) usb_redir="no"
  1027. ;;
  1028. --enable-usb-redir) usb_redir="yes"
  1029. ;;
  1030. --disable-zlib-test) zlib="no"
  1031. ;;
  1032. --disable-lzo) lzo="no"
  1033. ;;
  1034. --enable-lzo) lzo="yes"
  1035. ;;
  1036. --disable-snappy) snappy="no"
  1037. ;;
  1038. --enable-snappy) snappy="yes"
  1039. ;;
  1040. --disable-bzip2) bzip2="no"
  1041. ;;
  1042. --enable-bzip2) bzip2="yes"
  1043. ;;
  1044. --enable-guest-agent) guest_agent="yes"
  1045. ;;
  1046. --disable-guest-agent) guest_agent="no"
  1047. ;;
  1048. --enable-guest-agent-msi) guest_agent_msi="yes"
  1049. ;;
  1050. --disable-guest-agent-msi) guest_agent_msi="no"
  1051. ;;
  1052. --with-vss-sdk) vss_win32_sdk=""
  1053. ;;
  1054. --with-vss-sdk=*) vss_win32_sdk="$optarg"
  1055. ;;
  1056. --without-vss-sdk) vss_win32_sdk="no"
  1057. ;;
  1058. --with-win-sdk) win_sdk=""
  1059. ;;
  1060. --with-win-sdk=*) win_sdk="$optarg"
  1061. ;;
  1062. --without-win-sdk) win_sdk="no"
  1063. ;;
  1064. --enable-tools) want_tools="yes"
  1065. ;;
  1066. --disable-tools) want_tools="no"
  1067. ;;
  1068. --enable-seccomp) seccomp="yes"
  1069. ;;
  1070. --disable-seccomp) seccomp="no"
  1071. ;;
  1072. --disable-glusterfs) glusterfs="no"
  1073. ;;
  1074. --enable-glusterfs) glusterfs="yes"
  1075. ;;
  1076. --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
  1077. echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
  1078. ;;
  1079. --enable-vhdx|--disable-vhdx)
  1080. echo "$0: $opt is obsolete, VHDX driver is always built" >&2
  1081. ;;
  1082. --enable-uuid|--disable-uuid)
  1083. echo "$0: $opt is obsolete, UUID support is always built" >&2
  1084. ;;
  1085. --disable-gtk) gtk="no"
  1086. ;;
  1087. --enable-gtk) gtk="yes"
  1088. ;;
  1089. --tls-priority=*) tls_priority="$optarg"
  1090. ;;
  1091. --disable-gnutls) gnutls="no"
  1092. ;;
  1093. --enable-gnutls) gnutls="yes"
  1094. ;;
  1095. --disable-nettle) nettle="no"
  1096. ;;
  1097. --enable-nettle) nettle="yes"
  1098. ;;
  1099. --disable-gcrypt) gcrypt="no"
  1100. ;;
  1101. --enable-gcrypt) gcrypt="yes"
  1102. ;;
  1103. --enable-rdma) rdma="yes"
  1104. ;;
  1105. --disable-rdma) rdma="no"
  1106. ;;
  1107. --with-gtkabi=*) gtkabi="$optarg"
  1108. ;;
  1109. --disable-vte) vte="no"
  1110. ;;
  1111. --enable-vte) vte="yes"
  1112. ;;
  1113. --disable-virglrenderer) virglrenderer="no"
  1114. ;;
  1115. --enable-virglrenderer) virglrenderer="yes"
  1116. ;;
  1117. --disable-tpm) tpm="no"
  1118. ;;
  1119. --enable-tpm) tpm="yes"
  1120. ;;
  1121. --disable-libssh2) libssh2="no"
  1122. ;;
  1123. --enable-libssh2) libssh2="yes"
  1124. ;;
  1125. --disable-live-block-migration) live_block_migration="no"
  1126. ;;
  1127. --enable-live-block-migration) live_block_migration="yes"
  1128. ;;
  1129. --disable-numa) numa="no"
  1130. ;;
  1131. --enable-numa) numa="yes"
  1132. ;;
  1133. --disable-tcmalloc) tcmalloc="no"
  1134. ;;
  1135. --enable-tcmalloc) tcmalloc="yes"
  1136. ;;
  1137. --disable-jemalloc) jemalloc="no"
  1138. ;;
  1139. --enable-jemalloc) jemalloc="yes"
  1140. ;;
  1141. --disable-replication) replication="no"
  1142. ;;
  1143. --enable-replication) replication="yes"
  1144. ;;
  1145. --disable-vxhs) vxhs="no"
  1146. ;;
  1147. --enable-vxhs) vxhs="yes"
  1148. ;;
  1149. *)
  1150. echo "ERROR: unknown option $opt"
  1151. echo "Try '$0 --help' for more information"
  1152. exit 1
  1153. ;;
  1154. esac
  1155. done
  1156. case "$cpu" in
  1157. ppc)
  1158. CPU_CFLAGS="-m32"
  1159. LDFLAGS="-m32 $LDFLAGS"
  1160. ;;
  1161. ppc64)
  1162. CPU_CFLAGS="-m64"
  1163. LDFLAGS="-m64 $LDFLAGS"
  1164. ;;
  1165. sparc)
  1166. CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc"
  1167. LDFLAGS="-m32 -mv8plus $LDFLAGS"
  1168. ;;
  1169. sparc64)
  1170. CPU_CFLAGS="-m64 -mcpu=ultrasparc"
  1171. LDFLAGS="-m64 $LDFLAGS"
  1172. ;;
  1173. s390)
  1174. CPU_CFLAGS="-m31"
  1175. LDFLAGS="-m31 $LDFLAGS"
  1176. ;;
  1177. s390x)
  1178. CPU_CFLAGS="-m64"
  1179. LDFLAGS="-m64 $LDFLAGS"
  1180. ;;
  1181. i386)
  1182. CPU_CFLAGS="-m32"
  1183. LDFLAGS="-m32 $LDFLAGS"
  1184. cc_i386='$(CC) -m32'
  1185. ;;
  1186. x86_64)
  1187. # ??? Only extremely old AMD cpus do not have cmpxchg16b.
  1188. # If we truly care, we should simply detect this case at
  1189. # runtime and generate the fallback to serial emulation.
  1190. CPU_CFLAGS="-m64 -mcx16"
  1191. LDFLAGS="-m64 $LDFLAGS"
  1192. cc_i386='$(CC) -m32'
  1193. ;;
  1194. x32)
  1195. CPU_CFLAGS="-mx32"
  1196. LDFLAGS="-mx32 $LDFLAGS"
  1197. cc_i386='$(CC) -m32'
  1198. ;;
  1199. # No special flags required for other host CPUs
  1200. esac
  1201. QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
  1202. EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
  1203. # For user-mode emulation the host arch has to be one we explicitly
  1204. # support, even if we're using TCI.
  1205. if [ "$ARCH" = "unknown" ]; then
  1206. bsd_user="no"
  1207. linux_user="no"
  1208. fi
  1209. default_target_list=""
  1210. mak_wilds=""
  1211. if [ "$softmmu" = "yes" ]; then
  1212. mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
  1213. fi
  1214. if [ "$linux_user" = "yes" ]; then
  1215. mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
  1216. fi
  1217. if [ "$bsd_user" = "yes" ]; then
  1218. mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
  1219. fi
  1220. for config in $mak_wilds; do
  1221. default_target_list="${default_target_list} $(basename "$config" .mak)"
  1222. done
  1223. # Enumerate public trace backends for --help output
  1224. trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/'))
  1225. if test x"$show_help" = x"yes" ; then
  1226. cat << EOF
  1227. Usage: configure [options]
  1228. Options: [defaults in brackets after descriptions]
  1229. Standard options:
  1230. --help print this message
  1231. --prefix=PREFIX install in PREFIX [$prefix]
  1232. --interp-prefix=PREFIX where to find shared libraries, etc.
  1233. use %M for cpu name [$interp_prefix]
  1234. --target-list=LIST set target list (default: build everything)
  1235. $(echo Available targets: $default_target_list | \
  1236. fold -s -w 53 | sed -e 's/^/ /')
  1237. Advanced options (experts only):
  1238. --source-path=PATH path of source code [$source_path]
  1239. --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
  1240. --cc=CC use C compiler CC [$cc]
  1241. --iasl=IASL use ACPI compiler IASL [$iasl]
  1242. --host-cc=CC use C compiler CC [$host_cc] for code run at
  1243. build time
  1244. --cxx=CXX use C++ compiler CXX [$cxx]
  1245. --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
  1246. --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
  1247. --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
  1248. --make=MAKE use specified make [$make]
  1249. --install=INSTALL use specified install [$install]
  1250. --python=PYTHON use specified python [$python]
  1251. --smbd=SMBD use specified smbd [$smbd]
  1252. --static enable static build [$static]
  1253. --mandir=PATH install man pages in PATH
  1254. --datadir=PATH install firmware in PATH$confsuffix
  1255. --docdir=PATH install documentation in PATH$confsuffix
  1256. --bindir=PATH install binaries in PATH
  1257. --libdir=PATH install libraries in PATH
  1258. --sysconfdir=PATH install config in PATH$confsuffix
  1259. --localstatedir=PATH install local state in PATH (set at runtime on win32)
  1260. --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
  1261. --enable-debug enable common debug build options
  1262. --disable-strip disable stripping binaries
  1263. --disable-werror disable compilation abort on warning
  1264. --disable-stack-protector disable compiler-provided stack protection
  1265. --audio-drv-list=LIST set audio drivers list:
  1266. Available drivers: $audio_possible_drivers
  1267. --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
  1268. --block-drv-rw-whitelist=L
  1269. set block driver read-write whitelist
  1270. (affects only QEMU, not qemu-img)
  1271. --block-drv-ro-whitelist=L
  1272. set block driver read-only whitelist
  1273. (affects only QEMU, not qemu-img)
  1274. --enable-trace-backends=B Set trace backend
  1275. Available backends: $trace_backend_list
  1276. --with-trace-file=NAME Full PATH,NAME of file to store traces
  1277. Default:trace-<pid>
  1278. --disable-slirp disable SLIRP userspace network connectivity
  1279. --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
  1280. --oss-lib path to OSS library
  1281. --cpu=CPU Build for host CPU [$cpu]
  1282. --with-coroutine=BACKEND coroutine backend. Supported options:
  1283. ucontext, sigaltstack, windows
  1284. --enable-gcov enable test coverage analysis with gcov
  1285. --gcov=GCOV use specified gcov [$gcov_tool]
  1286. --disable-blobs disable installing provided firmware blobs
  1287. --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
  1288. --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
  1289. --tls-priority default TLS protocol/cipher priority string
  1290. --enable-gprof QEMU profiling with gprof
  1291. --enable-profiler profiler support
  1292. --enable-xen-pv-domain-build
  1293. xen pv domain builder
  1294. --enable-debug-stack-usage
  1295. track the maximum stack usage of stacks created by qemu_alloc_stack
  1296. Optional features, enabled with --enable-FEATURE and
  1297. disabled with --disable-FEATURE, default is enabled if available:
  1298. system all system emulation targets
  1299. user supported user emulation targets
  1300. linux-user all linux usermode emulation targets
  1301. bsd-user all BSD usermode emulation targets
  1302. docs build documentation
  1303. guest-agent build the QEMU Guest Agent
  1304. guest-agent-msi build guest agent Windows MSI installation package
  1305. pie Position Independent Executables
  1306. modules modules support
  1307. debug-tcg TCG debugging (default is disabled)
  1308. debug-info debugging information
  1309. sparse sparse checker
  1310. gnutls GNUTLS cryptography support
  1311. nettle nettle cryptography support
  1312. gcrypt libgcrypt cryptography support
  1313. sdl SDL UI
  1314. --with-sdlabi select preferred SDL ABI 1.2 or 2.0
  1315. gtk gtk UI
  1316. --with-gtkabi select preferred GTK ABI 2.0 or 3.0
  1317. vte vte support for the gtk UI
  1318. curses curses UI
  1319. vnc VNC UI support
  1320. vnc-sasl SASL encryption for VNC server
  1321. vnc-jpeg JPEG lossy compression for VNC server
  1322. vnc-png PNG compression for VNC server
  1323. cocoa Cocoa UI (Mac OS X only)
  1324. virtfs VirtFS
  1325. xen xen backend driver support
  1326. xen-pci-passthrough
  1327. brlapi BrlAPI (Braile)
  1328. curl curl connectivity
  1329. fdt fdt device tree
  1330. bluez bluez stack connectivity
  1331. kvm KVM acceleration support
  1332. hax HAX acceleration support
  1333. rdma RDMA-based migration support
  1334. vde support for vde network
  1335. netmap support for netmap network
  1336. linux-aio Linux AIO support
  1337. cap-ng libcap-ng support
  1338. attr attr and xattr support
  1339. vhost-net vhost-net acceleration support
  1340. spice spice
  1341. rbd rados block device (rbd)
  1342. libiscsi iscsi support
  1343. libnfs nfs support
  1344. smartcard smartcard support (libcacard)
  1345. libusb libusb (for usb passthrough)
  1346. live-block-migration Block migration in the main migration stream
  1347. usb-redir usb network redirection support
  1348. lzo support of lzo compression library
  1349. snappy support of snappy compression library
  1350. bzip2 support of bzip2 compression library
  1351. (for reading bzip2-compressed dmg images)
  1352. seccomp seccomp support
  1353. coroutine-pool coroutine freelist (better performance)
  1354. glusterfs GlusterFS backend
  1355. tpm TPM support
  1356. libssh2 ssh block device support
  1357. numa libnuma support
  1358. tcmalloc tcmalloc support
  1359. jemalloc jemalloc support
  1360. replication replication support
  1361. vhost-vsock virtio sockets device support
  1362. opengl opengl support
  1363. virglrenderer virgl rendering support
  1364. xfsctl xfsctl support
  1365. qom-cast-debug cast debugging support
  1366. tools build qemu-io, qemu-nbd and qemu-image tools
  1367. vxhs Veritas HyperScale vDisk backend support
  1368. NOTE: The object files are built at the place where configure is launched
  1369. EOF
  1370. exit 0
  1371. fi
  1372. if ! has $python; then
  1373. error_exit "Python not found. Use --python=/path/to/python"
  1374. fi
  1375. # Note that if the Python conditional here evaluates True we will exit
  1376. # with status 1 which is a shell 'false' value.
  1377. if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.version_info >= (3,))'; then
  1378. error_exit "Cannot use '$python', Python 2.6 or later is required." \
  1379. "Note that Python 3 or later is not yet supported." \
  1380. "Use --python=/path/to/python to specify a supported Python."
  1381. fi
  1382. # Suppress writing compiled files
  1383. python="$python -B"
  1384. # Now we have handled --enable-tcg-interpreter and know we're not just
  1385. # printing the help message, bail out if the host CPU isn't supported.
  1386. if test "$ARCH" = "unknown"; then
  1387. if test "$tcg_interpreter" = "yes" ; then
  1388. echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
  1389. else
  1390. error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
  1391. fi
  1392. fi
  1393. # Consult white-list to determine whether to enable werror
  1394. # by default. Only enable by default for git builds
  1395. if test -z "$werror" ; then
  1396. if test -d "$source_path/.git" -a \
  1397. \( "$linux" = "yes" -o "$mingw32" = "yes" \) ; then
  1398. werror="yes"
  1399. else
  1400. werror="no"
  1401. fi
  1402. fi
  1403. # check that the C compiler works.
  1404. write_c_skeleton;
  1405. if compile_object ; then
  1406. : C compiler works ok
  1407. else
  1408. error_exit "\"$cc\" either does not exist or does not work"
  1409. fi
  1410. if ! compile_prog ; then
  1411. error_exit "\"$cc\" cannot build an executable (is your linker broken?)"
  1412. fi
  1413. if test "$bogus_os" = "yes"; then
  1414. # Now that we know that we're not printing the help and that
  1415. # the compiler works (so the results of the check_defines we used
  1416. # to identify the OS are reliable), if we didn't recognize the
  1417. # host OS we should stop now.
  1418. error_exit "Unrecognized host OS $targetos"
  1419. fi
  1420. # Check that the C++ compiler exists and works with the C compiler
  1421. if has $cxx; then
  1422. cat > $TMPC <<EOF
  1423. int c_function(void);
  1424. int main(void) { return c_function(); }
  1425. EOF
  1426. compile_object
  1427. cat > $TMPCXX <<EOF
  1428. extern "C" {
  1429. int c_function(void);
  1430. }
  1431. int c_function(void) { return 42; }
  1432. EOF
  1433. update_cxxflags
  1434. if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
  1435. # C++ compiler $cxx works ok with C compiler $cc
  1436. :
  1437. else
  1438. echo "C++ compiler $cxx does not work with C compiler $cc"
  1439. echo "Disabling C++ specific optional code"
  1440. cxx=
  1441. fi
  1442. else
  1443. echo "No C++ compiler available; disabling C++ specific optional code"
  1444. cxx=
  1445. fi
  1446. gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
  1447. gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
  1448. gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
  1449. gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
  1450. gcc_flags="-Wno-initializer-overrides $gcc_flags"
  1451. gcc_flags="-Wno-string-plus-int $gcc_flags"
  1452. # Note that we do not add -Werror to gcc_flags here, because that would
  1453. # enable it for all configure tests. If a configure test failed due
  1454. # to -Werror this would just silently disable some features,
  1455. # so it's too error prone.
  1456. cc_has_warning_flag() {
  1457. write_c_skeleton;
  1458. # Use the positive sense of the flag when testing for -Wno-wombat
  1459. # support (gcc will happily accept the -Wno- form of unknown
  1460. # warning options).
  1461. optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
  1462. compile_prog "-Werror $optflag" ""
  1463. }
  1464. for flag in $gcc_flags; do
  1465. if cc_has_warning_flag $flag ; then
  1466. QEMU_CFLAGS="$QEMU_CFLAGS $flag"
  1467. fi
  1468. done
  1469. if test "$stack_protector" != "no"; then
  1470. cat > $TMPC << EOF
  1471. int main(int argc, char *argv[])
  1472. {
  1473. char arr[64], *p = arr, *c = argv[0];
  1474. while (*c) {
  1475. *p++ = *c++;
  1476. }
  1477. return 0;
  1478. }
  1479. EOF
  1480. gcc_flags="-fstack-protector-strong -fstack-protector-all"
  1481. sp_on=0
  1482. for flag in $gcc_flags; do
  1483. # We need to check both a compile and a link, since some compiler
  1484. # setups fail only on a .c->.o compile and some only at link time
  1485. if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
  1486. compile_prog "-Werror $flag" ""; then
  1487. QEMU_CFLAGS="$QEMU_CFLAGS $flag"
  1488. sp_on=1
  1489. break
  1490. fi
  1491. done
  1492. if test "$stack_protector" = yes; then
  1493. if test $sp_on = 0; then
  1494. error_exit "Stack protector not supported"
  1495. fi
  1496. fi
  1497. fi
  1498. # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
  1499. # large functions that use global variables. The bug is in all releases of
  1500. # GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
  1501. # 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
  1502. cat > $TMPC << EOF
  1503. #if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
  1504. int main(void) { return 0; }
  1505. #else
  1506. #error No bug in this compiler.
  1507. #endif
  1508. EOF
  1509. if compile_prog "-Werror -fno-gcse" "" ; then
  1510. TRANSLATE_OPT_CFLAGS=-fno-gcse
  1511. fi
  1512. if test "$static" = "yes" ; then
  1513. if test "$modules" = "yes" ; then
  1514. error_exit "static and modules are mutually incompatible"
  1515. fi
  1516. if test "$pie" = "yes" ; then
  1517. error_exit "static and pie are mutually incompatible"
  1518. else
  1519. pie="no"
  1520. fi
  1521. fi
  1522. # Unconditional check for compiler __thread support
  1523. cat > $TMPC << EOF
  1524. static __thread int tls_var;
  1525. int main(void) { return tls_var; }
  1526. EOF
  1527. if ! compile_prog "-Werror" "" ; then
  1528. error_exit "Your compiler does not support the __thread specifier for " \
  1529. "Thread-Local Storage (TLS). Please upgrade to a version that does."
  1530. fi
  1531. if test "$pie" = ""; then
  1532. case "$cpu-$targetos" in
  1533. i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
  1534. ;;
  1535. *)
  1536. pie="no"
  1537. ;;
  1538. esac
  1539. fi
  1540. if test "$pie" != "no" ; then
  1541. cat > $TMPC << EOF
  1542. #ifdef __linux__
  1543. # define THREAD __thread
  1544. #else
  1545. # define THREAD
  1546. #endif
  1547. static THREAD int tls_var;
  1548. int main(void) { return tls_var; }
  1549. EOF
  1550. if compile_prog "-fPIE -DPIE" "-pie"; then
  1551. QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
  1552. LDFLAGS="-pie $LDFLAGS"
  1553. pie="yes"
  1554. if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
  1555. LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
  1556. fi
  1557. else
  1558. if test "$pie" = "yes"; then
  1559. error_exit "PIE not available due to missing toolchain support"
  1560. else
  1561. echo "Disabling PIE due to missing toolchain support"
  1562. pie="no"
  1563. fi
  1564. fi
  1565. if compile_prog "-Werror -fno-pie" "-nopie"; then
  1566. CFLAGS_NOPIE="-fno-pie"
  1567. LDFLAGS_NOPIE="-nopie"
  1568. fi
  1569. fi
  1570. ##########################################
  1571. # __sync_fetch_and_and requires at least -march=i486. Many toolchains
  1572. # use i686 as default anyway, but for those that don't, an explicit
  1573. # specification is necessary
  1574. if test "$cpu" = "i386"; then
  1575. cat > $TMPC << EOF
  1576. static int sfaa(int *ptr)
  1577. {
  1578. return __sync_fetch_and_and(ptr, 0);
  1579. }
  1580. int main(void)
  1581. {
  1582. int val = 42;
  1583. val = __sync_val_compare_and_swap(&val, 0, 1);
  1584. sfaa(&val);
  1585. return val;
  1586. }
  1587. EOF
  1588. if ! compile_prog "" "" ; then
  1589. QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
  1590. fi
  1591. fi
  1592. #########################################
  1593. # Solaris specific configure tool chain decisions
  1594. if test "$solaris" = "yes" ; then
  1595. if has $install; then
  1596. :
  1597. else
  1598. error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
  1599. "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
  1600. "to get ginstall which is used by default (which lives in /opt/csw/bin)"
  1601. fi
  1602. if test "$(path_of $install)" = "/usr/sbin/install" ; then
  1603. error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
  1604. "try ginstall from the GNU fileutils available from www.blastwave.org" \
  1605. "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
  1606. fi
  1607. if has ar; then
  1608. :
  1609. else
  1610. if test -f /usr/ccs/bin/ar ; then
  1611. error_exit "No path includes ar" \
  1612. "Add /usr/ccs/bin to your path and rerun configure"
  1613. fi
  1614. error_exit "No path includes ar"
  1615. fi
  1616. fi
  1617. if test -z "${target_list+xxx}" ; then
  1618. target_list="$default_target_list"
  1619. else
  1620. target_list=$(echo "$target_list" | sed -e 's/,/ /g')
  1621. fi
  1622. # Check that we recognised the target name; this allows a more
  1623. # friendly error message than if we let it fall through.
  1624. for target in $target_list; do
  1625. case " $default_target_list " in
  1626. *" $target "*)
  1627. ;;
  1628. *)
  1629. error_exit "Unknown target name '$target'"
  1630. ;;
  1631. esac
  1632. done
  1633. # see if system emulation was really requested
  1634. case " $target_list " in
  1635. *"-softmmu "*) softmmu=yes
  1636. ;;
  1637. *) softmmu=no
  1638. ;;
  1639. esac
  1640. feature_not_found() {
  1641. feature=$1
  1642. remedy=$2
  1643. error_exit "User requested feature $feature" \
  1644. "configure was not able to find it." \
  1645. "$remedy"
  1646. }
  1647. # ---
  1648. # big/little endian test
  1649. cat > $TMPC << EOF
  1650. short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
  1651. short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
  1652. extern int foo(short *, short *);
  1653. int main(int argc, char *argv[]) {
  1654. return foo(big_endian, little_endian);
  1655. }
  1656. EOF
  1657. if compile_object ; then
  1658. if grep -q BiGeNdIaN $TMPO ; then
  1659. bigendian="yes"
  1660. elif grep -q LiTtLeEnDiAn $TMPO ; then
  1661. bigendian="no"
  1662. else
  1663. echo big/little test failed
  1664. fi
  1665. else
  1666. echo big/little test failed
  1667. fi
  1668. ##########################################
  1669. # cocoa implies not SDL or GTK
  1670. # (the cocoa UI code currently assumes it is always the active UI
  1671. # and doesn't interact well with other UI frontend code)
  1672. if test "$cocoa" = "yes"; then
  1673. if test "$sdl" = "yes"; then
  1674. error_exit "Cocoa and SDL UIs cannot both be enabled at once"
  1675. fi
  1676. if test "$gtk" = "yes"; then
  1677. error_exit "Cocoa and GTK UIs cannot both be enabled at once"
  1678. fi
  1679. gtk=no
  1680. sdl=no
  1681. fi
  1682. # Some versions of Mac OS X incorrectly define SIZE_MAX
  1683. cat > $TMPC << EOF
  1684. #include <stdint.h>
  1685. #include <stdio.h>
  1686. int main(int argc, char *argv[]) {
  1687. return printf("%zu", SIZE_MAX);
  1688. }
  1689. EOF
  1690. have_broken_size_max=no
  1691. if ! compile_object -Werror ; then
  1692. have_broken_size_max=yes
  1693. fi
  1694. ##########################################
  1695. # L2TPV3 probe
  1696. cat > $TMPC <<EOF
  1697. #include <sys/socket.h>
  1698. #include <linux/ip.h>
  1699. int main(void) { return sizeof(struct mmsghdr); }
  1700. EOF
  1701. if compile_prog "" "" ; then
  1702. l2tpv3=yes
  1703. else
  1704. l2tpv3=no
  1705. fi
  1706. ##########################################
  1707. # MinGW / Mingw-w64 localtime_r/gmtime_r check
  1708. if test "$mingw32" = "yes"; then
  1709. # Some versions of MinGW / Mingw-w64 lack localtime_r
  1710. # and gmtime_r entirely.
  1711. #
  1712. # Some versions of Mingw-w64 define a macro for
  1713. # localtime_r/gmtime_r.
  1714. #
  1715. # Some versions of Mingw-w64 will define functions
  1716. # for localtime_r/gmtime_r, but only if you have
  1717. # _POSIX_THREAD_SAFE_FUNCTIONS defined. For fun
  1718. # though, unistd.h and pthread.h both define
  1719. # that for you.
  1720. #
  1721. # So this #undef localtime_r and #include <unistd.h>
  1722. # are not in fact redundant.
  1723. cat > $TMPC << EOF
  1724. #include <unistd.h>
  1725. #include <time.h>
  1726. #undef localtime_r
  1727. int main(void) { localtime_r(NULL, NULL); return 0; }
  1728. EOF
  1729. if compile_prog "" "" ; then
  1730. localtime_r="yes"
  1731. else
  1732. localtime_r="no"
  1733. fi
  1734. fi
  1735. ##########################################
  1736. # pkg-config probe
  1737. if ! has "$pkg_config_exe"; then
  1738. error_exit "pkg-config binary '$pkg_config_exe' not found"
  1739. fi
  1740. ##########################################
  1741. # NPTL probe
  1742. if test "$linux_user" = "yes"; then
  1743. cat > $TMPC <<EOF
  1744. #include <sched.h>
  1745. #include <linux/futex.h>
  1746. int main(void) {
  1747. #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
  1748. #error bork
  1749. #endif
  1750. return 0;
  1751. }
  1752. EOF
  1753. if ! compile_object ; then
  1754. feature_not_found "nptl" "Install glibc and linux kernel headers."
  1755. fi
  1756. fi
  1757. ##########################################
  1758. # avx2 optimization requirement check
  1759. cat > $TMPC << EOF
  1760. #pragma GCC push_options
  1761. #pragma GCC target("avx2")
  1762. #include <cpuid.h>
  1763. #include <immintrin.h>
  1764. static int bar(void *a) {
  1765. __m256i x = *(__m256i *)a;
  1766. return _mm256_testz_si256(x, x);
  1767. }
  1768. int main(int argc, char *argv[]) { return bar(argv[0]); }
  1769. EOF
  1770. if compile_object "" ; then
  1771. avx2_opt="yes"
  1772. fi
  1773. #########################################
  1774. # zlib check
  1775. if test "$zlib" != "no" ; then
  1776. cat > $TMPC << EOF
  1777. #include <zlib.h>
  1778. int main(void) { zlibVersion(); return 0; }
  1779. EOF
  1780. if compile_prog "" "-lz" ; then
  1781. :
  1782. else
  1783. error_exit "zlib check failed" \
  1784. "Make sure to have the zlib libs and headers installed."
  1785. fi
  1786. fi
  1787. LIBS="$LIBS -lz"
  1788. ##########################################
  1789. # lzo check
  1790. if test "$lzo" != "no" ; then
  1791. cat > $TMPC << EOF
  1792. #include <lzo/lzo1x.h>
  1793. int main(void) { lzo_version(); return 0; }
  1794. EOF
  1795. if compile_prog "" "-llzo2" ; then
  1796. libs_softmmu="$libs_softmmu -llzo2"
  1797. lzo="yes"
  1798. else
  1799. if test "$lzo" = "yes"; then
  1800. feature_not_found "liblzo2" "Install liblzo2 devel"
  1801. fi
  1802. lzo="no"
  1803. fi
  1804. fi
  1805. ##########################################
  1806. # snappy check
  1807. if test "$snappy" != "no" ; then
  1808. cat > $TMPC << EOF
  1809. #include <snappy-c.h>
  1810. int main(void) { snappy_max_compressed_length(4096); return 0; }
  1811. EOF
  1812. if compile_prog "" "-lsnappy" ; then
  1813. libs_softmmu="$libs_softmmu -lsnappy"
  1814. snappy="yes"
  1815. else
  1816. if test "$snappy" = "yes"; then
  1817. feature_not_found "libsnappy" "Install libsnappy devel"
  1818. fi
  1819. snappy="no"
  1820. fi
  1821. fi
  1822. ##########################################
  1823. # bzip2 check
  1824. if test "$bzip2" != "no" ; then
  1825. cat > $TMPC << EOF
  1826. #include <bzlib.h>
  1827. int main(void) { BZ2_bzlibVersion(); return 0; }
  1828. EOF
  1829. if compile_prog "" "-lbz2" ; then
  1830. bzip2="yes"
  1831. else
  1832. if test "$bzip2" = "yes"; then
  1833. feature_not_found "libbzip2" "Install libbzip2 devel"
  1834. fi
  1835. bzip2="no"
  1836. fi
  1837. fi
  1838. ##########################################
  1839. # libseccomp check
  1840. if test "$seccomp" != "no" ; then
  1841. case "$cpu" in
  1842. i386|x86_64)
  1843. libseccomp_minver="2.1.0"
  1844. ;;
  1845. mips)
  1846. libseccomp_minver="2.2.0"
  1847. ;;
  1848. arm|aarch64)
  1849. libseccomp_minver="2.2.3"
  1850. ;;
  1851. ppc|ppc64)
  1852. libseccomp_minver="2.3.0"
  1853. ;;
  1854. *)
  1855. libseccomp_minver=""
  1856. ;;
  1857. esac
  1858. if test "$libseccomp_minver" != "" &&
  1859. $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
  1860. libs_softmmu="$libs_softmmu $($pkg_config --libs libseccomp)"
  1861. QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags libseccomp)"
  1862. seccomp="yes"
  1863. else
  1864. if test "$seccomp" = "yes" ; then
  1865. if test "$libseccomp_minver" != "" ; then
  1866. feature_not_found "libseccomp" \
  1867. "Install libseccomp devel >= $libseccomp_minver"
  1868. else
  1869. feature_not_found "libseccomp" \
  1870. "libseccomp is not supported for host cpu $cpu"
  1871. fi
  1872. fi
  1873. seccomp="no"
  1874. fi
  1875. fi
  1876. ##########################################
  1877. # xen probe
  1878. if test "$xen" != "no" ; then
  1879. # Check whether Xen library path is specified via --extra-ldflags to avoid
  1880. # overriding this setting with pkg-config output. If not, try pkg-config
  1881. # to obtain all needed flags.
  1882. if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \
  1883. $pkg_config --exists xencontrol ; then
  1884. xen_ctrl_version="$(printf '%d%02d%02d' \
  1885. $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
  1886. xen=yes
  1887. xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab"
  1888. xen_pc="$xen_pc xenevtchn xendevicemodel"
  1889. QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
  1890. libs_softmmu="$($pkg_config --libs $xen_pc) $libs_softmmu"
  1891. LDFLAGS="$($pkg_config --libs $xen_pc) $LDFLAGS"
  1892. else
  1893. xen_libs="-lxenstore -lxenctrl -lxenguest"
  1894. xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
  1895. # First we test whether Xen headers and libraries are available.
  1896. # If no, we are done and there is no Xen support.
  1897. # If yes, more tests are run to detect the Xen version.
  1898. # Xen (any)
  1899. cat > $TMPC <<EOF
  1900. #include <xenctrl.h>
  1901. int main(void) {
  1902. return 0;
  1903. }
  1904. EOF
  1905. if ! compile_prog "" "$xen_libs" ; then
  1906. # Xen not found
  1907. if test "$xen" = "yes" ; then
  1908. feature_not_found "xen" "Install xen devel"
  1909. fi
  1910. xen=no
  1911. # Xen unstable
  1912. elif
  1913. cat > $TMPC <<EOF &&
  1914. #undef XC_WANT_COMPAT_DEVICEMODEL_API
  1915. #define __XEN_TOOLS__
  1916. #include <xendevicemodel.h>
  1917. int main(void) {
  1918. xendevicemodel_handle *xd;
  1919. xd = xendevicemodel_open(0, 0);
  1920. xendevicemodel_close(xd);
  1921. return 0;
  1922. }
  1923. EOF
  1924. compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
  1925. then
  1926. xen_stable_libs="-lxendevicemodel $xen_stable_libs"
  1927. xen_ctrl_version=40900
  1928. xen=yes
  1929. elif
  1930. cat > $TMPC <<EOF &&
  1931. /*
  1932. * If we have stable libs the we don't want the libxc compat
  1933. * layers, regardless of what CFLAGS we may have been given.
  1934. *
  1935. * Also, check if xengnttab_grant_copy_segment_t is defined and
  1936. * grant copy operation is implemented.
  1937. */
  1938. #undef XC_WANT_COMPAT_EVTCHN_API
  1939. #undef XC_WANT_COMPAT_GNTTAB_API
  1940. #undef XC_WANT_COMPAT_MAP_FOREIGN_API
  1941. #include <xenctrl.h>
  1942. #include <xenstore.h>
  1943. #include <xenevtchn.h>
  1944. #include <xengnttab.h>
  1945. #include <xenforeignmemory.h>
  1946. #include <stdint.h>
  1947. #include <xen/hvm/hvm_info_table.h>
  1948. #if !defined(HVM_MAX_VCPUS)
  1949. # error HVM_MAX_VCPUS not defined
  1950. #endif
  1951. int main(void) {
  1952. xc_interface *xc = NULL;
  1953. xenforeignmemory_handle *xfmem;
  1954. xenevtchn_handle *xe;
  1955. xengnttab_handle *xg;
  1956. xen_domain_handle_t handle;
  1957. xengnttab_grant_copy_segment_t* seg = NULL;
  1958. xs_daemon_open();
  1959. xc = xc_interface_open(0, 0, 0);
  1960. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1961. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  1962. xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
  1963. xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
  1964. xc_domain_create(xc, 0, handle, 0, NULL, NULL);
  1965. xfmem = xenforeignmemory_open(0, 0);
  1966. xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
  1967. xe = xenevtchn_open(0, 0);
  1968. xenevtchn_fd(xe);
  1969. xg = xengnttab_open(0, 0);
  1970. xengnttab_grant_copy(xg, 0, seg);
  1971. return 0;
  1972. }
  1973. EOF
  1974. compile_prog "" "$xen_libs $xen_stable_libs"
  1975. then
  1976. xen_ctrl_version=40800
  1977. xen=yes
  1978. elif
  1979. cat > $TMPC <<EOF &&
  1980. /*
  1981. * If we have stable libs the we don't want the libxc compat
  1982. * layers, regardless of what CFLAGS we may have been given.
  1983. */
  1984. #undef XC_WANT_COMPAT_EVTCHN_API
  1985. #undef XC_WANT_COMPAT_GNTTAB_API
  1986. #undef XC_WANT_COMPAT_MAP_FOREIGN_API
  1987. #include <xenctrl.h>
  1988. #include <xenstore.h>
  1989. #include <xenevtchn.h>
  1990. #include <xengnttab.h>
  1991. #include <xenforeignmemory.h>
  1992. #include <stdint.h>
  1993. #include <xen/hvm/hvm_info_table.h>
  1994. #if !defined(HVM_MAX_VCPUS)
  1995. # error HVM_MAX_VCPUS not defined
  1996. #endif
  1997. int main(void) {
  1998. xc_interface *xc = NULL;
  1999. xenforeignmemory_handle *xfmem;
  2000. xenevtchn_handle *xe;
  2001. xengnttab_handle *xg;
  2002. xen_domain_handle_t handle;
  2003. xs_daemon_open();
  2004. xc = xc_interface_open(0, 0, 0);
  2005. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  2006. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  2007. xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
  2008. xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
  2009. xc_domain_create(xc, 0, handle, 0, NULL, NULL);
  2010. xfmem = xenforeignmemory_open(0, 0);
  2011. xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
  2012. xe = xenevtchn_open(0, 0);
  2013. xenevtchn_fd(xe);
  2014. xg = xengnttab_open(0, 0);
  2015. xengnttab_map_grant_ref(xg, 0, 0, 0);
  2016. return 0;
  2017. }
  2018. EOF
  2019. compile_prog "" "$xen_libs $xen_stable_libs"
  2020. then
  2021. xen_ctrl_version=40701
  2022. xen=yes
  2023. elif
  2024. cat > $TMPC <<EOF &&
  2025. #include <xenctrl.h>
  2026. #include <stdint.h>
  2027. int main(void) {
  2028. xc_interface *xc = NULL;
  2029. xen_domain_handle_t handle;
  2030. xc_domain_create(xc, 0, handle, 0, NULL, NULL);
  2031. return 0;
  2032. }
  2033. EOF
  2034. compile_prog "" "$xen_libs"
  2035. then
  2036. xen_ctrl_version=40700
  2037. xen=yes
  2038. # Xen 4.6
  2039. elif
  2040. cat > $TMPC <<EOF &&
  2041. #include <xenctrl.h>
  2042. #include <xenstore.h>
  2043. #include <stdint.h>
  2044. #include <xen/hvm/hvm_info_table.h>
  2045. #if !defined(HVM_MAX_VCPUS)
  2046. # error HVM_MAX_VCPUS not defined
  2047. #endif
  2048. int main(void) {
  2049. xc_interface *xc;
  2050. xs_daemon_open();
  2051. xc = xc_interface_open(0, 0, 0);
  2052. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  2053. xc_gnttab_open(NULL, 0);
  2054. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  2055. xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
  2056. xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
  2057. xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
  2058. return 0;
  2059. }
  2060. EOF
  2061. compile_prog "" "$xen_libs"
  2062. then
  2063. xen_ctrl_version=40600
  2064. xen=yes
  2065. # Xen 4.5
  2066. elif
  2067. cat > $TMPC <<EOF &&
  2068. #include <xenctrl.h>
  2069. #include <xenstore.h>
  2070. #include <stdint.h>
  2071. #include <xen/hvm/hvm_info_table.h>
  2072. #if !defined(HVM_MAX_VCPUS)
  2073. # error HVM_MAX_VCPUS not defined
  2074. #endif
  2075. int main(void) {
  2076. xc_interface *xc;
  2077. xs_daemon_open();
  2078. xc = xc_interface_open(0, 0, 0);
  2079. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  2080. xc_gnttab_open(NULL, 0);
  2081. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  2082. xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
  2083. xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
  2084. return 0;
  2085. }
  2086. EOF
  2087. compile_prog "" "$xen_libs"
  2088. then
  2089. xen_ctrl_version=40500
  2090. xen=yes
  2091. elif
  2092. cat > $TMPC <<EOF &&
  2093. #include <xenctrl.h>
  2094. #include <xenstore.h>
  2095. #include <stdint.h>
  2096. #include <xen/hvm/hvm_info_table.h>
  2097. #if !defined(HVM_MAX_VCPUS)
  2098. # error HVM_MAX_VCPUS not defined
  2099. #endif
  2100. int main(void) {
  2101. xc_interface *xc;
  2102. xs_daemon_open();
  2103. xc = xc_interface_open(0, 0, 0);
  2104. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  2105. xc_gnttab_open(NULL, 0);
  2106. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  2107. xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
  2108. return 0;
  2109. }
  2110. EOF
  2111. compile_prog "" "$xen_libs"
  2112. then
  2113. xen_ctrl_version=40200
  2114. xen=yes
  2115. else
  2116. if test "$xen" = "yes" ; then
  2117. feature_not_found "xen (unsupported version)" \
  2118. "Install a supported xen (xen 4.2 or newer)"
  2119. fi
  2120. xen=no
  2121. fi
  2122. if test "$xen" = yes; then
  2123. if test $xen_ctrl_version -ge 40701 ; then
  2124. libs_softmmu="$xen_stable_libs $libs_softmmu"
  2125. fi
  2126. libs_softmmu="$xen_libs $libs_softmmu"
  2127. fi
  2128. fi
  2129. fi
  2130. if test "$xen_pci_passthrough" != "no"; then
  2131. if test "$xen" = "yes" && test "$linux" = "yes"; then
  2132. xen_pci_passthrough=yes
  2133. else
  2134. if test "$xen_pci_passthrough" = "yes"; then
  2135. error_exit "User requested feature Xen PCI Passthrough" \
  2136. " but this feature requires /sys from Linux"
  2137. fi
  2138. xen_pci_passthrough=no
  2139. fi
  2140. fi
  2141. if test "$xen_pv_domain_build" = "yes" &&
  2142. test "$xen" != "yes"; then
  2143. error_exit "User requested Xen PV domain builder support" \
  2144. "which requires Xen support."
  2145. fi
  2146. ##########################################
  2147. # Sparse probe
  2148. if test "$sparse" != "no" ; then
  2149. if has cgcc; then
  2150. sparse=yes
  2151. else
  2152. if test "$sparse" = "yes" ; then
  2153. feature_not_found "sparse" "Install sparse binary"
  2154. fi
  2155. sparse=no
  2156. fi
  2157. fi
  2158. ##########################################
  2159. # X11 probe
  2160. x11_cflags=
  2161. x11_libs=-lX11
  2162. if $pkg_config --exists "x11"; then
  2163. x11_cflags=$($pkg_config --cflags x11)
  2164. x11_libs=$($pkg_config --libs x11)
  2165. fi
  2166. ##########################################
  2167. # GTK probe
  2168. if test "$gtkabi" = ""; then
  2169. # The GTK ABI was not specified explicitly, so try whether 2.0 is available.
  2170. # Use 3.0 as a fallback if that is available.
  2171. if $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
  2172. gtkabi=2.0
  2173. elif $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
  2174. gtkabi=3.0
  2175. else
  2176. gtkabi=2.0
  2177. fi
  2178. fi
  2179. if test "$gtk" != "no"; then
  2180. gtkpackage="gtk+-$gtkabi"
  2181. gtkx11package="gtk+-x11-$gtkabi"
  2182. if test "$gtkabi" = "3.0" ; then
  2183. gtkversion="3.0.0"
  2184. else
  2185. gtkversion="2.18.0"
  2186. fi
  2187. if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
  2188. gtk_cflags=$($pkg_config --cflags $gtkpackage)
  2189. gtk_libs=$($pkg_config --libs $gtkpackage)
  2190. gtk_version=$($pkg_config --modversion $gtkpackage)
  2191. if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
  2192. gtk_cflags="$gtk_cflags $x11_cflags"
  2193. gtk_libs="$gtk_libs $x11_libs"
  2194. fi
  2195. libs_softmmu="$gtk_libs $libs_softmmu"
  2196. gtk="yes"
  2197. elif test "$gtk" = "yes"; then
  2198. feature_not_found "gtk" "Install gtk2 or gtk3 devel"
  2199. else
  2200. gtk="no"
  2201. fi
  2202. fi
  2203. ##########################################
  2204. # GNUTLS probe
  2205. gnutls_works() {
  2206. # Unfortunately some distros have bad pkg-config information for gnutls
  2207. # such that it claims to exist but you get a compiler error if you try
  2208. # to use the options returned by --libs. Specifically, Ubuntu for --static
  2209. # builds doesn't work:
  2210. # https://bugs.launchpad.net/ubuntu/+source/gnutls26/+bug/1478035
  2211. #
  2212. # So sanity check the cflags/libs before assuming gnutls can be used.
  2213. if ! $pkg_config --exists "gnutls"; then
  2214. return 1
  2215. fi
  2216. write_c_skeleton
  2217. compile_prog "$($pkg_config --cflags gnutls)" "$($pkg_config --libs gnutls)"
  2218. }
  2219. gnutls_gcrypt=no
  2220. gnutls_nettle=no
  2221. if test "$gnutls" != "no"; then
  2222. if gnutls_works; then
  2223. gnutls_cflags=$($pkg_config --cflags gnutls)
  2224. gnutls_libs=$($pkg_config --libs gnutls)
  2225. libs_softmmu="$gnutls_libs $libs_softmmu"
  2226. libs_tools="$gnutls_libs $libs_tools"
  2227. QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
  2228. gnutls="yes"
  2229. # gnutls_rnd requires >= 2.11.0
  2230. if $pkg_config --exists "gnutls >= 2.11.0"; then
  2231. gnutls_rnd="yes"
  2232. else
  2233. gnutls_rnd="no"
  2234. fi
  2235. if $pkg_config --exists 'gnutls >= 3.0'; then
  2236. gnutls_gcrypt=no
  2237. gnutls_nettle=yes
  2238. elif $pkg_config --exists 'gnutls >= 2.12'; then
  2239. case $($pkg_config --libs --static gnutls) in
  2240. *gcrypt*)
  2241. gnutls_gcrypt=yes
  2242. gnutls_nettle=no
  2243. ;;
  2244. *nettle*)
  2245. gnutls_gcrypt=no
  2246. gnutls_nettle=yes
  2247. ;;
  2248. *)
  2249. gnutls_gcrypt=yes
  2250. gnutls_nettle=no
  2251. ;;
  2252. esac
  2253. else
  2254. gnutls_gcrypt=yes
  2255. gnutls_nettle=no
  2256. fi
  2257. elif test "$gnutls" = "yes"; then
  2258. feature_not_found "gnutls" "Install gnutls devel"
  2259. else
  2260. gnutls="no"
  2261. gnutls_rnd="no"
  2262. fi
  2263. else
  2264. gnutls_rnd="no"
  2265. fi
  2266. # If user didn't give a --disable/enable-gcrypt flag,
  2267. # then mark as disabled if user requested nettle
  2268. # explicitly, or if gnutls links to nettle
  2269. if test -z "$gcrypt"
  2270. then
  2271. if test "$nettle" = "yes" || test "$gnutls_nettle" = "yes"
  2272. then
  2273. gcrypt="no"
  2274. fi
  2275. fi
  2276. # If user didn't give a --disable/enable-nettle flag,
  2277. # then mark as disabled if user requested gcrypt
  2278. # explicitly, or if gnutls links to gcrypt
  2279. if test -z "$nettle"
  2280. then
  2281. if test "$gcrypt" = "yes" || test "$gnutls_gcrypt" = "yes"
  2282. then
  2283. nettle="no"
  2284. fi
  2285. fi
  2286. has_libgcrypt_config() {
  2287. if ! has "libgcrypt-config"
  2288. then
  2289. return 1
  2290. fi
  2291. if test -n "$cross_prefix"
  2292. then
  2293. host=$(libgcrypt-config --host)
  2294. if test "$host-" != $cross_prefix
  2295. then
  2296. return 1
  2297. fi
  2298. fi
  2299. return 0
  2300. }
  2301. if test "$gcrypt" != "no"; then
  2302. if has_libgcrypt_config; then
  2303. gcrypt_cflags=$(libgcrypt-config --cflags)
  2304. gcrypt_libs=$(libgcrypt-config --libs)
  2305. # Debian has remove -lgpg-error from libgcrypt-config
  2306. # as it "spreads unnecessary dependencies" which in
  2307. # turn breaks static builds...
  2308. if test "$static" = "yes"
  2309. then
  2310. gcrypt_libs="$gcrypt_libs -lgpg-error"
  2311. fi
  2312. libs_softmmu="$gcrypt_libs $libs_softmmu"
  2313. libs_tools="$gcrypt_libs $libs_tools"
  2314. QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
  2315. gcrypt="yes"
  2316. if test -z "$nettle"; then
  2317. nettle="no"
  2318. fi
  2319. cat > $TMPC << EOF
  2320. #include <gcrypt.h>
  2321. int main(void) {
  2322. gcry_kdf_derive(NULL, 0, GCRY_KDF_PBKDF2,
  2323. GCRY_MD_SHA256,
  2324. NULL, 0, 0, 0, NULL);
  2325. return 0;
  2326. }
  2327. EOF
  2328. if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
  2329. gcrypt_kdf=yes
  2330. fi
  2331. cat > $TMPC << EOF
  2332. #include <gcrypt.h>
  2333. int main(void) {
  2334. gcry_mac_hd_t handle;
  2335. gcry_mac_open(&handle, GCRY_MAC_HMAC_MD5,
  2336. GCRY_MAC_FLAG_SECURE, NULL);
  2337. return 0;
  2338. }
  2339. EOF
  2340. if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
  2341. gcrypt_hmac=yes
  2342. fi
  2343. else
  2344. if test "$gcrypt" = "yes"; then
  2345. feature_not_found "gcrypt" "Install gcrypt devel"
  2346. else
  2347. gcrypt="no"
  2348. fi
  2349. fi
  2350. fi
  2351. if test "$nettle" != "no"; then
  2352. if $pkg_config --exists "nettle"; then
  2353. nettle_cflags=$($pkg_config --cflags nettle)
  2354. nettle_libs=$($pkg_config --libs nettle)
  2355. nettle_version=$($pkg_config --modversion nettle)
  2356. libs_softmmu="$nettle_libs $libs_softmmu"
  2357. libs_tools="$nettle_libs $libs_tools"
  2358. QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
  2359. nettle="yes"
  2360. cat > $TMPC << EOF
  2361. #include <stddef.h>
  2362. #include <nettle/pbkdf2.h>
  2363. int main(void) {
  2364. pbkdf2_hmac_sha256(8, NULL, 1000, 8, NULL, 8, NULL);
  2365. return 0;
  2366. }
  2367. EOF
  2368. if compile_prog "$nettle_cflags" "$nettle_libs" ; then
  2369. nettle_kdf=yes
  2370. fi
  2371. else
  2372. if test "$nettle" = "yes"; then
  2373. feature_not_found "nettle" "Install nettle devel"
  2374. else
  2375. nettle="no"
  2376. fi
  2377. fi
  2378. fi
  2379. if test "$gcrypt" = "yes" && test "$nettle" = "yes"
  2380. then
  2381. error_exit "Only one of gcrypt & nettle can be enabled"
  2382. fi
  2383. ##########################################
  2384. # libtasn1 - only for the TLS creds/session test suite
  2385. tasn1=yes
  2386. tasn1_cflags=""
  2387. tasn1_libs=""
  2388. if $pkg_config --exists "libtasn1"; then
  2389. tasn1_cflags=$($pkg_config --cflags libtasn1)
  2390. tasn1_libs=$($pkg_config --libs libtasn1)
  2391. else
  2392. tasn1=no
  2393. fi
  2394. ##########################################
  2395. # getifaddrs (for tests/test-io-channel-socket )
  2396. have_ifaddrs_h=yes
  2397. if ! check_include "ifaddrs.h" ; then
  2398. have_ifaddrs_h=no
  2399. fi
  2400. ##########################################
  2401. # VTE probe
  2402. if test "$vte" != "no"; then
  2403. if test "$gtkabi" = "3.0"; then
  2404. vteminversion="0.32.0"
  2405. if $pkg_config --exists "vte-2.91"; then
  2406. vtepackage="vte-2.91"
  2407. else
  2408. vtepackage="vte-2.90"
  2409. fi
  2410. else
  2411. vtepackage="vte"
  2412. vteminversion="0.24.0"
  2413. fi
  2414. if $pkg_config --exists "$vtepackage >= $vteminversion"; then
  2415. vte_cflags=$($pkg_config --cflags $vtepackage)
  2416. vte_libs=$($pkg_config --libs $vtepackage)
  2417. vteversion=$($pkg_config --modversion $vtepackage)
  2418. libs_softmmu="$vte_libs $libs_softmmu"
  2419. vte="yes"
  2420. elif test "$vte" = "yes"; then
  2421. if test "$gtkabi" = "3.0"; then
  2422. feature_not_found "vte" "Install libvte-2.90/2.91 devel"
  2423. else
  2424. feature_not_found "vte" "Install libvte devel"
  2425. fi
  2426. else
  2427. vte="no"
  2428. fi
  2429. fi
  2430. ##########################################
  2431. # SDL probe
  2432. # Look for sdl configuration program (pkg-config or sdl-config). Try
  2433. # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
  2434. if test "$sdlabi" = ""; then
  2435. if $pkg_config --exists "sdl"; then
  2436. sdlabi=1.2
  2437. elif $pkg_config --exists "sdl2"; then
  2438. sdlabi=2.0
  2439. else
  2440. sdlabi=1.2
  2441. fi
  2442. fi
  2443. if test $sdlabi = "2.0"; then
  2444. sdl_config=$sdl2_config
  2445. sdlname=sdl2
  2446. sdlconfigname=sdl2_config
  2447. elif test $sdlabi = "1.2"; then
  2448. sdlname=sdl
  2449. sdlconfigname=sdl_config
  2450. else
  2451. error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0"
  2452. fi
  2453. if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then
  2454. sdl_config=$sdlconfigname
  2455. fi
  2456. if $pkg_config $sdlname --exists; then
  2457. sdlconfig="$pkg_config $sdlname"
  2458. sdlversion=$($sdlconfig --modversion 2>/dev/null)
  2459. elif has ${sdl_config}; then
  2460. sdlconfig="$sdl_config"
  2461. sdlversion=$($sdlconfig --version)
  2462. else
  2463. if test "$sdl" = "yes" ; then
  2464. feature_not_found "sdl" "Install SDL devel"
  2465. fi
  2466. sdl=no
  2467. fi
  2468. if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
  2469. echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
  2470. fi
  2471. sdl_too_old=no
  2472. if test "$sdl" != "no" ; then
  2473. cat > $TMPC << EOF
  2474. #include <SDL.h>
  2475. #undef main /* We don't want SDL to override our main() */
  2476. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  2477. EOF
  2478. sdl_cflags=$($sdlconfig --cflags 2>/dev/null)
  2479. if test "$static" = "yes" ; then
  2480. sdl_libs=$($sdlconfig --static-libs 2>/dev/null)
  2481. else
  2482. sdl_libs=$($sdlconfig --libs 2>/dev/null)
  2483. fi
  2484. if compile_prog "$sdl_cflags" "$sdl_libs" ; then
  2485. if test $(echo $sdlversion | sed 's/[^0-9]//g') -lt 121 ; then
  2486. sdl_too_old=yes
  2487. else
  2488. sdl=yes
  2489. fi
  2490. # static link with sdl ? (note: sdl.pc's --static --libs is broken)
  2491. if test "$sdl" = "yes" -a "$static" = "yes" ; then
  2492. if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
  2493. sdl_libs="$sdl_libs $(aalib-config --static-libs 2>/dev/null)"
  2494. sdl_cflags="$sdl_cflags $(aalib-config --cflags 2>/dev/null)"
  2495. fi
  2496. if compile_prog "$sdl_cflags" "$sdl_libs" ; then
  2497. :
  2498. else
  2499. sdl=no
  2500. fi
  2501. fi # static link
  2502. else # sdl not found
  2503. if test "$sdl" = "yes" ; then
  2504. feature_not_found "sdl" "Install SDL devel"
  2505. fi
  2506. sdl=no
  2507. fi # sdl compile test
  2508. fi
  2509. if test "$sdl" = "yes" ; then
  2510. cat > $TMPC <<EOF
  2511. #include <SDL.h>
  2512. #if defined(SDL_VIDEO_DRIVER_X11)
  2513. #include <X11/XKBlib.h>
  2514. #else
  2515. #error No x11 support
  2516. #endif
  2517. int main(void) { return 0; }
  2518. EOF
  2519. if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then
  2520. sdl_cflags="$sdl_cflags $x11_cflags"
  2521. sdl_libs="$sdl_libs $x11_libs"
  2522. fi
  2523. libs_softmmu="$sdl_libs $libs_softmmu"
  2524. fi
  2525. ##########################################
  2526. # RDMA needs OpenFabrics libraries
  2527. if test "$rdma" != "no" ; then
  2528. cat > $TMPC <<EOF
  2529. #include <rdma/rdma_cma.h>
  2530. int main(void) { return 0; }
  2531. EOF
  2532. rdma_libs="-lrdmacm -libverbs"
  2533. if compile_prog "" "$rdma_libs" ; then
  2534. rdma="yes"
  2535. libs_softmmu="$libs_softmmu $rdma_libs"
  2536. else
  2537. if test "$rdma" = "yes" ; then
  2538. error_exit \
  2539. " OpenFabrics librdmacm/libibverbs not present." \
  2540. " Your options:" \
  2541. " (1) Fast: Install infiniband packages from your distro." \
  2542. " (2) Cleanest: Install libraries from www.openfabrics.org" \
  2543. " (3) Also: Install softiwarp if you don't have RDMA hardware"
  2544. fi
  2545. rdma="no"
  2546. fi
  2547. fi
  2548. ##########################################
  2549. # VNC SASL detection
  2550. if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
  2551. cat > $TMPC <<EOF
  2552. #include <sasl/sasl.h>
  2553. #include <stdio.h>
  2554. int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
  2555. EOF
  2556. # Assuming Cyrus-SASL installed in /usr prefix
  2557. vnc_sasl_cflags=""
  2558. vnc_sasl_libs="-lsasl2"
  2559. if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
  2560. vnc_sasl=yes
  2561. libs_softmmu="$vnc_sasl_libs $libs_softmmu"
  2562. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
  2563. else
  2564. if test "$vnc_sasl" = "yes" ; then
  2565. feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
  2566. fi
  2567. vnc_sasl=no
  2568. fi
  2569. fi
  2570. ##########################################
  2571. # VNC JPEG detection
  2572. if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
  2573. cat > $TMPC <<EOF
  2574. #include <stdio.h>
  2575. #include <jpeglib.h>
  2576. int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
  2577. EOF
  2578. vnc_jpeg_cflags=""
  2579. vnc_jpeg_libs="-ljpeg"
  2580. if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
  2581. vnc_jpeg=yes
  2582. libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
  2583. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
  2584. else
  2585. if test "$vnc_jpeg" = "yes" ; then
  2586. feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
  2587. fi
  2588. vnc_jpeg=no
  2589. fi
  2590. fi
  2591. ##########################################
  2592. # VNC PNG detection
  2593. if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
  2594. cat > $TMPC <<EOF
  2595. //#include <stdio.h>
  2596. #include <png.h>
  2597. #include <stddef.h>
  2598. int main(void) {
  2599. png_structp png_ptr;
  2600. png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
  2601. return png_ptr != 0;
  2602. }
  2603. EOF
  2604. if $pkg_config libpng --exists; then
  2605. vnc_png_cflags=$($pkg_config libpng --cflags)
  2606. vnc_png_libs=$($pkg_config libpng --libs)
  2607. else
  2608. vnc_png_cflags=""
  2609. vnc_png_libs="-lpng"
  2610. fi
  2611. if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
  2612. vnc_png=yes
  2613. libs_softmmu="$vnc_png_libs $libs_softmmu"
  2614. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
  2615. else
  2616. if test "$vnc_png" = "yes" ; then
  2617. feature_not_found "vnc-png" "Install libpng devel"
  2618. fi
  2619. vnc_png=no
  2620. fi
  2621. fi
  2622. ##########################################
  2623. # fnmatch() probe, used for ACL routines
  2624. fnmatch="no"
  2625. cat > $TMPC << EOF
  2626. #include <fnmatch.h>
  2627. int main(void)
  2628. {
  2629. fnmatch("foo", "foo", 0);
  2630. return 0;
  2631. }
  2632. EOF
  2633. if compile_prog "" "" ; then
  2634. fnmatch="yes"
  2635. fi
  2636. ##########################################
  2637. # xfsctl() probe, used for file-posix.c
  2638. if test "$xfs" != "no" ; then
  2639. cat > $TMPC << EOF
  2640. #include <stddef.h> /* NULL */
  2641. #include <xfs/xfs.h>
  2642. int main(void)
  2643. {
  2644. xfsctl(NULL, 0, 0, NULL);
  2645. return 0;
  2646. }
  2647. EOF
  2648. if compile_prog "" "" ; then
  2649. xfs="yes"
  2650. else
  2651. if test "$xfs" = "yes" ; then
  2652. feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
  2653. fi
  2654. xfs=no
  2655. fi
  2656. fi
  2657. ##########################################
  2658. # vde libraries probe
  2659. if test "$vde" != "no" ; then
  2660. vde_libs="-lvdeplug"
  2661. cat > $TMPC << EOF
  2662. #include <libvdeplug.h>
  2663. int main(void)
  2664. {
  2665. struct vde_open_args a = {0, 0, 0};
  2666. char s[] = "";
  2667. vde_open(s, s, &a);
  2668. return 0;
  2669. }
  2670. EOF
  2671. if compile_prog "" "$vde_libs" ; then
  2672. vde=yes
  2673. libs_softmmu="$vde_libs $libs_softmmu"
  2674. libs_tools="$vde_libs $libs_tools"
  2675. else
  2676. if test "$vde" = "yes" ; then
  2677. feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
  2678. fi
  2679. vde=no
  2680. fi
  2681. fi
  2682. ##########################################
  2683. # netmap support probe
  2684. # Apart from looking for netmap headers, we make sure that the host API version
  2685. # supports the netmap backend (>=11). The upper bound (15) is meant to simulate
  2686. # a minor/major version number. Minor new features will be marked with values up
  2687. # to 15, and if something happens that requires a change to the backend we will
  2688. # move above 15, submit the backend fixes and modify this two bounds.
  2689. if test "$netmap" != "no" ; then
  2690. cat > $TMPC << EOF
  2691. #include <inttypes.h>
  2692. #include <net/if.h>
  2693. #include <net/netmap.h>
  2694. #include <net/netmap_user.h>
  2695. #if (NETMAP_API < 11) || (NETMAP_API > 15)
  2696. #error
  2697. #endif
  2698. int main(void) { return 0; }
  2699. EOF
  2700. if compile_prog "" "" ; then
  2701. netmap=yes
  2702. else
  2703. if test "$netmap" = "yes" ; then
  2704. feature_not_found "netmap"
  2705. fi
  2706. netmap=no
  2707. fi
  2708. fi
  2709. ##########################################
  2710. # libcap-ng library probe
  2711. if test "$cap_ng" != "no" ; then
  2712. cap_libs="-lcap-ng"
  2713. cat > $TMPC << EOF
  2714. #include <cap-ng.h>
  2715. int main(void)
  2716. {
  2717. capng_capability_to_name(CAPNG_EFFECTIVE);
  2718. return 0;
  2719. }
  2720. EOF
  2721. if compile_prog "" "$cap_libs" ; then
  2722. cap_ng=yes
  2723. libs_tools="$cap_libs $libs_tools"
  2724. else
  2725. if test "$cap_ng" = "yes" ; then
  2726. feature_not_found "cap_ng" "Install libcap-ng devel"
  2727. fi
  2728. cap_ng=no
  2729. fi
  2730. fi
  2731. ##########################################
  2732. # Sound support libraries probe
  2733. audio_drv_probe()
  2734. {
  2735. drv=$1
  2736. hdr=$2
  2737. lib=$3
  2738. exp=$4
  2739. cfl=$5
  2740. cat > $TMPC << EOF
  2741. #include <$hdr>
  2742. int main(void) { $exp }
  2743. EOF
  2744. if compile_prog "$cfl" "$lib" ; then
  2745. :
  2746. else
  2747. error_exit "$drv check failed" \
  2748. "Make sure to have the $drv libs and headers installed."
  2749. fi
  2750. }
  2751. audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/,/ /g')
  2752. for drv in $audio_drv_list; do
  2753. case $drv in
  2754. alsa)
  2755. audio_drv_probe $drv alsa/asoundlib.h -lasound \
  2756. "return snd_pcm_close((snd_pcm_t *)0);"
  2757. libs_softmmu="-lasound $libs_softmmu"
  2758. ;;
  2759. pa)
  2760. audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \
  2761. "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;"
  2762. libs_softmmu="-lpulse $libs_softmmu"
  2763. audio_pt_int="yes"
  2764. ;;
  2765. sdl)
  2766. if test "$sdl" = "no"; then
  2767. error_exit "sdl not found or disabled, can not use sdl audio driver"
  2768. fi
  2769. ;;
  2770. coreaudio)
  2771. libs_softmmu="-framework CoreAudio $libs_softmmu"
  2772. ;;
  2773. dsound)
  2774. libs_softmmu="-lole32 -ldxguid $libs_softmmu"
  2775. audio_win_int="yes"
  2776. ;;
  2777. oss)
  2778. libs_softmmu="$oss_lib $libs_softmmu"
  2779. ;;
  2780. wav)
  2781. # XXX: Probes for CoreAudio, DirectSound
  2782. ;;
  2783. *)
  2784. echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
  2785. error_exit "Unknown driver '$drv' selected" \
  2786. "Possible drivers are: $audio_possible_drivers"
  2787. }
  2788. ;;
  2789. esac
  2790. done
  2791. ##########################################
  2792. # BrlAPI probe
  2793. if test "$brlapi" != "no" ; then
  2794. brlapi_libs="-lbrlapi"
  2795. cat > $TMPC << EOF
  2796. #include <brlapi.h>
  2797. #include <stddef.h>
  2798. int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
  2799. EOF
  2800. if compile_prog "" "$brlapi_libs" ; then
  2801. brlapi=yes
  2802. libs_softmmu="$brlapi_libs $libs_softmmu"
  2803. else
  2804. if test "$brlapi" = "yes" ; then
  2805. feature_not_found "brlapi" "Install brlapi devel"
  2806. fi
  2807. brlapi=no
  2808. fi
  2809. fi
  2810. ##########################################
  2811. # curses probe
  2812. if test "$curses" != "no" ; then
  2813. if test "$mingw32" = "yes" ; then
  2814. curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
  2815. curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses"
  2816. else
  2817. curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:"
  2818. curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw"
  2819. fi
  2820. curses_found=no
  2821. cat > $TMPC << EOF
  2822. #include <locale.h>
  2823. #include <curses.h>
  2824. #include <wchar.h>
  2825. int main(void) {
  2826. wchar_t wch = L'w';
  2827. setlocale(LC_ALL, "");
  2828. resize_term(0, 0);
  2829. addwstr(L"wide chars\n");
  2830. addnwstr(&wch, 1);
  2831. add_wch(WACS_DEGREE);
  2832. return 0;
  2833. }
  2834. EOF
  2835. IFS=:
  2836. for curses_inc in $curses_inc_list; do
  2837. IFS=:
  2838. for curses_lib in $curses_lib_list; do
  2839. unset IFS
  2840. if compile_prog "$curses_inc" "$curses_lib" ; then
  2841. curses_found=yes
  2842. QEMU_CFLAGS="$curses_inc $QEMU_CFLAGS"
  2843. libs_softmmu="$curses_lib $libs_softmmu"
  2844. break
  2845. fi
  2846. done
  2847. if test "$curses_found" = yes ; then
  2848. break
  2849. fi
  2850. done
  2851. unset IFS
  2852. if test "$curses_found" = "yes" ; then
  2853. curses=yes
  2854. else
  2855. if test "$curses" = "yes" ; then
  2856. feature_not_found "curses" "Install ncurses devel"
  2857. fi
  2858. curses=no
  2859. fi
  2860. fi
  2861. ##########################################
  2862. # curl probe
  2863. if test "$curl" != "no" ; then
  2864. if $pkg_config libcurl --exists; then
  2865. curlconfig="$pkg_config libcurl"
  2866. else
  2867. curlconfig=curl-config
  2868. fi
  2869. cat > $TMPC << EOF
  2870. #include <curl/curl.h>
  2871. int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
  2872. EOF
  2873. curl_cflags=$($curlconfig --cflags 2>/dev/null)
  2874. curl_libs=$($curlconfig --libs 2>/dev/null)
  2875. if compile_prog "$curl_cflags" "$curl_libs" ; then
  2876. curl=yes
  2877. else
  2878. if test "$curl" = "yes" ; then
  2879. feature_not_found "curl" "Install libcurl devel"
  2880. fi
  2881. curl=no
  2882. fi
  2883. fi # test "$curl"
  2884. ##########################################
  2885. # bluez support probe
  2886. if test "$bluez" != "no" ; then
  2887. cat > $TMPC << EOF
  2888. #include <bluetooth/bluetooth.h>
  2889. int main(void) { return bt_error(0); }
  2890. EOF
  2891. bluez_cflags=$($pkg_config --cflags bluez 2>/dev/null)
  2892. bluez_libs=$($pkg_config --libs bluez 2>/dev/null)
  2893. if compile_prog "$bluez_cflags" "$bluez_libs" ; then
  2894. bluez=yes
  2895. libs_softmmu="$bluez_libs $libs_softmmu"
  2896. else
  2897. if test "$bluez" = "yes" ; then
  2898. feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
  2899. fi
  2900. bluez="no"
  2901. fi
  2902. fi
  2903. ##########################################
  2904. # glib support probe
  2905. if test "$mingw32" = yes; then
  2906. glib_req_ver=2.30
  2907. else
  2908. glib_req_ver=2.22
  2909. fi
  2910. glib_modules=gthread-2.0
  2911. if test "$modules" = yes; then
  2912. glib_modules="$glib_modules gmodule-2.0"
  2913. fi
  2914. # This workaround is required due to a bug in pkg-config file for glib as it
  2915. # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
  2916. if test "$static" = yes -a "$mingw32" = yes; then
  2917. QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS"
  2918. fi
  2919. for i in $glib_modules; do
  2920. if $pkg_config --atleast-version=$glib_req_ver $i; then
  2921. glib_cflags=$($pkg_config --cflags $i)
  2922. glib_libs=$($pkg_config --libs $i)
  2923. QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS"
  2924. LIBS="$glib_libs $LIBS"
  2925. libs_qga="$glib_libs $libs_qga"
  2926. else
  2927. error_exit "glib-$glib_req_ver $i is required to compile QEMU"
  2928. fi
  2929. done
  2930. # Sanity check that the current size_t matches the
  2931. # size that glib thinks it should be. This catches
  2932. # problems on multi-arch where people try to build
  2933. # 32-bit QEMU while pointing at 64-bit glib headers
  2934. cat > $TMPC <<EOF
  2935. #include <glib.h>
  2936. #include <unistd.h>
  2937. #define QEMU_BUILD_BUG_ON(x) \
  2938. typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused));
  2939. int main(void) {
  2940. QEMU_BUILD_BUG_ON(sizeof(size_t) != GLIB_SIZEOF_SIZE_T);
  2941. return 0;
  2942. }
  2943. EOF
  2944. if ! compile_prog "$CFLAGS" "$LIBS" ; then
  2945. error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
  2946. "You probably need to set PKG_CONFIG_LIBDIR"\
  2947. "to point to the right pkg-config files for your"\
  2948. "build target"
  2949. fi
  2950. # g_test_trap_subprocess added in 2.38. Used by some tests.
  2951. glib_subprocess=yes
  2952. if ! $pkg_config --atleast-version=2.38 glib-2.0; then
  2953. glib_subprocess=no
  2954. fi
  2955. # Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage
  2956. cat > $TMPC << EOF
  2957. #include <glib.h>
  2958. int main(void) { return 0; }
  2959. EOF
  2960. if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
  2961. if cc_has_warning_flag "-Wno-unknown-attributes"; then
  2962. glib_cflags="-Wno-unknown-attributes $glib_cflags"
  2963. CFLAGS="-Wno-unknown-attributes $CFLAGS"
  2964. fi
  2965. fi
  2966. ##########################################
  2967. # SHA command probe for modules
  2968. if test "$modules" = yes; then
  2969. shacmd_probe="sha1sum sha1 shasum"
  2970. for c in $shacmd_probe; do
  2971. if has $c; then
  2972. shacmd="$c"
  2973. break
  2974. fi
  2975. done
  2976. if test "$shacmd" = ""; then
  2977. error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
  2978. fi
  2979. fi
  2980. ##########################################
  2981. # pixman support probe
  2982. if test "$pixman" = ""; then
  2983. if test "$want_tools" = "no" -a "$softmmu" = "no"; then
  2984. pixman="none"
  2985. elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
  2986. pixman="system"
  2987. else
  2988. pixman="internal"
  2989. fi
  2990. fi
  2991. if test "$pixman" = "none"; then
  2992. if test "$want_tools" != "no" -o "$softmmu" != "no"; then
  2993. error_exit "pixman disabled but system emulation or tools build" \
  2994. "enabled. You can turn off pixman only if you also" \
  2995. "disable all system emulation targets and the tools" \
  2996. "build with '--disable-tools --disable-system'."
  2997. fi
  2998. pixman_cflags=
  2999. pixman_libs=
  3000. elif test "$pixman" = "system"; then
  3001. # pixman version has been checked above
  3002. pixman_cflags=$($pkg_config --cflags pixman-1)
  3003. pixman_libs=$($pkg_config --libs pixman-1)
  3004. else
  3005. if test ! -d ${source_path}/pixman/pixman; then
  3006. error_exit "pixman >= 0.21.8 not present. Your options:" \
  3007. " (1) Preferred: Install the pixman devel package (any recent" \
  3008. " distro should have packages as Xorg needs pixman too)." \
  3009. " (2) Fetch the pixman submodule, using:" \
  3010. " git submodule update --init pixman"
  3011. fi
  3012. mkdir -p pixman/pixman
  3013. pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
  3014. pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
  3015. fi
  3016. ##########################################
  3017. # libcap probe
  3018. if test "$cap" != "no" ; then
  3019. cat > $TMPC <<EOF
  3020. #include <stdio.h>
  3021. #include <sys/capability.h>
  3022. int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
  3023. EOF
  3024. if compile_prog "" "-lcap" ; then
  3025. cap=yes
  3026. else
  3027. cap=no
  3028. fi
  3029. fi
  3030. ##########################################
  3031. # pthread probe
  3032. PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
  3033. pthread=no
  3034. cat > $TMPC << EOF
  3035. #include <pthread.h>
  3036. static void *f(void *p) { return NULL; }
  3037. int main(void) {
  3038. pthread_t thread;
  3039. pthread_create(&thread, 0, f, 0);
  3040. return 0;
  3041. }
  3042. EOF
  3043. if compile_prog "" "" ; then
  3044. pthread=yes
  3045. else
  3046. for pthread_lib in $PTHREADLIBS_LIST; do
  3047. if compile_prog "" "$pthread_lib" ; then
  3048. pthread=yes
  3049. found=no
  3050. for lib_entry in $LIBS; do
  3051. if test "$lib_entry" = "$pthread_lib"; then
  3052. found=yes
  3053. break
  3054. fi
  3055. done
  3056. if test "$found" = "no"; then
  3057. LIBS="$pthread_lib $LIBS"
  3058. fi
  3059. PTHREAD_LIB="$pthread_lib"
  3060. break
  3061. fi
  3062. done
  3063. fi
  3064. if test "$mingw32" != yes -a "$pthread" = no; then
  3065. error_exit "pthread check failed" \
  3066. "Make sure to have the pthread libs and headers installed."
  3067. fi
  3068. # check for pthread_setname_np
  3069. pthread_setname_np=no
  3070. cat > $TMPC << EOF
  3071. #include <pthread.h>
  3072. static void *f(void *p) { return NULL; }
  3073. int main(void)
  3074. {
  3075. pthread_t thread;
  3076. pthread_create(&thread, 0, f, 0);
  3077. pthread_setname_np(thread, "QEMU");
  3078. return 0;
  3079. }
  3080. EOF
  3081. if compile_prog "" "$pthread_lib" ; then
  3082. pthread_setname_np=yes
  3083. fi
  3084. ##########################################
  3085. # rbd probe
  3086. if test "$rbd" != "no" ; then
  3087. cat > $TMPC <<EOF
  3088. #include <stdio.h>
  3089. #include <rbd/librbd.h>
  3090. int main(void) {
  3091. rados_t cluster;
  3092. rados_create(&cluster, NULL);
  3093. return 0;
  3094. }
  3095. EOF
  3096. rbd_libs="-lrbd -lrados"
  3097. if compile_prog "" "$rbd_libs" ; then
  3098. rbd=yes
  3099. else
  3100. if test "$rbd" = "yes" ; then
  3101. feature_not_found "rados block device" "Install librbd/ceph devel"
  3102. fi
  3103. rbd=no
  3104. fi
  3105. fi
  3106. ##########################################
  3107. # libssh2 probe
  3108. min_libssh2_version=1.2.8
  3109. if test "$libssh2" != "no" ; then
  3110. if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
  3111. libssh2_cflags=$($pkg_config libssh2 --cflags)
  3112. libssh2_libs=$($pkg_config libssh2 --libs)
  3113. libssh2=yes
  3114. else
  3115. if test "$libssh2" = "yes" ; then
  3116. error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
  3117. fi
  3118. libssh2=no
  3119. fi
  3120. fi
  3121. ##########################################
  3122. # libssh2_sftp_fsync probe
  3123. if test "$libssh2" = "yes"; then
  3124. cat > $TMPC <<EOF
  3125. #include <stdio.h>
  3126. #include <libssh2.h>
  3127. #include <libssh2_sftp.h>
  3128. int main(void) {
  3129. LIBSSH2_SESSION *session;
  3130. LIBSSH2_SFTP *sftp;
  3131. LIBSSH2_SFTP_HANDLE *sftp_handle;
  3132. session = libssh2_session_init ();
  3133. sftp = libssh2_sftp_init (session);
  3134. sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
  3135. libssh2_sftp_fsync (sftp_handle);
  3136. return 0;
  3137. }
  3138. EOF
  3139. # libssh2_cflags/libssh2_libs defined in previous test.
  3140. if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
  3141. QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
  3142. fi
  3143. fi
  3144. ##########################################
  3145. # linux-aio probe
  3146. if test "$linux_aio" != "no" ; then
  3147. cat > $TMPC <<EOF
  3148. #include <libaio.h>
  3149. #include <sys/eventfd.h>
  3150. #include <stddef.h>
  3151. int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
  3152. EOF
  3153. if compile_prog "" "-laio" ; then
  3154. linux_aio=yes
  3155. else
  3156. if test "$linux_aio" = "yes" ; then
  3157. feature_not_found "linux AIO" "Install libaio devel"
  3158. fi
  3159. linux_aio=no
  3160. fi
  3161. fi
  3162. ##########################################
  3163. # TPM passthrough is only on x86 Linux
  3164. if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
  3165. tpm_passthrough=$tpm
  3166. else
  3167. tpm_passthrough=no
  3168. fi
  3169. ##########################################
  3170. # attr probe
  3171. if test "$attr" != "no" ; then
  3172. cat > $TMPC <<EOF
  3173. #include <stdio.h>
  3174. #include <sys/types.h>
  3175. #ifdef CONFIG_LIBATTR
  3176. #include <attr/xattr.h>
  3177. #else
  3178. #include <sys/xattr.h>
  3179. #endif
  3180. int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
  3181. EOF
  3182. if compile_prog "" "" ; then
  3183. attr=yes
  3184. # Older distros have <attr/xattr.h>, and need -lattr:
  3185. elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
  3186. attr=yes
  3187. LIBS="-lattr $LIBS"
  3188. libattr=yes
  3189. else
  3190. if test "$attr" = "yes" ; then
  3191. feature_not_found "ATTR" "Install libc6 or libattr devel"
  3192. fi
  3193. attr=no
  3194. fi
  3195. fi
  3196. ##########################################
  3197. # iovec probe
  3198. cat > $TMPC <<EOF
  3199. #include <sys/types.h>
  3200. #include <sys/uio.h>
  3201. #include <unistd.h>
  3202. int main(void) { return sizeof(struct iovec); }
  3203. EOF
  3204. iovec=no
  3205. if compile_prog "" "" ; then
  3206. iovec=yes
  3207. fi
  3208. ##########################################
  3209. # preadv probe
  3210. cat > $TMPC <<EOF
  3211. #include <sys/types.h>
  3212. #include <sys/uio.h>
  3213. #include <unistd.h>
  3214. int main(void) { return preadv(0, 0, 0, 0); }
  3215. EOF
  3216. preadv=no
  3217. if compile_prog "" "" ; then
  3218. preadv=yes
  3219. fi
  3220. ##########################################
  3221. # fdt probe
  3222. # fdt support is mandatory for at least some target architectures,
  3223. # so insist on it if we're building those system emulators.
  3224. fdt_required=no
  3225. for target in $target_list; do
  3226. case $target in
  3227. aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu)
  3228. fdt_required=yes
  3229. ;;
  3230. esac
  3231. done
  3232. if test "$fdt_required" = "yes"; then
  3233. if test "$fdt" = "no"; then
  3234. error_exit "fdt disabled but some requested targets require it." \
  3235. "You can turn off fdt only if you also disable all the system emulation" \
  3236. "targets which need it (by specifying a cut down --target-list)."
  3237. fi
  3238. fdt=yes
  3239. fi
  3240. if test "$fdt" != "no" ; then
  3241. fdt_libs="-lfdt"
  3242. # explicitly check for libfdt_env.h as it is missing in some stable installs
  3243. # and test for required functions to make sure we are on a version >= 1.4.2
  3244. cat > $TMPC << EOF
  3245. #include <libfdt.h>
  3246. #include <libfdt_env.h>
  3247. int main(void) { fdt_first_subnode(0, 0); return 0; }
  3248. EOF
  3249. if compile_prog "" "$fdt_libs" ; then
  3250. # system DTC is good - use it
  3251. fdt=yes
  3252. elif test -d ${source_path}/dtc/libfdt ; then
  3253. # have submodule DTC - use it
  3254. fdt=yes
  3255. dtc_internal="yes"
  3256. mkdir -p dtc
  3257. if [ "$pwd_is_source_path" != "y" ] ; then
  3258. symlink "$source_path/dtc/Makefile" "dtc/Makefile"
  3259. symlink "$source_path/dtc/scripts" "dtc/scripts"
  3260. fi
  3261. fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
  3262. fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
  3263. elif test "$fdt" = "yes" ; then
  3264. # have neither and want - prompt for system/submodule install
  3265. error_exit "DTC (libfdt) version >= 1.4.2 not present. Your options:" \
  3266. " (1) Preferred: Install the DTC (libfdt) devel package" \
  3267. " (2) Fetch the DTC submodule, using:" \
  3268. " git submodule update --init dtc"
  3269. else
  3270. # don't have and don't want
  3271. fdt_libs=
  3272. fdt=no
  3273. fi
  3274. fi
  3275. libs_softmmu="$libs_softmmu $fdt_libs"
  3276. ##########################################
  3277. # opengl probe (for sdl2, gtk, milkymist-tmu2)
  3278. if test "$opengl" != "no" ; then
  3279. opengl_pkgs="epoxy libdrm gbm"
  3280. if $pkg_config $opengl_pkgs x11; then
  3281. opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags"
  3282. opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
  3283. opengl=yes
  3284. if test "$gtk" = "yes" && $pkg_config --exists "$gtkpackage >= 3.16"; then
  3285. gtk_gl="yes"
  3286. fi
  3287. QEMU_CFLAGS="$QEMU_CFLAGS $opengl_cflags"
  3288. else
  3289. if test "$opengl" = "yes" ; then
  3290. feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
  3291. fi
  3292. opengl_cflags=""
  3293. opengl_libs=""
  3294. opengl=no
  3295. fi
  3296. fi
  3297. if test "$opengl" = "yes"; then
  3298. cat > $TMPC << EOF
  3299. #include <epoxy/egl.h>
  3300. #ifndef EGL_MESA_image_dma_buf_export
  3301. # error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
  3302. #endif
  3303. int main(void) { return 0; }
  3304. EOF
  3305. if compile_prog "" "" ; then
  3306. opengl_dmabuf=yes
  3307. fi
  3308. fi
  3309. ##########################################
  3310. # glusterfs probe
  3311. if test "$glusterfs" != "no" ; then
  3312. if $pkg_config --atleast-version=3 glusterfs-api; then
  3313. glusterfs="yes"
  3314. glusterfs_cflags=$($pkg_config --cflags glusterfs-api)
  3315. glusterfs_libs=$($pkg_config --libs glusterfs-api)
  3316. if $pkg_config --atleast-version=4 glusterfs-api; then
  3317. glusterfs_xlator_opt="yes"
  3318. fi
  3319. if $pkg_config --atleast-version=5 glusterfs-api; then
  3320. glusterfs_discard="yes"
  3321. fi
  3322. if $pkg_config --atleast-version=6 glusterfs-api; then
  3323. glusterfs_fallocate="yes"
  3324. glusterfs_zerofill="yes"
  3325. fi
  3326. else
  3327. if test "$glusterfs" = "yes" ; then
  3328. feature_not_found "GlusterFS backend support" \
  3329. "Install glusterfs-api devel >= 3"
  3330. fi
  3331. glusterfs="no"
  3332. fi
  3333. fi
  3334. # Check for inotify functions when we are building linux-user
  3335. # emulator. This is done because older glibc versions don't
  3336. # have syscall stubs for these implemented. In that case we
  3337. # don't provide them even if kernel supports them.
  3338. #
  3339. inotify=no
  3340. cat > $TMPC << EOF
  3341. #include <sys/inotify.h>
  3342. int
  3343. main(void)
  3344. {
  3345. /* try to start inotify */
  3346. return inotify_init();
  3347. }
  3348. EOF
  3349. if compile_prog "" "" ; then
  3350. inotify=yes
  3351. fi
  3352. inotify1=no
  3353. cat > $TMPC << EOF
  3354. #include <sys/inotify.h>
  3355. int
  3356. main(void)
  3357. {
  3358. /* try to start inotify */
  3359. return inotify_init1(0);
  3360. }
  3361. EOF
  3362. if compile_prog "" "" ; then
  3363. inotify1=yes
  3364. fi
  3365. # check if pipe2 is there
  3366. pipe2=no
  3367. cat > $TMPC << EOF
  3368. #include <unistd.h>
  3369. #include <fcntl.h>
  3370. int main(void)
  3371. {
  3372. int pipefd[2];
  3373. return pipe2(pipefd, O_CLOEXEC);
  3374. }
  3375. EOF
  3376. if compile_prog "" "" ; then
  3377. pipe2=yes
  3378. fi
  3379. # check if accept4 is there
  3380. accept4=no
  3381. cat > $TMPC << EOF
  3382. #include <sys/socket.h>
  3383. #include <stddef.h>
  3384. int main(void)
  3385. {
  3386. accept4(0, NULL, NULL, SOCK_CLOEXEC);
  3387. return 0;
  3388. }
  3389. EOF
  3390. if compile_prog "" "" ; then
  3391. accept4=yes
  3392. fi
  3393. # check if tee/splice is there. vmsplice was added same time.
  3394. splice=no
  3395. cat > $TMPC << EOF
  3396. #include <unistd.h>
  3397. #include <fcntl.h>
  3398. #include <limits.h>
  3399. int main(void)
  3400. {
  3401. int len, fd = 0;
  3402. len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
  3403. splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
  3404. return 0;
  3405. }
  3406. EOF
  3407. if compile_prog "" "" ; then
  3408. splice=yes
  3409. fi
  3410. ##########################################
  3411. # libnuma probe
  3412. if test "$numa" != "no" ; then
  3413. cat > $TMPC << EOF
  3414. #include <numa.h>
  3415. int main(void) { return numa_available(); }
  3416. EOF
  3417. if compile_prog "" "-lnuma" ; then
  3418. numa=yes
  3419. libs_softmmu="-lnuma $libs_softmmu"
  3420. else
  3421. if test "$numa" = "yes" ; then
  3422. feature_not_found "numa" "install numactl devel"
  3423. fi
  3424. numa=no
  3425. fi
  3426. fi
  3427. if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then
  3428. echo "ERROR: tcmalloc && jemalloc can't be used at the same time"
  3429. exit 1
  3430. fi
  3431. ##########################################
  3432. # tcmalloc probe
  3433. if test "$tcmalloc" = "yes" ; then
  3434. cat > $TMPC << EOF
  3435. #include <stdlib.h>
  3436. int main(void) { malloc(1); return 0; }
  3437. EOF
  3438. if compile_prog "" "-ltcmalloc" ; then
  3439. LIBS="-ltcmalloc $LIBS"
  3440. else
  3441. feature_not_found "tcmalloc" "install gperftools devel"
  3442. fi
  3443. fi
  3444. ##########################################
  3445. # jemalloc probe
  3446. if test "$jemalloc" = "yes" ; then
  3447. cat > $TMPC << EOF
  3448. #include <stdlib.h>
  3449. int main(void) { malloc(1); return 0; }
  3450. EOF
  3451. if compile_prog "" "-ljemalloc" ; then
  3452. LIBS="-ljemalloc $LIBS"
  3453. else
  3454. feature_not_found "jemalloc" "install jemalloc devel"
  3455. fi
  3456. fi
  3457. ##########################################
  3458. # signalfd probe
  3459. signalfd="no"
  3460. cat > $TMPC << EOF
  3461. #include <unistd.h>
  3462. #include <sys/syscall.h>
  3463. #include <signal.h>
  3464. int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
  3465. EOF
  3466. if compile_prog "" "" ; then
  3467. signalfd=yes
  3468. fi
  3469. # check if eventfd is supported
  3470. eventfd=no
  3471. cat > $TMPC << EOF
  3472. #include <sys/eventfd.h>
  3473. int main(void)
  3474. {
  3475. return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
  3476. }
  3477. EOF
  3478. if compile_prog "" "" ; then
  3479. eventfd=yes
  3480. fi
  3481. # check if memfd is supported
  3482. memfd=no
  3483. cat > $TMPC << EOF
  3484. #include <sys/memfd.h>
  3485. int main(void)
  3486. {
  3487. return memfd_create("foo", MFD_ALLOW_SEALING);
  3488. }
  3489. EOF
  3490. if compile_prog "" "" ; then
  3491. memfd=yes
  3492. fi
  3493. # check for fallocate
  3494. fallocate=no
  3495. cat > $TMPC << EOF
  3496. #include <fcntl.h>
  3497. int main(void)
  3498. {
  3499. fallocate(0, 0, 0, 0);
  3500. return 0;
  3501. }
  3502. EOF
  3503. if compile_prog "" "" ; then
  3504. fallocate=yes
  3505. fi
  3506. # check for fallocate hole punching
  3507. fallocate_punch_hole=no
  3508. cat > $TMPC << EOF
  3509. #include <fcntl.h>
  3510. #include <linux/falloc.h>
  3511. int main(void)
  3512. {
  3513. fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
  3514. return 0;
  3515. }
  3516. EOF
  3517. if compile_prog "" "" ; then
  3518. fallocate_punch_hole=yes
  3519. fi
  3520. # check that fallocate supports range zeroing inside the file
  3521. fallocate_zero_range=no
  3522. cat > $TMPC << EOF
  3523. #include <fcntl.h>
  3524. #include <linux/falloc.h>
  3525. int main(void)
  3526. {
  3527. fallocate(0, FALLOC_FL_ZERO_RANGE, 0, 0);
  3528. return 0;
  3529. }
  3530. EOF
  3531. if compile_prog "" "" ; then
  3532. fallocate_zero_range=yes
  3533. fi
  3534. # check for posix_fallocate
  3535. posix_fallocate=no
  3536. cat > $TMPC << EOF
  3537. #include <fcntl.h>
  3538. int main(void)
  3539. {
  3540. posix_fallocate(0, 0, 0);
  3541. return 0;
  3542. }
  3543. EOF
  3544. if compile_prog "" "" ; then
  3545. posix_fallocate=yes
  3546. fi
  3547. # check for sync_file_range
  3548. sync_file_range=no
  3549. cat > $TMPC << EOF
  3550. #include <fcntl.h>
  3551. int main(void)
  3552. {
  3553. sync_file_range(0, 0, 0, 0);
  3554. return 0;
  3555. }
  3556. EOF
  3557. if compile_prog "" "" ; then
  3558. sync_file_range=yes
  3559. fi
  3560. # check for linux/fiemap.h and FS_IOC_FIEMAP
  3561. fiemap=no
  3562. cat > $TMPC << EOF
  3563. #include <sys/ioctl.h>
  3564. #include <linux/fs.h>
  3565. #include <linux/fiemap.h>
  3566. int main(void)
  3567. {
  3568. ioctl(0, FS_IOC_FIEMAP, 0);
  3569. return 0;
  3570. }
  3571. EOF
  3572. if compile_prog "" "" ; then
  3573. fiemap=yes
  3574. fi
  3575. # check for dup3
  3576. dup3=no
  3577. cat > $TMPC << EOF
  3578. #include <unistd.h>
  3579. int main(void)
  3580. {
  3581. dup3(0, 0, 0);
  3582. return 0;
  3583. }
  3584. EOF
  3585. if compile_prog "" "" ; then
  3586. dup3=yes
  3587. fi
  3588. # check for ppoll support
  3589. ppoll=no
  3590. cat > $TMPC << EOF
  3591. #include <poll.h>
  3592. int main(void)
  3593. {
  3594. struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
  3595. ppoll(&pfd, 1, 0, 0);
  3596. return 0;
  3597. }
  3598. EOF
  3599. if compile_prog "" "" ; then
  3600. ppoll=yes
  3601. fi
  3602. # check for prctl(PR_SET_TIMERSLACK , ... ) support
  3603. prctl_pr_set_timerslack=no
  3604. cat > $TMPC << EOF
  3605. #include <sys/prctl.h>
  3606. int main(void)
  3607. {
  3608. prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
  3609. return 0;
  3610. }
  3611. EOF
  3612. if compile_prog "" "" ; then
  3613. prctl_pr_set_timerslack=yes
  3614. fi
  3615. # check for epoll support
  3616. epoll=no
  3617. cat > $TMPC << EOF
  3618. #include <sys/epoll.h>
  3619. int main(void)
  3620. {
  3621. epoll_create(0);
  3622. return 0;
  3623. }
  3624. EOF
  3625. if compile_prog "" "" ; then
  3626. epoll=yes
  3627. fi
  3628. # epoll_create1 is a later addition
  3629. # so we must check separately for its presence
  3630. epoll_create1=no
  3631. cat > $TMPC << EOF
  3632. #include <sys/epoll.h>
  3633. int main(void)
  3634. {
  3635. /* Note that we use epoll_create1 as a value, not as
  3636. * a function being called. This is necessary so that on
  3637. * old SPARC glibc versions where the function was present in
  3638. * the library but not declared in the header file we will
  3639. * fail the configure check. (Otherwise we will get a compiler
  3640. * warning but not an error, and will proceed to fail the
  3641. * qemu compile where we compile with -Werror.)
  3642. */
  3643. return (int)(uintptr_t)&epoll_create1;
  3644. }
  3645. EOF
  3646. if compile_prog "" "" ; then
  3647. epoll_create1=yes
  3648. fi
  3649. # check for sendfile support
  3650. sendfile=no
  3651. cat > $TMPC << EOF
  3652. #include <sys/sendfile.h>
  3653. int main(void)
  3654. {
  3655. return sendfile(0, 0, 0, 0);
  3656. }
  3657. EOF
  3658. if compile_prog "" "" ; then
  3659. sendfile=yes
  3660. fi
  3661. # check for timerfd support (glibc 2.8 and newer)
  3662. timerfd=no
  3663. cat > $TMPC << EOF
  3664. #include <sys/timerfd.h>
  3665. int main(void)
  3666. {
  3667. return(timerfd_create(CLOCK_REALTIME, 0));
  3668. }
  3669. EOF
  3670. if compile_prog "" "" ; then
  3671. timerfd=yes
  3672. fi
  3673. # check for setns and unshare support
  3674. setns=no
  3675. cat > $TMPC << EOF
  3676. #include <sched.h>
  3677. int main(void)
  3678. {
  3679. int ret;
  3680. ret = setns(0, 0);
  3681. ret = unshare(0);
  3682. return ret;
  3683. }
  3684. EOF
  3685. if compile_prog "" "" ; then
  3686. setns=yes
  3687. fi
  3688. # clock_adjtime probe
  3689. clock_adjtime=no
  3690. cat > $TMPC <<EOF
  3691. #include <time.h>
  3692. int main(void)
  3693. {
  3694. return clock_adjtime(0, 0);
  3695. }
  3696. EOF
  3697. clock_adjtime=no
  3698. if compile_prog "" "" ; then
  3699. clock_adjtime=yes
  3700. fi
  3701. # syncfs probe
  3702. syncfs=no
  3703. cat > $TMPC <<EOF
  3704. #include <unistd.h>
  3705. int main(void)
  3706. {
  3707. return syncfs(0);
  3708. }
  3709. EOF
  3710. syncfs=no
  3711. if compile_prog "" "" ; then
  3712. syncfs=yes
  3713. fi
  3714. # Check if tools are available to build documentation.
  3715. if test "$docs" != "no" ; then
  3716. if has makeinfo && has pod2man; then
  3717. docs=yes
  3718. else
  3719. if test "$docs" = "yes" ; then
  3720. feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
  3721. fi
  3722. docs=no
  3723. fi
  3724. fi
  3725. # Search for bswap_32 function
  3726. byteswap_h=no
  3727. cat > $TMPC << EOF
  3728. #include <byteswap.h>
  3729. int main(void) { return bswap_32(0); }
  3730. EOF
  3731. if compile_prog "" "" ; then
  3732. byteswap_h=yes
  3733. fi
  3734. # Search for bswap32 function
  3735. bswap_h=no
  3736. cat > $TMPC << EOF
  3737. #include <sys/endian.h>
  3738. #include <sys/types.h>
  3739. #include <machine/bswap.h>
  3740. int main(void) { return bswap32(0); }
  3741. EOF
  3742. if compile_prog "" "" ; then
  3743. bswap_h=yes
  3744. fi
  3745. ##########################################
  3746. # Do we have libiscsi >= 1.9.0
  3747. if test "$libiscsi" != "no" ; then
  3748. if $pkg_config --atleast-version=1.9.0 libiscsi; then
  3749. libiscsi="yes"
  3750. libiscsi_cflags=$($pkg_config --cflags libiscsi)
  3751. libiscsi_libs=$($pkg_config --libs libiscsi)
  3752. else
  3753. if test "$libiscsi" = "yes" ; then
  3754. feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
  3755. fi
  3756. libiscsi="no"
  3757. fi
  3758. fi
  3759. ##########################################
  3760. # Do we need libm
  3761. cat > $TMPC << EOF
  3762. #include <math.h>
  3763. int main(int argc, char **argv) { return isnan(sin((double)argc)); }
  3764. EOF
  3765. if compile_prog "" "" ; then
  3766. :
  3767. elif compile_prog "" "-lm" ; then
  3768. LIBS="-lm $LIBS"
  3769. libs_qga="-lm $libs_qga"
  3770. else
  3771. error_exit "libm check failed"
  3772. fi
  3773. ##########################################
  3774. # Do we need librt
  3775. # uClibc provides 2 versions of clock_gettime(), one with realtime
  3776. # support and one without. This means that the clock_gettime() don't
  3777. # need -lrt. We still need it for timer_create() so we check for this
  3778. # function in addition.
  3779. cat > $TMPC <<EOF
  3780. #include <signal.h>
  3781. #include <time.h>
  3782. int main(void) {
  3783. timer_create(CLOCK_REALTIME, NULL, NULL);
  3784. return clock_gettime(CLOCK_REALTIME, NULL);
  3785. }
  3786. EOF
  3787. if compile_prog "" "" ; then
  3788. :
  3789. # we need pthread for static linking. use previous pthread test result
  3790. elif compile_prog "" "$pthread_lib -lrt" ; then
  3791. LIBS="$LIBS -lrt"
  3792. libs_qga="$libs_qga -lrt"
  3793. fi
  3794. if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
  3795. "$aix" != "yes" -a "$haiku" != "yes" ; then
  3796. libs_softmmu="-lutil $libs_softmmu"
  3797. fi
  3798. ##########################################
  3799. # spice probe
  3800. if test "$spice" != "no" ; then
  3801. cat > $TMPC << EOF
  3802. #include <spice.h>
  3803. int main(void) { spice_server_new(); return 0; }
  3804. EOF
  3805. spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
  3806. spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
  3807. if $pkg_config --atleast-version=0.12.0 spice-server && \
  3808. $pkg_config --atleast-version=0.12.3 spice-protocol && \
  3809. compile_prog "$spice_cflags" "$spice_libs" ; then
  3810. spice="yes"
  3811. libs_softmmu="$libs_softmmu $spice_libs"
  3812. QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
  3813. spice_protocol_version=$($pkg_config --modversion spice-protocol)
  3814. spice_server_version=$($pkg_config --modversion spice-server)
  3815. else
  3816. if test "$spice" = "yes" ; then
  3817. feature_not_found "spice" \
  3818. "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel"
  3819. fi
  3820. spice="no"
  3821. fi
  3822. fi
  3823. # check for smartcard support
  3824. smartcard_cflags=""
  3825. if test "$smartcard" != "no"; then
  3826. if $pkg_config libcacard; then
  3827. libcacard_cflags=$($pkg_config --cflags libcacard)
  3828. libcacard_libs=$($pkg_config --libs libcacard)
  3829. QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
  3830. libs_softmmu="$libs_softmmu $libcacard_libs"
  3831. smartcard="yes"
  3832. else
  3833. if test "$smartcard" = "yes"; then
  3834. feature_not_found "smartcard" "Install libcacard devel"
  3835. fi
  3836. smartcard="no"
  3837. fi
  3838. fi
  3839. # check for libusb
  3840. if test "$libusb" != "no" ; then
  3841. if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
  3842. libusb="yes"
  3843. libusb_cflags=$($pkg_config --cflags libusb-1.0)
  3844. libusb_libs=$($pkg_config --libs libusb-1.0)
  3845. QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
  3846. libs_softmmu="$libs_softmmu $libusb_libs"
  3847. else
  3848. if test "$libusb" = "yes"; then
  3849. feature_not_found "libusb" "Install libusb devel >= 1.0.13"
  3850. fi
  3851. libusb="no"
  3852. fi
  3853. fi
  3854. # check for usbredirparser for usb network redirection support
  3855. if test "$usb_redir" != "no" ; then
  3856. if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
  3857. usb_redir="yes"
  3858. usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
  3859. usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
  3860. QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
  3861. libs_softmmu="$libs_softmmu $usb_redir_libs"
  3862. else
  3863. if test "$usb_redir" = "yes"; then
  3864. feature_not_found "usb-redir" "Install usbredir devel"
  3865. fi
  3866. usb_redir="no"
  3867. fi
  3868. fi
  3869. ##########################################
  3870. # check if we have VSS SDK headers for win
  3871. if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
  3872. case "$vss_win32_sdk" in
  3873. "") vss_win32_include="-isystem $source_path" ;;
  3874. *\ *) # The SDK is installed in "Program Files" by default, but we cannot
  3875. # handle path with spaces. So we symlink the headers into ".sdk/vss".
  3876. vss_win32_include="-isystem $source_path/.sdk/vss"
  3877. symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
  3878. ;;
  3879. *) vss_win32_include="-isystem $vss_win32_sdk"
  3880. esac
  3881. cat > $TMPC << EOF
  3882. #define __MIDL_user_allocate_free_DEFINED__
  3883. #include <inc/win2003/vss.h>
  3884. int main(void) { return VSS_CTX_BACKUP; }
  3885. EOF
  3886. if compile_prog "$vss_win32_include" "" ; then
  3887. guest_agent_with_vss="yes"
  3888. QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
  3889. libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
  3890. qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
  3891. else
  3892. if test "$vss_win32_sdk" != "" ; then
  3893. echo "ERROR: Please download and install Microsoft VSS SDK:"
  3894. echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
  3895. echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
  3896. echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
  3897. echo "ERROR: The headers are extracted in the directory \`inc'."
  3898. feature_not_found "VSS support"
  3899. fi
  3900. guest_agent_with_vss="no"
  3901. fi
  3902. fi
  3903. ##########################################
  3904. # lookup Windows platform SDK (if not specified)
  3905. # The SDK is needed only to build .tlb (type library) file of guest agent
  3906. # VSS provider from the source. It is usually unnecessary because the
  3907. # pre-compiled .tlb file is included.
  3908. if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
  3909. if test -z "$win_sdk"; then
  3910. programfiles="$PROGRAMFILES"
  3911. test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
  3912. if test -n "$programfiles"; then
  3913. win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
  3914. else
  3915. feature_not_found "Windows SDK"
  3916. fi
  3917. elif test "$win_sdk" = "no"; then
  3918. win_sdk=""
  3919. fi
  3920. fi
  3921. ##########################################
  3922. # check if mingw environment provides a recent ntddscsi.h
  3923. if test "$mingw32" = "yes" -a "$guest_agent" != "no"; then
  3924. cat > $TMPC << EOF
  3925. #include <windows.h>
  3926. #include <ntddscsi.h>
  3927. int main(void) {
  3928. #if !defined(IOCTL_SCSI_GET_ADDRESS)
  3929. #error Missing required ioctl definitions
  3930. #endif
  3931. SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
  3932. return addr.Lun;
  3933. }
  3934. EOF
  3935. if compile_prog "" "" ; then
  3936. guest_agent_ntddscsi=yes
  3937. libs_qga="-lsetupapi $libs_qga"
  3938. fi
  3939. fi
  3940. ##########################################
  3941. # virgl renderer probe
  3942. if test "$virglrenderer" != "no" ; then
  3943. cat > $TMPC << EOF
  3944. #include <virglrenderer.h>
  3945. int main(void) { virgl_renderer_poll(); return 0; }
  3946. EOF
  3947. virgl_cflags=$($pkg_config --cflags virglrenderer 2>/dev/null)
  3948. virgl_libs=$($pkg_config --libs virglrenderer 2>/dev/null)
  3949. if $pkg_config virglrenderer >/dev/null 2>&1 && \
  3950. compile_prog "$virgl_cflags" "$virgl_libs" ; then
  3951. virglrenderer="yes"
  3952. else
  3953. if test "$virglrenderer" = "yes" ; then
  3954. feature_not_found "virglrenderer"
  3955. fi
  3956. virglrenderer="no"
  3957. fi
  3958. fi
  3959. ##########################################
  3960. # check if we have fdatasync
  3961. fdatasync=no
  3962. cat > $TMPC << EOF
  3963. #include <unistd.h>
  3964. int main(void) {
  3965. #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
  3966. return fdatasync(0);
  3967. #else
  3968. #error Not supported
  3969. #endif
  3970. }
  3971. EOF
  3972. if compile_prog "" "" ; then
  3973. fdatasync=yes
  3974. fi
  3975. ##########################################
  3976. # check if we have madvise
  3977. madvise=no
  3978. cat > $TMPC << EOF
  3979. #include <sys/types.h>
  3980. #include <sys/mman.h>
  3981. #include <stddef.h>
  3982. int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
  3983. EOF
  3984. if compile_prog "" "" ; then
  3985. madvise=yes
  3986. fi
  3987. ##########################################
  3988. # check if we have posix_madvise
  3989. posix_madvise=no
  3990. cat > $TMPC << EOF
  3991. #include <sys/mman.h>
  3992. #include <stddef.h>
  3993. int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
  3994. EOF
  3995. if compile_prog "" "" ; then
  3996. posix_madvise=yes
  3997. fi
  3998. ##########################################
  3999. # check if we have posix_syslog
  4000. posix_syslog=no
  4001. cat > $TMPC << EOF
  4002. #include <syslog.h>
  4003. int main(void) { openlog("qemu", LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "configure"); return 0; }
  4004. EOF
  4005. if compile_prog "" "" ; then
  4006. posix_syslog=yes
  4007. fi
  4008. ##########################################
  4009. # check if trace backend exists
  4010. $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null
  4011. if test "$?" -ne 0 ; then
  4012. error_exit "invalid trace backends" \
  4013. "Please choose supported trace backends."
  4014. fi
  4015. ##########################################
  4016. # For 'ust' backend, test if ust headers are present
  4017. if have_backend "ust"; then
  4018. cat > $TMPC << EOF
  4019. #include <lttng/tracepoint.h>
  4020. int main(void) { return 0; }
  4021. EOF
  4022. if compile_prog "" "-Wl,--no-as-needed -ldl" ; then
  4023. if $pkg_config lttng-ust --exists; then
  4024. lttng_ust_libs=$($pkg_config --libs lttng-ust)
  4025. else
  4026. lttng_ust_libs="-llttng-ust -ldl"
  4027. fi
  4028. if $pkg_config liburcu-bp --exists; then
  4029. urcu_bp_libs=$($pkg_config --libs liburcu-bp)
  4030. else
  4031. urcu_bp_libs="-lurcu-bp"
  4032. fi
  4033. LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
  4034. libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
  4035. else
  4036. error_exit "Trace backend 'ust' missing lttng-ust header files"
  4037. fi
  4038. fi
  4039. ##########################################
  4040. # For 'dtrace' backend, test if 'dtrace' command is present
  4041. if have_backend "dtrace"; then
  4042. if ! has 'dtrace' ; then
  4043. error_exit "dtrace command is not found in PATH $PATH"
  4044. fi
  4045. trace_backend_stap="no"
  4046. if has 'stap' ; then
  4047. trace_backend_stap="yes"
  4048. fi
  4049. fi
  4050. ##########################################
  4051. # check and set a backend for coroutine
  4052. # We prefer ucontext, but it's not always possible. The fallback
  4053. # is sigcontext. On Windows the only valid backend is the Windows
  4054. # specific one.
  4055. ucontext_works=no
  4056. if test "$darwin" != "yes"; then
  4057. cat > $TMPC << EOF
  4058. #include <ucontext.h>
  4059. #ifdef __stub_makecontext
  4060. #error Ignoring glibc stub makecontext which will always fail
  4061. #endif
  4062. int main(void) { makecontext(0, 0, 0); return 0; }
  4063. EOF
  4064. if compile_prog "" "" ; then
  4065. ucontext_works=yes
  4066. fi
  4067. fi
  4068. if test "$coroutine" = ""; then
  4069. if test "$mingw32" = "yes"; then
  4070. coroutine=win32
  4071. elif test "$ucontext_works" = "yes"; then
  4072. coroutine=ucontext
  4073. else
  4074. coroutine=sigaltstack
  4075. fi
  4076. else
  4077. case $coroutine in
  4078. windows)
  4079. if test "$mingw32" != "yes"; then
  4080. error_exit "'windows' coroutine backend only valid for Windows"
  4081. fi
  4082. # Unfortunately the user visible backend name doesn't match the
  4083. # coroutine-*.c filename for this case, so we have to adjust it here.
  4084. coroutine=win32
  4085. ;;
  4086. ucontext)
  4087. if test "$ucontext_works" != "yes"; then
  4088. feature_not_found "ucontext"
  4089. fi
  4090. ;;
  4091. sigaltstack)
  4092. if test "$mingw32" = "yes"; then
  4093. error_exit "only the 'windows' coroutine backend is valid for Windows"
  4094. fi
  4095. ;;
  4096. *)
  4097. error_exit "unknown coroutine backend $coroutine"
  4098. ;;
  4099. esac
  4100. fi
  4101. if test "$coroutine_pool" = ""; then
  4102. coroutine_pool=yes
  4103. fi
  4104. if test "$debug_stack_usage" = "yes"; then
  4105. if test "$cpu" = "ia64" -o "$cpu" = "hppa"; then
  4106. error_exit "stack usage debugging is not supported for $cpu"
  4107. fi
  4108. if test "$coroutine_pool" = "yes"; then
  4109. echo "WARN: disabling coroutine pool for stack usage debugging"
  4110. coroutine_pool=no
  4111. fi
  4112. fi
  4113. ##########################################
  4114. # check if we have open_by_handle_at
  4115. open_by_handle_at=no
  4116. cat > $TMPC << EOF
  4117. #include <fcntl.h>
  4118. #if !defined(AT_EMPTY_PATH)
  4119. # error missing definition
  4120. #else
  4121. int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
  4122. #endif
  4123. EOF
  4124. if compile_prog "" "" ; then
  4125. open_by_handle_at=yes
  4126. fi
  4127. ########################################
  4128. # check if we have linux/magic.h
  4129. linux_magic_h=no
  4130. cat > $TMPC << EOF
  4131. #include <linux/magic.h>
  4132. int main(void) {
  4133. return 0;
  4134. }
  4135. EOF
  4136. if compile_prog "" "" ; then
  4137. linux_magic_h=yes
  4138. fi
  4139. ########################################
  4140. # check whether we can disable warning option with a pragma (this is needed
  4141. # to silence warnings in the headers of some versions of external libraries).
  4142. # This test has to be compiled with -Werror as otherwise an unknown pragma is
  4143. # only a warning.
  4144. #
  4145. # If we can't selectively disable warning in the code, disable -Werror so that
  4146. # the build doesn't fail anyway.
  4147. pragma_disable_unused_but_set=no
  4148. cat > $TMPC << EOF
  4149. #pragma GCC diagnostic push
  4150. #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
  4151. #pragma GCC diagnostic ignored "-Wstrict-prototypes"
  4152. #pragma GCC diagnostic pop
  4153. int main(void) {
  4154. return 0;
  4155. }
  4156. EOF
  4157. if compile_prog "-Werror" "" ; then
  4158. pragma_diagnostic_available=yes
  4159. else
  4160. werror=no
  4161. fi
  4162. ########################################
  4163. # check if we have valgrind/valgrind.h
  4164. valgrind_h=no
  4165. cat > $TMPC << EOF
  4166. #include <valgrind/valgrind.h>
  4167. int main(void) {
  4168. return 0;
  4169. }
  4170. EOF
  4171. if compile_prog "" "" ; then
  4172. valgrind_h=yes
  4173. fi
  4174. ########################################
  4175. # check if environ is declared
  4176. has_environ=no
  4177. cat > $TMPC << EOF
  4178. #include <unistd.h>
  4179. int main(void) {
  4180. environ = 0;
  4181. return 0;
  4182. }
  4183. EOF
  4184. if compile_prog "" "" ; then
  4185. has_environ=yes
  4186. fi
  4187. ########################################
  4188. # check if cpuid.h is usable.
  4189. cpuid_h=no
  4190. cat > $TMPC << EOF
  4191. #include <cpuid.h>
  4192. int main(void) {
  4193. unsigned a, b, c, d;
  4194. int max = __get_cpuid_max(0, 0);
  4195. if (max >= 1) {
  4196. __cpuid(1, a, b, c, d);
  4197. }
  4198. if (max >= 7) {
  4199. __cpuid_count(7, 0, a, b, c, d);
  4200. }
  4201. return 0;
  4202. }
  4203. EOF
  4204. if compile_prog "" "" ; then
  4205. cpuid_h=yes
  4206. fi
  4207. ########################################
  4208. # check if __[u]int128_t is usable.
  4209. int128=no
  4210. cat > $TMPC << EOF
  4211. #if defined(__clang_major__) && defined(__clang_minor__)
  4212. # if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
  4213. # error __int128_t does not work in CLANG before 3.2
  4214. # endif
  4215. #endif
  4216. __int128_t a;
  4217. __uint128_t b;
  4218. int main (void) {
  4219. a = a + b;
  4220. b = a * b;
  4221. a = a * a;
  4222. return 0;
  4223. }
  4224. EOF
  4225. if compile_prog "" "" ; then
  4226. int128=yes
  4227. fi
  4228. #########################################
  4229. # See if 128-bit atomic operations are supported.
  4230. atomic128=no
  4231. if test "$int128" = "yes"; then
  4232. cat > $TMPC << EOF
  4233. int main(void)
  4234. {
  4235. unsigned __int128 x = 0, y = 0;
  4236. y = __atomic_load_16(&x, 0);
  4237. __atomic_store_16(&x, y, 0);
  4238. __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0);
  4239. return 0;
  4240. }
  4241. EOF
  4242. if compile_prog "" "" ; then
  4243. atomic128=yes
  4244. fi
  4245. fi
  4246. #########################################
  4247. # See if 64-bit atomic operations are supported.
  4248. # Note that without __atomic builtins, we can only
  4249. # assume atomic loads/stores max at pointer size.
  4250. cat > $TMPC << EOF
  4251. #include <stdint.h>
  4252. int main(void)
  4253. {
  4254. uint64_t x = 0, y = 0;
  4255. #ifdef __ATOMIC_RELAXED
  4256. y = __atomic_load_8(&x, 0);
  4257. __atomic_store_8(&x, y, 0);
  4258. __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0);
  4259. __atomic_exchange_8(&x, y, 0);
  4260. __atomic_fetch_add_8(&x, y, 0);
  4261. #else
  4262. typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1];
  4263. __sync_lock_test_and_set(&x, y);
  4264. __sync_val_compare_and_swap(&x, y, 0);
  4265. __sync_fetch_and_add(&x, y);
  4266. #endif
  4267. return 0;
  4268. }
  4269. EOF
  4270. if compile_prog "" "" ; then
  4271. atomic64=yes
  4272. fi
  4273. ########################################
  4274. # check if getauxval is available.
  4275. getauxval=no
  4276. cat > $TMPC << EOF
  4277. #include <sys/auxv.h>
  4278. int main(void) {
  4279. return getauxval(AT_HWCAP) == 0;
  4280. }
  4281. EOF
  4282. if compile_prog "" "" ; then
  4283. getauxval=yes
  4284. fi
  4285. ########################################
  4286. # check if ccache is interfering with
  4287. # semantic analysis of macros
  4288. unset CCACHE_CPP2
  4289. ccache_cpp2=no
  4290. cat > $TMPC << EOF
  4291. static const int Z = 1;
  4292. #define fn() ({ Z; })
  4293. #define TAUT(X) ((X) == Z)
  4294. #define PAREN(X, Y) (X == Y)
  4295. #define ID(X) (X)
  4296. int main(int argc, char *argv[])
  4297. {
  4298. int x = 0, y = 0;
  4299. x = ID(x);
  4300. x = fn();
  4301. fn();
  4302. if (PAREN(x, y)) return 0;
  4303. if (TAUT(Z)) return 0;
  4304. return 0;
  4305. }
  4306. EOF
  4307. if ! compile_object "-Werror"; then
  4308. ccache_cpp2=yes
  4309. fi
  4310. #################################################
  4311. # clang does not support glibc + FORTIFY_SOURCE.
  4312. if test "$fortify_source" != "no"; then
  4313. if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then
  4314. fortify_source="no";
  4315. elif test -n "$cxx" &&
  4316. echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then
  4317. fortify_source="no";
  4318. else
  4319. fortify_source="yes"
  4320. fi
  4321. fi
  4322. ##########################################
  4323. # check if struct fsxattr is available via linux/fs.h
  4324. have_fsxattr=no
  4325. cat > $TMPC << EOF
  4326. #include <linux/fs.h>
  4327. struct fsxattr foo;
  4328. int main(void) {
  4329. return 0;
  4330. }
  4331. EOF
  4332. if compile_prog "" "" ; then
  4333. have_fsxattr=yes
  4334. fi
  4335. ##########################################
  4336. # check if rtnetlink.h exists and is useful
  4337. have_rtnetlink=no
  4338. cat > $TMPC << EOF
  4339. #include <linux/rtnetlink.h>
  4340. int main(void) {
  4341. return IFLA_PROTO_DOWN;
  4342. }
  4343. EOF
  4344. if compile_prog "" "" ; then
  4345. have_rtnetlink=yes
  4346. fi
  4347. ##########################################
  4348. # check for usable AF_VSOCK environment
  4349. have_af_vsock=no
  4350. cat > $TMPC << EOF
  4351. #include <errno.h>
  4352. #include <sys/types.h>
  4353. #include <sys/socket.h>
  4354. #if !defined(AF_VSOCK)
  4355. # error missing AF_VSOCK flag
  4356. #endif
  4357. #include <linux/vm_sockets.h>
  4358. int main(void) {
  4359. int sock, ret;
  4360. struct sockaddr_vm svm;
  4361. socklen_t len = sizeof(svm);
  4362. sock = socket(AF_VSOCK, SOCK_STREAM, 0);
  4363. ret = getpeername(sock, (struct sockaddr *)&svm, &len);
  4364. if ((ret == -1) && (errno == ENOTCONN)) {
  4365. return 0;
  4366. }
  4367. return -1;
  4368. }
  4369. EOF
  4370. if compile_prog "" "" ; then
  4371. have_af_vsock=yes
  4372. fi
  4373. #################################################
  4374. # Sparc implicitly links with --relax, which is
  4375. # incompatible with -r, so --no-relax should be
  4376. # given. It does no harm to give it on other
  4377. # platforms too.
  4378. # Note: the prototype is needed since QEMU_CFLAGS
  4379. # contains -Wmissing-prototypes
  4380. cat > $TMPC << EOF
  4381. extern int foo(void);
  4382. int foo(void) { return 0; }
  4383. EOF
  4384. if ! compile_object ""; then
  4385. error_exit "Failed to compile object file for LD_REL_FLAGS test"
  4386. fi
  4387. for i in '-Wl,-r -Wl,--no-relax' -Wl,-r -r; do
  4388. if do_cc -nostdlib $i -o $TMPMO $TMPO; then
  4389. LD_REL_FLAGS=$i
  4390. break
  4391. fi
  4392. done
  4393. if test "$modules" = "yes" && test "$LD_REL_FLAGS" = ""; then
  4394. feature_not_found "modules" "Cannot find how to build relocatable objects"
  4395. fi
  4396. ##########################################
  4397. # check for sysmacros.h
  4398. have_sysmacros=no
  4399. cat > $TMPC << EOF
  4400. #include <sys/sysmacros.h>
  4401. int main(void) {
  4402. return makedev(0, 0);
  4403. }
  4404. EOF
  4405. if compile_prog "" "" ; then
  4406. have_sysmacros=yes
  4407. fi
  4408. ##########################################
  4409. # Veritas HyperScale block driver VxHS
  4410. # Check if libvxhs is installed
  4411. if test "$vxhs" != "no" ; then
  4412. cat > $TMPC <<EOF
  4413. #include <stdint.h>
  4414. #include <qnio/qnio_api.h>
  4415. void *vxhs_callback;
  4416. int main(void) {
  4417. iio_init(QNIO_VERSION, vxhs_callback);
  4418. return 0;
  4419. }
  4420. EOF
  4421. vxhs_libs="-lvxhs -lssl"
  4422. if compile_prog "" "$vxhs_libs" ; then
  4423. vxhs=yes
  4424. else
  4425. if test "$vxhs" = "yes" ; then
  4426. feature_not_found "vxhs block device" "Install libvxhs See github"
  4427. fi
  4428. vxhs=no
  4429. fi
  4430. fi
  4431. ##########################################
  4432. # check for _Static_assert()
  4433. have_static_assert=no
  4434. cat > $TMPC << EOF
  4435. _Static_assert(1, "success");
  4436. int main(void) {
  4437. return 0;
  4438. }
  4439. EOF
  4440. if compile_prog "" "" ; then
  4441. have_static_assert=yes
  4442. fi
  4443. ##########################################
  4444. # End of CC checks
  4445. # After here, no more $cc or $ld runs
  4446. if test "$gcov" = "yes" ; then
  4447. CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
  4448. LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
  4449. elif test "$fortify_source" = "yes" ; then
  4450. CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
  4451. elif test "$debug" = "no"; then
  4452. CFLAGS="-O2 $CFLAGS"
  4453. fi
  4454. ##########################################
  4455. # Do we have libnfs
  4456. if test "$libnfs" != "no" ; then
  4457. if $pkg_config --atleast-version=1.9.3 libnfs; then
  4458. libnfs="yes"
  4459. libnfs_libs=$($pkg_config --libs libnfs)
  4460. else
  4461. if test "$libnfs" = "yes" ; then
  4462. feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
  4463. fi
  4464. libnfs="no"
  4465. fi
  4466. fi
  4467. # Now we've finished running tests it's OK to add -Werror to the compiler flags
  4468. if test "$werror" = "yes"; then
  4469. QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
  4470. fi
  4471. if test "$solaris" = "no" ; then
  4472. if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
  4473. LDFLAGS="-Wl,--warn-common $LDFLAGS"
  4474. fi
  4475. fi
  4476. # test if pod2man has --utf8 option
  4477. if pod2man --help | grep -q utf8; then
  4478. POD2MAN="pod2man --utf8"
  4479. else
  4480. POD2MAN="pod2man"
  4481. fi
  4482. # Use ASLR, no-SEH and DEP if available
  4483. if test "$mingw32" = "yes" ; then
  4484. for flag in --dynamicbase --no-seh --nxcompat; do
  4485. if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
  4486. LDFLAGS="-Wl,$flag $LDFLAGS"
  4487. fi
  4488. done
  4489. fi
  4490. qemu_confdir=$sysconfdir$confsuffix
  4491. qemu_moddir=$libdir$confsuffix
  4492. qemu_datadir=$datadir$confsuffix
  4493. qemu_localedir="$datadir/locale"
  4494. tools=""
  4495. if test "$want_tools" = "yes" ; then
  4496. tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
  4497. if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
  4498. tools="qemu-nbd\$(EXESUF) $tools"
  4499. tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools"
  4500. fi
  4501. fi
  4502. if test "$softmmu" = yes ; then
  4503. if test "$virtfs" != no ; then
  4504. if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
  4505. virtfs=yes
  4506. tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
  4507. else
  4508. if test "$virtfs" = yes; then
  4509. error_exit "VirtFS is supported only on Linux and requires libcap devel and libattr devel"
  4510. fi
  4511. virtfs=no
  4512. fi
  4513. fi
  4514. fi
  4515. # Probe for guest agent support/options
  4516. if [ "$guest_agent" != "no" ]; then
  4517. if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
  4518. tools="qemu-ga $tools"
  4519. guest_agent=yes
  4520. elif [ "$guest_agent" != yes ]; then
  4521. guest_agent=no
  4522. else
  4523. error_exit "Guest agent is not supported on this platform"
  4524. fi
  4525. fi
  4526. # Guest agent Window MSI package
  4527. if test "$guest_agent" != yes; then
  4528. if test "$guest_agent_msi" = yes; then
  4529. error_exit "MSI guest agent package requires guest agent enabled"
  4530. fi
  4531. guest_agent_msi=no
  4532. elif test "$mingw32" != "yes"; then
  4533. if test "$guest_agent_msi" = "yes"; then
  4534. error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation"
  4535. fi
  4536. guest_agent_msi=no
  4537. elif ! has wixl; then
  4538. if test "$guest_agent_msi" = "yes"; then
  4539. error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )"
  4540. fi
  4541. guest_agent_msi=no
  4542. else
  4543. # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't
  4544. # disabled explicitly
  4545. if test "$guest_agent_msi" != "no"; then
  4546. guest_agent_msi=yes
  4547. fi
  4548. fi
  4549. if test "$guest_agent_msi" = "yes"; then
  4550. if test "$guest_agent_with_vss" = "yes"; then
  4551. QEMU_GA_MSI_WITH_VSS="-D InstallVss"
  4552. fi
  4553. if test "$QEMU_GA_MANUFACTURER" = ""; then
  4554. QEMU_GA_MANUFACTURER=QEMU
  4555. fi
  4556. if test "$QEMU_GA_DISTRO" = ""; then
  4557. QEMU_GA_DISTRO=Linux
  4558. fi
  4559. if test "$QEMU_GA_VERSION" = ""; then
  4560. QEMU_GA_VERSION=$(cat $source_path/VERSION)
  4561. fi
  4562. QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin"
  4563. case "$cpu" in
  4564. x86_64)
  4565. QEMU_GA_MSI_ARCH="-a x64 -D Arch=64"
  4566. ;;
  4567. i386)
  4568. QEMU_GA_MSI_ARCH="-D Arch=32"
  4569. ;;
  4570. *)
  4571. error_exit "CPU $cpu not supported for building installation package"
  4572. ;;
  4573. esac
  4574. fi
  4575. # Mac OS X ships with a broken assembler
  4576. roms=
  4577. if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
  4578. "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
  4579. "$softmmu" = yes ; then
  4580. # Different host OS linkers have different ideas about the name of the ELF
  4581. # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _fbsd
  4582. # variant; and Windows uses i386pe.
  4583. for emu in elf_i386 elf_i386_fbsd i386pe; do
  4584. if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
  4585. ld_i386_emulation="$emu"
  4586. roms="optionrom"
  4587. break
  4588. fi
  4589. done
  4590. fi
  4591. if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
  4592. roms="$roms spapr-rtas"
  4593. fi
  4594. if test "$cpu" = "s390x" ; then
  4595. roms="$roms s390-ccw"
  4596. fi
  4597. # Probe for the need for relocating the user-only binary.
  4598. if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then
  4599. textseg_addr=
  4600. case "$cpu" in
  4601. arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
  4602. # ??? Rationale for choosing this address
  4603. textseg_addr=0x60000000
  4604. ;;
  4605. mips)
  4606. # A 256M aligned address, high in the address space, with enough
  4607. # room for the code_gen_buffer above it before the stack.
  4608. textseg_addr=0x60000000
  4609. ;;
  4610. esac
  4611. if [ -n "$textseg_addr" ]; then
  4612. cat > $TMPC <<EOF
  4613. int main(void) { return 0; }
  4614. EOF
  4615. textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
  4616. if ! compile_prog "" "$textseg_ldflags"; then
  4617. # In case ld does not support -Ttext-segment, edit the default linker
  4618. # script via sed to set the .text start addr. This is needed on FreeBSD
  4619. # at least.
  4620. if ! $ld --verbose >/dev/null 2>&1; then
  4621. error_exit \
  4622. "We need to link the QEMU user mode binaries at a" \
  4623. "specific text address. Unfortunately your linker" \
  4624. "doesn't support either the -Ttext-segment option or" \
  4625. "printing the default linker script with --verbose." \
  4626. "If you don't want the user mode binaries, pass the" \
  4627. "--disable-user option to configure."
  4628. fi
  4629. $ld --verbose | sed \
  4630. -e '1,/==================================================/d' \
  4631. -e '/==================================================/,$d' \
  4632. -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
  4633. -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
  4634. textseg_ldflags="-Wl,-T../config-host.ld"
  4635. fi
  4636. fi
  4637. fi
  4638. echo_version() {
  4639. if test "$1" = "yes" ; then
  4640. echo "($2)"
  4641. fi
  4642. }
  4643. # prepend pixman and ftd flags after all config tests are done
  4644. QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
  4645. libs_softmmu="$pixman_libs $libs_softmmu"
  4646. echo "Install prefix $prefix"
  4647. echo "BIOS directory $(eval echo $qemu_datadir)"
  4648. echo "binary directory $(eval echo $bindir)"
  4649. echo "library directory $(eval echo $libdir)"
  4650. echo "module directory $(eval echo $qemu_moddir)"
  4651. echo "libexec directory $(eval echo $libexecdir)"
  4652. echo "include directory $(eval echo $includedir)"
  4653. echo "config directory $(eval echo $sysconfdir)"
  4654. if test "$mingw32" = "no" ; then
  4655. echo "local state directory $(eval echo $local_statedir)"
  4656. echo "Manual directory $(eval echo $mandir)"
  4657. echo "ELF interp prefix $interp_prefix"
  4658. else
  4659. echo "local state directory queried at runtime"
  4660. echo "Windows SDK $win_sdk"
  4661. fi
  4662. echo "Source path $source_path"
  4663. echo "C compiler $cc"
  4664. echo "Host C compiler $host_cc"
  4665. echo "C++ compiler $cxx"
  4666. echo "Objective-C compiler $objcc"
  4667. echo "ARFLAGS $ARFLAGS"
  4668. echo "CFLAGS $CFLAGS"
  4669. echo "QEMU_CFLAGS $QEMU_CFLAGS"
  4670. echo "LDFLAGS $LDFLAGS"
  4671. echo "make $make"
  4672. echo "install $install"
  4673. echo "python $python"
  4674. if test "$slirp" = "yes" ; then
  4675. echo "smbd $smbd"
  4676. fi
  4677. echo "module support $modules"
  4678. echo "host CPU $cpu"
  4679. echo "host big endian $bigendian"
  4680. echo "target list $target_list"
  4681. echo "tcg debug enabled $debug_tcg"
  4682. echo "gprof enabled $gprof"
  4683. echo "sparse enabled $sparse"
  4684. echo "strip binaries $strip_opt"
  4685. echo "profiler $profiler"
  4686. echo "static build $static"
  4687. if test "$darwin" = "yes" ; then
  4688. echo "Cocoa support $cocoa"
  4689. fi
  4690. echo "pixman $pixman"
  4691. echo "SDL support $sdl $(echo_version $sdl $sdlversion)"
  4692. echo "GTK support $gtk $(echo_version $gtk $gtk_version)"
  4693. echo "GTK GL support $gtk_gl"
  4694. echo "VTE support $vte $(echo_version $vte $vteversion)"
  4695. echo "TLS priority $tls_priority"
  4696. echo "GNUTLS support $gnutls"
  4697. echo "GNUTLS rnd $gnutls_rnd"
  4698. echo "libgcrypt $gcrypt"
  4699. echo "libgcrypt kdf $gcrypt_kdf"
  4700. echo "nettle $nettle $(echo_version $nettle $nettle_version)"
  4701. echo "nettle kdf $nettle_kdf"
  4702. echo "libtasn1 $tasn1"
  4703. echo "curses support $curses"
  4704. echo "virgl support $virglrenderer"
  4705. echo "curl support $curl"
  4706. echo "mingw32 support $mingw32"
  4707. echo "Audio drivers $audio_drv_list"
  4708. echo "Block whitelist (rw) $block_drv_rw_whitelist"
  4709. echo "Block whitelist (ro) $block_drv_ro_whitelist"
  4710. echo "VirtFS support $virtfs"
  4711. echo "VNC support $vnc"
  4712. if test "$vnc" = "yes" ; then
  4713. echo "VNC SASL support $vnc_sasl"
  4714. echo "VNC JPEG support $vnc_jpeg"
  4715. echo "VNC PNG support $vnc_png"
  4716. fi
  4717. if test -n "$sparc_cpu"; then
  4718. echo "Target Sparc Arch $sparc_cpu"
  4719. fi
  4720. echo "xen support $xen"
  4721. if test "$xen" = "yes" ; then
  4722. echo "xen ctrl version $xen_ctrl_version"
  4723. echo "pv dom build $xen_pv_domain_build"
  4724. fi
  4725. echo "brlapi support $brlapi"
  4726. echo "bluez support $bluez"
  4727. echo "Documentation $docs"
  4728. echo "PIE $pie"
  4729. echo "vde support $vde"
  4730. echo "netmap support $netmap"
  4731. echo "Linux AIO support $linux_aio"
  4732. echo "ATTR/XATTR support $attr"
  4733. echo "Install blobs $blobs"
  4734. echo "KVM support $kvm"
  4735. echo "HAX support $hax"
  4736. echo "RDMA support $rdma"
  4737. echo "TCG interpreter $tcg_interpreter"
  4738. echo "fdt support $fdt"
  4739. echo "preadv support $preadv"
  4740. echo "fdatasync $fdatasync"
  4741. echo "madvise $madvise"
  4742. echo "posix_madvise $posix_madvise"
  4743. echo "libcap-ng support $cap_ng"
  4744. echo "vhost-net support $vhost_net"
  4745. echo "vhost-scsi support $vhost_scsi"
  4746. echo "vhost-vsock support $vhost_vsock"
  4747. echo "Trace backends $trace_backends"
  4748. if have_backend "simple"; then
  4749. echo "Trace output file $trace_file-<pid>"
  4750. fi
  4751. echo "spice support $spice $(echo_version $spice $spice_protocol_version/$spice_server_version)"
  4752. echo "rbd support $rbd"
  4753. echo "xfsctl support $xfs"
  4754. echo "smartcard support $smartcard"
  4755. echo "libusb $libusb"
  4756. echo "usb net redir $usb_redir"
  4757. echo "OpenGL support $opengl"
  4758. echo "OpenGL dmabufs $opengl_dmabuf"
  4759. echo "libiscsi support $libiscsi"
  4760. echo "libnfs support $libnfs"
  4761. echo "build guest agent $guest_agent"
  4762. echo "QGA VSS support $guest_agent_with_vss"
  4763. echo "QGA w32 disk info $guest_agent_ntddscsi"
  4764. echo "QGA MSI support $guest_agent_msi"
  4765. echo "seccomp support $seccomp"
  4766. echo "coroutine backend $coroutine"
  4767. echo "coroutine pool $coroutine_pool"
  4768. echo "debug stack usage $debug_stack_usage"
  4769. echo "GlusterFS support $glusterfs"
  4770. echo "gcov $gcov_tool"
  4771. echo "gcov enabled $gcov"
  4772. echo "TPM support $tpm"
  4773. echo "libssh2 support $libssh2"
  4774. echo "TPM passthrough $tpm_passthrough"
  4775. echo "QOM debugging $qom_cast_debug"
  4776. echo "Live block migration $live_block_migration"
  4777. echo "lzo support $lzo"
  4778. echo "snappy support $snappy"
  4779. echo "bzip2 support $bzip2"
  4780. echo "NUMA host support $numa"
  4781. echo "tcmalloc support $tcmalloc"
  4782. echo "jemalloc support $jemalloc"
  4783. echo "avx2 optimization $avx2_opt"
  4784. echo "replication support $replication"
  4785. echo "VxHS block device $vxhs"
  4786. if test "$sdl_too_old" = "yes"; then
  4787. echo "-> Your SDL version is too old - please upgrade to have SDL support"
  4788. fi
  4789. if test "$supported_cpu" = "no"; then
  4790. echo
  4791. echo "WARNING: SUPPORT FOR THIS HOST CPU WILL GO AWAY IN FUTURE RELEASES!"
  4792. echo
  4793. echo "CPU host architecture $cpu support is not currently maintained."
  4794. echo "The QEMU project intends to remove support for this host CPU in"
  4795. echo "a future release if nobody volunteers to maintain it and to"
  4796. echo "provide a build host for our continuous integration setup."
  4797. echo "configure has succeeded and you can continue to build, but"
  4798. echo "if you care about QEMU on this platform you should contact"
  4799. echo "us upstream at qemu-devel@nongnu.org."
  4800. fi
  4801. if test "$supported_os" = "no"; then
  4802. echo
  4803. echo "WARNING: SUPPORT FOR THIS HOST OS WILL GO AWAY IN FUTURE RELEASES!"
  4804. echo
  4805. echo "Host OS $targetos support is not currently maintained."
  4806. echo "The QEMU project intends to remove support for this host OS in"
  4807. echo "a future release if nobody volunteers to maintain it and to"
  4808. echo "provide a build host for our continuous integration setup."
  4809. echo "configure has succeeded and you can continue to build, but"
  4810. echo "if you care about QEMU on this platform you should contact"
  4811. echo "us upstream at qemu-devel@nongnu.org."
  4812. fi
  4813. config_host_mak="config-host.mak"
  4814. echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
  4815. echo "# Automatically generated by configure - do not modify" > $config_host_mak
  4816. echo >> $config_host_mak
  4817. echo all: >> $config_host_mak
  4818. echo "prefix=$prefix" >> $config_host_mak
  4819. echo "bindir=$bindir" >> $config_host_mak
  4820. echo "libdir=$libdir" >> $config_host_mak
  4821. echo "libexecdir=$libexecdir" >> $config_host_mak
  4822. echo "includedir=$includedir" >> $config_host_mak
  4823. echo "mandir=$mandir" >> $config_host_mak
  4824. echo "sysconfdir=$sysconfdir" >> $config_host_mak
  4825. echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
  4826. echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
  4827. echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
  4828. echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
  4829. if test "$mingw32" = "no" ; then
  4830. echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
  4831. fi
  4832. echo "qemu_helperdir=$libexecdir" >> $config_host_mak
  4833. echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
  4834. echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
  4835. echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
  4836. echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
  4837. echo "ARCH=$ARCH" >> $config_host_mak
  4838. if test "$debug_tcg" = "yes" ; then
  4839. echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
  4840. fi
  4841. if test "$strip_opt" = "yes" ; then
  4842. echo "STRIP=${strip}" >> $config_host_mak
  4843. fi
  4844. if test "$bigendian" = "yes" ; then
  4845. echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
  4846. fi
  4847. if test "$mingw32" = "yes" ; then
  4848. echo "CONFIG_WIN32=y" >> $config_host_mak
  4849. rc_version=$(cat $source_path/VERSION)
  4850. version_major=${rc_version%%.*}
  4851. rc_version=${rc_version#*.}
  4852. version_minor=${rc_version%%.*}
  4853. rc_version=${rc_version#*.}
  4854. version_subminor=${rc_version%%.*}
  4855. version_micro=0
  4856. echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
  4857. echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
  4858. if test "$guest_agent_with_vss" = "yes" ; then
  4859. echo "CONFIG_QGA_VSS=y" >> $config_host_mak
  4860. echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak
  4861. echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
  4862. fi
  4863. if test "$guest_agent_ntddscsi" = "yes" ; then
  4864. echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak
  4865. fi
  4866. if test "$guest_agent_msi" = "yes"; then
  4867. echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
  4868. echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
  4869. echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
  4870. echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak
  4871. echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
  4872. echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
  4873. echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
  4874. fi
  4875. else
  4876. echo "CONFIG_POSIX=y" >> $config_host_mak
  4877. fi
  4878. if test "$linux" = "yes" ; then
  4879. echo "CONFIG_LINUX=y" >> $config_host_mak
  4880. fi
  4881. if test "$darwin" = "yes" ; then
  4882. echo "CONFIG_DARWIN=y" >> $config_host_mak
  4883. fi
  4884. if test "$aix" = "yes" ; then
  4885. echo "CONFIG_AIX=y" >> $config_host_mak
  4886. fi
  4887. if test "$solaris" = "yes" ; then
  4888. echo "CONFIG_SOLARIS=y" >> $config_host_mak
  4889. echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
  4890. if test "$needs_libsunmath" = "yes" ; then
  4891. echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
  4892. fi
  4893. fi
  4894. if test "$haiku" = "yes" ; then
  4895. echo "CONFIG_HAIKU=y" >> $config_host_mak
  4896. fi
  4897. if test "$static" = "yes" ; then
  4898. echo "CONFIG_STATIC=y" >> $config_host_mak
  4899. fi
  4900. if test "$profiler" = "yes" ; then
  4901. echo "CONFIG_PROFILER=y" >> $config_host_mak
  4902. fi
  4903. if test "$slirp" = "yes" ; then
  4904. echo "CONFIG_SLIRP=y" >> $config_host_mak
  4905. echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
  4906. fi
  4907. if test "$vde" = "yes" ; then
  4908. echo "CONFIG_VDE=y" >> $config_host_mak
  4909. fi
  4910. if test "$netmap" = "yes" ; then
  4911. echo "CONFIG_NETMAP=y" >> $config_host_mak
  4912. fi
  4913. if test "$l2tpv3" = "yes" ; then
  4914. echo "CONFIG_L2TPV3=y" >> $config_host_mak
  4915. fi
  4916. if test "$cap_ng" = "yes" ; then
  4917. echo "CONFIG_LIBCAP=y" >> $config_host_mak
  4918. fi
  4919. echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
  4920. for drv in $audio_drv_list; do
  4921. def=CONFIG_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
  4922. echo "$def=y" >> $config_host_mak
  4923. done
  4924. if test "$audio_pt_int" = "yes" ; then
  4925. echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
  4926. fi
  4927. if test "$audio_win_int" = "yes" ; then
  4928. echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
  4929. fi
  4930. echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
  4931. echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
  4932. if test "$vnc" = "yes" ; then
  4933. echo "CONFIG_VNC=y" >> $config_host_mak
  4934. fi
  4935. if test "$vnc_sasl" = "yes" ; then
  4936. echo "CONFIG_VNC_SASL=y" >> $config_host_mak
  4937. fi
  4938. if test "$vnc_jpeg" = "yes" ; then
  4939. echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
  4940. fi
  4941. if test "$vnc_png" = "yes" ; then
  4942. echo "CONFIG_VNC_PNG=y" >> $config_host_mak
  4943. fi
  4944. if test "$fnmatch" = "yes" ; then
  4945. echo "CONFIG_FNMATCH=y" >> $config_host_mak
  4946. fi
  4947. if test "$xfs" = "yes" ; then
  4948. echo "CONFIG_XFS=y" >> $config_host_mak
  4949. fi
  4950. qemu_version=$(head $source_path/VERSION)
  4951. echo "VERSION=$qemu_version" >>$config_host_mak
  4952. echo "PKGVERSION=$pkgversion" >>$config_host_mak
  4953. echo "SRC_PATH=$source_path" >> $config_host_mak
  4954. echo "TARGET_DIRS=$target_list" >> $config_host_mak
  4955. if [ "$docs" = "yes" ] ; then
  4956. echo "BUILD_DOCS=yes" >> $config_host_mak
  4957. fi
  4958. if test "$modules" = "yes"; then
  4959. # $shacmd can generate a hash started with digit, which the compiler doesn't
  4960. # like as an symbol. So prefix it with an underscore
  4961. echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
  4962. echo "CONFIG_MODULES=y" >> $config_host_mak
  4963. fi
  4964. if test "$sdl" = "yes" ; then
  4965. echo "CONFIG_SDL=y" >> $config_host_mak
  4966. echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
  4967. echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
  4968. fi
  4969. if test "$cocoa" = "yes" ; then
  4970. echo "CONFIG_COCOA=y" >> $config_host_mak
  4971. fi
  4972. if test "$curses" = "yes" ; then
  4973. echo "CONFIG_CURSES=y" >> $config_host_mak
  4974. fi
  4975. if test "$pipe2" = "yes" ; then
  4976. echo "CONFIG_PIPE2=y" >> $config_host_mak
  4977. fi
  4978. if test "$accept4" = "yes" ; then
  4979. echo "CONFIG_ACCEPT4=y" >> $config_host_mak
  4980. fi
  4981. if test "$splice" = "yes" ; then
  4982. echo "CONFIG_SPLICE=y" >> $config_host_mak
  4983. fi
  4984. if test "$eventfd" = "yes" ; then
  4985. echo "CONFIG_EVENTFD=y" >> $config_host_mak
  4986. fi
  4987. if test "$memfd" = "yes" ; then
  4988. echo "CONFIG_MEMFD=y" >> $config_host_mak
  4989. fi
  4990. if test "$fallocate" = "yes" ; then
  4991. echo "CONFIG_FALLOCATE=y" >> $config_host_mak
  4992. fi
  4993. if test "$fallocate_punch_hole" = "yes" ; then
  4994. echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
  4995. fi
  4996. if test "$fallocate_zero_range" = "yes" ; then
  4997. echo "CONFIG_FALLOCATE_ZERO_RANGE=y" >> $config_host_mak
  4998. fi
  4999. if test "$posix_fallocate" = "yes" ; then
  5000. echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
  5001. fi
  5002. if test "$sync_file_range" = "yes" ; then
  5003. echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
  5004. fi
  5005. if test "$fiemap" = "yes" ; then
  5006. echo "CONFIG_FIEMAP=y" >> $config_host_mak
  5007. fi
  5008. if test "$dup3" = "yes" ; then
  5009. echo "CONFIG_DUP3=y" >> $config_host_mak
  5010. fi
  5011. if test "$ppoll" = "yes" ; then
  5012. echo "CONFIG_PPOLL=y" >> $config_host_mak
  5013. fi
  5014. if test "$prctl_pr_set_timerslack" = "yes" ; then
  5015. echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
  5016. fi
  5017. if test "$epoll" = "yes" ; then
  5018. echo "CONFIG_EPOLL=y" >> $config_host_mak
  5019. fi
  5020. if test "$epoll_create1" = "yes" ; then
  5021. echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
  5022. fi
  5023. if test "$sendfile" = "yes" ; then
  5024. echo "CONFIG_SENDFILE=y" >> $config_host_mak
  5025. fi
  5026. if test "$timerfd" = "yes" ; then
  5027. echo "CONFIG_TIMERFD=y" >> $config_host_mak
  5028. fi
  5029. if test "$setns" = "yes" ; then
  5030. echo "CONFIG_SETNS=y" >> $config_host_mak
  5031. fi
  5032. if test "$clock_adjtime" = "yes" ; then
  5033. echo "CONFIG_CLOCK_ADJTIME=y" >> $config_host_mak
  5034. fi
  5035. if test "$syncfs" = "yes" ; then
  5036. echo "CONFIG_SYNCFS=y" >> $config_host_mak
  5037. fi
  5038. if test "$inotify" = "yes" ; then
  5039. echo "CONFIG_INOTIFY=y" >> $config_host_mak
  5040. fi
  5041. if test "$inotify1" = "yes" ; then
  5042. echo "CONFIG_INOTIFY1=y" >> $config_host_mak
  5043. fi
  5044. if test "$byteswap_h" = "yes" ; then
  5045. echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
  5046. fi
  5047. if test "$bswap_h" = "yes" ; then
  5048. echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
  5049. fi
  5050. if test "$curl" = "yes" ; then
  5051. echo "CONFIG_CURL=m" >> $config_host_mak
  5052. echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
  5053. echo "CURL_LIBS=$curl_libs" >> $config_host_mak
  5054. fi
  5055. if test "$brlapi" = "yes" ; then
  5056. echo "CONFIG_BRLAPI=y" >> $config_host_mak
  5057. fi
  5058. if test "$bluez" = "yes" ; then
  5059. echo "CONFIG_BLUEZ=y" >> $config_host_mak
  5060. echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
  5061. fi
  5062. if test "$glib_subprocess" = "yes" ; then
  5063. echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak
  5064. fi
  5065. if test "$gtk" = "yes" ; then
  5066. echo "CONFIG_GTK=y" >> $config_host_mak
  5067. echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
  5068. echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
  5069. echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
  5070. if test "$gtk_gl" = "yes" ; then
  5071. echo "CONFIG_GTK_GL=y" >> $config_host_mak
  5072. fi
  5073. fi
  5074. echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
  5075. if test "$gnutls" = "yes" ; then
  5076. echo "CONFIG_GNUTLS=y" >> $config_host_mak
  5077. fi
  5078. if test "$gnutls_rnd" = "yes" ; then
  5079. echo "CONFIG_GNUTLS_RND=y" >> $config_host_mak
  5080. fi
  5081. if test "$gcrypt" = "yes" ; then
  5082. echo "CONFIG_GCRYPT=y" >> $config_host_mak
  5083. if test "$gcrypt_hmac" = "yes" ; then
  5084. echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak
  5085. fi
  5086. if test "$gcrypt_kdf" = "yes" ; then
  5087. echo "CONFIG_GCRYPT_KDF=y" >> $config_host_mak
  5088. fi
  5089. fi
  5090. if test "$nettle" = "yes" ; then
  5091. echo "CONFIG_NETTLE=y" >> $config_host_mak
  5092. echo "CONFIG_NETTLE_VERSION_MAJOR=${nettle_version%%.*}" >> $config_host_mak
  5093. if test "$nettle_kdf" = "yes" ; then
  5094. echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak
  5095. fi
  5096. fi
  5097. if test "$tasn1" = "yes" ; then
  5098. echo "CONFIG_TASN1=y" >> $config_host_mak
  5099. fi
  5100. if test "$have_ifaddrs_h" = "yes" ; then
  5101. echo "HAVE_IFADDRS_H=y" >> $config_host_mak
  5102. fi
  5103. if test "$have_broken_size_max" = "yes" ; then
  5104. echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
  5105. fi
  5106. # Work around a system header bug with some kernel/XFS header
  5107. # versions where they both try to define 'struct fsxattr':
  5108. # xfs headers will not try to redefine structs from linux headers
  5109. # if this macro is set.
  5110. if test "$have_fsxattr" = "yes" ; then
  5111. echo "HAVE_FSXATTR=y" >> $config_host_mak
  5112. fi
  5113. if test "$vte" = "yes" ; then
  5114. echo "CONFIG_VTE=y" >> $config_host_mak
  5115. echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
  5116. fi
  5117. if test "$virglrenderer" = "yes" ; then
  5118. echo "CONFIG_VIRGL=y" >> $config_host_mak
  5119. echo "VIRGL_CFLAGS=$virgl_cflags" >> $config_host_mak
  5120. echo "VIRGL_LIBS=$virgl_libs" >> $config_host_mak
  5121. fi
  5122. if test "$xen" = "yes" ; then
  5123. echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
  5124. echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
  5125. if test "$xen_pv_domain_build" = "yes" ; then
  5126. echo "CONFIG_XEN_PV_DOMAIN_BUILD=y" >> $config_host_mak
  5127. fi
  5128. fi
  5129. if test "$linux_aio" = "yes" ; then
  5130. echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
  5131. fi
  5132. if test "$attr" = "yes" ; then
  5133. echo "CONFIG_ATTR=y" >> $config_host_mak
  5134. fi
  5135. if test "$libattr" = "yes" ; then
  5136. echo "CONFIG_LIBATTR=y" >> $config_host_mak
  5137. fi
  5138. if test "$virtfs" = "yes" ; then
  5139. echo "CONFIG_VIRTFS=y" >> $config_host_mak
  5140. fi
  5141. if test "$vhost_scsi" = "yes" ; then
  5142. echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
  5143. fi
  5144. if test "$vhost_net" = "yes" ; then
  5145. echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
  5146. fi
  5147. if test "$vhost_vsock" = "yes" ; then
  5148. echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
  5149. fi
  5150. if test "$blobs" = "yes" ; then
  5151. echo "INSTALL_BLOBS=yes" >> $config_host_mak
  5152. fi
  5153. if test "$iovec" = "yes" ; then
  5154. echo "CONFIG_IOVEC=y" >> $config_host_mak
  5155. fi
  5156. if test "$preadv" = "yes" ; then
  5157. echo "CONFIG_PREADV=y" >> $config_host_mak
  5158. fi
  5159. if test "$fdt" = "yes" ; then
  5160. echo "CONFIG_FDT=y" >> $config_host_mak
  5161. fi
  5162. if test "$signalfd" = "yes" ; then
  5163. echo "CONFIG_SIGNALFD=y" >> $config_host_mak
  5164. fi
  5165. if test "$tcg_interpreter" = "yes" ; then
  5166. echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
  5167. fi
  5168. if test "$fdatasync" = "yes" ; then
  5169. echo "CONFIG_FDATASYNC=y" >> $config_host_mak
  5170. fi
  5171. if test "$madvise" = "yes" ; then
  5172. echo "CONFIG_MADVISE=y" >> $config_host_mak
  5173. fi
  5174. if test "$posix_madvise" = "yes" ; then
  5175. echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
  5176. fi
  5177. if test "$spice" = "yes" ; then
  5178. echo "CONFIG_SPICE=y" >> $config_host_mak
  5179. fi
  5180. if test "$smartcard" = "yes" ; then
  5181. echo "CONFIG_SMARTCARD=y" >> $config_host_mak
  5182. fi
  5183. if test "$libusb" = "yes" ; then
  5184. echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
  5185. fi
  5186. if test "$usb_redir" = "yes" ; then
  5187. echo "CONFIG_USB_REDIR=y" >> $config_host_mak
  5188. fi
  5189. if test "$opengl" = "yes" ; then
  5190. echo "CONFIG_OPENGL=y" >> $config_host_mak
  5191. echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
  5192. if test "$opengl_dmabuf" = "yes" ; then
  5193. echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
  5194. fi
  5195. fi
  5196. if test "$avx2_opt" = "yes" ; then
  5197. echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
  5198. fi
  5199. if test "$lzo" = "yes" ; then
  5200. echo "CONFIG_LZO=y" >> $config_host_mak
  5201. fi
  5202. if test "$snappy" = "yes" ; then
  5203. echo "CONFIG_SNAPPY=y" >> $config_host_mak
  5204. fi
  5205. if test "$bzip2" = "yes" ; then
  5206. echo "CONFIG_BZIP2=y" >> $config_host_mak
  5207. echo "BZIP2_LIBS=-lbz2" >> $config_host_mak
  5208. fi
  5209. if test "$libiscsi" = "yes" ; then
  5210. echo "CONFIG_LIBISCSI=m" >> $config_host_mak
  5211. echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
  5212. echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
  5213. fi
  5214. if test "$libnfs" = "yes" ; then
  5215. echo "CONFIG_LIBNFS=m" >> $config_host_mak
  5216. echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
  5217. fi
  5218. if test "$seccomp" = "yes"; then
  5219. echo "CONFIG_SECCOMP=y" >> $config_host_mak
  5220. fi
  5221. # XXX: suppress that
  5222. if [ "$bsd" = "yes" ] ; then
  5223. echo "CONFIG_BSD=y" >> $config_host_mak
  5224. fi
  5225. if test "$localtime_r" = "yes" ; then
  5226. echo "CONFIG_LOCALTIME_R=y" >> $config_host_mak
  5227. fi
  5228. if test "$qom_cast_debug" = "yes" ; then
  5229. echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
  5230. fi
  5231. if test "$rbd" = "yes" ; then
  5232. echo "CONFIG_RBD=m" >> $config_host_mak
  5233. echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
  5234. echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
  5235. fi
  5236. echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
  5237. if test "$coroutine_pool" = "yes" ; then
  5238. echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
  5239. else
  5240. echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
  5241. fi
  5242. if test "$debug_stack_usage" = "yes" ; then
  5243. echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak
  5244. fi
  5245. if test "$open_by_handle_at" = "yes" ; then
  5246. echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
  5247. fi
  5248. if test "$linux_magic_h" = "yes" ; then
  5249. echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
  5250. fi
  5251. if test "$pragma_diagnostic_available" = "yes" ; then
  5252. echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
  5253. fi
  5254. if test "$valgrind_h" = "yes" ; then
  5255. echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
  5256. fi
  5257. if test "$has_environ" = "yes" ; then
  5258. echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
  5259. fi
  5260. if test "$cpuid_h" = "yes" ; then
  5261. echo "CONFIG_CPUID_H=y" >> $config_host_mak
  5262. fi
  5263. if test "$int128" = "yes" ; then
  5264. echo "CONFIG_INT128=y" >> $config_host_mak
  5265. fi
  5266. if test "$atomic128" = "yes" ; then
  5267. echo "CONFIG_ATOMIC128=y" >> $config_host_mak
  5268. fi
  5269. if test "$atomic64" = "yes" ; then
  5270. echo "CONFIG_ATOMIC64=y" >> $config_host_mak
  5271. fi
  5272. if test "$getauxval" = "yes" ; then
  5273. echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
  5274. fi
  5275. if test "$glusterfs" = "yes" ; then
  5276. echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
  5277. echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
  5278. echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
  5279. fi
  5280. if test "$glusterfs_xlator_opt" = "yes" ; then
  5281. echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak
  5282. fi
  5283. if test "$glusterfs_discard" = "yes" ; then
  5284. echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
  5285. fi
  5286. if test "$glusterfs_fallocate" = "yes" ; then
  5287. echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak
  5288. fi
  5289. if test "$glusterfs_zerofill" = "yes" ; then
  5290. echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
  5291. fi
  5292. if test "$libssh2" = "yes" ; then
  5293. echo "CONFIG_LIBSSH2=m" >> $config_host_mak
  5294. echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
  5295. echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
  5296. fi
  5297. if test "$live_block_migration" = "yes" ; then
  5298. echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
  5299. fi
  5300. # USB host support
  5301. if test "$libusb" = "yes"; then
  5302. echo "HOST_USB=libusb legacy" >> $config_host_mak
  5303. else
  5304. echo "HOST_USB=stub" >> $config_host_mak
  5305. fi
  5306. # TPM passthrough support?
  5307. if test "$tpm" = "yes"; then
  5308. echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
  5309. if test "$tpm_passthrough" = "yes"; then
  5310. echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
  5311. fi
  5312. fi
  5313. echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
  5314. if have_backend "nop"; then
  5315. echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
  5316. fi
  5317. if have_backend "simple"; then
  5318. echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
  5319. # Set the appropriate trace file.
  5320. trace_file="\"$trace_file-\" FMT_pid"
  5321. fi
  5322. if have_backend "log"; then
  5323. echo "CONFIG_TRACE_LOG=y" >> $config_host_mak
  5324. fi
  5325. if have_backend "ust"; then
  5326. echo "CONFIG_TRACE_UST=y" >> $config_host_mak
  5327. fi
  5328. if have_backend "dtrace"; then
  5329. echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
  5330. if test "$trace_backend_stap" = "yes" ; then
  5331. echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
  5332. fi
  5333. fi
  5334. if have_backend "ftrace"; then
  5335. if test "$linux" = "yes" ; then
  5336. echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
  5337. else
  5338. feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
  5339. fi
  5340. fi
  5341. if have_backend "syslog"; then
  5342. if test "$posix_syslog" = "yes" ; then
  5343. echo "CONFIG_TRACE_SYSLOG=y" >> $config_host_mak
  5344. else
  5345. feature_not_found "syslog(trace backend)" "syslog not available"
  5346. fi
  5347. fi
  5348. echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
  5349. if test "$rdma" = "yes" ; then
  5350. echo "CONFIG_RDMA=y" >> $config_host_mak
  5351. fi
  5352. if test "$have_rtnetlink" = "yes" ; then
  5353. echo "CONFIG_RTNETLINK=y" >> $config_host_mak
  5354. fi
  5355. if test "$replication" = "yes" ; then
  5356. echo "CONFIG_REPLICATION=y" >> $config_host_mak
  5357. fi
  5358. if test "$have_af_vsock" = "yes" ; then
  5359. echo "CONFIG_AF_VSOCK=y" >> $config_host_mak
  5360. fi
  5361. if test "$have_sysmacros" = "yes" ; then
  5362. echo "CONFIG_SYSMACROS=y" >> $config_host_mak
  5363. fi
  5364. if test "$have_static_assert" = "yes" ; then
  5365. echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak
  5366. fi
  5367. # Hold two types of flag:
  5368. # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
  5369. # a thread we have a handle to
  5370. # CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
  5371. # platform
  5372. if test "$pthread_setname_np" = "yes" ; then
  5373. echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
  5374. echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
  5375. fi
  5376. if test "$vxhs" = "yes" ; then
  5377. echo "CONFIG_VXHS=y" >> $config_host_mak
  5378. echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
  5379. fi
  5380. if test "$tcg_interpreter" = "yes"; then
  5381. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
  5382. elif test "$ARCH" = "sparc64" ; then
  5383. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
  5384. elif test "$ARCH" = "s390x" ; then
  5385. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
  5386. elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
  5387. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
  5388. elif test "$ARCH" = "ppc64" ; then
  5389. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
  5390. else
  5391. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
  5392. fi
  5393. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
  5394. echo "TOOLS=$tools" >> $config_host_mak
  5395. echo "ROMS=$roms" >> $config_host_mak
  5396. echo "MAKE=$make" >> $config_host_mak
  5397. echo "INSTALL=$install" >> $config_host_mak
  5398. echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
  5399. echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
  5400. echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
  5401. echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
  5402. echo "PYTHON=$python" >> $config_host_mak
  5403. echo "CC=$cc" >> $config_host_mak
  5404. if $iasl -h > /dev/null 2>&1; then
  5405. echo "IASL=$iasl" >> $config_host_mak
  5406. fi
  5407. echo "CC_I386=$cc_i386" >> $config_host_mak
  5408. echo "HOST_CC=$host_cc" >> $config_host_mak
  5409. echo "CXX=$cxx" >> $config_host_mak
  5410. echo "OBJCC=$objcc" >> $config_host_mak
  5411. echo "AR=$ar" >> $config_host_mak
  5412. echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
  5413. echo "AS=$as" >> $config_host_mak
  5414. echo "CCAS=$ccas" >> $config_host_mak
  5415. echo "CPP=$cpp" >> $config_host_mak
  5416. echo "OBJCOPY=$objcopy" >> $config_host_mak
  5417. echo "LD=$ld" >> $config_host_mak
  5418. echo "NM=$nm" >> $config_host_mak
  5419. echo "WINDRES=$windres" >> $config_host_mak
  5420. echo "CFLAGS=$CFLAGS" >> $config_host_mak
  5421. echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
  5422. echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
  5423. echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
  5424. if test "$sparse" = "yes" ; then
  5425. echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
  5426. echo "CPP := REAL_CC=\"\$(CPP)\" cgcc" >> $config_host_mak
  5427. echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
  5428. echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
  5429. echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
  5430. fi
  5431. if test "$cross_prefix" != ""; then
  5432. echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
  5433. else
  5434. echo "AUTOCONF_HOST := " >> $config_host_mak
  5435. fi
  5436. echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
  5437. echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
  5438. echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
  5439. echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
  5440. echo "LIBS+=$LIBS" >> $config_host_mak
  5441. echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
  5442. echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak
  5443. echo "EXESUF=$EXESUF" >> $config_host_mak
  5444. echo "DSOSUF=$DSOSUF" >> $config_host_mak
  5445. echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
  5446. echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
  5447. echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak
  5448. echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
  5449. echo "POD2MAN=$POD2MAN" >> $config_host_mak
  5450. echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
  5451. if test "$gcov" = "yes" ; then
  5452. echo "CONFIG_GCOV=y" >> $config_host_mak
  5453. echo "GCOV=$gcov_tool" >> $config_host_mak
  5454. fi
  5455. # use included Linux headers
  5456. if test "$linux" = "yes" ; then
  5457. mkdir -p linux-headers
  5458. case "$cpu" in
  5459. i386|x86_64|x32)
  5460. linux_arch=x86
  5461. ;;
  5462. ppcemb|ppc|ppc64)
  5463. linux_arch=powerpc
  5464. ;;
  5465. s390x)
  5466. linux_arch=s390
  5467. ;;
  5468. aarch64)
  5469. linux_arch=arm64
  5470. ;;
  5471. mips64)
  5472. linux_arch=mips
  5473. ;;
  5474. *)
  5475. # For most CPUs the kernel architecture name and QEMU CPU name match.
  5476. linux_arch="$cpu"
  5477. ;;
  5478. esac
  5479. # For non-KVM architectures we will not have asm headers
  5480. if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
  5481. symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
  5482. fi
  5483. fi
  5484. for target in $target_list; do
  5485. target_dir="$target"
  5486. config_target_mak=$target_dir/config-target.mak
  5487. target_name=$(echo $target | cut -d '-' -f 1)
  5488. target_bigendian="no"
  5489. case "$target_name" in
  5490. armeb|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
  5491. target_bigendian=yes
  5492. ;;
  5493. esac
  5494. target_softmmu="no"
  5495. target_user_only="no"
  5496. target_linux_user="no"
  5497. target_bsd_user="no"
  5498. case "$target" in
  5499. ${target_name}-softmmu)
  5500. target_softmmu="yes"
  5501. ;;
  5502. ${target_name}-linux-user)
  5503. if test "$linux" != "yes" ; then
  5504. error_exit "Target '$target' is only available on a Linux host"
  5505. fi
  5506. target_user_only="yes"
  5507. target_linux_user="yes"
  5508. ;;
  5509. ${target_name}-bsd-user)
  5510. if test "$bsd" != "yes" ; then
  5511. error_exit "Target '$target' is only available on a BSD host"
  5512. fi
  5513. target_user_only="yes"
  5514. target_bsd_user="yes"
  5515. ;;
  5516. *)
  5517. error_exit "Target '$target' not recognised"
  5518. exit 1
  5519. ;;
  5520. esac
  5521. mkdir -p $target_dir
  5522. echo "# Automatically generated by configure - do not modify" > $config_target_mak
  5523. bflt="no"
  5524. mttcg="no"
  5525. interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g")
  5526. gdb_xml_files=""
  5527. TARGET_ARCH="$target_name"
  5528. TARGET_BASE_ARCH=""
  5529. TARGET_ABI_DIR=""
  5530. case "$target_name" in
  5531. i386)
  5532. gdb_xml_files="i386-32bit-core.xml"
  5533. ;;
  5534. x86_64)
  5535. TARGET_BASE_ARCH=i386
  5536. gdb_xml_files="i386-64bit-core.xml"
  5537. ;;
  5538. alpha)
  5539. mttcg="yes"
  5540. ;;
  5541. arm|armeb)
  5542. TARGET_ARCH=arm
  5543. bflt="yes"
  5544. mttcg="yes"
  5545. gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
  5546. ;;
  5547. aarch64)
  5548. TARGET_BASE_ARCH=arm
  5549. bflt="yes"
  5550. mttcg="yes"
  5551. gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
  5552. ;;
  5553. cris)
  5554. ;;
  5555. hppa)
  5556. ;;
  5557. lm32)
  5558. ;;
  5559. m68k)
  5560. bflt="yes"
  5561. gdb_xml_files="cf-core.xml cf-fp.xml"
  5562. ;;
  5563. microblaze|microblazeel)
  5564. TARGET_ARCH=microblaze
  5565. bflt="yes"
  5566. ;;
  5567. mips|mipsel)
  5568. TARGET_ARCH=mips
  5569. echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
  5570. ;;
  5571. mipsn32|mipsn32el)
  5572. TARGET_ARCH=mips64
  5573. TARGET_BASE_ARCH=mips
  5574. echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
  5575. echo "TARGET_ABI32=y" >> $config_target_mak
  5576. ;;
  5577. mips64|mips64el)
  5578. TARGET_ARCH=mips64
  5579. TARGET_BASE_ARCH=mips
  5580. echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
  5581. ;;
  5582. moxie)
  5583. ;;
  5584. nios2)
  5585. ;;
  5586. or1k)
  5587. TARGET_ARCH=openrisc
  5588. TARGET_BASE_ARCH=openrisc
  5589. ;;
  5590. ppc)
  5591. gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  5592. ;;
  5593. ppcemb)
  5594. TARGET_BASE_ARCH=ppc
  5595. TARGET_ABI_DIR=ppc
  5596. gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  5597. ;;
  5598. ppc64)
  5599. TARGET_BASE_ARCH=ppc
  5600. TARGET_ABI_DIR=ppc
  5601. mttcg=yes
  5602. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
  5603. ;;
  5604. ppc64le)
  5605. TARGET_ARCH=ppc64
  5606. TARGET_BASE_ARCH=ppc
  5607. TARGET_ABI_DIR=ppc
  5608. mttcg=yes
  5609. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
  5610. ;;
  5611. ppc64abi32)
  5612. TARGET_ARCH=ppc64
  5613. TARGET_BASE_ARCH=ppc
  5614. TARGET_ABI_DIR=ppc
  5615. echo "TARGET_ABI32=y" >> $config_target_mak
  5616. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
  5617. ;;
  5618. sh4|sh4eb)
  5619. TARGET_ARCH=sh4
  5620. bflt="yes"
  5621. ;;
  5622. sparc)
  5623. ;;
  5624. sparc64)
  5625. TARGET_BASE_ARCH=sparc
  5626. ;;
  5627. sparc32plus)
  5628. TARGET_ARCH=sparc64
  5629. TARGET_BASE_ARCH=sparc
  5630. TARGET_ABI_DIR=sparc
  5631. echo "TARGET_ABI32=y" >> $config_target_mak
  5632. ;;
  5633. s390x)
  5634. gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml"
  5635. ;;
  5636. tilegx)
  5637. ;;
  5638. tricore)
  5639. ;;
  5640. unicore32)
  5641. ;;
  5642. xtensa|xtensaeb)
  5643. TARGET_ARCH=xtensa
  5644. ;;
  5645. *)
  5646. error_exit "Unsupported target CPU"
  5647. ;;
  5648. esac
  5649. # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
  5650. if [ "$TARGET_BASE_ARCH" = "" ]; then
  5651. TARGET_BASE_ARCH=$TARGET_ARCH
  5652. fi
  5653. symlink "$source_path/Makefile.target" "$target_dir/Makefile"
  5654. upper() {
  5655. echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
  5656. }
  5657. target_arch_name="$(upper $TARGET_ARCH)"
  5658. echo "TARGET_$target_arch_name=y" >> $config_target_mak
  5659. echo "TARGET_NAME=$target_name" >> $config_target_mak
  5660. echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
  5661. if [ "$TARGET_ABI_DIR" = "" ]; then
  5662. TARGET_ABI_DIR=$TARGET_ARCH
  5663. fi
  5664. echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
  5665. if [ "$HOST_VARIANT_DIR" != "" ]; then
  5666. echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
  5667. fi
  5668. case "$target_name" in
  5669. i386|x86_64)
  5670. if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
  5671. echo "CONFIG_XEN=y" >> $config_target_mak
  5672. if test "$xen_pci_passthrough" = yes; then
  5673. echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
  5674. fi
  5675. fi
  5676. ;;
  5677. *)
  5678. esac
  5679. case "$target_name" in
  5680. aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x|mipsel|mips)
  5681. # Make sure the target and host cpus are compatible
  5682. if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
  5683. \( "$target_name" = "$cpu" -o \
  5684. \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
  5685. \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \
  5686. \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \
  5687. \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
  5688. \( "$target_name" = "mipsel" -a "$cpu" = "mips" \) -o \
  5689. \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \
  5690. \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) -o \
  5691. \( "$target_name" = "x86_64" -a "$cpu" = "x32" \) -o \
  5692. \( "$target_name" = "i386" -a "$cpu" = "x32" \) \) ; then
  5693. echo "CONFIG_KVM=y" >> $config_target_mak
  5694. if test "$vhost_net" = "yes" ; then
  5695. echo "CONFIG_VHOST_NET=y" >> $config_target_mak
  5696. echo "CONFIG_VHOST_NET_TEST_$target_name=y" >> $config_host_mak
  5697. fi
  5698. fi
  5699. esac
  5700. if test "$hax" = "yes" ; then
  5701. if test "$target_softmmu" = "yes" ; then
  5702. case "$target_name" in
  5703. i386|x86_64)
  5704. echo "CONFIG_HAX=y" >> $config_target_mak
  5705. ;;
  5706. esac
  5707. fi
  5708. fi
  5709. if test "$target_bigendian" = "yes" ; then
  5710. echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
  5711. fi
  5712. if test "$target_softmmu" = "yes" ; then
  5713. echo "CONFIG_SOFTMMU=y" >> $config_target_mak
  5714. if test "$mttcg" = "yes" ; then
  5715. echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak
  5716. fi
  5717. fi
  5718. if test "$target_user_only" = "yes" ; then
  5719. echo "CONFIG_USER_ONLY=y" >> $config_target_mak
  5720. echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
  5721. fi
  5722. if test "$target_linux_user" = "yes" ; then
  5723. echo "CONFIG_LINUX_USER=y" >> $config_target_mak
  5724. fi
  5725. list=""
  5726. if test ! -z "$gdb_xml_files" ; then
  5727. for x in $gdb_xml_files; do
  5728. list="$list $source_path/gdb-xml/$x"
  5729. done
  5730. echo "TARGET_XML_FILES=$list" >> $config_target_mak
  5731. fi
  5732. if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
  5733. echo "TARGET_HAS_BFLT=y" >> $config_target_mak
  5734. fi
  5735. if test "$target_bsd_user" = "yes" ; then
  5736. echo "CONFIG_BSD_USER=y" >> $config_target_mak
  5737. fi
  5738. # generate QEMU_CFLAGS/LDFLAGS for targets
  5739. cflags=""
  5740. ldflags=""
  5741. disas_config() {
  5742. echo "CONFIG_${1}_DIS=y" >> $config_target_mak
  5743. echo "CONFIG_${1}_DIS=y" >> config-all-disas.mak
  5744. }
  5745. for i in $ARCH $TARGET_BASE_ARCH ; do
  5746. case "$i" in
  5747. alpha)
  5748. disas_config "ALPHA"
  5749. ;;
  5750. aarch64)
  5751. if test -n "${cxx}"; then
  5752. disas_config "ARM_A64"
  5753. fi
  5754. ;;
  5755. arm)
  5756. disas_config "ARM"
  5757. if test -n "${cxx}"; then
  5758. disas_config "ARM_A64"
  5759. fi
  5760. ;;
  5761. cris)
  5762. disas_config "CRIS"
  5763. ;;
  5764. hppa)
  5765. disas_config "HPPA"
  5766. ;;
  5767. i386|x86_64|x32)
  5768. disas_config "I386"
  5769. ;;
  5770. ia64*)
  5771. disas_config "IA64"
  5772. ;;
  5773. lm32)
  5774. disas_config "LM32"
  5775. ;;
  5776. m68k)
  5777. disas_config "M68K"
  5778. ;;
  5779. microblaze*)
  5780. disas_config "MICROBLAZE"
  5781. ;;
  5782. mips*)
  5783. disas_config "MIPS"
  5784. ;;
  5785. moxie*)
  5786. disas_config "MOXIE"
  5787. ;;
  5788. nios2)
  5789. disas_config "NIOS2"
  5790. ;;
  5791. or1k)
  5792. disas_config "OPENRISC"
  5793. ;;
  5794. ppc*)
  5795. disas_config "PPC"
  5796. ;;
  5797. s390*)
  5798. disas_config "S390"
  5799. ;;
  5800. sh4)
  5801. disas_config "SH4"
  5802. ;;
  5803. sparc*)
  5804. disas_config "SPARC"
  5805. ;;
  5806. xtensa*)
  5807. disas_config "XTENSA"
  5808. ;;
  5809. esac
  5810. done
  5811. if test "$tcg_interpreter" = "yes" ; then
  5812. disas_config "TCI"
  5813. fi
  5814. case "$ARCH" in
  5815. alpha)
  5816. # Ensure there's only a single GP
  5817. cflags="-msmall-data $cflags"
  5818. ;;
  5819. esac
  5820. if test "$gprof" = "yes" ; then
  5821. echo "TARGET_GPROF=yes" >> $config_target_mak
  5822. if test "$target_linux_user" = "yes" ; then
  5823. cflags="-p $cflags"
  5824. ldflags="-p $ldflags"
  5825. fi
  5826. if test "$target_softmmu" = "yes" ; then
  5827. ldflags="-p $ldflags"
  5828. echo "GPROF_CFLAGS=-p" >> $config_target_mak
  5829. fi
  5830. fi
  5831. if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
  5832. ldflags="$ldflags $textseg_ldflags"
  5833. fi
  5834. echo "LDFLAGS+=$ldflags" >> $config_target_mak
  5835. echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
  5836. done # for target in $targets
  5837. if [ "$pixman" = "internal" ]; then
  5838. echo "config-host.h: subdir-pixman" >> $config_host_mak
  5839. fi
  5840. if [ "$dtc_internal" = "yes" ]; then
  5841. echo "config-host.h: subdir-dtc" >> $config_host_mak
  5842. fi
  5843. if test "$numa" = "yes"; then
  5844. echo "CONFIG_NUMA=y" >> $config_host_mak
  5845. fi
  5846. if test "$ccache_cpp2" = "yes"; then
  5847. echo "export CCACHE_CPP2=y" >> $config_host_mak
  5848. fi
  5849. # build tree in object directory in case the source is not in the current directory
  5850. DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
  5851. DIRS="$DIRS docs fsdev"
  5852. DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
  5853. DIRS="$DIRS roms/seabios roms/vgabios"
  5854. DIRS="$DIRS qapi-generated"
  5855. FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
  5856. FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
  5857. FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
  5858. FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
  5859. FILES="$FILES pc-bios/spapr-rtas/Makefile"
  5860. FILES="$FILES pc-bios/s390-ccw/Makefile"
  5861. FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
  5862. FILES="$FILES pc-bios/qemu-icon.bmp"
  5863. FILES="$FILES .gdbinit scripts" # scripts needed by relative path in .gdbinit
  5864. for bios_file in \
  5865. $source_path/pc-bios/*.bin \
  5866. $source_path/pc-bios/*.lid \
  5867. $source_path/pc-bios/*.aml \
  5868. $source_path/pc-bios/*.rom \
  5869. $source_path/pc-bios/*.dtb \
  5870. $source_path/pc-bios/*.img \
  5871. $source_path/pc-bios/openbios-* \
  5872. $source_path/pc-bios/u-boot.* \
  5873. $source_path/pc-bios/palcode-*
  5874. do
  5875. FILES="$FILES pc-bios/$(basename $bios_file)"
  5876. done
  5877. for test_file in $(find $source_path/tests/acpi-test-data -type f)
  5878. do
  5879. FILES="$FILES tests/acpi-test-data$(echo $test_file | sed -e 's/.*acpi-test-data//')"
  5880. done
  5881. mkdir -p $DIRS
  5882. for f in $FILES ; do
  5883. if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
  5884. symlink "$source_path/$f" "$f"
  5885. fi
  5886. done
  5887. # temporary config to build submodules
  5888. for rom in seabios vgabios ; do
  5889. config_mak=roms/$rom/config.mak
  5890. echo "# Automatically generated by configure - do not modify" > $config_mak
  5891. echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
  5892. echo "AS=$as" >> $config_mak
  5893. echo "CCAS=$ccas" >> $config_mak
  5894. echo "CC=$cc" >> $config_mak
  5895. echo "BCC=bcc" >> $config_mak
  5896. echo "CPP=$cpp" >> $config_mak
  5897. echo "OBJCOPY=objcopy" >> $config_mak
  5898. echo "IASL=$iasl" >> $config_mak
  5899. echo "LD=$ld" >> $config_mak
  5900. done
  5901. # set up tests data directory
  5902. if [ ! -e tests/data ]; then
  5903. symlink "$source_path/tests/data" tests/data
  5904. fi
  5905. # set up qemu-iotests in this build directory
  5906. iotests_common_env="tests/qemu-iotests/common.env"
  5907. iotests_check="tests/qemu-iotests/check"
  5908. echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
  5909. echo >> "$iotests_common_env"
  5910. echo "export PYTHON='$python'" >> "$iotests_common_env"
  5911. if [ ! -e "$iotests_check" ]; then
  5912. symlink "$source_path/$iotests_check" "$iotests_check"
  5913. fi
  5914. # Save the configure command line for later reuse.
  5915. cat <<EOD >config.status
  5916. #!/bin/sh
  5917. # Generated by configure.
  5918. # Run this file to recreate the current configuration.
  5919. # Compiler output produced by configure, useful for debugging
  5920. # configure, is in config.log if it exists.
  5921. EOD
  5922. printf "exec" >>config.status
  5923. printf " '%s'" "$0" "$@" >>config.status
  5924. echo ' "$@"' >>config.status
  5925. chmod +x config.status
  5926. rm -r "$TMPDIR1"