configure 140 KB

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