2
0

configure 175 KB

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