You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure 208KB

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