configure 186 KB

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