configure 224 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943
  1. #!/bin/sh
  2. #
  3. # FFmpeg configure script
  4. #
  5. # Copyright (c) 2000-2002 Fabrice Bellard
  6. # Copyright (c) 2005-2008 Diego Biurrun
  7. # Copyright (c) 2005-2008 Mans Rullgard
  8. #
  9. # Prevent locale nonsense from breaking basic text processing.
  10. LC_ALL=C
  11. export LC_ALL
  12. # make sure we are running under a compatible shell
  13. # try to make this part work with most shells
  14. try_exec(){
  15. echo "Trying shell $1"
  16. type "$1" > /dev/null 2>&1 && exec "$@"
  17. }
  18. unset foo
  19. (: ${foo%%bar}) 2> /dev/null
  20. E1="$?"
  21. (: ${foo?}) 2> /dev/null
  22. E2="$?"
  23. if test "$E1" != 0 || test "$E2" = 0; then
  24. echo "Broken shell detected. Trying alternatives."
  25. export FF_CONF_EXEC
  26. if test "0$FF_CONF_EXEC" -lt 1; then
  27. FF_CONF_EXEC=1
  28. try_exec bash "$0" "$@"
  29. fi
  30. if test "0$FF_CONF_EXEC" -lt 2; then
  31. FF_CONF_EXEC=2
  32. try_exec ksh "$0" "$@"
  33. fi
  34. if test "0$FF_CONF_EXEC" -lt 3; then
  35. FF_CONF_EXEC=3
  36. try_exec /usr/xpg4/bin/sh "$0" "$@"
  37. fi
  38. echo "No compatible shell script interpreter found."
  39. echo "This configure script requires a POSIX-compatible shell"
  40. echo "such as bash or ksh."
  41. echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
  42. echo "Instead, install a working POSIX-compatible shell."
  43. echo "Disabling this configure test will create a broken FFmpeg."
  44. if test "$BASH_VERSION" = '2.04.0(1)-release'; then
  45. echo "This bash version ($BASH_VERSION) is broken on your platform."
  46. echo "Upgrade to a later version if available."
  47. fi
  48. exit 1
  49. fi
  50. test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
  51. show_help(){
  52. cat <<EOF
  53. Usage: configure [options]
  54. Options: [defaults in brackets after descriptions]
  55. Help options:
  56. --help print this message
  57. --quiet Suppress showing informative output
  58. --list-decoders show all available decoders
  59. --list-encoders show all available encoders
  60. --list-hwaccels show all available hardware accelerators
  61. --list-demuxers show all available demuxers
  62. --list-muxers show all available muxers
  63. --list-parsers show all available parsers
  64. --list-protocols show all available protocols
  65. --list-bsfs show all available bitstream filters
  66. --list-indevs show all available input devices
  67. --list-outdevs show all available output devices
  68. --list-filters show all available filters
  69. Standard options:
  70. --logfile=FILE log tests and output to FILE [config.log]
  71. --disable-logging do not log configure debug information
  72. --fatal-warnings fail if any configure warning is generated
  73. --prefix=PREFIX install in PREFIX [$prefix_default]
  74. --bindir=DIR install binaries in DIR [PREFIX/bin]
  75. --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]
  76. --docdir=DIR install documentation in DIR [PREFIX/share/doc/ffmpeg]
  77. --libdir=DIR install libs in DIR [PREFIX/lib]
  78. --shlibdir=DIR install shared libs in DIR [LIBDIR]
  79. --incdir=DIR install includes in DIR [PREFIX/include]
  80. --mandir=DIR install man page in DIR [PREFIX/share/man]
  81. --pkgconfigdir=DIR install pkg-config files in DIR [LIBDIR/pkgconfig]
  82. --enable-rpath use rpath to allow installing libraries in paths
  83. not part of the dynamic linker search path
  84. use rpath when linking programs (USE WITH CARE)
  85. --install-name-dir=DIR Darwin directory name for installed targets
  86. Licensing options:
  87. --enable-gpl allow use of GPL code, the resulting libs
  88. and binaries will be under GPL [no]
  89. --enable-version3 upgrade (L)GPL to version 3 [no]
  90. --enable-nonfree allow use of nonfree code, the resulting libs
  91. and binaries will be unredistributable [no]
  92. Configuration options:
  93. --disable-static do not build static libraries [no]
  94. --enable-shared build shared libraries [no]
  95. --enable-small optimize for size instead of speed
  96. --disable-runtime-cpudetect disable detecting CPU capabilities at runtime (smaller binary)
  97. --enable-gray enable full grayscale support (slower color)
  98. --disable-swscale-alpha disable alpha channel support in swscale
  99. --disable-all disable building components, libraries and programs
  100. --enable-raise-major increase major version numbers in sonames [no]
  101. Program options:
  102. --disable-programs do not build command line programs
  103. --disable-ffmpeg disable ffmpeg build
  104. --disable-ffplay disable ffplay build
  105. --disable-ffprobe disable ffprobe build
  106. --disable-ffserver disable ffserver build
  107. Documentation options:
  108. --disable-doc do not build documentation
  109. --disable-htmlpages do not build HTML documentation pages
  110. --disable-manpages do not build man documentation pages
  111. --disable-podpages do not build POD documentation pages
  112. --disable-txtpages do not build text documentation pages
  113. Component options:
  114. --disable-avdevice disable libavdevice build
  115. --disable-avcodec disable libavcodec build
  116. --disable-avformat disable libavformat build
  117. --disable-swresample disable libswresample build
  118. --disable-swscale disable libswscale build
  119. --disable-postproc disable libpostproc build
  120. --disable-avfilter disable libavfilter build
  121. --enable-avresample enable libavresample build [no]
  122. --disable-pthreads disable pthreads [autodetect]
  123. --disable-w32threads disable Win32 threads [autodetect]
  124. --disable-os2threads disable OS/2 threads [autodetect]
  125. --disable-network disable network support [no]
  126. --disable-dct disable DCT code
  127. --disable-dwt disable DWT code
  128. --disable-error-resilience disable error resilience code
  129. --disable-lsp disable LSP code
  130. --disable-lzo disable LZO decoder code
  131. --disable-mdct disable MDCT code
  132. --disable-rdft disable RDFT code
  133. --disable-fft disable FFT code
  134. --disable-faan disable floating point AAN (I)DCT code
  135. --disable-pixelutils disable pixel utils in libavutil
  136. Individual component options:
  137. --disable-everything disable all components listed below
  138. --disable-encoder=NAME disable encoder NAME
  139. --enable-encoder=NAME enable encoder NAME
  140. --disable-encoders disable all encoders
  141. --disable-decoder=NAME disable decoder NAME
  142. --enable-decoder=NAME enable decoder NAME
  143. --disable-decoders disable all decoders
  144. --disable-hwaccel=NAME disable hwaccel NAME
  145. --enable-hwaccel=NAME enable hwaccel NAME
  146. --disable-hwaccels disable all hwaccels
  147. --disable-muxer=NAME disable muxer NAME
  148. --enable-muxer=NAME enable muxer NAME
  149. --disable-muxers disable all muxers
  150. --disable-demuxer=NAME disable demuxer NAME
  151. --enable-demuxer=NAME enable demuxer NAME
  152. --disable-demuxers disable all demuxers
  153. --enable-parser=NAME enable parser NAME
  154. --disable-parser=NAME disable parser NAME
  155. --disable-parsers disable all parsers
  156. --enable-bsf=NAME enable bitstream filter NAME
  157. --disable-bsf=NAME disable bitstream filter NAME
  158. --disable-bsfs disable all bitstream filters
  159. --enable-protocol=NAME enable protocol NAME
  160. --disable-protocol=NAME disable protocol NAME
  161. --disable-protocols disable all protocols
  162. --enable-indev=NAME enable input device NAME
  163. --disable-indev=NAME disable input device NAME
  164. --disable-indevs disable input devices
  165. --enable-outdev=NAME enable output device NAME
  166. --disable-outdev=NAME disable output device NAME
  167. --disable-outdevs disable output devices
  168. --disable-devices disable all devices
  169. --enable-filter=NAME enable filter NAME
  170. --disable-filter=NAME disable filter NAME
  171. --disable-filters disable all filters
  172. External library support:
  173. Using any of the following switches will allow FFmpeg to link to the
  174. corresponding external library. All the components depending on that library
  175. will become enabled, if all their other dependencies are met and they are not
  176. explicitly disabled. E.g. --enable-libwavpack will enable linking to
  177. libwavpack and allow the libwavpack encoder to be built, unless it is
  178. specifically disabled with --disable-encoder=libwavpack.
  179. Note that only the system libraries are auto-detected. All the other external
  180. libraries must be explicitly enabled.
  181. Also note that the following help text describes the purpose of the libraries
  182. themselves, not all their features will necessarily be usable by FFmpeg.
  183. --enable-avisynth enable reading of AviSynth script files [no]
  184. --disable-bzlib disable bzlib [autodetect]
  185. --enable-chromaprint enable audio fingerprinting with chromaprint [no]
  186. --enable-frei0r enable frei0r video filtering [no]
  187. --enable-gcrypt enable gcrypt, needed for rtmp(t)e support
  188. if openssl, librtmp or gmp is not used [no]
  189. --enable-gmp enable gmp, needed for rtmp(t)e support
  190. if openssl or librtmp is not used [no]
  191. --enable-gnutls enable gnutls, needed for https support
  192. if openssl is not used [no]
  193. --disable-iconv disable iconv [autodetect]
  194. --enable-jni enable JNI support [no]
  195. --enable-ladspa enable LADSPA audio filtering [no]
  196. --enable-libass enable libass subtitles rendering,
  197. needed for subtitles and ass filter [no]
  198. --enable-libbluray enable BluRay reading using libbluray [no]
  199. --enable-libbs2b enable bs2b DSP library [no]
  200. --enable-libcaca enable textual display using libcaca [no]
  201. --enable-libcelt enable CELT decoding via libcelt [no]
  202. --enable-libcdio enable audio CD grabbing with libcdio [no]
  203. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  204. and libraw1394 [no]
  205. --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
  206. --enable-libflite enable flite (voice synthesis) support via libflite [no]
  207. --enable-libfontconfig enable libfontconfig, useful for drawtext filter [no]
  208. --enable-libfreetype enable libfreetype, needed for drawtext filter [no]
  209. --enable-libfribidi enable libfribidi, improves drawtext filter [no]
  210. --enable-libgme enable Game Music Emu via libgme [no]
  211. --enable-libgsm enable GSM de/encoding via libgsm [no]
  212. --enable-libiec61883 enable iec61883 via libiec61883 [no]
  213. --enable-libilbc enable iLBC de/encoding via libilbc [no]
  214. --enable-libkvazaar enable HEVC encoding via libkvazaar [no]
  215. --enable-libmodplug enable ModPlug via libmodplug [no]
  216. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  217. --enable-libnut enable NUT (de)muxing via libnut,
  218. native (de)muxer exists [no]
  219. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  220. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  221. --enable-libopencv enable video filtering via libopencv [no]
  222. --enable-libopenh264 enable H.264 encoding via OpenH264 [no]
  223. --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
  224. --enable-libopenmpt enable decoding tracked files via libopenmpt [no]
  225. --enable-libopus enable Opus de/encoding via libopus [no]
  226. --enable-libpulse enable Pulseaudio input via libpulse [no]
  227. --enable-librubberband enable rubberband needed for rubberband filter [no]
  228. --enable-librtmp enable RTMP[E] support via librtmp [no]
  229. --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
  230. --enable-libshine enable fixed-point MP3 encoding via libshine [no]
  231. --enable-libsmbclient enable Samba protocol via libsmbclient [no]
  232. --enable-libsnappy enable Snappy compression, needed for hap encoding [no]
  233. --enable-libsoxr enable Include libsoxr resampling [no]
  234. --enable-libspeex enable Speex de/encoding via libspeex [no]
  235. --enable-libssh enable SFTP protocol via libssh [no]
  236. --enable-libtesseract enable Tesseract, needed for ocr filter [no]
  237. --enable-libtheora enable Theora encoding via libtheora [no]
  238. --enable-libtwolame enable MP2 encoding via libtwolame [no]
  239. --enable-libv4l2 enable libv4l2/v4l-utils [no]
  240. --enable-libvidstab enable video stabilization using vid.stab [no]
  241. --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
  242. --enable-libvorbis enable Vorbis en/decoding via libvorbis,
  243. native implementation exists [no]
  244. --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
  245. --enable-libwavpack enable wavpack encoding via libwavpack [no]
  246. --enable-libwebp enable WebP encoding via libwebp [no]
  247. --enable-libx264 enable H.264 encoding via x264 [no]
  248. --enable-libx265 enable HEVC encoding via x265 [no]
  249. --enable-libxavs enable AVS encoding via xavs [no]
  250. --enable-libxcb enable X11 grabbing using XCB [autodetect]
  251. --enable-libxcb-shm enable X11 grabbing shm communication [autodetect]
  252. --enable-libxcb-xfixes enable X11 grabbing mouse rendering [autodetect]
  253. --enable-libxcb-shape enable X11 grabbing shape rendering [autodetect]
  254. --enable-libxvid enable Xvid encoding via xvidcore,
  255. native MPEG-4/Xvid encoder exists [no]
  256. --enable-libzimg enable z.lib, needed for zscale filter [no]
  257. --enable-libzmq enable message passing via libzmq [no]
  258. --enable-libzvbi enable teletext support via libzvbi [no]
  259. --disable-lzma disable lzma [autodetect]
  260. --enable-decklink enable Blackmagic DeckLink I/O support [no]
  261. --enable-mediacodec enable Android MediaCodec support [no]
  262. --enable-netcdf enable NetCDF, needed for sofalizer filter [no]
  263. --enable-openal enable OpenAL 1.1 capture support [no]
  264. --enable-opencl enable OpenCL code
  265. --enable-opengl enable OpenGL rendering [no]
  266. --enable-openssl enable openssl, needed for https support
  267. if gnutls is not used [no]
  268. --disable-schannel disable SChannel SSP, needed for TLS support on
  269. Windows if openssl and gnutls are not used [autodetect]
  270. --disable-sdl2 disable sdl2 [autodetect]
  271. --disable-securetransport disable Secure Transport, needed for TLS support
  272. on OSX if openssl and gnutls are not used [autodetect]
  273. --disable-xlib disable xlib [autodetect]
  274. --disable-zlib disable zlib [autodetect]
  275. The following libraries provide various hardware acceleration features:
  276. --disable-audiotoolbox disable Apple AudioToolbox code [autodetect]
  277. --disable-cuda disable dynamically linked Nvidia CUDA code [autodetect]
  278. --disable-cuvid disable Nvidia CUVID support [autodetect]
  279. --disable-d3d11va disable Microsoft Direct3D 11 video acceleration code [autodetect]
  280. --disable-dxva2 disable Microsoft DirectX 9 video acceleration code [autodetect]
  281. --enable-libmfx enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]
  282. --enable-libnpp enable Nvidia Performance Primitives-based code [no]
  283. --enable-mmal enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
  284. --disable-nvenc disable Nvidia video encoding code [autodetect]
  285. --enable-omx enable OpenMAX IL code [no]
  286. --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no]
  287. --disable-vaapi disable Video Acceleration API (mainly Unix/Intel) code [autodetect]
  288. --disable-vda disable Apple Video Decode Acceleration code [autodetect]
  289. --disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
  290. --disable-videotoolbox disable VideoToolbox code [autodetect]
  291. Toolchain options:
  292. --arch=ARCH select architecture [$arch]
  293. --cpu=CPU select the minimum required CPU (affects
  294. instruction selection, may crash on older CPUs)
  295. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  296. --progs-suffix=SUFFIX program name suffix []
  297. --enable-cross-compile assume a cross-compiler is used
  298. --sysroot=PATH root of cross-build tree
  299. --sysinclude=PATH location of cross-build system headers
  300. --target-os=OS compiler targets OS [$target_os]
  301. --target-exec=CMD command to run executables on target
  302. --target-path=DIR path to view of build directory on target
  303. --target-samples=DIR path to samples directory on target
  304. --tempprefix=PATH force fixed dir/prefix instead of mktemp for checks
  305. --toolchain=NAME set tool defaults according to NAME
  306. --nm=NM use nm tool NM [$nm_default]
  307. --ar=AR use archive tool AR [$ar_default]
  308. --as=AS use assembler AS [$as_default]
  309. --ln_s=LN_S use symbolic link tool LN_S [$ln_s_default]
  310. --strip=STRIP use strip tool STRIP [$strip_default]
  311. --windres=WINDRES use windows resource compiler WINDRES [$windres_default]
  312. --yasmexe=EXE use yasm-compatible assembler EXE [$yasmexe_default]
  313. --cc=CC use C compiler CC [$cc_default]
  314. --cxx=CXX use C compiler CXX [$cxx_default]
  315. --objcc=OCC use ObjC compiler OCC [$cc_default]
  316. --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
  317. --ld=LD use linker LD [$ld_default]
  318. --pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default]
  319. --pkg-config-flags=FLAGS pass additional flags to pkgconf []
  320. --ranlib=RANLIB use ranlib RANLIB [$ranlib_default]
  321. --doxygen=DOXYGEN use DOXYGEN to generate API doc [$doxygen_default]
  322. --host-cc=HOSTCC use host C compiler HOSTCC
  323. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  324. --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
  325. --host-ld=HOSTLD use host linker HOSTLD
  326. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  327. --host-libs=HLIBS use libs HLIBS when linking for host
  328. --host-os=OS compiler host OS [$target_os]
  329. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  330. --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
  331. --extra-objcflags=FLAGS add FLAGS to OBJCFLAGS [$CFLAGS]
  332. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  333. --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
  334. --extra-ldlibflags=ELDFLAGS add ELDFLAGS to LDLIBFLAGS [$LDLIBFLAGS]
  335. --extra-libs=ELIBS add ELIBS [$ELIBS]
  336. --extra-version=STRING version string suffix []
  337. --optflags=OPTFLAGS override optimization-related compiler flags
  338. --build-suffix=SUFFIX library name suffix []
  339. --enable-pic build position-independent code
  340. --enable-thumb compile for Thumb instruction set
  341. --enable-lto use link-time optimization
  342. --env="ENV=override" override the environment variables
  343. Advanced options (experts only):
  344. --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
  345. --custom-allocator=NAME use a supported custom allocator
  346. --disable-symver disable symbol versioning
  347. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  348. --disable-safe-bitstream-reader
  349. disable buffer boundary checking in bitreaders
  350. (faster, but may crash)
  351. --sws-max-filter-size=N the max filter size swscale uses [$sws_max_filter_size_default]
  352. Optimization options (experts only):
  353. --disable-asm disable all assembly optimizations
  354. --disable-altivec disable AltiVec optimizations
  355. --disable-vsx disable VSX optimizations
  356. --disable-power8 disable POWER8 optimizations
  357. --disable-amd3dnow disable 3DNow! optimizations
  358. --disable-amd3dnowext disable 3DNow! extended optimizations
  359. --disable-mmx disable MMX optimizations
  360. --disable-mmxext disable MMXEXT optimizations
  361. --disable-sse disable SSE optimizations
  362. --disable-sse2 disable SSE2 optimizations
  363. --disable-sse3 disable SSE3 optimizations
  364. --disable-ssse3 disable SSSE3 optimizations
  365. --disable-sse4 disable SSE4 optimizations
  366. --disable-sse42 disable SSE4.2 optimizations
  367. --disable-avx disable AVX optimizations
  368. --disable-xop disable XOP optimizations
  369. --disable-fma3 disable FMA3 optimizations
  370. --disable-fma4 disable FMA4 optimizations
  371. --disable-avx2 disable AVX2 optimizations
  372. --disable-aesni disable AESNI optimizations
  373. --disable-armv5te disable armv5te optimizations
  374. --disable-armv6 disable armv6 optimizations
  375. --disable-armv6t2 disable armv6t2 optimizations
  376. --disable-vfp disable VFP optimizations
  377. --disable-neon disable NEON optimizations
  378. --disable-inline-asm disable use of inline assembly
  379. --disable-yasm disable use of nasm/yasm assembly
  380. --disable-mipsdsp disable MIPS DSP ASE R1 optimizations
  381. --disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations
  382. --disable-msa disable MSA optimizations
  383. --disable-mipsfpu disable floating point MIPS optimizations
  384. --disable-mmi disable Loongson SIMD optimizations
  385. --disable-fast-unaligned consider unaligned accesses slow
  386. Developer options (useful when working on FFmpeg itself):
  387. --disable-debug disable debugging symbols
  388. --enable-debug=LEVEL set the debug level [$debuglevel]
  389. --disable-optimizations disable compiler optimizations
  390. --enable-extra-warnings enable more compiler warnings
  391. --disable-stripping disable stripping of executables and shared libraries
  392. --assert-level=level 0(default), 1 or 2, amount of assertion testing,
  393. 2 causes a slowdown at runtime.
  394. --enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data
  395. --valgrind=VALGRIND run "make fate" tests through valgrind to detect memory
  396. leaks and errors, using the specified valgrind binary.
  397. Cannot be combined with --target-exec
  398. --enable-ftrapv Trap arithmetic overflows
  399. --samples=PATH location of test samples for FATE, if not set use
  400. \$FATE_SAMPLES at make invocation time.
  401. --enable-neon-clobber-test check NEON registers for clobbering (should be
  402. used only for debugging purposes)
  403. --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
  404. should be used only for debugging purposes)
  405. --enable-random randomly enable/disable components
  406. --disable-random
  407. --enable-random=LIST randomly enable/disable specific components or
  408. --disable-random=LIST component groups. LIST is a comma-separated list
  409. of NAME[:PROB] entries where NAME is a component
  410. (group) and PROB the probability associated with
  411. NAME (default 0.5).
  412. --random-seed=VALUE seed value for --enable/disable-random
  413. --disable-valgrind-backtrace do not print a backtrace under Valgrind
  414. (only applies to --disable-optimizations builds)
  415. NOTE: Object files are built at the place where configure is launched.
  416. EOF
  417. exit 0
  418. }
  419. quotes='""'
  420. if test -t 1 && which tput >/dev/null 2>&1; then
  421. ncolors=$(tput colors)
  422. if test -n "$ncolors" && test $ncolors -ge 8; then
  423. bold_color=$(tput bold)
  424. warn_color=$(tput setaf 3)
  425. error_color=$(tput setaf 1)
  426. reset_color=$(tput sgr0)
  427. fi
  428. # 72 used instead of 80 since that's the default of pr
  429. ncols=$(tput cols)
  430. fi
  431. : ${ncols:=72}
  432. log(){
  433. echo "$@" >> $logfile
  434. }
  435. log_file(){
  436. log BEGIN $1
  437. pr -n -t $1 >> $logfile
  438. log END $1
  439. }
  440. warn(){
  441. log "WARNING: $*"
  442. WARNINGS="${WARNINGS}WARNING: $*\n"
  443. }
  444. die(){
  445. log "$@"
  446. echo "$error_color$bold_color$@$reset_color"
  447. cat <<EOF
  448. If you think configure made a mistake, make sure you are using the latest
  449. version from Git. If the latest version fails, report the problem to the
  450. ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
  451. EOF
  452. if disabled logging; then
  453. cat <<EOF
  454. Rerun configure with logging enabled (do not use --disable-logging), and
  455. include the log this produces with your report.
  456. EOF
  457. else
  458. cat <<EOF
  459. Include the log file "$logfile" produced by configure as this will help
  460. solve the problem.
  461. EOF
  462. fi
  463. exit 1
  464. }
  465. # Avoid locale weirdness, besides we really just want to translate ASCII.
  466. toupper(){
  467. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  468. }
  469. tolower(){
  470. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  471. }
  472. c_escape(){
  473. echo "$*" | sed 's/["\\]/\\\0/g'
  474. }
  475. sh_quote(){
  476. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  477. test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
  478. echo "$v"
  479. }
  480. cleanws(){
  481. echo "$@" | sed 's/^ *//;s/[[:space:]][[:space:]]*/ /g;s/ *$//'
  482. }
  483. filter(){
  484. pat=$1
  485. shift
  486. for v; do
  487. eval "case $v in $pat) echo $v ;; esac"
  488. done
  489. }
  490. filter_out(){
  491. pat=$1
  492. shift
  493. for v; do
  494. eval "case $v in $pat) ;; *) echo $v ;; esac"
  495. done
  496. }
  497. map(){
  498. m=$1
  499. shift
  500. for v; do eval $m; done
  501. }
  502. add_suffix(){
  503. suffix=$1
  504. shift
  505. for v; do echo ${v}${suffix}; done
  506. }
  507. set_all(){
  508. value=$1
  509. shift
  510. for var in $*; do
  511. eval $var=$value
  512. done
  513. }
  514. set_weak(){
  515. value=$1
  516. shift
  517. for var; do
  518. eval : \${$var:=$value}
  519. done
  520. }
  521. sanitize_var_name(){
  522. echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
  523. }
  524. set_safe(){
  525. var=$1
  526. shift
  527. eval $(sanitize_var_name "$var")='$*'
  528. }
  529. get_safe(){
  530. eval echo \$$(sanitize_var_name "$1")
  531. }
  532. pushvar(){
  533. for pvar in $*; do
  534. eval level=\${${pvar}_level:=0}
  535. eval ${pvar}_${level}="\$$pvar"
  536. eval ${pvar}_level=$(($level+1))
  537. done
  538. }
  539. popvar(){
  540. for pvar in $*; do
  541. eval level=\${${pvar}_level:-0}
  542. test $level = 0 && continue
  543. eval level=$(($level-1))
  544. eval $pvar="\${${pvar}_${level}}"
  545. eval ${pvar}_level=$level
  546. eval unset ${pvar}_${level}
  547. done
  548. }
  549. request(){
  550. for var in $*; do
  551. eval ${var}_requested=yes
  552. eval $var=
  553. done
  554. }
  555. enable(){
  556. set_all yes $*
  557. }
  558. disable(){
  559. set_all no $*
  560. }
  561. enable_weak(){
  562. set_weak yes $*
  563. }
  564. disable_weak(){
  565. set_weak no $*
  566. }
  567. enable_safe(){
  568. for var; do
  569. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  570. done
  571. }
  572. disable_safe(){
  573. for var; do
  574. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  575. done
  576. }
  577. do_enable_deep(){
  578. for var; do
  579. enabled $var && continue
  580. eval sel="\$${var}_select"
  581. eval sgs="\$${var}_suggest"
  582. pushvar var sgs
  583. enable_deep $sel
  584. popvar sgs
  585. enable_deep_weak $sgs
  586. popvar var
  587. done
  588. }
  589. enable_deep(){
  590. do_enable_deep $*
  591. enable $*
  592. }
  593. enable_deep_weak(){
  594. for var; do
  595. disabled $var && continue
  596. pushvar var
  597. do_enable_deep $var
  598. popvar var
  599. enable_weak $var
  600. done
  601. }
  602. requested(){
  603. test "${1#!}" = "$1" && op='=' || op=!=
  604. eval test "x\$${1#!}_requested" $op "xyes"
  605. }
  606. enabled(){
  607. test "${1#!}" = "$1" && op='=' || op=!=
  608. eval test "x\$${1#!}" $op "xyes"
  609. }
  610. disabled(){
  611. test "${1#!}" = "$1" && op='=' || op=!=
  612. eval test "x\$${1#!}" $op "xno"
  613. }
  614. enabled_all(){
  615. for opt; do
  616. enabled $opt || return 1
  617. done
  618. }
  619. disabled_all(){
  620. for opt; do
  621. disabled $opt || return 1
  622. done
  623. }
  624. enabled_any(){
  625. for opt; do
  626. enabled $opt && return 0
  627. done
  628. }
  629. disabled_any(){
  630. for opt; do
  631. disabled $opt && return 0
  632. done
  633. return 1
  634. }
  635. set_default(){
  636. for opt; do
  637. eval : \${$opt:=\$${opt}_default}
  638. done
  639. }
  640. is_in(){
  641. value=$1
  642. shift
  643. for var in $*; do
  644. [ $var = $value ] && return 0
  645. done
  646. return 1
  647. }
  648. do_check_deps(){
  649. for cfg; do
  650. cfg="${cfg#!}"
  651. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  652. disabled ${cfg}_checking && continue
  653. enable ${cfg}_checking
  654. append allopts $cfg
  655. eval dep_all="\$${cfg}_deps"
  656. eval dep_any="\$${cfg}_deps_any"
  657. eval dep_sel="\$${cfg}_select"
  658. eval dep_sgs="\$${cfg}_suggest"
  659. eval dep_ifa="\$${cfg}_if"
  660. eval dep_ifn="\$${cfg}_if_any"
  661. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  662. do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  663. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  664. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  665. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  666. enabled_all $dep_all || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not all dependencies are satisfied: $dep_all"; }
  667. enabled_any $dep_any || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not any dependency is satisfied: $dep_any"; }
  668. disabled_any $dep_sel && { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but some selected dependency is unsatisfied: $dep_sel"; }
  669. if enabled $cfg; then
  670. enable_deep $dep_sel
  671. enable_deep_weak $dep_sgs
  672. fi
  673. disable ${cfg}_checking
  674. done
  675. }
  676. check_deps(){
  677. unset allopts
  678. do_check_deps "$@"
  679. for cfg in $allopts; do
  680. enabled $cfg || continue
  681. eval dep_extralibs="\$${cfg}_extralibs"
  682. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  683. done
  684. }
  685. print_config(){
  686. pfx=$1
  687. files=$2
  688. shift 2
  689. map 'eval echo "$v \${$v:-no}"' "$@" |
  690. awk "BEGIN { split(\"$files\", files) }
  691. {
  692. c = \"$pfx\" toupper(\$1);
  693. v = \$2;
  694. sub(/yes/, 1, v);
  695. sub(/no/, 0, v);
  696. for (f in files) {
  697. file = files[f];
  698. if (file ~ /\\.h\$/) {
  699. printf(\"#define %s %d\\n\", c, v) >>file;
  700. } else if (file ~ /\\.asm\$/) {
  701. printf(\"%%define %s %d\\n\", c, v) >>file;
  702. } else if (file ~ /\\.mak\$/) {
  703. n = -v ? \"\" : \"!\";
  704. printf(\"%s%s=yes\\n\", n, c) >>file;
  705. } else if (file ~ /\\.texi\$/) {
  706. pre = -v ? \"\" : \"@c \";
  707. yesno = \$2;
  708. c2 = tolower(c);
  709. gsub(/_/, \"-\", c2);
  710. printf(\"%s@set %s %s\\n\", pre, c2, yesno) >>file;
  711. }
  712. }
  713. }"
  714. }
  715. print_enabled(){
  716. suf=$1
  717. shift
  718. for v; do
  719. enabled $v && printf "%s\n" ${v%$suf}
  720. done
  721. }
  722. append(){
  723. var=$1
  724. shift
  725. eval "$var=\"\$$var $*\""
  726. }
  727. prepend(){
  728. var=$1
  729. shift
  730. eval "$var=\"$* \$$var\""
  731. }
  732. unique(){
  733. var=$1
  734. uniq_list=""
  735. for tok in $(eval echo \$$var); do
  736. uniq_list="$(filter_out $tok $uniq_list) $tok"
  737. done
  738. eval "$var=\"${uniq_list}\""
  739. }
  740. add_cppflags(){
  741. append CPPFLAGS "$@"
  742. }
  743. add_cflags(){
  744. append CFLAGS $($cflags_filter "$@")
  745. }
  746. add_cxxflags(){
  747. append CXXFLAGS $($cflags_filter "$@")
  748. }
  749. add_asflags(){
  750. append ASFLAGS $($asflags_filter "$@")
  751. }
  752. add_objcflags(){
  753. append OBJCFLAGS $($objcflags_filter "$@")
  754. }
  755. add_ldflags(){
  756. append LDFLAGS $($ldflags_filter "$@")
  757. }
  758. add_ldexeflags(){
  759. append LDEXEFLAGS $($ldflags_filter "$@")
  760. }
  761. add_ldlibflags(){
  762. append LDLIBFLAGS $($ldflags_filter "$@")
  763. }
  764. add_stripflags(){
  765. append ASMSTRIPFLAGS "$@"
  766. }
  767. add_extralibs(){
  768. prepend extralibs $($ldflags_filter "$@")
  769. }
  770. add_host_cppflags(){
  771. append host_cppflags "$@"
  772. }
  773. add_host_cflags(){
  774. append host_cflags $($host_cflags_filter "$@")
  775. }
  776. add_host_ldflags(){
  777. append host_ldflags $($host_ldflags_filter "$@")
  778. }
  779. add_compat(){
  780. append compat_objs $1
  781. shift
  782. map 'add_cppflags -D$v' "$@"
  783. }
  784. check_cmd(){
  785. log "$@"
  786. "$@" >> $logfile 2>&1
  787. }
  788. check_stat(){
  789. log check_stat "$@"
  790. stat "$1" >> $logfile 2>&1
  791. }
  792. cc_o(){
  793. eval printf '%s\\n' $CC_O
  794. }
  795. cc_e(){
  796. eval printf '%s\\n' $CC_E
  797. }
  798. check_cc(){
  799. log check_cc "$@"
  800. cat > $TMPC
  801. log_file $TMPC
  802. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
  803. }
  804. check_cxx(){
  805. log check_cxx "$@"
  806. cat > $TMPCPP
  807. log_file $TMPCPP
  808. check_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" $CXX_C -o $TMPO $TMPCPP
  809. }
  810. check_objcc(){
  811. log check_objcc "$@"
  812. cat > $TMPM
  813. log_file $TMPM
  814. check_cmd $objcc -Werror=missing-prototypes $CPPFLAGS $CFLAGS $OBJCFLAGS "$@" $OBJCC_C $(cc_o $TMPO) $TMPM
  815. }
  816. check_cpp(){
  817. log check_cpp "$@"
  818. cat > $TMPC
  819. log_file $TMPC
  820. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
  821. }
  822. as_o(){
  823. eval printf '%s\\n' $AS_O
  824. }
  825. check_as(){
  826. log check_as "$@"
  827. cat > $TMPS
  828. log_file $TMPS
  829. check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
  830. }
  831. check_inline_asm(){
  832. log check_inline_asm "$@"
  833. name="$1"
  834. code="$2"
  835. shift 2
  836. disable $name
  837. check_cc "$@" <<EOF && enable $name
  838. void foo(void){ __asm__ volatile($code); }
  839. EOF
  840. }
  841. check_inline_asm_flags(){
  842. log check_inline_asm_flags "$@"
  843. name="$1"
  844. code="$2"
  845. flags=''
  846. shift 2
  847. while [ "$1" != "" ]; do
  848. append flags $1
  849. shift
  850. done;
  851. disable $name
  852. cat > $TMPC <<EOF
  853. void foo(void){ __asm__ volatile($code); }
  854. EOF
  855. log_file $TMPC
  856. check_cmd $cc $CPPFLAGS $CFLAGS $flags "$@" $CC_C $(cc_o $TMPO) $TMPC &&
  857. enable $name && add_cflags $flags && add_asflags $flags && add_ldflags $flags
  858. }
  859. check_insn(){
  860. log check_insn "$@"
  861. check_inline_asm ${1}_inline "\"$2\""
  862. echo "$2" | check_as && enable ${1}_external || disable ${1}_external
  863. }
  864. check_yasm(){
  865. log check_yasm "$@"
  866. echo "$1" > $TMPS
  867. log_file $TMPS
  868. shift 1
  869. check_cmd $yasmexe $YASMFLAGS -Werror "$@" -o $TMPO $TMPS
  870. }
  871. ld_o(){
  872. eval printf '%s\\n' $LD_O
  873. }
  874. check_ld(){
  875. log check_ld "$@"
  876. type=$1
  877. shift 1
  878. flags=$(filter_out '-l*|*.so' $@)
  879. libs=$(filter '-l*|*.so' $@)
  880. check_$type $($cflags_filter $flags) || return
  881. flags=$($ldflags_filter $flags)
  882. libs=$($ldflags_filter $libs)
  883. check_cmd $ld $LDFLAGS $LDEXEFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
  884. }
  885. print_include(){
  886. hdr=$1
  887. test "${hdr%.h}" = "${hdr}" &&
  888. echo "#include $hdr" ||
  889. echo "#include <$hdr>"
  890. }
  891. check_code(){
  892. log check_code "$@"
  893. check=$1
  894. headers=$2
  895. code=$3
  896. shift 3
  897. {
  898. for hdr in $headers; do
  899. print_include $hdr
  900. done
  901. echo "int main(void) { $code; return 0; }"
  902. } | check_$check "$@"
  903. }
  904. check_cppflags(){
  905. log check_cppflags "$@"
  906. check_cpp "$@" <<EOF && append CPPFLAGS "$@"
  907. int x;
  908. EOF
  909. }
  910. test_cflags(){
  911. log test_cflags "$@"
  912. set -- $($cflags_filter "$@")
  913. check_cc "$@" <<EOF
  914. int x;
  915. EOF
  916. }
  917. check_cflags(){
  918. log check_cflags "$@"
  919. test_cflags "$@" && add_cflags "$@"
  920. }
  921. check_cxxflags(){
  922. log check_cxxflags "$@"
  923. set -- $($cflags_filter "$@")
  924. check_cxx "$@" <<EOF && append CXXFLAGS "$@"
  925. int x;
  926. EOF
  927. }
  928. test_objcflags(){
  929. log test_objcflags "$@"
  930. set -- $($objcflags_filter "$@")
  931. check_objcc "$@" <<EOF
  932. int x;
  933. EOF
  934. }
  935. check_objcflags(){
  936. log check_objcflags "$@"
  937. test_objcflags "$@" && add_objcflags "$@"
  938. }
  939. test_ldflags(){
  940. log test_ldflags "$@"
  941. check_ld "cc" "$@" <<EOF
  942. int main(void){ return 0; }
  943. EOF
  944. }
  945. check_ldflags(){
  946. log check_ldflags "$@"
  947. test_ldflags "$@" && add_ldflags "$@"
  948. }
  949. test_stripflags(){
  950. log test_stripflags "$@"
  951. # call check_cc to get a fresh TMPO
  952. check_cc <<EOF
  953. int main(void) { return 0; }
  954. EOF
  955. check_cmd $strip $ASMSTRIPFLAGS "$@" $TMPO
  956. }
  957. check_stripflags(){
  958. log check_stripflags "$@"
  959. test_stripflags "$@" && add_stripflags "$@"
  960. }
  961. check_header(){
  962. log check_header "$@"
  963. header=$1
  964. shift
  965. disable_safe $header
  966. check_cpp "$@" <<EOF && enable_safe $header
  967. #include <$header>
  968. int x;
  969. EOF
  970. }
  971. check_header_objcc(){
  972. log check_header_objcc "$@"
  973. rm -f -- "$TMPO"
  974. header=$1
  975. shift
  976. disable_safe $header
  977. {
  978. echo "#include <$header>"
  979. echo "int main(void) { return 0; }"
  980. } | check_objcc && check_stat "$TMPO" && enable_safe $headers
  981. }
  982. check_func(){
  983. log check_func "$@"
  984. func=$1
  985. shift
  986. disable $func
  987. check_ld "cc" "$@" <<EOF && enable $func
  988. extern int $func();
  989. int main(void){ $func(); }
  990. EOF
  991. }
  992. check_complexfunc(){
  993. log check_complexfunc "$@"
  994. func=$1
  995. narg=$2
  996. shift 2
  997. test $narg = 2 && args="f, g" || args="f * I"
  998. disable $func
  999. check_ld "cc" "$@" <<EOF && enable $func
  1000. #include <complex.h>
  1001. #include <math.h>
  1002. float foo(complex float f, complex float g) { return $func($args); }
  1003. int main(void){ return (int) foo; }
  1004. EOF
  1005. }
  1006. check_mathfunc(){
  1007. log check_mathfunc "$@"
  1008. func=$1
  1009. narg=$2
  1010. shift 2
  1011. test $narg = 2 && args="f, g" || args="f"
  1012. disable $func
  1013. check_ld "cc" "$@" <<EOF && enable $func
  1014. #include <math.h>
  1015. float foo(float f, float g) { return $func($args); }
  1016. int main(void){ return (int) foo; }
  1017. EOF
  1018. }
  1019. check_func_headers(){
  1020. log check_func_headers "$@"
  1021. headers=$1
  1022. funcs=$2
  1023. shift 2
  1024. {
  1025. for hdr in $headers; do
  1026. print_include $hdr
  1027. done
  1028. echo "#include <stdint.h>"
  1029. for func in $funcs; do
  1030. echo "long check_$func(void) { return (long) $func; }"
  1031. done
  1032. echo "int main(void) { int ret = 0;"
  1033. # LTO could optimize out the test functions without this
  1034. for func in $funcs; do
  1035. echo " ret |= ((intptr_t)check_$func) & 0xFFFF;"
  1036. done
  1037. echo "return ret; }"
  1038. } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
  1039. }
  1040. check_class_headers_cpp(){
  1041. log check_class_headers_cpp "$@"
  1042. headers=$1
  1043. classes=$2
  1044. shift 2
  1045. {
  1046. for hdr in $headers; do
  1047. echo "#include <$hdr>"
  1048. done
  1049. echo "int main(void) { "
  1050. i=1
  1051. for class in $classes; do
  1052. echo "$class obj$i;"
  1053. i=$(expr $i + 1)
  1054. done
  1055. echo "return 0; }"
  1056. } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers
  1057. }
  1058. check_cpp_condition(){
  1059. log check_cpp_condition "$@"
  1060. header=$1
  1061. condition=$2
  1062. shift 2
  1063. check_cpp "$@" <<EOF
  1064. #include <$header>
  1065. #if !($condition)
  1066. #error "unsatisfied condition: $condition"
  1067. #endif
  1068. EOF
  1069. }
  1070. test_cflags_cc(){
  1071. log test_cflags_cc "$@"
  1072. flags=$1
  1073. header=$2
  1074. condition=$3
  1075. shift 3
  1076. set -- $($cflags_filter "$flags")
  1077. check_cc "$@" <<EOF
  1078. #include <$header>
  1079. #if !($condition)
  1080. #error "unsatisfied condition: $condition"
  1081. #endif
  1082. EOF
  1083. }
  1084. check_lib(){
  1085. log check_lib "$@"
  1086. headers="$1"
  1087. funcs="$2"
  1088. shift 2
  1089. check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
  1090. }
  1091. check_lib_cpp(){
  1092. log check_lib_cpp "$@"
  1093. headers="$1"
  1094. classes="$2"
  1095. shift 2
  1096. check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@"
  1097. }
  1098. check_pkg_config(){
  1099. log check_pkg_config "$@"
  1100. pkgandversion="$1"
  1101. pkg="${1%% *}"
  1102. headers="$2"
  1103. funcs="$3"
  1104. shift 3
  1105. check_cmd $pkg_config --exists --print-errors $pkgandversion || return
  1106. pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
  1107. pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
  1108. check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
  1109. set_safe "${pkg}_cflags" $pkg_cflags &&
  1110. set_safe "${pkg}_libs" $pkg_libs
  1111. }
  1112. check_exec(){
  1113. check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  1114. }
  1115. check_exec_crash(){
  1116. log check_exec_crash "$@"
  1117. code=$(cat)
  1118. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  1119. # are safe but may not be available everywhere. Thus we use
  1120. # raise(SIGTERM) instead. The check is run in a subshell so we
  1121. # can redirect the "Terminated" message from the shell. SIGBUS
  1122. # is not defined by standard C so it is used conditionally.
  1123. (check_exec "$@") >> $logfile 2>&1 <<EOF
  1124. #include <signal.h>
  1125. static void sighandler(int sig){
  1126. raise(SIGTERM);
  1127. }
  1128. int foo(void){
  1129. $code
  1130. }
  1131. int (*func_ptr)(void) = foo;
  1132. int main(void){
  1133. signal(SIGILL, sighandler);
  1134. signal(SIGFPE, sighandler);
  1135. signal(SIGSEGV, sighandler);
  1136. #ifdef SIGBUS
  1137. signal(SIGBUS, sighandler);
  1138. #endif
  1139. return func_ptr();
  1140. }
  1141. EOF
  1142. }
  1143. check_type(){
  1144. log check_type "$@"
  1145. headers=$1
  1146. type=$2
  1147. shift 2
  1148. disable_safe "$type"
  1149. check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
  1150. }
  1151. check_struct(){
  1152. log check_struct "$@"
  1153. headers=$1
  1154. struct=$2
  1155. member=$3
  1156. shift 3
  1157. disable_safe "${struct}_${member}"
  1158. check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
  1159. enable_safe "${struct}_${member}"
  1160. }
  1161. check_builtin(){
  1162. log check_builtin "$@"
  1163. name=$1
  1164. headers=$2
  1165. builtin=$3
  1166. shift 3
  1167. disable "$name"
  1168. check_code ld "$headers" "$builtin" "cc" "$@" && enable "$name"
  1169. }
  1170. check_compile_assert(){
  1171. log check_compile_assert "$@"
  1172. name=$1
  1173. headers=$2
  1174. condition=$3
  1175. shift 3
  1176. disable "$name"
  1177. check_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
  1178. }
  1179. require(){
  1180. log require "$@"
  1181. name="$1"
  1182. headers="$2"
  1183. func="$3"
  1184. shift 3
  1185. check_lib "$headers" $func "$@" || die "ERROR: $name not found"
  1186. }
  1187. require_cpp(){
  1188. name="$1"
  1189. headers="$2"
  1190. classes="$3"
  1191. shift 3
  1192. check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
  1193. }
  1194. use_pkg_config(){
  1195. log use_pkg_config "$@"
  1196. pkg="$1"
  1197. check_pkg_config "$@" || return 1
  1198. add_cflags $(get_safe "${pkg}_cflags")
  1199. add_extralibs $(get_safe "${pkg}_libs")
  1200. }
  1201. require_pkg_config(){
  1202. use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message"
  1203. }
  1204. require_libfreetype(){
  1205. log require_libfreetype "$@"
  1206. pkg="freetype2"
  1207. check_cmd $pkg_config --exists --print-errors $pkg \
  1208. || die "ERROR: $pkg not found"
  1209. pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
  1210. pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
  1211. {
  1212. echo "#include <ft2build.h>"
  1213. echo "#include FT_FREETYPE_H"
  1214. echo "long check_func(void) { return (long) FT_Init_FreeType; }"
  1215. echo "int main(void) { return 0; }"
  1216. } | check_ld "cc" $pkg_cflags $pkg_libs \
  1217. && set_safe "${pkg}_cflags" $pkg_cflags \
  1218. && set_safe "${pkg}_libs" $pkg_libs \
  1219. || die "ERROR: $pkg not found"
  1220. add_cflags $(get_safe "${pkg}_cflags")
  1221. add_extralibs $(get_safe "${pkg}_libs")
  1222. }
  1223. hostcc_e(){
  1224. eval printf '%s\\n' $HOSTCC_E
  1225. }
  1226. hostcc_o(){
  1227. eval printf '%s\\n' $HOSTCC_O
  1228. }
  1229. check_host_cc(){
  1230. log check_host_cc "$@"
  1231. cat > $TMPC
  1232. log_file $TMPC
  1233. check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
  1234. }
  1235. check_host_cpp(){
  1236. log check_host_cpp "$@"
  1237. cat > $TMPC
  1238. log_file $TMPC
  1239. check_cmd $host_cc $host_cppflags $host_cflags "$@" $(hostcc_e $TMPO) $TMPC
  1240. }
  1241. check_host_cppflags(){
  1242. log check_host_cppflags "$@"
  1243. check_host_cpp "$@" <<EOF && append host_cppflags "$@"
  1244. int x;
  1245. EOF
  1246. }
  1247. check_host_cflags(){
  1248. log check_host_cflags "$@"
  1249. set -- $($host_cflags_filter "$@")
  1250. check_host_cc "$@" <<EOF && append host_cflags "$@"
  1251. int x;
  1252. EOF
  1253. }
  1254. check_host_cpp_condition(){
  1255. log check_host_cpp_condition "$@"
  1256. header=$1
  1257. condition=$2
  1258. shift 2
  1259. check_host_cpp "$@" <<EOF
  1260. #include <$header>
  1261. #if !($condition)
  1262. #error "unsatisfied condition: $condition"
  1263. #endif
  1264. EOF
  1265. }
  1266. cp_if_changed(){
  1267. cmp -s "$1" "$2" && { test "$quiet" != "yes" && echo "$2 is unchanged"; } && return
  1268. mkdir -p "$(dirname $2)"
  1269. $cp_f "$1" "$2"
  1270. }
  1271. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  1272. # system-dependent things.
  1273. AVCODEC_COMPONENTS="
  1274. bsfs
  1275. decoders
  1276. encoders
  1277. hwaccels
  1278. parsers
  1279. "
  1280. AVDEVICE_COMPONENTS="
  1281. indevs
  1282. outdevs
  1283. "
  1284. AVFILTER_COMPONENTS="
  1285. filters
  1286. "
  1287. AVFORMAT_COMPONENTS="
  1288. demuxers
  1289. muxers
  1290. protocols
  1291. "
  1292. AVRESAMPLE_COMPONENTS=""
  1293. AVUTIL_COMPONENTS=""
  1294. COMPONENT_LIST="
  1295. $AVCODEC_COMPONENTS
  1296. $AVDEVICE_COMPONENTS
  1297. $AVFILTER_COMPONENTS
  1298. $AVFORMAT_COMPONENTS
  1299. $AVRESAMPLE_COMPONENTS
  1300. $AVUTIL_COMPONENTS
  1301. "
  1302. EXAMPLE_LIST="
  1303. avio_dir_cmd_example
  1304. avio_reading_example
  1305. decode_audio_example
  1306. decode_video_example
  1307. demuxing_decoding_example
  1308. encode_audio_example
  1309. encode_video_example
  1310. extract_mvs_example
  1311. filter_audio_example
  1312. filtering_audio_example
  1313. filtering_video_example
  1314. http_multiclient_example
  1315. metadata_example
  1316. muxing_example
  1317. qsvdec_example
  1318. remuxing_example
  1319. resampling_audio_example
  1320. scaling_video_example
  1321. transcode_aac_example
  1322. transcoding_example
  1323. "
  1324. EXTERNAL_AUTODETECT_LIBRARY_LIST="
  1325. bzlib
  1326. iconv
  1327. libxcb
  1328. libxcb_shm
  1329. libxcb_shape
  1330. libxcb_xfixes
  1331. lzma
  1332. schannel
  1333. sdl
  1334. sdl2
  1335. securetransport
  1336. xlib
  1337. zlib
  1338. "
  1339. EXTERNAL_LIBRARY_GPL_LIST="
  1340. avisynth
  1341. frei0r
  1342. libcdio
  1343. librubberband
  1344. libvidstab
  1345. libx264
  1346. libx265
  1347. libxavs
  1348. libxvid
  1349. "
  1350. EXTERNAL_LIBRARY_NONFREE_LIST="
  1351. decklink
  1352. libfdk_aac
  1353. openssl
  1354. "
  1355. EXTERNAL_LIBRARY_VERSION3_LIST="
  1356. gmp
  1357. libopencore_amrnb
  1358. libopencore_amrwb
  1359. libvo_amrwbenc
  1360. "
  1361. EXTERNAL_LIBRARY_GPLV3_LIST="
  1362. libsmbclient
  1363. "
  1364. EXTERNAL_LIBRARY_LIST="
  1365. $EXTERNAL_AUTODETECT_LIBRARY_LIST
  1366. $EXTERNAL_LIBRARY_GPL_LIST
  1367. $EXTERNAL_LIBRARY_NONFREE_LIST
  1368. $EXTERNAL_LIBRARY_VERSION3_LIST
  1369. $EXTERNAL_LIBRARY_GPLV3_LIST
  1370. chromaprint
  1371. crystalhd
  1372. gcrypt
  1373. gnutls
  1374. jni
  1375. ladspa
  1376. libass
  1377. libbluray
  1378. libbs2b
  1379. libcaca
  1380. libcelt
  1381. libdc1394
  1382. libflite
  1383. libfontconfig
  1384. libfreetype
  1385. libfribidi
  1386. libgme
  1387. libgsm
  1388. libiec61883
  1389. libilbc
  1390. libkvazaar
  1391. libmodplug
  1392. libmp3lame
  1393. libnut
  1394. libopencv
  1395. libopenh264
  1396. libopenjpeg
  1397. libopenmpt
  1398. libopus
  1399. libpulse
  1400. librtmp
  1401. libschroedinger
  1402. libshine
  1403. libsmbclient
  1404. libsnappy
  1405. libsoxr
  1406. libspeex
  1407. libssh
  1408. libtesseract
  1409. libtheora
  1410. libtwolame
  1411. libv4l2
  1412. libvorbis
  1413. libvpx
  1414. libwavpack
  1415. libwebp
  1416. libzimg
  1417. libzmq
  1418. libzvbi
  1419. mediacodec
  1420. netcdf
  1421. openal
  1422. opencl
  1423. opengl
  1424. videotoolbox
  1425. "
  1426. HWACCEL_AUTODETECT_LIBRARY_LIST="
  1427. audiotoolbox
  1428. cuda
  1429. cuvid
  1430. d3d11va
  1431. dxva2
  1432. nvenc
  1433. vaapi
  1434. vda
  1435. vdpau
  1436. videotoolbox_hwaccel
  1437. xvmc
  1438. "
  1439. HWACCEL_LIBRARY_NONFREE_LIST="
  1440. libnpp
  1441. "
  1442. HWACCEL_LIBRARY_LIST="
  1443. $HWACCEL_AUTODETECT_LIBRARY_LIST
  1444. $HWACCEL_LIBRARY_NONFREE_LIST
  1445. libmfx
  1446. mmal
  1447. omx
  1448. "
  1449. DOCUMENT_LIST="
  1450. doc
  1451. htmlpages
  1452. manpages
  1453. podpages
  1454. txtpages
  1455. "
  1456. FEATURE_LIST="
  1457. ftrapv
  1458. gray
  1459. hardcoded_tables
  1460. omx_rpi
  1461. runtime_cpudetect
  1462. safe_bitstream_reader
  1463. shared
  1464. small
  1465. static
  1466. swscale_alpha
  1467. "
  1468. LIBRARY_LIST="
  1469. avcodec
  1470. avdevice
  1471. avfilter
  1472. avformat
  1473. avresample
  1474. avutil
  1475. postproc
  1476. swresample
  1477. swscale
  1478. "
  1479. LICENSE_LIST="
  1480. gpl
  1481. nonfree
  1482. version3
  1483. "
  1484. PROGRAM_LIST="
  1485. ffplay
  1486. ffprobe
  1487. ffserver
  1488. ffmpeg
  1489. "
  1490. SUBSYSTEM_LIST="
  1491. dct
  1492. dwt
  1493. error_resilience
  1494. faan
  1495. fast_unaligned
  1496. fft
  1497. lsp
  1498. lzo
  1499. mdct
  1500. pixelutils
  1501. network
  1502. rdft
  1503. "
  1504. CONFIG_LIST="
  1505. $COMPONENT_LIST
  1506. $DOCUMENT_LIST
  1507. $EXAMPLE_LIST
  1508. $EXTERNAL_LIBRARY_LIST
  1509. $HWACCEL_LIBRARY_LIST
  1510. $FEATURE_LIST
  1511. $LICENSE_LIST
  1512. $LIBRARY_LIST
  1513. $PROGRAM_LIST
  1514. $SUBSYSTEM_LIST
  1515. fontconfig
  1516. memory_poisoning
  1517. neon_clobber_test
  1518. pic
  1519. raise_major
  1520. thumb
  1521. valgrind_backtrace
  1522. xmm_clobber_test
  1523. "
  1524. THREADS_LIST="
  1525. pthreads
  1526. os2threads
  1527. w32threads
  1528. "
  1529. ATOMICS_LIST="
  1530. atomics_gcc
  1531. atomics_suncc
  1532. atomics_win32
  1533. "
  1534. AUTODETECT_LIBS="
  1535. $EXTERNAL_AUTODETECT_LIBRARY_LIST
  1536. $HWACCEL_AUTODETECT_LIBRARY_LIST
  1537. $THREADS_LIST
  1538. "
  1539. ARCH_LIST="
  1540. aarch64
  1541. alpha
  1542. arm
  1543. avr32
  1544. avr32_ap
  1545. avr32_uc
  1546. bfin
  1547. ia64
  1548. m68k
  1549. mips
  1550. mips64
  1551. parisc
  1552. ppc
  1553. ppc64
  1554. s390
  1555. sh4
  1556. sparc
  1557. sparc64
  1558. tilegx
  1559. tilepro
  1560. tomi
  1561. x86
  1562. x86_32
  1563. x86_64
  1564. "
  1565. ARCH_EXT_LIST_ARM="
  1566. armv5te
  1567. armv6
  1568. armv6t2
  1569. armv8
  1570. neon
  1571. vfp
  1572. vfpv3
  1573. setend
  1574. "
  1575. ARCH_EXT_LIST_MIPS="
  1576. mipsfpu
  1577. mips32r2
  1578. mips32r5
  1579. mips64r2
  1580. mips32r6
  1581. mips64r6
  1582. mipsdsp
  1583. mipsdspr2
  1584. msa
  1585. "
  1586. ARCH_EXT_LIST_LOONGSON="
  1587. loongson2
  1588. loongson3
  1589. mmi
  1590. "
  1591. ARCH_EXT_LIST_X86_SIMD="
  1592. aesni
  1593. amd3dnow
  1594. amd3dnowext
  1595. avx
  1596. avx2
  1597. fma3
  1598. fma4
  1599. mmx
  1600. mmxext
  1601. sse
  1602. sse2
  1603. sse3
  1604. sse4
  1605. sse42
  1606. ssse3
  1607. xop
  1608. "
  1609. ARCH_EXT_LIST_PPC="
  1610. altivec
  1611. dcbzl
  1612. ldbrx
  1613. power8
  1614. ppc4xx
  1615. vsx
  1616. "
  1617. ARCH_EXT_LIST_X86="
  1618. $ARCH_EXT_LIST_X86_SIMD
  1619. cpunop
  1620. i686
  1621. "
  1622. ARCH_EXT_LIST="
  1623. $ARCH_EXT_LIST_ARM
  1624. $ARCH_EXT_LIST_PPC
  1625. $ARCH_EXT_LIST_X86
  1626. $ARCH_EXT_LIST_MIPS
  1627. $ARCH_EXT_LIST_LOONGSON
  1628. "
  1629. ARCH_FEATURES="
  1630. aligned_stack
  1631. fast_64bit
  1632. fast_clz
  1633. fast_cmov
  1634. local_aligned_8
  1635. local_aligned_16
  1636. local_aligned_32
  1637. simd_align_16
  1638. simd_align_32
  1639. "
  1640. BUILTIN_LIST="
  1641. atomic_cas_ptr
  1642. machine_rw_barrier
  1643. MemoryBarrier
  1644. mm_empty
  1645. rdtsc
  1646. sarestart
  1647. sem_timedwait
  1648. sync_val_compare_and_swap
  1649. "
  1650. HAVE_LIST_CMDLINE="
  1651. inline_asm
  1652. symver
  1653. yasm
  1654. "
  1655. HAVE_LIST_PUB="
  1656. bigendian
  1657. fast_unaligned
  1658. "
  1659. HEADERS_LIST="
  1660. alsa_asoundlib_h
  1661. altivec_h
  1662. arpa_inet_h
  1663. asm_types_h
  1664. cdio_paranoia_h
  1665. cdio_paranoia_paranoia_h
  1666. cuda_h
  1667. dispatch_dispatch_h
  1668. dev_bktr_ioctl_bt848_h
  1669. dev_bktr_ioctl_meteor_h
  1670. dev_ic_bt8xx_h
  1671. dev_video_bktr_ioctl_bt848_h
  1672. dev_video_meteor_ioctl_meteor_h
  1673. direct_h
  1674. dirent_h
  1675. dlfcn_h
  1676. d3d11_h
  1677. dxva_h
  1678. ES2_gl_h
  1679. gsm_h
  1680. io_h
  1681. mach_mach_time_h
  1682. machine_ioctl_bt848_h
  1683. machine_ioctl_meteor_h
  1684. malloc_h
  1685. opencv2_core_core_c_h
  1686. openjpeg_2_1_openjpeg_h
  1687. openjpeg_2_0_openjpeg_h
  1688. openjpeg_1_5_openjpeg_h
  1689. OpenGL_gl3_h
  1690. poll_h
  1691. sndio_h
  1692. soundcard_h
  1693. stdatomic_h
  1694. sys_mman_h
  1695. sys_param_h
  1696. sys_resource_h
  1697. sys_select_h
  1698. sys_soundcard_h
  1699. sys_time_h
  1700. sys_un_h
  1701. sys_videoio_h
  1702. termios_h
  1703. udplite_h
  1704. unistd_h
  1705. valgrind_valgrind_h
  1706. windows_h
  1707. winsock2_h
  1708. "
  1709. INTRINSICS_LIST="
  1710. intrinsics_neon
  1711. "
  1712. COMPLEX_FUNCS="
  1713. cabs
  1714. cexp
  1715. "
  1716. MATH_FUNCS="
  1717. atanf
  1718. atan2f
  1719. cbrt
  1720. cbrtf
  1721. copysign
  1722. cosf
  1723. erf
  1724. exp2
  1725. exp2f
  1726. expf
  1727. hypot
  1728. isfinite
  1729. isinf
  1730. isnan
  1731. ldexpf
  1732. llrint
  1733. llrintf
  1734. log2
  1735. log2f
  1736. log10f
  1737. lrint
  1738. lrintf
  1739. powf
  1740. rint
  1741. round
  1742. roundf
  1743. sinf
  1744. trunc
  1745. truncf
  1746. "
  1747. SYSTEM_FUNCS="
  1748. access
  1749. aligned_malloc
  1750. arc4random
  1751. clock_gettime
  1752. closesocket
  1753. CommandLineToArgvW
  1754. CoTaskMemFree
  1755. CryptGenRandom
  1756. dlopen
  1757. fcntl
  1758. flt_lim
  1759. fork
  1760. getaddrinfo
  1761. gethrtime
  1762. getopt
  1763. GetProcessAffinityMask
  1764. GetProcessMemoryInfo
  1765. GetProcessTimes
  1766. getrusage
  1767. GetSystemTimeAsFileTime
  1768. gettimeofday
  1769. glob
  1770. glXGetProcAddress
  1771. gmtime_r
  1772. inet_aton
  1773. isatty
  1774. jack_port_get_latency_range
  1775. kbhit
  1776. LoadLibrary
  1777. localtime_r
  1778. lstat
  1779. lzo1x_999_compress
  1780. mach_absolute_time
  1781. MapViewOfFile
  1782. memalign
  1783. mkstemp
  1784. mmap
  1785. mprotect
  1786. nanosleep
  1787. PeekNamedPipe
  1788. posix_memalign
  1789. pthread_cancel
  1790. sched_getaffinity
  1791. SetConsoleTextAttribute
  1792. SetConsoleCtrlHandler
  1793. setmode
  1794. setrlimit
  1795. Sleep
  1796. strerror_r
  1797. sysconf
  1798. sysctl
  1799. usleep
  1800. UTGetOSTypeFromString
  1801. VirtualAlloc
  1802. wglGetProcAddress
  1803. "
  1804. TOOLCHAIN_FEATURES="
  1805. as_dn_directive
  1806. as_fpu_directive
  1807. as_func
  1808. as_object_arch
  1809. asm_mod_q
  1810. attribute_may_alias
  1811. attribute_packed
  1812. ebp_available
  1813. ebx_available
  1814. gnu_as
  1815. gnu_windres
  1816. ibm_asm
  1817. inline_asm_direct_symbol_refs
  1818. inline_asm_labels
  1819. inline_asm_nonlocal_labels
  1820. pragma_deprecated
  1821. rsync_contimeout
  1822. symver_asm_label
  1823. symver_gnu_asm
  1824. vfp_args
  1825. xform_asm
  1826. xmm_clobbers
  1827. "
  1828. TYPES_LIST="
  1829. CONDITION_VARIABLE_Ptr
  1830. socklen_t
  1831. struct_addrinfo
  1832. struct_group_source_req
  1833. struct_ip_mreq_source
  1834. struct_ipv6_mreq
  1835. struct_msghdr_msg_flags
  1836. struct_pollfd
  1837. struct_rusage_ru_maxrss
  1838. struct_sctp_event_subscribe
  1839. struct_sockaddr_in6
  1840. struct_sockaddr_sa_len
  1841. struct_sockaddr_storage
  1842. struct_stat_st_mtim_tv_nsec
  1843. struct_v4l2_frmivalenum_discrete
  1844. "
  1845. HAVE_LIST="
  1846. $ARCH_EXT_LIST
  1847. $(add_suffix _external $ARCH_EXT_LIST)
  1848. $(add_suffix _inline $ARCH_EXT_LIST)
  1849. $ARCH_FEATURES
  1850. $ATOMICS_LIST
  1851. $BUILTIN_LIST
  1852. $COMPLEX_FUNCS
  1853. $HAVE_LIST_CMDLINE
  1854. $HAVE_LIST_PUB
  1855. $HEADERS_LIST
  1856. $INTRINSICS_LIST
  1857. $MATH_FUNCS
  1858. $SYSTEM_FUNCS
  1859. $THREADS_LIST
  1860. $TOOLCHAIN_FEATURES
  1861. $TYPES_LIST
  1862. atomics_native
  1863. dos_paths
  1864. dxva2_lib
  1865. dxva2api_cobj
  1866. libc_msvcrt
  1867. libdc1394_1
  1868. libdc1394_2
  1869. makeinfo
  1870. makeinfo_html
  1871. MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS
  1872. perl
  1873. pod2man
  1874. sdl2
  1875. section_data_rel_ro
  1876. texi2html
  1877. threads
  1878. vaapi_drm
  1879. vaapi_x11
  1880. vdpau_x11
  1881. winrt
  1882. xlib
  1883. "
  1884. # options emitted with CONFIG_ prefix but not available on the command line
  1885. CONFIG_EXTRA="
  1886. aandcttables
  1887. ac3dsp
  1888. audio_frame_queue
  1889. audiodsp
  1890. blockdsp
  1891. bswapdsp
  1892. cabac
  1893. dirac_parse
  1894. dvprofile
  1895. exif
  1896. faandct
  1897. faanidct
  1898. fdctdsp
  1899. flacdsp
  1900. fmtconvert
  1901. frame_thread_encoder
  1902. g722dsp
  1903. golomb
  1904. gplv3
  1905. h263dsp
  1906. h264chroma
  1907. h264dsp
  1908. h264parse
  1909. h264pred
  1910. h264qpel
  1911. hpeldsp
  1912. huffman
  1913. huffyuvdsp
  1914. huffyuvencdsp
  1915. idctdsp
  1916. iirfilter
  1917. mdct15
  1918. intrax8
  1919. iso_media
  1920. ividsp
  1921. jpegtables
  1922. lgplv3
  1923. libx262
  1924. llauddsp
  1925. llviddsp
  1926. llvidencdsp
  1927. lpc
  1928. lzf
  1929. me_cmp
  1930. mpeg_er
  1931. mpegaudio
  1932. mpegaudiodsp
  1933. mpegvideo
  1934. mpegvideoenc
  1935. mss34dsp
  1936. pixblockdsp
  1937. qpeldsp
  1938. qsv
  1939. qsvdec
  1940. qsvenc
  1941. rangecoder
  1942. riffdec
  1943. riffenc
  1944. rtpdec
  1945. rtpenc_chain
  1946. rv34dsp
  1947. sinewin
  1948. snappy
  1949. srtp
  1950. startcode
  1951. texturedsp
  1952. texturedspenc
  1953. tpeldsp
  1954. vaapi_encode
  1955. vc1dsp
  1956. videodsp
  1957. vp3dsp
  1958. vp56dsp
  1959. vp8dsp
  1960. vt_bt2020
  1961. wma_freqs
  1962. wmv2dsp
  1963. "
  1964. CMDLINE_SELECT="
  1965. $ARCH_EXT_LIST
  1966. $CONFIG_LIST
  1967. $HAVE_LIST_CMDLINE
  1968. $THREADS_LIST
  1969. asm
  1970. cross_compile
  1971. debug
  1972. extra_warnings
  1973. logging
  1974. lto
  1975. optimizations
  1976. rpath
  1977. stripping
  1978. "
  1979. PATHS_LIST="
  1980. bindir
  1981. datadir
  1982. docdir
  1983. incdir
  1984. libdir
  1985. mandir
  1986. pkgconfigdir
  1987. prefix
  1988. shlibdir
  1989. install_name_dir
  1990. "
  1991. CMDLINE_SET="
  1992. $PATHS_LIST
  1993. ar
  1994. arch
  1995. as
  1996. assert_level
  1997. build_suffix
  1998. cc
  1999. objcc
  2000. cpu
  2001. cross_prefix
  2002. custom_allocator
  2003. cxx
  2004. dep_cc
  2005. doxygen
  2006. env
  2007. extra_version
  2008. gas
  2009. host_cc
  2010. host_cflags
  2011. host_ld
  2012. host_ldflags
  2013. host_libs
  2014. host_os
  2015. install
  2016. ld
  2017. ln_s
  2018. logfile
  2019. malloc_prefix
  2020. nm
  2021. optflags
  2022. pkg_config
  2023. pkg_config_flags
  2024. progs_suffix
  2025. random_seed
  2026. ranlib
  2027. samples
  2028. strip
  2029. sws_max_filter_size
  2030. sysinclude
  2031. sysroot
  2032. target_exec
  2033. target_os
  2034. target_path
  2035. target_samples
  2036. tempprefix
  2037. toolchain
  2038. valgrind
  2039. yasmexe
  2040. "
  2041. CMDLINE_APPEND="
  2042. extra_cflags
  2043. extra_cxxflags
  2044. extra_objcflags
  2045. host_cppflags
  2046. "
  2047. # code dependency declarations
  2048. # architecture extensions
  2049. armv5te_deps="arm"
  2050. armv6_deps="arm"
  2051. armv6t2_deps="arm"
  2052. armv8_deps="aarch64"
  2053. neon_deps_any="aarch64 arm"
  2054. intrinsics_neon_deps="neon"
  2055. vfp_deps_any="aarch64 arm"
  2056. vfpv3_deps="vfp"
  2057. setend_deps="arm"
  2058. map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
  2059. loongson2_deps="mips"
  2060. loongson3_deps="mips"
  2061. mipsfpu_deps="mips"
  2062. mipsdsp_deps="mips"
  2063. mipsdspr2_deps="mips"
  2064. mips32r2_deps="mips"
  2065. mips32r5_deps="mips"
  2066. mips32r6_deps="mips"
  2067. mips64r2_deps="mips"
  2068. mips64r6_deps="mips"
  2069. msa_deps="mipsfpu"
  2070. mmi_deps="mips"
  2071. altivec_deps="ppc"
  2072. dcbzl_deps="ppc"
  2073. ldbrx_deps="ppc"
  2074. ppc4xx_deps="ppc"
  2075. vsx_deps="altivec"
  2076. power8_deps="vsx"
  2077. cpunop_deps="i686"
  2078. x86_64_select="i686"
  2079. x86_64_suggest="fast_cmov"
  2080. amd3dnow_deps="mmx"
  2081. amd3dnowext_deps="amd3dnow"
  2082. i686_deps="x86"
  2083. mmx_deps="x86"
  2084. mmxext_deps="mmx"
  2085. sse_deps="mmxext"
  2086. sse2_deps="sse"
  2087. sse3_deps="sse2"
  2088. ssse3_deps="sse3"
  2089. sse4_deps="ssse3"
  2090. sse42_deps="sse4"
  2091. aesni_deps="sse42"
  2092. avx_deps="sse42"
  2093. xop_deps="avx"
  2094. fma3_deps="avx"
  2095. fma4_deps="avx"
  2096. avx2_deps="avx"
  2097. mmx_external_deps="yasm"
  2098. mmx_inline_deps="inline_asm"
  2099. mmx_suggest="mmx_external mmx_inline"
  2100. for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
  2101. eval dep=\$${ext}_deps
  2102. eval ${ext}_external_deps='"${dep}_external"'
  2103. eval ${ext}_inline_deps='"${dep}_inline"'
  2104. eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
  2105. done
  2106. aligned_stack_if_any="aarch64 ppc x86"
  2107. fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  2108. fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
  2109. fast_unaligned_if_any="aarch64 ppc x86"
  2110. simd_align_16_if_any="altivec neon sse"
  2111. simd_align_32_if_any="avx"
  2112. # system capabilities
  2113. symver_if_any="symver_asm_label symver_gnu_asm"
  2114. valgrind_backtrace_deps="!optimizations valgrind_valgrind_h"
  2115. # threading support
  2116. atomics_gcc_if="sync_val_compare_and_swap"
  2117. atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
  2118. atomics_win32_if="MemoryBarrier"
  2119. atomics_native_if_any="$ATOMICS_LIST"
  2120. w32threads_deps="atomics_native"
  2121. threads_if_any="$THREADS_LIST"
  2122. # subsystems
  2123. dct_select="rdft"
  2124. dirac_parse_select="golomb"
  2125. error_resilience_select="me_cmp"
  2126. faandct_deps="faan fdctdsp"
  2127. faanidct_deps="faan idctdsp"
  2128. h264dsp_select="startcode"
  2129. frame_thread_encoder_deps="encoders threads"
  2130. intrax8_select="blockdsp idctdsp"
  2131. mdct_select="fft"
  2132. mdct15_select="fft"
  2133. me_cmp_select="fdctdsp idctdsp pixblockdsp"
  2134. mpeg_er_select="error_resilience"
  2135. mpegaudio_select="mpegaudiodsp"
  2136. mpegaudiodsp_select="dct"
  2137. mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp me_cmp mpeg_er videodsp"
  2138. mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
  2139. vc1dsp_select="h264chroma qpeldsp startcode"
  2140. rdft_select="fft"
  2141. # decoders / encoders
  2142. aac_decoder_select="mdct15 mdct sinewin"
  2143. aac_fixed_decoder_select="mdct sinewin"
  2144. aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin"
  2145. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  2146. ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
  2147. ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp mdct"
  2148. ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
  2149. ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
  2150. adpcm_g722_decoder_select="g722dsp"
  2151. adpcm_g722_encoder_select="g722dsp"
  2152. aic_decoder_select="golomb idctdsp"
  2153. alac_encoder_select="lpc"
  2154. als_decoder_select="bswapdsp"
  2155. amrnb_decoder_select="lsp"
  2156. amrwb_decoder_select="lsp"
  2157. amv_decoder_select="sp5x_decoder exif"
  2158. amv_encoder_select="aandcttables jpegtables mpegvideoenc"
  2159. ape_decoder_select="bswapdsp llauddsp"
  2160. apng_decoder_select="zlib"
  2161. apng_encoder_select="llvidencdsp zlib"
  2162. asv1_decoder_select="blockdsp bswapdsp idctdsp"
  2163. asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
  2164. asv2_decoder_select="blockdsp bswapdsp idctdsp"
  2165. asv2_encoder_select="bswapdsp fdctdsp pixblockdsp"
  2166. atrac1_decoder_select="mdct sinewin"
  2167. atrac3_decoder_select="mdct"
  2168. atrac3p_decoder_select="mdct sinewin"
  2169. avrn_decoder_select="exif jpegtables"
  2170. bink_decoder_select="blockdsp hpeldsp"
  2171. binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
  2172. binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
  2173. cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
  2174. cllc_decoder_select="bswapdsp"
  2175. comfortnoise_encoder_select="lpc"
  2176. cook_decoder_select="audiodsp mdct sinewin"
  2177. cscd_decoder_select="lzo"
  2178. cscd_decoder_suggest="zlib"
  2179. dca_decoder_select="mdct"
  2180. dds_decoder_select="texturedsp"
  2181. dirac_decoder_select="dirac_parse dwt golomb videodsp mpegvideoenc"
  2182. dnxhd_decoder_select="blockdsp idctdsp"
  2183. dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
  2184. dvvideo_decoder_select="dvprofile idctdsp"
  2185. dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
  2186. dxa_decoder_select="zlib"
  2187. dxv_decoder_select="lzf texturedsp"
  2188. eac3_decoder_select="ac3_decoder"
  2189. eac3_encoder_select="ac3_encoder"
  2190. eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
  2191. eatgq_decoder_select="aandcttables"
  2192. eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
  2193. exr_decoder_select="zlib"
  2194. ffv1_decoder_select="golomb rangecoder"
  2195. ffv1_encoder_select="rangecoder"
  2196. ffvhuff_decoder_select="huffyuv_decoder"
  2197. ffvhuff_encoder_select="huffyuv_encoder"
  2198. fic_decoder_select="golomb"
  2199. flac_decoder_select="flacdsp golomb"
  2200. flac_encoder_select="bswapdsp flacdsp golomb lpc"
  2201. flashsv2_decoder_select="zlib"
  2202. flashsv2_encoder_select="zlib"
  2203. flashsv_decoder_select="zlib"
  2204. flashsv_encoder_select="zlib"
  2205. flv_decoder_select="h263_decoder"
  2206. flv_encoder_select="h263_encoder"
  2207. fourxm_decoder_select="blockdsp bswapdsp"
  2208. fraps_decoder_select="bswapdsp huffman"
  2209. g2m_decoder_select="blockdsp idctdsp jpegtables zlib"
  2210. g729_decoder_select="audiodsp"
  2211. h261_decoder_select="mpegvideo"
  2212. h261_encoder_select="aandcttables mpegvideoenc"
  2213. h263_decoder_select="h263_parser h263dsp mpegvideo qpeldsp"
  2214. h263_encoder_select="aandcttables h263dsp mpegvideoenc"
  2215. h263i_decoder_select="h263_decoder"
  2216. h263p_decoder_select="h263_decoder"
  2217. h263p_encoder_select="h263_encoder"
  2218. h264_decoder_select="cabac golomb h264chroma h264dsp h264parse h264pred h264qpel videodsp"
  2219. h264_decoder_suggest="error_resilience"
  2220. hap_decoder_select="snappy texturedsp"
  2221. hap_encoder_deps="libsnappy"
  2222. hap_encoder_select="texturedspenc"
  2223. hevc_decoder_select="bswapdsp cabac golomb videodsp"
  2224. huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
  2225. huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp"
  2226. iac_decoder_select="imc_decoder"
  2227. imc_decoder_select="bswapdsp fft mdct sinewin"
  2228. indeo3_decoder_select="hpeldsp"
  2229. indeo4_decoder_select="ividsp"
  2230. indeo5_decoder_select="ividsp"
  2231. interplay_video_decoder_select="hpeldsp"
  2232. jpegls_decoder_select="golomb mjpeg_decoder"
  2233. jpegls_encoder_select="golomb"
  2234. jv_decoder_select="blockdsp"
  2235. lagarith_decoder_select="llviddsp"
  2236. ljpeg_encoder_select="aandcttables idctdsp jpegtables mpegvideoenc"
  2237. loco_decoder_select="golomb"
  2238. magicyuv_decoder_select="llviddsp"
  2239. mdec_decoder_select="blockdsp idctdsp mpegvideo"
  2240. metasound_decoder_select="lsp mdct sinewin"
  2241. mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
  2242. mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables"
  2243. mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc"
  2244. mjpegb_decoder_select="mjpeg_decoder"
  2245. mlp_decoder_select="mlp_parser"
  2246. motionpixels_decoder_select="bswapdsp"
  2247. mp1_decoder_select="mpegaudio"
  2248. mp1float_decoder_select="mpegaudio"
  2249. mp2_decoder_select="mpegaudio"
  2250. mp2float_decoder_select="mpegaudio"
  2251. mp3_decoder_select="mpegaudio"
  2252. mp3adu_decoder_select="mpegaudio"
  2253. mp3adufloat_decoder_select="mpegaudio"
  2254. mp3float_decoder_select="mpegaudio"
  2255. mp3on4_decoder_select="mpegaudio"
  2256. mp3on4float_decoder_select="mpegaudio"
  2257. mpc7_decoder_select="bswapdsp mpegaudiodsp"
  2258. mpc8_decoder_select="mpegaudiodsp"
  2259. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  2260. mpeg_xvmc_decoder_select="mpeg2video_decoder"
  2261. mpegvideo_decoder_select="mpegvideo"
  2262. mpeg1video_decoder_select="mpegvideo"
  2263. mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp"
  2264. mpeg2video_decoder_select="mpegvideo"
  2265. mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp"
  2266. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  2267. mpeg4_encoder_select="h263_encoder"
  2268. msa1_decoder_select="mss34dsp"
  2269. msmpeg4v1_decoder_select="h263_decoder"
  2270. msmpeg4v2_decoder_select="h263_decoder"
  2271. msmpeg4v2_encoder_select="h263_encoder"
  2272. msmpeg4v3_decoder_select="h263_decoder"
  2273. msmpeg4v3_encoder_select="h263_encoder"
  2274. mss2_decoder_select="vc1_decoder mpegvideo"
  2275. mts2_decoder_select="mss34dsp"
  2276. mxpeg_decoder_select="mjpeg_decoder"
  2277. nellymoser_decoder_select="mdct sinewin"
  2278. nellymoser_encoder_select="audio_frame_queue mdct sinewin"
  2279. nuv_decoder_select="idctdsp lzo"
  2280. on2avc_decoder_select="mdct"
  2281. opus_decoder_deps="swresample"
  2282. opus_decoder_select="mdct15"
  2283. opus_encoder_select="audio_frame_queue mdct15"
  2284. png_decoder_select="zlib"
  2285. png_encoder_select="llvidencdsp zlib"
  2286. prores_decoder_select="blockdsp idctdsp"
  2287. prores_encoder_select="fdctdsp"
  2288. qcelp_decoder_select="lsp"
  2289. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  2290. ra_144_decoder_select="audiodsp"
  2291. ra_144_encoder_select="audio_frame_queue lpc audiodsp"
  2292. ralf_decoder_select="golomb"
  2293. rawvideo_decoder_select="bswapdsp"
  2294. rscc_decoder_select="zlib"
  2295. rtjpeg_decoder_select="me_cmp"
  2296. rv10_decoder_select="h263_decoder"
  2297. rv10_encoder_select="h263_encoder"
  2298. rv20_decoder_select="h263_decoder"
  2299. rv20_encoder_select="h263_encoder"
  2300. rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
  2301. rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
  2302. screenpresso_decoder_select="zlib"
  2303. shorten_decoder_select="golomb bswapdsp"
  2304. sipr_decoder_select="lsp"
  2305. snow_decoder_select="dwt h264qpel hpeldsp me_cmp rangecoder videodsp"
  2306. snow_encoder_select="aandcttables dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder"
  2307. sonic_decoder_select="golomb rangecoder"
  2308. sonic_encoder_select="golomb rangecoder"
  2309. sonic_ls_encoder_select="golomb rangecoder"
  2310. sp5x_decoder_select="mjpeg_decoder"
  2311. svq1_decoder_select="hpeldsp"
  2312. svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
  2313. svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp videodsp"
  2314. svq3_decoder_suggest="zlib"
  2315. tak_decoder_select="audiodsp"
  2316. tdsc_decoder_select="zlib mjpeg_decoder"
  2317. theora_decoder_select="vp3_decoder"
  2318. thp_decoder_select="mjpeg_decoder"
  2319. tiff_decoder_suggest="zlib lzma"
  2320. tiff_encoder_suggest="zlib"
  2321. truehd_decoder_select="mlp_parser"
  2322. truemotion2_decoder_select="bswapdsp"
  2323. truespeech_decoder_select="bswapdsp"
  2324. tscc_decoder_select="zlib"
  2325. twinvq_decoder_select="mdct lsp sinewin"
  2326. txd_decoder_select="texturedsp"
  2327. utvideo_decoder_select="bswapdsp llviddsp"
  2328. utvideo_encoder_select="bswapdsp huffman llvidencdsp"
  2329. vble_decoder_select="llviddsp"
  2330. vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 mpegvideo vc1dsp"
  2331. vc1_qsv_decoder_deps="libmfx"
  2332. vc1_qsv_decoder_select="qsvdec vc1_qsv_hwaccel vc1_parser"
  2333. vc1image_decoder_select="vc1_decoder"
  2334. vorbis_decoder_select="mdct"
  2335. vorbis_encoder_select="mdct"
  2336. vp3_decoder_select="hpeldsp vp3dsp videodsp"
  2337. vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp"
  2338. vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp vp56dsp"
  2339. vp6a_decoder_select="vp6_decoder"
  2340. vp6f_decoder_select="vp6_decoder"
  2341. vp7_decoder_select="h264pred videodsp vp8dsp"
  2342. vp8_decoder_select="h264pred videodsp vp8dsp"
  2343. vp9_decoder_select="videodsp vp9_parser"
  2344. webp_decoder_select="vp8_decoder exif"
  2345. wmalossless_decoder_select="llauddsp"
  2346. wmapro_decoder_select="mdct sinewin wma_freqs"
  2347. wmav1_decoder_select="mdct sinewin wma_freqs"
  2348. wmav1_encoder_select="mdct sinewin wma_freqs"
  2349. wmav2_decoder_select="mdct sinewin wma_freqs"
  2350. wmav2_encoder_select="mdct sinewin wma_freqs"
  2351. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  2352. wmv1_decoder_select="h263_decoder"
  2353. wmv1_encoder_select="h263_encoder"
  2354. wmv2_decoder_select="blockdsp error_resilience h263_decoder idctdsp intrax8 videodsp wmv2dsp"
  2355. wmv2_encoder_select="h263_encoder wmv2dsp"
  2356. wmv3_decoder_select="vc1_decoder"
  2357. wmv3image_decoder_select="wmv3_decoder"
  2358. xma1_decoder_select="wmapro_decoder"
  2359. xma2_decoder_select="wmapro_decoder"
  2360. zerocodec_decoder_select="zlib"
  2361. zlib_decoder_select="zlib"
  2362. zlib_encoder_select="zlib"
  2363. zmbv_decoder_select="zlib"
  2364. zmbv_encoder_select="zlib"
  2365. # platform codecs
  2366. audiotoolbox_deps="AudioToolbox_AudioToolbox_h"
  2367. audiotoolbox_extralibs="-framework CoreFoundation -framework AudioToolbox -framework CoreMedia"
  2368. # hardware accelerators
  2369. crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
  2370. cuda_deps_any="dlopen LoadLibrary"
  2371. cuvid_deps="cuda"
  2372. d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder ID3D11VideoContext"
  2373. dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode"
  2374. dxva2_extralibs="-luser32"
  2375. vaapi_deps="va_va_h"
  2376. vda_framework_deps="VideoDecodeAcceleration_VDADecoder_h"
  2377. vda_framework_extralibs="-framework VideoDecodeAcceleration"
  2378. vda_deps="vda_framework pthreads"
  2379. vda_extralibs="-framework CoreFoundation -framework QuartzCore"
  2380. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  2381. videotoolbox_hwaccel_deps="videotoolbox pthreads"
  2382. videotoolbox_hwaccel_extralibs="-framework QuartzCore"
  2383. xvmc_deps="X11_extensions_XvMClib_h"
  2384. h263_vaapi_hwaccel_deps="vaapi"
  2385. h263_vaapi_hwaccel_select="h263_decoder"
  2386. h263_videotoolbox_hwaccel_deps="videotoolbox"
  2387. h263_videotoolbox_hwaccel_select="h263_decoder"
  2388. h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
  2389. h264_cuvid_hwaccel_deps="cuda cuvid"
  2390. h264_cuvid_hwaccel_select="h264_cuvid_decoder"
  2391. h264_d3d11va_hwaccel_deps="d3d11va"
  2392. h264_d3d11va_hwaccel_select="h264_decoder"
  2393. h264_dxva2_hwaccel_deps="dxva2"
  2394. h264_dxva2_hwaccel_select="h264_decoder"
  2395. h264_mediacodec_decoder_deps="mediacodec"
  2396. h264_mediacodec_hwaccel_deps="mediacodec"
  2397. h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser"
  2398. h264_mmal_decoder_deps="mmal"
  2399. h264_mmal_decoder_select="mmal"
  2400. h264_mmal_hwaccel_deps="mmal"
  2401. h264_omx_encoder_deps="omx"
  2402. h264_qsv_hwaccel_deps="libmfx"
  2403. h264_vaapi_hwaccel_deps="vaapi"
  2404. h264_vaapi_hwaccel_select="h264_decoder"
  2405. h264_vda_decoder_deps="vda"
  2406. h264_vda_decoder_select="h264_decoder"
  2407. h264_vda_hwaccel_deps="vda"
  2408. h264_vda_hwaccel_select="h264_decoder"
  2409. h264_vda_old_hwaccel_deps="vda"
  2410. h264_vda_old_hwaccel_select="h264_decoder"
  2411. h264_vdpau_decoder_deps="vdpau"
  2412. h264_vdpau_decoder_select="h264_decoder"
  2413. h264_vdpau_hwaccel_deps="vdpau"
  2414. h264_vdpau_hwaccel_select="h264_decoder"
  2415. h264_videotoolbox_hwaccel_deps="videotoolbox"
  2416. h264_videotoolbox_hwaccel_select="h264_decoder"
  2417. hevc_cuvid_hwaccel_deps="cuda cuvid"
  2418. hevc_cuvid_hwaccel_select="hevc_cuvid_decoder"
  2419. hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
  2420. hevc_d3d11va_hwaccel_select="hevc_decoder"
  2421. hevc_mediacodec_decoder_deps="mediacodec"
  2422. hevc_mediacodec_hwaccel_deps="mediacodec"
  2423. hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser"
  2424. hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
  2425. hevc_dxva2_hwaccel_select="hevc_decoder"
  2426. hevc_qsv_hwaccel_deps="libmfx"
  2427. hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
  2428. hevc_vaapi_hwaccel_select="hevc_decoder"
  2429. hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
  2430. hevc_vdpau_hwaccel_select="hevc_decoder"
  2431. mjpeg_cuvid_hwaccel_deps="cuda cuvid"
  2432. mjpeg_cuvid_hwaccel_select="mjpeg_cuvid_decoder"
  2433. mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
  2434. mjpeg_vaapi_encoder_select="vaapi_encode jpegtables"
  2435. mpeg_vdpau_decoder_deps="vdpau"
  2436. mpeg_vdpau_decoder_select="mpeg2video_decoder"
  2437. mpeg_xvmc_hwaccel_deps="xvmc"
  2438. mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
  2439. mpeg1_cuvid_hwaccel_deps="cuda cuvid"
  2440. mpeg1_cuvid_hwaccel_select="mpeg1_cuvid_decoder"
  2441. mpeg1_vdpau_decoder_deps="vdpau"
  2442. mpeg1_vdpau_decoder_select="mpeg1video_decoder"
  2443. mpeg1_vdpau_hwaccel_deps="vdpau"
  2444. mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
  2445. mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
  2446. mpeg1_videotoolbox_hwaccel_select="mpeg1video_decoder"
  2447. mpeg1_xvmc_hwaccel_deps="xvmc"
  2448. mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
  2449. mpeg2_crystalhd_decoder_select="crystalhd"
  2450. mpeg2_cuvid_hwaccel_deps="cuda cuvid"
  2451. mpeg2_cuvid_hwaccel_select="mpeg2_cuvid_decoder"
  2452. mpeg2_d3d11va_hwaccel_deps="d3d11va"
  2453. mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
  2454. mpeg2_dxva2_hwaccel_deps="dxva2"
  2455. mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
  2456. mpeg2_mmal_decoder_deps="mmal"
  2457. mpeg2_mmal_decoder_select="mmal"
  2458. mpeg2_mmal_hwaccel_deps="mmal"
  2459. mpeg2_qsv_hwaccel_deps="libmfx"
  2460. mpeg2_qsv_hwaccel_select="qsvdec_mpeg2"
  2461. mpeg2_vaapi_hwaccel_deps="vaapi"
  2462. mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
  2463. mpeg2_vdpau_hwaccel_deps="vdpau"
  2464. mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
  2465. mpeg2_videotoolbox_hwaccel_deps="videotoolbox"
  2466. mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder"
  2467. mpeg2_xvmc_hwaccel_deps="xvmc"
  2468. mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
  2469. mpeg4_crystalhd_decoder_select="crystalhd"
  2470. mpeg4_cuvid_hwaccel_deps="cuda cuvid"
  2471. mpeg4_cuvid_hwaccel_select="mpeg4_cuvid_decoder"
  2472. mpeg4_mediacodec_decoder_deps="mediacodec"
  2473. mpeg4_mediacodec_hwaccel_deps="mediacodec"
  2474. mpeg4_mmal_decoder_deps="mmal"
  2475. mpeg4_mmal_decoder_select="mmal"
  2476. mpeg4_mmal_hwaccel_deps="mmal"
  2477. mpeg4_omx_encoder_deps="omx"
  2478. mpeg4_vaapi_hwaccel_deps="vaapi"
  2479. mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
  2480. mpeg4_vdpau_decoder_deps="vdpau"
  2481. mpeg4_vdpau_decoder_select="mpeg4_decoder"
  2482. mpeg4_vdpau_hwaccel_deps="vdpau"
  2483. mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
  2484. mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
  2485. mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
  2486. msmpeg4_crystalhd_decoder_select="crystalhd"
  2487. vc1_crystalhd_decoder_select="crystalhd"
  2488. vc1_cuvid_hwaccel_deps="cuda cuvid"
  2489. vc1_cuvid_hwaccel_select="vc1_cuvid_decoder"
  2490. vc1_d3d11va_hwaccel_deps="d3d11va"
  2491. vc1_d3d11va_hwaccel_select="vc1_decoder"
  2492. vc1_dxva2_hwaccel_deps="dxva2"
  2493. vc1_dxva2_hwaccel_select="vc1_decoder"
  2494. vc1_mmal_decoder_deps="mmal"
  2495. vc1_mmal_decoder_select="mmal"
  2496. vc1_mmal_hwaccel_deps="mmal"
  2497. vc1_qsv_hwaccel_deps="libmfx"
  2498. vc1_qsv_hwaccel_select="qsvdec_vc1"
  2499. vc1_vaapi_hwaccel_deps="vaapi"
  2500. vc1_vaapi_hwaccel_select="vc1_decoder"
  2501. vc1_vdpau_decoder_deps="vdpau"
  2502. vc1_vdpau_decoder_select="vc1_decoder"
  2503. vc1_vdpau_hwaccel_deps="vdpau"
  2504. vc1_vdpau_hwaccel_select="vc1_decoder"
  2505. vp8_cuvid_hwaccel_deps="cuda cuvid"
  2506. vp8_cuvid_hwaccel_select="vp8_cuvid_decoder"
  2507. vp9_cuvid_hwaccel_deps="cuda cuvid"
  2508. vp9_cuvid_hwaccel_select="vp9_cuvid_decoder"
  2509. vp8_mediacodec_decoder_deps="mediacodec"
  2510. vp8_mediacodec_hwaccel_deps="mediacodec"
  2511. vp8_qsv_hwaccel_deps="libmfx"
  2512. vp9_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_VP9"
  2513. vp9_d3d11va_hwaccel_select="vp9_decoder"
  2514. vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
  2515. vp9_dxva2_hwaccel_select="vp9_decoder"
  2516. vp9_mediacodec_decoder_deps="mediacodec"
  2517. vp9_mediacodec_hwaccel_deps="mediacodec"
  2518. vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth"
  2519. vp9_vaapi_hwaccel_select="vp9_decoder"
  2520. wmv3_crystalhd_decoder_select="crystalhd"
  2521. wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
  2522. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  2523. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  2524. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  2525. wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
  2526. # hardware-accelerated codecs
  2527. omx_deps="dlopen pthreads"
  2528. omx_extralibs='$ldl'
  2529. qsvdec_select="qsv"
  2530. qsvenc_select="qsv"
  2531. vaapi_encode_deps="vaapi"
  2532. hwupload_cuda_filter_deps="cuda"
  2533. scale_npp_filter_deps="cuda libnpp"
  2534. nvenc_deps="cuda"
  2535. nvenc_deps_any="dlopen LoadLibrary"
  2536. nvenc_encoder_deps="nvenc"
  2537. h264_cuvid_decoder_deps="cuda cuvid"
  2538. h264_cuvid_decoder_select="h264_mp4toannexb_bsf"
  2539. h264_nvenc_encoder_deps="nvenc"
  2540. h264_qsv_decoder_deps="libmfx"
  2541. h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel"
  2542. h264_qsv_encoder_deps="libmfx"
  2543. h264_qsv_encoder_select="qsvenc"
  2544. h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
  2545. h264_vaapi_encoder_select="vaapi_encode golomb"
  2546. hevc_cuvid_decoder_deps="cuda cuvid"
  2547. hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
  2548. hevc_nvenc_encoder_deps="nvenc"
  2549. hevc_qsv_decoder_deps="libmfx"
  2550. hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec hevc_qsv_hwaccel"
  2551. hevc_qsv_encoder_deps="libmfx"
  2552. hevc_qsv_encoder_select="qsvenc"
  2553. hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
  2554. hevc_vaapi_encoder_select="vaapi_encode golomb"
  2555. mjpeg_cuvid_decoder_deps="cuda cuvid"
  2556. mpeg1_cuvid_decoder_deps="cuda cuvid"
  2557. mpeg2_cuvid_decoder_deps="cuda cuvid"
  2558. mpeg2_qsv_decoder_deps="libmfx"
  2559. mpeg2_qsv_decoder_select="qsvdec mpeg2_qsv_hwaccel"
  2560. mpeg2_qsv_encoder_deps="libmfx"
  2561. mpeg2_qsv_encoder_select="qsvenc"
  2562. mpeg2_vaapi_encoder_deps="VAEncPictureParameterBufferMPEG2"
  2563. mpeg2_vaapi_encoder_select="vaapi_encode"
  2564. mpeg4_cuvid_decoder_deps="cuda cuvid"
  2565. nvenc_h264_encoder_deps="nvenc"
  2566. nvenc_hevc_encoder_deps="nvenc"
  2567. vc1_cuvid_decoder_deps="cuda cuvid"
  2568. vp8_cuvid_decoder_deps="cuda cuvid"
  2569. vp8_qsv_decoder_deps="libmfx"
  2570. vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser"
  2571. vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
  2572. vp8_vaapi_encoder_select="vaapi_encode"
  2573. vp9_cuvid_decoder_deps="cuda cuvid"
  2574. # parsers
  2575. h264_parser_select="golomb h264dsp h264parse"
  2576. hevc_parser_select="golomb"
  2577. mpegvideo_parser_select="mpegvideo"
  2578. mpeg4video_parser_select="h263dsp mpegvideo qpeldsp"
  2579. vc1_parser_select="vc1dsp"
  2580. # bitstream_filters
  2581. mjpeg2jpeg_bsf_select="jpegtables"
  2582. # external libraries
  2583. aac_at_decoder_deps="audiotoolbox"
  2584. ac3_at_decoder_deps="audiotoolbox"
  2585. ac3_at_decoder_select="ac3_parser"
  2586. adpcm_ima_qt_at_decoder_deps="audiotoolbox"
  2587. alac_at_decoder_deps="audiotoolbox"
  2588. amr_nb_at_decoder_deps="audiotoolbox"
  2589. avisynth_deps_any="dlopen LoadLibrary"
  2590. avisynth_demuxer_deps="avisynth"
  2591. avisynth_demuxer_select="riffdec"
  2592. eac3_at_decoder_deps="audiotoolbox"
  2593. eac3_at_decoder_select="ac3_parser"
  2594. gsm_ms_at_decoder_deps="audiotoolbox"
  2595. ilbc_at_decoder_deps="audiotoolbox"
  2596. mp1_at_decoder_deps="audiotoolbox"
  2597. mp2_at_decoder_deps="audiotoolbox"
  2598. mp3_at_decoder_deps="audiotoolbox"
  2599. pcm_alaw_at_decoder_deps="audiotoolbox"
  2600. pcm_mulaw_at_decoder_deps="audiotoolbox"
  2601. qdmc_at_decoder_deps="audiotoolbox"
  2602. qdm2_at_decoder_deps="audiotoolbox"
  2603. aac_at_encoder_deps="audiotoolbox"
  2604. aac_at_encoder_select="audio_frame_queue"
  2605. alac_at_encoder_deps="audiotoolbox"
  2606. alac_at_encoder_select="audio_frame_queue"
  2607. ilbc_at_encoder_deps="audiotoolbox"
  2608. ilbc_at_encoder_select="audio_frame_queue"
  2609. pcm_alaw_at_encoder_deps="audiotoolbox"
  2610. pcm_alaw_at_encoder_select="audio_frame_queue"
  2611. pcm_mulaw_at_encoder_deps="audiotoolbox"
  2612. pcm_mulaw_at_encoder_select="audio_frame_queue"
  2613. chromaprint_muxer_deps="chromaprint"
  2614. h264_videotoolbox_encoder_deps="videotoolbox_encoder pthreads"
  2615. libcelt_decoder_deps="libcelt"
  2616. libfdk_aac_decoder_deps="libfdk_aac"
  2617. libfdk_aac_encoder_deps="libfdk_aac"
  2618. libfdk_aac_encoder_select="audio_frame_queue"
  2619. libgme_demuxer_deps="libgme"
  2620. libgsm_decoder_deps="libgsm"
  2621. libgsm_encoder_deps="libgsm"
  2622. libgsm_ms_decoder_deps="libgsm"
  2623. libgsm_ms_encoder_deps="libgsm"
  2624. libilbc_decoder_deps="libilbc"
  2625. libilbc_encoder_deps="libilbc"
  2626. libkvazaar_encoder_deps="libkvazaar"
  2627. libmodplug_demuxer_deps="libmodplug"
  2628. libmp3lame_encoder_deps="libmp3lame"
  2629. libmp3lame_encoder_select="audio_frame_queue"
  2630. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  2631. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  2632. libopencore_amrnb_encoder_select="audio_frame_queue"
  2633. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  2634. libopenh264_decoder_deps="libopenh264"
  2635. libopenh264_decoder_select="h264_mp4toannexb_bsf"
  2636. libopenh264_encoder_deps="libopenh264"
  2637. libopenjpeg_decoder_deps="libopenjpeg"
  2638. libopenjpeg_encoder_deps="libopenjpeg"
  2639. libopenmpt_demuxer_deps="libopenmpt"
  2640. libopus_decoder_deps="libopus"
  2641. libopus_encoder_deps="libopus"
  2642. libopus_encoder_select="audio_frame_queue"
  2643. libschroedinger_decoder_deps="libschroedinger"
  2644. libschroedinger_encoder_deps="libschroedinger"
  2645. libshine_encoder_deps="libshine"
  2646. libshine_encoder_select="audio_frame_queue"
  2647. libspeex_decoder_deps="libspeex"
  2648. libspeex_encoder_deps="libspeex"
  2649. libspeex_encoder_select="audio_frame_queue"
  2650. libtheora_encoder_deps="libtheora"
  2651. libtwolame_encoder_deps="libtwolame"
  2652. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  2653. libvorbis_decoder_deps="libvorbis"
  2654. libvorbis_encoder_deps="libvorbis"
  2655. libvorbis_encoder_select="audio_frame_queue"
  2656. libvpx_vp8_decoder_deps="libvpx"
  2657. libvpx_vp8_encoder_deps="libvpx"
  2658. libvpx_vp9_decoder_deps="libvpx"
  2659. libvpx_vp9_encoder_deps="libvpx"
  2660. libwavpack_encoder_deps="libwavpack"
  2661. libwebp_encoder_deps="libwebp"
  2662. libwebp_anim_encoder_deps="libwebp"
  2663. libx262_encoder_deps="libx262"
  2664. libx264_encoder_deps="libx264"
  2665. libx264rgb_encoder_deps="libx264 x264_csp_bgr"
  2666. libx264rgb_encoder_select="libx264_encoder"
  2667. libx265_encoder_deps="libx265"
  2668. libxavs_encoder_deps="libxavs"
  2669. libxvid_encoder_deps="libxvid"
  2670. libzvbi_teletext_decoder_deps="libzvbi"
  2671. videotoolbox_deps="VideoToolbox_VideoToolbox_h"
  2672. videotoolbox_extralibs="-framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework CoreVideo"
  2673. videotoolbox_encoder_deps="videotoolbox VTCompressionSessionPrepareToEncodeFrames"
  2674. videotoolbox_encoder_suggest="vda_framework vt_bt2020"
  2675. vt_bt2020_deps="kCVImageBufferColorPrimaries_ITU_R_2020"
  2676. # demuxers / muxers
  2677. ac3_demuxer_select="ac3_parser"
  2678. aiff_muxer_select="iso_media"
  2679. asf_demuxer_select="riffdec"
  2680. asf_o_demuxer_select="riffdec"
  2681. asf_muxer_select="riffenc"
  2682. asf_stream_muxer_select="asf_muxer"
  2683. avi_demuxer_select="iso_media riffdec exif"
  2684. avi_muxer_select="riffenc"
  2685. caf_demuxer_select="iso_media riffdec"
  2686. caf_muxer_select="iso_media"
  2687. dash_muxer_select="mp4_muxer"
  2688. dirac_demuxer_select="dirac_parser"
  2689. dts_demuxer_select="dca_parser"
  2690. dtshd_demuxer_select="dca_parser"
  2691. dv_demuxer_select="dvprofile"
  2692. dv_muxer_select="dvprofile"
  2693. dxa_demuxer_select="riffdec"
  2694. eac3_demuxer_select="ac3_parser"
  2695. f4v_muxer_select="mov_muxer"
  2696. fifo_muxer_deps="threads"
  2697. flac_demuxer_select="flac_parser"
  2698. hds_muxer_select="flv_muxer"
  2699. hls_muxer_select="mpegts_muxer"
  2700. image2_alias_pix_demuxer_select="image2_demuxer"
  2701. image2_brender_pix_demuxer_select="image2_demuxer"
  2702. ipod_muxer_select="mov_muxer"
  2703. ismv_muxer_select="mov_muxer"
  2704. libnut_demuxer_deps="libnut"
  2705. libnut_muxer_deps="libnut"
  2706. matroska_audio_muxer_select="matroska_muxer"
  2707. matroska_demuxer_select="iso_media riffdec"
  2708. matroska_demuxer_suggest="bzlib lzo zlib"
  2709. matroska_muxer_select="iso_media riffenc"
  2710. mmf_muxer_select="riffenc"
  2711. mov_demuxer_select="iso_media riffdec"
  2712. mov_demuxer_suggest="zlib"
  2713. mov_muxer_select="iso_media riffenc rtpenc_chain"
  2714. mp3_demuxer_select="mpegaudio_parser"
  2715. mp4_muxer_select="mov_muxer"
  2716. mpegts_demuxer_select="iso_media"
  2717. mpegts_muxer_select="adts_muxer latm_muxer"
  2718. mpegtsraw_demuxer_select="mpegts_demuxer"
  2719. mxf_d10_muxer_select="mxf_muxer"
  2720. mxf_opatom_muxer_select="mxf_muxer"
  2721. nut_muxer_select="riffenc"
  2722. nuv_demuxer_select="riffdec"
  2723. oga_muxer_select="ogg_muxer"
  2724. ogg_demuxer_select="dirac_parse"
  2725. ogv_muxer_select="ogg_muxer"
  2726. opus_muxer_select="ogg_muxer"
  2727. psp_muxer_select="mov_muxer"
  2728. rtp_demuxer_select="sdp_demuxer"
  2729. rtp_muxer_select="golomb"
  2730. rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
  2731. rtsp_demuxer_select="http_protocol rtpdec"
  2732. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  2733. sap_demuxer_select="sdp_demuxer"
  2734. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  2735. sdp_demuxer_select="rtpdec"
  2736. smoothstreaming_muxer_select="ismv_muxer"
  2737. spdif_muxer_select="aac_parser"
  2738. spx_muxer_select="ogg_muxer"
  2739. swf_demuxer_suggest="zlib"
  2740. tak_demuxer_select="tak_parser"
  2741. tg2_muxer_select="mov_muxer"
  2742. tgp_muxer_select="mov_muxer"
  2743. vobsub_demuxer_select="mpegps_demuxer"
  2744. w64_demuxer_select="wav_demuxer"
  2745. w64_muxer_select="wav_muxer"
  2746. wav_demuxer_select="riffdec"
  2747. wav_muxer_select="riffenc"
  2748. webm_muxer_select="iso_media riffenc"
  2749. webm_dash_manifest_demuxer_select="matroska_demuxer"
  2750. wtv_demuxer_select="mpegts_demuxer riffdec"
  2751. wtv_muxer_select="mpegts_muxer riffenc"
  2752. xmv_demuxer_select="riffdec"
  2753. xwma_demuxer_select="riffdec"
  2754. # indevs / outdevs
  2755. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  2756. alsa_outdev_deps="alsa_asoundlib_h"
  2757. avfoundation_indev_extralibs="-framework CoreVideo -framework Foundation -framework AVFoundation -framework CoreMedia"
  2758. avfoundation_indev_select="avfoundation"
  2759. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  2760. caca_outdev_deps="libcaca"
  2761. decklink_indev_deps="decklink pthreads"
  2762. decklink_indev_extralibs="-lstdc++"
  2763. decklink_outdev_deps="decklink pthreads"
  2764. decklink_outdev_extralibs="-lstdc++"
  2765. dshow_indev_deps="IBaseFilter"
  2766. dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi"
  2767. dv1394_indev_deps="dv1394"
  2768. dv1394_indev_select="dv_demuxer"
  2769. fbdev_indev_deps="linux_fb_h"
  2770. fbdev_outdev_deps="linux_fb_h"
  2771. gdigrab_indev_deps="CreateDIBSection"
  2772. gdigrab_indev_extralibs="-lgdi32"
  2773. gdigrab_indev_select="bmp_decoder"
  2774. iec61883_indev_deps="libiec61883"
  2775. jack_indev_deps="jack_jack_h"
  2776. jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
  2777. lavfi_indev_deps="avfilter"
  2778. libcdio_indev_deps="libcdio"
  2779. libdc1394_indev_deps="libdc1394"
  2780. libv4l2_indev_deps="libv4l2"
  2781. openal_indev_deps="openal"
  2782. opengl_outdev_deps="opengl"
  2783. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  2784. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  2785. pulse_indev_deps="libpulse"
  2786. pulse_outdev_deps="libpulse"
  2787. qtkit_indev_extralibs="-framework QTKit -framework Foundation -framework QuartzCore"
  2788. qtkit_indev_select="qtkit"
  2789. sdl2_outdev_deps="sdl2"
  2790. sndio_indev_deps="sndio_h"
  2791. sndio_outdev_deps="sndio_h"
  2792. v4l_indev_deps="linux_videodev_h"
  2793. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  2794. v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
  2795. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  2796. vfwcap_indev_extralibs="-lavicap32"
  2797. xcbgrab_indev_deps="libxcb"
  2798. xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
  2799. xv_outdev_extralibs="-lXv -lX11 -lXext"
  2800. # protocols
  2801. async_protocol_deps="threads"
  2802. bluray_protocol_deps="libbluray"
  2803. ffrtmpcrypt_protocol_deps="!librtmp_protocol"
  2804. ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
  2805. ffrtmpcrypt_protocol_select="tcp_protocol"
  2806. ffrtmphttp_protocol_deps="!librtmp_protocol"
  2807. ffrtmphttp_protocol_select="http_protocol"
  2808. ftp_protocol_select="tcp_protocol"
  2809. gopher_protocol_select="network"
  2810. http_protocol_select="tcp_protocol"
  2811. httpproxy_protocol_select="tcp_protocol"
  2812. https_protocol_select="tls_protocol"
  2813. icecast_protocol_select="http_protocol"
  2814. librtmp_protocol_deps="librtmp"
  2815. librtmpe_protocol_deps="librtmp"
  2816. librtmps_protocol_deps="librtmp"
  2817. librtmpt_protocol_deps="librtmp"
  2818. librtmpte_protocol_deps="librtmp"
  2819. libsmbclient_protocol_deps="libsmbclient gplv3"
  2820. libssh_protocol_deps="libssh"
  2821. mmsh_protocol_select="http_protocol"
  2822. mmst_protocol_select="network"
  2823. rtmp_protocol_deps="!librtmp_protocol"
  2824. rtmp_protocol_select="tcp_protocol"
  2825. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  2826. rtmps_protocol_deps="!librtmp_protocol"
  2827. rtmps_protocol_select="tls_protocol"
  2828. rtmpt_protocol_select="ffrtmphttp_protocol"
  2829. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  2830. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  2831. rtp_protocol_select="udp_protocol"
  2832. sctp_protocol_deps="struct_sctp_event_subscribe struct_msghdr_msg_flags"
  2833. sctp_protocol_select="network"
  2834. srtp_protocol_select="rtp_protocol srtp"
  2835. tcp_protocol_select="network"
  2836. tls_gnutls_protocol_deps="gnutls !tls_schannel_protocol !tls_securetransport_protocol"
  2837. tls_gnutls_protocol_select="tcp_protocol"
  2838. tls_openssl_protocol_deps="openssl !tls_schannel_protocol !tls_securetransport_protocol !tls_gnutls_protocol"
  2839. tls_openssl_protocol_select="tcp_protocol"
  2840. tls_schannel_protocol_deps="schannel"
  2841. tls_schannel_protocol_select="tcp_protocol"
  2842. tls_securetransport_protocol_deps="securetransport"
  2843. tls_securetransport_protocol_select="tcp_protocol"
  2844. tls_protocol_deps_any="tls_schannel_protocol tls_securetransport_protocol tls_gnutls_protocol tls_openssl_protocol"
  2845. udp_protocol_select="network"
  2846. udplite_protocol_select="network"
  2847. unix_protocol_deps="sys_un_h"
  2848. unix_protocol_select="network"
  2849. # filters
  2850. afftfilt_filter_deps="avcodec"
  2851. afftfilt_filter_select="fft"
  2852. amovie_filter_deps="avcodec avformat"
  2853. aresample_filter_deps="swresample"
  2854. ass_filter_deps="libass"
  2855. atempo_filter_deps="avcodec"
  2856. atempo_filter_select="rdft"
  2857. azmq_filter_deps="libzmq"
  2858. blackframe_filter_deps="gpl"
  2859. boxblur_filter_deps="gpl"
  2860. bs2b_filter_deps="libbs2b"
  2861. colormatrix_filter_deps="gpl"
  2862. cover_rect_filter_deps="avcodec avformat gpl"
  2863. cropdetect_filter_deps="gpl"
  2864. deinterlace_qsv_filter_deps="libmfx"
  2865. deinterlace_vaapi_filter_deps="vaapi"
  2866. delogo_filter_deps="gpl"
  2867. deshake_filter_select="pixelutils"
  2868. drawtext_filter_deps="libfreetype"
  2869. eq_filter_deps="gpl"
  2870. fftfilt_filter_deps="avcodec"
  2871. fftfilt_filter_select="rdft"
  2872. find_rect_filter_deps="avcodec avformat gpl"
  2873. firequalizer_filter_deps="avcodec"
  2874. firequalizer_filter_select="rdft"
  2875. flite_filter_deps="libflite"
  2876. framerate_filter_select="pixelutils"
  2877. frei0r_filter_deps="frei0r dlopen"
  2878. frei0r_src_filter_deps="frei0r dlopen"
  2879. fspp_filter_deps="gpl"
  2880. geq_filter_deps="gpl"
  2881. histeq_filter_deps="gpl"
  2882. hqdn3d_filter_deps="gpl"
  2883. interlace_filter_deps="gpl"
  2884. kerndeint_filter_deps="gpl"
  2885. ladspa_filter_deps="ladspa dlopen"
  2886. mcdeint_filter_deps="avcodec gpl"
  2887. movie_filter_deps="avcodec avformat"
  2888. mpdecimate_filter_deps="gpl"
  2889. mpdecimate_filter_select="pixelutils"
  2890. mptestsrc_filter_deps="gpl"
  2891. negate_filter_deps="lut_filter"
  2892. nnedi_filter_deps="gpl"
  2893. ocr_filter_deps="libtesseract"
  2894. ocv_filter_deps="libopencv"
  2895. owdenoise_filter_deps="gpl"
  2896. pan_filter_deps="swresample"
  2897. perspective_filter_deps="gpl"
  2898. phase_filter_deps="gpl"
  2899. pp7_filter_deps="gpl"
  2900. pp_filter_deps="gpl postproc"
  2901. pullup_filter_deps="gpl"
  2902. removelogo_filter_deps="avcodec avformat swscale"
  2903. repeatfields_filter_deps="gpl"
  2904. resample_filter_deps="avresample"
  2905. rubberband_filter_deps="librubberband"
  2906. sab_filter_deps="gpl swscale"
  2907. scale2ref_filter_deps="swscale"
  2908. scale_filter_deps="swscale"
  2909. scale_qsv_filter_deps="libmfx"
  2910. select_filter_select="pixelutils"
  2911. showcqt_filter_deps="avcodec avformat swscale"
  2912. showcqt_filter_select="fft"
  2913. showfreqs_filter_deps="avcodec"
  2914. showfreqs_filter_select="fft"
  2915. showspectrum_filter_deps="avcodec"
  2916. showspectrum_filter_select="fft"
  2917. showspectrumpic_filter_deps="avcodec"
  2918. showspectrumpic_filter_select="fft"
  2919. signature_filter_deps="gpl avcodec avformat"
  2920. smartblur_filter_deps="gpl swscale"
  2921. sofalizer_filter_deps="netcdf avcodec"
  2922. sofalizer_filter_select="fft"
  2923. spectrumsynth_filter_deps="avcodec"
  2924. spectrumsynth_filter_select="fft"
  2925. spp_filter_deps="gpl avcodec"
  2926. spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp"
  2927. stereo3d_filter_deps="gpl"
  2928. subtitles_filter_deps="avformat avcodec libass"
  2929. super2xsai_filter_deps="gpl"
  2930. pixfmts_super2xsai_test_deps="super2xsai_filter"
  2931. tinterlace_filter_deps="gpl"
  2932. tinterlace_merge_test_deps="tinterlace_filter"
  2933. tinterlace_pad_test_deps="tinterlace_filter"
  2934. uspp_filter_deps="gpl avcodec"
  2935. vaguedenoiser_filter_deps="gpl"
  2936. vidstabdetect_filter_deps="libvidstab"
  2937. vidstabtransform_filter_deps="libvidstab"
  2938. zmq_filter_deps="libzmq"
  2939. zoompan_filter_deps="swscale"
  2940. zscale_filter_deps="libzimg"
  2941. scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
  2942. # examples
  2943. avio_dir_cmd_deps="avformat avutil"
  2944. avio_reading_deps="avformat avcodec avutil"
  2945. decode_audio_example_deps="avcodec avutil"
  2946. decode_video_example_deps="avcodec avutil"
  2947. demuxing_decoding_example_deps="avcodec avformat avutil"
  2948. encode_audio_example_deps="avcodec avutil"
  2949. encode_video_example_deps="avcodec avutil"
  2950. extract_mvs_example_deps="avcodec avformat avutil"
  2951. filter_audio_example_deps="avfilter avutil"
  2952. filtering_audio_example_deps="avfilter avcodec avformat avutil"
  2953. filtering_video_example_deps="avfilter avcodec avformat avutil"
  2954. http_multiclient_example_deps="avformat avutil fork"
  2955. metadata_example_deps="avformat avutil"
  2956. muxing_example_deps="avcodec avformat avutil swscale"
  2957. qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
  2958. remuxing_example_deps="avcodec avformat avutil"
  2959. resampling_audio_example_deps="avutil swresample"
  2960. scaling_video_example_deps="avutil swscale"
  2961. transcode_aac_example_deps="avcodec avformat swresample"
  2962. transcoding_example_deps="avfilter avcodec avformat avutil"
  2963. # libraries, in linking order
  2964. avcodec_deps="avutil"
  2965. avdevice_deps="avformat avcodec avutil"
  2966. avfilter_deps="avutil"
  2967. avformat_deps="avcodec avutil"
  2968. avresample_deps="avutil"
  2969. postproc_deps="avutil gpl"
  2970. swresample_deps="avutil"
  2971. swscale_deps="avutil"
  2972. # programs
  2973. ffmpeg_deps="avcodec avfilter avformat swresample"
  2974. ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
  2975. null_filter
  2976. trim_filter"
  2977. ffplay_deps="avcodec avformat swscale swresample sdl2"
  2978. ffplay_libs='$sdl2_libs'
  2979. ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter"
  2980. ffprobe_deps="avcodec avformat"
  2981. ffserver_deps="avformat fork sarestart"
  2982. ffserver_select="ffm_muxer rtp_protocol rtsp_demuxer"
  2983. # documentation
  2984. podpages_deps="perl"
  2985. manpages_deps="perl pod2man"
  2986. htmlpages_deps="perl"
  2987. htmlpages_deps_any="makeinfo_html texi2html"
  2988. txtpages_deps="perl makeinfo"
  2989. doc_deps_any="manpages htmlpages podpages txtpages"
  2990. # default parameters
  2991. logfile="config.log"
  2992. # installation paths
  2993. prefix_default="/usr/local"
  2994. bindir_default='${prefix}/bin'
  2995. datadir_default='${prefix}/share/ffmpeg'
  2996. docdir_default='${prefix}/share/doc/ffmpeg'
  2997. incdir_default='${prefix}/include'
  2998. libdir_default='${prefix}/lib'
  2999. mandir_default='${prefix}/share/man'
  3000. # toolchain
  3001. ar_default="ar"
  3002. cc_default="gcc"
  3003. cxx_default="g++"
  3004. host_cc_default="gcc"
  3005. cp_f="cp -f"
  3006. doxygen_default="doxygen"
  3007. install="install"
  3008. ln_s_default="ln -s -f"
  3009. nm_default="nm -g"
  3010. objformat="elf"
  3011. pkg_config_default=pkg-config
  3012. ranlib_default="ranlib"
  3013. strip_default="strip"
  3014. version_script='--version-script'
  3015. yasmexe_default="yasm"
  3016. windres_default="windres"
  3017. # OS
  3018. target_os_default=$(tolower $(uname -s))
  3019. host_os=$target_os_default
  3020. # machine
  3021. if test "$target_os_default" = aix; then
  3022. arch_default=$(uname -p)
  3023. strip_default="strip -X32_64"
  3024. else
  3025. arch_default=$(uname -m)
  3026. fi
  3027. cpu="generic"
  3028. intrinsics="none"
  3029. # configurable options
  3030. enable $PROGRAM_LIST
  3031. enable $DOCUMENT_LIST
  3032. enable $EXAMPLE_LIST
  3033. enable $(filter_out avresample $LIBRARY_LIST)
  3034. enable stripping
  3035. enable asm
  3036. enable debug
  3037. enable doc
  3038. enable faan faandct faanidct
  3039. enable optimizations
  3040. enable runtime_cpudetect
  3041. enable safe_bitstream_reader
  3042. enable static
  3043. enable swscale_alpha
  3044. enable valgrind_backtrace
  3045. sws_max_filter_size_default=256
  3046. set_default sws_max_filter_size
  3047. # build settings
  3048. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  3049. LIBPREF="lib"
  3050. LIBSUF=".a"
  3051. FULLNAME='$(NAME)$(BUILDSUF)'
  3052. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  3053. SLIBPREF="lib"
  3054. SLIBSUF=".so"
  3055. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  3056. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  3057. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  3058. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  3059. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  3060. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  3061. VERSION_SCRIPT_POSTPROCESS_CMD="cat"
  3062. asflags_filter=echo
  3063. cflags_filter=echo
  3064. ldflags_filter=echo
  3065. AS_C='-c'
  3066. AS_O='-o $@'
  3067. CC_C='-c'
  3068. CC_E='-E -o $@'
  3069. CC_O='-o $@'
  3070. CXX_C='-c'
  3071. CXX_O='-o $@'
  3072. OBJCC_C='-c'
  3073. OBJCC_E='-E -o $@'
  3074. OBJCC_O='-o $@'
  3075. LD_O='-o $@'
  3076. LD_LIB='-l%'
  3077. LD_PATH='-L'
  3078. HOSTCC_C='-c'
  3079. HOSTCC_E='-E -o $@'
  3080. HOSTCC_O='-o $@'
  3081. HOSTLD_O='-o $@'
  3082. host_libs='-lm'
  3083. host_cflags_filter=echo
  3084. host_ldflags_filter=echo
  3085. target_path='$(CURDIR)'
  3086. # since the object filename is not given with the -MM flag, the compiler
  3087. # is only able to print the basename, and we must add the path ourselves
  3088. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>/dev/null | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(@F),$(@D)/$(@F)," > $(@:.o=.d)'
  3089. DEPFLAGS='-MM'
  3090. # find source path
  3091. if test -f configure; then
  3092. source_path=.
  3093. else
  3094. source_path=$(cd $(dirname "$0"); pwd)
  3095. case "$source_path" in
  3096. *[[:blank:]]*) die "Out of tree builds are impossible with whitespace in source path." ;;
  3097. esac
  3098. test -e "$source_path/config.h" &&
  3099. die "Out of tree builds are impossible with config.h in source dir."
  3100. fi
  3101. for v in "$@"; do
  3102. r=${v#*=}
  3103. l=${v%"$r"}
  3104. r=$(sh_quote "$r")
  3105. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  3106. done
  3107. find_things(){
  3108. thing=$1
  3109. pattern=$2
  3110. file=$source_path/$3
  3111. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  3112. }
  3113. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  3114. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  3115. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  3116. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  3117. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  3118. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  3119. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  3120. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  3121. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  3122. find_things_extern(){
  3123. thing=$1
  3124. pattern=$2
  3125. file=$source_path/$3
  3126. sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file"
  3127. }
  3128. BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
  3129. PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
  3130. ALL_COMPONENTS="
  3131. $BSF_LIST
  3132. $DECODER_LIST
  3133. $DEMUXER_LIST
  3134. $ENCODER_LIST
  3135. $FILTER_LIST
  3136. $HWACCEL_LIST
  3137. $INDEV_LIST
  3138. $MUXER_LIST
  3139. $OUTDEV_LIST
  3140. $PARSER_LIST
  3141. $PROTOCOL_LIST
  3142. "
  3143. for n in $COMPONENT_LIST; do
  3144. v=$(toupper ${n%s})_LIST
  3145. eval enable \$$v
  3146. eval ${n}_if_any="\$$v"
  3147. done
  3148. enable $ARCH_EXT_LIST
  3149. die_unknown(){
  3150. echo "Unknown option \"$1\"."
  3151. echo "See $0 --help for available options."
  3152. exit 1
  3153. }
  3154. print_in_columns() {
  3155. cols=$(expr $ncols / 24)
  3156. cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t
  3157. }
  3158. show_list() {
  3159. suffix=_$1
  3160. shift
  3161. echo $* | sed s/$suffix//g | print_in_columns
  3162. exit 0
  3163. }
  3164. rand_list(){
  3165. IFS=', '
  3166. set -- $*
  3167. unset IFS
  3168. for thing; do
  3169. comp=${thing%:*}
  3170. prob=${thing#$comp}
  3171. prob=${prob#:}
  3172. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  3173. echo "prob ${prob:-0.5}"
  3174. printf '%s\n' $comp
  3175. done
  3176. }
  3177. do_random(){
  3178. action=$1
  3179. shift
  3180. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  3181. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  3182. }
  3183. for opt do
  3184. optval="${opt#*=}"
  3185. case "$opt" in
  3186. --extra-ldflags=*)
  3187. add_ldflags $optval
  3188. ;;
  3189. --extra-ldexeflags=*)
  3190. add_ldexeflags $optval
  3191. ;;
  3192. --extra-ldlibflags=*)
  3193. add_ldlibflags $optval
  3194. ;;
  3195. --extra-libs=*)
  3196. add_extralibs $optval
  3197. ;;
  3198. --disable-devices)
  3199. disable $INDEV_LIST $OUTDEV_LIST
  3200. ;;
  3201. --enable-debug=*)
  3202. debuglevel="$optval"
  3203. ;;
  3204. --disable-programs)
  3205. disable $PROGRAM_LIST
  3206. ;;
  3207. --disable-everything)
  3208. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  3209. ;;
  3210. --disable-all)
  3211. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  3212. disable $LIBRARY_LIST $PROGRAM_LIST doc
  3213. enable avutil
  3214. ;;
  3215. --enable-random|--disable-random)
  3216. action=${opt%%-random}
  3217. do_random ${action#--} $COMPONENT_LIST
  3218. ;;
  3219. --enable-random=*|--disable-random=*)
  3220. action=${opt%%-random=*}
  3221. do_random ${action#--} $optval
  3222. ;;
  3223. --enable-*=*|--disable-*=*)
  3224. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  3225. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  3226. eval list=\$$(toupper $thing)_LIST
  3227. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  3228. list=$(filter "$name" $list)
  3229. [ "$list" = "" ] && warn "Option $opt did not match anything"
  3230. $action $list
  3231. ;;
  3232. --enable-?*|--disable-?*)
  3233. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  3234. if is_in $option $COMPONENT_LIST; then
  3235. test $action = disable && action=unset
  3236. eval $action \$$(toupper ${option%s})_LIST
  3237. elif is_in $option $CMDLINE_SELECT; then
  3238. $action $option
  3239. else
  3240. die_unknown $opt
  3241. fi
  3242. ;;
  3243. --list-*)
  3244. NAME="${opt#--list-}"
  3245. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  3246. NAME=${NAME%s}
  3247. eval show_list $NAME \$$(toupper $NAME)_LIST
  3248. ;;
  3249. --help|-h) show_help
  3250. ;;
  3251. --quiet|-q) quiet=yes
  3252. ;;
  3253. --fatal-warnings) enable fatal_warnings
  3254. ;;
  3255. *)
  3256. optname="${opt%%=*}"
  3257. optname="${optname#--}"
  3258. optname=$(echo "$optname" | sed 's/-/_/g')
  3259. if is_in $optname $CMDLINE_SET; then
  3260. eval $optname='$optval'
  3261. elif is_in $optname $CMDLINE_APPEND; then
  3262. append $optname "$optval"
  3263. else
  3264. die_unknown $opt
  3265. fi
  3266. ;;
  3267. esac
  3268. done
  3269. for e in $env; do
  3270. eval "export $e"
  3271. done
  3272. # Mark specifically enabled, but normally autodetected libraries as requested.
  3273. for lib in $AUTODETECT_LIBS; do
  3274. enabled $lib && request $lib
  3275. done
  3276. # Enable platform codecs by default.
  3277. enable_weak audiotoolbox
  3278. # Enable hwaccels by default.
  3279. enable_weak d3d11va dxva2 vaapi vda vdpau videotoolbox_hwaccel xvmc
  3280. enable_weak xlib
  3281. enable_weak cuda cuvid nvenc vda_framework videotoolbox videotoolbox_encoder
  3282. disabled logging && logfile=/dev/null
  3283. die_license_disabled() {
  3284. enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; }
  3285. }
  3286. die_license_disabled_gpl() {
  3287. enabled $1 || { enabled $v && die "$v is incompatible with the gpl and --enable-$1 is not specified."; }
  3288. }
  3289. map "die_license_disabled gpl" $EXTERNAL_LIBRARY_GPL_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
  3290. map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST $EXTERNAL_LIBRARY_GPLV3_LIST
  3291. enabled gpl && map "die_license_disabled_gpl nonfree" $EXTERNAL_LIBRARY_NONFREE_LIST
  3292. map "die_license_disabled nonfree" $HWACCEL_LIBRARY_NONFREE_LIST
  3293. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3294. # Disable all the library-specific components if the library itself
  3295. # is disabled, see AVCODEC_LIST and following _LIST variables.
  3296. disable_components(){
  3297. disabled ${1} && disable $(
  3298. eval components="\$$(toupper ${1})_COMPONENTS"
  3299. map 'eval echo \${$(toupper ${v%s})_LIST}' $components
  3300. )
  3301. }
  3302. map 'disable_components $v' $LIBRARY_LIST
  3303. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  3304. set >> $logfile
  3305. test -n "$valgrind" && toolchain="valgrind-memcheck"
  3306. case "$toolchain" in
  3307. *-asan)
  3308. cc_default="${toolchain%-asan}"
  3309. add_cflags -fsanitize=address
  3310. add_ldflags -fsanitize=address
  3311. ;;
  3312. *-msan)
  3313. cc_default="${toolchain%-msan}"
  3314. add_cflags -fsanitize=memory -fsanitize-memory-track-origins
  3315. add_ldflags -fsanitize=memory
  3316. ;;
  3317. *-tsan)
  3318. cc_default="${toolchain%-tsan}"
  3319. add_cflags -fsanitize=thread -fPIE
  3320. add_ldflags -fsanitize=thread -pie
  3321. case "$toolchain" in
  3322. gcc-tsan)
  3323. add_cflags -fPIC
  3324. add_ldflags -fPIC
  3325. ;;
  3326. esac
  3327. ;;
  3328. *-usan)
  3329. cc_default="${toolchain%-usan}"
  3330. add_cflags -fsanitize=undefined
  3331. add_ldflags -fsanitize=undefined
  3332. ;;
  3333. valgrind-*)
  3334. target_exec_default="valgrind"
  3335. case "$toolchain" in
  3336. valgrind-massif)
  3337. target_exec_args="--tool=massif --alloc-fn=av_malloc --alloc-fn=av_mallocz --alloc-fn=av_calloc --alloc-fn=av_fast_padded_malloc --alloc-fn=av_fast_malloc --alloc-fn=av_realloc_f --alloc-fn=av_fast_realloc --alloc-fn=av_realloc"
  3338. ;;
  3339. valgrind-memcheck)
  3340. target_exec_args="--error-exitcode=1 --malloc-fill=0x2a --track-origins=yes --leak-check=full --gen-suppressions=all --suppressions=$source_path/tests/fate-valgrind.supp"
  3341. ;;
  3342. esac
  3343. ;;
  3344. msvc)
  3345. # Check whether the current MSVC version needs the C99 converter.
  3346. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  3347. # support enough of C99 to build ffmpeg. Default to the new
  3348. # behaviour if the regexp was unable to match anything, since this
  3349. # successfully parses the version number of existing supported
  3350. # versions that require the converter (MSVC 2010 and 2012).
  3351. cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  3352. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  3353. cc_default="cl"
  3354. else
  3355. cc_default="c99wrap cl"
  3356. fi
  3357. ld_default="$source_path/compat/windows/mslink"
  3358. nm_default="dumpbin -symbols"
  3359. ar_default="lib"
  3360. case "$arch" in
  3361. arm*)
  3362. as_default="armasm"
  3363. ;;
  3364. esac
  3365. target_os_default="win32"
  3366. # Use a relative path for TMPDIR. This makes sure all the
  3367. # ffconf temp files are written with a relative path, avoiding
  3368. # issues with msys/win32 path conversion for MSVC parameters
  3369. # such as -Fo<file> or -out:<file>.
  3370. TMPDIR=.
  3371. ;;
  3372. icl)
  3373. cc_default="icl"
  3374. ld_default="xilink"
  3375. nm_default="dumpbin -symbols"
  3376. ar_default="xilib"
  3377. target_os_default="win32"
  3378. TMPDIR=.
  3379. ;;
  3380. gcov)
  3381. add_cflags -fprofile-arcs -ftest-coverage
  3382. add_ldflags -fprofile-arcs -ftest-coverage
  3383. ;;
  3384. llvm-cov)
  3385. add_cflags -fprofile-arcs -ftest-coverage
  3386. add_ldflags --coverage
  3387. ;;
  3388. hardened)
  3389. add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
  3390. add_cflags -fno-strict-overflow -fstack-protector-all
  3391. add_ldflags -Wl,-z,relro -Wl,-z,now
  3392. add_cflags -fPIE
  3393. add_ldexeflags -fPIE -pie
  3394. ;;
  3395. ?*)
  3396. die "Unknown toolchain $toolchain"
  3397. ;;
  3398. esac
  3399. test -n "$cross_prefix" && enable cross_compile
  3400. if enabled cross_compile; then
  3401. test -n "$arch" && test -n "$target_os" ||
  3402. die "Must specify target arch and OS when cross-compiling"
  3403. fi
  3404. ar_default="${cross_prefix}${ar_default}"
  3405. cc_default="${cross_prefix}${cc_default}"
  3406. cxx_default="${cross_prefix}${cxx_default}"
  3407. nm_default="${cross_prefix}${nm_default}"
  3408. pkg_config_default="${cross_prefix}${pkg_config_default}"
  3409. if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
  3410. ranlib_default="${cross_prefix}${ranlib_default} -D"
  3411. else
  3412. ranlib_default="${cross_prefix}${ranlib_default}"
  3413. fi
  3414. strip_default="${cross_prefix}${strip_default}"
  3415. windres_default="${cross_prefix}${windres_default}"
  3416. sysinclude_default="${sysroot}/usr/include"
  3417. set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
  3418. target_exec target_os yasmexe
  3419. enabled cross_compile || host_cc_default=$cc
  3420. set_default host_cc
  3421. pkg_config_fail_message=""
  3422. if ! $pkg_config --version >/dev/null 2>&1; then
  3423. warn "$pkg_config not found, library detection may fail."
  3424. pkg_config=false
  3425. elif is_in -static $cc $LDFLAGS && ! is_in --static $pkg_config $pkg_config_flags; then
  3426. pkg_config_fail_message="
  3427. Note: When building a static binary, add --pkg-config-flags=\"--static\"."
  3428. fi
  3429. if test $doxygen != $doxygen_default && \
  3430. ! $doxygen --version >/dev/null 2>&1; then
  3431. warn "Specified doxygen \"$doxygen\" not found, API documentation will fail to build."
  3432. fi
  3433. exesuf() {
  3434. case $1 in
  3435. mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  3436. esac
  3437. }
  3438. EXESUF=$(exesuf $target_os)
  3439. HOSTEXESUF=$(exesuf $host_os)
  3440. # set temporary file name
  3441. : ${TMPDIR:=$TEMPDIR}
  3442. : ${TMPDIR:=$TMP}
  3443. : ${TMPDIR:=/tmp}
  3444. if [ -n "$tempprefix" ] ; then
  3445. mktemp(){
  3446. echo $tempprefix.${HOSTNAME}.${UID}
  3447. }
  3448. elif ! check_cmd mktemp -u XXXXXX; then
  3449. # simple replacement for missing mktemp
  3450. # NOT SAFE FOR GENERAL USE
  3451. mktemp(){
  3452. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  3453. }
  3454. fi
  3455. tmpfile(){
  3456. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  3457. (set -C; exec > $tmp) 2>/dev/null ||
  3458. die "Unable to create temporary file in $TMPDIR."
  3459. append TMPFILES $tmp
  3460. eval $1=$tmp
  3461. }
  3462. trap 'rm -f -- $TMPFILES' EXIT
  3463. tmpfile TMPASM .asm
  3464. tmpfile TMPC .c
  3465. tmpfile TMPCPP .cpp
  3466. tmpfile TMPE $EXESUF
  3467. tmpfile TMPH .h
  3468. tmpfile TMPM .m
  3469. tmpfile TMPO .o
  3470. tmpfile TMPS .S
  3471. tmpfile TMPSH .sh
  3472. tmpfile TMPV .ver
  3473. unset -f mktemp
  3474. chmod +x $TMPE
  3475. # make sure we can execute files in $TMPDIR
  3476. cat > $TMPSH 2>> $logfile <<EOF
  3477. #! /bin/sh
  3478. EOF
  3479. chmod +x $TMPSH >> $logfile 2>&1
  3480. if ! $TMPSH >> $logfile 2>&1; then
  3481. cat <<EOF
  3482. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  3483. variable to another directory and make sure that it is not mounted noexec.
  3484. EOF
  3485. die "Sanity test failed."
  3486. fi
  3487. armasm_flags(){
  3488. for flag; do
  3489. case $flag in
  3490. # Filter out MSVC cl.exe options from cflags that shouldn't
  3491. # be passed to gas-preprocessor
  3492. -M[TD]*) ;;
  3493. *) echo $flag ;;
  3494. esac
  3495. done
  3496. }
  3497. ccc_flags(){
  3498. for flag; do
  3499. case $flag in
  3500. -std=c99) echo -c99 ;;
  3501. -mcpu=*) echo -arch ${flag#*=} ;;
  3502. -mieee) echo -ieee ;;
  3503. -O*|-fast) echo $flag ;;
  3504. -fno-math-errno) echo -assume nomath_errno ;;
  3505. -g) echo -g3 ;;
  3506. -Wall) echo -msg_enable level2 ;;
  3507. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  3508. -Wl,*) echo $flag ;;
  3509. -f*|-W*) ;;
  3510. *) echo $flag ;;
  3511. esac
  3512. done
  3513. }
  3514. cparser_flags(){
  3515. for flag; do
  3516. case $flag in
  3517. -Wno-switch) echo -Wno-switch-enum ;;
  3518. -Wno-format-zero-length) ;;
  3519. -Wdisabled-optimization) ;;
  3520. -Wno-pointer-sign) echo -Wno-other ;;
  3521. *) echo $flag ;;
  3522. esac
  3523. done
  3524. }
  3525. msvc_common_flags(){
  3526. for flag; do
  3527. case $flag in
  3528. # In addition to specifying certain flags under the compiler
  3529. # specific filters, they must be specified here as well or else the
  3530. # generic catch all at the bottom will print the original flag.
  3531. -Wall) ;;
  3532. -std=c99) ;;
  3533. # Common flags
  3534. -fomit-frame-pointer) ;;
  3535. -g) echo -Z7 ;;
  3536. -fno-math-errno) ;;
  3537. -fno-common) ;;
  3538. -fno-signed-zeros) ;;
  3539. -fPIC) ;;
  3540. -mthumb) ;;
  3541. -march=*) ;;
  3542. -lz) echo zlib.lib ;;
  3543. -lavifil32) echo vfw32.lib ;;
  3544. -lavicap32) echo vfw32.lib user32.lib ;;
  3545. -lx264) echo libx264.lib ;;
  3546. -l*) echo ${flag#-l}.lib ;;
  3547. -LARGEADDRESSAWARE) echo $flag ;;
  3548. -L*) echo -libpath:${flag#-L} ;;
  3549. *) echo $flag ;;
  3550. esac
  3551. done
  3552. }
  3553. msvc_flags(){
  3554. msvc_common_flags "$@"
  3555. for flag; do
  3556. case $flag in
  3557. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  3558. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  3559. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  3560. -wd4307 \
  3561. -wd4273 -wd4554 -wd4701 ;;
  3562. esac
  3563. done
  3564. }
  3565. icl_flags(){
  3566. msvc_common_flags "$@"
  3567. for flag; do
  3568. case $flag in
  3569. # Despite what Intel's documentation says -Wall, which is supported
  3570. # on Windows, does enable remarks so disable them here.
  3571. -Wall) echo $flag -Qdiag-disable:remark ;;
  3572. -std=c99) echo -Qstd=c99 ;;
  3573. -flto) echo -ipo ;;
  3574. esac
  3575. done
  3576. }
  3577. icc_flags(){
  3578. for flag; do
  3579. case $flag in
  3580. -flto) echo -ipo ;;
  3581. *) echo $flag ;;
  3582. esac
  3583. done
  3584. }
  3585. pgi_flags(){
  3586. for flag; do
  3587. case $flag in
  3588. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  3589. -fomit-frame-pointer) echo -Mnoframe ;;
  3590. -g) echo -gopt ;;
  3591. *) echo $flag ;;
  3592. esac
  3593. done
  3594. }
  3595. suncc_flags(){
  3596. for flag; do
  3597. case $flag in
  3598. -march=*|-mcpu=*)
  3599. case "${flag#*=}" in
  3600. native) echo -xtarget=native ;;
  3601. v9|niagara) echo -xarch=sparc ;;
  3602. ultrasparc) echo -xarch=sparcvis ;;
  3603. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  3604. i586|pentium) echo -xchip=pentium ;;
  3605. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  3606. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  3607. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  3608. pentium4*) echo -xtarget=pentium4 ;;
  3609. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  3610. *-sse3) echo -xarch=sse3 ;;
  3611. core2) echo -xarch=ssse3 -xchip=core2 ;;
  3612. bonnell) echo -xarch=ssse3 ;;
  3613. corei7|nehalem) echo -xtarget=nehalem ;;
  3614. westmere) echo -xtarget=westmere ;;
  3615. silvermont) echo -xarch=sse4_2 ;;
  3616. corei7-avx|sandybridge) echo -xtarget=sandybridge ;;
  3617. core-avx*|ivybridge|haswell|broadwell|skylake*|knl)
  3618. echo -xarch=avx ;;
  3619. amdfam10|barcelona) echo -xtarget=barcelona ;;
  3620. btver1) echo -xarch=amdsse4a ;;
  3621. btver2|bdver*|znver*) echo -xarch=avx ;;
  3622. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  3623. k8|opteron|athlon64|athlon-fx)
  3624. echo -xarch=sse2a ;;
  3625. athlon*) echo -xarch=pentium_proa ;;
  3626. esac
  3627. ;;
  3628. -std=c99) echo -xc99 ;;
  3629. -fomit-frame-pointer) echo -xregs=frameptr ;;
  3630. -fPIC) echo -KPIC -xcode=pic32 ;;
  3631. -W*,*) echo $flag ;;
  3632. -f*-*|-W*|-mimpure-text) ;;
  3633. -shared) echo -G ;;
  3634. *) echo $flag ;;
  3635. esac
  3636. done
  3637. }
  3638. tms470_flags(){
  3639. for flag; do
  3640. case $flag in
  3641. -march=*|-mcpu=*)
  3642. case "${flag#*=}" in
  3643. armv7-a|cortex-a*) echo -mv=7a8 ;;
  3644. armv7-r|cortex-r*) echo -mv=7r4 ;;
  3645. armv7-m|cortex-m*) echo -mv=7m3 ;;
  3646. armv6*|arm11*) echo -mv=6 ;;
  3647. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  3648. echo -mv=5e ;;
  3649. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  3650. esac
  3651. ;;
  3652. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  3653. -mfpu=vfp) echo --float_support=vfpv2 ;;
  3654. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  3655. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  3656. -msoft-float) echo --float_support=vfplib ;;
  3657. -O[0-3]|-mf=*) echo $flag ;;
  3658. -g) echo -g -mn ;;
  3659. -pds=*) echo $flag ;;
  3660. -D*|-I*) echo $flag ;;
  3661. --gcc|--abi=*) echo $flag ;;
  3662. -me) echo $flag ;;
  3663. esac
  3664. done
  3665. }
  3666. probe_cc(){
  3667. pfx=$1
  3668. _cc=$2
  3669. first=$3
  3670. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  3671. unset _ld_o _ldflags _ld_lib _ld_path
  3672. unset _depflags _DEPCMD _DEPFLAGS
  3673. _flags_filter=echo
  3674. if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
  3675. true # no-op to avoid reading stdin in following checks
  3676. elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  3677. _type=llvm_gcc
  3678. gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
  3679. _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
  3680. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3681. _cflags_speed='-O3'
  3682. _cflags_size='-Os'
  3683. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  3684. _type=gcc
  3685. gcc_version=$($_cc --version | head -n1)
  3686. gcc_basever=$($_cc -dumpversion)
  3687. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  3688. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  3689. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  3690. case $gcc_basever in
  3691. 2) ;;
  3692. 2.*) ;;
  3693. *) _depflags='-MMD -MF $(@:.o=.d) -MT $@' ;;
  3694. esac
  3695. if [ "$first" = true ]; then
  3696. case $gcc_basever in
  3697. 4.2*)
  3698. warn "gcc 4.2 is outdated and may miscompile FFmpeg. Please use a newer compiler." ;;
  3699. esac
  3700. fi
  3701. _cflags_speed='-O3'
  3702. _cflags_size='-Os'
  3703. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  3704. _type=icc
  3705. _ident=$($_cc --version | head -n1)
  3706. _depflags='-MMD'
  3707. _cflags_speed='-O3'
  3708. _cflags_size='-Os'
  3709. _cflags_noopt='-O1'
  3710. _flags_filter=icc_flags
  3711. elif $_cc -v 2>&1 | grep -q xlc; then
  3712. _type=xlc
  3713. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  3714. _cflags_speed='-O5'
  3715. _cflags_size='-O5 -qcompact'
  3716. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  3717. _type=ccc
  3718. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  3719. _DEPFLAGS='-M'
  3720. _cflags_speed='-fast'
  3721. _cflags_size='-O1'
  3722. _flags_filter=ccc_flags
  3723. elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
  3724. test -d "$sysroot" || die "No valid sysroot specified."
  3725. _type=armcc
  3726. _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
  3727. armcc_conf="$PWD/armcc.conf"
  3728. $_cc --arm_linux_configure \
  3729. --arm_linux_config_file="$armcc_conf" \
  3730. --configure_sysroot="$sysroot" \
  3731. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  3732. die "Error creating armcc configuration file."
  3733. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  3734. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  3735. as_default="${cross_prefix}gcc"
  3736. _depflags='-MMD'
  3737. _cflags_speed='-O3'
  3738. _cflags_size='-Os'
  3739. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  3740. _type=tms470
  3741. _ident=$($_cc -version | head -n1 | tr -s ' ')
  3742. _flags='--gcc --abi=eabi -me'
  3743. _cc_e='-ppl -fe=$@'
  3744. _cc_o='-fe=$@'
  3745. _depflags='-ppa -ppd=$(@:.o=.d)'
  3746. _cflags_speed='-O3 -mf=5'
  3747. _cflags_size='-O3 -mf=2'
  3748. _flags_filter=tms470_flags
  3749. elif $_cc -v 2>&1 | grep -q clang; then
  3750. _type=clang
  3751. _ident=$($_cc --version 2>/dev/null | head -n1)
  3752. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3753. _cflags_speed='-O3'
  3754. _cflags_size='-Oz'
  3755. elif $_cc -V 2>&1 | grep -q Sun; then
  3756. _type=suncc
  3757. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  3758. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  3759. _DEPFLAGS='-xM1 -xc99'
  3760. _ldflags='-std=c99'
  3761. _cflags_speed='-O5'
  3762. _cflags_size='-O5 -xspace'
  3763. _flags_filter=suncc_flags
  3764. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  3765. _type=pathscale
  3766. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  3767. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3768. _cflags_speed='-O2'
  3769. _cflags_size='-Os'
  3770. _flags_filter='filter_out -Wdisabled-optimization'
  3771. elif $_cc -v 2>&1 | grep -q Open64; then
  3772. _type=open64
  3773. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  3774. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3775. _cflags_speed='-O2'
  3776. _cflags_size='-Os'
  3777. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  3778. elif $_cc -V 2>&1 | grep -q Portland; then
  3779. _type=pgi
  3780. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  3781. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  3782. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  3783. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  3784. _cflags_noopt="-O"
  3785. _flags_filter=pgi_flags
  3786. elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
  3787. _type=armasm
  3788. _ident=$($_cc | head -n1)
  3789. # 4509: "This form of conditional instruction is deprecated"
  3790. _flags="-nologo -ignore 4509"
  3791. _flags_filter=armasm_flags
  3792. elif $_cc 2>&1 | grep -q Intel; then
  3793. _type=icl
  3794. _ident=$($_cc 2>&1 | head -n1)
  3795. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  3796. # Not only is O3 broken on 13.x+ but it is slower on all previous
  3797. # versions (tested) as well.
  3798. _cflags_speed="-O2"
  3799. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  3800. if $_cc 2>&1 | grep -q Linker; then
  3801. _ld_o='-out:$@'
  3802. else
  3803. _ld_o='-Fe$@'
  3804. fi
  3805. _cc_o='-Fo$@'
  3806. _cc_e='-P'
  3807. _flags_filter=icl_flags
  3808. _ld_lib='lib%.a'
  3809. _ld_path='-libpath:'
  3810. # -Qdiag-error to make icl error when seeing certain unknown arguments
  3811. _flags='-nologo -Qdiag-error:4044,10157'
  3812. # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency
  3813. # with MSVC which enables it by default.
  3814. _cflags='-Qms0 -Qvec- -Qsimd- -GS -fp:precise'
  3815. disable stripping
  3816. elif $_cc -? 2>/dev/null | grep -q 'LLVM.*Linker'; then
  3817. # lld can emulate multiple different linkers; in ms link.exe mode,
  3818. # the -? parameter gives the help output which contains an identifyable
  3819. # string, while it gives an error in other modes.
  3820. _type=lld-link
  3821. # The link.exe mode doesn't have a switch for getting the version,
  3822. # but we can force it back to gnu mode and get the version from there.
  3823. _ident=$($_cc -flavor gnu --version 2>/dev/null)
  3824. _ld_o='-out:$@'
  3825. _flags_filter=msvc_flags
  3826. _ld_lib='lib%.a'
  3827. _ld_path='-libpath:'
  3828. elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
  3829. _type=msvc
  3830. _ident=$($_cc 2>&1 | head -n1)
  3831. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  3832. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  3833. _cflags_speed="-O2"
  3834. _cflags_size="-O1"
  3835. if $_cc -nologo- 2>&1 | grep -q Linker; then
  3836. _ld_o='-out:$@'
  3837. else
  3838. _ld_o='-Fe$@'
  3839. fi
  3840. _cc_o='-Fo$@'
  3841. _cc_e='-P -Fi$@'
  3842. _flags_filter=msvc_flags
  3843. _ld_lib='lib%.a'
  3844. _ld_path='-libpath:'
  3845. _flags='-nologo'
  3846. disable stripping
  3847. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  3848. _type=cparser
  3849. _ident=$($_cc --version | head -n1)
  3850. _depflags='-MMD'
  3851. _cflags_speed='-O4'
  3852. _cflags_size='-O2'
  3853. _flags_filter=cparser_flags
  3854. fi
  3855. eval ${pfx}_type=\$_type
  3856. eval ${pfx}_ident=\$_ident
  3857. }
  3858. set_ccvars(){
  3859. eval ${1}_C=\${_cc_c-\${${1}_C}}
  3860. eval ${1}_E=\${_cc_e-\${${1}_E}}
  3861. eval ${1}_O=\${_cc_o-\${${1}_O}}
  3862. if [ -n "$_depflags" ]; then
  3863. eval ${1}_DEPFLAGS=\$_depflags
  3864. else
  3865. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  3866. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  3867. eval DEP${1}FLAGS=\$_flags
  3868. fi
  3869. }
  3870. probe_cc cc "$cc" "true"
  3871. cflags_filter=$_flags_filter
  3872. cflags_speed=$_cflags_speed
  3873. cflags_size=$_cflags_size
  3874. cflags_noopt=$_cflags_noopt
  3875. add_cflags $_flags $_cflags
  3876. cc_ldflags=$_ldflags
  3877. set_ccvars CC
  3878. probe_cc hostcc "$host_cc"
  3879. host_cflags_filter=$_flags_filter
  3880. add_host_cflags $_flags $_cflags
  3881. set_ccvars HOSTCC
  3882. test -n "$cc_type" && enable $cc_type ||
  3883. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  3884. : ${as_default:=$cc}
  3885. : ${objcc_default:=$cc}
  3886. : ${dep_cc_default:=$cc}
  3887. : ${ld_default:=$cc}
  3888. : ${host_ld_default:=$host_cc}
  3889. set_default ar as objcc dep_cc ld ln_s host_ld windres
  3890. probe_cc as "$as"
  3891. asflags_filter=$_flags_filter
  3892. add_asflags $_flags $_cflags
  3893. set_ccvars AS
  3894. probe_cc objcc "$objcc"
  3895. objcflags_filter=$_flags_filter
  3896. add_objcflags $_flags $_cflags
  3897. set_ccvars OBJC
  3898. probe_cc ld "$ld"
  3899. ldflags_filter=$_flags_filter
  3900. add_ldflags $_flags $_ldflags
  3901. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  3902. LD_O=${_ld_o-$LD_O}
  3903. LD_LIB=${_ld_lib-$LD_LIB}
  3904. LD_PATH=${_ld_path-$LD_PATH}
  3905. probe_cc hostld "$host_ld"
  3906. host_ldflags_filter=$_flags_filter
  3907. add_host_ldflags $_flags $_ldflags
  3908. HOSTLD_O=${_ld_o-$HOSTLD_O}
  3909. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  3910. probe_cc depcc "$dep_cc"
  3911. CCDEP=${_DEPCMD:-$DEPCMD}
  3912. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  3913. DEPCCFLAGS=$_flags
  3914. fi
  3915. if $ar 2>&1 | grep -q Microsoft; then
  3916. arflags="-nologo"
  3917. ar_o='-out:$@'
  3918. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  3919. arflags="rq"
  3920. ar_o='$@'
  3921. elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
  3922. arflags='-Xany -r -c'
  3923. ar_o='$@'
  3924. elif $ar 2>&1 | grep -q "\[D\] "; then
  3925. arflags="rcD"
  3926. ar_o='$@'
  3927. else
  3928. arflags="rc"
  3929. ar_o='$@'
  3930. fi
  3931. add_cflags $extra_cflags
  3932. add_cxxflags $extra_cxxflags
  3933. add_objcflags $extra_objcflags
  3934. add_asflags $extra_cflags
  3935. if test -n "$sysroot"; then
  3936. case "$cc_type" in
  3937. gcc|llvm_gcc|clang)
  3938. add_cppflags --sysroot="$sysroot"
  3939. add_ldflags --sysroot="$sysroot"
  3940. # On Darwin --sysroot may be ignored, -isysroot always affects headers and linking
  3941. add_cppflags -isysroot "$sysroot"
  3942. add_ldflags -isysroot "$sysroot"
  3943. ;;
  3944. tms470)
  3945. add_cppflags -I"$sysinclude"
  3946. add_ldflags --sysroot="$sysroot"
  3947. ;;
  3948. esac
  3949. fi
  3950. if test "$cpu" = host; then
  3951. enabled cross_compile &&
  3952. die "--cpu=host makes no sense when cross-compiling."
  3953. case "$cc_type" in
  3954. gcc|llvm_gcc)
  3955. check_native(){
  3956. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  3957. sed -n "/cc1.*$1=/{
  3958. s/.*$1=\\([^ ]*\\).*/\\1/
  3959. p
  3960. q
  3961. }" $TMPE
  3962. }
  3963. cpu=$(check_native -march || check_native -mcpu)
  3964. ;;
  3965. clang)
  3966. check_native(){
  3967. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  3968. sed -n "/cc1.*-target-cpu /{
  3969. s/.*-target-cpu \\([^ ]*\\).*/\\1/
  3970. p
  3971. q
  3972. }" $TMPE
  3973. }
  3974. cpu=$(check_native -march)
  3975. ;;
  3976. esac
  3977. test "${cpu:-host}" = host &&
  3978. die "--cpu=host not supported with compiler $cc"
  3979. fi
  3980. # Deal with common $arch aliases
  3981. case "$arch" in
  3982. aarch64|arm64)
  3983. arch="aarch64"
  3984. ;;
  3985. arm*|iPad*|iPhone*)
  3986. arch="arm"
  3987. ;;
  3988. mips*|IP*)
  3989. case "$arch" in
  3990. *el)
  3991. add_cppflags -EL
  3992. add_ldflags -EL
  3993. ;;
  3994. *eb)
  3995. add_cppflags -EB
  3996. add_ldflags -EB
  3997. ;;
  3998. esac
  3999. arch="mips"
  4000. ;;
  4001. parisc*|hppa*)
  4002. arch="parisc"
  4003. ;;
  4004. "Power Macintosh"|ppc*|powerpc*)
  4005. arch="ppc"
  4006. ;;
  4007. s390|s390x)
  4008. arch="s390"
  4009. ;;
  4010. sh4|sh)
  4011. arch="sh4"
  4012. ;;
  4013. sun4*|sparc*)
  4014. arch="sparc"
  4015. ;;
  4016. tilegx|tile-gx)
  4017. arch="tilegx"
  4018. ;;
  4019. i[3-6]86*|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  4020. arch="x86"
  4021. ;;
  4022. esac
  4023. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  4024. enable $arch
  4025. # Add processor-specific flags
  4026. if enabled aarch64; then
  4027. case $cpu in
  4028. armv*)
  4029. cpuflags="-march=$cpu"
  4030. ;;
  4031. *)
  4032. cpuflags="-mcpu=$cpu"
  4033. ;;
  4034. esac
  4035. elif enabled alpha; then
  4036. cpuflags="-mcpu=$cpu"
  4037. elif enabled arm; then
  4038. check_arm_arch() {
  4039. check_cpp_condition stddef.h \
  4040. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  4041. $cpuflags
  4042. }
  4043. probe_arm_arch() {
  4044. if check_arm_arch 4; then echo armv4
  4045. elif check_arm_arch 4T; then echo armv4t
  4046. elif check_arm_arch 5; then echo armv5
  4047. elif check_arm_arch 5E; then echo armv5e
  4048. elif check_arm_arch 5T; then echo armv5t
  4049. elif check_arm_arch 5TE; then echo armv5te
  4050. elif check_arm_arch 5TEJ; then echo armv5te
  4051. elif check_arm_arch 6; then echo armv6
  4052. elif check_arm_arch 6J; then echo armv6j
  4053. elif check_arm_arch 6K; then echo armv6k
  4054. elif check_arm_arch 6Z; then echo armv6z
  4055. elif check_arm_arch 6ZK; then echo armv6zk
  4056. elif check_arm_arch 6T2; then echo armv6t2
  4057. elif check_arm_arch 7; then echo armv7
  4058. elif check_arm_arch 7A 7_A; then echo armv7-a
  4059. elif check_arm_arch 7S; then echo armv7-a
  4060. elif check_arm_arch 7R 7_R; then echo armv7-r
  4061. elif check_arm_arch 7M 7_M; then echo armv7-m
  4062. elif check_arm_arch 7EM 7E_M; then echo armv7-m
  4063. elif check_arm_arch 8A 8_A; then echo armv8-a
  4064. fi
  4065. }
  4066. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  4067. case $cpu in
  4068. armv*)
  4069. cpuflags="-march=$cpu"
  4070. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  4071. ;;
  4072. *)
  4073. cpuflags="-mcpu=$cpu"
  4074. case $cpu in
  4075. cortex-a*) subarch=armv7a ;;
  4076. cortex-r*) subarch=armv7r ;;
  4077. cortex-m*) enable thumb; subarch=armv7m ;;
  4078. arm11*) subarch=armv6 ;;
  4079. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  4080. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  4081. *) subarch=$(probe_arm_arch) ;;
  4082. esac
  4083. ;;
  4084. esac
  4085. case "$subarch" in
  4086. armv5t*) enable fast_clz ;;
  4087. armv[6-8]*)
  4088. enable fast_clz
  4089. disabled fast_unaligned || enable fast_unaligned
  4090. ;;
  4091. esac
  4092. elif enabled avr32; then
  4093. case $cpu in
  4094. ap7[02]0[0-2])
  4095. subarch="avr32_ap"
  4096. cpuflags="-mpart=$cpu"
  4097. ;;
  4098. ap)
  4099. subarch="avr32_ap"
  4100. cpuflags="-march=$cpu"
  4101. ;;
  4102. uc3[ab]*)
  4103. subarch="avr32_uc"
  4104. cpuflags="-mcpu=$cpu"
  4105. ;;
  4106. uc)
  4107. subarch="avr32_uc"
  4108. cpuflags="-march=$cpu"
  4109. ;;
  4110. esac
  4111. elif enabled bfin; then
  4112. cpuflags="-mcpu=$cpu"
  4113. elif enabled mips; then
  4114. cpuflags="-march=$cpu"
  4115. if [ "$cpu" != "generic" ]; then
  4116. disable mips32r2
  4117. disable mips32r5
  4118. disable mips64r2
  4119. disable mips32r6
  4120. disable mips64r6
  4121. disable loongson2
  4122. disable loongson3
  4123. case $cpu in
  4124. 24kc|24kf*|24kec|34kc|1004kc|24kef*|34kf*|1004kf*|74kc|74kf)
  4125. enable mips32r2
  4126. disable msa
  4127. ;;
  4128. p5600|i6400|p6600)
  4129. disable mipsdsp
  4130. disable mipsdspr2
  4131. ;;
  4132. loongson*)
  4133. enable loongson2
  4134. enable loongson3
  4135. enable local_aligned_8 local_aligned_16 local_aligned_32
  4136. enable simd_align_16
  4137. enable fast_64bit
  4138. enable fast_clz
  4139. enable fast_cmov
  4140. enable fast_unaligned
  4141. disable aligned_stack
  4142. disable mipsfpu
  4143. disable mipsdsp
  4144. disable mipsdspr2
  4145. case $cpu in
  4146. loongson3*)
  4147. cpuflags="-march=loongson3a -mhard-float -fno-expensive-optimizations"
  4148. ;;
  4149. loongson2e)
  4150. cpuflags="-march=loongson2e -mhard-float -fno-expensive-optimizations"
  4151. ;;
  4152. loongson2f)
  4153. cpuflags="-march=loongson2f -mhard-float -fno-expensive-optimizations"
  4154. ;;
  4155. esac
  4156. ;;
  4157. *)
  4158. # Unknown CPU. Disable everything.
  4159. warn "unknown CPU. Disabling all MIPS optimizations."
  4160. disable mipsfpu
  4161. disable mipsdsp
  4162. disable mipsdspr2
  4163. disable msa
  4164. disable mmi
  4165. ;;
  4166. esac
  4167. case $cpu in
  4168. 24kc)
  4169. disable mipsfpu
  4170. disable mipsdsp
  4171. disable mipsdspr2
  4172. ;;
  4173. 24kf*)
  4174. disable mipsdsp
  4175. disable mipsdspr2
  4176. ;;
  4177. 24kec|34kc|1004kc)
  4178. disable mipsfpu
  4179. disable mipsdspr2
  4180. ;;
  4181. 24kef*|34kf*|1004kf*)
  4182. disable mipsdspr2
  4183. ;;
  4184. 74kc)
  4185. disable mipsfpu
  4186. ;;
  4187. p5600)
  4188. enable mips32r5
  4189. check_cflags "-mtune=p5600" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops"
  4190. ;;
  4191. i6400)
  4192. enable mips64r6
  4193. check_cflags "-mtune=i6400 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
  4194. ;;
  4195. p6600)
  4196. enable mips64r6
  4197. check_cflags "-mtune=p6600 -mabi=64" && check_cflags "-msched-weight -mload-store-pairs -funroll-loops" && check_ldflags "-mabi=64"
  4198. ;;
  4199. esac
  4200. else
  4201. # We do not disable anything. Is up to the user to disable the unwanted features.
  4202. warn 'generic cpu selected'
  4203. fi
  4204. elif enabled ppc; then
  4205. disable ldbrx
  4206. case $(tolower $cpu) in
  4207. 601|ppc601|powerpc601)
  4208. cpuflags="-mcpu=601"
  4209. disable altivec
  4210. ;;
  4211. 603*|ppc603*|powerpc603*)
  4212. cpuflags="-mcpu=603"
  4213. disable altivec
  4214. ;;
  4215. 604*|ppc604*|powerpc604*)
  4216. cpuflags="-mcpu=604"
  4217. disable altivec
  4218. ;;
  4219. g3|75*|ppc75*|powerpc75*)
  4220. cpuflags="-mcpu=750"
  4221. disable altivec
  4222. ;;
  4223. g4|745*|ppc745*|powerpc745*)
  4224. cpuflags="-mcpu=7450"
  4225. disable vsx
  4226. ;;
  4227. 74*|ppc74*|powerpc74*)
  4228. cpuflags="-mcpu=7400"
  4229. disable vsx
  4230. ;;
  4231. g5|970|ppc970|powerpc970)
  4232. cpuflags="-mcpu=970"
  4233. disable vsx
  4234. ;;
  4235. power[3-6]*)
  4236. cpuflags="-mcpu=$cpu"
  4237. disable vsx
  4238. ;;
  4239. power[7-8]*)
  4240. cpuflags="-mcpu=$cpu"
  4241. ;;
  4242. cell)
  4243. cpuflags="-mcpu=cell"
  4244. enable ldbrx
  4245. disable vsx
  4246. ;;
  4247. e500mc)
  4248. cpuflags="-mcpu=e500mc"
  4249. disable altivec
  4250. ;;
  4251. e500v2)
  4252. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  4253. disable altivec
  4254. disable dcbzl
  4255. ;;
  4256. e500)
  4257. cpuflags="-mcpu=8540 -mhard-float"
  4258. disable altivec
  4259. disable dcbzl
  4260. ;;
  4261. esac
  4262. elif enabled sparc; then
  4263. case $cpu in
  4264. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  4265. cpuflags="-mcpu=$cpu"
  4266. ;;
  4267. ultrasparc*|niagara[234])
  4268. cpuflags="-mcpu=$cpu"
  4269. ;;
  4270. esac
  4271. elif enabled x86; then
  4272. case $cpu in
  4273. i[345]86|pentium)
  4274. cpuflags="-march=$cpu"
  4275. disable i686
  4276. disable mmx
  4277. ;;
  4278. # targets that do NOT support nopl and conditional mov (cmov)
  4279. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  4280. cpuflags="-march=$cpu"
  4281. disable i686
  4282. ;;
  4283. # targets that do support nopl and conditional mov (cmov)
  4284. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx\
  4285. |core*|atom|bonnell|nehalem|westmere|silvermont|sandybridge|ivybridge|haswell|broadwell|skylake*|knl\
  4286. |amdfam10|barcelona|b[dt]ver*|znver*)
  4287. cpuflags="-march=$cpu"
  4288. enable i686
  4289. enable fast_cmov
  4290. ;;
  4291. # targets that do support conditional mov but on which it's slow
  4292. pentium4|pentium4m|prescott|nocona)
  4293. cpuflags="-march=$cpu"
  4294. enable i686
  4295. disable fast_cmov
  4296. ;;
  4297. esac
  4298. fi
  4299. if [ "$cpu" != generic ]; then
  4300. add_cflags $cpuflags
  4301. add_asflags $cpuflags
  4302. test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
  4303. fi
  4304. # compiler sanity check
  4305. check_exec <<EOF
  4306. int main(void){ return 0; }
  4307. EOF
  4308. if test "$?" != 0; then
  4309. echo "$cc is unable to create an executable file."
  4310. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  4311. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  4312. echo "Only do this if you know what cross compiling means."
  4313. fi
  4314. die "C compiler test failed."
  4315. fi
  4316. add_cppflags -D_ISOC99_SOURCE
  4317. add_cxxflags -D__STDC_CONSTANT_MACROS
  4318. check_cxxflags -std=c++11 || check_cxxflags -std=c++0x
  4319. # some compilers silently accept -std=c11, so we also need to check that the
  4320. # version macro is defined properly
  4321. if test_cflags_cc -std=c11 ctype.h "__STDC_VERSION__ >= 201112L"; then
  4322. add_cflags -std=c11
  4323. else
  4324. check_cflags -std=c99
  4325. fi
  4326. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  4327. #include <stdlib.h>
  4328. EOF
  4329. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  4330. #include <stdlib.h>
  4331. EOF
  4332. add_host_cppflags -D_ISOC99_SOURCE
  4333. check_host_cflags -std=c99
  4334. check_host_cflags -Wall
  4335. check_host_cflags -O3
  4336. check_64bit(){
  4337. arch32=$1
  4338. arch64=$2
  4339. expr=$3
  4340. check_code cc "" "int test[2*($expr) - 1]" &&
  4341. subarch=$arch64 || subarch=$arch32
  4342. }
  4343. case "$arch" in
  4344. aarch64|alpha|ia64)
  4345. spic=$shared
  4346. ;;
  4347. mips)
  4348. check_64bit mips mips64 '_MIPS_SIM > 1'
  4349. spic=$shared
  4350. ;;
  4351. parisc)
  4352. check_64bit parisc parisc64 'sizeof(void *) > 4'
  4353. spic=$shared
  4354. ;;
  4355. ppc)
  4356. check_64bit ppc ppc64 'sizeof(void *) > 4'
  4357. spic=$shared
  4358. ;;
  4359. s390)
  4360. check_64bit s390 s390x 'sizeof(void *) > 4'
  4361. spic=$shared
  4362. ;;
  4363. sparc)
  4364. check_64bit sparc sparc64 'sizeof(void *) > 4'
  4365. spic=$shared
  4366. ;;
  4367. x86)
  4368. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  4369. # Treat x32 as x64 for now. Note it also needs spic=$shared
  4370. test "$subarch" = "x86_32" && check_cpp_condition stddef.h 'defined(__x86_64__)' &&
  4371. subarch=x86_64
  4372. if test "$subarch" = "x86_64"; then
  4373. spic=$shared
  4374. fi
  4375. ;;
  4376. ppc)
  4377. check_cc <<EOF && subarch="ppc64"
  4378. int test[(int)sizeof(char*) - 7];
  4379. EOF
  4380. ;;
  4381. esac
  4382. enable $subarch
  4383. enabled spic && enable_weak pic
  4384. # OS specific
  4385. case $target_os in
  4386. aix)
  4387. SHFLAGS=-shared
  4388. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  4389. enabled shared && add_ldflags -Wl,-brtl
  4390. ;;
  4391. android)
  4392. disable symver
  4393. enable section_data_rel_ro
  4394. SLIB_INSTALL_NAME='$(SLIBNAME)'
  4395. SLIB_INSTALL_LINKS=
  4396. SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
  4397. ;;
  4398. haiku)
  4399. prefix_default="/boot/common"
  4400. network_extralibs="-lnetwork"
  4401. host_libs=
  4402. ;;
  4403. sunos)
  4404. SHFLAGS='-shared -Wl,-h,$$(@F)'
  4405. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  4406. network_extralibs="-lsocket -lnsl"
  4407. add_cppflags -D__EXTENSIONS__
  4408. # When using suncc to build, the Solaris linker will mark
  4409. # an executable with each instruction set encountered by
  4410. # the Solaris assembler. As our libraries contain their own
  4411. # guards for processor-specific code, instead suppress
  4412. # generation of the HWCAPS ELF section on Solaris x86 only.
  4413. enabled_all suncc x86 &&
  4414. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  4415. add_ldflags -Wl,-M,mapfile
  4416. nm_default='nm -P -g'
  4417. version_script='-M'
  4418. VERSION_SCRIPT_POSTPROCESS_CMD='perl $(SRC_PATH)/compat/solaris/make_sunver.pl - $(OBJS)'
  4419. ;;
  4420. netbsd)
  4421. disable symver
  4422. oss_indev_extralibs="-lossaudio"
  4423. oss_outdev_extralibs="-lossaudio"
  4424. enabled gcc || check_ldflags -Wl,-zmuldefs
  4425. ;;
  4426. openbsd|bitrig)
  4427. disable symver
  4428. SHFLAGS='-shared'
  4429. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  4430. SLIB_INSTALL_LINKS=
  4431. oss_indev_extralibs="-lossaudio"
  4432. oss_outdev_extralibs="-lossaudio"
  4433. ;;
  4434. dragonfly)
  4435. disable symver
  4436. ;;
  4437. freebsd)
  4438. ;;
  4439. bsd/os)
  4440. add_extralibs -lpoll -lgnugetopt
  4441. strip="strip -d"
  4442. ;;
  4443. darwin)
  4444. enabled ppc && add_asflags -force_cpusubtype_ALL
  4445. install_name_dir_default='$(SHLIBDIR)'
  4446. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(INSTALL_NAME_DIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  4447. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  4448. strip="${strip} -x"
  4449. add_ldflags -Wl,-dynamic,-search_paths_first
  4450. SLIBSUF=".dylib"
  4451. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  4452. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  4453. objformat="macho"
  4454. enabled x86_64 && objformat="macho64"
  4455. enabled_any pic shared x86_64 ||
  4456. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  4457. check_header dispatch/dispatch.h &&
  4458. add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore'
  4459. version_script='-exported_symbols_list'
  4460. VERSION_SCRIPT_POSTPROCESS_CMD='tr " " "\n" | sed -n /global:/,/local:/p | grep ";" | tr ";" "\n" | sed -E "s/(.+)/_\1/g" | sed -E "s/(.+[^*])$$$$/\1*/"'
  4461. ;;
  4462. msys*)
  4463. die "Native MSYS builds are discouraged, please use the MINGW environment."
  4464. ;;
  4465. mingw32*|mingw64*)
  4466. if test $target_os = "mingw32ce"; then
  4467. disable network
  4468. else
  4469. target_os=mingw32
  4470. fi
  4471. decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32"
  4472. decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32"
  4473. LIBTARGET=i386
  4474. if enabled x86_64; then
  4475. LIBTARGET="i386:x86-64"
  4476. elif enabled arm; then
  4477. LIBTARGET=arm-wince
  4478. fi
  4479. enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
  4480. enabled x86_32 && check_ldflags -Wl,--large-address-aware
  4481. shlibdir_default="$bindir_default"
  4482. SLIBPREF=""
  4483. SLIBSUF=".dll"
  4484. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4485. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  4486. dlltool="${cross_prefix}dlltool"
  4487. if check_cmd lib.exe -list; then
  4488. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe -nologo -machine:$(LIBTARGET) -def:$$(@:$(SLIBSUF)=.def) -out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  4489. if enabled x86_64; then
  4490. LIBTARGET=x64
  4491. fi
  4492. elif check_cmd $dlltool --version; then
  4493. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  4494. fi
  4495. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4496. SLIB_INSTALL_LINKS=
  4497. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  4498. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  4499. SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--disable-auto-image-base'
  4500. objformat="win32"
  4501. ranlib=:
  4502. enable dos_paths
  4503. check_ldflags -Wl,--nxcompat,--dynamicbase
  4504. # Lets work around some stupidity in binutils.
  4505. # ld will strip relocations from executables even though we need them
  4506. # for dynamicbase (ASLR). Using -pie does retain the reloc section
  4507. # however ld then forgets what the entry point should be (oops) so we
  4508. # have to manually (re)set it.
  4509. if enabled x86_32; then
  4510. disabled debug && add_ldexeflags -Wl,--pic-executable,-e,_mainCRTStartup
  4511. elif enabled x86_64; then
  4512. disabled debug && add_ldexeflags -Wl,--pic-executable,-e,mainCRTStartup
  4513. check_ldflags -Wl,--high-entropy-va # binutils 2.25
  4514. # Set image base >4GB for extra entropy with HEASLR
  4515. add_ldexeflags -Wl,--image-base,0x140000000
  4516. append SHFLAGS -Wl,--image-base,0x180000000
  4517. fi
  4518. ;;
  4519. win32|win64)
  4520. disable symver
  4521. if enabled shared; then
  4522. # Link to the import library instead of the normal static library
  4523. # for shared libs.
  4524. LD_LIB='%.lib'
  4525. # Cannot build both shared and static libs with MSVC or icl.
  4526. disable static
  4527. fi
  4528. enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
  4529. shlibdir_default="$bindir_default"
  4530. SLIBPREF=""
  4531. SLIBSUF=".dll"
  4532. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4533. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  4534. SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  4535. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4536. SLIB_INSTALL_LINKS=
  4537. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  4538. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  4539. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  4540. objformat="win32"
  4541. ranlib=:
  4542. enable dos_paths
  4543. ;;
  4544. cygwin*)
  4545. target_os=cygwin
  4546. shlibdir_default="$bindir_default"
  4547. SLIBPREF="cyg"
  4548. SLIBSUF=".dll"
  4549. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4550. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  4551. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4552. SLIB_INSTALL_LINKS=
  4553. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  4554. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  4555. objformat="win32"
  4556. enable dos_paths
  4557. enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
  4558. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  4559. ;;
  4560. *-dos|freedos|opendos)
  4561. network_extralibs="-lsocket"
  4562. objformat="coff"
  4563. enable dos_paths
  4564. add_cppflags -U__STRICT_ANSI__
  4565. ;;
  4566. linux)
  4567. enable dv1394
  4568. enable section_data_rel_ro
  4569. ;;
  4570. irix*)
  4571. target_os=irix
  4572. ranlib="echo ignoring ranlib"
  4573. ;;
  4574. os/2*)
  4575. strip="lxlite -CS"
  4576. objformat="aout"
  4577. add_cppflags -D_GNU_SOURCE
  4578. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  4579. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  4580. LIBSUF="_s.a"
  4581. SLIBPREF=""
  4582. SLIBSUF=".dll"
  4583. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  4584. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(FULLNAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  4585. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(FULLNAME).def; \
  4586. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(FULLNAME).def; \
  4587. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(FULLNAME).def; \
  4588. echo EXPORTS >> $(SUBDIR)$(FULLNAME).def; \
  4589. emxexp $(OBJS) >> $(SUBDIR)$(FULLNAME).def'
  4590. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.a $(SUBDIR)$(FULLNAME).def; \
  4591. emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.lib $(SUBDIR)$(FULLNAME).def;'
  4592. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  4593. SLIB_INSTALL_LINKS=
  4594. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(FULLNAME)_dll.a $(LIBPREF)$(FULLNAME)_dll.lib'
  4595. enable dos_paths
  4596. enable_weak os2threads
  4597. ;;
  4598. gnu/kfreebsd)
  4599. add_cppflags -D_BSD_SOURCE
  4600. ;;
  4601. gnu)
  4602. ;;
  4603. qnx)
  4604. add_cppflags -D_QNX_SOURCE
  4605. network_extralibs="-lsocket"
  4606. ;;
  4607. symbian)
  4608. SLIBSUF=".dll"
  4609. enable dos_paths
  4610. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  4611. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  4612. add_ldflags -Wl,--target1-abs,--no-undefined \
  4613. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  4614. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  4615. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  4616. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  4617. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  4618. ;;
  4619. osf1)
  4620. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  4621. ;;
  4622. minix)
  4623. ;;
  4624. plan9)
  4625. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  4626. -D_REENTRANT_SOURCE \
  4627. -D_RESEARCH_SOURCE \
  4628. -DFD_SETSIZE=96 \
  4629. -DHAVE_SOCK_OPTS
  4630. add_compat strtod.o strtod=avpriv_strtod
  4631. network_extralibs='-lbsd'
  4632. exeobjs=compat/plan9/main.o
  4633. disable ffserver
  4634. cp_f='cp'
  4635. ;;
  4636. none)
  4637. ;;
  4638. *)
  4639. die "Unknown OS '$target_os'."
  4640. ;;
  4641. esac
  4642. # test if creating links works
  4643. link_dest=$(mktemp -u $TMPDIR/dest_XXXXXXXX)
  4644. link_name=$(mktemp -u $TMPDIR/name_XXXXXXXX)
  4645. mkdir "$link_dest"
  4646. $ln_s "$link_dest" "$link_name"
  4647. touch "$link_dest/test_file"
  4648. if [ "$source_path" != "." ] && ([ ! -d src ] || [ -L src ]) && [ -e "$link_name/test_file" ]; then
  4649. # create link to source path
  4650. [ -e src ] && rm src
  4651. $ln_s "$source_path" src
  4652. source_link=src
  4653. else
  4654. # creating directory links doesn't work
  4655. # fall back to using the full source path
  4656. source_link="$source_path"
  4657. fi
  4658. # cleanup
  4659. rm -r "$link_dest"
  4660. rm -r "$link_name"
  4661. # determine libc flavour
  4662. probe_libc(){
  4663. pfx=$1
  4664. pfx_no_=${pfx%_}
  4665. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  4666. if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
  4667. eval ${pfx}libc_type=uclibc
  4668. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  4669. elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then
  4670. eval ${pfx}libc_type=glibc
  4671. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  4672. # MinGW headers can be installed on Cygwin, so check for newlib first.
  4673. elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  4674. eval ${pfx}libc_type=newlib
  4675. add_${pfx}cppflags -U__STRICT_ANSI__
  4676. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  4677. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  4678. eval ${pfx}libc_type=mingw64
  4679. if check_${pfx}cpp_condition _mingw.h "__MINGW64_VERSION_MAJOR < 3"; then
  4680. add_compat msvcrt/snprintf.o
  4681. add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
  4682. fi
  4683. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  4684. eval test \$${pfx_no_}cc_type = "gcc" &&
  4685. add_${pfx}cppflags -D__printf__=__gnu_printf__
  4686. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  4687. check_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  4688. eval ${pfx}libc_type=mingw32
  4689. check_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  4690. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  4691. die "ERROR: MinGW32 runtime version must be >= 3.15."
  4692. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  4693. check_${pfx}cpp_condition _mingw.h "defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0502" ||
  4694. add_${pfx}cppflags -D_WIN32_WINNT=0x0502
  4695. check_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
  4696. add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
  4697. eval test \$${pfx_no_}cc_type = "gcc" &&
  4698. add_${pfx}cppflags -D__printf__=__gnu_printf__
  4699. elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  4700. eval ${pfx}libc_type=msvcrt
  4701. if check_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
  4702. if [ "$pfx" = host_ ]; then
  4703. add_host_cppflags -Dsnprintf=_snprintf
  4704. else
  4705. add_compat strtod.o strtod=avpriv_strtod
  4706. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  4707. _snprintf=avpriv_snprintf \
  4708. vsnprintf=avpriv_vsnprintf
  4709. fi
  4710. fi
  4711. add_${pfx}cppflags -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS
  4712. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  4713. # 0x601 by default unless something else is set by the user.
  4714. # This can easily lead to us detecting functions only present
  4715. # in such new versions and producing binaries requiring windows 7.0.
  4716. # Therefore explicitly set the default to XP unless the user has
  4717. # set something else on the command line.
  4718. # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
  4719. # family. For these cases, configure is free to use any functions
  4720. # found in the SDK headers by default. (Alternatively, we could force
  4721. # _WIN32_WINNT to 0x0602 in that case.)
  4722. check_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  4723. { check_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0502; }
  4724. #ifdef WINAPI_FAMILY
  4725. #include <winapifamily.h>
  4726. #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  4727. #error not desktop
  4728. #endif
  4729. #endif
  4730. EOF
  4731. if [ "$pfx" = "" ]; then
  4732. check_func strtoll || add_cflags -Dstrtoll=_strtoi64
  4733. check_func strtoull || add_cflags -Dstrtoull=_strtoui64
  4734. fi
  4735. elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  4736. eval ${pfx}libc_type=klibc
  4737. elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  4738. eval ${pfx}libc_type=bionic
  4739. elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  4740. eval ${pfx}libc_type=solaris
  4741. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  4742. fi
  4743. check_${pfx}cc <<EOF
  4744. #include <time.h>
  4745. void *v = localtime_r;
  4746. EOF
  4747. test "$?" != 0 && check_${pfx}cc -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 <<EOF && add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  4748. #include <time.h>
  4749. void *v = localtime_r;
  4750. EOF
  4751. }
  4752. probe_libc
  4753. test -n "$libc_type" && enable libc_$libc_type
  4754. probe_libc host_
  4755. test -n "$host_libc_type" && enable host_libc_$host_libc_type
  4756. case $libc_type in
  4757. bionic)
  4758. add_compat strtod.o strtod=avpriv_strtod
  4759. ;;
  4760. esac
  4761. # hacks for compiler/libc/os combinations
  4762. if enabled_all tms470 libc_glibc; then
  4763. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  4764. add_cppflags -D__USER_LABEL_PREFIX__=
  4765. add_cppflags -D__builtin_memset=memset
  4766. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  4767. add_cflags -pds=48 # incompatible redefinition of macro
  4768. fi
  4769. if enabled_all ccc libc_glibc; then
  4770. add_ldflags -Wl,-z,now # calls to libots crash without this
  4771. fi
  4772. check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
  4773. add_cppflags '-I\$(SRC_PATH)/compat/float'
  4774. esc(){
  4775. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  4776. }
  4777. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate
  4778. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  4779. set_default libdir
  4780. : ${shlibdir_default:="$libdir"}
  4781. : ${pkgconfigdir_default:="$libdir/pkgconfig"}
  4782. set_default $PATHS_LIST
  4783. set_default nm
  4784. # we need to build at least one lib type
  4785. if ! enabled_any static shared; then
  4786. cat <<EOF
  4787. At least one library type must be built.
  4788. Specify --enable-static to build the static libraries or --enable-shared to
  4789. build the shared libraries as well. To only build the shared libraries specify
  4790. --disable-static in addition to --enable-shared.
  4791. EOF
  4792. exit 1
  4793. fi
  4794. disabled optimizations || check_cflags -fomit-frame-pointer
  4795. enable_weak_pic() {
  4796. disabled pic && return
  4797. enable pic
  4798. add_cppflags -DPIC
  4799. case "$target_os" in
  4800. mingw*|cygwin*)
  4801. ;;
  4802. *)
  4803. add_cflags -fPIC
  4804. ;;
  4805. esac
  4806. add_asflags -fPIC
  4807. }
  4808. enabled pic && enable_weak_pic
  4809. check_cc <<EOF || die "Symbol mangling check failed."
  4810. int ff_extern;
  4811. EOF
  4812. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  4813. extern_prefix=${sym%%ff_extern*}
  4814. check_cc <<EOF && enable_weak inline_asm
  4815. void foo(void) { __asm__ volatile ("" ::); }
  4816. EOF
  4817. _restrict=
  4818. for restrict_keyword in restrict __restrict__ __restrict; do
  4819. check_cc <<EOF && _restrict=$restrict_keyword && break
  4820. void foo(char * $restrict_keyword p);
  4821. EOF
  4822. done
  4823. check_cc <<EOF && enable pragma_deprecated
  4824. void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
  4825. EOF
  4826. check_cc <<EOF && enable attribute_packed
  4827. struct { int x; } __attribute__((packed)) x;
  4828. EOF
  4829. check_cc <<EOF && enable attribute_may_alias
  4830. union { int x; } __attribute__((may_alias)) x;
  4831. EOF
  4832. check_cc <<EOF || die "endian test failed"
  4833. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  4834. EOF
  4835. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  4836. if ! enabled ppc64 || enabled bigendian; then
  4837. disable vsx
  4838. fi
  4839. check_gas() {
  4840. log "check_gas using '$as' as AS"
  4841. # :vararg is used on aarch64, arm and ppc altivec
  4842. check_as <<EOF || return 1
  4843. .macro m n, y:vararg=0
  4844. \n: .int \y
  4845. .endm
  4846. m x
  4847. EOF
  4848. # .altmacro is only used in arm asm
  4849. ! enabled arm || check_as <<EOF || return 1
  4850. .altmacro
  4851. EOF
  4852. enable gnu_as
  4853. return 0
  4854. }
  4855. if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
  4856. nogas=:
  4857. enabled_any arm aarch64 && nogas=die
  4858. enabled_all ppc altivec && [ $target_os_default != aix ] && nogas=warn
  4859. as_noop=-v
  4860. case $as_type in
  4861. arm*) gaspp_as_type=armasm; as_noop=-h ;;
  4862. gcc) gaspp_as_type=gas ;;
  4863. *) gaspp_as_type=$as_type ;;
  4864. esac
  4865. [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
  4866. test "${as#*gas-preprocessor.pl}" != "$as" ||
  4867. check_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- ${as:=$cc} $as_noop &&
  4868. gas="${gas:=gas-preprocessor.pl} -arch $arch -as-type $gaspp_as_type -- ${as:=$cc}"
  4869. if ! check_gas ; then
  4870. as=${gas:=$as}
  4871. check_gas || \
  4872. $nogas "GNU assembler not found, install/update gas-preprocessor"
  4873. fi
  4874. check_as <<EOF && enable as_func
  4875. .func test
  4876. .endfunc
  4877. EOF
  4878. fi
  4879. check_inline_asm inline_asm_labels '"1:\n"'
  4880. check_inline_asm inline_asm_nonlocal_labels '"Label:\n"'
  4881. if enabled aarch64; then
  4882. enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
  4883. # internal assembler in clang 3.3 does not support this instruction
  4884. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  4885. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  4886. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  4887. elif enabled alpha; then
  4888. check_cflags -mieee
  4889. elif enabled arm; then
  4890. enabled msvc && check_cpp_condition stddef.h "defined _M_ARMT" && enable thumb
  4891. check_cpp_condition stddef.h "defined __thumb__" && check_cc <<EOF && enable_weak thumb
  4892. float func(float a, float b){ return a+b; }
  4893. EOF
  4894. enabled thumb && check_cflags -mthumb || check_cflags -marm
  4895. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  4896. enable vfp_args
  4897. elif check_cpp_condition stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then
  4898. enable vfp_args
  4899. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then
  4900. case "${cross_prefix:-$cc}" in
  4901. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  4902. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  4903. __asm__ (".eabi_attribute 28, 1");
  4904. int main(void) { return 0; }
  4905. EOF
  4906. esac
  4907. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  4908. fi
  4909. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  4910. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  4911. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  4912. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  4913. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  4914. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  4915. enabled setend && check_insn setend 'setend be'
  4916. [ $target_os = linux ] || [ $target_os = android ] ||
  4917. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  4918. $ARCH_EXT_LIST_ARM
  4919. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  4920. check_as <<EOF && enable as_dn_directive
  4921. ra .dn d0.i16
  4922. .unreq ra
  4923. EOF
  4924. check_as <<EOF && enable as_fpu_directive
  4925. .fpu neon
  4926. EOF
  4927. # llvm's integrated assembler supports .object_arch from llvm 3.5
  4928. [ "$objformat" = elf ] && check_as <<EOF && enable as_object_arch
  4929. .object_arch armv4
  4930. EOF
  4931. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  4932. elif enabled mips; then
  4933. enabled loongson2 && check_inline_asm loongson2 '"dmult.g $8, $9, $10"'
  4934. enabled loongson3 && check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"'
  4935. enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"'
  4936. # Enable minimum ISA based on selected options
  4937. if enabled mips64; then
  4938. enabled mips64r6 && check_inline_asm_flags mips64r6 '"dlsa $0, $0, $0, 1"' '-mips64r6'
  4939. enabled mips64r2 && check_inline_asm_flags mips64r2 '"dext $0, $0, 0, 1"' '-mips64r2'
  4940. disabled mips64r6 && disabled mips64r2 && check_inline_asm_flags mips64r1 '"daddi $0, $0, 0"' '-mips64'
  4941. else
  4942. enabled mips32r6 && check_inline_asm_flags mips32r6 '"aui $0, $0, 0"' '-mips32r6'
  4943. enabled mips32r5 && check_inline_asm_flags mips32r5 '"eretnc"' '-mips32r5'
  4944. enabled mips32r2 && check_inline_asm_flags mips32r2 '"ext $0, $0, 0, 1"' '-mips32r2'
  4945. disabled mips32r6 && disabled mips32r5 && disabled mips32r2 && check_inline_asm_flags mips32r1 '"addi $0, $0, 0"' '-mips32'
  4946. fi
  4947. enabled mipsfpu && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f2"' '-mhard-float'
  4948. enabled mipsfpu && (enabled mips32r5 || enabled mips32r6 || enabled mips64r6) && check_inline_asm_flags mipsfpu '"cvt.d.l $f0, $f1"' '-mfp64'
  4949. enabled mipsfpu && enabled msa && check_inline_asm_flags msa '"addvi.b $w0, $w1, 1"' '-mmsa' && check_header msa.h || disable msa
  4950. enabled mipsdsp && check_inline_asm_flags mipsdsp '"addu.qb $t0, $t1, $t2"' '-mdsp'
  4951. enabled mipsdspr2 && check_inline_asm_flags mipsdspr2 '"absq_s.qb $t0, $t1"' '-mdspr2'
  4952. elif enabled parisc; then
  4953. if enabled gcc; then
  4954. case $($cc -dumpversion) in
  4955. 4.[3-9].*) check_cflags -fno-optimize-sibling-calls ;;
  4956. esac
  4957. fi
  4958. elif enabled ppc; then
  4959. enable local_aligned_8 local_aligned_16 local_aligned_32
  4960. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  4961. check_inline_asm ibm_asm '"add 0, 0, 0"'
  4962. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  4963. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  4964. # AltiVec flags: The FSF version of GCC differs from the Apple version
  4965. if enabled altivec; then
  4966. check_cflags -maltivec -mabi=altivec &&
  4967. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  4968. check_cflags -faltivec
  4969. # check if our compiler supports Motorola AltiVec C API
  4970. check_cc <<EOF || disable altivec
  4971. $inc_altivec_h
  4972. int main(void) {
  4973. vector signed int v1 = (vector signed int) { 0 };
  4974. vector signed int v2 = (vector signed int) { 1 };
  4975. v1 = vec_add(v1, v2);
  4976. return 0;
  4977. }
  4978. EOF
  4979. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  4980. fi
  4981. if enabled vsx; then
  4982. check_cflags -mvsx &&
  4983. check_builtin vec_vsx_ld "altivec.h" "__builtin_vec_vsx_ld" || disable vsx
  4984. fi
  4985. if enabled power8; then
  4986. check_cpp_condition "altivec.h" "defined(_ARCH_PWR8)" || disable power8
  4987. fi
  4988. elif enabled x86; then
  4989. check_builtin rdtsc intrin.h "__rdtsc()"
  4990. check_builtin mm_empty mmintrin.h "_mm_empty()"
  4991. enable local_aligned_8 local_aligned_16 local_aligned_32
  4992. # check whether EBP is available on x86
  4993. # As 'i' is stored on the stack, this program will crash
  4994. # if the base pointer is used to access it because the
  4995. # base pointer is cleared in the inline assembly code.
  4996. check_exec_crash <<EOF && enable ebp_available
  4997. volatile int i=0;
  4998. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  4999. return i;
  5000. EOF
  5001. # check whether EBX is available on x86
  5002. check_inline_asm ebx_available '""::"b"(0)' &&
  5003. check_inline_asm ebx_available '"":::"%ebx"'
  5004. # check whether xmm clobbers are supported
  5005. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  5006. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test, %eax"' ||
  5007. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test(%rip), %eax"'
  5008. # check whether binutils is new enough to compile SSSE3/MMXEXT
  5009. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  5010. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  5011. if ! disabled_any asm mmx yasm; then
  5012. if check_cmd $yasmexe --version; then
  5013. enabled x86_64 && yasm_extra="-m amd64"
  5014. yasm_debug="-g dwarf2"
  5015. elif check_cmd nasm -v; then
  5016. yasmexe=nasm
  5017. yasm_debug="-g -F dwarf"
  5018. if enabled x86_64; then
  5019. case "$objformat" in
  5020. elf) objformat=elf64 ;;
  5021. win32) objformat=win64 ;;
  5022. esac
  5023. fi
  5024. fi
  5025. YASMFLAGS="-f $objformat $yasm_extra"
  5026. enabled pic && append YASMFLAGS "-DPIC"
  5027. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  5028. case "$objformat" in
  5029. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  5030. esac
  5031. check_yasm "movbe ecx, [5]" && enable yasm ||
  5032. die "yasm/nasm not found or too old. Use --disable-yasm for a crippled build."
  5033. check_yasm "vextracti128 xmm0, ymm0, 0" || disable avx2_external
  5034. check_yasm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
  5035. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  5036. check_yasm "CPU amdnop" || disable cpunop
  5037. fi
  5038. case "$cpu" in
  5039. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  5040. disable fast_clz
  5041. ;;
  5042. esac
  5043. fi
  5044. check_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_neon
  5045. check_ldflags -Wl,--as-needed
  5046. check_ldflags -Wl,-z,noexecstack
  5047. if check_func dlopen && check_func dlsym; then
  5048. ldl=
  5049. elif check_func dlopen -ldl && check_func dlsym -ldl; then
  5050. ldl=-ldl
  5051. fi
  5052. avisynth_demuxer_extralibs='$ldl'
  5053. cuda_extralibs='$ldl'
  5054. decklink_outdev_extralibs="$decklink_outdev_extralibs $ldl"
  5055. decklink_indev_extralibs="$decklink_indev_extralibs $ldl"
  5056. frei0r_filter_extralibs='$ldl'
  5057. frei0r_src_filter_extralibs='$ldl'
  5058. ladspa_filter_extralibs='$ldl'
  5059. nvenc_extralibs='$ldl'
  5060. coreimage_filter_extralibs="-framework QuartzCore -framework AppKit -framework OpenGL"
  5061. coreimagesrc_filter_extralibs="-framework QuartzCore -framework AppKit -framework OpenGL"
  5062. if ! disabled network; then
  5063. check_func getaddrinfo $network_extralibs
  5064. check_func inet_aton $network_extralibs
  5065. check_type netdb.h "struct addrinfo"
  5066. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  5067. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  5068. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  5069. check_type poll.h "struct pollfd"
  5070. check_type netinet/sctp.h "struct sctp_event_subscribe"
  5071. check_struct "sys/socket.h" "struct msghdr" msg_flags
  5072. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  5073. check_type netinet/in.h "struct sockaddr_in6"
  5074. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  5075. check_type "sys/types.h sys/socket.h" socklen_t
  5076. # Prefer arpa/inet.h over winsock2
  5077. if check_header arpa/inet.h ; then
  5078. check_func closesocket
  5079. elif check_header winsock2.h ; then
  5080. check_func_headers winsock2.h closesocket -lws2 &&
  5081. network_extralibs="-lws2" ||
  5082. { check_func_headers winsock2.h closesocket -lws2_32 &&
  5083. network_extralibs="-lws2_32"; } || disable winsock2_h network
  5084. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  5085. check_type ws2tcpip.h socklen_t
  5086. check_type ws2tcpip.h "struct addrinfo"
  5087. check_type ws2tcpip.h "struct group_source_req"
  5088. check_type ws2tcpip.h "struct ip_mreq_source"
  5089. check_type ws2tcpip.h "struct ipv6_mreq"
  5090. check_type winsock2.h "struct pollfd"
  5091. check_struct winsock2.h "struct sockaddr" sa_len
  5092. check_type ws2tcpip.h "struct sockaddr_in6"
  5093. check_type ws2tcpip.h "struct sockaddr_storage"
  5094. else
  5095. disable network
  5096. fi
  5097. fi
  5098. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  5099. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  5100. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  5101. check_builtin sarestart signal.h "SA_RESTART"
  5102. check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" -lpthread
  5103. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  5104. check_builtin gmtime_r time.h "time_t *time; struct tm *tm; gmtime_r(time, tm)"
  5105. check_builtin localtime_r time.h "time_t *time; struct tm *tm; localtime_r(time, tm)"
  5106. check_builtin x264_csp_bgr "stdint.h x264.h" "X264_CSP_BGR"
  5107. case "$custom_allocator" in
  5108. jemalloc)
  5109. # jemalloc by default does not use a prefix
  5110. require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc
  5111. ;;
  5112. tcmalloc)
  5113. require_pkg_config libtcmalloc gperftools/tcmalloc.h tc_malloc
  5114. malloc_prefix=tc_
  5115. ;;
  5116. esac
  5117. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  5118. check_func ${malloc_prefix}memalign && enable memalign
  5119. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  5120. check_func access
  5121. check_func_headers stdlib.h arc4random
  5122. check_func_headers time.h clock_gettime ||
  5123. { check_lib time.h clock_gettime -lrt && LIBRT="-lrt"; }
  5124. check_func fcntl
  5125. check_func fork
  5126. check_func gethrtime
  5127. check_func getopt
  5128. check_func getrusage
  5129. check_func gettimeofday
  5130. check_func isatty
  5131. check_func mach_absolute_time
  5132. check_func mkstemp
  5133. check_func mmap
  5134. check_func mprotect
  5135. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  5136. check_func_headers time.h nanosleep ||
  5137. { check_lib time.h nanosleep -lrt && LIBRT="-lrt"; }
  5138. check_func sched_getaffinity
  5139. check_func setrlimit
  5140. check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
  5141. check_func strerror_r
  5142. check_func sysconf
  5143. check_func sysctl
  5144. check_func usleep
  5145. check_func_headers conio.h kbhit
  5146. check_func_headers io.h setmode
  5147. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  5148. check_func_headers stdlib.h getenv
  5149. check_func_headers sys/stat.h lstat
  5150. check_func_headers windows.h CoTaskMemFree -lole32
  5151. check_func_headers windows.h GetProcessAffinityMask
  5152. check_func_headers windows.h GetProcessTimes
  5153. check_func_headers windows.h GetSystemTimeAsFileTime
  5154. check_func_headers windows.h LoadLibrary
  5155. check_func_headers windows.h MapViewOfFile
  5156. check_func_headers windows.h PeekNamedPipe
  5157. check_func_headers windows.h SetConsoleTextAttribute
  5158. check_func_headers windows.h SetConsoleCtrlHandler
  5159. check_func_headers windows.h Sleep
  5160. check_func_headers windows.h VirtualAlloc
  5161. check_struct windows.h "CONDITION_VARIABLE" Ptr
  5162. check_func_headers glob.h glob
  5163. enabled xlib &&
  5164. check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
  5165. check_header AudioToolbox/AudioToolbox.h
  5166. check_header direct.h
  5167. check_header dirent.h
  5168. check_header dlfcn.h
  5169. check_header d3d11.h
  5170. check_header dxva.h
  5171. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  5172. check_header io.h
  5173. check_header libcrystalhd/libcrystalhd_if.h
  5174. check_header mach/mach_time.h
  5175. check_header malloc.h
  5176. check_header net/udplite.h
  5177. check_header poll.h
  5178. check_header sys/mman.h
  5179. check_header sys/param.h
  5180. check_header sys/resource.h
  5181. check_header sys/select.h
  5182. check_header sys/time.h
  5183. check_header sys/un.h
  5184. check_header termios.h
  5185. check_header unistd.h
  5186. check_header valgrind/valgrind.h
  5187. check_header vdpau/vdpau.h
  5188. check_header vdpau/vdpau_x11.h
  5189. check_header VideoDecodeAcceleration/VDADecoder.h
  5190. check_header VideoToolbox/VideoToolbox.h
  5191. check_func_headers VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox
  5192. enabled videotoolbox && check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferColorPrimaries_ITU_R_2020 -framework CoreVideo
  5193. check_header windows.h
  5194. check_header X11/extensions/XvMClib.h
  5195. check_header asm/types.h
  5196. # it seems there are versions of clang in some distros that try to use the
  5197. # gcc headers, which explodes for stdatomic
  5198. # so we also check that atomics actually work here
  5199. check_builtin stdatomic_h stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0)"
  5200. check_lib "windows.h shellapi.h" CommandLineToArgvW -lshell32
  5201. check_lib "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  5202. check_lib "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  5203. check_lib "CoreServices/CoreServices.h" UTGetOSTypeFromString "-framework CoreServices"
  5204. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  5205. check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  5206. check_type "windows.h dxva.h" "DXVA_PicParams_VP9" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  5207. check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
  5208. check_type "windows.h d3d11.h" "ID3D11VideoContext"
  5209. check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
  5210. check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
  5211. check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
  5212. check_type "va/va.h va/va_vpp.h" "VAProcPipelineParameterBuffer"
  5213. check_type "va/va.h va/va_enc_h264.h" "VAEncPictureParameterBufferH264"
  5214. check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
  5215. check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
  5216. check_type "va/va.h va/va_enc_mpeg2.h" "VAEncPictureParameterBufferMPEG2"
  5217. check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8"
  5218. check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
  5219. check_cpp_condition windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)" && enable winrt || disable winrt
  5220. if ! disabled w32threads && ! enabled pthreads; then
  5221. check_func_headers "windows.h process.h" _beginthreadex &&
  5222. enable w32threads || disable w32threads
  5223. if ! enabled w32threads && enabled winrt; then
  5224. check_func_headers "windows.h" CreateThread &&
  5225. enable w32threads || disable w32threads
  5226. fi
  5227. fi
  5228. # check for some common methods of building with pthread support
  5229. # do this before the optional library checks as some of them require pthreads
  5230. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  5231. enable pthreads
  5232. if check_func pthread_join -pthread && check_func pthread_create -pthread; then
  5233. add_cflags -pthread
  5234. add_extralibs -pthread
  5235. elif check_func pthread_join -pthreads && check_func pthread_create -pthreads; then
  5236. add_cflags -pthreads
  5237. add_extralibs -pthreads
  5238. elif check_func pthread_join -ldl -pthread && check_func pthread_create -ldl -pthread; then
  5239. add_cflags -ldl -pthread
  5240. add_extralibs -ldl -pthread
  5241. elif check_func pthread_join -lpthreadGC2 && check_func pthread_create -lpthreadGC2; then
  5242. add_extralibs -lpthreadGC2
  5243. elif check_lib pthread.h pthread_join -lpthread && check_lib pthread.h pthread_create -lpthread; then
  5244. :
  5245. elif ! check_func pthread_join && ! check_func pthread_create; then
  5246. disable pthreads
  5247. fi
  5248. check_code cc "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER" || disable pthreads
  5249. fi
  5250. if enabled pthreads; then
  5251. check_func pthread_cancel
  5252. fi
  5253. enabled pthreads &&
  5254. check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)"
  5255. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  5256. disabled bzlib || check_lib bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  5257. disabled lzma || check_lib lzma.h lzma_version_number -llzma || disable lzma
  5258. check_lib math.h sin -lm && LIBM="-lm"
  5259. disabled crystalhd || check_lib "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  5260. atan2f_args=2
  5261. copysign_args=2
  5262. hypot_args=2
  5263. ldexpf_args=2
  5264. powf_args=2
  5265. for func in $MATH_FUNCS; do
  5266. eval check_mathfunc $func \${${func}_args:-1}
  5267. done
  5268. for func in $COMPLEX_FUNCS; do
  5269. eval check_complexfunc $func \${${func}_args:-1}
  5270. done
  5271. # these are off by default, so fail if requested and not available
  5272. enabled avfoundation_indev && { check_header_objcc AVFoundation/AVFoundation.h || disable avfoundation_indev; }
  5273. enabled avfoundation_indev && { check_lib CoreGraphics/CoreGraphics.h CGGetActiveDisplayList -framework CoreGraphics ||
  5274. check_lib ApplicationServices/ApplicationServices.h CGGetActiveDisplayList -framework ApplicationServices; }
  5275. enabled cuda && check_header cuda.h # this is not a dependency
  5276. enabled cuvid && { enabled cuda ||
  5277. die "ERROR: CUVID requires CUDA"; }
  5278. enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint
  5279. enabled coreimage_filter && { check_header_objcc QuartzCore/CoreImage.h || disable coreimage_filter; }
  5280. enabled coreimagesrc_filter && { check_header_objcc QuartzCore/CoreImage.h || disable coreimagesrc_filter; }
  5281. enabled decklink && { { check_header DeckLinkAPI.h || die "ERROR: DeckLinkAPI.h header not found"; } &&
  5282. { check_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a060100" || die "ERROR: Decklink API version must be >= 10.6.1."; } }
  5283. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  5284. enabled gmp && require gmp gmp.h mpz_export -lgmp
  5285. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  5286. enabled jni && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads &&
  5287. check_lib "dlfcn.h" dlopen -ldl || die "ERROR: jni not found"; }
  5288. enabled ladspa && { check_header ladspa.h || die "ERROR: ladspa.h header not found"; }
  5289. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  5290. enabled libass && require_pkg_config libass ass/ass.h ass_library_init
  5291. enabled libbluray && require_pkg_config libbluray libbluray/bluray.h bd_open
  5292. enabled libbs2b && require_pkg_config libbs2b bs2b.h bs2b_open
  5293. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  5294. { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
  5295. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  5296. enabled libcaca && require_pkg_config caca caca.h caca_create_canvas
  5297. enabled libfdk_aac && { use_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
  5298. { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
  5299. warn "using libfdk without pkg-config"; } }
  5300. flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
  5301. enabled libflite && require libflite "flite/flite.h" flite_init $flite_libs
  5302. enabled fontconfig && enable libfontconfig
  5303. enabled libfontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  5304. enabled libfreetype && require_libfreetype
  5305. enabled libfribidi && require_pkg_config fribidi fribidi.h fribidi_version_info
  5306. enabled libgme && require libgme gme/gme.h gme_new_emu -lgme -lstdc++
  5307. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  5308. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  5309. done || die "ERROR: libgsm not found"; }
  5310. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  5311. enabled libkvazaar && require_pkg_config "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
  5312. enabled libmfx && require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit
  5313. enabled libmodplug && require_pkg_config libmodplug libmodplug/modplug.h ModPlug_Load
  5314. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  5315. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  5316. enabled libnpp && { check_lib npp.h nppGetLibVersion -lnppig -lnppicc -lnppc ||
  5317. check_lib npp.h nppGetLibVersion -lnppi -lnppc ||
  5318. die "ERROR: libnpp not found"; }
  5319. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  5320. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  5321. enabled libopencv && { check_header opencv2/core/core_c.h &&
  5322. { use_pkg_config opencv opencv2/core/core_c.h cvCreateImageHeader ||
  5323. require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
  5324. require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader; }
  5325. enabled libopenh264 && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion
  5326. enabled libopenjpeg && { { check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
  5327. check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 ||
  5328. { check_lib openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
  5329. { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
  5330. { check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
  5331. die "ERROR: libopenjpeg not found"; }
  5332. enabled libopenmpt && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
  5333. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  5334. enabled libpulse && require_pkg_config libpulse pulse/pulseaudio.h pa_context_new
  5335. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  5336. enabled librubberband && require_pkg_config "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new
  5337. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  5338. enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer
  5339. enabled libsmbclient && { use_pkg_config smbclient libsmbclient.h smbc_init ||
  5340. require smbclient libsmbclient.h smbc_init -lsmbclient; }
  5341. enabled libsnappy && require snappy snappy-c.h snappy_compress -lsnappy
  5342. enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr && LIBSOXR="-lsoxr"
  5343. enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init
  5344. enabled libspeex && require_pkg_config speex speex/speex.h speex_decoder_init -lspeex
  5345. enabled libtesseract && require_pkg_config tesseract tesseract/capi.h TessBaseAPICreate
  5346. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  5347. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  5348. { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  5349. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  5350. enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
  5351. enabled libvidstab && require_pkg_config "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
  5352. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  5353. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  5354. enabled libvpx && {
  5355. enabled libvpx_vp8_decoder && {
  5356. use_pkg_config "vpx >= 0.9.1" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
  5357. check_lib "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  5358. die "ERROR: libvpx decoder version must be >=0.9.1";
  5359. }
  5360. enabled libvpx_vp8_encoder && {
  5361. use_pkg_config "vpx >= 0.9.7" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
  5362. check_lib "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
  5363. die "ERROR: libvpx encoder version must be >=0.9.7";
  5364. }
  5365. enabled libvpx_vp9_decoder && {
  5366. use_pkg_config "vpx >= 1.3.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
  5367. check_lib "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx ||
  5368. disable libvpx_vp9_decoder;
  5369. }
  5370. enabled libvpx_vp9_encoder && {
  5371. use_pkg_config "vpx >= 1.3.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
  5372. check_lib "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx ||
  5373. disable libvpx_vp9_encoder;
  5374. }
  5375. if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
  5376. die "libvpx enabled but no supported decoders found"
  5377. fi
  5378. }
  5379. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  5380. enabled libwebp && {
  5381. enabled libwebp_encoder && require_pkg_config "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
  5382. enabled libwebp_anim_encoder && { use_pkg_config "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit || disable libwebp_anim_encoder; } }
  5383. enabled libx264 && { use_pkg_config x264 "stdint.h x264.h" x264_encoder_encode ||
  5384. { require libx264 "stdint.h x264.h" x264_encoder_encode -lx264 &&
  5385. warn "using libx264 without pkg-config"; } } &&
  5386. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  5387. die "ERROR: libx264 must be installed and version must be >= 0.118."; } &&
  5388. { check_cpp_condition x264.h "X264_MPEG2" &&
  5389. enable libx262; }
  5390. enabled libx265 && require_pkg_config x265 x265.h x265_api_get &&
  5391. { check_cpp_condition x265.h "X265_BUILD >= 68" ||
  5392. die "ERROR: libx265 version must be >= 68."; }
  5393. enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs
  5394. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  5395. enabled libzimg && require_pkg_config "zimg >= 2.3.0" zimg.h zimg_get_api_version
  5396. enabled libzmq && require_pkg_config libzmq zmq.h zmq_ctx_new
  5397. enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi &&
  5398. { check_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" ||
  5399. enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; }
  5400. enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; }
  5401. enabled mmal && { check_lib interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
  5402. { ! enabled cross_compile && {
  5403. add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline ;
  5404. add_extralibs -L/opt/vc/lib/ -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ;
  5405. check_lib interface/mmal/mmal.h mmal_port_connect ; }
  5406. check_lib interface/mmal/mmal.h mmal_port_connect ; } ||
  5407. die "ERROR: mmal not found"; }
  5408. enabled mmal && check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"
  5409. enabled netcdf && require_pkg_config netcdf netcdf.h nc_inq_libvers
  5410. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  5411. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  5412. die "ERROR: openal not found"; } &&
  5413. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  5414. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  5415. enabled opencl && { check_lib OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
  5416. check_lib CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
  5417. die "ERROR: opencl not found"; } &&
  5418. { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
  5419. check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
  5420. die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
  5421. enabled opengl && { check_lib GL/glx.h glXGetProcAddress "-lGL" ||
  5422. check_lib windows.h wglGetProcAddress "-lopengl32 -lgdi32" ||
  5423. check_lib OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" ||
  5424. check_lib ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
  5425. die "ERROR: opengl not found."
  5426. }
  5427. enabled omx_rpi && enable omx
  5428. enabled omx && { check_header OMX_Core.h ||
  5429. { ! enabled cross_compile && enabled omx_rpi && {
  5430. add_cflags -isystem/opt/vc/include/IL ; }
  5431. check_header OMX_Core.h ; } ||
  5432. die "ERROR: OpenMAX IL headers not found"; }
  5433. enabled openssl && { use_pkg_config openssl openssl/ssl.h OPENSSL_init_ssl ||
  5434. use_pkg_config openssl openssl/ssl.h SSL_library_init ||
  5435. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  5436. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  5437. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  5438. die "ERROR: openssl not found"; }
  5439. enabled qtkit_indev && { check_header_objcc QTKit/QTKit.h || disable qtkit_indev; }
  5440. # libdc1394 check
  5441. if enabled libdc1394; then
  5442. { require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new &&
  5443. enable libdc1394_2; } ||
  5444. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  5445. enable libdc1394_1; } ||
  5446. die "ERROR: No version of libdc1394 found "
  5447. fi
  5448. if enabled gcrypt; then
  5449. GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
  5450. if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then
  5451. gcrypt_cflags=$("${GCRYPT_CONFIG}" --cflags)
  5452. gcrypt_libs=$("${GCRYPT_CONFIG}" --libs)
  5453. check_func_headers gcrypt.h gcry_mpi_new $gcrypt_cflags $gcrypt_libs ||
  5454. die "ERROR: gcrypt not found"
  5455. add_cflags $gcrypt_cflags && add_extralibs $gcrypt_libs
  5456. else
  5457. require gcrypt gcrypt.h gcry_mpi_new -lgcrypt
  5458. fi
  5459. fi
  5460. disabled sdl && disable sdl2
  5461. if ! disabled sdl2; then
  5462. SDL2_CONFIG="${cross_prefix}sdl2-config"
  5463. if check_pkg_config sdl2 SDL_events.h SDL_PollEvent; then
  5464. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
  5465. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
  5466. check_func SDL_Init $sdl2_libs $sdl2_cflags && enable sdl2
  5467. else
  5468. if "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
  5469. sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
  5470. sdl2_libs=$("${SDL2_CONFIG}" --libs)
  5471. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
  5472. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
  5473. check_func SDL_Init $sdl2_libs $sdl2_cflags && enable sdl2
  5474. fi
  5475. fi
  5476. if test $target_os = "mingw32"; then
  5477. sdl2_libs="$sdl2_libs -mconsole"
  5478. fi
  5479. fi
  5480. enabled sdl2 && enable sdl && add_cflags $sdl2_cflags && add_extralibs $sdl2_libs
  5481. disabled securetransport || { check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
  5482. check_lib "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
  5483. enable securetransport; }
  5484. disabled schannel || { check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 &&
  5485. check_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" && enable schannel && add_extralibs -lsecur32; }
  5486. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  5487. enabled makeinfo \
  5488. && [ 0$(makeinfo --version | grep "texinfo" | sed 's/.*texinfo[^0-9]*\([0-9]*\)\..*/\1/') -ge 5 ] \
  5489. && enable makeinfo_html || disable makeinfo_html
  5490. disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  5491. perl -v > /dev/null 2>&1 && enable perl || disable perl
  5492. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  5493. rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  5494. check_header linux/fb.h
  5495. check_header linux/videodev.h
  5496. check_header linux/videodev2.h
  5497. check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  5498. check_header sys/videoio.h
  5499. check_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  5500. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  5501. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  5502. # w32api 3.12 had it defined wrong
  5503. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  5504. check_type "dshow.h" IBaseFilter
  5505. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  5506. { check_header dev/bktr/ioctl_meteor.h &&
  5507. check_header dev/bktr/ioctl_bt848.h; } ||
  5508. { check_header machine/ioctl_meteor.h &&
  5509. check_header machine/ioctl_bt848.h; } ||
  5510. { check_header dev/video/meteor/ioctl_meteor.h &&
  5511. check_header dev/video/bktr/ioctl_bt848.h; } ||
  5512. check_header dev/ic/bt8xx.h
  5513. check_header sndio.h
  5514. if check_struct sys/soundcard.h audio_buf_info bytes; then
  5515. enable_safe sys/soundcard.h
  5516. else
  5517. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  5518. #include <sys/soundcard.h>
  5519. audio_buf_info abc;
  5520. EOF
  5521. fi
  5522. check_header soundcard.h
  5523. enabled_any alsa_indev alsa_outdev &&
  5524. check_lib alsa/asoundlib.h snd_pcm_htimestamp -lasound
  5525. enabled jack_indev && check_lib jack/jack.h jack_client_open -ljack &&
  5526. check_func jack_port_get_latency_range -ljack
  5527. enabled_any sndio_indev sndio_outdev && check_lib sndio.h sio_open -lsndio
  5528. if enabled libcdio; then
  5529. check_lib "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  5530. check_lib "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  5531. die "ERROR: No usable libcdio/cdparanoia found"
  5532. fi
  5533. if ! disabled libxcb; then
  5534. check_pkg_config "xcb >= 1.4" xcb/xcb.h xcb_connect || {
  5535. enabled libxcb && die "ERROR: libxcb >= 1.4 not found";
  5536. } && enable libxcb
  5537. if enabled libxcb; then
  5538. disabled libxcb_shm || {
  5539. check_pkg_config xcb-shm xcb/shm.h xcb_shm_attach || {
  5540. enabled libxcb_shm && die "ERROR: libxcb_shm not found";
  5541. } && check_header sys/shm.h && enable libxcb_shm; }
  5542. disabled libxcb_xfixes || {
  5543. check_pkg_config xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image || {
  5544. enabled libxcb_xfixes && die "ERROR: libxcb_xfixes not found";
  5545. } && enable libxcb_xfixes; }
  5546. disabled libxcb_shape || {
  5547. check_pkg_config xcb-shape xcb/shape.h xcb_shape_get_rectangles || {
  5548. enabled libxcb_shape && die "ERROR: libxcb_shape not found";
  5549. } && enable libxcb_shape; }
  5550. add_cflags $xcb_cflags $xcb_shm_cflags $xcb_xfixes_cflags $xcb_shape_cflags
  5551. add_extralibs $xcb_libs $xcb_shm_libs $xcb_xfixes_libs $xcb_shape_libs
  5552. fi
  5553. fi
  5554. check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs"
  5555. enabled dxva2api_h &&
  5556. check_cc <<EOF && enable dxva2api_cobj
  5557. #define _WIN32_WINNT 0x0600
  5558. #define COBJMACROS
  5559. #include <windows.h>
  5560. #include <d3d9.h>
  5561. #include <dxva2api.h>
  5562. int main(void) { IDirectXVideoDecoder *o = NULL; IDirectXVideoDecoder_Release(o); return 0; }
  5563. EOF
  5564. enabled vaapi &&
  5565. check_lib va/va.h vaInitialize -lva ||
  5566. disable vaapi
  5567. enabled vaapi &&
  5568. check_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" ||
  5569. disable vaapi
  5570. enabled vaapi &&
  5571. check_lib "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm &&
  5572. enable vaapi_drm
  5573. enabled vdpau &&
  5574. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  5575. disable vdpau
  5576. enabled_any vaapi vdpau && check_lib X11/Xlib.h XOpenDisplay -lX11 && enable xlib
  5577. enabled vaapi && enabled xlib &&
  5578. check_lib "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 &&
  5579. enable vaapi_x11
  5580. enabled vdpau && enabled xlib &&
  5581. check_lib "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau &&
  5582. enable vdpau_x11
  5583. if enabled x86; then
  5584. case $target_os in
  5585. mingw32*|mingw64*|win32|win64|linux|cygwin*)
  5586. ;;
  5587. *)
  5588. disable cuda cuvid nvenc
  5589. ;;
  5590. esac
  5591. else
  5592. disable cuda cuvid nvenc
  5593. fi
  5594. enabled nvenc &&
  5595. check_cc -I$source_path <<EOF || disable nvenc
  5596. #include "compat/nvenc/nvEncodeAPI.h"
  5597. NV_ENCODE_API_FUNCTION_LIST flist;
  5598. void f(void) { struct { const GUID guid; } s[] = { { NV_ENC_PRESET_HQ_GUID } }; }
  5599. int main(void) { return 0; }
  5600. EOF
  5601. # Funny iconv installations are not unusual, so check it after all flags have been set
  5602. disabled iconv || check_func_headers iconv.h iconv || check_lib iconv.h iconv -liconv || disable iconv
  5603. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  5604. # add some useful compiler flags if supported
  5605. check_cflags -Wdeclaration-after-statement
  5606. check_cflags -Wall
  5607. check_cflags -Wdisabled-optimization
  5608. check_cflags -Wpointer-arith
  5609. check_cflags -Wredundant-decls
  5610. check_cflags -Wwrite-strings
  5611. check_cflags -Wtype-limits
  5612. check_cflags -Wundef
  5613. check_cflags -Wmissing-prototypes
  5614. check_cflags -Wno-pointer-to-int-cast
  5615. check_cflags -Wstrict-prototypes
  5616. check_cflags -Wempty-body
  5617. enabled extra_warnings && check_cflags -Winline
  5618. enabled extra_warnings && check_cflags -Wcast-qual
  5619. check_disable_warning(){
  5620. warning_flag=-W${1#-Wno-}
  5621. test_cflags $warning_flag && add_cflags $1
  5622. }
  5623. check_disable_warning -Wno-parentheses
  5624. check_disable_warning -Wno-switch
  5625. check_disable_warning -Wno-format-zero-length
  5626. check_disable_warning -Wno-pointer-sign
  5627. check_disable_warning -Wno-unused-const-variable
  5628. # add some linker flags
  5629. check_ldflags -Wl,--warn-common
  5630. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  5631. enabled rpath && add_ldexeflags -Wl,-rpath,$libdir
  5632. enabled rpath && add_ldlibflags -Wl,-rpath,$libdir
  5633. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  5634. # add some strip flags
  5635. # -wN '..@*' is more selective than -x, but not available everywhere.
  5636. check_stripflags -wN \'..@*\' || check_stripflags -x
  5637. enabled neon_clobber_test &&
  5638. check_ldflags -Wl,--wrap,avcodec_open2 \
  5639. -Wl,--wrap,avcodec_decode_audio4 \
  5640. -Wl,--wrap,avcodec_decode_video2 \
  5641. -Wl,--wrap,avcodec_decode_subtitle2 \
  5642. -Wl,--wrap,avcodec_encode_audio2 \
  5643. -Wl,--wrap,avcodec_encode_video2 \
  5644. -Wl,--wrap,avcodec_encode_subtitle \
  5645. -Wl,--wrap,avcodec_send_packet \
  5646. -Wl,--wrap,avcodec_receive_packet \
  5647. -Wl,--wrap,avcodec_send_frame \
  5648. -Wl,--wrap,avcodec_receive_frame \
  5649. -Wl,--wrap,swr_convert \
  5650. -Wl,--wrap,avresample_convert ||
  5651. disable neon_clobber_test
  5652. enabled xmm_clobber_test &&
  5653. check_ldflags -Wl,--wrap,avcodec_open2 \
  5654. -Wl,--wrap,avcodec_decode_audio4 \
  5655. -Wl,--wrap,avcodec_decode_video2 \
  5656. -Wl,--wrap,avcodec_decode_subtitle2 \
  5657. -Wl,--wrap,avcodec_encode_audio2 \
  5658. -Wl,--wrap,avcodec_encode_video2 \
  5659. -Wl,--wrap,avcodec_encode_subtitle \
  5660. -Wl,--wrap,avcodec_send_packet \
  5661. -Wl,--wrap,avcodec_receive_packet \
  5662. -Wl,--wrap,avcodec_send_frame \
  5663. -Wl,--wrap,avcodec_receive_frame \
  5664. -Wl,--wrap,swr_convert \
  5665. -Wl,--wrap,avresample_convert \
  5666. -Wl,--wrap,sws_scale ||
  5667. disable xmm_clobber_test
  5668. check_ld "cc" <<EOF && enable proper_dce
  5669. extern const int array[512];
  5670. static inline int func(void) { return array[0]; }
  5671. int main(void) { return 0; }
  5672. EOF
  5673. if enabled proper_dce; then
  5674. echo "X { local: *; };" > $TMPV
  5675. if test_ldflags -Wl,${version_script},$TMPV; then
  5676. append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
  5677. check_cc <<EOF && enable symver_asm_label
  5678. void ff_foo(void) __asm__ ("av_foo@VERSION");
  5679. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  5680. EOF
  5681. check_cc <<EOF && enable symver_gnu_asm
  5682. __asm__(".symver ff_foo,av_foo@VERSION");
  5683. void ff_foo(void) {}
  5684. EOF
  5685. fi
  5686. fi
  5687. if [ -z "$optflags" ]; then
  5688. if enabled small; then
  5689. optflags=$cflags_size
  5690. elif enabled optimizations; then
  5691. optflags=$cflags_speed
  5692. else
  5693. optflags=$cflags_noopt
  5694. fi
  5695. fi
  5696. check_optflags(){
  5697. check_cflags "$@"
  5698. enabled lto && check_ldflags "$@"
  5699. }
  5700. if enabled lto; then
  5701. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  5702. check_cflags -flto
  5703. check_ldflags -flto $cpuflags
  5704. disable inline_asm_direct_symbol_refs
  5705. fi
  5706. check_optflags $optflags
  5707. check_optflags -fno-math-errno
  5708. check_optflags -fno-signed-zeros
  5709. enabled ftrapv && check_cflags -ftrapv
  5710. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  5711. int x;
  5712. EOF
  5713. if enabled icc; then
  5714. # Just warnings, no remarks
  5715. check_cflags -w1
  5716. # -wd: Disable following warnings
  5717. # 144, 167, 556: -Wno-pointer-sign
  5718. # 188: enumerated type mixed with another type
  5719. # 1292: attribute "foo" ignored
  5720. # 1419: external declaration in primary source file
  5721. # 10006: ignoring unknown option -fno-signed-zeros
  5722. # 10148: ignoring unknown option -Wno-parentheses
  5723. # 10156: ignoring option '-W'; no argument required
  5724. # 13200: No EMMS instruction before call to function
  5725. # 13203: No EMMS instruction before return from function
  5726. check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156,13200,13203
  5727. # 11030: Warning unknown option --as-needed
  5728. # 10156: ignoring option '-export'; no argument required
  5729. check_ldflags -wd10156,11030
  5730. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  5731. enable ebp_available
  5732. # The test above does not test linking
  5733. enabled lto && disable symver_asm_label
  5734. if enabled x86_32; then
  5735. icc_version=$($cc -dumpversion)
  5736. test ${icc_version%%.*} -ge 11 &&
  5737. check_cflags -falign-stack=maintain-16-byte ||
  5738. disable aligned_stack
  5739. fi
  5740. elif enabled ccc; then
  5741. # disable some annoying warnings
  5742. add_cflags -msg_disable bitnotint
  5743. add_cflags -msg_disable mixfuncvoid
  5744. add_cflags -msg_disable nonstandcast
  5745. add_cflags -msg_disable unsupieee
  5746. elif enabled gcc; then
  5747. check_optflags -fno-tree-vectorize
  5748. check_cflags -Werror=format-security
  5749. check_cflags -Werror=implicit-function-declaration
  5750. check_cflags -Werror=missing-prototypes
  5751. check_cflags -Werror=return-type
  5752. check_cflags -Werror=vla
  5753. check_cflags -Wformat
  5754. check_cflags -fdiagnostics-color=auto
  5755. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  5756. elif enabled llvm_gcc; then
  5757. check_cflags -mllvm -stack-alignment=16
  5758. elif enabled clang; then
  5759. check_cflags -mllvm -stack-alignment=16
  5760. check_cflags -mstack-alignment=16
  5761. check_cflags -Qunused-arguments
  5762. check_cflags -Werror=implicit-function-declaration
  5763. check_cflags -Werror=missing-prototypes
  5764. check_cflags -Werror=return-type
  5765. elif enabled cparser; then
  5766. add_cflags -Wno-missing-variable-declarations
  5767. add_cflags -Wno-empty-statement
  5768. elif enabled armcc; then
  5769. add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
  5770. add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
  5771. # 2523: use of inline assembly is deprecated
  5772. add_cflags -W${armcc_opt},--diag_suppress=2523
  5773. add_cflags -W${armcc_opt},--diag_suppress=1207
  5774. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  5775. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  5776. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  5777. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  5778. elif enabled tms470; then
  5779. add_cflags -pds=824 -pds=837
  5780. disable inline_asm
  5781. elif enabled pathscale; then
  5782. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  5783. elif enabled_any msvc icl; then
  5784. enabled x86_32 && disable aligned_stack
  5785. enabled_all x86_32 debug && add_cflags -Oy-
  5786. enabled debug && add_ldflags -debug
  5787. enable pragma_deprecated
  5788. if enabled icl; then
  5789. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  5790. # (correctly) on icl 13.x.
  5791. check_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  5792. add_cflags -Qansi-alias
  5793. # Some inline asm is not compilable in debug
  5794. if enabled debug; then
  5795. disable ebp_available
  5796. disable ebx_available
  5797. fi
  5798. fi
  5799. # msvcrt10 x64 incorrectly enables log2, only msvcrt12 (MSVC 2013) onwards actually has log2.
  5800. check_cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION >= 12" || disable log2
  5801. # The CRT headers contain __declspec(restrict) in a few places, but if redefining
  5802. # restrict, this might break. MSVC 2010 and 2012 fail with __declspec(__restrict)
  5803. # (as it ends up if the restrict redefine is done before including stdlib.h), while
  5804. # MSVC 2013 and newer can handle it fine.
  5805. # If this declspec fails, force including stdlib.h before the restrict redefinition
  5806. # happens in config.h.
  5807. if [ $_restrict != restrict ]; then
  5808. check_cc <<EOF || add_cflags -FIstdlib.h
  5809. __declspec($_restrict) void* foo(int);
  5810. EOF
  5811. fi
  5812. # the new SSA optimzer in VS2015 U3 is mis-optimizing some parts of the code
  5813. # Issue has been fixed in MSVC v19.00.24218.
  5814. check_cpp_condition windows.h "_MSC_FULL_VER >= 190024218" ||
  5815. check_cflags -d2SSAOptimizer-
  5816. # enable utf-8 source processing on VS2015 U2 and newer
  5817. check_cpp_condition windows.h "_MSC_FULL_VER >= 190023918" &&
  5818. add_cflags -utf-8
  5819. fi
  5820. for pfx in "" host_; do
  5821. varname=${pfx%_}cc_type
  5822. eval "type=\$$varname"
  5823. if [ $type = "msvc" ]; then
  5824. check_${pfx}cc <<EOF || add_${pfx}cflags -Dinline=__inline
  5825. static inline int foo(int a) { return a; }
  5826. EOF
  5827. fi
  5828. done
  5829. case $as_type in
  5830. clang)
  5831. add_asflags -Qunused-arguments
  5832. ;;
  5833. esac
  5834. case $ld_type in
  5835. clang)
  5836. check_ldflags -Qunused-arguments
  5837. ;;
  5838. esac
  5839. case $target_os in
  5840. osf1)
  5841. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  5842. ;;
  5843. plan9)
  5844. add_cppflags -Dmain=plan9_main
  5845. ;;
  5846. esac
  5847. enable frame_thread_encoder
  5848. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  5849. check_deps $CONFIG_LIST \
  5850. $CONFIG_EXTRA \
  5851. $HAVE_LIST \
  5852. $ALL_COMPONENTS \
  5853. enabled threads && ! enabled pthreads && ! enabled atomics_native && die "non pthread threading without atomics not supported, try adding --enable-pthreads or --cpu=i486 or higher if you are on x86"
  5854. if test $target_os = "haiku"; then
  5855. disable memalign
  5856. disable posix_memalign
  5857. fi
  5858. enabled_all dxva2 dxva2api_cobj CoTaskMemFree &&
  5859. prepend ffmpeg_libs $($ldflags_filter "-lole32") &&
  5860. enable dxva2_lib
  5861. # add_dep lib dep
  5862. # -> enable ${lib}_deps_${dep}
  5863. # -> add $dep to ${lib}_deps only once
  5864. add_dep() {
  5865. lib=$1
  5866. dep=$2
  5867. enabled "${lib}_deps_${dep}" && return 0
  5868. enable "${lib}_deps_${dep}"
  5869. prepend "${lib}_deps" $dep
  5870. }
  5871. # merge deps lib components
  5872. # merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
  5873. merge_deps() {
  5874. lib=$1
  5875. shift
  5876. for comp in $*; do
  5877. enabled $comp || continue
  5878. eval "dep=\"\$${comp}_deps\""
  5879. for d in $dep; do
  5880. add_dep $lib $d
  5881. done
  5882. done
  5883. }
  5884. merge_deps libavfilter $FILTER_LIST
  5885. map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
  5886. for thread in $THREADS_LIST; do
  5887. if enabled $thread; then
  5888. test -n "$thread_type" &&
  5889. die "ERROR: Only one thread type must be selected." ||
  5890. thread_type="$thread"
  5891. fi
  5892. done
  5893. if disabled stdatomic_h; then
  5894. if enabled atomics_gcc; then
  5895. add_cppflags '-I\$(SRC_PATH)/compat/atomics/gcc'
  5896. elif enabled atomics_win32; then
  5897. add_cppflags '-I\$(SRC_PATH)/compat/atomics/win32'
  5898. elif enabled atomics_suncc; then
  5899. add_cppflags '-I\$(SRC_PATH)/compat/atomics/suncc'
  5900. elif enabled pthreads; then
  5901. add_compat atomics/pthread/stdatomic.o
  5902. add_cppflags '-I\$(SRC_PATH)/compat/atomics/pthread'
  5903. else
  5904. enabled threads && die "Threading is enabled, but no atomics are available"
  5905. add_cppflags '-I\$(SRC_PATH)/compat/atomics/dummy'
  5906. fi
  5907. fi
  5908. # Check if requested libraries were found.
  5909. for lib in $AUTODETECT_LIBS; do
  5910. requested $lib && ! enabled $lib && die "ERROR: $lib requested but not found";
  5911. done
  5912. enabled zlib && add_cppflags -DZLIB_CONST
  5913. # conditional library dependencies, in linking order
  5914. enabled afftfilt_filter && prepend avfilter_deps "avcodec"
  5915. enabled amovie_filter && prepend avfilter_deps "avformat avcodec"
  5916. enabled aresample_filter && prepend avfilter_deps "swresample"
  5917. enabled atempo_filter && prepend avfilter_deps "avcodec"
  5918. enabled cover_rect_filter && prepend avfilter_deps "avformat avcodec"
  5919. enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample"
  5920. enabled elbg_filter && prepend avfilter_deps "avcodec"
  5921. enabled fftfilt_filter && prepend avfilter_deps "avcodec"
  5922. enabled find_rect_filter && prepend avfilter_deps "avformat avcodec"
  5923. enabled mcdeint_filter && prepend avfilter_deps "avcodec"
  5924. enabled movie_filter && prepend avfilter_deps "avformat avcodec"
  5925. enabled pan_filter && prepend avfilter_deps "swresample"
  5926. enabled pp_filter && prepend avfilter_deps "postproc"
  5927. enabled removelogo_filter && prepend avfilter_deps "avformat avcodec swscale"
  5928. enabled resample_filter && prepend avfilter_deps "avresample"
  5929. enabled sab_filter && prepend avfilter_deps "swscale"
  5930. enabled scale_filter && prepend avfilter_deps "swscale"
  5931. enabled scale2ref_filter && prepend avfilter_deps "swscale"
  5932. enabled sofalizer_filter && prepend avfilter_deps "avcodec"
  5933. enabled showcqt_filter && prepend avfilter_deps "avformat avcodec swscale"
  5934. enabled showfreqs_filter && prepend avfilter_deps "avcodec"
  5935. enabled showspectrum_filter && prepend avfilter_deps "avcodec"
  5936. enabled smartblur_filter && prepend avfilter_deps "swscale"
  5937. enabled spectrumsynth_filter && prepend avfilter_deps "avcodec"
  5938. enabled subtitles_filter && prepend avfilter_deps "avformat avcodec"
  5939. enabled uspp_filter && prepend avfilter_deps "avcodec"
  5940. enabled lavfi_indev && prepend avdevice_deps "avfilter"
  5941. enabled opus_decoder && prepend avcodec_deps "swresample"
  5942. expand_deps(){
  5943. lib_deps=${1}_deps
  5944. eval "deps=\$$lib_deps"
  5945. append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
  5946. unique $lib_deps
  5947. }
  5948. #we have to remove gpl from the deps here as some code assumes all lib deps are libs
  5949. postproc_deps="$(filter_out 'gpl' $postproc_deps)"
  5950. map 'expand_deps $v' $LIBRARY_LIST
  5951. license="LGPL version 2.1 or later"
  5952. if enabled nonfree; then
  5953. license="nonfree and unredistributable"
  5954. elif enabled gplv3; then
  5955. license="GPL version 3 or later"
  5956. elif enabled lgplv3; then
  5957. license="LGPL version 3 or later"
  5958. elif enabled gpl; then
  5959. license="GPL version 2 or later"
  5960. fi
  5961. if test "$quiet" != "yes"; then
  5962. echo "install prefix $prefix"
  5963. echo "source path $source_path"
  5964. echo "C compiler $cc"
  5965. echo "C library $libc_type"
  5966. if test "$host_cc" != "$cc"; then
  5967. echo "host C compiler $host_cc"
  5968. echo "host C library $host_libc_type"
  5969. fi
  5970. echo "ARCH $arch ($cpu)"
  5971. if test "$build_suffix" != ""; then
  5972. echo "build suffix $build_suffix"
  5973. fi
  5974. if test "$progs_suffix" != ""; then
  5975. echo "progs suffix $progs_suffix"
  5976. fi
  5977. if test "$extra_version" != ""; then
  5978. echo "version string suffix $extra_version"
  5979. fi
  5980. echo "big-endian ${bigendian-no}"
  5981. echo "runtime cpu detection ${runtime_cpudetect-no}"
  5982. if enabled x86; then
  5983. echo "${yasmexe} ${yasm-no}"
  5984. echo "MMX enabled ${mmx-no}"
  5985. echo "MMXEXT enabled ${mmxext-no}"
  5986. echo "3DNow! enabled ${amd3dnow-no}"
  5987. echo "3DNow! extended enabled ${amd3dnowext-no}"
  5988. echo "SSE enabled ${sse-no}"
  5989. echo "SSSE3 enabled ${ssse3-no}"
  5990. echo "AESNI enabled ${aesni-no}"
  5991. echo "AVX enabled ${avx-no}"
  5992. echo "XOP enabled ${xop-no}"
  5993. echo "FMA3 enabled ${fma3-no}"
  5994. echo "FMA4 enabled ${fma4-no}"
  5995. echo "i686 features enabled ${i686-no}"
  5996. echo "CMOV is fast ${fast_cmov-no}"
  5997. echo "EBX available ${ebx_available-no}"
  5998. echo "EBP available ${ebp_available-no}"
  5999. fi
  6000. if enabled aarch64; then
  6001. echo "NEON enabled ${neon-no}"
  6002. echo "VFP enabled ${vfp-no}"
  6003. fi
  6004. if enabled arm; then
  6005. echo "ARMv5TE enabled ${armv5te-no}"
  6006. echo "ARMv6 enabled ${armv6-no}"
  6007. echo "ARMv6T2 enabled ${armv6t2-no}"
  6008. echo "VFP enabled ${vfp-no}"
  6009. echo "NEON enabled ${neon-no}"
  6010. echo "THUMB enabled ${thumb-no}"
  6011. fi
  6012. if enabled mips; then
  6013. echo "MIPS FPU enabled ${mipsfpu-no}"
  6014. echo "MIPS DSP R1 enabled ${mipsdsp-no}"
  6015. echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
  6016. echo "MIPS MSA enabled ${msa-no}"
  6017. echo "LOONGSON MMI enabled ${mmi-no}"
  6018. fi
  6019. if enabled ppc; then
  6020. echo "AltiVec enabled ${altivec-no}"
  6021. echo "VSX enabled ${vsx-no}"
  6022. echo "POWER8 enabled ${power8-no}"
  6023. echo "PPC 4xx optimizations ${ppc4xx-no}"
  6024. echo "dcbzl available ${dcbzl-no}"
  6025. fi
  6026. echo "debug symbols ${debug-no}"
  6027. echo "strip symbols ${stripping-no}"
  6028. echo "optimize for size ${small-no}"
  6029. echo "optimizations ${optimizations-no}"
  6030. echo "static ${static-no}"
  6031. echo "shared ${shared-no}"
  6032. echo "postprocessing support ${postproc-no}"
  6033. echo "network support ${network-no}"
  6034. echo "threading support ${thread_type-no}"
  6035. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  6036. echo "texi2html enabled ${texi2html-no}"
  6037. echo "perl enabled ${perl-no}"
  6038. echo "pod2man enabled ${pod2man-no}"
  6039. echo "makeinfo enabled ${makeinfo-no}"
  6040. echo "makeinfo supports HTML ${makeinfo_html-no}"
  6041. test -n "$random_seed" &&
  6042. echo "random seed ${random_seed}"
  6043. echo
  6044. echo "External libraries:"
  6045. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_in_columns
  6046. echo
  6047. echo "External libraries providing hardware acceleration:"
  6048. print_enabled '' $HWACCEL_LIBRARY_LIST | print_in_columns
  6049. echo
  6050. echo "Libraries:"
  6051. print_enabled '' $LIBRARY_LIST | print_in_columns
  6052. echo
  6053. echo "Programs:"
  6054. print_enabled '' $PROGRAM_LIST | print_in_columns
  6055. echo
  6056. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  6057. echo "Enabled ${type}s:"
  6058. eval list=\$$(toupper $type)_LIST
  6059. print_enabled '_*' $list | print_in_columns
  6060. echo
  6061. done
  6062. echo "License: $license"
  6063. echo "Creating configuration files ..."
  6064. fi # test "$quiet" != "yes"
  6065. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  6066. enabled stripping || strip="echo skipping strip"
  6067. config_files="$TMPH config.mak doc/config.texi"
  6068. cat > config.mak <<EOF
  6069. # Automatically generated by configure - do not modify!
  6070. ifndef FFMPEG_CONFIG_MAK
  6071. FFMPEG_CONFIG_MAK=1
  6072. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  6073. prefix=$prefix
  6074. LIBDIR=\$(DESTDIR)$libdir
  6075. SHLIBDIR=\$(DESTDIR)$shlibdir
  6076. INCDIR=\$(DESTDIR)$incdir
  6077. BINDIR=\$(DESTDIR)$bindir
  6078. DATADIR=\$(DESTDIR)$datadir
  6079. DOCDIR=\$(DESTDIR)$docdir
  6080. MANDIR=\$(DESTDIR)$mandir
  6081. PKGCONFIGDIR=\$(DESTDIR)$pkgconfigdir
  6082. INSTALL_NAME_DIR=$install_name_dir
  6083. SRC_PATH=$source_path
  6084. SRC_LINK=$source_link
  6085. ifndef MAIN_MAKEFILE
  6086. SRC_PATH:=\$(SRC_PATH:.%=..%)
  6087. endif
  6088. CC_IDENT=$cc_ident
  6089. ARCH=$arch
  6090. INTRINSICS=$intrinsics
  6091. CC=$cc
  6092. CXX=$cxx
  6093. AS=$as
  6094. OBJCC=$objcc
  6095. LD=$ld
  6096. DEPCC=$dep_cc
  6097. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  6098. DEPAS=$as
  6099. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  6100. YASM=$yasmexe
  6101. DEPYASM=$yasmexe
  6102. AR=$ar
  6103. ARFLAGS=$arflags
  6104. AR_O=$ar_o
  6105. RANLIB=$ranlib
  6106. STRIP=$strip
  6107. CP=cp -p
  6108. LN_S=$ln_s
  6109. CPPFLAGS=$CPPFLAGS
  6110. CFLAGS=$CFLAGS
  6111. CXXFLAGS=$CXXFLAGS
  6112. OBJCFLAGS=$OBJCFLAGS
  6113. ASFLAGS=$ASFLAGS
  6114. AS_C=$AS_C
  6115. AS_O=$AS_O
  6116. OBJCC_C=$OBJCC_C
  6117. OBJCC_E=$OBJCC_E
  6118. OBJCC_O=$OBJCC_O
  6119. CC_C=$CC_C
  6120. CC_E=$CC_E
  6121. CC_O=$CC_O
  6122. CXX_C=$CXX_C
  6123. CXX_O=$CXX_O
  6124. LD_O=$LD_O
  6125. LD_LIB=$LD_LIB
  6126. LD_PATH=$LD_PATH
  6127. DLLTOOL=$dlltool
  6128. WINDRES=$windres
  6129. DEPWINDRES=$dep_cc
  6130. DOXYGEN=$doxygen
  6131. LDFLAGS=$LDFLAGS
  6132. LDEXEFLAGS=$LDEXEFLAGS
  6133. LDLIBFLAGS=$LDLIBFLAGS
  6134. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  6135. ASMSTRIPFLAGS=$ASMSTRIPFLAGS
  6136. YASMFLAGS=$YASMFLAGS
  6137. BUILDSUF=$build_suffix
  6138. PROGSSUF=$progs_suffix
  6139. FULLNAME=$FULLNAME
  6140. LIBPREF=$LIBPREF
  6141. LIBSUF=$LIBSUF
  6142. LIBNAME=$LIBNAME
  6143. SLIBPREF=$SLIBPREF
  6144. SLIBSUF=$SLIBSUF
  6145. EXESUF=$EXESUF
  6146. EXTRA_VERSION=$extra_version
  6147. CCDEP=$CCDEP
  6148. CXXDEP=$CXXDEP
  6149. CCDEP_FLAGS=$CCDEP_FLAGS
  6150. ASDEP=$ASDEP
  6151. ASDEP_FLAGS=$ASDEP_FLAGS
  6152. CC_DEPFLAGS=$CC_DEPFLAGS
  6153. AS_DEPFLAGS=$AS_DEPFLAGS
  6154. HOSTCC=$host_cc
  6155. HOSTLD=$host_ld
  6156. HOSTCFLAGS=$host_cflags
  6157. HOSTCPPFLAGS=$host_cppflags
  6158. HOSTEXESUF=$HOSTEXESUF
  6159. HOSTLDFLAGS=$host_ldflags
  6160. HOSTLIBS=$host_libs
  6161. DEPHOSTCC=$host_cc
  6162. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  6163. HOSTCCDEP=$HOSTCCDEP
  6164. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  6165. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  6166. HOSTCC_C=$HOSTCC_C
  6167. HOSTCC_O=$HOSTCC_O
  6168. HOSTLD_O=$HOSTLD_O
  6169. TARGET_EXEC=$target_exec $target_exec_args
  6170. TARGET_PATH=$target_path
  6171. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  6172. CFLAGS-ffplay=${sdl2_cflags}
  6173. ZLIB=$($ldflags_filter -lz)
  6174. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  6175. EXTRALIBS=$extralibs
  6176. COMPAT_OBJS=$compat_objs
  6177. EXEOBJS=$exeobjs
  6178. INSTALL=$install
  6179. LIBTARGET=${LIBTARGET}
  6180. SLIBNAME=${SLIBNAME}
  6181. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  6182. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  6183. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  6184. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  6185. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  6186. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  6187. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  6188. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  6189. VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
  6190. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  6191. NOREDZONE_FLAGS=$noredzone_flags
  6192. EOF
  6193. get_version(){
  6194. lcname=lib${1}
  6195. name=$(toupper $lcname)
  6196. file=$source_path/$lcname/version.h
  6197. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  6198. enabled raise_major && eval ${name}_VERSION_MAJOR=$((${name}_VERSION_MAJOR+100))
  6199. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  6200. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  6201. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  6202. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  6203. }
  6204. map 'get_version $v' $LIBRARY_LIST
  6205. map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> config.mak' $LIBRARY_LIST
  6206. print_program_libs(){
  6207. eval "program_libs=\$${1}_libs"
  6208. eval echo "LIBS-${1}=${program_libs}" >> config.mak
  6209. }
  6210. map 'print_program_libs $v' $PROGRAM_LIST
  6211. cat > $TMPH <<EOF
  6212. /* Automatically generated by configure - do not modify! */
  6213. #ifndef FFMPEG_CONFIG_H
  6214. #define FFMPEG_CONFIG_H
  6215. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  6216. #define FFMPEG_LICENSE "$(c_escape $license)"
  6217. #define CONFIG_THIS_YEAR 2018
  6218. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  6219. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  6220. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  6221. #define av_restrict $_restrict
  6222. #define EXTERN_PREFIX "${extern_prefix}"
  6223. #define EXTERN_ASM ${extern_prefix}
  6224. #define BUILDSUF "$build_suffix"
  6225. #define SLIBSUF "$SLIBSUF"
  6226. #define HAVE_MMX2 HAVE_MMXEXT
  6227. #define SWS_MAX_FILTER_SIZE $sws_max_filter_size
  6228. EOF
  6229. test -n "$assert_level" &&
  6230. echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
  6231. test -n "$malloc_prefix" &&
  6232. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  6233. if enabled yasm; then
  6234. append config_files $TMPASM
  6235. printf '' >$TMPASM
  6236. fi
  6237. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  6238. mkdir -p doc
  6239. mkdir -p tests
  6240. mkdir -p tests/api
  6241. echo "@c auto-generated by configure - do not modify! " > doc/config.texi
  6242. print_config ARCH_ "$config_files" $ARCH_LIST
  6243. print_config HAVE_ "$config_files" $HAVE_LIST
  6244. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  6245. $CONFIG_EXTRA \
  6246. $ALL_COMPONENTS \
  6247. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  6248. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  6249. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  6250. cp_if_changed $TMPH config.h
  6251. touch .config
  6252. enabled yasm && cp_if_changed $TMPASM config.asm
  6253. cat > $TMPH <<EOF
  6254. /* Generated by ffconf */
  6255. #ifndef AVUTIL_AVCONFIG_H
  6256. #define AVUTIL_AVCONFIG_H
  6257. EOF
  6258. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  6259. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  6260. cp_if_changed $TMPH libavutil/avconfig.h
  6261. # generate the lists of enabled components
  6262. print_enabled_components(){
  6263. file=$1
  6264. struct_name=$2
  6265. name=$3
  6266. shift 3
  6267. echo "static const $struct_name *$name[] = {" > $TMPH
  6268. for c in $*; do
  6269. enabled $c && printf " &ff_%s,\n" $c >> $TMPH
  6270. done
  6271. echo " NULL };" >> $TMPH
  6272. cp_if_changed $TMPH $file
  6273. }
  6274. print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
  6275. print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
  6276. if test -n "$WARNINGS"; then
  6277. printf "\n%s%s$WARNINGS%s" "$warn_color" "$bold_color" "$reset_color"
  6278. enabled fatal_warnings && exit 1
  6279. fi
  6280. # build pkg-config files
  6281. lib_version(){
  6282. eval printf "\"lib${1}${build_suffix} >= \$LIB$(toupper ${1})_VERSION, \""
  6283. }
  6284. pkgconfig_generate(){
  6285. name=$1
  6286. shortname=${name#lib}${build_suffix}
  6287. comment=$2
  6288. version=$3
  6289. libs=$4
  6290. requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps))
  6291. requires=${requires%, }
  6292. enabled ${name#lib} || return 0
  6293. mkdir -p $name
  6294. cat <<EOF > $name/$name${build_suffix}.pc
  6295. prefix=$prefix
  6296. exec_prefix=\${prefix}
  6297. libdir=$libdir
  6298. includedir=$incdir
  6299. Name: $name
  6300. Description: $comment
  6301. Version: $version
  6302. Requires: $(enabled shared || echo $requires)
  6303. Requires.private: $(enabled shared && echo $requires)
  6304. Conflicts:
  6305. Libs: -L\${libdir} $(enabled rpath && echo "-Wl,-rpath,\${libdir}") -l${shortname} $(enabled shared || echo $libs)
  6306. Libs.private: $(enabled shared && echo $libs)
  6307. Cflags: -I\${includedir}
  6308. EOF
  6309. mkdir -p doc/examples/pc-uninstalled
  6310. includedir=${source_path}
  6311. [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.."
  6312. cat <<EOF > doc/examples/pc-uninstalled/${name}-uninstalled.pc
  6313. prefix=
  6314. exec_prefix=
  6315. libdir=\${pcfiledir}/../../../$name
  6316. includedir=${includedir}
  6317. Name: $name
  6318. Description: $comment
  6319. Version: $version
  6320. Requires: $requires
  6321. Conflicts:
  6322. Libs: -L\${libdir} -Wl,-rpath,\${libdir} -l${shortname} $(enabled shared || echo $libs)
  6323. Cflags: -I\${includedir}
  6324. EOF
  6325. }
  6326. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBRT $LIBM"
  6327. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs"
  6328. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs"
  6329. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs"
  6330. pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
  6331. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" ""
  6332. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$LIBM"
  6333. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM"
  6334. pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM $LIBSOXR"