configure 138 KB

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