configure 167 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442
  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. --list-decoders show all available decoders
  58. --list-encoders show all available encoders
  59. --list-hwaccels show all available hardware accelerators
  60. --list-demuxers show all available demuxers
  61. --list-muxers show all available muxers
  62. --list-parsers show all available parsers
  63. --list-protocols show all available protocols
  64. --list-bsfs show all available bitstream filters
  65. --list-indevs show all available input devices
  66. --list-outdevs show all available output devices
  67. --list-filters show all available filters
  68. Standard options:
  69. --logfile=FILE log tests and output to FILE [config.log]
  70. --disable-logging do not log configure debug information
  71. --fatal-warnings fail if any configure warning is generated
  72. --prefix=PREFIX install in PREFIX [$prefix]
  73. --bindir=DIR install binaries in DIR [PREFIX/bin]
  74. --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]
  75. --docdir=DIR install documentation in DIR [PREFIX/share/doc/ffmpeg]
  76. --libdir=DIR install libs in DIR [PREFIX/lib]
  77. --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
  78. --incdir=DIR install includes in DIR [PREFIX/include]
  79. --mandir=DIR install man page in DIR [PREFIX/share/man]
  80. --enable-rpath use rpath to allow installing libraries in paths
  81. not part of the dynamic linker search path
  82. Licensing options:
  83. --enable-gpl allow use of GPL code, the resulting libs
  84. and binaries will be under GPL [no]
  85. --enable-version3 upgrade (L)GPL to version 3 [no]
  86. --enable-nonfree allow use of nonfree code, the resulting libs
  87. and binaries will be unredistributable [no]
  88. Configuration options:
  89. --disable-static do not build static libraries [no]
  90. --enable-shared build shared libraries [no]
  91. --enable-small optimize for size instead of speed
  92. --disable-runtime-cpudetect disable detecting cpu capabilities at runtime (smaller binary)
  93. --enable-gray enable full grayscale support (slower color)
  94. --disable-swscale-alpha disable alpha channel support in swscale
  95. --disable-all disable building components, libraries and programs
  96. --enable-incompatible-libav-abi enable incompatible Libav fork ABI [no]
  97. --enable-raise-major increase major version numbers in sonames [no]
  98. Program options:
  99. --disable-programs do not build command line programs
  100. --disable-ffmpeg disable ffmpeg build
  101. --disable-ffplay disable ffplay build
  102. --disable-ffprobe disable ffprobe build
  103. --disable-ffserver disable ffserver build
  104. Documentation options:
  105. --disable-doc do not build documentation
  106. --disable-htmlpages do not build HTML documentation pages
  107. --disable-manpages do not build man documentation pages
  108. --disable-podpages do not build POD documentation pages
  109. --disable-txtpages do not build text documentation pages
  110. Component options:
  111. --disable-avdevice disable libavdevice build
  112. --disable-avcodec disable libavcodec build
  113. --disable-avformat disable libavformat build
  114. --disable-avutil disable libavutil build
  115. --disable-swresample disable libswresample build
  116. --disable-swscale disable libswscale build
  117. --disable-postproc disable libpostproc build
  118. --disable-avfilter disable libavfilter build
  119. --enable-avresample enable libavresample build [no]
  120. --disable-pthreads disable pthreads [auto]
  121. --disable-w32threads disable Win32 threads [auto]
  122. --disable-os2threads disable OS/2 threads [auto]
  123. --disable-network disable network support [no]
  124. --disable-dct disable DCT code
  125. --disable-dwt disable DWT code
  126. --disable-error-resilience disable error resilience code
  127. --disable-lsp disable LSP code
  128. --disable-lzo disable LZO decoder code
  129. --disable-mdct disable MDCT code
  130. --disable-rdft disable RDFT code
  131. --disable-fft disable FFT code
  132. Hardware accelerators:
  133. --disable-dxva2 disable DXVA2 code [autodetect]
  134. --disable-vaapi disable VAAPI code [autodetect]
  135. --disable-vda disable VDA code [autodetect]
  136. --disable-vdpau disable VDPAU code [autodetect]
  137. Individual component options:
  138. --disable-everything disable all components listed below
  139. --disable-encoder=NAME disable encoder NAME
  140. --enable-encoder=NAME enable encoder NAME
  141. --disable-encoders disable all encoders
  142. --disable-decoder=NAME disable decoder NAME
  143. --enable-decoder=NAME enable decoder NAME
  144. --disable-decoders disable all decoders
  145. --disable-hwaccel=NAME disable hwaccel NAME
  146. --enable-hwaccel=NAME enable hwaccel NAME
  147. --disable-hwaccels disable all hwaccels
  148. --disable-muxer=NAME disable muxer NAME
  149. --enable-muxer=NAME enable muxer NAME
  150. --disable-muxers disable all muxers
  151. --disable-demuxer=NAME disable demuxer NAME
  152. --enable-demuxer=NAME enable demuxer NAME
  153. --disable-demuxers disable all demuxers
  154. --enable-parser=NAME enable parser NAME
  155. --disable-parser=NAME disable parser NAME
  156. --disable-parsers disable all parsers
  157. --enable-bsf=NAME enable bitstream filter NAME
  158. --disable-bsf=NAME disable bitstream filter NAME
  159. --disable-bsfs disable all bitstream filters
  160. --enable-protocol=NAME enable protocol NAME
  161. --disable-protocol=NAME disable protocol NAME
  162. --disable-protocols disable all protocols
  163. --enable-indev=NAME enable input device NAME
  164. --disable-indev=NAME disable input device NAME
  165. --disable-indevs disable input devices
  166. --enable-outdev=NAME enable output device NAME
  167. --disable-outdev=NAME disable output device NAME
  168. --disable-outdevs disable output devices
  169. --disable-devices disable all devices
  170. --enable-filter=NAME enable filter NAME
  171. --disable-filter=NAME disable filter NAME
  172. --disable-filters disable all filters
  173. External library support:
  174. --enable-avisynth enable reading of AviSynth script files [no]
  175. --disable-bzlib disable bzlib [autodetect]
  176. --enable-fontconfig enable fontconfig
  177. --enable-frei0r enable frei0r video filtering
  178. --enable-gnutls enable gnutls [no]
  179. --disable-iconv disable iconv [autodetect]
  180. --enable-ladspa enable LADSPA audio filtering
  181. --enable-libaacplus enable AAC+ encoding via libaacplus [no]
  182. --enable-libass enable libass subtitles rendering [no]
  183. --enable-libbluray enable BluRay reading using libbluray [no]
  184. --enable-libcaca enable textual display using libcaca
  185. --enable-libcelt enable CELT decoding via libcelt [no]
  186. --enable-libcdio enable audio CD grabbing with libcdio
  187. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  188. and libraw1394 [no]
  189. --enable-libfaac enable AAC encoding via libfaac [no]
  190. --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
  191. --enable-libflite enable flite (voice synthesis) support via libflite [no]
  192. --enable-libfreetype enable libfreetype [no]
  193. --enable-libgme enable Game Music Emu via libgme [no]
  194. --enable-libgsm enable GSM de/encoding via libgsm [no]
  195. --enable-libiec61883 enable iec61883 via libiec61883 [no]
  196. --enable-libilbc enable iLBC de/encoding via libilbc [no]
  197. --enable-libmodplug enable ModPlug via libmodplug [no]
  198. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  199. --enable-libnut enable NUT (de)muxing via libnut,
  200. native (de)muxer exists [no]
  201. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  202. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  203. --enable-libopencv enable video filtering via libopencv [no]
  204. --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
  205. --enable-libopus enable Opus decoding via libopus [no]
  206. --enable-libpulse enable Pulseaudio input via libpulse [no]
  207. --enable-libquvi enable quvi input via libquvi [no]
  208. --enable-librtmp enable RTMP[E] support via librtmp [no]
  209. --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
  210. --enable-libshine enable fixed-point MP3 encoding via libshine [no]
  211. --enable-libsoxr enable Include libsoxr resampling [no]
  212. --enable-libspeex enable Speex de/encoding via libspeex [no]
  213. --enable-libssh enable SFTP protocol via libssh [no]
  214. --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no]
  215. --enable-libtheora enable Theora encoding via libtheora [no]
  216. --enable-libtwolame enable MP2 encoding via libtwolame [no]
  217. --enable-libutvideo enable Ut Video encoding and decoding via libutvideo [no]
  218. --enable-libv4l2 enable libv4l2/v4l-utils [no]
  219. --enable-libvidstab enable video stabilization using vid.stab [no]
  220. --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
  221. --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
  222. --enable-libvorbis enable Vorbis en/decoding via libvorbis,
  223. native implementation exists [no]
  224. --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
  225. --enable-libwavpack enable wavpack encoding via libwavpack [no]
  226. --enable-libwebp enable WebP encoding via libwebp [no]
  227. --enable-libx264 enable H.264 encoding via x264 [no]
  228. --enable-libx265 enable HEVC encoding via x265 [no]
  229. --enable-libxavs enable AVS encoding via xavs [no]
  230. --enable-libxvid enable Xvid encoding via xvidcore,
  231. native MPEG-4/Xvid encoder exists [no]
  232. --enable-libzmq enable message passing via libzmq [no]
  233. --enable-libzvbi enable teletext support via libzvbi [no]
  234. --enable-decklink enable Blackmagick DeckLink output [no]
  235. --enable-openal enable OpenAL 1.1 capture support [no]
  236. --enable-opencl enable OpenCL code
  237. --enable-opengl enable OpenGL rendering [no]
  238. --enable-openssl enable openssl [no]
  239. --enable-x11grab enable X11 grabbing [no]
  240. --disable-xlib disable xlib [autodetect]
  241. --disable-zlib disable zlib [autodetect]
  242. Toolchain options:
  243. --arch=ARCH select architecture [$arch]
  244. --cpu=CPU select the minimum required CPU (affects
  245. instruction selection, may crash on older CPUs)
  246. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  247. --progs-suffix=SUFFIX program name suffix []
  248. --enable-cross-compile assume a cross-compiler is used
  249. --sysroot=PATH root of cross-build tree
  250. --sysinclude=PATH location of cross-build system headers
  251. --target-os=OS compiler targets OS [$target_os]
  252. --target-exec=CMD command to run executables on target
  253. --target-path=DIR path to view of build directory on target
  254. --target-samples=DIR path to samples directory on target
  255. --tempprefix=PATH force fixed dir/prefix instead of mktemp for checks
  256. --toolchain=NAME set tool defaults according to NAME
  257. --pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default]
  258. --nm=NM use nm tool NM [$nm_default]
  259. --ar=AR use archive tool AR [$ar_default]
  260. --as=AS use assembler AS [$as_default]
  261. --windres=WINDRES use windows resource compiler WINDRES [$windres_default]
  262. --yasmexe=EXE use yasm-compatible assembler EXE [$yasmexe_default]
  263. --cc=CC use C compiler CC [$cc_default]
  264. --cxx=CXX use C compiler CXX [$cxx_default]
  265. --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
  266. --ld=LD use linker LD [$ld_default]
  267. --pkg-config=PKGCONF use pkg-config PKGCONF [$pkg_config_default]
  268. --pkg-config-flags=FLAGS pass additional flags to pkgconf []
  269. --host-cc=HOSTCC use host C compiler HOSTCC
  270. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  271. --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
  272. --host-ld=HOSTLD use host linker HOSTLD
  273. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  274. --host-libs=HLIBS use libs HLIBS when linking for host
  275. --host-os=OS compiler host OS [$target_os]
  276. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  277. --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
  278. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  279. --extra-libs=ELIBS add ELIBS [$ELIBS]
  280. --extra-version=STRING version string suffix []
  281. --optflags=OPTFLAGS override optimization-related compiler flags
  282. --build-suffix=SUFFIX library name suffix []
  283. --enable-pic build position-independent code
  284. --enable-thumb compile for Thumb instruction set
  285. --enable-lto use link-time optimization
  286. Advanced options (experts only):
  287. --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
  288. --disable-symver disable symbol versioning
  289. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  290. --disable-safe-bitstream-reader
  291. disable buffer boundary checking in bitreaders
  292. (faster, but may crash)
  293. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  294. --enable-sram allow use of on-chip SRAM
  295. Optimization options (experts only):
  296. --disable-asm disable all assembler optimizations
  297. --disable-altivec disable AltiVec optimizations
  298. --disable-amd3dnow disable 3DNow! optimizations
  299. --disable-amd3dnowext disable 3DNow! extended optimizations
  300. --disable-mmx disable MMX optimizations
  301. --disable-mmxext disable MMXEXT optimizations
  302. --disable-sse disable SSE optimizations
  303. --disable-sse2 disable SSE2 optimizations
  304. --disable-sse3 disable SSE3 optimizations
  305. --disable-ssse3 disable SSSE3 optimizations
  306. --disable-sse4 disable SSE4 optimizations
  307. --disable-sse42 disable SSE4.2 optimizations
  308. --disable-avx disable AVX optimizations
  309. --disable-xop disable XOP optimizations
  310. --disable-fma3 disable FMA3 optimizations
  311. --disable-fma4 disable FMA4 optimizations
  312. --disable-avx2 disable AVX2 optimizations
  313. --disable-armv5te disable armv5te optimizations
  314. --disable-armv6 disable armv6 optimizations
  315. --disable-armv6t2 disable armv6t2 optimizations
  316. --disable-vfp disable VFP optimizations
  317. --disable-neon disable NEON optimizations
  318. --disable-inline-asm disable use of inline assembler
  319. --disable-yasm disable use of yasm assembler
  320. --disable-mips32r2 disable MIPS32R2 optimizations
  321. --disable-mipsdspr1 disable MIPS DSP ASE R1 optimizations
  322. --disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations
  323. --disable-mipsfpu disable floating point MIPS optimizations
  324. --disable-fast-unaligned consider unaligned accesses slow
  325. Developer options (useful when working on FFmpeg itself):
  326. --disable-debug disable debugging symbols
  327. --enable-debug=LEVEL set the debug level [$debuglevel]
  328. --disable-optimizations disable compiler optimizations
  329. --enable-extra-warnings enable more compiler warnings
  330. --disable-stripping disable stripping of executables and shared libraries
  331. --assert-level=level 0(default), 1 or 2, amount of assertion testing,
  332. 2 causes a slowdown at runtime.
  333. --enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data
  334. --valgrind=VALGRIND run "make fate" tests through valgrind to detect memory
  335. leaks and errors, using the specified valgrind binary.
  336. Cannot be combined with --target-exec
  337. --enable-ftrapv Trap arithmetic overflows
  338. --samples=PATH location of test samples for FATE, if not set use
  339. \$FATE_SAMPLES at make invocation time.
  340. --enable-neon-clobber-test check NEON registers for clobbering (should be
  341. used only for debugging purposes)
  342. --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
  343. should be used only for debugging purposes)
  344. --enable-random randomly enable/disable components
  345. --disable-random
  346. --enable-random=LIST randomly enable/disable specific components or
  347. --disable-random=LIST component groups. LIST is a comma-separated list
  348. of NAME[:PROB] entries where NAME is a component
  349. (group) and PROB the probability associated with
  350. NAME (default 0.5).
  351. --random-seed=VALUE seed value for --enable/disable-random
  352. NOTE: Object files are built at the place where configure is launched.
  353. EOF
  354. exit 0
  355. }
  356. quotes='""'
  357. log(){
  358. echo "$@" >> $logfile
  359. }
  360. log_file(){
  361. log BEGIN $1
  362. pr -n -t $1 >> $logfile
  363. log END $1
  364. }
  365. echolog(){
  366. log "$@"
  367. echo "$@"
  368. }
  369. warn(){
  370. log "WARNING: $*"
  371. WARNINGS="${WARNINGS}WARNING: $*\n"
  372. }
  373. die(){
  374. echolog "$@"
  375. cat <<EOF
  376. If you think configure made a mistake, make sure you are using the latest
  377. version from Git. If the latest version fails, report the problem to the
  378. ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
  379. EOF
  380. if disabled logging; then
  381. cat <<EOF
  382. Rerun configure with logging enabled (do not use --disable-logging), and
  383. include the log this produces with your report.
  384. EOF
  385. else
  386. cat <<EOF
  387. Include the log file "$logfile" produced by configure as this will help
  388. solving the problem.
  389. EOF
  390. fi
  391. exit 1
  392. }
  393. # Avoid locale weirdness, besides we really just want to translate ASCII.
  394. toupper(){
  395. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  396. }
  397. tolower(){
  398. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  399. }
  400. c_escape(){
  401. echo "$*" | sed 's/["\\]/\\\0/g'
  402. }
  403. sh_quote(){
  404. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  405. test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
  406. echo "$v"
  407. }
  408. cleanws(){
  409. echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//;s/\r//g'
  410. }
  411. filter(){
  412. pat=$1
  413. shift
  414. for v; do
  415. eval "case $v in $pat) echo $v ;; esac"
  416. done
  417. }
  418. filter_out(){
  419. pat=$1
  420. shift
  421. for v; do
  422. eval "case $v in $pat) ;; *) echo $v ;; esac"
  423. done
  424. }
  425. map(){
  426. m=$1
  427. shift
  428. for v; do eval $m; done
  429. }
  430. add_suffix(){
  431. suffix=$1
  432. shift
  433. for v; do echo ${v}${suffix}; done
  434. }
  435. set_all(){
  436. value=$1
  437. shift
  438. for var in $*; do
  439. eval $var=$value
  440. done
  441. }
  442. set_weak(){
  443. value=$1
  444. shift
  445. for var; do
  446. eval : \${$var:=$value}
  447. done
  448. }
  449. sanitize_var_name(){
  450. echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
  451. }
  452. set_safe(){
  453. var=$1
  454. shift
  455. eval $(sanitize_var_name "$var")='$*'
  456. }
  457. get_safe(){
  458. eval echo \$$(sanitize_var_name "$1")
  459. }
  460. pushvar(){
  461. for pvar in $*; do
  462. eval level=\${${pvar}_level:=0}
  463. eval ${pvar}_${level}="\$$pvar"
  464. eval ${pvar}_level=$(($level+1))
  465. done
  466. }
  467. popvar(){
  468. for pvar in $*; do
  469. eval level=\${${pvar}_level:-0}
  470. test $level = 0 && continue
  471. eval level=$(($level-1))
  472. eval $pvar="\${${pvar}_${level}}"
  473. eval ${pvar}_level=$level
  474. eval unset ${pvar}_${level}
  475. done
  476. }
  477. enable(){
  478. set_all yes $*
  479. }
  480. disable(){
  481. set_all no $*
  482. }
  483. enable_weak(){
  484. set_weak yes $*
  485. }
  486. disable_weak(){
  487. set_weak no $*
  488. }
  489. enable_safe(){
  490. for var; do
  491. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  492. done
  493. }
  494. disable_safe(){
  495. for var; do
  496. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  497. done
  498. }
  499. do_enable_deep(){
  500. for var; do
  501. enabled $var && continue
  502. eval sel="\$${var}_select"
  503. eval sgs="\$${var}_suggest"
  504. pushvar var sgs
  505. enable_deep $sel
  506. popvar sgs
  507. enable_deep_weak $sgs
  508. popvar var
  509. done
  510. }
  511. enable_deep(){
  512. do_enable_deep $*
  513. enable $*
  514. }
  515. enable_deep_weak(){
  516. for var; do
  517. disabled $var && continue
  518. pushvar var
  519. do_enable_deep $var
  520. popvar var
  521. enable_weak $var
  522. done
  523. }
  524. enabled(){
  525. test "${1#!}" = "$1" && op== || op=!=
  526. eval test "x\$${1#!}" $op "xyes"
  527. }
  528. disabled(){
  529. test "${1#!}" = "$1" && op== || op=!=
  530. eval test "x\$${1#!}" $op "xno"
  531. }
  532. enabled_all(){
  533. for opt; do
  534. enabled $opt || return 1
  535. done
  536. }
  537. disabled_all(){
  538. for opt; do
  539. disabled $opt || return 1
  540. done
  541. }
  542. enabled_any(){
  543. for opt; do
  544. enabled $opt && return 0
  545. done
  546. }
  547. disabled_any(){
  548. for opt; do
  549. disabled $opt && return 0
  550. done
  551. return 1
  552. }
  553. set_default(){
  554. for opt; do
  555. eval : \${$opt:=\$${opt}_default}
  556. done
  557. }
  558. is_in(){
  559. value=$1
  560. shift
  561. for var in $*; do
  562. [ $var = $value ] && return 0
  563. done
  564. return 1
  565. }
  566. do_check_deps(){
  567. for cfg; do
  568. cfg="${cfg#!}"
  569. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  570. disabled ${cfg}_checking && continue
  571. enable ${cfg}_checking
  572. append allopts $cfg
  573. eval dep_all="\$${cfg}_deps"
  574. eval dep_any="\$${cfg}_deps_any"
  575. eval dep_sel="\$${cfg}_select"
  576. eval dep_sgs="\$${cfg}_suggest"
  577. eval dep_ifa="\$${cfg}_if"
  578. eval dep_ifn="\$${cfg}_if_any"
  579. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  580. do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  581. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  582. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  583. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  584. enabled_all $dep_all || disable $cfg
  585. enabled_any $dep_any || disable $cfg
  586. disabled_any $dep_sel && disable $cfg
  587. if enabled $cfg; then
  588. enable_deep $dep_sel
  589. enable_deep_weak $dep_sgs
  590. fi
  591. disable ${cfg}_checking
  592. done
  593. }
  594. check_deps(){
  595. unset allopts
  596. do_check_deps "$@"
  597. for cfg in $allopts; do
  598. enabled $cfg || continue
  599. eval dep_extralibs="\$${cfg}_extralibs"
  600. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  601. done
  602. }
  603. print_config(){
  604. pfx=$1
  605. files=$2
  606. shift 2
  607. map 'eval echo "$v \${$v:-no}"' "$@" |
  608. awk "BEGIN { split(\"$files\", files) }
  609. {
  610. c = \"$pfx\" toupper(\$1);
  611. v = \$2;
  612. sub(/yes/, 1, v);
  613. sub(/no/, 0, v);
  614. for (f in files) {
  615. file = files[f];
  616. if (file ~ /\\.h\$/) {
  617. printf(\"#define %s %d\\n\", c, v) >>file;
  618. } else if (file ~ /\\.asm\$/) {
  619. printf(\"%%define %s %d\\n\", c, v) >>file;
  620. } else if (file ~ /\\.mak\$/) {
  621. n = -v ? \"\" : \"!\";
  622. printf(\"%s%s=yes\\n\", n, c) >>file;
  623. } else if (file ~ /\\.texi\$/) {
  624. pre = -v ? \"\" : \"@c \";
  625. yesno = \$2;
  626. c2 = tolower(c);
  627. gsub(/_/, \"-\", c2);
  628. printf(\"%s@set %s %s\\n\", pre, c2, yesno) >>file;
  629. }
  630. }
  631. }"
  632. }
  633. print_enabled(){
  634. suf=$1
  635. shift
  636. for v; do
  637. enabled $v && printf "%s\n" ${v%$suf};
  638. done
  639. }
  640. append(){
  641. var=$1
  642. shift
  643. eval "$var=\"\$$var $*\""
  644. }
  645. prepend(){
  646. var=$1
  647. shift
  648. eval "$var=\"$* \$$var\""
  649. }
  650. add_cppflags(){
  651. append CPPFLAGS "$@"
  652. }
  653. add_cflags(){
  654. append CFLAGS $($cflags_filter "$@")
  655. }
  656. add_cxxflags(){
  657. append CXXFLAGS $($cflags_filter "$@")
  658. }
  659. add_asflags(){
  660. append ASFLAGS $($asflags_filter "$@")
  661. }
  662. add_ldflags(){
  663. append LDFLAGS $($ldflags_filter "$@")
  664. }
  665. add_stripflags(){
  666. append ASMSTRIPFLAGS "$@"
  667. }
  668. add_extralibs(){
  669. prepend extralibs $($ldflags_filter "$@")
  670. }
  671. add_host_cppflags(){
  672. append host_cppflags "$@"
  673. }
  674. add_host_cflags(){
  675. append host_cflags $($host_cflags_filter "$@")
  676. }
  677. add_host_ldflags(){
  678. append host_ldflags $($host_ldflags_filter "$@")
  679. }
  680. add_compat(){
  681. append compat_objs $1
  682. shift
  683. map 'add_cppflags -D$v' "$@"
  684. }
  685. check_cmd(){
  686. log "$@"
  687. "$@" >> $logfile 2>&1
  688. }
  689. check_stat(){
  690. log check_stat "$@"
  691. stat "$1" >> $logfile 2>&1
  692. }
  693. cc_o(){
  694. eval printf '%s\\n' $CC_O
  695. }
  696. cc_e(){
  697. eval printf '%s\\n' $CC_E
  698. }
  699. check_cc(){
  700. log check_cc "$@"
  701. cat > $TMPC
  702. log_file $TMPC
  703. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
  704. }
  705. check_cxx(){
  706. log check_cxx "$@"
  707. cat > $TMPCPP
  708. log_file $TMPCPP
  709. check_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" $CXX_C -o $TMPO $TMPCPP
  710. }
  711. check_oc(){
  712. log check_oc "$@"
  713. cat > $TMPM
  714. log_file $TMPM
  715. check_cmd $cc -Werror=missing-prototypes $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPM
  716. }
  717. check_cpp(){
  718. log check_cpp "$@"
  719. cat > $TMPC
  720. log_file $TMPC
  721. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
  722. }
  723. as_o(){
  724. eval printf '%s\\n' $AS_O
  725. }
  726. check_as(){
  727. log check_as "$@"
  728. cat > $TMPS
  729. log_file $TMPS
  730. check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
  731. }
  732. check_inline_asm(){
  733. log check_inline_asm "$@"
  734. name="$1"
  735. code="$2"
  736. shift 2
  737. disable $name
  738. check_cc "$@" <<EOF && enable $name
  739. void foo(void){ __asm__ volatile($code); }
  740. EOF
  741. }
  742. check_insn(){
  743. log check_insn "$@"
  744. check_inline_asm ${1}_inline "\"$2\""
  745. echo "$2" | check_as && enable ${1}_external || disable ${1}_external
  746. }
  747. check_yasm(){
  748. log check_yasm "$@"
  749. echo "$1" > $TMPS
  750. log_file $TMPS
  751. shift 1
  752. check_cmd $yasmexe $YASMFLAGS -Werror "$@" -o $TMPO $TMPS
  753. }
  754. ld_o(){
  755. eval printf '%s\\n' $LD_O
  756. }
  757. check_ld(){
  758. log check_ld "$@"
  759. type=$1
  760. shift 1
  761. flags=$(filter_out '-l*|*.so' $@)
  762. libs=$(filter '-l*|*.so' $@)
  763. check_$type $($cflags_filter $flags) || return
  764. flags=$($ldflags_filter $flags)
  765. libs=$($ldflags_filter $libs)
  766. check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
  767. }
  768. print_include(){
  769. hdr=$1
  770. test "${hdr%.h}" = "${hdr}" &&
  771. echo "#include $hdr" ||
  772. echo "#include <$hdr>"
  773. }
  774. check_code(){
  775. log check_code "$@"
  776. check=$1
  777. headers=$2
  778. code=$3
  779. shift 3
  780. {
  781. for hdr in $headers; do
  782. print_include $hdr
  783. done
  784. echo "int main(void) { $code; return 0; }"
  785. } | check_$check "$@"
  786. }
  787. check_cppflags(){
  788. log check_cppflags "$@"
  789. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  790. int x;
  791. EOF
  792. }
  793. test_cflags(){
  794. log test_cflags "$@"
  795. set -- $($cflags_filter "$@")
  796. check_cc "$@" <<EOF
  797. int x;
  798. EOF
  799. }
  800. check_cflags(){
  801. log check_cflags "$@"
  802. test_cflags "$@" && add_cflags "$@"
  803. }
  804. check_cxxflags(){
  805. log check_cxxflags "$@"
  806. set -- $($cflags_filter "$@")
  807. check_cxx "$@" <<EOF && append CXXFLAGS "$@"
  808. int x;
  809. EOF
  810. }
  811. test_ldflags(){
  812. log test_ldflags "$@"
  813. check_ld "cc" "$@" <<EOF
  814. int main(void){ return 0; }
  815. EOF
  816. }
  817. check_ldflags(){
  818. log check_ldflags "$@"
  819. test_ldflags "$@" && add_ldflags "$@"
  820. }
  821. test_stripflags(){
  822. log test_stripflags "$@"
  823. # call check_cc to get a fresh TMPO
  824. check_cc <<EOF
  825. int main(void) { return 0; }
  826. EOF
  827. check_cmd $strip $ASMSTRIPFLAGS "$@" $TMPO
  828. }
  829. check_stripflags(){
  830. log check_stripflags "$@"
  831. test_stripflags "$@" && add_stripflags "$@"
  832. }
  833. check_header(){
  834. log check_header "$@"
  835. header=$1
  836. shift
  837. disable_safe $header
  838. check_cpp "$@" <<EOF && enable_safe $header
  839. #include <$header>
  840. int x;
  841. EOF
  842. }
  843. check_header_oc(){
  844. log check_header_oc "$@"
  845. rm -f -- "$TMPO"
  846. header=$1
  847. shift
  848. disable_safe $header
  849. {
  850. echo "#include <$header>"
  851. echo "int main(void) { return 0; }"
  852. } | check_oc && check_stat "$TMPO" && enable_safe $headers
  853. }
  854. check_func(){
  855. log check_func "$@"
  856. func=$1
  857. shift
  858. disable $func
  859. check_ld "cc" "$@" <<EOF && enable $func
  860. extern int $func();
  861. int main(void){ $func(); }
  862. EOF
  863. }
  864. check_mathfunc(){
  865. log check_mathfunc "$@"
  866. func=$1
  867. narg=$2
  868. shift 2
  869. test $narg = 2 && args="f, g" || args="f"
  870. disable $func
  871. check_ld "cc" "$@" <<EOF && enable $func
  872. #include <math.h>
  873. float foo(float f, float g) { return $func($args); }
  874. int main(void){ return (int) foo; }
  875. EOF
  876. }
  877. check_func_headers(){
  878. log check_func_headers "$@"
  879. headers=$1
  880. funcs=$2
  881. shift 2
  882. {
  883. for hdr in $headers; do
  884. print_include $hdr
  885. done
  886. for func in $funcs; do
  887. echo "long check_$func(void) { return (long) $func; }"
  888. done
  889. echo "int main(void) { return 0; }"
  890. } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
  891. }
  892. check_class_headers_cpp(){
  893. log check_class_headers_cpp "$@"
  894. headers=$1
  895. classes=$2
  896. shift 2
  897. {
  898. for hdr in $headers; do
  899. echo "#include <$hdr>"
  900. done
  901. echo "int main(void) { "
  902. i=1
  903. for class in $classes; do
  904. echo "$class obj$i;"
  905. i=$(expr $i + 1)
  906. done
  907. echo "return 0; }"
  908. } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers
  909. }
  910. check_cpp_condition(){
  911. log check_cpp_condition "$@"
  912. header=$1
  913. condition=$2
  914. shift 2
  915. check_cpp "$@" <<EOF
  916. #include <$header>
  917. #if !($condition)
  918. #error "unsatisfied condition: $condition"
  919. #endif
  920. EOF
  921. }
  922. check_lib(){
  923. log check_lib "$@"
  924. header="$1"
  925. func="$2"
  926. shift 2
  927. check_header $header && check_func $func "$@" && add_extralibs "$@"
  928. }
  929. check_lib2(){
  930. log check_lib2 "$@"
  931. headers="$1"
  932. funcs="$2"
  933. shift 2
  934. check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
  935. }
  936. check_lib_cpp(){
  937. log check_lib_cpp "$@"
  938. headers="$1"
  939. classes="$2"
  940. shift 2
  941. check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@"
  942. }
  943. check_pkg_config(){
  944. log check_pkg_config "$@"
  945. pkgandversion="$1"
  946. pkg="${1%% *}"
  947. headers="$2"
  948. funcs="$3"
  949. shift 3
  950. check_cmd $pkg_config --exists --print-errors $pkgandversion || return
  951. pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
  952. pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
  953. check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
  954. set_safe ${pkg}_cflags $pkg_cflags &&
  955. set_safe ${pkg}_libs $pkg_libs
  956. }
  957. check_exec(){
  958. check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  959. }
  960. check_exec_crash(){
  961. code=$(cat)
  962. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  963. # are safe but may not be available everywhere. Thus we use
  964. # raise(SIGTERM) instead. The check is run in a subshell so we
  965. # can redirect the "Terminated" message from the shell. SIGBUS
  966. # is not defined by standard C so it is used conditionally.
  967. (check_exec "$@") >> $logfile 2>&1 <<EOF
  968. #include <signal.h>
  969. static void sighandler(int sig){
  970. raise(SIGTERM);
  971. }
  972. int foo(void){
  973. $code
  974. }
  975. int (*func_ptr)(void) = foo;
  976. int main(void){
  977. signal(SIGILL, sighandler);
  978. signal(SIGFPE, sighandler);
  979. signal(SIGSEGV, sighandler);
  980. #ifdef SIGBUS
  981. signal(SIGBUS, sighandler);
  982. #endif
  983. return func_ptr();
  984. }
  985. EOF
  986. }
  987. check_type(){
  988. log check_type "$@"
  989. headers=$1
  990. type=$2
  991. shift 2
  992. disable_safe "$type"
  993. check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
  994. }
  995. check_struct(){
  996. log check_struct "$@"
  997. headers=$1
  998. struct=$2
  999. member=$3
  1000. shift 3
  1001. disable_safe "${struct}_${member}"
  1002. check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
  1003. enable_safe "${struct}_${member}"
  1004. }
  1005. check_builtin(){
  1006. log check_builtin "$@"
  1007. name=$1
  1008. headers=$2
  1009. builtin=$3
  1010. shift 3
  1011. disable "$name"
  1012. check_code ld "$headers" "$builtin" "cc" "$@" && enable "$name"
  1013. }
  1014. check_compile_assert(){
  1015. log check_compile_assert "$@"
  1016. name=$1
  1017. headers=$2
  1018. condition=$3
  1019. shift 3
  1020. disable "$name"
  1021. check_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
  1022. }
  1023. require(){
  1024. name="$1"
  1025. header="$2"
  1026. func="$3"
  1027. shift 3
  1028. check_lib $header $func "$@" || die "ERROR: $name not found"
  1029. }
  1030. require2(){
  1031. name="$1"
  1032. headers="$2"
  1033. func="$3"
  1034. shift 3
  1035. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  1036. }
  1037. require_cpp(){
  1038. name="$1"
  1039. headers="$2"
  1040. classes="$3"
  1041. shift 3
  1042. check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
  1043. }
  1044. require_pkg_config(){
  1045. pkg="$1"
  1046. check_pkg_config "$@" || die "ERROR: $pkg not found"
  1047. add_cflags $(get_safe ${pkg}_cflags)
  1048. add_extralibs $(get_safe ${pkg}_libs)
  1049. }
  1050. require_libfreetype(){
  1051. log require_libfreetype "$@"
  1052. pkg="freetype2"
  1053. check_cmd $pkg_config --exists --print-errors $pkg \
  1054. || die "ERROR: $pkg not found"
  1055. pkg_cflags=$($pkg_config --cflags $pkg)
  1056. pkg_libs=$($pkg_config --libs $pkg)
  1057. {
  1058. echo "#include <ft2build.h>"
  1059. echo "#include FT_FREETYPE_H"
  1060. echo "long check_func(void) { return (long) FT_Init_FreeType; }"
  1061. echo "int main(void) { return 0; }"
  1062. } | check_ld "cc" $pkg_cflags $pkg_libs \
  1063. && set_safe ${pkg}_cflags $pkg_cflags \
  1064. && set_safe ${pkg}_libs $pkg_libs \
  1065. || die "ERROR: $pkg not found"
  1066. add_cflags $(get_safe ${pkg}_cflags)
  1067. add_extralibs $(get_safe ${pkg}_libs)
  1068. }
  1069. hostcc_e(){
  1070. eval printf '%s\\n' $HOSTCC_E
  1071. }
  1072. hostcc_o(){
  1073. eval printf '%s\\n' $HOSTCC_O
  1074. }
  1075. check_host_cc(){
  1076. log check_host_cc "$@"
  1077. cat > $TMPC
  1078. log_file $TMPC
  1079. check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
  1080. }
  1081. check_host_cpp(){
  1082. log check_host_cpp "$@"
  1083. cat > $TMPC
  1084. log_file $TMPC
  1085. check_cmd $host_cc $HOSTCPPFLAGS $HOSTCFLAGS "$@" $(hostcc_e $TMPO) $TMPC
  1086. }
  1087. check_host_cppflags(){
  1088. log check_host_cppflags "$@"
  1089. check_host_cc "$@" <<EOF && append host_cppflags "$@"
  1090. int x;
  1091. EOF
  1092. }
  1093. check_host_cflags(){
  1094. log check_host_cflags "$@"
  1095. set -- $($host_cflags_filter "$@")
  1096. check_host_cc "$@" <<EOF && append host_cflags "$@"
  1097. int x;
  1098. EOF
  1099. }
  1100. check_host_cpp_condition(){
  1101. log check_host_cpp_condition "$@"
  1102. header=$1
  1103. condition=$2
  1104. shift 2
  1105. check_host_cpp "$@" <<EOF
  1106. #include <$header>
  1107. #if !($condition)
  1108. #error "unsatisfied condition: $condition"
  1109. #endif
  1110. EOF
  1111. }
  1112. apply(){
  1113. file=$1
  1114. shift
  1115. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  1116. }
  1117. cp_if_changed(){
  1118. cmp -s "$1" "$2" && echo "$2 is unchanged" && return
  1119. mkdir -p "$(dirname $2)"
  1120. $cp_f "$1" "$2"
  1121. }
  1122. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  1123. # system-dependent things.
  1124. COMPONENT_LIST="
  1125. bsfs
  1126. decoders
  1127. demuxers
  1128. encoders
  1129. filters
  1130. hwaccels
  1131. indevs
  1132. muxers
  1133. outdevs
  1134. parsers
  1135. protocols
  1136. "
  1137. EXAMPLE_LIST="
  1138. avio_reading_example
  1139. decoding_encoding_example
  1140. demuxing_decoding_example
  1141. filter_audio_example
  1142. filtering_audio_example
  1143. filtering_video_example
  1144. metadata_example
  1145. muxing_example
  1146. remuxing_example
  1147. resampling_audio_example
  1148. scaling_video_example
  1149. transcode_aac_example
  1150. transcoding_example
  1151. "
  1152. EXTERNAL_LIBRARY_LIST="
  1153. avisynth
  1154. bzlib
  1155. crystalhd
  1156. decklink
  1157. frei0r
  1158. gnutls
  1159. iconv
  1160. ladspa
  1161. libaacplus
  1162. libass
  1163. libbluray
  1164. libcaca
  1165. libcdio
  1166. libcelt
  1167. libdc1394
  1168. libfaac
  1169. libfdk_aac
  1170. libflite
  1171. libfontconfig
  1172. libfreetype
  1173. libgme
  1174. libgsm
  1175. libiec61883
  1176. libilbc
  1177. libmodplug
  1178. libmp3lame
  1179. libnut
  1180. libopencore_amrnb
  1181. libopencore_amrwb
  1182. libopencv
  1183. libopenjpeg
  1184. libopus
  1185. libpulse
  1186. libquvi
  1187. librtmp
  1188. libschroedinger
  1189. libshine
  1190. libsoxr
  1191. libspeex
  1192. libssh
  1193. libstagefright_h264
  1194. libtheora
  1195. libtwolame
  1196. libutvideo
  1197. libv4l2
  1198. libvidstab
  1199. libvo_aacenc
  1200. libvo_amrwbenc
  1201. libvorbis
  1202. libvpx
  1203. libwavpack
  1204. libwebp
  1205. libx264
  1206. libx265
  1207. libxavs
  1208. libxvid
  1209. libzmq
  1210. libzvbi
  1211. openal
  1212. opencl
  1213. opengl
  1214. openssl
  1215. x11grab
  1216. xlib
  1217. zlib
  1218. "
  1219. DOCUMENT_LIST="
  1220. doc
  1221. htmlpages
  1222. manpages
  1223. podpages
  1224. txtpages
  1225. "
  1226. FEATURE_LIST="
  1227. ftrapv
  1228. gray
  1229. hardcoded_tables
  1230. runtime_cpudetect
  1231. safe_bitstream_reader
  1232. shared
  1233. small
  1234. sram
  1235. static
  1236. swscale_alpha
  1237. "
  1238. HWACCEL_LIST="
  1239. dxva2
  1240. vaapi
  1241. vda
  1242. vdpau
  1243. xvmc
  1244. "
  1245. LIBRARY_LIST="
  1246. avcodec
  1247. avdevice
  1248. avfilter
  1249. avformat
  1250. avresample
  1251. avutil
  1252. postproc
  1253. swresample
  1254. swscale
  1255. "
  1256. LICENSE_LIST="
  1257. gpl
  1258. nonfree
  1259. version3
  1260. "
  1261. PROGRAM_LIST="
  1262. ffplay
  1263. ffprobe
  1264. ffserver
  1265. ffmpeg
  1266. "
  1267. SUBSYSTEM_LIST="
  1268. dct
  1269. dwt
  1270. error_resilience
  1271. fast_unaligned
  1272. fft
  1273. lsp
  1274. lzo
  1275. mdct
  1276. network
  1277. rdft
  1278. "
  1279. CONFIG_LIST="
  1280. $COMPONENT_LIST
  1281. $DOCUMENT_LIST
  1282. $EXAMPLE_LIST
  1283. $EXTERNAL_LIBRARY_LIST
  1284. $FEATURE_LIST
  1285. $HWACCEL_LIST
  1286. $LICENSE_LIST
  1287. $LIBRARY_LIST
  1288. $PROGRAM_LIST
  1289. $SUBSYSTEM_LIST
  1290. fontconfig
  1291. incompatible_libav_abi
  1292. memalign_hack
  1293. memory_poisoning
  1294. neon_clobber_test
  1295. pic
  1296. pod2man
  1297. raise_major
  1298. thumb
  1299. xmm_clobber_test
  1300. "
  1301. THREADS_LIST="
  1302. pthreads
  1303. os2threads
  1304. w32threads
  1305. "
  1306. ATOMICS_LIST="
  1307. atomics_gcc
  1308. atomics_suncc
  1309. atomics_win32
  1310. "
  1311. ARCH_LIST="
  1312. aarch64
  1313. alpha
  1314. arm
  1315. avr32
  1316. avr32_ap
  1317. avr32_uc
  1318. bfin
  1319. ia64
  1320. m68k
  1321. mips
  1322. mips64
  1323. parisc
  1324. ppc
  1325. ppc64
  1326. s390
  1327. sh4
  1328. sparc
  1329. sparc64
  1330. tilegx
  1331. tilepro
  1332. tomi
  1333. x86
  1334. x86_32
  1335. x86_64
  1336. "
  1337. ARCH_EXT_LIST_ARM="
  1338. armv5te
  1339. armv6
  1340. armv6t2
  1341. armv8
  1342. neon
  1343. vfp
  1344. vfpv3
  1345. "
  1346. ARCH_EXT_LIST_MIPS="
  1347. mipsfpu
  1348. mips32r2
  1349. mipsdspr1
  1350. mipsdspr2
  1351. "
  1352. ARCH_EXT_LIST_X86_SIMD="
  1353. amd3dnow
  1354. amd3dnowext
  1355. avx
  1356. avx2
  1357. fma3
  1358. fma4
  1359. mmx
  1360. mmxext
  1361. sse
  1362. sse2
  1363. sse3
  1364. sse4
  1365. sse42
  1366. ssse3
  1367. xop
  1368. "
  1369. ARCH_EXT_LIST_PPC="
  1370. altivec
  1371. dcbzl
  1372. ldbrx
  1373. ppc4xx
  1374. "
  1375. ARCH_EXT_LIST_X86="
  1376. $ARCH_EXT_LIST_X86_SIMD
  1377. cpunop
  1378. i686
  1379. "
  1380. ARCH_EXT_LIST="
  1381. $ARCH_EXT_LIST_ARM
  1382. $ARCH_EXT_LIST_PPC
  1383. $ARCH_EXT_LIST_X86
  1384. $ARCH_EXT_LIST_MIPS
  1385. loongson
  1386. "
  1387. ARCH_FEATURES="
  1388. aligned_stack
  1389. fast_64bit
  1390. fast_clz
  1391. fast_cmov
  1392. local_aligned_8
  1393. local_aligned_16
  1394. "
  1395. BUILTIN_LIST="
  1396. atomic_cas_ptr
  1397. machine_rw_barrier
  1398. MemoryBarrier
  1399. mm_empty
  1400. rdtsc
  1401. sarestart
  1402. sync_val_compare_and_swap
  1403. "
  1404. HAVE_LIST_CMDLINE="
  1405. inline_asm
  1406. symver
  1407. yasm
  1408. "
  1409. HAVE_LIST_PUB="
  1410. bigendian
  1411. fast_unaligned
  1412. incompatible_libav_abi
  1413. "
  1414. HEADERS_LIST="
  1415. alsa_asoundlib_h
  1416. altivec_h
  1417. arpa_inet_h
  1418. asm_types_h
  1419. cdio_paranoia_h
  1420. cdio_paranoia_paranoia_h
  1421. CL_cl_h
  1422. dev_bktr_ioctl_bt848_h
  1423. dev_bktr_ioctl_meteor_h
  1424. dev_ic_bt8xx_h
  1425. dev_video_bktr_ioctl_bt848_h
  1426. dev_video_meteor_ioctl_meteor_h
  1427. direct_h
  1428. dlfcn_h
  1429. dxva_h
  1430. ES2_gl_h
  1431. gsm_h
  1432. io_h
  1433. mach_mach_time_h
  1434. machine_ioctl_bt848_h
  1435. machine_ioctl_meteor_h
  1436. malloc_h
  1437. openjpeg_1_5_openjpeg_h
  1438. OpenGL_gl3_h
  1439. poll_h
  1440. sndio_h
  1441. soundcard_h
  1442. sys_mman_h
  1443. sys_param_h
  1444. sys_resource_h
  1445. sys_select_h
  1446. sys_soundcard_h
  1447. sys_time_h
  1448. sys_un_h
  1449. sys_videoio_h
  1450. termios_h
  1451. unistd_h
  1452. windows_h
  1453. winsock2_h
  1454. "
  1455. MATH_FUNCS="
  1456. atanf
  1457. atan2f
  1458. cbrt
  1459. cbrtf
  1460. cosf
  1461. exp2
  1462. exp2f
  1463. expf
  1464. isinf
  1465. isnan
  1466. ldexpf
  1467. llrint
  1468. llrintf
  1469. log2
  1470. log2f
  1471. log10f
  1472. lrint
  1473. lrintf
  1474. powf
  1475. rint
  1476. round
  1477. roundf
  1478. sinf
  1479. trunc
  1480. truncf
  1481. "
  1482. SYSTEM_FUNCS="
  1483. access
  1484. aligned_malloc
  1485. clock_gettime
  1486. closesocket
  1487. CommandLineToArgvW
  1488. CryptGenRandom
  1489. dlopen
  1490. fcntl
  1491. flt_lim
  1492. fork
  1493. getaddrinfo
  1494. gethrtime
  1495. getopt
  1496. GetProcessAffinityMask
  1497. GetProcessMemoryInfo
  1498. GetProcessTimes
  1499. getrusage
  1500. getservbyport
  1501. GetSystemTimeAsFileTime
  1502. gettimeofday
  1503. glob
  1504. glXGetProcAddress
  1505. inet_aton
  1506. isatty
  1507. jack_port_get_latency_range
  1508. kbhit
  1509. localtime_r
  1510. lzo1x_999_compress
  1511. mach_absolute_time
  1512. MapViewOfFile
  1513. memalign
  1514. mkstemp
  1515. mmap
  1516. mprotect
  1517. nanosleep
  1518. PeekNamedPipe
  1519. posix_memalign
  1520. pthread_cancel
  1521. sched_getaffinity
  1522. SetConsoleTextAttribute
  1523. setmode
  1524. setrlimit
  1525. Sleep
  1526. strerror_r
  1527. sysconf
  1528. sysctl
  1529. usleep
  1530. VirtualAlloc
  1531. wglGetProcAddress
  1532. "
  1533. TOOLCHAIN_FEATURES="
  1534. asm_mod_q
  1535. attribute_may_alias
  1536. attribute_packed
  1537. ebp_available
  1538. ebx_available
  1539. gnu_as
  1540. gnu_windres
  1541. ibm_asm
  1542. inline_asm_labels
  1543. inline_asm_nonlocal_labels
  1544. inline_asm_direct_symbol_refs
  1545. pragma_deprecated
  1546. rsync_contimeout
  1547. symver_asm_label
  1548. symver_gnu_asm
  1549. vfp_args
  1550. xform_asm
  1551. xmm_clobbers
  1552. "
  1553. TYPES_LIST="
  1554. socklen_t
  1555. struct_addrinfo
  1556. struct_group_source_req
  1557. struct_ip_mreq_source
  1558. struct_ipv6_mreq
  1559. struct_pollfd
  1560. struct_rusage_ru_maxrss
  1561. struct_sctp_event_subscribe
  1562. struct_sockaddr_in6
  1563. struct_sockaddr_sa_len
  1564. struct_sockaddr_storage
  1565. struct_stat_st_mtim_tv_nsec
  1566. struct_v4l2_frmivalenum_discrete
  1567. "
  1568. HAVE_LIST="
  1569. $ARCH_EXT_LIST
  1570. $(add_suffix _external $ARCH_EXT_LIST)
  1571. $(add_suffix _inline $ARCH_EXT_LIST)
  1572. $ARCH_FEATURES
  1573. $ATOMICS_LIST
  1574. $BUILTIN_LIST
  1575. $HAVE_LIST_CMDLINE
  1576. $HAVE_LIST_PUB
  1577. $HEADERS_LIST
  1578. $MATH_FUNCS
  1579. $SYSTEM_FUNCS
  1580. $THREADS_LIST
  1581. $TOOLCHAIN_FEATURES
  1582. $TYPES_LIST
  1583. atomics_native
  1584. dos_paths
  1585. libc_msvcrt
  1586. libdc1394_1
  1587. libdc1394_2
  1588. makeinfo
  1589. perl
  1590. pod2man
  1591. sdl
  1592. texi2html
  1593. threads
  1594. vdpau_x11
  1595. xlib
  1596. "
  1597. # options emitted with CONFIG_ prefix but not available on the command line
  1598. CONFIG_EXTRA="
  1599. aandcttables
  1600. ac3dsp
  1601. audio_frame_queue
  1602. cabac
  1603. dsputil
  1604. exif
  1605. frame_thread_encoder
  1606. gcrypt
  1607. golomb
  1608. gplv3
  1609. h263dsp
  1610. h264chroma
  1611. h264dsp
  1612. h264pred
  1613. h264qpel
  1614. hpeldsp
  1615. huffman
  1616. intrax8
  1617. lgplv3
  1618. llviddsp
  1619. lpc
  1620. mpegaudio
  1621. mpegaudiodsp
  1622. mpegvideo
  1623. mpegvideoenc
  1624. nettle
  1625. rangecoder
  1626. riffdec
  1627. riffenc
  1628. rtpdec
  1629. rtpenc_chain
  1630. sinewin
  1631. tpeldsp
  1632. videodsp
  1633. vp3dsp
  1634. "
  1635. CMDLINE_SELECT="
  1636. $ARCH_EXT_LIST
  1637. $CONFIG_LIST
  1638. $HAVE_LIST_CMDLINE
  1639. $THREADS_LIST
  1640. asm
  1641. cross_compile
  1642. debug
  1643. extra_warnings
  1644. logging
  1645. lto
  1646. optimizations
  1647. rpath
  1648. stripping
  1649. "
  1650. PATHS_LIST="
  1651. bindir
  1652. datadir
  1653. docdir
  1654. incdir
  1655. libdir
  1656. mandir
  1657. prefix
  1658. shlibdir
  1659. "
  1660. CMDLINE_SET="
  1661. $PATHS_LIST
  1662. ar
  1663. arch
  1664. as
  1665. assert_level
  1666. build_suffix
  1667. cc
  1668. cpu
  1669. cross_prefix
  1670. cxx
  1671. dep_cc
  1672. extra_version
  1673. gas
  1674. host_cc
  1675. host_cflags
  1676. host_ld
  1677. host_ldflags
  1678. host_libs
  1679. host_os
  1680. install
  1681. ld
  1682. logfile
  1683. malloc_prefix
  1684. nm
  1685. optflags
  1686. pkg_config
  1687. pkg_config_flags
  1688. progs_suffix
  1689. random_seed
  1690. samples
  1691. strip
  1692. sysinclude
  1693. sysroot
  1694. target_exec
  1695. target_os
  1696. target_path
  1697. target_samples
  1698. tempprefix
  1699. toolchain
  1700. valgrind
  1701. yasmexe
  1702. "
  1703. CMDLINE_APPEND="
  1704. extra_cflags
  1705. extra_cxxflags
  1706. host_cppflags
  1707. "
  1708. # code dependency declarations
  1709. # architecture extensions
  1710. armv5te_deps="arm"
  1711. armv6_deps="arm"
  1712. armv6t2_deps="arm"
  1713. armv8_deps="aarch64"
  1714. neon_deps_any="aarch64 arm"
  1715. vfp_deps_any="aarch64 arm"
  1716. vfpv3_deps="vfp"
  1717. map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
  1718. mipsfpu_deps="mips"
  1719. mips32r2_deps="mips"
  1720. mipsdspr1_deps="mips"
  1721. mipsdspr2_deps="mips"
  1722. altivec_deps="ppc"
  1723. ppc4xx_deps="ppc"
  1724. cpunop_deps="i686"
  1725. x86_64_select="i686"
  1726. x86_64_suggest="fast_cmov"
  1727. amd3dnow_deps="mmx"
  1728. amd3dnowext_deps="amd3dnow"
  1729. i686_deps="x86"
  1730. mmx_deps="x86"
  1731. mmxext_deps="mmx"
  1732. sse_deps="mmxext"
  1733. sse2_deps="sse"
  1734. sse3_deps="sse2"
  1735. ssse3_deps="sse3"
  1736. sse4_deps="ssse3"
  1737. sse42_deps="sse4"
  1738. avx_deps="sse42"
  1739. xop_deps="avx"
  1740. fma3_deps="avx"
  1741. fma4_deps="avx"
  1742. avx2_deps="avx"
  1743. mmx_external_deps="yasm"
  1744. mmx_inline_deps="inline_asm"
  1745. mmx_suggest="mmx_external mmx_inline"
  1746. for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
  1747. eval dep=\$${ext}_deps
  1748. eval ${ext}_external_deps='"${dep}_external"'
  1749. eval ${ext}_inline_deps='"${dep}_inline"'
  1750. eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
  1751. done
  1752. aligned_stack_if_any="aarch64 ppc x86"
  1753. fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1754. fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
  1755. fast_unaligned_if_any="aarch64 ppc x86"
  1756. need_memalign="altivec neon sse"
  1757. # system capabilities
  1758. log2_deps="!libc_msvcrt"
  1759. symver_if_any="symver_asm_label symver_gnu_asm"
  1760. # threading support
  1761. atomics_gcc_if="sync_val_compare_and_swap"
  1762. atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
  1763. atomics_win32_if="MemoryBarrier"
  1764. atomics_native_if_any="$ATOMICS_LIST"
  1765. w32threads_deps="atomics_native"
  1766. threads_if_any="$THREADS_LIST"
  1767. # subsystems
  1768. dct_select="rdft"
  1769. error_resilience_select="dsputil"
  1770. frame_thread_encoder_deps="encoders threads"
  1771. mdct_select="fft"
  1772. rdft_select="fft"
  1773. mpegaudio_select="mpegaudiodsp"
  1774. mpegaudiodsp_select="dct"
  1775. mpegvideo_select="dsputil h264chroma hpeldsp videodsp"
  1776. mpegvideoenc_select="dsputil mpegvideo"
  1777. # decoders / encoders
  1778. aac_decoder_select="mdct sinewin"
  1779. aac_encoder_select="audio_frame_queue mdct sinewin"
  1780. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1781. ac3_decoder_select="mdct ac3dsp ac3_parser dsputil"
  1782. ac3_fixed_decoder_select="mdct ac3dsp ac3_parser dsputil"
  1783. ac3_encoder_select="mdct ac3dsp dsputil"
  1784. ac3_fixed_encoder_select="mdct ac3dsp dsputil"
  1785. aic_decoder_select="dsputil golomb"
  1786. alac_encoder_select="lpc"
  1787. als_decoder_select="dsputil"
  1788. amrnb_decoder_select="lsp"
  1789. amrwb_decoder_select="lsp"
  1790. amv_decoder_select="sp5x_decoder exif"
  1791. amv_encoder_select="aandcttables"
  1792. ape_decoder_select="dsputil"
  1793. asv1_decoder_select="dsputil"
  1794. asv1_encoder_select="dsputil"
  1795. asv2_decoder_select="dsputil"
  1796. asv2_encoder_select="dsputil"
  1797. atrac1_decoder_select="mdct sinewin"
  1798. atrac3_decoder_select="mdct"
  1799. atrac3p_decoder_select="mdct sinewin"
  1800. avrn_decoder_select="exif"
  1801. bink_decoder_select="dsputil hpeldsp"
  1802. binkaudio_dct_decoder_select="mdct rdft dct sinewin"
  1803. binkaudio_rdft_decoder_select="mdct rdft sinewin"
  1804. cavs_decoder_select="dsputil golomb h264chroma videodsp"
  1805. cllc_decoder_select="dsputil"
  1806. comfortnoise_encoder_select="lpc"
  1807. cook_decoder_select="dsputil mdct sinewin"
  1808. cscd_decoder_select="lzo"
  1809. cscd_decoder_suggest="zlib"
  1810. dca_decoder_select="mdct"
  1811. dirac_decoder_select="dsputil dwt golomb videodsp"
  1812. dnxhd_decoder_select="dsputil"
  1813. dnxhd_encoder_select="aandcttables dsputil mpegvideoenc"
  1814. dvvideo_decoder_select="dsputil"
  1815. dvvideo_encoder_select="dsputil"
  1816. dxa_decoder_select="zlib"
  1817. eac3_decoder_select="ac3_decoder"
  1818. eac3_encoder_select="ac3_encoder"
  1819. eamad_decoder_select="aandcttables dsputil mpegvideo"
  1820. eatgq_decoder_select="aandcttables"
  1821. eatqi_decoder_select="aandcttables dsputil error_resilience mpegvideo"
  1822. exr_decoder_select="zlib"
  1823. ffv1_decoder_select="golomb rangecoder"
  1824. ffv1_encoder_select="rangecoder"
  1825. ffvhuff_decoder_select="huffyuv_decoder"
  1826. ffvhuff_encoder_select="huffyuv_encoder"
  1827. fic_decoder_select="golomb"
  1828. flac_decoder_select="golomb"
  1829. flac_encoder_select="dsputil golomb lpc"
  1830. flashsv_decoder_select="zlib"
  1831. flashsv_encoder_select="zlib"
  1832. flashsv2_encoder_select="zlib"
  1833. flashsv2_decoder_select="zlib"
  1834. flv_decoder_select="h263_decoder"
  1835. flv_encoder_select="h263_encoder"
  1836. fourxm_decoder_select="dsputil"
  1837. fraps_decoder_select="dsputil huffman"
  1838. g2m_decoder_select="dsputil zlib"
  1839. g729_decoder_select="dsputil"
  1840. h261_decoder_select="error_resilience mpegvideo"
  1841. h261_encoder_select="aandcttables mpegvideoenc"
  1842. h263_decoder_select="error_resilience h263_parser h263dsp mpegvideo"
  1843. h263_encoder_select="aandcttables h263dsp mpegvideoenc"
  1844. h263i_decoder_select="h263_decoder"
  1845. h263p_encoder_select="h263_encoder"
  1846. h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel videodsp"
  1847. h264_decoder_suggest="error_resilience"
  1848. hevc_decoder_select="cabac dsputil golomb videodsp"
  1849. huffyuv_decoder_select="dsputil llviddsp"
  1850. huffyuv_encoder_select="dsputil huffman llviddsp"
  1851. iac_decoder_select="imc_decoder"
  1852. imc_decoder_select="dsputil fft mdct sinewin"
  1853. indeo3_decoder_select="hpeldsp"
  1854. interplay_video_decoder_select="hpeldsp"
  1855. jpegls_decoder_select="golomb mjpeg_decoder"
  1856. jpegls_encoder_select="golomb"
  1857. jv_decoder_select="dsputil"
  1858. lagarith_decoder_select="dsputil"
  1859. ljpeg_encoder_select="aandcttables mpegvideoenc"
  1860. loco_decoder_select="golomb"
  1861. mdec_decoder_select="dsputil error_resilience mpegvideo"
  1862. metasound_decoder_select="lsp mdct sinewin"
  1863. mimic_decoder_select="dsputil hpeldsp"
  1864. mjpeg_decoder_select="dsputil hpeldsp exif"
  1865. mjpeg_encoder_select="aandcttables mpegvideoenc"
  1866. mjpegb_decoder_select="mjpeg_decoder"
  1867. mlp_decoder_select="mlp_parser"
  1868. motionpixels_decoder_select="dsputil"
  1869. mp1_decoder_select="mpegaudio"
  1870. mp1float_decoder_select="mpegaudio"
  1871. mp2_decoder_select="mpegaudio"
  1872. mp2float_decoder_select="mpegaudio"
  1873. mp3_decoder_select="mpegaudio"
  1874. mp3adu_decoder_select="mpegaudio"
  1875. mp3adufloat_decoder_select="mpegaudio"
  1876. mp3float_decoder_select="mpegaudio"
  1877. mp3on4_decoder_select="mpegaudio"
  1878. mp3on4float_decoder_select="mpegaudio"
  1879. mpc7_decoder_select="dsputil mpegaudiodsp"
  1880. mpc8_decoder_select="mpegaudiodsp"
  1881. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1882. mpeg_xvmc_decoder_select="mpeg2video_decoder"
  1883. mpeg1video_decoder_select="error_resilience mpegvideo"
  1884. mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp"
  1885. mpeg2video_decoder_select="error_resilience mpegvideo"
  1886. mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp"
  1887. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1888. mpeg4_encoder_select="h263_encoder"
  1889. msmpeg4v1_decoder_select="h263_decoder"
  1890. msmpeg4v2_decoder_select="h263_decoder"
  1891. msmpeg4v2_encoder_select="h263_encoder"
  1892. msmpeg4v3_decoder_select="h263_decoder"
  1893. msmpeg4v3_encoder_select="h263_encoder"
  1894. mss2_decoder_select="error_resilience vc1_decoder"
  1895. mxpeg_decoder_select="mjpeg_decoder"
  1896. nellymoser_decoder_select="mdct sinewin"
  1897. nellymoser_encoder_select="audio_frame_queue mdct sinewin"
  1898. nuv_decoder_select="dsputil lzo"
  1899. on2avc_decoder_select="mdct"
  1900. png_decoder_select="zlib"
  1901. png_encoder_select="dsputil zlib"
  1902. prores_decoder_select="dsputil"
  1903. prores_encoder_select="dsputil"
  1904. qcelp_decoder_select="lsp"
  1905. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1906. ra_144_encoder_select="audio_frame_queue lpc"
  1907. ralf_decoder_select="golomb"
  1908. rawvideo_decoder_select="dsputil"
  1909. rtjpeg_decoder_select="dsputil"
  1910. rv10_decoder_select="error_resilience h263_decoder h263dsp"
  1911. rv10_encoder_select="h263_encoder"
  1912. rv20_decoder_select="error_resilience h263_decoder h263dsp"
  1913. rv20_encoder_select="h263_encoder"
  1914. rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
  1915. rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
  1916. shorten_decoder_select="golomb"
  1917. sipr_decoder_select="lsp"
  1918. snow_decoder_select="dsputil dwt h264qpel hpeldsp rangecoder"
  1919. snow_encoder_select="aandcttables dsputil dwt h264qpel hpeldsp mpegvideoenc rangecoder"
  1920. sonic_decoder_select="golomb rangecoder"
  1921. sonic_encoder_select="golomb rangecoder"
  1922. sonic_ls_encoder_select="golomb"
  1923. sp5x_decoder_select="mjpeg_decoder"
  1924. svq1_decoder_select="hpeldsp"
  1925. svq1_encoder_select="aandcttables dsputil hpeldsp mpegvideoenc"
  1926. svq3_decoder_select="h264_decoder hpeldsp tpeldsp"
  1927. svq3_decoder_suggest="zlib"
  1928. tak_decoder_select="dsputil"
  1929. theora_decoder_select="vp3_decoder"
  1930. thp_decoder_select="mjpeg_decoder"
  1931. tiff_decoder_suggest="zlib"
  1932. tiff_encoder_suggest="zlib"
  1933. truehd_decoder_select="mlp_parser"
  1934. truemotion2_decoder_select="dsputil"
  1935. truespeech_decoder_select="dsputil"
  1936. tscc_decoder_select="zlib"
  1937. twinvq_decoder_select="mdct lsp sinewin"
  1938. utvideo_decoder_select="dsputil"
  1939. utvideo_encoder_select="dsputil huffman"
  1940. vble_decoder_select="dsputil"
  1941. vc1_decoder_select="error_resilience h263_decoder h264chroma h264qpel intrax8"
  1942. vc1image_decoder_select="vc1_decoder"
  1943. vorbis_decoder_select="mdct"
  1944. vorbis_encoder_select="mdct"
  1945. vp3_decoder_select="hpeldsp vp3dsp videodsp"
  1946. vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp"
  1947. vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
  1948. vp6a_decoder_select="vp6_decoder"
  1949. vp6f_decoder_select="vp6_decoder"
  1950. vp7_decoder_select="h264pred videodsp"
  1951. vp8_decoder_select="h264pred videodsp"
  1952. vp9_decoder_select="videodsp"
  1953. webp_decoder_select="vp8_decoder"
  1954. wmapro_decoder_select="mdct sinewin"
  1955. wmav1_decoder_select="mdct sinewin"
  1956. wmav1_encoder_select="mdct sinewin"
  1957. wmav2_decoder_select="mdct sinewin"
  1958. wmav2_encoder_select="mdct sinewin"
  1959. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1960. wmv1_decoder_select="h263_decoder"
  1961. wmv1_encoder_select="h263_encoder"
  1962. wmv2_decoder_select="h263_decoder intrax8 videodsp"
  1963. wmv2_encoder_select="h263_encoder"
  1964. wmv3_decoder_select="vc1_decoder"
  1965. wmv3image_decoder_select="wmv3_decoder"
  1966. zerocodec_decoder_select="zlib"
  1967. zlib_decoder_select="zlib"
  1968. zlib_encoder_select="zlib"
  1969. zmbv_decoder_select="zlib"
  1970. zmbv_encoder_select="zlib"
  1971. # hardware accelerators
  1972. crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
  1973. dxva2_deps="dxva2api_h"
  1974. vaapi_deps="va_va_h"
  1975. vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
  1976. vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
  1977. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1978. xvmc_deps="X11_extensions_XvMClib_h"
  1979. h263_vaapi_hwaccel_deps="vaapi"
  1980. h263_vaapi_hwaccel_select="h263_decoder"
  1981. h263_vdpau_hwaccel_deps="vdpau"
  1982. h263_vdpau_hwaccel_select="h263_decoder"
  1983. h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
  1984. h264_dxva2_hwaccel_deps="dxva2"
  1985. h264_dxva2_hwaccel_select="h264_decoder"
  1986. h264_vaapi_hwaccel_deps="vaapi"
  1987. h264_vaapi_hwaccel_select="h264_decoder"
  1988. h264_vda_decoder_deps="vda"
  1989. h264_vda_decoder_select="h264_decoder"
  1990. h264_vda_hwaccel_deps="vda"
  1991. h264_vda_hwaccel_select="h264_decoder"
  1992. h264_vdpau_decoder_deps="vdpau"
  1993. h264_vdpau_decoder_select="h264_decoder"
  1994. h264_vdpau_hwaccel_deps="vdpau"
  1995. h264_vdpau_hwaccel_select="h264_decoder"
  1996. mpeg_vdpau_decoder_deps="vdpau"
  1997. mpeg_vdpau_decoder_select="mpeg2video_decoder"
  1998. mpeg_xvmc_hwaccel_deps="xvmc"
  1999. mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
  2000. mpeg1_vdpau_decoder_deps="vdpau"
  2001. mpeg1_vdpau_decoder_select="mpeg1video_decoder"
  2002. mpeg1_vdpau_hwaccel_deps="vdpau"
  2003. mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
  2004. mpeg1_xvmc_hwaccel_deps="xvmc"
  2005. mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
  2006. mpeg2_crystalhd_decoder_select="crystalhd"
  2007. mpeg2_dxva2_hwaccel_deps="dxva2"
  2008. mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
  2009. mpeg2_vaapi_hwaccel_deps="vaapi"
  2010. mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
  2011. mpeg2_vdpau_hwaccel_deps="vdpau"
  2012. mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
  2013. mpeg2_xvmc_hwaccel_deps="xvmc"
  2014. mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
  2015. mpeg4_crystalhd_decoder_select="crystalhd"
  2016. mpeg4_vaapi_hwaccel_deps="vaapi"
  2017. mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
  2018. mpeg4_vdpau_decoder_deps="vdpau"
  2019. mpeg4_vdpau_decoder_select="mpeg4_decoder"
  2020. mpeg4_vdpau_hwaccel_deps="vdpau"
  2021. mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
  2022. msmpeg4_crystalhd_decoder_select="crystalhd"
  2023. vc1_crystalhd_decoder_select="crystalhd"
  2024. vc1_dxva2_hwaccel_deps="dxva2"
  2025. vc1_dxva2_hwaccel_select="vc1_decoder"
  2026. vc1_vaapi_hwaccel_deps="vaapi"
  2027. vc1_vaapi_hwaccel_select="vc1_decoder"
  2028. vc1_vdpau_decoder_deps="vdpau"
  2029. vc1_vdpau_decoder_select="vc1_decoder"
  2030. vc1_vdpau_hwaccel_deps="vdpau"
  2031. vc1_vdpau_hwaccel_select="vc1_decoder"
  2032. wmv3_crystalhd_decoder_select="crystalhd"
  2033. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  2034. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  2035. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  2036. wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
  2037. # parsers
  2038. h264_parser_select="h264_decoder"
  2039. hevc_parser_select="hevc_decoder"
  2040. mpeg4video_parser_select="error_resilience h263dsp mpegvideo"
  2041. mpegvideo_parser_select="error_resilience mpegvideo"
  2042. vc1_parser_select="mpegvideo"
  2043. # external libraries
  2044. libaacplus_encoder_deps="libaacplus"
  2045. libcelt_decoder_deps="libcelt"
  2046. libfaac_encoder_deps="libfaac"
  2047. libfaac_encoder_select="audio_frame_queue"
  2048. libfdk_aac_decoder_deps="libfdk_aac"
  2049. libfdk_aac_encoder_deps="libfdk_aac"
  2050. libfdk_aac_encoder_select="audio_frame_queue"
  2051. libgme_demuxer_deps="libgme"
  2052. libgsm_decoder_deps="libgsm"
  2053. libgsm_encoder_deps="libgsm"
  2054. libgsm_ms_decoder_deps="libgsm"
  2055. libgsm_ms_encoder_deps="libgsm"
  2056. libilbc_decoder_deps="libilbc"
  2057. libilbc_encoder_deps="libilbc"
  2058. libmodplug_demuxer_deps="libmodplug"
  2059. libmp3lame_encoder_deps="libmp3lame"
  2060. libmp3lame_encoder_select="audio_frame_queue"
  2061. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  2062. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  2063. libopencore_amrnb_encoder_select="audio_frame_queue"
  2064. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  2065. libopenjpeg_decoder_deps="libopenjpeg"
  2066. libopenjpeg_encoder_deps="libopenjpeg"
  2067. libopus_decoder_deps="libopus"
  2068. libopus_encoder_deps="libopus"
  2069. libopus_encoder_select="audio_frame_queue"
  2070. libquvi_demuxer_deps="libquvi"
  2071. libschroedinger_decoder_deps="libschroedinger"
  2072. libschroedinger_encoder_deps="libschroedinger"
  2073. libshine_encoder_deps="libshine"
  2074. libshine_encoder_select="audio_frame_queue"
  2075. libspeex_decoder_deps="libspeex"
  2076. libspeex_encoder_deps="libspeex"
  2077. libspeex_encoder_select="audio_frame_queue"
  2078. libstagefright_h264_decoder_deps="libstagefright_h264"
  2079. libtheora_encoder_deps="libtheora"
  2080. libtwolame_encoder_deps="libtwolame"
  2081. libvo_aacenc_encoder_deps="libvo_aacenc"
  2082. libvo_aacenc_encoder_select="audio_frame_queue"
  2083. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  2084. libvorbis_decoder_deps="libvorbis"
  2085. libvorbis_encoder_deps="libvorbis"
  2086. libvorbis_encoder_select="audio_frame_queue"
  2087. libvpx_vp8_decoder_deps="libvpx"
  2088. libvpx_vp8_encoder_deps="libvpx"
  2089. libvpx_vp9_decoder_deps="libvpx"
  2090. libvpx_vp9_encoder_deps="libvpx"
  2091. libwavpack_encoder_deps="libwavpack"
  2092. libwebp_encoder_deps="libwebp"
  2093. libx264_encoder_deps="libx264"
  2094. libx264rgb_encoder_deps="libx264"
  2095. libx265_encoder_deps="libx265"
  2096. libxavs_encoder_deps="libxavs"
  2097. libxvid_encoder_deps="libxvid"
  2098. libutvideo_decoder_deps="libutvideo"
  2099. libutvideo_encoder_deps="libutvideo"
  2100. libzvbi_teletext_decoder_deps="libzvbi"
  2101. # demuxers / muxers
  2102. ac3_demuxer_select="ac3_parser"
  2103. asf_demuxer_select="riffdec"
  2104. asf_muxer_select="riffenc"
  2105. asf_stream_muxer_select="asf_muxer"
  2106. avi_demuxer_select="riffdec exif"
  2107. avi_muxer_select="riffenc"
  2108. avisynth_demuxer_deps="avisynth"
  2109. avisynth_demuxer_select="riffdec"
  2110. caf_demuxer_select="riffdec"
  2111. dirac_demuxer_select="dirac_parser"
  2112. dts_demuxer_select="dca_parser"
  2113. dtshd_demuxer_select="dca_parser"
  2114. dxa_demuxer_select="riffdec"
  2115. eac3_demuxer_select="ac3_parser"
  2116. f4v_muxer_select="mov_muxer"
  2117. flac_demuxer_select="flac_parser"
  2118. hds_muxer_select="flv_muxer"
  2119. hls_muxer_select="mpegts_muxer"
  2120. image2_alias_pix_demuxer_select="image2_demuxer"
  2121. image2_brender_pix_demuxer_select="image2_demuxer"
  2122. ipod_muxer_select="mov_muxer"
  2123. ismv_muxer_select="mov_muxer"
  2124. libnut_demuxer_deps="libnut"
  2125. libnut_muxer_deps="libnut"
  2126. matroska_audio_muxer_select="matroska_muxer"
  2127. matroska_demuxer_select="riffdec"
  2128. matroska_demuxer_suggest="bzlib lzo zlib"
  2129. matroska_muxer_select="riffenc"
  2130. mmf_muxer_select="riffenc"
  2131. mov_demuxer_select="riffdec"
  2132. mov_demuxer_suggest="zlib"
  2133. mov_muxer_select="riffenc rtpenc_chain"
  2134. mp3_demuxer_select="mpegaudio_parser"
  2135. mp4_muxer_select="mov_muxer"
  2136. mpegts_muxer_select="adts_muxer latm_muxer"
  2137. mpegtsraw_demuxer_select="mpegts_demuxer"
  2138. mxf_d10_muxer_select="mxf_muxer"
  2139. nut_muxer_select="riffenc"
  2140. nuv_demuxer_select="riffdec"
  2141. ogg_demuxer_select="golomb"
  2142. psp_muxer_select="mov_muxer"
  2143. rtp_demuxer_select="sdp_demuxer"
  2144. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  2145. rtsp_demuxer_select="http_protocol rtpdec"
  2146. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  2147. sap_demuxer_select="sdp_demuxer"
  2148. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  2149. sdp_demuxer_select="rtpdec"
  2150. smoothstreaming_muxer_select="ismv_muxer"
  2151. spdif_muxer_select="aac_parser"
  2152. tak_demuxer_select="tak_parser"
  2153. tg2_muxer_select="mov_muxer"
  2154. tgp_muxer_select="mov_muxer"
  2155. vobsub_demuxer_select="mpegps_demuxer"
  2156. w64_demuxer_select="wav_demuxer"
  2157. w64_muxer_select="wav_muxer"
  2158. wav_demuxer_select="riffdec"
  2159. wav_muxer_select="riffenc"
  2160. webm_muxer_select="riffenc"
  2161. wtv_demuxer_select="riffdec"
  2162. wtv_muxer_select="riffenc"
  2163. xmv_demuxer_select="riffdec"
  2164. xwma_demuxer_select="riffdec"
  2165. # indevs / outdevs
  2166. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  2167. alsa_outdev_deps="alsa_asoundlib_h"
  2168. avfoundation_indev_extralibs="-framework CoreVideo -framework Foundation -framework AVFoundation -framework CoreMedia"
  2169. avfoundation_indev_select="avfoundation"
  2170. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  2171. caca_outdev_deps="libcaca"
  2172. decklink_outdev_deps="decklink pthreads"
  2173. decklink_outdev_extralibs="-lstdc++"
  2174. dshow_indev_deps="IBaseFilter"
  2175. dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid"
  2176. dv1394_indev_deps="dv1394"
  2177. dv1394_indev_select="dv_demuxer"
  2178. fbdev_indev_deps="linux_fb_h"
  2179. fbdev_outdev_deps="linux_fb_h"
  2180. gdigrab_indev_deps="CreateDIBSection"
  2181. gdigrab_indev_extralibs="-lgdi32"
  2182. gdigrab_indev_select="bmp_decoder"
  2183. iec61883_indev_deps="libiec61883"
  2184. jack_indev_deps="jack_jack_h sem_timedwait"
  2185. lavfi_indev_deps="avfilter"
  2186. libcdio_indev_deps="libcdio"
  2187. libdc1394_indev_deps="libdc1394"
  2188. libv4l2_indev_deps="libv4l2"
  2189. openal_indev_deps="openal"
  2190. opengl_outdev_deps="opengl"
  2191. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  2192. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  2193. pulse_indev_deps="libpulse"
  2194. pulse_outdev_deps="libpulse"
  2195. qtkit_indev_extralibs="-framework QTKit -framework Foundation -framework QuartzCore"
  2196. qtkit_indev_select="qtkit"
  2197. sdl_outdev_deps="sdl"
  2198. sndio_indev_deps="sndio_h"
  2199. sndio_outdev_deps="sndio_h"
  2200. v4l_indev_deps="linux_videodev_h"
  2201. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  2202. v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
  2203. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  2204. vfwcap_indev_extralibs="-lavicap32"
  2205. xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
  2206. xv_outdev_extralibs="-lXv -lX11 -lXext"
  2207. x11grab_indev_deps="x11grab"
  2208. # protocols
  2209. bluray_protocol_deps="libbluray"
  2210. ffrtmpcrypt_protocol_deps="!librtmp_protocol"
  2211. ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
  2212. ffrtmpcrypt_protocol_select="tcp_protocol"
  2213. ffrtmphttp_protocol_deps="!librtmp_protocol"
  2214. ffrtmphttp_protocol_select="http_protocol"
  2215. ftp_protocol_select="tcp_protocol"
  2216. gopher_protocol_select="network"
  2217. http_protocol_select="tcp_protocol"
  2218. httpproxy_protocol_select="tcp_protocol"
  2219. https_protocol_select="tls_protocol"
  2220. librtmp_protocol_deps="librtmp"
  2221. librtmpe_protocol_deps="librtmp"
  2222. librtmps_protocol_deps="librtmp"
  2223. librtmpt_protocol_deps="librtmp"
  2224. librtmpte_protocol_deps="librtmp"
  2225. libssh_protocol_deps="libssh"
  2226. mmsh_protocol_select="http_protocol"
  2227. mmst_protocol_select="network"
  2228. rtmp_protocol_deps="!librtmp_protocol"
  2229. rtmp_protocol_select="tcp_protocol"
  2230. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  2231. rtmps_protocol_deps="!librtmp_protocol"
  2232. rtmps_protocol_select="tls_protocol"
  2233. rtmpt_protocol_select="ffrtmphttp_protocol"
  2234. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  2235. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  2236. rtp_protocol_select="udp_protocol"
  2237. sctp_protocol_deps="struct_sctp_event_subscribe"
  2238. sctp_protocol_select="network"
  2239. srtp_protocol_select="rtp_protocol"
  2240. tcp_protocol_select="network"
  2241. tls_protocol_deps_any="openssl gnutls"
  2242. tls_protocol_select="tcp_protocol"
  2243. udp_protocol_select="network"
  2244. unix_protocol_deps="sys_un_h"
  2245. unix_protocol_select="network"
  2246. # filters
  2247. aconvert_filter_deps="swresample"
  2248. amovie_filter_deps="avcodec avformat"
  2249. aresample_filter_deps="swresample"
  2250. ass_filter_deps="libass"
  2251. asyncts_filter_deps="avresample"
  2252. atempo_filter_deps="avcodec"
  2253. atempo_filter_select="rdft"
  2254. azmq_filter_deps="libzmq"
  2255. blackframe_filter_deps="gpl"
  2256. boxblur_filter_deps="gpl"
  2257. colormatrix_filter_deps="gpl"
  2258. cropdetect_filter_deps="gpl"
  2259. dctdnoiz_filter_deps="avcodec"
  2260. dctdnoiz_filter_select="dct"
  2261. delogo_filter_deps="gpl"
  2262. deshake_filter_deps="avcodec"
  2263. deshake_filter_select="dsputil"
  2264. drawtext_filter_deps="libfreetype"
  2265. ebur128_filter_deps="gpl"
  2266. flite_filter_deps="libflite"
  2267. frei0r_filter_deps="frei0r dlopen"
  2268. frei0r_filter_extralibs='$ldl'
  2269. frei0r_src_filter_deps="frei0r dlopen"
  2270. frei0r_src_filter_extralibs='$ldl'
  2271. geq_filter_deps="gpl"
  2272. histeq_filter_deps="gpl"
  2273. hqdn3d_filter_deps="gpl"
  2274. interlace_filter_deps="gpl"
  2275. kerndeint_filter_deps="gpl"
  2276. ladspa_filter_deps="ladspa dlopen"
  2277. mcdeint_filter_deps="avcodec gpl"
  2278. movie_filter_deps="avcodec avformat"
  2279. mp_filter_deps="gpl avcodec swscale inline_asm"
  2280. mpdecimate_filter_deps="gpl avcodec"
  2281. mptestsrc_filter_deps="gpl"
  2282. negate_filter_deps="lut_filter"
  2283. perspective_filter_deps="gpl"
  2284. ocv_filter_deps="libopencv"
  2285. owdenoise_filter_deps="gpl"
  2286. pan_filter_deps="swresample"
  2287. phase_filter_deps="gpl"
  2288. pp_filter_deps="gpl postproc"
  2289. pullup_filter_deps="gpl"
  2290. removelogo_filter_deps="avcodec avformat swscale"
  2291. resample_filter_deps="avresample"
  2292. sab_filter_deps="gpl swscale"
  2293. scale_filter_deps="swscale"
  2294. smartblur_filter_deps="gpl swscale"
  2295. showspectrum_filter_deps="avcodec"
  2296. showspectrum_filter_select="rdft"
  2297. spp_filter_deps="gpl avcodec"
  2298. spp_filter_select="fft"
  2299. stereo3d_filter_deps="gpl"
  2300. subtitles_filter_deps="avformat avcodec libass"
  2301. super2xsai_filter_deps="gpl"
  2302. tinterlace_filter_deps="gpl"
  2303. vidstabdetect_filter_deps="libvidstab"
  2304. vidstabtransform_filter_deps="libvidstab"
  2305. pixfmts_super2xsai_test_deps="super2xsai_filter"
  2306. tinterlace_merge_test_deps="tinterlace_filter"
  2307. tinterlace_pad_test_deps="tinterlace_filter"
  2308. zmq_filter_deps="libzmq"
  2309. # examples
  2310. avio_reading="avformat avcodec avutil"
  2311. avcodec_example_deps="avcodec avutil"
  2312. demuxing_decoding_example_deps="avcodec avformat avutil"
  2313. filter_audio_example_deps="avfilter avutil"
  2314. filtering_audio_example_deps="avfilter avcodec avformat avutil"
  2315. filtering_video_example_deps="avfilter avcodec avformat avutil"
  2316. metadata_example_deps="avformat avutil"
  2317. muxing_example_deps="avcodec avformat avutil swscale"
  2318. remuxing_example_deps="avcodec avformat avutil"
  2319. resampling_audio_example_deps="avutil swresample"
  2320. scaling_video_example_deps="avutil swscale"
  2321. transcode_aac_example_deps="avcodec avformat swresample"
  2322. transcoding_example_deps="avfilter avcodec avformat avutil"
  2323. # libraries
  2324. avcodec_deps="avutil"
  2325. avdevice_deps="avutil avcodec avformat"
  2326. avfilter_deps="avutil"
  2327. avformat_deps="avutil avcodec"
  2328. avresample_deps="avutil"
  2329. postproc_deps="avutil gpl"
  2330. swscale_deps="avutil"
  2331. # programs
  2332. ffmpeg_deps="avcodec avfilter avformat swresample"
  2333. ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
  2334. null_filter
  2335. setpts_filter trim_filter"
  2336. ffplay_deps="avcodec avformat swscale swresample sdl"
  2337. ffplay_libs='$sdl_libs'
  2338. ffplay_select="rdft crop_filter"
  2339. ffprobe_deps="avcodec avformat"
  2340. ffserver_deps="avformat fork sarestart"
  2341. ffserver_select="ffm_muxer rtp_protocol rtsp_demuxer"
  2342. # documentation
  2343. podpages_deps="perl"
  2344. manpages_deps="perl pod2man"
  2345. htmlpages_deps="perl texi2html"
  2346. txtpages_deps="perl makeinfo"
  2347. doc_deps_any="manpages htmlpages podpages txtpages"
  2348. # default parameters
  2349. logfile="config.log"
  2350. # installation paths
  2351. prefix_default="/usr/local"
  2352. bindir_default='${prefix}/bin'
  2353. datadir_default='${prefix}/share/ffmpeg'
  2354. docdir_default='${prefix}/share/doc/ffmpeg'
  2355. incdir_default='${prefix}/include'
  2356. libdir_default='${prefix}/lib'
  2357. mandir_default='${prefix}/share/man'
  2358. shlibdir_default="$libdir_default"
  2359. # toolchain
  2360. ar_default="ar"
  2361. cc_default="gcc"
  2362. cxx_default="g++"
  2363. host_cc_default="gcc"
  2364. cp_f="cp -f"
  2365. install="install"
  2366. ln_s="ln -s -f"
  2367. nm_default="nm -g"
  2368. objformat="elf"
  2369. pkg_config_default=pkg-config
  2370. ranlib="ranlib"
  2371. strip_default="strip"
  2372. yasmexe_default="yasm"
  2373. windres_default="windres"
  2374. nogas=":"
  2375. # OS
  2376. target_os_default=$(tolower $(uname -s))
  2377. host_os=$target_os_default
  2378. # machine
  2379. if test "$target_os_default" = aix; then
  2380. arch_default=$(uname -p)
  2381. else
  2382. arch_default=$(uname -m)
  2383. fi
  2384. cpu="generic"
  2385. # configurable options
  2386. enable $PROGRAM_LIST
  2387. enable $DOCUMENT_LIST
  2388. enable $EXAMPLE_LIST
  2389. enable $(filter_out avresample $LIBRARY_LIST)
  2390. enable stripping
  2391. enable asm
  2392. enable debug
  2393. enable doc
  2394. enable optimizations
  2395. enable runtime_cpudetect
  2396. enable safe_bitstream_reader
  2397. enable static
  2398. enable swscale_alpha
  2399. # Enable hwaccels by default.
  2400. enable dxva2 vaapi vda vdpau xvmc
  2401. enable xlib
  2402. # build settings
  2403. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  2404. LIBPREF="lib"
  2405. LIBSUF=".a"
  2406. FULLNAME='$(NAME)$(BUILDSUF)'
  2407. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  2408. SLIBPREF="lib"
  2409. SLIBSUF=".so"
  2410. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  2411. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  2412. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  2413. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  2414. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  2415. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  2416. asflags_filter=echo
  2417. cflags_filter=echo
  2418. ldflags_filter=echo
  2419. AS_C='-c'
  2420. AS_O='-o $@'
  2421. CC_C='-c'
  2422. CC_E='-E -o $@'
  2423. CC_O='-o $@'
  2424. CXX_C='-c'
  2425. CXX_O='-o $@'
  2426. LD_O='-o $@'
  2427. LD_LIB='-l%'
  2428. LD_PATH='-L'
  2429. HOSTCC_C='-c'
  2430. HOSTCC_E='-E -o $@'
  2431. HOSTCC_O='-o $@'
  2432. HOSTLD_O='-o $@'
  2433. host_libs='-lm'
  2434. host_cflags_filter=echo
  2435. host_ldflags_filter=echo
  2436. target_path='$(CURDIR)'
  2437. # since the object filename is not given with the -MM flag, the compiler
  2438. # is only able to print the basename, and we must add the path ourselves
  2439. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  2440. DEPFLAGS='-MM'
  2441. # find source path
  2442. if test -f configure; then
  2443. source_path=.
  2444. else
  2445. source_path=$(cd $(dirname "$0"); pwd)
  2446. echo "$source_path" | grep -q '[[:blank:]]' &&
  2447. die "Out of tree builds are impossible with whitespace in source path."
  2448. test -e "$source_path/config.h" &&
  2449. die "Out of tree builds are impossible with config.h in source dir."
  2450. fi
  2451. for v in "$@"; do
  2452. r=${v#*=}
  2453. l=${v%"$r"}
  2454. r=$(sh_quote "$r")
  2455. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  2456. done
  2457. find_things(){
  2458. thing=$1
  2459. pattern=$2
  2460. file=$source_path/$3
  2461. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  2462. }
  2463. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  2464. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  2465. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  2466. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  2467. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  2468. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  2469. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  2470. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  2471. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  2472. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  2473. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  2474. ALL_COMPONENTS="
  2475. $BSF_LIST
  2476. $DECODER_LIST
  2477. $DEMUXER_LIST
  2478. $ENCODER_LIST
  2479. $FILTER_LIST
  2480. $HWACCEL_LIST
  2481. $INDEV_LIST
  2482. $MUXER_LIST
  2483. $OUTDEV_LIST
  2484. $PARSER_LIST
  2485. $PROTOCOL_LIST
  2486. "
  2487. for n in $COMPONENT_LIST; do
  2488. v=$(toupper ${n%s})_LIST
  2489. eval enable \$$v
  2490. eval ${n}_if_any="\$$v"
  2491. done
  2492. enable $ARCH_EXT_LIST
  2493. die_unknown(){
  2494. echo "Unknown option \"$1\"."
  2495. echo "See $0 --help for available options."
  2496. exit 1
  2497. }
  2498. print_3_columns() {
  2499. cat | tr ' ' '\n' | sort | pr -r -3 -t
  2500. }
  2501. show_list() {
  2502. suffix=_$1
  2503. shift
  2504. echo $* | sed s/$suffix//g | print_3_columns
  2505. exit 0
  2506. }
  2507. rand_list(){
  2508. IFS=', '
  2509. set -- $*
  2510. unset IFS
  2511. for thing; do
  2512. comp=${thing%:*}
  2513. prob=${thing#$comp}
  2514. prob=${prob#:}
  2515. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  2516. echo "prob ${prob:-0.5}"
  2517. printf '%s\n' $comp
  2518. done
  2519. }
  2520. do_random(){
  2521. action=$1
  2522. shift
  2523. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  2524. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  2525. }
  2526. for opt do
  2527. optval="${opt#*=}"
  2528. case "$opt" in
  2529. --extra-ldflags=*)
  2530. add_ldflags $optval
  2531. ;;
  2532. --extra-libs=*)
  2533. add_extralibs $optval
  2534. ;;
  2535. --disable-devices)
  2536. disable $INDEV_LIST $OUTDEV_LIST
  2537. ;;
  2538. --enable-debug=*)
  2539. debuglevel="$optval"
  2540. ;;
  2541. --disable-programs)
  2542. disable $PROGRAM_LIST
  2543. ;;
  2544. --disable-everything)
  2545. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2546. ;;
  2547. --disable-all)
  2548. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2549. disable $LIBRARY_LIST $PROGRAM_LIST doc
  2550. ;;
  2551. --enable-random|--disable-random)
  2552. action=${opt%%-random}
  2553. do_random ${action#--} $COMPONENT_LIST
  2554. ;;
  2555. --enable-random=*|--disable-random=*)
  2556. action=${opt%%-random=*}
  2557. do_random ${action#--} $optval
  2558. ;;
  2559. --enable-*=*|--disable-*=*)
  2560. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  2561. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  2562. eval list=\$$(toupper $thing)_LIST
  2563. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  2564. list=$(filter "$name" $list)
  2565. [ "$list" = "" ] && warn "Option $opt did not match anything"
  2566. $action $list
  2567. ;;
  2568. --enable-?*|--disable-?*)
  2569. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  2570. if is_in $option $COMPONENT_LIST; then
  2571. test $action = disable && action=unset
  2572. eval $action \$$(toupper ${option%s})_LIST
  2573. elif is_in $option $CMDLINE_SELECT; then
  2574. $action $option
  2575. else
  2576. die_unknown $opt
  2577. fi
  2578. ;;
  2579. --list-*)
  2580. NAME="${opt#--list-}"
  2581. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  2582. NAME=${NAME%s}
  2583. eval show_list $NAME \$$(toupper $NAME)_LIST
  2584. ;;
  2585. --help|-h) show_help
  2586. ;;
  2587. --fatal-warnings) enable fatal_warnings
  2588. ;;
  2589. *)
  2590. optname="${opt%%=*}"
  2591. optname="${optname#--}"
  2592. optname=$(echo "$optname" | sed 's/-/_/g')
  2593. if is_in $optname $CMDLINE_SET; then
  2594. eval $optname='$optval'
  2595. elif is_in $optname $CMDLINE_APPEND; then
  2596. append $optname "$optval"
  2597. else
  2598. die_unknown $opt
  2599. fi
  2600. ;;
  2601. esac
  2602. done
  2603. disabled logging && logfile=/dev/null
  2604. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  2605. set >> $logfile
  2606. test -n "$cross_prefix" && enable cross_compile
  2607. if enabled cross_compile; then
  2608. test -n "$arch" && test -n "$target_os" ||
  2609. die "Must specify target arch and OS when cross-compiling"
  2610. fi
  2611. ar_default="${cross_prefix}${ar_default}"
  2612. cc_default="${cross_prefix}${cc_default}"
  2613. cxx_default="${cross_prefix}${cxx_default}"
  2614. nm_default="${cross_prefix}${nm_default}"
  2615. pkg_config_default="${cross_prefix}${pkg_config_default}"
  2616. ranlib="${cross_prefix}${ranlib}"
  2617. strip_default="${cross_prefix}${strip_default}"
  2618. windres_default="${cross_prefix}${windres_default}"
  2619. sysinclude_default="${sysroot}/usr/include"
  2620. test -n "$valgrind" && toolchain="valgrind-memcheck"
  2621. case "$toolchain" in
  2622. clang-asan)
  2623. cc_default="clang"
  2624. add_cflags -fsanitize=address
  2625. add_ldflags -fsanitize=address
  2626. ;;
  2627. clang-tsan)
  2628. cc_default="clang"
  2629. add_cflags -fsanitize=thread -pie
  2630. add_ldflags -fsanitize=thread -pie
  2631. ;;
  2632. clang-usan)
  2633. cc_default="clang"
  2634. add_cflags -fsanitize=undefined
  2635. add_ldflags -fsanitize=undefined
  2636. ;;
  2637. gcc-asan)
  2638. cc_default="gcc"
  2639. add_cflags -fsanitize=address
  2640. add_ldflags -fsanitize=address
  2641. ;;
  2642. gcc-tsan)
  2643. cc_default="gcc"
  2644. add_cflags -fsanitize=thread -pie -fPIC
  2645. add_ldflags -fsanitize=thread -pie -fPIC
  2646. ;;
  2647. gcc-usan)
  2648. cc_default="gcc"
  2649. add_cflags -fsanitize=undefined
  2650. add_ldflags -fsanitize=undefined
  2651. ;;
  2652. valgrind-massif)
  2653. target_exec_default=${valgrind:-"valgrind"}
  2654. 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"
  2655. ;;
  2656. valgrind-memcheck)
  2657. target_exec_default=${valgrind:-"valgrind"}
  2658. 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"
  2659. ;;
  2660. msvc)
  2661. # Check whether the current MSVC version needs the C99 converter.
  2662. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  2663. # support enough of C99 to build ffmpeg. Default to the new
  2664. # behaviour if the regexp was unable to match anything, since this
  2665. # successfully parses the version number of existing supported
  2666. # versions that require the converter (MSVC 2010 and 2012).
  2667. cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  2668. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  2669. cc_default="cl"
  2670. else
  2671. cc_default="c99wrap cl"
  2672. fi
  2673. ld_default="link"
  2674. nm_default="dumpbin -symbols"
  2675. ar_default="lib"
  2676. target_os_default="win32"
  2677. # Use a relative path for TMPDIR. This makes sure all the
  2678. # ffconf temp files are written with a relative path, avoiding
  2679. # issues with msys/win32 path conversion for MSVC parameters
  2680. # such as -Fo<file> or -out:<file>.
  2681. TMPDIR=.
  2682. ;;
  2683. icl)
  2684. cc_default="icl"
  2685. ld_default="xilink"
  2686. nm_default="dumpbin -symbols"
  2687. ar_default="xilib"
  2688. target_os_default="win32"
  2689. TMPDIR=.
  2690. ;;
  2691. gcov)
  2692. add_cflags -fprofile-arcs -ftest-coverage
  2693. add_ldflags -fprofile-arcs -ftest-coverage
  2694. ;;
  2695. hardened)
  2696. add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all
  2697. add_ldflags -Wl,-z,relro -Wl,-z,now
  2698. ;;
  2699. ?*)
  2700. die "Unknown toolchain $toolchain"
  2701. ;;
  2702. esac
  2703. set_default arch cc cxx pkg_config strip sysinclude target_exec target_os yasmexe
  2704. enabled cross_compile || host_cc_default=$cc
  2705. set_default host_cc
  2706. if ! $pkg_config --version >/dev/null 2>&1; then
  2707. warn "$pkg_config not found, library detection may fail."
  2708. pkg_config=false
  2709. fi
  2710. exesuf() {
  2711. case $1 in
  2712. mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2713. esac
  2714. }
  2715. EXESUF=$(exesuf $target_os)
  2716. HOSTEXESUF=$(exesuf $host_os)
  2717. # set temporary file name
  2718. : ${TMPDIR:=$TEMPDIR}
  2719. : ${TMPDIR:=$TMP}
  2720. : ${TMPDIR:=/tmp}
  2721. if [ -n "$tempprefix" ] ; then
  2722. mktemp(){
  2723. echo $tempprefix.${HOSTNAME}.${UID}
  2724. }
  2725. elif ! check_cmd mktemp -u XXXXXX; then
  2726. # simple replacement for missing mktemp
  2727. # NOT SAFE FOR GENERAL USE
  2728. mktemp(){
  2729. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2730. }
  2731. fi
  2732. tmpfile(){
  2733. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  2734. (set -C; exec > $tmp) 2>/dev/null ||
  2735. die "Unable to create temporary file in $TMPDIR."
  2736. append TMPFILES $tmp
  2737. eval $1=$tmp
  2738. }
  2739. trap 'rm -f -- $TMPFILES' EXIT
  2740. tmpfile TMPASM .asm
  2741. tmpfile TMPC .c
  2742. tmpfile TMPCPP .cpp
  2743. tmpfile TMPE $EXESUF
  2744. tmpfile TMPH .h
  2745. tmpfile TMPM .m
  2746. tmpfile TMPO .o
  2747. tmpfile TMPS .S
  2748. tmpfile TMPSH .sh
  2749. tmpfile TMPV .ver
  2750. unset -f mktemp
  2751. chmod +x $TMPE
  2752. # make sure we can execute files in $TMPDIR
  2753. cat > $TMPSH 2>> $logfile <<EOF
  2754. #! /bin/sh
  2755. EOF
  2756. chmod +x $TMPSH >> $logfile 2>&1
  2757. if ! $TMPSH >> $logfile 2>&1; then
  2758. cat <<EOF
  2759. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2760. variable to another directory and make sure that it is not mounted noexec.
  2761. EOF
  2762. die "Sanity test failed."
  2763. fi
  2764. ccc_flags(){
  2765. for flag; do
  2766. case $flag in
  2767. -std=c99) echo -c99 ;;
  2768. -mcpu=*) echo -arch ${flag#*=} ;;
  2769. -mieee) echo -ieee ;;
  2770. -O*|-fast) echo $flag ;;
  2771. -fno-math-errno) echo -assume nomath_errno ;;
  2772. -g) echo -g3 ;;
  2773. -Wall) echo -msg_enable level2 ;;
  2774. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  2775. -Wl,*) echo $flag ;;
  2776. -f*|-W*) ;;
  2777. *) echo $flag ;;
  2778. esac
  2779. done
  2780. }
  2781. cparser_flags(){
  2782. for flag; do
  2783. case $flag in
  2784. -Wno-switch) echo -Wno-switch-enum ;;
  2785. -Wno-format-zero-length) ;;
  2786. -Wdisabled-optimization) ;;
  2787. -Wno-pointer-sign) echo -Wno-other ;;
  2788. *) echo $flag ;;
  2789. esac
  2790. done
  2791. }
  2792. msvc_common_flags(){
  2793. for flag; do
  2794. case $flag in
  2795. # In addition to specifying certain flags under the compiler
  2796. # specific filters, they must be specified here as well or else the
  2797. # generic catch all at the bottom will print the original flag.
  2798. -Wall) ;;
  2799. -std=c99) ;;
  2800. # Common flags
  2801. -fomit-frame-pointer) ;;
  2802. -g) echo -Z7 ;;
  2803. -fno-math-errno) ;;
  2804. -fno-common) ;;
  2805. -fno-signed-zeros) ;;
  2806. -fPIC) ;;
  2807. -mthumb) ;;
  2808. -march=*) ;;
  2809. -lz) echo zlib.lib ;;
  2810. -lavifil32) echo vfw32.lib ;;
  2811. -lavicap32) echo vfw32.lib user32.lib ;;
  2812. -l*) echo ${flag#-l}.lib ;;
  2813. *) echo $flag ;;
  2814. esac
  2815. done
  2816. }
  2817. msvc_flags(){
  2818. msvc_common_flags "$@"
  2819. for flag; do
  2820. case $flag in
  2821. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2822. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2823. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2824. -wd4554 \
  2825. -wd4273 ;;
  2826. esac
  2827. done
  2828. }
  2829. icl_flags(){
  2830. msvc_common_flags "$@"
  2831. for flag; do
  2832. case $flag in
  2833. # Despite what Intel's documentation says -Wall, which is supported
  2834. # on Windows, does enable remarks so disable them here.
  2835. -Wall) echo $flag -Qdiag-disable:remark ;;
  2836. -std=c99) echo -Qstd=c99 ;;
  2837. esac
  2838. done
  2839. }
  2840. pgi_flags(){
  2841. for flag; do
  2842. case $flag in
  2843. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2844. -fomit-frame-pointer) echo -Mnoframe ;;
  2845. -g) echo -gopt ;;
  2846. *) echo $flag ;;
  2847. esac
  2848. done
  2849. }
  2850. suncc_flags(){
  2851. for flag; do
  2852. case $flag in
  2853. -march=*|-mcpu=*)
  2854. case "${flag#*=}" in
  2855. native) echo -xtarget=native ;;
  2856. v9|niagara) echo -xarch=sparc ;;
  2857. ultrasparc) echo -xarch=sparcvis ;;
  2858. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2859. i586|pentium) echo -xchip=pentium ;;
  2860. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2861. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2862. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2863. pentium4*) echo -xtarget=pentium4 ;;
  2864. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2865. *-sse3) echo -xarch=sse3 ;;
  2866. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2867. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2868. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2869. amdfam10|barcelona) echo -xtarget=barcelona ;;
  2870. bdver*) echo -xarch=avx ;;
  2871. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2872. k8|opteron|athlon64|athlon-fx)
  2873. echo -xarch=sse2a ;;
  2874. athlon*) echo -xarch=pentium_proa ;;
  2875. esac
  2876. ;;
  2877. -std=c99) echo -xc99 ;;
  2878. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2879. -fPIC) echo -KPIC -xcode=pic32 ;;
  2880. -W*,*) echo $flag ;;
  2881. -f*-*|-W*|-mimpure-text) ;;
  2882. -shared) echo -G ;;
  2883. *) echo $flag ;;
  2884. esac
  2885. done
  2886. }
  2887. tms470_flags(){
  2888. for flag; do
  2889. case $flag in
  2890. -march=*|-mcpu=*)
  2891. case "${flag#*=}" in
  2892. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2893. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2894. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2895. armv6*|arm11*) echo -mv=6 ;;
  2896. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2897. echo -mv=5e ;;
  2898. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2899. esac
  2900. ;;
  2901. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2902. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2903. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2904. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2905. -msoft-float) echo --float_support=vfplib ;;
  2906. -O[0-3]|-mf=*) echo $flag ;;
  2907. -g) echo -g -mn ;;
  2908. -pds=*) echo $flag ;;
  2909. -D*|-I*) echo $flag ;;
  2910. --gcc|--abi=*) echo $flag ;;
  2911. -me) echo $flag ;;
  2912. esac
  2913. done
  2914. }
  2915. probe_cc(){
  2916. pfx=$1
  2917. _cc=$2
  2918. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2919. unset _ld_o _ldflags _ld_lib _ld_path
  2920. unset _depflags _DEPCMD _DEPFLAGS
  2921. _flags_filter=echo
  2922. if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
  2923. true # no-op to avoid reading stdin in following checks
  2924. elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2925. _type=llvm_gcc
  2926. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  2927. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  2928. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2929. _cflags_speed='-O3'
  2930. _cflags_size='-Os'
  2931. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2932. _type=gcc
  2933. gcc_version=$($_cc --version | head -n1)
  2934. gcc_basever=$($_cc -dumpversion)
  2935. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2936. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2937. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2938. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2939. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2940. fi
  2941. _cflags_speed='-O3'
  2942. _cflags_size='-Os'
  2943. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  2944. _type=icc
  2945. _ident=$($_cc --version | head -n1)
  2946. _depflags='-MMD'
  2947. _cflags_speed='-O3'
  2948. _cflags_size='-Os'
  2949. _cflags_noopt='-O1'
  2950. elif $_cc -v 2>&1 | grep -q xlc; then
  2951. _type=xlc
  2952. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2953. _cflags_speed='-O5'
  2954. _cflags_size='-O5 -qcompact'
  2955. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2956. _type=ccc
  2957. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2958. _DEPFLAGS='-M'
  2959. _cflags_speed='-fast'
  2960. _cflags_size='-O1'
  2961. _flags_filter=ccc_flags
  2962. elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
  2963. test -d "$sysroot" || die "No valid sysroot specified."
  2964. _type=armcc
  2965. _ident=$($_cc --vsn | head -n1 | sed 's/.*: //')
  2966. armcc_conf="$PWD/armcc.conf"
  2967. $_cc --arm_linux_configure \
  2968. --arm_linux_config_file="$armcc_conf" \
  2969. --configure_sysroot="$sysroot" \
  2970. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2971. die "Error creating armcc configuration file."
  2972. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2973. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2974. as_default="${cross_prefix}gcc"
  2975. _depflags='-MMD'
  2976. _cflags_speed='-O3'
  2977. _cflags_size='-Os'
  2978. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2979. _type=tms470
  2980. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2981. _flags='--gcc --abi=eabi -me'
  2982. _cc_e='-ppl -fe=$@'
  2983. _cc_o='-fe=$@'
  2984. _depflags='-ppa -ppd=$(@:.o=.d)'
  2985. _cflags_speed='-O3 -mf=5'
  2986. _cflags_size='-O3 -mf=2'
  2987. _flags_filter=tms470_flags
  2988. elif $_cc -v 2>&1 | grep -q clang; then
  2989. _type=clang
  2990. _ident=$($_cc --version | head -n1)
  2991. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2992. _cflags_speed='-O3'
  2993. _cflags_size='-Os'
  2994. elif $_cc -V 2>&1 | grep -q Sun; then
  2995. _type=suncc
  2996. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2997. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2998. _DEPFLAGS='-xM1 -xc99'
  2999. _ldflags='-std=c99'
  3000. _cflags_speed='-O5'
  3001. _cflags_size='-O5 -xspace'
  3002. _flags_filter=suncc_flags
  3003. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  3004. _type=pathscale
  3005. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  3006. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3007. _cflags_speed='-O2'
  3008. _cflags_size='-Os'
  3009. _flags_filter='filter_out -Wdisabled-optimization'
  3010. elif $_cc -v 2>&1 | grep -q Open64; then
  3011. _type=open64
  3012. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  3013. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3014. _cflags_speed='-O2'
  3015. _cflags_size='-Os'
  3016. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  3017. elif $_cc -V 2>&1 | grep -q Portland; then
  3018. _type=pgi
  3019. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  3020. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  3021. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  3022. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  3023. _cflags_noopt="-O"
  3024. _flags_filter=pgi_flags
  3025. elif $_cc 2>&1 | grep -q Microsoft; then
  3026. _type=msvc
  3027. _ident=$($cc 2>&1 | head -n1)
  3028. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  3029. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  3030. _cflags_speed="-O2"
  3031. _cflags_size="-O1"
  3032. if $_cc 2>&1 | grep -q Linker; then
  3033. _ld_o='-out:$@'
  3034. else
  3035. _ld_o='-Fe$@'
  3036. fi
  3037. _cc_o='-Fo$@'
  3038. _cc_e='-P -Fi$@'
  3039. _flags_filter=msvc_flags
  3040. _ld_lib='lib%.a'
  3041. _ld_path='-libpath:'
  3042. _flags='-nologo'
  3043. _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  3044. if [ $pfx = hostcc ]; then
  3045. append _cflags -Dsnprintf=_snprintf
  3046. fi
  3047. disable stripping
  3048. elif $_cc 2>&1 | grep -q Intel; then
  3049. _type=icl
  3050. _ident=$($cc 2>&1 | head -n1)
  3051. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  3052. # Not only is O3 broken on 13.x+ but it is slower on all previous
  3053. # versions (tested) as well.
  3054. _cflags_speed="-O2"
  3055. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  3056. if $_cc 2>&1 | grep -q Linker; then
  3057. _ld_o='-out:$@'
  3058. else
  3059. _ld_o='-Fe$@'
  3060. fi
  3061. _cc_o='-Fo$@'
  3062. _cc_e='-P'
  3063. _flags_filter=icl_flags
  3064. _ld_lib='lib%.a'
  3065. _ld_path='-libpath:'
  3066. # -Qdiag-error to make icl error when seeing certain unknown arguments
  3067. _flags='-nologo -Qdiag-error:4044,10157'
  3068. # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
  3069. # with MSVC which enables it by default.
  3070. _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
  3071. if [ $pfx = hostcc ]; then
  3072. append _cflags -Dsnprintf=_snprintf
  3073. fi
  3074. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  3075. _type=cparser
  3076. _ident=$($_cc --version | head -n1)
  3077. _depflags='-MMD'
  3078. _cflags_speed='-O4'
  3079. _cflags_size='-O2'
  3080. _flags_filter=cparser_flags
  3081. fi
  3082. eval ${pfx}_type=\$_type
  3083. eval ${pfx}_ident=\$_ident
  3084. }
  3085. set_ccvars(){
  3086. eval ${1}_C=\${_cc_c-\${${1}_C}}
  3087. eval ${1}_E=\${_cc_e-\${${1}_E}}
  3088. eval ${1}_O=\${_cc_o-\${${1}_O}}
  3089. if [ -n "$_depflags" ]; then
  3090. eval ${1}_DEPFLAGS=\$_depflags
  3091. else
  3092. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  3093. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  3094. eval DEP${1}FLAGS=\$_flags
  3095. fi
  3096. }
  3097. probe_cc cc "$cc"
  3098. cflags_filter=$_flags_filter
  3099. cflags_speed=$_cflags_speed
  3100. cflags_size=$_cflags_size
  3101. cflags_noopt=$_cflags_noopt
  3102. add_cflags $_flags $_cflags
  3103. cc_ldflags=$_ldflags
  3104. set_ccvars CC
  3105. probe_cc hostcc "$host_cc"
  3106. host_cflags_filter=$_flags_filter
  3107. add_host_cflags $_flags $_cflags
  3108. set_ccvars HOSTCC
  3109. test -n "$cc_type" && enable $cc_type ||
  3110. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  3111. : ${as_default:=$cc}
  3112. : ${dep_cc_default:=$cc}
  3113. : ${ld_default:=$cc}
  3114. : ${host_ld_default:=$host_cc}
  3115. set_default ar as dep_cc ld host_ld windres
  3116. probe_cc as "$as"
  3117. asflags_filter=$_flags_filter
  3118. add_asflags $_flags $_cflags
  3119. set_ccvars AS
  3120. probe_cc ld "$ld"
  3121. ldflags_filter=$_flags_filter
  3122. add_ldflags $_flags $_ldflags
  3123. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  3124. LD_O=${_ld_o-$LD_O}
  3125. LD_LIB=${_ld_lib-$LD_LIB}
  3126. LD_PATH=${_ld_path-$LD_PATH}
  3127. probe_cc hostld "$host_ld"
  3128. host_ldflags_filter=$_flags_filter
  3129. add_host_ldflags $_flags $_ldflags
  3130. HOSTLD_O=${_ld_o-$HOSTLD_O}
  3131. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  3132. probe_cc depcc "$dep_cc"
  3133. CCDEP=${_DEPCMD:-$DEPCMD}
  3134. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  3135. DEPCCFLAGS=$_flags
  3136. fi
  3137. if $ar 2>&1 | grep -q Microsoft; then
  3138. arflags="-nologo"
  3139. ar_o='-out:$@'
  3140. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  3141. arflags="rq"
  3142. ar_o='$@'
  3143. elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
  3144. arflags='-Xany -r -c'
  3145. ar_o='$@'
  3146. else
  3147. arflags="rc"
  3148. ar_o='$@'
  3149. fi
  3150. add_cflags $extra_cflags
  3151. add_cxxflags $extra_cxxflags
  3152. add_asflags $extra_cflags
  3153. if test -n "$sysroot"; then
  3154. case "$cc_type" in
  3155. gcc|llvm_gcc|clang)
  3156. add_cppflags --sysroot="$sysroot"
  3157. add_ldflags --sysroot="$sysroot"
  3158. # On Darwin --sysroot may be ignored, -isysroot always affects headers and linking
  3159. add_cppflags -isysroot "$sysroot"
  3160. add_ldflags -isysroot "$sysroot"
  3161. ;;
  3162. tms470)
  3163. add_cppflags -I"$sysinclude"
  3164. add_ldflags --sysroot="$sysroot"
  3165. ;;
  3166. esac
  3167. fi
  3168. if test "$cpu" = host; then
  3169. enabled cross_compile &&
  3170. die "--cpu=host makes no sense when cross-compiling."
  3171. case "$cc_type" in
  3172. gcc|llvm_gcc)
  3173. check_native(){
  3174. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  3175. sed -n "/cc1.*$1=/{
  3176. s/.*$1=\\([^ ]*\\).*/\\1/
  3177. p
  3178. q
  3179. }" $TMPE
  3180. }
  3181. cpu=$(check_native -march || check_native -mcpu)
  3182. ;;
  3183. esac
  3184. test "${cpu:-host}" = host &&
  3185. die "--cpu=host not supported with compiler $cc"
  3186. fi
  3187. # Deal with common $arch aliases
  3188. case "$arch" in
  3189. aarch64|arm64)
  3190. arch="aarch64"
  3191. ;;
  3192. arm*|iPad*|iPhone*)
  3193. arch="arm"
  3194. ;;
  3195. mips*|IP*)
  3196. arch="mips"
  3197. ;;
  3198. parisc*|hppa*)
  3199. arch="parisc"
  3200. ;;
  3201. "Power Macintosh"|ppc*|powerpc*)
  3202. arch="ppc"
  3203. ;;
  3204. s390|s390x)
  3205. arch="s390"
  3206. ;;
  3207. sh4|sh)
  3208. arch="sh4"
  3209. ;;
  3210. sun4u|sparc*)
  3211. arch="sparc"
  3212. ;;
  3213. tilegx|tile-gx)
  3214. arch="tilegx"
  3215. ;;
  3216. i[3-6]86|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  3217. arch="x86"
  3218. ;;
  3219. esac
  3220. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  3221. enable $arch
  3222. # Add processor-specific flags
  3223. if enabled aarch64; then
  3224. case $cpu in
  3225. armv*)
  3226. cpuflags="-march=$cpu"
  3227. ;;
  3228. *)
  3229. cpuflags="-mcpu=$cpu"
  3230. ;;
  3231. esac
  3232. elif enabled alpha; then
  3233. cpuflags="-mcpu=$cpu"
  3234. elif enabled arm; then
  3235. check_arm_arch() {
  3236. check_cpp_condition stddef.h \
  3237. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  3238. $cpuflags
  3239. }
  3240. probe_arm_arch() {
  3241. if check_arm_arch 4; then echo armv4;
  3242. elif check_arm_arch 4T; then echo armv4t;
  3243. elif check_arm_arch 5; then echo armv5;
  3244. elif check_arm_arch 5E; then echo armv5e;
  3245. elif check_arm_arch 5T; then echo armv5t;
  3246. elif check_arm_arch 5TE; then echo armv5te;
  3247. elif check_arm_arch 5TEJ; then echo armv5te;
  3248. elif check_arm_arch 6; then echo armv6;
  3249. elif check_arm_arch 6J; then echo armv6j;
  3250. elif check_arm_arch 6K; then echo armv6k;
  3251. elif check_arm_arch 6Z; then echo armv6z;
  3252. elif check_arm_arch 6ZK; then echo armv6zk;
  3253. elif check_arm_arch 6T2; then echo armv6t2;
  3254. elif check_arm_arch 7; then echo armv7;
  3255. elif check_arm_arch 7A 7_A; then echo armv7-a;
  3256. elif check_arm_arch 7R 7_R; then echo armv7-r;
  3257. elif check_arm_arch 7M 7_M; then echo armv7-m;
  3258. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  3259. elif check_arm_arch 8A 8_A; then echo armv8-a;
  3260. fi
  3261. }
  3262. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  3263. case $cpu in
  3264. armv*)
  3265. cpuflags="-march=$cpu"
  3266. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  3267. ;;
  3268. *)
  3269. cpuflags="-mcpu=$cpu"
  3270. case $cpu in
  3271. cortex-a*) subarch=armv7a ;;
  3272. cortex-r*) subarch=armv7r ;;
  3273. cortex-m*) enable thumb; subarch=armv7m ;;
  3274. arm11*) subarch=armv6 ;;
  3275. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  3276. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  3277. *) subarch=$(probe_arm_arch) ;;
  3278. esac
  3279. ;;
  3280. esac
  3281. case "$subarch" in
  3282. armv5t*) enable fast_clz ;;
  3283. armv[6-8]*) enable fast_clz fast_unaligned ;;
  3284. esac
  3285. elif enabled avr32; then
  3286. case $cpu in
  3287. ap7[02]0[0-2])
  3288. subarch="avr32_ap"
  3289. cpuflags="-mpart=$cpu"
  3290. ;;
  3291. ap)
  3292. subarch="avr32_ap"
  3293. cpuflags="-march=$cpu"
  3294. ;;
  3295. uc3[ab]*)
  3296. subarch="avr32_uc"
  3297. cpuflags="-mcpu=$cpu"
  3298. ;;
  3299. uc)
  3300. subarch="avr32_uc"
  3301. cpuflags="-march=$cpu"
  3302. ;;
  3303. esac
  3304. elif enabled bfin; then
  3305. cpuflags="-mcpu=$cpu"
  3306. elif enabled mips; then
  3307. cpuflags="-march=$cpu"
  3308. case $cpu in
  3309. 24kc)
  3310. disable mipsfpu
  3311. disable mipsdspr1
  3312. disable mipsdspr2
  3313. ;;
  3314. 24kf*)
  3315. disable mipsdspr1
  3316. disable mipsdspr2
  3317. ;;
  3318. 24kec|34kc|1004kc)
  3319. disable mipsfpu
  3320. disable mipsdspr2
  3321. ;;
  3322. 24kef*|34kf*|1004kf*)
  3323. disable mipsdspr2
  3324. ;;
  3325. 74kc)
  3326. disable mipsfpu
  3327. ;;
  3328. esac
  3329. elif enabled ppc; then
  3330. disable ldbrx
  3331. case $(tolower $cpu) in
  3332. 601|ppc601|powerpc601)
  3333. cpuflags="-mcpu=601"
  3334. disable altivec
  3335. ;;
  3336. 603*|ppc603*|powerpc603*)
  3337. cpuflags="-mcpu=603"
  3338. disable altivec
  3339. ;;
  3340. 604*|ppc604*|powerpc604*)
  3341. cpuflags="-mcpu=604"
  3342. disable altivec
  3343. ;;
  3344. g3|75*|ppc75*|powerpc75*)
  3345. cpuflags="-mcpu=750"
  3346. disable altivec
  3347. ;;
  3348. g4|745*|ppc745*|powerpc745*)
  3349. cpuflags="-mcpu=7450"
  3350. ;;
  3351. 74*|ppc74*|powerpc74*)
  3352. cpuflags="-mcpu=7400"
  3353. ;;
  3354. g5|970|ppc970|powerpc970)
  3355. cpuflags="-mcpu=970"
  3356. ;;
  3357. power[3-7]*)
  3358. cpuflags="-mcpu=$cpu"
  3359. ;;
  3360. cell)
  3361. cpuflags="-mcpu=cell"
  3362. enable ldbrx
  3363. ;;
  3364. e500mc)
  3365. cpuflags="-mcpu=e500mc"
  3366. disable altivec
  3367. ;;
  3368. e500v2)
  3369. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  3370. disable altivec
  3371. disable dcbzl
  3372. ;;
  3373. e500)
  3374. cpuflags="-mcpu=8540 -mhard-float"
  3375. disable altivec
  3376. disable dcbzl
  3377. ;;
  3378. esac
  3379. elif enabled sparc; then
  3380. case $cpu in
  3381. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  3382. cpuflags="-mcpu=$cpu"
  3383. ;;
  3384. ultrasparc*|niagara[234])
  3385. cpuflags="-mcpu=$cpu"
  3386. ;;
  3387. esac
  3388. elif enabled x86; then
  3389. case $cpu in
  3390. i[345]86|pentium)
  3391. cpuflags="-march=$cpu"
  3392. disable mmx
  3393. ;;
  3394. # targets that do NOT support nopl and conditional mov (cmov)
  3395. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  3396. cpuflags="-march=$cpu"
  3397. disable i686
  3398. ;;
  3399. # targets that do support nopl and conditional mov (cmov)
  3400. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|corei7*|amdfam10|barcelona|atom|bdver*)
  3401. cpuflags="-march=$cpu"
  3402. enable i686
  3403. enable fast_cmov
  3404. ;;
  3405. # targets that do support conditional mov but on which it's slow
  3406. pentium4|pentium4m|prescott|nocona)
  3407. cpuflags="-march=$cpu"
  3408. enable i686
  3409. disable fast_cmov
  3410. ;;
  3411. esac
  3412. fi
  3413. if [ "$cpu" != generic ]; then
  3414. add_cflags $cpuflags
  3415. add_asflags $cpuflags
  3416. fi
  3417. # compiler sanity check
  3418. check_exec <<EOF
  3419. int main(void){ return 0; }
  3420. EOF
  3421. if test "$?" != 0; then
  3422. echo "$cc is unable to create an executable file."
  3423. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  3424. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  3425. echo "Only do this if you know what cross compiling means."
  3426. fi
  3427. die "C compiler test failed."
  3428. fi
  3429. add_cppflags -D_ISOC99_SOURCE
  3430. add_cxxflags -D__STDC_CONSTANT_MACROS
  3431. check_cflags -std=c99
  3432. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  3433. #include <stdlib.h>
  3434. EOF
  3435. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  3436. #include <stdlib.h>
  3437. EOF
  3438. add_host_cppflags -D_ISOC99_SOURCE
  3439. check_host_cflags -std=c99
  3440. check_host_cflags -Wall
  3441. check_host_cflags -O3
  3442. check_64bit(){
  3443. arch32=$1
  3444. arch64=$2
  3445. expr=$3
  3446. check_code cc "" "int test[2*($expr) - 1]" &&
  3447. subarch=$arch64 || subarch=$arch32
  3448. }
  3449. case "$arch" in
  3450. aarch64|alpha|ia64)
  3451. spic=$shared
  3452. ;;
  3453. mips)
  3454. check_64bit mips mips64 '_MIPS_SIM > 1'
  3455. spic=$shared
  3456. ;;
  3457. parisc)
  3458. check_64bit parisc parisc64 'sizeof(void *) > 4'
  3459. spic=$shared
  3460. ;;
  3461. ppc)
  3462. check_64bit ppc ppc64 'sizeof(void *) > 4'
  3463. spic=$shared
  3464. ;;
  3465. s390)
  3466. check_64bit s390 s390x 'sizeof(void *) > 4'
  3467. spic=$shared
  3468. ;;
  3469. sparc)
  3470. check_64bit sparc sparc64 'sizeof(void *) > 4'
  3471. spic=$shared
  3472. ;;
  3473. x86)
  3474. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  3475. if test "$subarch" = "x86_64"; then
  3476. spic=$shared
  3477. fi
  3478. ;;
  3479. ppc)
  3480. check_cc <<EOF && subarch="ppc64"
  3481. int test[(int)sizeof(char*) - 7];
  3482. EOF
  3483. ;;
  3484. esac
  3485. enable $subarch
  3486. enabled spic && enable_weak pic
  3487. # OS specific
  3488. case $target_os in
  3489. aix)
  3490. SHFLAGS=-shared
  3491. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  3492. enabled shared && add_ldflags -Wl,-brtl
  3493. ;;
  3494. haiku)
  3495. prefix_default="/boot/common"
  3496. network_extralibs="-lnetwork"
  3497. host_libs=
  3498. ;;
  3499. sunos)
  3500. SHFLAGS='-shared -Wl,-h,$$(@F)'
  3501. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  3502. network_extralibs="-lsocket -lnsl"
  3503. # When using suncc to build, the Solaris linker will mark
  3504. # an executable with each instruction set encountered by
  3505. # the Solaris assembler. As our libraries contain their own
  3506. # guards for processor-specific code, instead suppress
  3507. # generation of the HWCAPS ELF section on Solaris x86 only.
  3508. enabled_all suncc x86 &&
  3509. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  3510. add_ldflags -Wl,-M,mapfile
  3511. nm_default='nm -P -g'
  3512. ;;
  3513. netbsd)
  3514. disable symver
  3515. oss_indev_extralibs="-lossaudio"
  3516. oss_outdev_extralibs="-lossaudio"
  3517. enabled gcc || check_ldflags -Wl,-zmuldefs
  3518. ;;
  3519. openbsd|bitrig)
  3520. disable symver
  3521. SHFLAGS='-shared'
  3522. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  3523. SLIB_INSTALL_LINKS=
  3524. oss_indev_extralibs="-lossaudio"
  3525. oss_outdev_extralibs="-lossaudio"
  3526. ;;
  3527. dragonfly)
  3528. disable symver
  3529. ;;
  3530. freebsd)
  3531. ;;
  3532. bsd/os)
  3533. add_extralibs -lpoll -lgnugetopt
  3534. strip="strip -d"
  3535. ;;
  3536. darwin)
  3537. test "${as#*gas-preprocessor.pl}" != "$as" || gas="${gas:=gas-preprocessor.pl} ${as:=$cc}"
  3538. enabled ppc && add_asflags -force_cpusubtype_ALL
  3539. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  3540. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  3541. strip="${strip} -x"
  3542. add_ldflags -Wl,-dynamic,-search_paths_first
  3543. SLIBSUF=".dylib"
  3544. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  3545. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  3546. objformat="macho"
  3547. enabled x86_64 && objformat="macho64"
  3548. enabled_any pic shared ||
  3549. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  3550. ;;
  3551. mingw32*)
  3552. if test $target_os = "mingw32ce"; then
  3553. disable network
  3554. else
  3555. target_os=mingw32
  3556. fi
  3557. LIBTARGET=i386
  3558. if enabled x86_64; then
  3559. LIBTARGET="i386:x86-64"
  3560. elif enabled arm; then
  3561. LIBTARGET=arm-wince
  3562. fi
  3563. enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
  3564. check_ldflags -Wl,--nxcompat
  3565. check_ldflags -Wl,--dynamicbase
  3566. shlibdir_default="$bindir_default"
  3567. SLIBPREF=""
  3568. SLIBSUF=".dll"
  3569. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3570. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3571. dlltool="${cross_prefix}dlltool"
  3572. if check_cmd lib.exe -list; then
  3573. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3574. if enabled x86_64; then
  3575. LIBTARGET=x64
  3576. fi
  3577. elif check_cmd $dlltool --version; then
  3578. 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)'
  3579. fi
  3580. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3581. SLIB_INSTALL_LINKS=
  3582. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3583. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3584. SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  3585. objformat="win32"
  3586. ranlib=:
  3587. enable dos_paths
  3588. ;;
  3589. win32|win64)
  3590. disable symver
  3591. if enabled shared; then
  3592. # Link to the import library instead of the normal static library
  3593. # for shared libs.
  3594. LD_LIB='%.lib'
  3595. # Cannot build both shared and static libs with MSVC or icl.
  3596. disable static
  3597. fi
  3598. shlibdir_default="$bindir_default"
  3599. SLIBPREF=""
  3600. SLIBSUF=".dll"
  3601. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3602. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3603. SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3604. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3605. SLIB_INSTALL_LINKS=
  3606. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3607. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3608. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3609. objformat="win32"
  3610. ranlib=:
  3611. enable dos_paths
  3612. ;;
  3613. cygwin*)
  3614. target_os=cygwin
  3615. shlibdir_default="$bindir_default"
  3616. SLIBPREF="cyg"
  3617. SLIBSUF=".dll"
  3618. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3619. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3620. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3621. SLIB_INSTALL_LINKS=
  3622. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  3623. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  3624. objformat="win32"
  3625. enable dos_paths
  3626. enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
  3627. ;;
  3628. *-dos|freedos|opendos)
  3629. network_extralibs="-lsocket"
  3630. objformat="coff"
  3631. enable dos_paths
  3632. add_cppflags -U__STRICT_ANSI__
  3633. ;;
  3634. linux)
  3635. enable dv1394
  3636. ;;
  3637. irix*)
  3638. target_os=irix
  3639. ranlib="echo ignoring ranlib"
  3640. ;;
  3641. os/2*)
  3642. strip="lxlite -CS"
  3643. ln_s="cp -f"
  3644. objformat="aout"
  3645. add_cppflags -D_GNU_SOURCE
  3646. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  3647. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  3648. LIBSUF="_s.a"
  3649. SLIBPREF=""
  3650. SLIBSUF=".dll"
  3651. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3652. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  3653. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  3654. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  3655. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  3656. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  3657. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  3658. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  3659. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  3660. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  3661. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  3662. enable dos_paths
  3663. enable_weak os2threads
  3664. ;;
  3665. gnu/kfreebsd)
  3666. add_cppflags -D_BSD_SOURCE
  3667. ;;
  3668. gnu)
  3669. ;;
  3670. qnx)
  3671. add_cppflags -D_QNX_SOURCE
  3672. network_extralibs="-lsocket"
  3673. ;;
  3674. symbian)
  3675. SLIBSUF=".dll"
  3676. enable dos_paths
  3677. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  3678. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  3679. add_ldflags -Wl,--target1-abs,--no-undefined \
  3680. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  3681. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  3682. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  3683. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  3684. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  3685. ;;
  3686. osf1)
  3687. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  3688. ;;
  3689. minix)
  3690. ;;
  3691. plan9)
  3692. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  3693. -D_REENTRANT_SOURCE \
  3694. -D_RESEARCH_SOURCE \
  3695. -DFD_SETSIZE=96 \
  3696. -DHAVE_SOCK_OPTS
  3697. add_compat strtod.o strtod=avpriv_strtod
  3698. network_extralibs='-lbsd'
  3699. exeobjs=compat/plan9/main.o
  3700. disable ffserver
  3701. cp_f='cp'
  3702. ;;
  3703. none)
  3704. ;;
  3705. *)
  3706. die "Unknown OS '$target_os'."
  3707. ;;
  3708. esac
  3709. # determine libc flavour
  3710. probe_libc(){
  3711. pfx=$1
  3712. pfx_no_=${pfx%_}
  3713. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  3714. if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
  3715. eval ${pfx}libc_type=uclibc
  3716. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3717. elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then
  3718. eval ${pfx}libc_type=glibc
  3719. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3720. # MinGW headers can be installed on Cygwin, so check for newlib first.
  3721. elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  3722. eval ${pfx}libc_type=newlib
  3723. add_${pfx}cppflags -U__STRICT_ANSI__
  3724. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  3725. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  3726. eval ${pfx}libc_type=mingw64
  3727. if check_${pfx}cpp_condition _mingw.h "__MINGW64_VERSION_MAJOR < 3"; then
  3728. add_compat msvcrt/snprintf.o
  3729. add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
  3730. fi
  3731. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3732. eval test \$${pfx_no_}cc_type = "gcc" &&
  3733. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3734. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  3735. check_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  3736. eval ${pfx}libc_type=mingw32
  3737. check_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  3738. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  3739. die "ERROR: MinGW32 runtime version must be >= 3.15."
  3740. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3741. eval test \$${pfx_no_}cc_type = "gcc" &&
  3742. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3743. elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  3744. eval ${pfx}libc_type=msvcrt
  3745. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  3746. # 0x601 by default unless something else is set by the user.
  3747. # This can easily lead to us detecting functions only present
  3748. # in such new versions and producing binaries requiring windows 7.0.
  3749. # Therefore explicitly set the default to XP unless the user has
  3750. # set something else on the command line.
  3751. check_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  3752. add_${pfx}cppflags -D_WIN32_WINNT=0x0502
  3753. elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  3754. eval ${pfx}libc_type=klibc
  3755. elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  3756. eval ${pfx}libc_type=bionic
  3757. elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  3758. eval ${pfx}libc_type=solaris
  3759. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  3760. fi
  3761. }
  3762. probe_libc
  3763. test -n "$libc_type" && enable libc_$libc_type
  3764. probe_libc host_
  3765. test -n "$host_libc_type" && enable host_libc_$host_libc_type
  3766. case $libc_type in
  3767. bionic)
  3768. add_compat strtod.o strtod=avpriv_strtod
  3769. ;;
  3770. msvcrt)
  3771. add_compat strtod.o strtod=avpriv_strtod
  3772. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  3773. _snprintf=avpriv_snprintf \
  3774. vsnprintf=avpriv_vsnprintf
  3775. ;;
  3776. esac
  3777. # hacks for compiler/libc/os combinations
  3778. if enabled_all tms470 libc_glibc; then
  3779. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  3780. add_cppflags -D__USER_LABEL_PREFIX__=
  3781. add_cppflags -D__builtin_memset=memset
  3782. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  3783. add_cflags -pds=48 # incompatible redefinition of macro
  3784. fi
  3785. if enabled_all ccc libc_glibc; then
  3786. add_ldflags -Wl,-z,now # calls to libots crash without this
  3787. fi
  3788. check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
  3789. add_cppflags '-I\$(SRC_PATH)/compat/float'
  3790. esc(){
  3791. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  3792. }
  3793. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate
  3794. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  3795. set_default $PATHS_LIST
  3796. set_default nm
  3797. # we need to build at least one lib type
  3798. if ! enabled_any static shared; then
  3799. cat <<EOF
  3800. At least one library type must be built.
  3801. Specify --enable-static to build the static libraries or --enable-shared to
  3802. build the shared libraries as well. To only build the shared libraries specify
  3803. --disable-static in addition to --enable-shared.
  3804. EOF
  3805. exit 1;
  3806. fi
  3807. die_license_disabled() {
  3808. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  3809. }
  3810. die_license_disabled_gpl() {
  3811. enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; }
  3812. }
  3813. die_license_disabled gpl frei0r
  3814. die_license_disabled gpl libcdio
  3815. die_license_disabled gpl libutvideo
  3816. die_license_disabled gpl libvidstab
  3817. die_license_disabled gpl libx264
  3818. die_license_disabled gpl libx265
  3819. die_license_disabled gpl libxavs
  3820. die_license_disabled gpl libxvid
  3821. die_license_disabled gpl libzvbi
  3822. die_license_disabled gpl x11grab
  3823. die_license_disabled nonfree libaacplus
  3824. die_license_disabled nonfree libfaac
  3825. enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
  3826. enabled gpl && die_license_disabled_gpl nonfree openssl
  3827. die_license_disabled version3 libopencore_amrnb
  3828. die_license_disabled version3 libopencore_amrwb
  3829. die_license_disabled version3 libvo_aacenc
  3830. die_license_disabled version3 libvo_amrwbenc
  3831. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3832. disabled optimizations || check_cflags -fomit-frame-pointer
  3833. enable_weak_pic() {
  3834. disabled pic && return
  3835. enable pic
  3836. add_cppflags -DPIC
  3837. case "$target_os" in
  3838. mingw*|cygwin*)
  3839. ;;
  3840. *)
  3841. add_cflags -fPIC
  3842. ;;
  3843. esac
  3844. add_asflags -fPIC
  3845. }
  3846. enabled pic && enable_weak_pic
  3847. check_cc <<EOF || die "Symbol mangling check failed."
  3848. int ff_extern;
  3849. EOF
  3850. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3851. extern_prefix=${sym%%ff_extern*}
  3852. check_cc <<EOF && enable_weak inline_asm
  3853. void foo(void) { __asm__ volatile ("" ::); }
  3854. EOF
  3855. _restrict=
  3856. for restrict_keyword in restrict __restrict__ __restrict; do
  3857. check_cc <<EOF && _restrict=$restrict_keyword && break
  3858. void foo(char * $restrict_keyword p);
  3859. EOF
  3860. done
  3861. check_cc <<EOF && enable pragma_deprecated
  3862. void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
  3863. EOF
  3864. check_cc <<EOF && enable attribute_packed
  3865. struct { int x; } __attribute__((packed)) x;
  3866. EOF
  3867. check_cc <<EOF && enable attribute_may_alias
  3868. union { int x; } __attribute__((may_alias)) x;
  3869. EOF
  3870. check_cc <<EOF || die "endian test failed"
  3871. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3872. EOF
  3873. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3874. check_inline_asm inline_asm_labels '"1:\n"'
  3875. check_inline_asm inline_asm_nonlocal_labels '"Label:\n"'
  3876. if enabled aarch64; then
  3877. enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
  3878. # internal assembler in clang 3.3 does not support this instruction
  3879. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  3880. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  3881. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  3882. elif enabled alpha; then
  3883. check_cflags -mieee
  3884. elif enabled arm; then
  3885. check_cpp_condition stddef.h "defined __thumb__" && check_cc <<EOF && enable_weak thumb
  3886. float func(float a, float b){ return a+b; }
  3887. EOF
  3888. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3889. nogas=die
  3890. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  3891. enable vfp_args
  3892. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  3893. case "${cross_prefix:-$cc}" in
  3894. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3895. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  3896. __asm__ (".eabi_attribute 28, 1");
  3897. int main(void) { return 0; }
  3898. EOF
  3899. esac
  3900. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3901. fi
  3902. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3903. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3904. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3905. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3906. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3907. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3908. [ $target_os = linux ] ||
  3909. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3910. $ARCH_EXT_LIST_ARM
  3911. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3912. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  3913. elif enabled mips; then
  3914. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3915. enabled mips32r2 && add_cflags "-mips32r2" && add_asflags "-mips32r2" &&
  3916. check_inline_asm mips32r2 '"rotr $t0, $t1, 1"'
  3917. enabled mipsdspr1 && add_cflags "-mdsp" && add_asflags "-mdsp" &&
  3918. check_inline_asm mipsdspr1 '"addu.qb $t0, $t1, $t2"'
  3919. enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
  3920. check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
  3921. enabled mipsfpu && add_cflags "-mhard-float" && add_asflags "-mhard-float" &&
  3922. check_inline_asm mipsfpu '"madd.d $f0, $f2, $f4, $f6"'
  3923. elif enabled parisc; then
  3924. if enabled gcc; then
  3925. case $($cc -dumpversion) in
  3926. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3927. esac
  3928. fi
  3929. elif enabled ppc; then
  3930. enable local_aligned_8 local_aligned_16
  3931. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3932. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3933. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3934. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3935. # AltiVec flags: The FSF version of GCC differs from the Apple version
  3936. if enabled altivec; then
  3937. if ! enabled_any pic ppc64; then
  3938. nogas=warn
  3939. fi
  3940. check_cflags -maltivec -mabi=altivec &&
  3941. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  3942. check_cflags -faltivec
  3943. # check if our compiler supports Motorola AltiVec C API
  3944. check_cc <<EOF || disable altivec
  3945. $inc_altivec_h
  3946. int main(void) {
  3947. vector signed int v1 = (vector signed int) { 0 };
  3948. vector signed int v2 = (vector signed int) { 1 };
  3949. v1 = vec_add(v1, v2);
  3950. return 0;
  3951. }
  3952. EOF
  3953. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3954. fi
  3955. elif enabled x86; then
  3956. check_builtin rdtsc intrin.h "__rdtsc()"
  3957. check_builtin mm_empty mmintrin.h "_mm_empty()"
  3958. enable local_aligned_8 local_aligned_16
  3959. # check whether EBP is available on x86
  3960. # As 'i' is stored on the stack, this program will crash
  3961. # if the base pointer is used to access it because the
  3962. # base pointer is cleared in the inline assembly code.
  3963. check_exec_crash <<EOF && enable ebp_available
  3964. volatile int i=0;
  3965. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3966. return i;
  3967. EOF
  3968. # check whether EBX is available on x86
  3969. check_inline_asm ebx_available '""::"b"(0)' &&
  3970. check_inline_asm ebx_available '"":::"%ebx"'
  3971. # check whether xmm clobbers are supported
  3972. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3973. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test, %eax"' ||
  3974. check_inline_asm inline_asm_direct_symbol_refs '"movl '$extern_prefix'test(%rip), %eax"'
  3975. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3976. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3977. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3978. if ! disabled_any asm mmx yasm; then
  3979. if check_cmd $yasmexe --version; then
  3980. enabled x86_64 && yasm_extra="-m amd64"
  3981. yasm_debug="-g dwarf2"
  3982. elif check_cmd nasm -v; then
  3983. yasmexe=nasm
  3984. yasm_debug="-g -F dwarf"
  3985. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  3986. fi
  3987. YASMFLAGS="-f $objformat $yasm_extra"
  3988. enabled pic && append YASMFLAGS "-DPIC"
  3989. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  3990. case "$objformat" in
  3991. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  3992. esac
  3993. check_yasm "movbe ecx, [5]" && enable yasm ||
  3994. die "yasm/nasm not found or too old. Use --disable-yasm for a crippled build."
  3995. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx_external avresample
  3996. check_yasm "vextracti128 xmm0, ymm0, 0" || disable avx2_external
  3997. check_yasm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
  3998. check_yasm "vfmadd132ps ymm0, ymm1, ymm2" || disable fma3_external
  3999. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  4000. check_yasm "CPU amdnop" || disable cpunop
  4001. fi
  4002. case "$cpu" in
  4003. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  4004. disable fast_clz
  4005. ;;
  4006. esac
  4007. fi
  4008. if enabled asm; then
  4009. as=${gas:=$as}
  4010. check_as <<EOF && enable gnu_as || \
  4011. $nogas "GNU assembler not found, install gas-preprocessor"
  4012. .macro m n
  4013. \n: .int 0
  4014. .endm
  4015. m x
  4016. EOF
  4017. fi
  4018. check_ldflags -Wl,--as-needed
  4019. if check_func dlopen; then
  4020. ldl=
  4021. elif check_func dlopen -ldl; then
  4022. ldl=-ldl
  4023. fi
  4024. if ! disabled network; then
  4025. check_func getaddrinfo $network_extralibs
  4026. check_func getservbyport $network_extralibs
  4027. check_func inet_aton $network_extralibs
  4028. check_type netdb.h "struct addrinfo"
  4029. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  4030. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  4031. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  4032. check_type poll.h "struct pollfd"
  4033. check_type netinet/sctp.h "struct sctp_event_subscribe"
  4034. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  4035. check_type netinet/in.h "struct sockaddr_in6"
  4036. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  4037. check_type "sys/types.h sys/socket.h" socklen_t
  4038. # Prefer arpa/inet.h over winsock2
  4039. if check_header arpa/inet.h ; then
  4040. check_func closesocket
  4041. elif check_header winsock2.h ; then
  4042. check_func_headers winsock2.h closesocket -lws2 &&
  4043. network_extralibs="-lws2" ||
  4044. { check_func_headers winsock2.h closesocket -lws2_32 &&
  4045. network_extralibs="-lws2_32"; } || disable winsock2_h network
  4046. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  4047. check_type ws2tcpip.h socklen_t
  4048. check_type ws2tcpip.h "struct addrinfo"
  4049. check_type ws2tcpip.h "struct group_source_req"
  4050. check_type ws2tcpip.h "struct ip_mreq_source"
  4051. check_type ws2tcpip.h "struct ipv6_mreq"
  4052. check_type winsock2.h "struct pollfd"
  4053. check_struct winsock2.h "struct sockaddr" sa_len
  4054. check_type ws2tcpip.h "struct sockaddr_in6"
  4055. check_type ws2tcpip.h "struct sockaddr_storage"
  4056. else
  4057. disable network
  4058. fi
  4059. fi
  4060. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  4061. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  4062. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  4063. check_builtin sarestart signal.h "SA_RESTART"
  4064. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  4065. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  4066. check_func ${malloc_prefix}memalign && enable memalign
  4067. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  4068. check_func access
  4069. check_func clock_gettime || { check_func clock_gettime -lrt && add_extralibs -lrt; }
  4070. check_func fcntl
  4071. check_func fork
  4072. check_func gethrtime
  4073. check_func getopt
  4074. check_func getrusage
  4075. check_func gettimeofday
  4076. check_func isatty
  4077. check_func localtime_r
  4078. check_func mach_absolute_time
  4079. check_func mkstemp
  4080. check_func mmap
  4081. check_func mprotect
  4082. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  4083. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  4084. check_func sched_getaffinity
  4085. check_func setrlimit
  4086. check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
  4087. check_func strerror_r
  4088. check_func sysconf
  4089. check_func sysctl
  4090. check_func usleep
  4091. check_func_headers conio.h kbhit
  4092. check_func_headers io.h setmode
  4093. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  4094. check_func_headers stdlib.h getenv
  4095. check_func_headers windows.h GetProcessAffinityMask
  4096. check_func_headers windows.h GetProcessTimes
  4097. check_func_headers windows.h GetSystemTimeAsFileTime
  4098. check_func_headers windows.h MapViewOfFile
  4099. check_func_headers windows.h PeekNamedPipe
  4100. check_func_headers windows.h SetConsoleTextAttribute
  4101. check_func_headers windows.h Sleep
  4102. check_func_headers windows.h VirtualAlloc
  4103. check_func_headers glob.h glob
  4104. enabled xlib &&
  4105. check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
  4106. check_header cl/cl.h
  4107. check_header direct.h
  4108. check_header dlfcn.h
  4109. check_header dxva.h
  4110. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  4111. check_header io.h
  4112. check_header libcrystalhd/libcrystalhd_if.h
  4113. check_header mach/mach_time.h
  4114. check_header malloc.h
  4115. check_header poll.h
  4116. check_header sys/mman.h
  4117. check_header sys/param.h
  4118. check_header sys/resource.h
  4119. check_header sys/select.h
  4120. check_header sys/time.h
  4121. check_header sys/un.h
  4122. check_header termios.h
  4123. check_header unistd.h
  4124. check_header vdpau/vdpau.h
  4125. check_header vdpau/vdpau_x11.h
  4126. check_header VideoDecodeAcceleration/VDADecoder.h
  4127. check_header windows.h
  4128. check_header X11/extensions/XvMClib.h
  4129. check_header asm/types.h
  4130. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  4131. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  4132. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  4133. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  4134. if ! disabled w32threads && ! enabled pthreads; then
  4135. check_func_headers "windows.h process.h" _beginthreadex &&
  4136. enable w32threads || disable w32threads
  4137. fi
  4138. # check for some common methods of building with pthread support
  4139. # do this before the optional library checks as some of them require pthreads
  4140. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  4141. enable pthreads
  4142. if check_func pthread_join -pthread && check_func pthread_create -pthread; then
  4143. add_cflags -pthread
  4144. add_extralibs -pthread
  4145. elif check_func pthread_join -pthreads && check_func pthread_create -pthreads; then
  4146. add_cflags -pthreads
  4147. add_extralibs -pthreads
  4148. elif check_func pthread_join -lpthreadGC2 && check_func pthread_create -lpthreadGC2; then
  4149. add_extralibs -lpthreadGC2
  4150. elif check_lib pthread.h pthread_join -lpthread && check_lib pthread.h pthread_create -lpthread; then
  4151. :
  4152. elif ! check_func pthread_join && ! check_func pthread_create; then
  4153. disable pthreads
  4154. fi
  4155. check_code cc "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER" || disable pthreads
  4156. fi
  4157. if enabled pthreads; then
  4158. check_func pthread_cancel
  4159. fi
  4160. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  4161. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  4162. check_lib math.h sin -lm && LIBM="-lm"
  4163. disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  4164. atan2f_args=2
  4165. ldexpf_args=2
  4166. powf_args=2
  4167. for func in $MATH_FUNCS; do
  4168. eval check_mathfunc $func \${${func}_args:-1}
  4169. done
  4170. # these are off by default, so fail if requested and not available
  4171. enabled avfoundation_indev && { check_header_oc AVFoundation/AVFoundation.h || disable avfoundation_indev; }
  4172. enabled avisynth && { { check_lib2 "windows.h" LoadLibrary; } ||
  4173. { check_lib2 "dlfcn.h" dlopen -ldl; } ||
  4174. die "ERROR: LoadLibrary/dlopen not found for avisynth"; }
  4175. enabled decklink && { check_header DeckLinkAPI.h || die "ERROR: DeckLinkAPI.h header not found"; }
  4176. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  4177. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  4178. enabled ladspa && { check_header ladspa.h || die "ERROR: ladspa.h header not found"; }
  4179. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  4180. enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
  4181. enabled libass && require_pkg_config libass ass/ass.h ass_library_init
  4182. enabled libbluray && require_pkg_config libbluray libbluray/bluray.h bd_open
  4183. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  4184. { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
  4185. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  4186. enabled libcaca && require_pkg_config caca caca.h caca_create_canvas
  4187. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  4188. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  4189. 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"
  4190. enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs
  4191. enabled fontconfig && enable libfontconfig
  4192. enabled libfontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  4193. enabled libfreetype && require_libfreetype
  4194. enabled libgme && require libgme gme/gme.h gme_new_emu -lgme -lstdc++
  4195. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  4196. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  4197. done || die "ERROR: libgsm not found"; }
  4198. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  4199. enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
  4200. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  4201. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  4202. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  4203. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  4204. enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
  4205. enabled libopenjpeg && { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
  4206. check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
  4207. die "ERROR: libopenjpeg not found"; }
  4208. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  4209. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  4210. enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init
  4211. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  4212. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  4213. enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer
  4214. enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
  4215. enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init
  4216. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  4217. enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
  4218. media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
  4219. media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
  4220. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  4221. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  4222. { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  4223. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  4224. enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
  4225. enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
  4226. enabled libvidstab && require_pkg_config "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
  4227. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  4228. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  4229. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  4230. enabled libvpx && {
  4231. enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  4232. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  4233. enabled libvpx_vp8_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
  4234. die "ERROR: libvpx encoder version must be >=0.9.7"; }
  4235. enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
  4236. enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_SVC" -lvpx || disable libvpx_vp9_encoder; } }
  4237. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  4238. enabled libwebp && require_pkg_config libwebp webp/encode.h WebPGetEncoderVersion
  4239. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  4240. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  4241. die "ERROR: libx264 must be installed and version must be >= 0.118."; }
  4242. enabled libx265 && require_pkg_config x265 x265.h x265_encoder_encode &&
  4243. { check_cpp_condition x265.h "X265_BUILD >= 13" ||
  4244. die "ERROR: libx265 version must be >= 13."; }
  4245. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  4246. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  4247. enabled libzmq && require_pkg_config libzmq zmq.h zmq_ctx_new
  4248. enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi
  4249. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  4250. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  4251. die "ERROR: openal not found"; } &&
  4252. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  4253. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  4254. enabled opencl && { check_lib2 OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
  4255. check_lib2 CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
  4256. die "ERROR: opencl not found"; } &&
  4257. { ! enabled_any w32threads os2threads ||
  4258. die "opencl currently needs --enable-pthreads or --disable-w32threads"; } &&
  4259. { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
  4260. check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
  4261. die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
  4262. enabled opengl && { check_lib GL/glx.h glXGetProcAddress "-lGL" ||
  4263. check_lib2 windows.h wglGetProcAddress "-lopengl32 -lgdi32" ||
  4264. check_lib2 OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" ||
  4265. check_lib2 ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
  4266. die "ERROR: opengl not found."
  4267. }
  4268. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  4269. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  4270. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  4271. die "ERROR: openssl not found"; }
  4272. enabled qtkit_indev && { check_header_oc QTKit/QTKit.h || disable qtkit_indev; }
  4273. if enabled gnutls; then
  4274. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  4275. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  4276. fi
  4277. # libdc1394 check
  4278. if enabled libdc1394; then
  4279. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  4280. enable libdc1394_2; } ||
  4281. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  4282. enable libdc1394_1; } ||
  4283. die "ERROR: No version of libdc1394 found "
  4284. fi
  4285. SDL_CONFIG="${cross_prefix}sdl-config"
  4286. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  4287. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  4288. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  4289. enable sdl
  4290. else
  4291. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  4292. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  4293. sdl_libs=$("${SDL_CONFIG}" --libs)
  4294. check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  4295. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  4296. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  4297. enable sdl
  4298. fi
  4299. fi
  4300. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
  4301. texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  4302. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  4303. perl -v > /dev/null 2>&1 && enable perl || disable perl
  4304. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  4305. rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  4306. check_header linux/fb.h
  4307. check_header linux/videodev.h
  4308. check_header linux/videodev2.h
  4309. check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  4310. check_header sys/videoio.h
  4311. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  4312. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  4313. # w32api 3.12 had it defined wrong
  4314. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  4315. check_type "dshow.h" IBaseFilter
  4316. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  4317. { check_header dev/bktr/ioctl_meteor.h &&
  4318. check_header dev/bktr/ioctl_bt848.h; } ||
  4319. { check_header machine/ioctl_meteor.h &&
  4320. check_header machine/ioctl_bt848.h; } ||
  4321. { check_header dev/video/meteor/ioctl_meteor.h &&
  4322. check_header dev/video/bktr/ioctl_bt848.h; } ||
  4323. check_header dev/ic/bt8xx.h
  4324. check_header sndio.h
  4325. if check_struct sys/soundcard.h audio_buf_info bytes; then
  4326. enable_safe sys/soundcard.h
  4327. else
  4328. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  4329. #include <sys/soundcard.h>
  4330. audio_buf_info abc;
  4331. EOF
  4332. fi
  4333. check_header soundcard.h
  4334. enabled_any alsa_indev alsa_outdev &&
  4335. check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  4336. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait &&
  4337. check_func jack_port_get_latency_range -ljack
  4338. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  4339. if enabled libcdio; then
  4340. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4341. check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4342. die "ERROR: libcdio-paranoia not found"
  4343. fi
  4344. enabled xlib &&
  4345. check_lib X11/Xlib.h XOpenDisplay -lX11 || disable xlib
  4346. enabled x11grab &&
  4347. require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
  4348. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes &&
  4349. { enabled xlib || die "ERROR: Xlib not found"; }
  4350. check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs"
  4351. enabled vaapi &&
  4352. check_lib va/va.h vaInitialize -lva ||
  4353. disable vaapi
  4354. enabled vdpau &&
  4355. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  4356. disable vdpau
  4357. enabled vdpau && enabled xlib &&
  4358. check_func_headers "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau &&
  4359. prepend ffmpeg_libs $($ldflags_filter "-lvdpau") &&
  4360. enable vdpau_x11
  4361. # Funny iconv installations are not unusual, so check it after all flags have been set
  4362. disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv
  4363. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  4364. # add some useful compiler flags if supported
  4365. check_cflags -Wdeclaration-after-statement
  4366. check_cflags -Wall
  4367. check_cflags -Wdisabled-optimization
  4368. check_cflags -Wpointer-arith
  4369. check_cflags -Wredundant-decls
  4370. check_cflags -Wwrite-strings
  4371. check_cflags -Wtype-limits
  4372. check_cflags -Wundef
  4373. check_cflags -Wmissing-prototypes
  4374. check_cflags -Wno-pointer-to-int-cast
  4375. check_cflags -Wstrict-prototypes
  4376. check_cflags -Wempty-body
  4377. enabled extra_warnings && check_cflags -Winline
  4378. check_disable_warning(){
  4379. warning_flag=-W${1#-Wno-}
  4380. test_cflags $warning_flag && add_cflags $1
  4381. }
  4382. check_disable_warning -Wno-parentheses
  4383. check_disable_warning -Wno-switch
  4384. check_disable_warning -Wno-format-zero-length
  4385. check_disable_warning -Wno-pointer-sign
  4386. # add some linker flags
  4387. check_ldflags -Wl,--warn-common
  4388. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  4389. enabled rpath && add_ldflags -Wl,-rpath,$libdir
  4390. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  4391. # add some strip flags
  4392. # -wN '..@*' is more selective than -x, but not available everywhere.
  4393. check_stripflags -wN \'..@*\' || check_stripflags -x
  4394. enabled neon_clobber_test &&
  4395. check_ldflags -Wl,--wrap,avcodec_open2 \
  4396. -Wl,--wrap,avcodec_decode_audio4 \
  4397. -Wl,--wrap,avcodec_decode_video2 \
  4398. -Wl,--wrap,avcodec_decode_subtitle2 \
  4399. -Wl,--wrap,avcodec_encode_audio2 \
  4400. -Wl,--wrap,avcodec_encode_video2 \
  4401. -Wl,--wrap,avcodec_encode_subtitle \
  4402. -Wl,--wrap,swr_convert \
  4403. -Wl,--wrap,avresample_convert ||
  4404. disable neon_clobber_test
  4405. enabled xmm_clobber_test &&
  4406. check_ldflags -Wl,--wrap,avcodec_open2 \
  4407. -Wl,--wrap,avcodec_decode_audio4 \
  4408. -Wl,--wrap,avcodec_decode_video2 \
  4409. -Wl,--wrap,avcodec_decode_subtitle2 \
  4410. -Wl,--wrap,avcodec_encode_audio2 \
  4411. -Wl,--wrap,avcodec_encode_video \
  4412. -Wl,--wrap,avcodec_encode_video2 \
  4413. -Wl,--wrap,avcodec_encode_subtitle \
  4414. -Wl,--wrap,swr_convert \
  4415. -Wl,--wrap,avresample_convert \
  4416. -Wl,--wrap,sws_scale ||
  4417. disable xmm_clobber_test
  4418. echo "X{};" > $TMPV
  4419. if test_ldflags -Wl,--version-script,$TMPV; then
  4420. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  4421. check_cc <<EOF && enable symver_asm_label
  4422. void ff_foo(void) __asm__ ("av_foo@VERSION");
  4423. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  4424. EOF
  4425. check_cc <<EOF && enable symver_gnu_asm
  4426. __asm__(".symver ff_foo,av_foo@VERSION");
  4427. void ff_foo(void) {}
  4428. EOF
  4429. fi
  4430. if [ -z "$optflags" ]; then
  4431. if enabled small; then
  4432. optflags=$cflags_size
  4433. elif enabled optimizations; then
  4434. optflags=$cflags_speed
  4435. else
  4436. optflags=$cflags_noopt
  4437. fi
  4438. fi
  4439. check_optflags(){
  4440. check_cflags "$@"
  4441. enabled lto && check_ldflags "$@"
  4442. }
  4443. if enabled lto; then
  4444. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  4445. check_cflags -flto
  4446. check_ldflags -flto $cpuflags
  4447. fi
  4448. check_optflags $optflags
  4449. check_optflags -fno-math-errno
  4450. check_optflags -fno-signed-zeros
  4451. enabled ftrapv && check_cflags -ftrapv
  4452. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  4453. int x;
  4454. EOF
  4455. if enabled icc; then
  4456. # Just warnings, no remarks
  4457. check_cflags -w1
  4458. # -wd: Disable following warnings
  4459. # 144, 167, 556: -Wno-pointer-sign
  4460. # 188: enumerated type mixed with another type
  4461. # 1292: attribute "foo" ignored
  4462. # 1419: external declaration in primary source file
  4463. # 10006: ignoring unknown option -fno-signed-zeros
  4464. # 10148: ignoring unknown option -Wno-parentheses
  4465. # 10156: ignoring option '-W'; no argument required
  4466. check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156
  4467. # 11030: Warning unknown option --as-needed
  4468. # 10156: ignoring option '-export'; no argument required
  4469. check_ldflags -wd10156,11030
  4470. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  4471. enable ebp_available
  4472. if enabled x86_32; then
  4473. icc_version=$($cc -dumpversion)
  4474. test ${icc_version%%.*} -ge 11 &&
  4475. check_cflags -falign-stack=maintain-16-byte ||
  4476. disable aligned_stack
  4477. fi
  4478. elif enabled ccc; then
  4479. # disable some annoying warnings
  4480. add_cflags -msg_disable bitnotint
  4481. add_cflags -msg_disable mixfuncvoid
  4482. add_cflags -msg_disable nonstandcast
  4483. add_cflags -msg_disable unsupieee
  4484. elif enabled gcc; then
  4485. check_optflags -fno-tree-vectorize
  4486. check_cflags -Werror=implicit-function-declaration
  4487. check_cflags -Werror=missing-prototypes
  4488. check_cflags -Werror=return-type
  4489. check_cflags -Werror=vla
  4490. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  4491. elif enabled llvm_gcc; then
  4492. check_cflags -mllvm -stack-alignment=16
  4493. elif enabled clang; then
  4494. check_cflags -mllvm -stack-alignment=16
  4495. check_cflags -Qunused-arguments
  4496. check_cflags -Werror=implicit-function-declaration
  4497. check_cflags -Werror=missing-prototypes
  4498. check_cflags -Werror=return-type
  4499. elif enabled cparser; then
  4500. add_cflags -Wno-missing-variable-declarations
  4501. add_cflags -Wno-empty-statement
  4502. elif enabled armcc; then
  4503. add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
  4504. add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
  4505. # 2523: use of inline assembler is deprecated
  4506. add_cflags -W${armcc_opt},--diag_suppress=2523
  4507. add_cflags -W${armcc_opt},--diag_suppress=1207
  4508. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  4509. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  4510. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  4511. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  4512. elif enabled tms470; then
  4513. add_cflags -pds=824 -pds=837
  4514. disable inline_asm
  4515. elif enabled pathscale; then
  4516. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  4517. elif enabled_any msvc icl; then
  4518. enabled x86_32 && disable aligned_stack
  4519. enabled_all x86_32 debug && add_cflags -Oy-
  4520. enabled debug && add_ldflags -debug
  4521. enable pragma_deprecated
  4522. if enabled icl; then
  4523. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  4524. # (correctly) on icl 13.x.
  4525. check_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  4526. add_cflags -Qansi-alias
  4527. # icl will pass the inline asm tests but inline asm is currently
  4528. # not supported (build will fail)
  4529. disabled inline_asm || warn "inline asm disabled due to issues with it in ICL"
  4530. disable inline_asm
  4531. fi
  4532. fi
  4533. case $as_type in
  4534. clang)
  4535. add_asflags -Qunused-arguments
  4536. ;;
  4537. esac
  4538. case $ld_type in
  4539. clang)
  4540. check_ldflags -Qunused-arguments
  4541. ;;
  4542. esac
  4543. case $target_os in
  4544. osf1)
  4545. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  4546. ;;
  4547. plan9)
  4548. add_cppflags -Dmain=plan9_main
  4549. ;;
  4550. esac
  4551. enable frame_thread_encoder
  4552. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  4553. check_deps $CONFIG_LIST \
  4554. $CONFIG_EXTRA \
  4555. $HAVE_LIST \
  4556. $ALL_COMPONENTS \
  4557. 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"
  4558. if test $target_os = "haiku"; then
  4559. disable memalign
  4560. disable posix_memalign
  4561. fi
  4562. ! enabled_any memalign posix_memalign aligned_malloc &&
  4563. enabled_any $need_memalign && enable memalign_hack
  4564. # add_dep lib dep
  4565. # -> enable ${lib}_deps_${dep}
  4566. # -> add $dep to ${lib}_deps only once
  4567. add_dep() {
  4568. lib=$1
  4569. dep=$2
  4570. enabled "${lib}_deps_${dep}" && return 0
  4571. enable "${lib}_deps_${dep}"
  4572. prepend "${lib}_deps" $dep
  4573. }
  4574. # merge deps lib components
  4575. # merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
  4576. merge_deps() {
  4577. lib=$1
  4578. shift
  4579. for comp in $*; do
  4580. enabled $comp || continue
  4581. eval "dep=\"\$${comp}_deps\""
  4582. for d in $dep; do
  4583. add_dep $lib $d
  4584. done
  4585. done
  4586. }
  4587. merge_deps libavfilter $FILTER_LIST
  4588. for thread in $THREADS_LIST; do
  4589. if enabled $thread; then
  4590. test -n "$thread_type" &&
  4591. die "ERROR: Only one thread type must be selected." ||
  4592. thread_type="$thread"
  4593. fi
  4594. done
  4595. echo "install prefix $prefix"
  4596. echo "source path $source_path"
  4597. echo "C compiler $cc"
  4598. echo "C library $libc_type"
  4599. if test "$host_cc" != "$cc"; then
  4600. echo "host C compiler $host_cc"
  4601. echo "host C library $host_libc_type"
  4602. fi
  4603. echo "ARCH $arch ($cpu)"
  4604. if test "$build_suffix" != ""; then
  4605. echo "build suffix $build_suffix"
  4606. fi
  4607. if test "$progs_suffix" != ""; then
  4608. echo "progs suffix $progs_suffix"
  4609. fi
  4610. if test "$extra_version" != ""; then
  4611. echo "version string suffix $extra_version"
  4612. fi
  4613. echo "big-endian ${bigendian-no}"
  4614. echo "runtime cpu detection ${runtime_cpudetect-no}"
  4615. if enabled x86; then
  4616. echo "${yasmexe} ${yasm-no}"
  4617. echo "MMX enabled ${mmx-no}"
  4618. echo "MMXEXT enabled ${mmxext-no}"
  4619. echo "3DNow! enabled ${amd3dnow-no}"
  4620. echo "3DNow! extended enabled ${amd3dnowext-no}"
  4621. echo "SSE enabled ${sse-no}"
  4622. echo "SSSE3 enabled ${ssse3-no}"
  4623. echo "AVX enabled ${avx-no}"
  4624. echo "XOP enabled ${xop-no}"
  4625. echo "FMA3 enabled ${fma3-no}"
  4626. echo "FMA4 enabled ${fma4-no}"
  4627. echo "i686 features enabled ${i686-no}"
  4628. echo "CMOV is fast ${fast_cmov-no}"
  4629. echo "EBX available ${ebx_available-no}"
  4630. echo "EBP available ${ebp_available-no}"
  4631. fi
  4632. if enabled aarch64; then
  4633. echo "NEON enabled ${neon-no}"
  4634. echo "VFP enabled ${vfp-no}"
  4635. fi
  4636. if enabled arm; then
  4637. echo "ARMv5TE enabled ${armv5te-no}"
  4638. echo "ARMv6 enabled ${armv6-no}"
  4639. echo "ARMv6T2 enabled ${armv6t2-no}"
  4640. echo "VFP enabled ${vfp-no}"
  4641. echo "NEON enabled ${neon-no}"
  4642. echo "THUMB enabled ${thumb-no}"
  4643. fi
  4644. if enabled mips; then
  4645. echo "MIPS FPU enabled ${mipsfpu-no}"
  4646. echo "MIPS32R2 enabled ${mips32r2-no}"
  4647. echo "MIPS DSP R1 enabled ${mipsdspr1-no}"
  4648. echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
  4649. fi
  4650. if enabled ppc; then
  4651. echo "AltiVec enabled ${altivec-no}"
  4652. echo "PPC 4xx optimizations ${ppc4xx-no}"
  4653. echo "dcbzl available ${dcbzl-no}"
  4654. fi
  4655. echo "debug symbols ${debug-no}"
  4656. echo "strip symbols ${stripping-no}"
  4657. echo "optimize for size ${small-no}"
  4658. echo "optimizations ${optimizations-no}"
  4659. echo "static ${static-no}"
  4660. echo "shared ${shared-no}"
  4661. echo "postprocessing support ${postproc-no}"
  4662. echo "new filter support ${avfilter-no}"
  4663. echo "network support ${network-no}"
  4664. echo "threading support ${thread_type-no}"
  4665. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  4666. echo "SDL support ${sdl-no}"
  4667. echo "opencl enabled ${opencl-no}"
  4668. echo "libzvbi enabled ${libzvbi-no}"
  4669. echo "texi2html enabled ${texi2html-no}"
  4670. echo "perl enabled ${perl-no}"
  4671. echo "pod2man enabled ${pod2man-no}"
  4672. echo "makeinfo enabled ${makeinfo-no}"
  4673. test -n "$random_seed" &&
  4674. echo "random seed ${random_seed}"
  4675. echo
  4676. echo "External libraries:"
  4677. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  4678. echo
  4679. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  4680. echo "Enabled ${type}s:"
  4681. eval list=\$$(toupper $type)_LIST
  4682. print_enabled '_*' $list | print_3_columns
  4683. echo
  4684. done
  4685. license="LGPL version 2.1 or later"
  4686. if enabled nonfree; then
  4687. license="nonfree and unredistributable"
  4688. elif enabled gplv3; then
  4689. license="GPL version 3 or later"
  4690. elif enabled lgplv3; then
  4691. license="LGPL version 3 or later"
  4692. elif enabled gpl; then
  4693. license="GPL version 2 or later"
  4694. fi
  4695. echo "License: $license"
  4696. echo "Creating config.mak, config.h, and doc/config.texi..."
  4697. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  4698. enabled stripping || strip="echo skipping strip"
  4699. config_files="$TMPH config.mak doc/config.texi"
  4700. cat > config.mak <<EOF
  4701. # Automatically generated by configure - do not modify!
  4702. ifndef FFMPEG_CONFIG_MAK
  4703. FFMPEG_CONFIG_MAK=1
  4704. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  4705. prefix=$prefix
  4706. LIBDIR=\$(DESTDIR)$libdir
  4707. SHLIBDIR=\$(DESTDIR)$shlibdir
  4708. INCDIR=\$(DESTDIR)$incdir
  4709. BINDIR=\$(DESTDIR)$bindir
  4710. DATADIR=\$(DESTDIR)$datadir
  4711. DOCDIR=\$(DESTDIR)$docdir
  4712. MANDIR=\$(DESTDIR)$mandir
  4713. SRC_PATH=$source_path
  4714. ifndef MAIN_MAKEFILE
  4715. SRC_PATH:=\$(SRC_PATH:.%=..%)
  4716. endif
  4717. CC_IDENT=$cc_ident
  4718. ARCH=$arch
  4719. CC=$cc
  4720. CXX=$cxx
  4721. AS=$as
  4722. LD=$ld
  4723. DEPCC=$dep_cc
  4724. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  4725. DEPAS=$as
  4726. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  4727. YASM=$yasmexe
  4728. DEPYASM=$yasmexe
  4729. AR=$ar
  4730. ARFLAGS=$arflags
  4731. AR_O=$ar_o
  4732. RANLIB=$ranlib
  4733. STRIP=$strip
  4734. CP=cp -p
  4735. LN_S=$ln_s
  4736. CPPFLAGS=$CPPFLAGS
  4737. CFLAGS=$CFLAGS
  4738. CXXFLAGS=$CXXFLAGS
  4739. ASFLAGS=$ASFLAGS
  4740. AS_C=$AS_C
  4741. AS_O=$AS_O
  4742. CC_C=$CC_C
  4743. CC_E=$CC_E
  4744. CC_O=$CC_O
  4745. CXX_C=$CXX_C
  4746. CXX_O=$CXX_O
  4747. LD_O=$LD_O
  4748. LD_LIB=$LD_LIB
  4749. LD_PATH=$LD_PATH
  4750. DLLTOOL=$dlltool
  4751. WINDRES=$windres
  4752. DEPWINDRES=$dep_cc
  4753. LDFLAGS=$LDFLAGS
  4754. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  4755. ASMSTRIPFLAGS=$ASMSTRIPFLAGS
  4756. YASMFLAGS=$YASMFLAGS
  4757. BUILDSUF=$build_suffix
  4758. PROGSSUF=$progs_suffix
  4759. FULLNAME=$FULLNAME
  4760. LIBPREF=$LIBPREF
  4761. LIBSUF=$LIBSUF
  4762. LIBNAME=$LIBNAME
  4763. SLIBPREF=$SLIBPREF
  4764. SLIBSUF=$SLIBSUF
  4765. EXESUF=$EXESUF
  4766. EXTRA_VERSION=$extra_version
  4767. CCDEP=$CCDEP
  4768. CXXDEP=$CXXDEP
  4769. CCDEP_FLAGS=$CCDEP_FLAGS
  4770. ASDEP=$ASDEP
  4771. ASDEP_FLAGS=$ASDEP_FLAGS
  4772. CC_DEPFLAGS=$CC_DEPFLAGS
  4773. AS_DEPFLAGS=$AS_DEPFLAGS
  4774. HOSTCC=$host_cc
  4775. HOSTLD=$host_ld
  4776. HOSTCFLAGS=$host_cflags
  4777. HOSTCPPFLAGS=$host_cppflags
  4778. HOSTEXESUF=$HOSTEXESUF
  4779. HOSTLDFLAGS=$host_ldflags
  4780. HOSTLIBS=$host_libs
  4781. DEPHOSTCC=$host_cc
  4782. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  4783. HOSTCCDEP=$HOSTCCDEP
  4784. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  4785. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  4786. HOSTCC_C=$HOSTCC_C
  4787. HOSTCC_O=$HOSTCC_O
  4788. HOSTLD_O=$HOSTLD_O
  4789. TARGET_EXEC=$target_exec $target_exec_args
  4790. TARGET_PATH=$target_path
  4791. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  4792. CFLAGS-ffplay=$sdl_cflags
  4793. ZLIB=$($ldflags_filter -lz)
  4794. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  4795. EXTRALIBS=$extralibs
  4796. COMPAT_OBJS=$compat_objs
  4797. EXEOBJS=$exeobjs
  4798. INSTALL=$install
  4799. LIBTARGET=${LIBTARGET}
  4800. SLIBNAME=${SLIBNAME}
  4801. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  4802. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  4803. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  4804. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  4805. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  4806. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  4807. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  4808. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  4809. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  4810. NOREDZONE_FLAGS=$noredzone_flags
  4811. EOF
  4812. get_version(){
  4813. lcname=lib${1}
  4814. name=$(toupper $lcname)
  4815. file=$source_path/$lcname/version.h
  4816. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  4817. enabled raise_major && eval ${name}_VERSION_MAJOR=$((${name}_VERSION_MAJOR+100))
  4818. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  4819. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  4820. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  4821. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  4822. }
  4823. map 'get_version $v' $LIBRARY_LIST
  4824. print_program_libs(){
  4825. eval "program_libs=\$${1}_libs"
  4826. eval echo "LIBS-${1}=${program_libs}" >> config.mak
  4827. }
  4828. map 'print_program_libs $v' $PROGRAM_LIST
  4829. cat > $TMPH <<EOF
  4830. /* Automatically generated by configure - do not modify! */
  4831. #ifndef FFMPEG_CONFIG_H
  4832. #define FFMPEG_CONFIG_H
  4833. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  4834. #define FFMPEG_LICENSE "$(c_escape $license)"
  4835. #define CONFIG_THIS_YEAR 2014
  4836. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  4837. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  4838. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  4839. #define av_restrict $_restrict
  4840. #define EXTERN_PREFIX "${extern_prefix}"
  4841. #define EXTERN_ASM ${extern_prefix}
  4842. #define BUILDSUF "$build_suffix"
  4843. #define SLIBSUF "$SLIBSUF"
  4844. #define HAVE_MMX2 HAVE_MMXEXT
  4845. EOF
  4846. test -n "$assert_level" &&
  4847. echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
  4848. test -n "$malloc_prefix" &&
  4849. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  4850. if enabled yasm; then
  4851. append config_files $TMPASM
  4852. printf '' >$TMPASM
  4853. fi
  4854. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  4855. mkdir -p doc
  4856. echo "@c auto-generated by configure" > doc/config.texi
  4857. print_config ARCH_ "$config_files" $ARCH_LIST
  4858. print_config HAVE_ "$config_files" $HAVE_LIST
  4859. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  4860. $CONFIG_EXTRA \
  4861. $ALL_COMPONENTS \
  4862. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  4863. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  4864. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  4865. cp_if_changed $TMPH config.h
  4866. touch .config
  4867. enabled yasm && cp_if_changed $TMPASM config.asm
  4868. cat > $TMPH <<EOF
  4869. /* Generated by ffconf */
  4870. #ifndef AVUTIL_AVCONFIG_H
  4871. #define AVUTIL_AVCONFIG_H
  4872. EOF
  4873. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  4874. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  4875. cp_if_changed $TMPH libavutil/avconfig.h
  4876. if test -n "$WARNINGS"; then
  4877. printf "\n$WARNINGS"
  4878. enabled fatal_warnings && exit 1
  4879. fi
  4880. # build pkg-config files
  4881. pkgconfig_generate(){
  4882. name=$1
  4883. shortname=${name#lib}${build_suffix}
  4884. comment=$2
  4885. version=$3
  4886. libs=$4
  4887. requires=$5
  4888. enabled ${name#lib} || return 0
  4889. mkdir -p $name
  4890. cat <<EOF > $name/$name${build_suffix}.pc
  4891. prefix=$prefix
  4892. exec_prefix=\${prefix}
  4893. libdir=$libdir
  4894. includedir=$incdir
  4895. Name: $name
  4896. Description: $comment
  4897. Version: $version
  4898. Requires: $(enabled shared || echo $requires)
  4899. Requires.private: $(enabled shared && echo $requires)
  4900. Conflicts:
  4901. Libs: -L\${libdir} $(enabled rpath && echo "-Wl,-rpath,\${libdir}") -l${shortname} $(enabled shared || echo $libs)
  4902. Libs.private: $(enabled shared && echo $libs)
  4903. Cflags: -I\${includedir}
  4904. EOF
  4905. mkdir -p doc/examples/pc-uninstalled
  4906. includedir=${source_path}
  4907. [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.."
  4908. cat <<EOF > doc/examples/pc-uninstalled/$name.pc
  4909. prefix=
  4910. exec_prefix=
  4911. libdir=\${pcfiledir}/../../../$name
  4912. includedir=${includedir}
  4913. Name: $name
  4914. Description: $comment
  4915. Version: $version
  4916. Requires: $requires
  4917. Conflicts:
  4918. Libs: -L\${libdir} -Wl,-rpath,\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4919. Cflags: -I\${includedir}
  4920. EOF
  4921. }
  4922. lavfi_libs="libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4923. enabled libavfilter_deps_avcodec && prepend lavfi_libs "libavcodec${build_suffix} = $LIBAVCODEC_VERSION,"
  4924. enabled libavfilter_deps_avformat && prepend lavfi_libs "libavformat${build_suffix} = $LIBAVFORMAT_VERSION,"
  4925. enabled libavfilter_deps_avresample && prepend lavfi_libs "libavresample${build_suffix} = $LIBAVRESAMPLE_VERSION,"
  4926. enabled libavfilter_deps_swscale && prepend lavfi_libs "libswscale${build_suffix} = $LIBSWSCALE_VERSION,"
  4927. enabled libavfilter_deps_swresample && prepend lavfi_libs "libswresample${build_suffix} = $LIBSWRESAMPLE_VERSION,"
  4928. enabled libavfilter_deps_postproc && prepend lavfi_libs "libpostproc${build_suffix} = $LIBPOSTPROC_VERSION,"
  4929. lavfi_libs=${lavfi_libs%, }
  4930. lavd_libs="libavformat${build_suffix} = $LIBAVFORMAT_VERSION"
  4931. enabled lavfi_indev && prepend lavd_libs "libavfilter${build_suffix} = $LIBAVFILTER_VERSION,"
  4932. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  4933. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4934. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec${build_suffix} = $LIBAVCODEC_VERSION"
  4935. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$lavd_libs"
  4936. pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$lavfi_libs"
  4937. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4938. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4939. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4940. pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"