configure 140 KB

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