configure 109 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641
  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. show_help(){
  51. cat <<EOF
  52. Usage: configure [options]
  53. Options: [defaults in brackets after descriptions]
  54. Standard options:
  55. --help print this message
  56. --logfile=FILE log tests and output to FILE [config.log]
  57. --disable-logging do not log configure debug information
  58. --prefix=PREFIX install in PREFIX [$prefix]
  59. --bindir=DIR install binaries in DIR [PREFIX/bin]
  60. --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]
  61. --libdir=DIR install libs in DIR [PREFIX/lib]
  62. --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
  63. --incdir=DIR install includes in DIR [PREFIX/include]
  64. --mandir=DIR install man page in DIR [PREFIX/share/man]
  65. Configuration options:
  66. --disable-static do not build static libraries [no]
  67. --enable-shared build shared libraries [no]
  68. --enable-gpl allow use of GPL code, the resulting libs
  69. and binaries will be under GPL [no]
  70. --enable-version3 upgrade (L)GPL to version 3 [no]
  71. --enable-nonfree allow use of nonfree code, the resulting libs
  72. and binaries will be unredistributable [no]
  73. --disable-doc do not build documentation
  74. --disable-ffmpeg disable ffmpeg build
  75. --disable-avconv disable avconv build
  76. --disable-ffplay disable ffplay build
  77. --disable-ffprobe disable ffprobe build
  78. --disable-ffserver disable ffserver build
  79. --disable-avdevice disable libavdevice build
  80. --disable-avcodec disable libavcodec build
  81. --disable-avformat disable libavformat build
  82. --disable-swresample disable libswresample build
  83. --disable-swscale disable libswscale build
  84. --disable-postproc disable libpostproc build
  85. --disable-avfilter disable video filter support [no]
  86. --disable-pthreads disable pthreads [auto]
  87. --enable-w32threads use Win32 threads [no]
  88. --enable-x11grab enable X11 grabbing [no]
  89. --disable-network disable network support [no]
  90. --enable-gray enable full grayscale support (slower color)
  91. --disable-swscale-alpha disable alpha channel support in swscale
  92. --disable-fastdiv disable table-based division
  93. --enable-small optimize for size instead of speed
  94. --disable-aandct disable AAN DCT code
  95. --disable-dct disable DCT code
  96. --disable-fft disable FFT code
  97. --disable-golomb disable Golomb code
  98. --disable-huffman disable Huffman code
  99. --disable-lpc disable LPC code
  100. --disable-mdct disable MDCT code
  101. --disable-rdft disable RDFT code
  102. --enable-vaapi enable VAAPI code [autodetect]
  103. --enable-vdpau enable VDPAU code [autodetect]
  104. --disable-dxva2 disable DXVA2 code
  105. --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  106. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  107. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  108. --disable-everything disable all components listed below
  109. --disable-encoder=NAME disable encoder NAME
  110. --enable-encoder=NAME enable encoder NAME
  111. --disable-encoders disable all encoders
  112. --disable-decoder=NAME disable decoder NAME
  113. --enable-decoder=NAME enable decoder NAME
  114. --disable-decoders disable all decoders
  115. --disable-hwaccel=NAME disable hwaccel NAME
  116. --enable-hwaccel=NAME enable hwaccel NAME
  117. --disable-hwaccels disable all hwaccels
  118. --disable-muxer=NAME disable muxer NAME
  119. --enable-muxer=NAME enable muxer NAME
  120. --disable-muxers disable all muxers
  121. --disable-demuxer=NAME disable demuxer NAME
  122. --enable-demuxer=NAME enable demuxer NAME
  123. --disable-demuxers disable all demuxers
  124. --enable-parser=NAME enable parser NAME
  125. --disable-parser=NAME disable parser NAME
  126. --disable-parsers disable all parsers
  127. --enable-bsf=NAME enable bitstream filter NAME
  128. --disable-bsf=NAME disable bitstream filter NAME
  129. --disable-bsfs disable all bitstream filters
  130. --enable-protocol=NAME enable protocol NAME
  131. --disable-protocol=NAME disable protocol NAME
  132. --disable-protocols disable all protocols
  133. --disable-indev=NAME disable input device NAME
  134. --disable-outdev=NAME disable output device NAME
  135. --disable-indevs disable input devices
  136. --disable-outdevs disable output devices
  137. --disable-devices disable all devices
  138. --enable-filter=NAME enable filter NAME
  139. --disable-filter=NAME disable filter NAME
  140. --disable-filters disable all filters
  141. --list-decoders show all available decoders
  142. --list-encoders show all available encoders
  143. --list-hwaccels show all available hardware accelerators
  144. --list-muxers show all available muxers
  145. --list-demuxers show all available demuxers
  146. --list-parsers show all available parsers
  147. --list-protocols show all available protocols
  148. --list-bsfs show all available bitstream filters
  149. --list-indevs show all available input devices
  150. --list-outdevs show all available output devices
  151. --list-filters show all available filters
  152. External library support:
  153. --enable-avisynth enable reading of AVISynth script files [no]
  154. --enable-bzlib enable bzlib [autodetect]
  155. --enable-libcelt enable CELT/Opus decoding via libcelt [no]
  156. --enable-frei0r enable frei0r video filtering
  157. --enable-libaacplus enable AAC+ encoding via libaacplus [no]
  158. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  159. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  160. --enable-libopencv enable video filtering via libopencv [no]
  161. --enable-libcdio enable audio CD grabbing with libcdio
  162. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  163. and libraw1394 [no]
  164. --enable-libdirac enable Dirac support via libdirac [no]
  165. --enable-libfaac enable FAAC support via libfaac [no]
  166. --enable-libfreetype enable libfreetype [no]
  167. --enable-libgsm enable GSM support via libgsm [no]
  168. --enable-libmodplug enable ModPlug via libmodplug [no]
  169. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  170. --enable-libnut enable NUT (de)muxing via libnut,
  171. native (de)muxer exists [no]
  172. --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]
  173. --enable-librtmp enable RTMP[E] support via librtmp [no]
  174. --enable-libschroedinger enable Dirac support via libschroedinger [no]
  175. --enable-libspeex enable Speex encoding and decoding via libspeex [no]
  176. --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no]
  177. --enable-libtheora enable Theora encoding via libtheora [no]
  178. --enable-libutvideo enable Ut Video decoding via libutvideo [no]
  179. --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
  180. --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
  181. --enable-libvorbis enable Vorbis encoding via libvorbis,
  182. native implementation exists [no]
  183. --enable-libvpx enable VP8 support via libvpx [no]
  184. --enable-libx264 enable H.264 encoding via x264 [no]
  185. --enable-libxavs enable AVS encoding via xavs [no]
  186. --enable-libxvid enable Xvid encoding via xvidcore,
  187. native MPEG-4/Xvid encoder exists [no]
  188. --enable-openal enable OpenAL 1.1 capture support [no]
  189. --enable-mlib enable Sun medialib [no]
  190. --enable-zlib enable zlib [autodetect]
  191. Advanced options (experts only):
  192. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  193. --enable-cross-compile assume a cross-compiler is used
  194. --sysroot=PATH root of cross-build tree
  195. --sysinclude=PATH location of cross-build system headers
  196. --target-os=OS compiler targets OS [$target_os]
  197. --target-exec=CMD command to run executables on target
  198. --target-path=DIR path to view of build directory on target
  199. --nm=NM use nm tool
  200. --ar=AR use archive tool AR [$ar_default]
  201. --as=AS use assembler AS [$as_default]
  202. --cc=CC use C compiler CC [$cc_default]
  203. --cxx=CXX use C compiler CXX [$cxx_default]
  204. --ld=LD use linker LD
  205. --host-cc=HOSTCC use host C compiler HOSTCC
  206. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  207. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  208. --host-libs=HLIBS use libs HLIBS when linking for host
  209. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  210. --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
  211. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  212. --extra-libs=ELIBS add ELIBS [$ELIBS]
  213. --extra-version=STRING version string suffix []
  214. --build-suffix=SUFFIX library name suffix []
  215. --progs-suffix=SUFFIX program name suffix []
  216. --arch=ARCH select architecture [$arch]
  217. --cpu=CPU select the minimum required CPU (affects
  218. instruction selection, may crash on older CPUs)
  219. --disable-asm disable all assembler optimizations
  220. --disable-altivec disable AltiVec optimizations
  221. --disable-amd3dnow disable 3DNow! optimizations
  222. --disable-amd3dnowext disable 3DNow! extended optimizations
  223. --disable-mmx disable MMX optimizations
  224. --disable-mmx2 disable MMX2 optimizations
  225. --disable-sse disable SSE optimizations
  226. --disable-ssse3 disable SSSE3 optimizations
  227. --disable-avx disable AVX optimizations
  228. --disable-armv5te disable armv5te optimizations
  229. --disable-armv6 disable armv6 optimizations
  230. --disable-armv6t2 disable armv6t2 optimizations
  231. --disable-armvfp disable ARM VFP optimizations
  232. --disable-iwmmxt disable iwmmxt optimizations
  233. --disable-mmi disable MMI optimizations
  234. --disable-neon disable neon optimizations
  235. --disable-vis disable VIS optimizations
  236. --disable-yasm disable use of yasm assembler
  237. --enable-pic build position-independent code
  238. --malloc-prefix=PFX prefix malloc and related names with PFX
  239. --enable-sram allow use of on-chip SRAM
  240. --disable-symver disable symbol versioning
  241. --optflags override optimization-related compiler flags
  242. Developer options (useful when working on FFmpeg itself):
  243. --disable-debug disable debugging symbols
  244. --enable-debug=LEVEL set the debug level [$debuglevel]
  245. --disable-optimizations disable compiler optimizations
  246. --enable-extra-warnings enable more compiler warnings
  247. --disable-stripping disable stripping of executables and shared libraries
  248. --samples=PATH location of test samples for FATE, if not set use
  249. \$FATE_SAMPLES at make invocation time.
  250. NOTE: Object files are built at the place where configure is launched.
  251. EOF
  252. exit 0
  253. }
  254. quotes='""'
  255. log(){
  256. echo "$@" >> $logfile
  257. }
  258. log_file(){
  259. log BEGIN $1
  260. pr -n -t $1 >> $logfile
  261. log END $1
  262. }
  263. echolog(){
  264. log "$@"
  265. echo "$@"
  266. }
  267. warn(){
  268. log "WARNING: $*"
  269. WARNINGS="${WARNINGS}WARNING: $*\n"
  270. }
  271. die(){
  272. echolog "$@"
  273. cat <<EOF
  274. If you think configure made a mistake, make sure you are using the latest
  275. version from Git. If the latest version fails, report the problem to the
  276. ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
  277. EOF
  278. if disabled logging; then
  279. cat <<EOF
  280. Rerun configure with logging enabled (do not use --disable-logging), and
  281. include the log this produces with your report.
  282. EOF
  283. else
  284. cat <<EOF
  285. Include the log file "$logfile" produced by configure as this will help
  286. solving the problem.
  287. EOF
  288. fi
  289. exit 1
  290. }
  291. # Avoid locale weirdness, besides we really just want to translate ASCII.
  292. toupper(){
  293. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  294. }
  295. tolower(){
  296. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  297. }
  298. c_escape(){
  299. echo "$*" | sed 's/["\\]/\\\0/g'
  300. }
  301. sh_quote(){
  302. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  303. test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
  304. echo "$v"
  305. }
  306. cleanws(){
  307. echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//'
  308. }
  309. filter(){
  310. pat=$1
  311. shift
  312. for v; do
  313. eval "case $v in $pat) echo $v ;; esac"
  314. done
  315. }
  316. filter_out(){
  317. pat=$1
  318. shift
  319. for v; do
  320. eval "case $v in $pat) ;; *) echo $v ;; esac"
  321. done
  322. }
  323. map(){
  324. m=$1
  325. shift
  326. for v; do eval $m; done
  327. }
  328. set_all(){
  329. value=$1
  330. shift
  331. for var in $*; do
  332. eval $var=$value
  333. done
  334. }
  335. set_weak(){
  336. value=$1
  337. shift
  338. for var; do
  339. eval : \${$var:=$value}
  340. done
  341. }
  342. set_safe(){
  343. var=$1
  344. shift
  345. eval $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')='$*'
  346. }
  347. get_safe(){
  348. eval echo \$$(echo "$1" | sed 's/[^A-Za-z0-9_]/_/g')
  349. }
  350. pushvar(){
  351. for var in $*; do
  352. eval level=\${${var}_level:=0}
  353. eval ${var}_${level}="\$$var"
  354. eval ${var}_level=$(($level+1))
  355. done
  356. }
  357. popvar(){
  358. for var in $*; do
  359. eval level=\${${var}_level:-0}
  360. test $level = 0 && continue
  361. eval level=$(($level-1))
  362. eval $var="\${${var}_${level}}"
  363. eval ${var}_level=$level
  364. eval unset ${var}_${level}
  365. done
  366. }
  367. enable(){
  368. set_all yes $*
  369. }
  370. disable(){
  371. set_all no $*
  372. }
  373. enable_weak(){
  374. set_weak yes $*
  375. }
  376. disable_weak(){
  377. set_weak no $*
  378. }
  379. enable_safe(){
  380. for var; do
  381. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  382. done
  383. }
  384. disable_safe(){
  385. for var; do
  386. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  387. done
  388. }
  389. do_enable_deep(){
  390. for var; do
  391. enabled $var && continue
  392. eval sel="\$${var}_select"
  393. eval sgs="\$${var}_suggest"
  394. pushvar var sgs
  395. enable_deep $sel
  396. popvar sgs
  397. enable_deep_weak $sgs
  398. popvar var
  399. done
  400. }
  401. enable_deep(){
  402. do_enable_deep $*
  403. enable $*
  404. }
  405. enable_deep_weak(){
  406. do_enable_deep $*
  407. enable_weak $*
  408. }
  409. enabled(){
  410. test "${1#!}" = "$1" && op== || op=!=
  411. eval test "x\$${1#!}" $op "xyes"
  412. }
  413. disabled(){
  414. test "${1#!}" = "$1" && op== || op=!=
  415. eval test "x\$${1#!}" $op "xno"
  416. }
  417. enabled_all(){
  418. for opt; do
  419. enabled $opt || return 1
  420. done
  421. }
  422. disabled_all(){
  423. for opt; do
  424. disabled $opt || return 1
  425. done
  426. }
  427. enabled_any(){
  428. for opt; do
  429. enabled $opt && return 0
  430. done
  431. }
  432. disabled_any(){
  433. for opt; do
  434. disabled $opt && return 0
  435. done
  436. return 1
  437. }
  438. set_default(){
  439. for opt; do
  440. eval : \${$opt:=\$${opt}_default}
  441. done
  442. }
  443. is_in(){
  444. value=$1
  445. shift
  446. for var in $*; do
  447. [ $var = $value ] && return 0
  448. done
  449. return 1
  450. }
  451. check_deps(){
  452. for cfg; do
  453. cfg="${cfg#!}"
  454. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  455. disabled ${cfg}_checking && continue
  456. enable ${cfg}_checking
  457. eval dep_all="\$${cfg}_deps"
  458. eval dep_any="\$${cfg}_deps_any"
  459. eval dep_sel="\$${cfg}_select"
  460. eval dep_sgs="\$${cfg}_suggest"
  461. eval dep_ifa="\$${cfg}_if"
  462. eval dep_ifn="\$${cfg}_if_any"
  463. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  464. check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  465. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  466. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  467. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  468. enabled_all $dep_all || disable $cfg
  469. enabled_any $dep_any || disable $cfg
  470. disabled_any $dep_sel && disable $cfg
  471. if enabled $cfg; then
  472. eval dep_extralibs="\$${cfg}_extralibs"
  473. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  474. enable_deep $dep_sel
  475. enable_deep_weak $dep_sgs
  476. fi
  477. disable ${cfg}_checking
  478. done
  479. }
  480. print_config_h(){
  481. enabled $1 && v=1 || v=0
  482. echo "#define $2 $v"
  483. }
  484. print_config_mak(){
  485. enabled $1 && v= || v=!
  486. echo "$v$2=yes"
  487. }
  488. print_config_asm(){
  489. enabled $1 && echo "%define $2"
  490. }
  491. print_config(){
  492. pfx=$1
  493. files=$2
  494. shift 2
  495. for cfg; do
  496. ucname="$(toupper $cfg)"
  497. for f in $files; do
  498. "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f
  499. done
  500. done
  501. }
  502. print_enabled(){
  503. test "$1" = -n && end=" " && shift || end="\n"
  504. suf=$1
  505. shift
  506. for v; do
  507. enabled $v && printf "%s$end" ${v%$suf};
  508. done
  509. }
  510. append(){
  511. var=$1
  512. shift
  513. eval "$var=\"\$$var $*\""
  514. }
  515. prepend(){
  516. var=$1
  517. shift
  518. eval "$var=\"$* \$$var\""
  519. }
  520. add_cppflags(){
  521. append CPPFLAGS $($filter_cppflags "$@")
  522. }
  523. add_cflags(){
  524. append CFLAGS $($filter_cflags "$@")
  525. }
  526. add_cxxflags(){
  527. append CXXFLAGS $($filter_cflags "$@")
  528. }
  529. add_asflags(){
  530. append ASFLAGS $($filter_asflags "$@")
  531. }
  532. add_ldflags(){
  533. append LDFLAGS "$@"
  534. }
  535. add_extralibs(){
  536. prepend extralibs "$@"
  537. }
  538. check_cmd(){
  539. log "$@"
  540. "$@" >> $logfile 2>&1
  541. }
  542. check_cc(){
  543. log check_cc "$@"
  544. cat > $TMPC
  545. log_file $TMPC
  546. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
  547. }
  548. check_cxx(){
  549. log check_cxx "$@"
  550. cat > $TMPCPP
  551. log_file $TMPCPP
  552. check_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" -c -o $TMPO $TMPCPP
  553. }
  554. check_cpp(){
  555. log check_cpp "$@"
  556. cat > $TMPC
  557. log_file $TMPC
  558. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
  559. }
  560. check_as(){
  561. log check_as "$@"
  562. cat > $TMPC
  563. log_file $TMPC
  564. check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
  565. }
  566. check_asm(){
  567. log check_asm "$@"
  568. name="$1"
  569. code="$2"
  570. shift 2
  571. disable $name
  572. check_as "$@" <<EOF && enable $name
  573. void foo(void){ __asm__ volatile($code); }
  574. EOF
  575. }
  576. check_yasm(){
  577. log check_yasm "$@"
  578. echo "$1" > $TMPS
  579. log_file $TMPS
  580. shift 1
  581. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  582. }
  583. check_ld(){
  584. log check_ld "$@"
  585. type=$1
  586. shift 1
  587. flags=''
  588. libs=''
  589. for f; do
  590. test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
  591. done
  592. check_$type $($filter_cflags $flags) || return
  593. check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $libs $extralibs
  594. }
  595. check_cppflags(){
  596. log check_cppflags "$@"
  597. set -- $($filter_cppflags "$@")
  598. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  599. int x;
  600. EOF
  601. }
  602. check_cflags(){
  603. log check_cflags "$@"
  604. set -- $($filter_cflags "$@")
  605. check_cc "$@" <<EOF && append CFLAGS "$@"
  606. int x;
  607. EOF
  608. }
  609. check_cxxflags(){
  610. log check_cxxflags "$@"
  611. set -- $($filter_cflags "$@")
  612. check_cxx "$@" <<EOF && append CXXFLAGS "$@"
  613. int x;
  614. EOF
  615. }
  616. test_ldflags(){
  617. log test_ldflags "$@"
  618. check_ld "cc" "$@" <<EOF
  619. int main(void){ return 0; }
  620. EOF
  621. }
  622. check_ldflags(){
  623. log check_ldflags "$@"
  624. test_ldflags "$@" && add_ldflags "$@"
  625. }
  626. check_header(){
  627. log check_header "$@"
  628. header=$1
  629. shift
  630. disable_safe $header
  631. check_cpp "$@" <<EOF && enable_safe $header
  632. #include <$header>
  633. int x;
  634. EOF
  635. }
  636. check_func(){
  637. log check_func "$@"
  638. func=$1
  639. shift
  640. disable $func
  641. check_ld "cc" "$@" <<EOF && enable $func
  642. extern int $func();
  643. int main(void){ $func(); }
  644. EOF
  645. }
  646. check_mathfunc(){
  647. log check_mathfunc "$@"
  648. func=$1
  649. shift
  650. disable $func
  651. check_ld "cc" "$@" <<EOF && enable $func
  652. #include <math.h>
  653. float foo(float f) { return $func(f); }
  654. int main(void){ return (int) foo; }
  655. EOF
  656. }
  657. check_func_headers(){
  658. log check_func_headers "$@"
  659. headers=$1
  660. funcs=$2
  661. shift 2
  662. {
  663. for hdr in $headers; do
  664. echo "#include <$hdr>"
  665. done
  666. for func in $funcs; do
  667. echo "long check_$func(void) { return (long) $func; }"
  668. done
  669. echo "int main(void) { return 0; }"
  670. } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
  671. }
  672. check_class_headers_cpp(){
  673. log check_class_headers_cpp "$@"
  674. headers=$1
  675. classes=$2
  676. shift 2
  677. {
  678. for hdr in $headers; do
  679. echo "#include <$hdr>"
  680. done
  681. echo "int main(void) { "
  682. i=1
  683. for class in $classes; do
  684. echo "$class obj$i;"
  685. i=$(expr $i + 1)
  686. done
  687. echo "return 0; }"
  688. } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers
  689. }
  690. check_cpp_condition(){
  691. log check_cpp_condition "$@"
  692. header=$1
  693. condition=$2
  694. shift 2
  695. check_cpp $($filter_cppflags "$@") <<EOF
  696. #include <$header>
  697. #if !($condition)
  698. #error "unsatisfied condition: $condition"
  699. #endif
  700. EOF
  701. }
  702. check_lib(){
  703. log check_lib "$@"
  704. header="$1"
  705. func="$2"
  706. shift 2
  707. check_header $header && check_func $func "$@" && add_extralibs "$@"
  708. }
  709. check_lib2(){
  710. log check_lib2 "$@"
  711. headers="$1"
  712. funcs="$2"
  713. shift 2
  714. check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
  715. }
  716. check_lib_cpp(){
  717. log check_lib_cpp "$@"
  718. headers="$1"
  719. classes="$2"
  720. shift 2
  721. check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@"
  722. }
  723. check_pkg_config(){
  724. log check_pkg_config "$@"
  725. pkg="$1"
  726. headers="$2"
  727. funcs="$3"
  728. shift 3
  729. $pkg_config --exists $pkg 2>/dev/null || return
  730. pkg_cflags=$($pkg_config --cflags $pkg)
  731. pkg_libs=$($pkg_config --libs $pkg)
  732. check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
  733. set_safe ${pkg}_cflags $pkg_cflags &&
  734. set_safe ${pkg}_libs $pkg_libs
  735. }
  736. check_exec(){
  737. check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  738. }
  739. check_exec_crash(){
  740. code=$(cat)
  741. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  742. # are safe but may not be available everywhere. Thus we use
  743. # raise(SIGTERM) instead. The check is run in a subshell so we
  744. # can redirect the "Terminated" message from the shell. SIGBUS
  745. # is not defined by standard C so it is used conditionally.
  746. (check_exec "$@") >> $logfile 2>&1 <<EOF
  747. #include <signal.h>
  748. static void sighandler(int sig){
  749. raise(SIGTERM);
  750. }
  751. int main(void){
  752. signal(SIGILL, sighandler);
  753. signal(SIGFPE, sighandler);
  754. signal(SIGSEGV, sighandler);
  755. #ifdef SIGBUS
  756. signal(SIGBUS, sighandler);
  757. #endif
  758. { $code }
  759. }
  760. EOF
  761. }
  762. check_type(){
  763. log check_type "$@"
  764. headers=$1
  765. type=$2
  766. shift 2
  767. disable_safe "$type"
  768. incs=""
  769. for hdr in $headers; do
  770. incs="$incs
  771. #include <$hdr>"
  772. done
  773. check_cc "$@" <<EOF && enable_safe "$type"
  774. $incs
  775. $type v;
  776. EOF
  777. }
  778. check_struct(){
  779. log check_type "$@"
  780. headers=$1
  781. struct=$2
  782. member=$3
  783. shift 3
  784. disable_safe "${struct}_${member}"
  785. incs=""
  786. for hdr in $headers; do
  787. incs="$incs
  788. #include <$hdr>"
  789. done
  790. check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
  791. $incs
  792. const void *p = &(($struct *)0)->$member;
  793. EOF
  794. }
  795. require(){
  796. name="$1"
  797. header="$2"
  798. func="$3"
  799. shift 3
  800. check_lib $header $func "$@" || die "ERROR: $name not found"
  801. }
  802. require2(){
  803. name="$1"
  804. headers="$2"
  805. func="$3"
  806. shift 3
  807. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  808. }
  809. require_cpp(){
  810. name="$1"
  811. headers="$2"
  812. classes="$3"
  813. shift 3
  814. check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
  815. }
  816. require_pkg_config(){
  817. pkg="$1"
  818. check_pkg_config "$@" || die "ERROR: $pkg not found"
  819. add_cflags $(get_safe ${pkg}_cflags)
  820. add_extralibs $(get_safe ${pkg}_libs)
  821. }
  822. check_host_cc(){
  823. log check_host_cc "$@"
  824. cat > $TMPC
  825. log_file $TMPC
  826. check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
  827. }
  828. check_host_cflags(){
  829. log check_host_cflags "$@"
  830. check_host_cc "$@" <<EOF && append host_cflags "$@"
  831. int x;
  832. EOF
  833. }
  834. apply(){
  835. file=$1
  836. shift
  837. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  838. }
  839. cp_if_changed(){
  840. cmp -s "$1" "$2" && echo "$2 is unchanged" && return
  841. mkdir -p "$(dirname $2)"
  842. cp -f "$1" "$2"
  843. }
  844. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  845. # system-dependent things.
  846. COMPONENT_LIST="
  847. bsfs
  848. decoders
  849. demuxers
  850. encoders
  851. filters
  852. hwaccels
  853. indevs
  854. muxers
  855. outdevs
  856. parsers
  857. protocols
  858. "
  859. CONFIG_LIST="
  860. $COMPONENT_LIST
  861. aandct
  862. ac3dsp
  863. avcodec
  864. avdevice
  865. avfilter
  866. avformat
  867. avisynth
  868. bzlib
  869. crystalhd
  870. dct
  871. doc
  872. dwt
  873. dxva2
  874. fastdiv
  875. ffmpeg
  876. avconv
  877. ffplay
  878. ffprobe
  879. ffserver
  880. fft
  881. frei0r
  882. golomb
  883. gpl
  884. gray
  885. h264dsp
  886. h264pred
  887. hardcoded_tables
  888. huffman
  889. libaacplus
  890. libcdio
  891. libcelt
  892. libdc1394
  893. libdirac
  894. libfaac
  895. libfreetype
  896. libgsm
  897. libmodplug
  898. libmp3lame
  899. libnut
  900. libopencore_amrnb
  901. libopencore_amrwb
  902. libopencv
  903. libopenjpeg
  904. librtmp
  905. libschroedinger
  906. libspeex
  907. libstagefright_h264
  908. libtheora
  909. libutvideo
  910. libvo_aacenc
  911. libvo_amrwbenc
  912. libvorbis
  913. libvpx
  914. libx264
  915. libxavs
  916. libxvid
  917. lpc
  918. lsp
  919. mdct
  920. memalign_hack
  921. mlib
  922. mpegaudiodsp
  923. network
  924. nonfree
  925. openal
  926. pic
  927. postproc
  928. rdft
  929. rtpdec
  930. runtime_cpudetect
  931. shared
  932. sinewin
  933. small
  934. sram
  935. static
  936. swresample
  937. swscale
  938. swscale_alpha
  939. thumb
  940. vaapi
  941. vdpau
  942. version3
  943. x11grab
  944. zlib
  945. "
  946. THREADS_LIST='
  947. pthreads
  948. w32threads
  949. '
  950. ARCH_LIST='
  951. alpha
  952. arm
  953. avr32
  954. avr32_ap
  955. avr32_uc
  956. bfin
  957. ia64
  958. m68k
  959. mips
  960. mips64
  961. parisc
  962. ppc
  963. ppc64
  964. s390
  965. sh4
  966. sparc
  967. sparc64
  968. tomi
  969. x86
  970. x86_32
  971. x86_64
  972. '
  973. ARCH_EXT_LIST='
  974. altivec
  975. amd3dnow
  976. amd3dnowext
  977. armv5te
  978. armv6
  979. armv6t2
  980. armvfp
  981. avx
  982. iwmmxt
  983. mmi
  984. mmx
  985. mmx2
  986. neon
  987. ppc4xx
  988. sse
  989. ssse3
  990. vfpv3
  991. vis
  992. '
  993. HAVE_LIST_PUB='
  994. bigendian
  995. fast_unaligned
  996. '
  997. HAVE_LIST="
  998. $ARCH_EXT_LIST
  999. $HAVE_LIST_PUB
  1000. $THREADS_LIST
  1001. aligned_stack
  1002. alsa_asoundlib_h
  1003. altivec_h
  1004. arpa_inet_h
  1005. asm_mod_y
  1006. attribute_may_alias
  1007. attribute_packed
  1008. bswap
  1009. closesocket
  1010. cmov
  1011. dcbzl
  1012. dev_bktr_ioctl_bt848_h
  1013. dev_bktr_ioctl_meteor_h
  1014. dev_ic_bt8xx_h
  1015. dev_video_meteor_ioctl_meteor_h
  1016. dev_video_bktr_ioctl_bt848_h
  1017. dlfcn_h
  1018. dlopen
  1019. dos_paths
  1020. ebp_available
  1021. ebx_available
  1022. exp2
  1023. exp2f
  1024. fast_64bit
  1025. fast_clz
  1026. fast_cmov
  1027. fcntl
  1028. fork
  1029. getaddrinfo
  1030. gethrtime
  1031. GetProcessMemoryInfo
  1032. GetProcessTimes
  1033. getrusage
  1034. gnu_as
  1035. struct_rusage_ru_maxrss
  1036. ibm_asm
  1037. inet_aton
  1038. inline_asm
  1039. isatty
  1040. kbhit
  1041. ldbrx
  1042. llrint
  1043. llrintf
  1044. local_aligned_16
  1045. local_aligned_8
  1046. localtime_r
  1047. log2
  1048. log2f
  1049. loongson
  1050. lrint
  1051. lrintf
  1052. lzo1x_999_compress
  1053. machine_ioctl_bt848_h
  1054. machine_ioctl_meteor_h
  1055. malloc_h
  1056. MapViewOfFile
  1057. memalign
  1058. mkstemp
  1059. mmap
  1060. PeekNamedPipe
  1061. posix_memalign
  1062. round
  1063. roundf
  1064. sdl
  1065. sdl_video_size
  1066. setmode
  1067. sndio_h
  1068. socklen_t
  1069. soundcard_h
  1070. poll_h
  1071. setrlimit
  1072. strerror_r
  1073. strptime
  1074. strtok_r
  1075. struct_addrinfo
  1076. struct_ipv6_mreq
  1077. struct_sockaddr_in6
  1078. struct_sockaddr_sa_len
  1079. struct_sockaddr_storage
  1080. symver
  1081. symver_gnu_asm
  1082. symver_asm_label
  1083. sys_mman_h
  1084. sys_resource_h
  1085. sys_select_h
  1086. sys_soundcard_h
  1087. sys_videoio_h
  1088. termios_h
  1089. threads
  1090. trunc
  1091. truncf
  1092. vfp_args
  1093. VirtualAlloc
  1094. winsock2_h
  1095. xform_asm
  1096. xmm_clobbers
  1097. yasm
  1098. "
  1099. # options emitted with CONFIG_ prefix but not available on command line
  1100. CONFIG_EXTRA="
  1101. avutil
  1102. gplv3
  1103. lgplv3
  1104. "
  1105. CMDLINE_SELECT="
  1106. $ARCH_EXT_LIST
  1107. $CONFIG_LIST
  1108. $THREADS_LIST
  1109. asm
  1110. cross_compile
  1111. debug
  1112. extra_warnings
  1113. logging
  1114. optimizations
  1115. stripping
  1116. symver
  1117. yasm
  1118. "
  1119. PATHS_LIST='
  1120. bindir
  1121. datadir
  1122. incdir
  1123. libdir
  1124. mandir
  1125. prefix
  1126. shlibdir
  1127. '
  1128. CMDLINE_SET="
  1129. $PATHS_LIST
  1130. ar
  1131. arch
  1132. as
  1133. build_suffix
  1134. progs_suffix
  1135. cc
  1136. cpu
  1137. cross_prefix
  1138. cxx
  1139. dep_cc
  1140. extra_version
  1141. host_cc
  1142. host_cflags
  1143. host_ldflags
  1144. host_libs
  1145. host_os
  1146. install
  1147. ld
  1148. logfile
  1149. malloc_prefix
  1150. nm
  1151. optflags
  1152. pkg_config
  1153. samples
  1154. strip
  1155. sysinclude
  1156. sysroot
  1157. target_exec
  1158. target_os
  1159. target_path
  1160. "
  1161. CMDLINE_APPEND="
  1162. extra_cflags
  1163. extra_cxxflags
  1164. "
  1165. # code dependency declarations
  1166. # architecture extensions
  1167. armv5te_deps="arm"
  1168. armv6_deps="arm"
  1169. armv6t2_deps="arm"
  1170. armvfp_deps="arm"
  1171. iwmmxt_deps="arm"
  1172. neon_deps="arm"
  1173. vfpv3_deps="armvfp"
  1174. mmi_deps="mips"
  1175. altivec_deps="ppc"
  1176. ppc4xx_deps="ppc"
  1177. vis_deps="sparc"
  1178. x86_64_suggest="cmov fast_cmov"
  1179. amd3dnow_deps="mmx"
  1180. amd3dnowext_deps="amd3dnow"
  1181. mmx_deps="x86"
  1182. mmx2_deps="mmx"
  1183. sse_deps="mmx"
  1184. ssse3_deps="sse"
  1185. avx_deps="ssse3"
  1186. aligned_stack_if_any="ppc x86"
  1187. fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1188. fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
  1189. fast_unaligned_if_any="armv6 ppc x86"
  1190. need_memalign="altivec neon sse"
  1191. inline_asm_deps="!tms470"
  1192. symver_if_any="symver_asm_label symver_gnu_asm"
  1193. # subsystems
  1194. dct_select="rdft"
  1195. mdct_select="fft"
  1196. rdft_select="fft"
  1197. mpegaudiodsp_select="dct"
  1198. # decoders / encoders / hardware accelerators
  1199. aac_decoder_select="mdct sinewin"
  1200. aac_encoder_select="mdct sinewin"
  1201. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1202. ac3_decoder_select="mdct ac3dsp ac3_parser"
  1203. ac3_encoder_select="mdct ac3dsp"
  1204. ac3_fixed_encoder_select="mdct ac3dsp"
  1205. alac_encoder_select="lpc"
  1206. amrnb_decoder_select="lsp"
  1207. amrwb_decoder_select="lsp"
  1208. atrac1_decoder_select="mdct sinewin"
  1209. atrac3_decoder_select="mdct"
  1210. binkaudio_dct_decoder_select="mdct rdft dct sinewin"
  1211. binkaudio_rdft_decoder_select="mdct rdft sinewin"
  1212. cavs_decoder_select="golomb"
  1213. cook_decoder_select="mdct sinewin"
  1214. cscd_decoder_suggest="zlib"
  1215. dca_decoder_select="mdct"
  1216. dnxhd_encoder_select="aandct"
  1217. dxa_decoder_select="zlib"
  1218. eac3_decoder_select="ac3_decoder"
  1219. eac3_encoder_select="mdct ac3dsp"
  1220. eamad_decoder_select="aandct"
  1221. eatgq_decoder_select="aandct"
  1222. eatqi_decoder_select="aandct"
  1223. ffv1_decoder_select="golomb"
  1224. flac_decoder_select="golomb"
  1225. flac_encoder_select="golomb lpc"
  1226. flashsv_decoder_select="zlib"
  1227. flashsv_encoder_select="zlib"
  1228. flashsv2_encoder_select="zlib"
  1229. flashsv2_decoder_select="zlib"
  1230. flv_decoder_select="h263_decoder"
  1231. flv_encoder_select="h263_encoder"
  1232. fraps_decoder_select="huffman"
  1233. h261_encoder_select="aandct"
  1234. h263_decoder_select="h263_parser"
  1235. h263_encoder_select="aandct"
  1236. h263_vaapi_hwaccel_select="vaapi h263_decoder"
  1237. h263i_decoder_select="h263_decoder"
  1238. h263p_encoder_select="h263_encoder"
  1239. h264_decoder_select="golomb h264dsp h264pred"
  1240. h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
  1241. h264_dxva2_hwaccel_deps="dxva2api_h"
  1242. h264_dxva2_hwaccel_select="dxva2 h264_decoder"
  1243. h264_vaapi_hwaccel_select="vaapi"
  1244. h264_vdpau_decoder_select="vdpau h264_decoder"
  1245. imc_decoder_select="fft mdct sinewin"
  1246. jpegls_decoder_select="golomb"
  1247. jpegls_encoder_select="golomb"
  1248. ljpeg_encoder_select="aandct"
  1249. loco_decoder_select="golomb"
  1250. mjpeg_encoder_select="aandct"
  1251. mlp_decoder_select="mlp_parser"
  1252. mp1_decoder_select="mpegaudiodsp"
  1253. mp2_decoder_select="mpegaudiodsp"
  1254. mp3adu_decoder_select="mpegaudiodsp"
  1255. mp3_decoder_select="mpegaudiodsp"
  1256. mp3on4_decoder_select="mpegaudiodsp"
  1257. mp1float_decoder_select="mpegaudiodsp"
  1258. mp2float_decoder_select="mpegaudiodsp"
  1259. mp3adufloat_decoder_select="mpegaudiodsp"
  1260. mp3float_decoder_select="mpegaudiodsp"
  1261. mp3on4float_decoder_select="mpegaudiodsp"
  1262. mpeg1video_encoder_select="aandct"
  1263. mpeg2video_encoder_select="aandct"
  1264. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1265. mpeg4_encoder_select="h263_encoder"
  1266. mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
  1267. mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
  1268. mpeg1_vdpau_hwaccel_select="vdpau mpeg1video_decoder"
  1269. mpeg2_crystalhd_decoder_select="crystalhd"
  1270. mpeg2_dxva2_hwaccel_deps="dxva2api_h"
  1271. mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
  1272. mpeg2_vdpau_hwaccel_select="vdpau mpeg2video_decoder"
  1273. mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
  1274. mpeg4_crystalhd_decoder_select="crystalhd"
  1275. mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
  1276. mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
  1277. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1278. mpeg_xvmc_decoder_select="mpegvideo_decoder"
  1279. msmpeg4_crystalhd_decoder_select="crystalhd"
  1280. msmpeg4v1_decoder_select="h263_decoder"
  1281. msmpeg4v1_encoder_select="h263_encoder"
  1282. msmpeg4v2_decoder_select="h263_decoder"
  1283. msmpeg4v2_encoder_select="h263_encoder"
  1284. msmpeg4v3_decoder_select="h263_decoder"
  1285. msmpeg4v3_encoder_select="h263_encoder"
  1286. nellymoser_decoder_select="mdct sinewin"
  1287. nellymoser_encoder_select="mdct sinewin"
  1288. png_decoder_select="zlib"
  1289. png_encoder_select="zlib"
  1290. qcelp_decoder_select="lsp"
  1291. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1292. ra_144_encoder_select="lpc"
  1293. rv10_decoder_select="h263_decoder"
  1294. rv10_encoder_select="h263_encoder"
  1295. rv20_decoder_select="h263_decoder"
  1296. rv20_encoder_select="h263_encoder"
  1297. rv30_decoder_select="golomb h264pred"
  1298. rv40_decoder_select="golomb h264pred"
  1299. shorten_decoder_select="golomb"
  1300. sipr_decoder_select="lsp"
  1301. snow_decoder_select="dwt"
  1302. snow_encoder_select="aandct dwt"
  1303. sonic_decoder_select="golomb"
  1304. sonic_encoder_select="golomb"
  1305. sonic_ls_encoder_select="golomb"
  1306. svq1_encoder_select="aandct"
  1307. svq3_decoder_select="golomb h264dsp h264pred"
  1308. svq3_decoder_suggest="zlib"
  1309. theora_decoder_select="vp3_decoder"
  1310. tiff_decoder_suggest="zlib"
  1311. tiff_encoder_suggest="zlib"
  1312. truehd_decoder_select="mlp_decoder"
  1313. tscc_decoder_select="zlib"
  1314. twinvq_decoder_select="mdct lsp sinewin"
  1315. vc1_decoder_select="h263_decoder"
  1316. vc1_crystalhd_decoder_select="crystalhd"
  1317. vc1_dxva2_hwaccel_deps="dxva2api_h"
  1318. vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
  1319. vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
  1320. vc1_vdpau_decoder_select="vdpau vc1_decoder"
  1321. vc1image_decoder_select="vc1_decoder"
  1322. vorbis_decoder_select="mdct"
  1323. vorbis_encoder_select="mdct"
  1324. vp6_decoder_select="huffman"
  1325. vp6a_decoder_select="vp6_decoder"
  1326. vp6f_decoder_select="vp6_decoder"
  1327. vp8_decoder_select="h264pred"
  1328. wmapro_decoder_select="mdct sinewin"
  1329. wmav1_decoder_select="mdct sinewin"
  1330. wmav1_encoder_select="mdct sinewin"
  1331. wmav2_decoder_select="mdct sinewin"
  1332. wmav2_encoder_select="mdct sinewin"
  1333. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1334. wmv1_decoder_select="h263_decoder"
  1335. wmv1_encoder_select="h263_encoder"
  1336. wmv2_decoder_select="h263_decoder"
  1337. wmv2_encoder_select="h263_encoder"
  1338. wmv3_decoder_select="vc1_decoder"
  1339. wmv3_crystalhd_decoder_select="crystalhd"
  1340. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1341. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1342. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1343. wmv3image_decoder_select="wmv3_decoder"
  1344. zlib_decoder_select="zlib"
  1345. zlib_encoder_select="zlib"
  1346. zmbv_decoder_select="zlib"
  1347. zmbv_encoder_select="zlib"
  1348. crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
  1349. vaapi_deps="va_va_h"
  1350. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1351. # parsers
  1352. h264_parser_select="golomb h264dsp h264pred"
  1353. # external libraries
  1354. libaacplus_encoder_deps="libaacplus"
  1355. libcelt_decoder_deps="libcelt"
  1356. libdirac_decoder_deps="libdirac !libschroedinger"
  1357. libdirac_encoder_deps="libdirac"
  1358. libfaac_encoder_deps="libfaac"
  1359. libgsm_decoder_deps="libgsm"
  1360. libgsm_encoder_deps="libgsm"
  1361. libgsm_ms_decoder_deps="libgsm"
  1362. libgsm_ms_encoder_deps="libgsm"
  1363. libmodplug_demuxer_deps="libmodplug"
  1364. libmp3lame_encoder_deps="libmp3lame"
  1365. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1366. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1367. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1368. libopenjpeg_decoder_deps="libopenjpeg"
  1369. libschroedinger_decoder_deps="libschroedinger"
  1370. libschroedinger_encoder_deps="libschroedinger"
  1371. libspeex_decoder_deps="libspeex"
  1372. libspeex_encoder_deps="libspeex"
  1373. libstagefright_h264_decoder_deps="libstagefright_h264"
  1374. libtheora_encoder_deps="libtheora"
  1375. libvo_aacenc_encoder_deps="libvo_aacenc"
  1376. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  1377. libvorbis_encoder_deps="libvorbis"
  1378. libvpx_decoder_deps="libvpx"
  1379. libvpx_encoder_deps="libvpx"
  1380. libx264_encoder_deps="libx264"
  1381. libxavs_encoder_deps="libxavs"
  1382. libxvid_encoder_deps="libxvid"
  1383. libutvideo_decoder_deps="libutvideo gpl"
  1384. # demuxers / muxers
  1385. ac3_demuxer_select="ac3_parser"
  1386. asf_stream_muxer_select="asf_muxer"
  1387. avisynth_demuxer_deps="avisynth"
  1388. dirac_demuxer_select="dirac_parser"
  1389. eac3_demuxer_select="ac3_parser"
  1390. flac_demuxer_select="flac_parser"
  1391. ipod_muxer_select="mov_muxer"
  1392. libnut_demuxer_deps="libnut"
  1393. libnut_muxer_deps="libnut"
  1394. matroska_audio_muxer_select="matroska_muxer"
  1395. matroska_demuxer_suggest="zlib bzlib"
  1396. mov_demuxer_suggest="zlib"
  1397. mp3_demuxer_select="mpegaudio_parser"
  1398. mp4_muxer_select="mov_muxer"
  1399. mpegtsraw_demuxer_select="mpegts_demuxer"
  1400. mxf_d10_muxer_select="mxf_muxer"
  1401. ogg_demuxer_select="golomb"
  1402. psp_muxer_select="mov_muxer"
  1403. rtp_demuxer_select="sdp_demuxer"
  1404. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  1405. rtsp_demuxer_select="http_protocol rtpdec"
  1406. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
  1407. sap_demuxer_select="sdp_demuxer"
  1408. sap_muxer_select="rtp_muxer rtp_protocol"
  1409. sdp_demuxer_select="rtpdec"
  1410. spdif_muxer_select="aac_parser"
  1411. tg2_muxer_select="mov_muxer"
  1412. tgp_muxer_select="mov_muxer"
  1413. w64_demuxer_deps="wav_demuxer"
  1414. # indevs / outdevs
  1415. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1416. alsa_outdev_deps="alsa_asoundlib_h"
  1417. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1418. dshow_indev_deps="IBaseFilter"
  1419. dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid"
  1420. dv1394_indev_deps="dv1394 dv_demuxer"
  1421. fbdev_indev_deps="linux_fb_h"
  1422. jack_indev_deps="jack_jack_h sem_timedwait"
  1423. lavfi_indev_deps="avfilter"
  1424. libcdio_indev_deps="libcdio"
  1425. libdc1394_indev_deps="libdc1394"
  1426. openal_indev_deps="openal"
  1427. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1428. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1429. sdl_outdev_deps="sdl"
  1430. sndio_indev_deps="sndio_h"
  1431. sndio_outdev_deps="sndio_h"
  1432. v4l_indev_deps="linux_videodev_h"
  1433. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1434. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1435. vfwcap_indev_extralibs="-lavicap32"
  1436. x11_grab_device_indev_deps="x11grab XShmCreateImage"
  1437. x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
  1438. # protocols
  1439. gopher_protocol_deps="network"
  1440. http_protocol_deps="network"
  1441. http_protocol_select="tcp_protocol"
  1442. mmsh_protocol_select="http_protocol"
  1443. mmst_protocol_deps="network"
  1444. rtmp_protocol_select="tcp_protocol"
  1445. rtp_protocol_select="udp_protocol"
  1446. tcp_protocol_deps="network"
  1447. udp_protocol_deps="network"
  1448. # filters
  1449. abuffer_filter_deps="strtok_r"
  1450. aconvert_filter_deps="strtok_r"
  1451. aformat_filter_deps="strtok_r"
  1452. amovie_filter_deps="avcodec avformat"
  1453. blackframe_filter_deps="gpl"
  1454. boxblur_filter_deps="gpl"
  1455. cropdetect_filter_deps="gpl"
  1456. delogo_filter_deps="gpl"
  1457. drawtext_filter_deps="libfreetype"
  1458. frei0r_filter_deps="frei0r dlopen strtok_r"
  1459. frei0r_src_filter_deps="frei0r dlopen strtok_r"
  1460. hqdn3d_filter_deps="gpl"
  1461. movie_filter_deps="avcodec avformat"
  1462. mp_filter_deps="gpl avcodec"
  1463. mptestsrc_filter_deps="gpl"
  1464. negate_filter_deps="lut_filter"
  1465. ocv_filter_deps="libopencv"
  1466. scale_filter_deps="swscale"
  1467. yadif_filter_deps="gpl"
  1468. # libraries
  1469. avdevice_deps="avcodec avformat"
  1470. avformat_deps="avcodec"
  1471. postproc_deps="gpl"
  1472. # programs
  1473. ffmpeg_deps="avcodec avformat swscale swresample"
  1474. ffmpeg_select="buffer_filter buffersink_filter"
  1475. avconv_deps="avcodec avformat swscale"
  1476. avconv_select="buffer_filter"
  1477. ffplay_deps="avcodec avformat swscale sdl"
  1478. ffplay_select="buffersink_filter rdft"
  1479. ffprobe_deps="avcodec avformat"
  1480. ffserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
  1481. ffserver_extralibs='$ldl'
  1482. doc_deps="texi2html"
  1483. # tests
  1484. test_deps(){
  1485. suf1=$1
  1486. suf2=$2
  1487. shift 2
  1488. for v; do
  1489. dep=${v%=*}
  1490. tests=${v#*=}
  1491. for name in ${tests}; do
  1492. append ${name}_test_deps ${dep}$suf1 ${dep}$suf2
  1493. done
  1494. done
  1495. }
  1496. mxf_d10_test_deps="avfilter"
  1497. seek_lavf_mxf_d10_test_deps="mxf_d10_test"
  1498. test_deps _encoder _decoder \
  1499. adpcm_g726=g726 \
  1500. adpcm_ima_qt \
  1501. adpcm_ima_wav \
  1502. adpcm_ms \
  1503. adpcm_swf \
  1504. adpcm_yamaha=adpcm_yam \
  1505. alac \
  1506. asv1 \
  1507. asv2 \
  1508. bmp \
  1509. dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd" \
  1510. dvvideo="dv dv50" \
  1511. ffv1 \
  1512. flac \
  1513. flashsv \
  1514. flv \
  1515. gif \
  1516. h261 \
  1517. h263="h263 h263p" \
  1518. huffyuv \
  1519. jpegls \
  1520. mjpeg="jpg mjpeg ljpeg" \
  1521. mp2 \
  1522. mpeg1video="mpeg mpeg1b" \
  1523. mpeg2video="mpeg2 mpeg2thread" \
  1524. mpeg4="mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc" \
  1525. msmpeg4v3=msmpeg4 \
  1526. msmpeg4v2 \
  1527. pbm=pbmpipe \
  1528. pcx \
  1529. pgm="pgm pgmpipe" \
  1530. png \
  1531. ppm="ppm ppmpipe" \
  1532. rawvideo="rgb yuv" \
  1533. roq \
  1534. rv10 \
  1535. rv20 \
  1536. sgi \
  1537. snow="snow snowll" \
  1538. svq1 \
  1539. targa=tga \
  1540. tiff \
  1541. wmav1 \
  1542. wmav2 \
  1543. wmv1 \
  1544. wmv2 \
  1545. test_deps _muxer _demuxer \
  1546. aiff \
  1547. pcm_alaw=alaw \
  1548. asf \
  1549. au \
  1550. avi \
  1551. dv=dv_fmt \
  1552. ffm \
  1553. flv=flv_fmt \
  1554. gxf \
  1555. matroska=mkv \
  1556. mmf \
  1557. mov \
  1558. pcm_mulaw=mulaw \
  1559. mxf="mxf mxf_d10" \
  1560. nut \
  1561. ogg \
  1562. rawvideo=pixfmt \
  1563. rm \
  1564. swf \
  1565. mpegts=ts \
  1566. voc \
  1567. wav \
  1568. yuv4mpegpipe=yuv4mpeg \
  1569. ac3_fixed_test_deps="ac3_fixed_encoder ac3_decoder rm_muxer rm_demuxer"
  1570. mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
  1571. # default parameters
  1572. logfile="config.log"
  1573. # installation paths
  1574. prefix_default="/usr/local"
  1575. bindir_default='${prefix}/bin'
  1576. datadir_default='${prefix}/share/ffmpeg'
  1577. incdir_default='${prefix}/include'
  1578. libdir_default='${prefix}/lib'
  1579. mandir_default='${prefix}/share/man'
  1580. shlibdir_default="$libdir_default"
  1581. # toolchain
  1582. ar_default="ar"
  1583. cc_default="gcc"
  1584. cxx_default="g++"
  1585. cc_version=\"unknown\"
  1586. host_cc_default="gcc"
  1587. install="install"
  1588. ln_s="ln -sf"
  1589. nm_default="nm"
  1590. objformat="elf"
  1591. pkg_config_default=pkg-config
  1592. ranlib="ranlib"
  1593. strip_default="strip"
  1594. yasmexe="yasm"
  1595. nogas=":"
  1596. nm_opts='-g'
  1597. # machine
  1598. arch_default=$(uname -m)
  1599. cpu="generic"
  1600. # OS
  1601. target_os_default=$(tolower $(uname -s))
  1602. host_os=$target_os_default
  1603. # configurable options
  1604. enable avcodec
  1605. enable avdevice
  1606. enable avfilter
  1607. enable avformat
  1608. enable avutil
  1609. enable asm
  1610. enable debug
  1611. enable doc
  1612. enable fastdiv
  1613. enable ffmpeg
  1614. enable avconv
  1615. enable ffplay
  1616. enable ffprobe
  1617. enable ffserver
  1618. enable network
  1619. enable optimizations
  1620. enable postproc
  1621. enable protocols
  1622. enable static
  1623. enable stripping
  1624. enable swresample
  1625. enable swscale
  1626. enable swscale_alpha
  1627. # build settings
  1628. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1629. FFSERVERLDFLAGS=-Wl,-E
  1630. LIBPREF="lib"
  1631. LIBSUF=".a"
  1632. FULLNAME='$(NAME)$(BUILDSUF)'
  1633. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1634. SLIBPREF="lib"
  1635. SLIBSUF=".so"
  1636. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1637. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1638. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1639. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1640. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  1641. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  1642. AS_O='-o $@'
  1643. CC_O='-o $@'
  1644. CXX_O='-o $@'
  1645. host_cflags='-D_ISOC99_SOURCE -O3 -g'
  1646. host_libs='-lm'
  1647. target_path='$(CURDIR)'
  1648. # since the object filename is not given with the -MM flag, the compiler
  1649. # is only able to print the basename, and we must add the path ourselves
  1650. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1651. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
  1652. # find source path
  1653. if test -f configure; then
  1654. source_path=.
  1655. else
  1656. source_path=$(cd $(dirname "$0"); pwd)
  1657. echo "$source_path" | grep -q '[[:blank:]]' &&
  1658. die "Out of tree builds are impossible with whitespace in source path."
  1659. test -e "$source_path/config.h" &&
  1660. die "Out of tree builds are impossible with config.h in source dir."
  1661. fi
  1662. for v in "$@"; do
  1663. r=${v#*=}
  1664. l=${v%"$r"}
  1665. r=$(sh_quote "$r")
  1666. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  1667. done
  1668. find_things(){
  1669. thing=$1
  1670. pattern=$2
  1671. file=$source_path/$3
  1672. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1673. }
  1674. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1675. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1676. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1677. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1678. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1679. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1680. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1681. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1682. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1683. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1684. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1685. find_tests(){
  1686. map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
  1687. }
  1688. ACODEC_TESTS=$(find_tests acodec)
  1689. VCODEC_TESTS=$(find_tests vsynth1)
  1690. LAVF_TESTS=$(find_tests lavf)
  1691. LAVFI_TESTS=$(find_tests lavfi)
  1692. SEEK_TESTS=$(find_tests seek seek_)
  1693. pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST))
  1694. for n in $COMPONENT_LIST; do
  1695. v=$(toupper ${n%s})_LIST
  1696. eval enable \$$v
  1697. eval ${n}_if_any="\$$v"
  1698. done
  1699. enable $ARCH_EXT_LIST $ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS
  1700. die_unknown(){
  1701. echo "Unknown option \"$1\"."
  1702. echo "See $0 --help for available options."
  1703. exit 1
  1704. }
  1705. show_list() {
  1706. suffix=_$1
  1707. shift
  1708. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1709. exit 0
  1710. }
  1711. for opt do
  1712. optval="${opt#*=}"
  1713. case "$opt" in
  1714. --extra-ldflags=*) add_ldflags $optval
  1715. ;;
  1716. --extra-libs=*) add_extralibs $optval
  1717. ;;
  1718. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1719. ;;
  1720. --enable-debug=*) debuglevel="$optval"
  1721. ;;
  1722. --disable-everything)
  1723. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1724. ;;
  1725. --enable-*=*|--disable-*=*)
  1726. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1727. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1728. eval list=\$$(toupper $thing)_LIST
  1729. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1730. $action $(filter "$name" $list)
  1731. ;;
  1732. --enable-?*|--disable-?*)
  1733. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1734. if is_in $option $COMPONENT_LIST; then
  1735. test $action = disable && action=unset
  1736. eval $action \$$(toupper ${option%s})_LIST
  1737. elif is_in $option $CMDLINE_SELECT; then
  1738. $action $option
  1739. else
  1740. die_unknown $opt
  1741. fi
  1742. ;;
  1743. --list-*)
  1744. NAME="${opt#--list-}"
  1745. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1746. NAME=${NAME%s}
  1747. eval show_list $NAME \$$(toupper $NAME)_LIST
  1748. ;;
  1749. --help|-h) show_help
  1750. ;;
  1751. *)
  1752. optname="${opt%%=*}"
  1753. optname="${optname#--}"
  1754. optname=$(echo "$optname" | sed 's/-/_/g')
  1755. if is_in $optname $CMDLINE_SET; then
  1756. eval $optname='$optval'
  1757. elif is_in $optname $CMDLINE_APPEND; then
  1758. append $optname "$optval"
  1759. else
  1760. die_unknown $opt
  1761. fi
  1762. ;;
  1763. esac
  1764. done
  1765. disabled logging && logfile=/dev/null
  1766. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  1767. set >> $logfile
  1768. test -n "$cross_prefix" && enable cross_compile
  1769. if enabled cross_compile; then
  1770. test -n "$arch" && test -n "$target_os" ||
  1771. die "Must specify target arch and OS when cross-compiling"
  1772. fi
  1773. set_default arch target_os
  1774. ar_default="${cross_prefix}${ar_default}"
  1775. cc_default="${cross_prefix}${cc_default}"
  1776. cxx_default="${cross_prefix}${cxx_default}"
  1777. nm_default="${cross_prefix}${nm_default}"
  1778. pkg_config_default="${cross_prefix}${pkg_config_default}"
  1779. ranlib="${cross_prefix}${ranlib}"
  1780. strip_default="${cross_prefix}${strip_default}"
  1781. sysinclude_default="${sysroot}/usr/include"
  1782. set_default cc cxx nm pkg_config strip sysinclude
  1783. enabled cross_compile || host_cc_default=$cc
  1784. set_default host_cc
  1785. if ! $pkg_config --version >/dev/null 2>&1; then
  1786. warn "$pkg_config not found, library detection may fail."
  1787. pkg_config=false
  1788. fi
  1789. exesuf() {
  1790. case $1 in
  1791. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  1792. esac
  1793. }
  1794. EXESUF=$(exesuf $target_os)
  1795. HOSTEXESUF=$(exesuf $host_os)
  1796. # set temporary file name
  1797. : ${TMPDIR:=$TEMPDIR}
  1798. : ${TMPDIR:=$TMP}
  1799. : ${TMPDIR:=/tmp}
  1800. if ! check_cmd mktemp -u XXXXXX; then
  1801. # simple replacement for missing mktemp
  1802. # NOT SAFE FOR GENERAL USE
  1803. mktemp(){
  1804. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  1805. }
  1806. fi
  1807. tmpfile(){
  1808. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1809. (set -C; exec > $tmp) 2>/dev/null ||
  1810. die "Unable to create temporary file in $TMPDIR."
  1811. append TMPFILES $tmp
  1812. eval $1=$tmp
  1813. }
  1814. trap 'rm -f -- $TMPFILES' EXIT
  1815. tmpfile TMPC .c
  1816. tmpfile TMPCPP .cpp
  1817. tmpfile TMPE $EXESUF
  1818. tmpfile TMPH .h
  1819. tmpfile TMPO .o
  1820. tmpfile TMPS .S
  1821. tmpfile TMPV .ver
  1822. tmpfile TMPSH .sh
  1823. tmpfile TMPASM .asm
  1824. unset -f mktemp
  1825. chmod +x $TMPE
  1826. # make sure we can execute files in $TMPDIR
  1827. cat > $TMPSH 2>> $logfile <<EOF
  1828. #! /bin/sh
  1829. EOF
  1830. chmod +x $TMPSH >> $logfile 2>&1
  1831. if ! $TMPSH >> $logfile 2>&1; then
  1832. cat <<EOF
  1833. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1834. variable to another directory and make sure that it is not mounted noexec.
  1835. EOF
  1836. die "Sanity test failed."
  1837. fi
  1838. filter_cflags=echo
  1839. filter_cppflags=echo
  1840. filter_asflags=echo
  1841. if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  1842. cc_type=llvm_gcc
  1843. cc_version=__VERSION__
  1844. gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
  1845. cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver"
  1846. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1847. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1848. speed_cflags='-O3'
  1849. size_cflags='-Os'
  1850. elif $cc -v 2>&1 | grep -qi ^gcc; then
  1851. cc_type=gcc
  1852. cc_version=__VERSION__
  1853. gcc_version=$($cc --version | head -n1)
  1854. gcc_basever=$($cc -dumpversion)
  1855. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  1856. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  1857. cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  1858. if ! $cc -dumpversion | grep -q '^2\.'; then
  1859. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1860. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1861. fi
  1862. speed_cflags='-O3'
  1863. size_cflags='-Os'
  1864. elif $cc --version 2>/dev/null | grep -q Intel; then
  1865. cc_type=icc
  1866. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1867. cc_ident=$($cc --version | head -n1)
  1868. icc_version=$($cc -dumpversion)
  1869. CC_DEPFLAGS='-MMD'
  1870. AS_DEPFLAGS='-MMD'
  1871. speed_cflags='-O3'
  1872. size_cflags='-Os'
  1873. noopt_cflags='-O1'
  1874. elif $cc -v 2>&1 | grep -q xlc; then
  1875. cc_type=xlc
  1876. cc_version="AV_STRINGIFY(__IBMC__)"
  1877. cc_ident=$($cc -qversion 2>/dev/null | head -n1)
  1878. speed_cflags='-O5'
  1879. size_cflags='-O5 -qcompact'
  1880. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1881. cc_type=ccc
  1882. cc_version="AV_STRINGIFY(__DECC_VER)"
  1883. cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3)
  1884. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1885. debuglevel=3
  1886. add_ldflags -Wl,-z,now # calls to libots crash without this
  1887. speed_cflags='-fast'
  1888. size_cflags='-O1'
  1889. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1890. test -d "$sysroot" || die "No valid sysroot specified."
  1891. cc_type=armcc
  1892. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1893. cc_ident=$($cc --vsn | head -n1)
  1894. armcc_conf="$PWD/armcc.conf"
  1895. $cc --arm_linux_configure \
  1896. --arm_linux_config_file="$armcc_conf" \
  1897. --configure_sysroot="$sysroot" \
  1898. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1899. die "Error creating armcc configuration file."
  1900. $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  1901. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1902. as_default="${cross_prefix}gcc"
  1903. CC_DEPFLAGS='-MMD'
  1904. AS_DEPFLAGS='-MMD'
  1905. speed_cflags='-O3'
  1906. size_cflags='-Os'
  1907. filter_asflags="filter_out -W${armcc_opt}*"
  1908. elif $cc -version 2>/dev/null | grep -q TMS470; then
  1909. cc_type=tms470
  1910. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  1911. cc_ident=$($cc -version | head -n1 | tr -s ' ')
  1912. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  1913. CC_O='-fr=$(@D)'
  1914. as_default="${cross_prefix}gcc"
  1915. ld_default="${cross_prefix}gcc"
  1916. TMPO=$(basename $TMPC .c).o
  1917. append TMPFILES $TMPO
  1918. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  1919. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  1920. AS_DEPFLAGS='-MMD'
  1921. speed_cflags='-O3 -mf=5'
  1922. size_cflags='-O3 -mf=2'
  1923. filter_cflags=tms470_flags
  1924. tms470_flags(){
  1925. for flag; do
  1926. case $flag in
  1927. -march=*|-mcpu=*)
  1928. case "${flag#*=}" in
  1929. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1930. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1931. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1932. armv6*|arm11*) echo -mv=6 ;;
  1933. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1934. echo -mv=5e ;;
  1935. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1936. esac
  1937. ;;
  1938. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1939. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1940. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1941. -msoft-float) echo --float_support=vfplib ;;
  1942. -O[0-3]|-mf=*) echo $flag ;;
  1943. -g) echo -g -mn ;;
  1944. -pds=*) echo $flag ;;
  1945. esac
  1946. done
  1947. }
  1948. elif $cc -v 2>&1 | grep -q clang; then
  1949. cc_type=clang
  1950. $cc -dM -E $TMPC | grep -q __clang_version__ &&
  1951. cc_version=__clang_version__ || cc_version=__VERSION__
  1952. cc_ident=$($cc --version | head -n1)
  1953. CC_DEPFLAGS='-MMD'
  1954. AS_DEPFLAGS='-MMD'
  1955. speed_cflags='-O3'
  1956. size_cflags='-Os'
  1957. elif $cc -V 2>&1 | grep -q Sun; then
  1958. cc_type=suncc
  1959. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  1960. cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  1961. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  1962. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  1963. add_ldflags -xc99
  1964. speed_cflags='-O5'
  1965. size_cflags='-O5 -xspace'
  1966. filter_cflags=suncc_flags
  1967. suncc_flags(){
  1968. for flag; do
  1969. case $flag in
  1970. -march=*|-mcpu=*)
  1971. case "${flag#*=}" in
  1972. native) echo -xtarget=native ;;
  1973. v9|niagara) echo -xarch=sparc ;;
  1974. ultrasparc) echo -xarch=sparcvis ;;
  1975. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  1976. i586|pentium) echo -xchip=pentium ;;
  1977. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1978. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  1979. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  1980. pentium4*) echo -xtarget=pentium4 ;;
  1981. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  1982. *-sse3) echo -xarch=sse3 ;;
  1983. core2) echo -xarch=ssse3 -xchip=core2 ;;
  1984. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  1985. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  1986. k8|opteron|athlon64|athlon-fx)
  1987. echo -xarch=sse2a ;;
  1988. athlon*) echo -xarch=pentium_proa ;;
  1989. esac
  1990. ;;
  1991. -std=c99) echo -xc99 ;;
  1992. -fomit-frame-pointer) echo -xregs=frameptr ;;
  1993. -fPIC) echo -KPIC -xcode=pic32 ;;
  1994. -W*,*) echo $flag ;;
  1995. -f*-*|-W*) ;;
  1996. *) echo $flag ;;
  1997. esac
  1998. done
  1999. }
  2000. elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2001. cc_type=pathscale
  2002. cc_version=__PATHSCALE__
  2003. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  2004. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2005. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2006. speed_cflags='-O2'
  2007. size_cflags='-Os'
  2008. filter_cflags='filter_out -Wdisabled-optimization'
  2009. elif $cc -v 2>&1 | grep -q Open64; then
  2010. cc_type=open64
  2011. cc_version=__OPEN64__
  2012. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  2013. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2014. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2015. speed_cflags='-O2'
  2016. size_cflags='-Os'
  2017. filter_cflags='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2018. fi
  2019. test -n "$cc_type" && enable $cc_type ||
  2020. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2021. : ${as_default:=$cc}
  2022. : ${dep_cc_default:=$cc}
  2023. : ${ld_default:=$cc}
  2024. set_default ar as dep_cc ld
  2025. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  2026. test -n "$CXX_DEPFLAGS" || CXXDEP=$DEPEND_CMD
  2027. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  2028. add_cflags $extra_cflags
  2029. add_cxxflags $extra_cxxflags
  2030. add_asflags $extra_cflags
  2031. if test -n "$sysroot"; then
  2032. case "$cc_type" in
  2033. gcc|llvm_gcc|clang)
  2034. add_cppflags --sysroot="$sysroot"
  2035. add_ldflags --sysroot="$sysroot"
  2036. ;;
  2037. tms470)
  2038. add_cppflags -I"$sysinclude"
  2039. add_ldflags --sysroot="$sysroot"
  2040. ;;
  2041. esac
  2042. fi
  2043. if test "$cpu" = host; then
  2044. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  2045. case "$cc_type" in
  2046. gcc|llvm_gcc)
  2047. check_native(){
  2048. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2049. sed -n "/cc1.*$1=/{
  2050. s/.*$1=\\([^ ]*\\).*/\\1/
  2051. p
  2052. q
  2053. }" $TMPE
  2054. }
  2055. cpu=$(check_native -march || check_native -mcpu)
  2056. ;;
  2057. esac
  2058. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  2059. fi
  2060. # Deal with common $arch aliases
  2061. case "$arch" in
  2062. arm*)
  2063. arch="arm"
  2064. ;;
  2065. mips|mipsel|IP*)
  2066. arch="mips"
  2067. ;;
  2068. mips64*)
  2069. arch="mips"
  2070. subarch="mips64"
  2071. ;;
  2072. parisc|hppa)
  2073. arch="parisc"
  2074. ;;
  2075. parisc64|hppa64)
  2076. arch="parisc"
  2077. subarch="parisc64"
  2078. ;;
  2079. "Power Macintosh"|ppc|powerpc|ppc64|powerpc64)
  2080. arch="ppc"
  2081. ;;
  2082. s390|s390x)
  2083. arch="s390"
  2084. ;;
  2085. sh4|sh)
  2086. arch="sh4"
  2087. ;;
  2088. sun4u|sparc64)
  2089. arch="sparc"
  2090. subarch="sparc64"
  2091. ;;
  2092. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  2093. arch="x86"
  2094. ;;
  2095. esac
  2096. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2097. enable $arch
  2098. # Add processor-specific flags
  2099. if test "$cpu" = generic; then
  2100. : do nothing
  2101. elif enabled ppc; then
  2102. case $(tolower $cpu) in
  2103. 601|ppc601|powerpc601)
  2104. cpuflags="-mcpu=601"
  2105. disable altivec
  2106. ;;
  2107. 603*|ppc603*|powerpc603*)
  2108. cpuflags="-mcpu=603"
  2109. disable altivec
  2110. ;;
  2111. 604*|ppc604*|powerpc604*)
  2112. cpuflags="-mcpu=604"
  2113. disable altivec
  2114. ;;
  2115. g3|75*|ppc75*|powerpc75*)
  2116. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  2117. disable altivec
  2118. ;;
  2119. g4|745*|ppc745*|powerpc745*)
  2120. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  2121. ;;
  2122. 74*|ppc74*|powerpc74*)
  2123. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  2124. ;;
  2125. g5|970|ppc970|powerpc970|power4*)
  2126. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  2127. ;;
  2128. cell)
  2129. cpuflags="-mcpu=cell"
  2130. enable ldbrx
  2131. ;;
  2132. e500v2)
  2133. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2134. disable altivec
  2135. ;;
  2136. e500)
  2137. cpuflags="-mcpu=8540 -mhard-float"
  2138. disable altivec
  2139. ;;
  2140. esac
  2141. elif enabled x86; then
  2142. case $cpu in
  2143. i[345]86|pentium)
  2144. cpuflags="-march=$cpu"
  2145. disable mmx
  2146. ;;
  2147. # targets that do NOT support conditional mov (cmov)
  2148. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2149. cpuflags="-march=$cpu"
  2150. disable cmov
  2151. ;;
  2152. # targets that do support conditional mov (cmov)
  2153. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|amdfam10|barcelona|atom)
  2154. cpuflags="-march=$cpu"
  2155. enable cmov
  2156. enable fast_cmov
  2157. ;;
  2158. # targets that do support conditional mov but on which it's slow
  2159. pentium4|pentium4m|prescott|nocona)
  2160. cpuflags="-march=$cpu"
  2161. enable cmov
  2162. disable fast_cmov
  2163. ;;
  2164. esac
  2165. elif enabled sparc; then
  2166. case $cpu in
  2167. niagara)
  2168. cpuflags="-mcpu=$cpu"
  2169. disable vis
  2170. ;;
  2171. sparc64)
  2172. cpuflags="-mcpu=v9"
  2173. ;;
  2174. esac
  2175. elif enabled arm; then
  2176. case $cpu in
  2177. armv*)
  2178. cpuflags="-march=$cpu"
  2179. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2180. ;;
  2181. *)
  2182. cpuflags="-mcpu=$cpu"
  2183. case $cpu in
  2184. cortex-a*) subarch=armv7a ;;
  2185. cortex-r*) subarch=armv7r ;;
  2186. cortex-m*) enable thumb; subarch=armv7m ;;
  2187. arm11*) subarch=armv6 ;;
  2188. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2189. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2190. esac
  2191. ;;
  2192. esac
  2193. elif enabled alpha; then
  2194. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  2195. elif enabled bfin; then
  2196. cpuflags="-mcpu=$cpu"
  2197. elif enabled mips; then
  2198. cpuflags="-march=$cpu"
  2199. elif enabled avr32; then
  2200. case $cpu in
  2201. ap7[02]0[0-2])
  2202. subarch="avr32_ap"
  2203. cpuflags="-mpart=$cpu"
  2204. ;;
  2205. ap)
  2206. subarch="avr32_ap"
  2207. cpuflags="-march=$cpu"
  2208. ;;
  2209. uc3[ab]*)
  2210. subarch="avr32_uc"
  2211. cpuflags="-mcpu=$cpu"
  2212. ;;
  2213. uc)
  2214. subarch="avr32_uc"
  2215. cpuflags="-march=$cpu"
  2216. ;;
  2217. esac
  2218. fi
  2219. add_cflags $cpuflags
  2220. add_asflags $cpuflags
  2221. # compiler sanity check
  2222. check_exec <<EOF
  2223. int main(void){ return 0; }
  2224. EOF
  2225. if test "$?" != 0; then
  2226. echo "$cc is unable to create an executable file."
  2227. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2228. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2229. echo "Only do this if you know what cross compiling means."
  2230. fi
  2231. die "C compiler test failed."
  2232. fi
  2233. add_cppflags -D_ISOC99_SOURCE
  2234. add_cxxflags -D__STDC_CONSTANT_MACROS
  2235. check_cflags -std=c99
  2236. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2237. #include <stdlib.h>
  2238. EOF
  2239. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2240. #include <stdlib.h>
  2241. EOF
  2242. check_host_cflags -std=c99
  2243. check_host_cflags -Wall
  2244. case "$arch" in
  2245. alpha|ia64|mips|parisc|sparc)
  2246. spic=$shared
  2247. ;;
  2248. x86)
  2249. subarch="x86_32"
  2250. check_cc <<EOF && subarch="x86_64"
  2251. int test[(int)sizeof(char*) - 7];
  2252. EOF
  2253. if test "$subarch" = "x86_64"; then
  2254. spic=$shared
  2255. fi
  2256. ;;
  2257. ppc)
  2258. check_cc <<EOF && subarch="ppc64"
  2259. int test[(int)sizeof(char*) - 7];
  2260. EOF
  2261. ;;
  2262. esac
  2263. enable $subarch
  2264. enabled spic && enable pic
  2265. # OS specific
  2266. case $target_os in
  2267. haiku)
  2268. prefix_default="/boot/common"
  2269. network_extralibs="-lnetwork"
  2270. host_libs=
  2271. ;;
  2272. sunos)
  2273. FFSERVERLDFLAGS=""
  2274. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2275. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2276. network_extralibs="-lsocket -lnsl"
  2277. add_cppflags -D__EXTENSIONS__
  2278. # When using suncc to build, the Solaris linker will mark
  2279. # an executable with each instruction set encountered by
  2280. # the Solaris assembler. As our libraries contain their own
  2281. # guards for processor-specific code, instead suppress
  2282. # generation of the HWCAPS ELF section on Solaris x86 only.
  2283. enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
  2284. nm_opts='-P -g'
  2285. ;;
  2286. netbsd)
  2287. disable symver
  2288. oss_indev_extralibs="-lossaudio"
  2289. oss_outdev_extralibs="-lossaudio"
  2290. ;;
  2291. openbsd)
  2292. enable malloc_aligned
  2293. # On OpenBSD 4.5. the compiler does not use PIC unless
  2294. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  2295. # however the generated executable will not do anything
  2296. # (simply quits with exit-code 1, no crash, no output).
  2297. # Thus explicitly enable PIC here.
  2298. enable pic
  2299. disable symver
  2300. SHFLAGS='-shared'
  2301. oss_indev_extralibs="-lossaudio"
  2302. oss_outdev_extralibs="-lossaudio"
  2303. ;;
  2304. dragonfly)
  2305. enable malloc_aligned
  2306. disable symver
  2307. ;;
  2308. freebsd)
  2309. enable malloc_aligned
  2310. ;;
  2311. bsd/os)
  2312. add_extralibs -lpoll -lgnugetopt
  2313. strip="strip -d"
  2314. ;;
  2315. darwin)
  2316. enable malloc_aligned
  2317. gas="gas-preprocessor.pl $cc"
  2318. enabled ppc && add_asflags -force_cpusubtype_ALL
  2319. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  2320. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  2321. strip="${strip} -x"
  2322. add_ldflags -Wl,-dynamic,-search_paths_first
  2323. SLIBSUF=".dylib"
  2324. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2325. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2326. FFSERVERLDFLAGS=-Wl,-bind_at_load
  2327. objformat="macho"
  2328. enabled x86_64 && objformat="macho64"
  2329. enabled_any pic shared ||
  2330. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2331. ;;
  2332. mingw32*)
  2333. if test $target_os = "mingw32ce"; then
  2334. disable network
  2335. else
  2336. target_os=mingw32
  2337. fi
  2338. LIBTARGET=i386
  2339. if enabled x86_64; then
  2340. enable malloc_aligned
  2341. LIBTARGET=x64
  2342. elif enabled arm; then
  2343. LIBTARGET=arm-wince
  2344. fi
  2345. shlibdir_default="$bindir_default"
  2346. SLIBPREF=""
  2347. SLIBSUF=".dll"
  2348. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2349. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2350. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  2351. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2352. SLIB_INSTALL_LINKS=
  2353. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  2354. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  2355. SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  2356. objformat="win32"
  2357. enable dos_paths
  2358. check_cflags -fno-common
  2359. check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
  2360. || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2361. die "ERROR: MinGW runtime version must be >= 3.15."
  2362. add_cppflags -U__STRICT_ANSI__
  2363. ;;
  2364. cygwin*)
  2365. target_os=cygwin
  2366. shlibdir_default="$bindir_default"
  2367. SLIBPREF="cyg"
  2368. SLIBSUF=".dll"
  2369. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2370. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2371. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2372. objformat="win32"
  2373. enable dos_paths
  2374. check_cflags -fno-common
  2375. add_cppflags -U__STRICT_ANSI__
  2376. ;;
  2377. *-dos|freedos|opendos)
  2378. network_extralibs="-lsocket"
  2379. objformat="coff"
  2380. enable dos_paths
  2381. add_cppflags -U__STRICT_ANSI__
  2382. ;;
  2383. linux)
  2384. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2385. enable dv1394
  2386. ;;
  2387. irix*)
  2388. target_os=irix
  2389. ranlib="echo ignoring ranlib"
  2390. ;;
  2391. os/2*)
  2392. strip="lxlite -CS"
  2393. ln_s="cp -f"
  2394. objformat="aout"
  2395. add_cppflags -D_GNU_SOURCE
  2396. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2397. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2398. FFSERVERLDFLAGS=""
  2399. LIBSUF="_s.a"
  2400. SLIBPREF=""
  2401. SLIBSUF=".dll"
  2402. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2403. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2404. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2405. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2406. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2407. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2408. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2409. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2410. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2411. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2412. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  2413. enable dos_paths
  2414. ;;
  2415. gnu/kfreebsd)
  2416. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
  2417. ;;
  2418. gnu)
  2419. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2420. ;;
  2421. qnx)
  2422. add_cppflags -D_QNX_SOURCE
  2423. network_extralibs="-lsocket"
  2424. ;;
  2425. symbian)
  2426. SLIBSUF=".dll"
  2427. enable dos_paths
  2428. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  2429. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  2430. add_ldflags -Wl,--target1-abs,--no-undefined \
  2431. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  2432. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  2433. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  2434. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  2435. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  2436. ;;
  2437. none)
  2438. ;;
  2439. *)
  2440. die "Unknown OS '$target_os'."
  2441. ;;
  2442. esac
  2443. echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$FFMPEG_CONFIGURATION" >config.fate
  2444. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2445. set_default $PATHS_LIST
  2446. # we need to build at least one lib type
  2447. if ! enabled_any static shared; then
  2448. cat <<EOF
  2449. At least one library type must be built.
  2450. Specify --enable-static to build the static libraries or --enable-shared to
  2451. build the shared libraries as well. To only build the shared libraries specify
  2452. --disable-static in addition to --enable-shared.
  2453. EOF
  2454. exit 1;
  2455. fi
  2456. die_license_disabled() {
  2457. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2458. }
  2459. die_license_disabled gpl libcdio
  2460. die_license_disabled gpl libx264
  2461. die_license_disabled gpl libxavs
  2462. die_license_disabled gpl libxvid
  2463. die_license_disabled gpl x11grab
  2464. die_license_disabled nonfree libaacplus
  2465. die_license_disabled nonfree libfaac
  2466. die_license_disabled version3 libopencore_amrnb
  2467. die_license_disabled version3 libopencore_amrwb
  2468. die_license_disabled version3 libvo_aacenc
  2469. die_license_disabled version3 libvo_amrwbenc
  2470. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2471. disabled optimizations || check_cflags -fomit-frame-pointer
  2472. enable_pic() {
  2473. enable pic
  2474. add_cppflags -DPIC
  2475. add_cflags -fPIC
  2476. add_asflags -fPIC
  2477. }
  2478. enabled pic && enable_pic
  2479. check_cc <<EOF || die "Symbol mangling check failed."
  2480. int ff_extern;
  2481. EOF
  2482. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2483. extern_prefix=${sym%%ff_extern*}
  2484. check_cc <<EOF && enable inline_asm
  2485. void foo(void) { __asm__ volatile ("" ::); }
  2486. EOF
  2487. _restrict=
  2488. for restrict_keyword in restrict __restrict__ __restrict; do
  2489. check_cc <<EOF && _restrict=$restrict_keyword && break
  2490. void foo(char * $restrict_keyword p);
  2491. EOF
  2492. done
  2493. check_cc <<EOF && enable attribute_packed
  2494. struct { int x; } __attribute__((packed)) x;
  2495. EOF
  2496. check_cc <<EOF && enable attribute_may_alias
  2497. union { int x; } __attribute__((may_alias)) x;
  2498. EOF
  2499. check_cc <<EOF || die "endian test failed"
  2500. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2501. EOF
  2502. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2503. if enabled alpha; then
  2504. check_cflags -mieee
  2505. elif enabled arm; then
  2506. enabled thumb && check_cflags -mthumb || check_cflags -marm
  2507. nogas=die
  2508. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  2509. enable vfp_args
  2510. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  2511. case "${cross_prefix:-$cc}" in
  2512. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  2513. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  2514. __asm__ (".eabi_attribute 28, 1");
  2515. int main(void) { return 0; }
  2516. EOF
  2517. esac
  2518. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  2519. fi
  2520. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2521. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2522. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2523. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2524. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2525. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2526. enabled vfpv3 && check_asm vfpv3 '"vmov.f32 s0, #1.0"'
  2527. check_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  2528. enabled_all armv6t2 shared !pic && enable_pic
  2529. elif enabled mips; then
  2530. check_asm loongson '"dmult.g $1, $2, $3"'
  2531. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2532. elif enabled ppc; then
  2533. enable local_aligned_8 local_aligned_16
  2534. check_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  2535. check_asm ibm_asm '"add 0, 0, 0"'
  2536. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2537. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2538. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2539. if enabled altivec; then
  2540. nogas=warn
  2541. check_cflags -maltivec -mabi=altivec &&
  2542. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2543. check_cflags -faltivec
  2544. # check if our compiler supports Motorola AltiVec C API
  2545. check_cc <<EOF || disable altivec
  2546. $inc_altivec_h
  2547. int main(void) {
  2548. vector signed int v1, v2, v3;
  2549. v1 = vec_add(v2,v3);
  2550. return 0;
  2551. }
  2552. EOF
  2553. # check if our compiler supports braces for vector declarations
  2554. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2555. $inc_altivec_h
  2556. int main (void) { (vector int) {1}; return 0; }
  2557. EOF
  2558. fi
  2559. elif enabled sparc; then
  2560. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2561. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2562. elif enabled x86; then
  2563. enable local_aligned_8 local_aligned_16
  2564. # check whether EBP is available on x86
  2565. # As 'i' is stored on the stack, this program will crash
  2566. # if the base pointer is used to access it because the
  2567. # base pointer is cleared in the inline assembly code.
  2568. check_exec_crash <<EOF && enable ebp_available
  2569. volatile int i=0;
  2570. __asm__ volatile (
  2571. "xorl %%ebp, %%ebp"
  2572. ::: "%ebp");
  2573. return i;
  2574. EOF
  2575. # check whether EBX is available on x86
  2576. check_asm ebx_available '""::"b"(0)' &&
  2577. check_asm ebx_available '"":::"%ebx"'
  2578. # check whether xmm clobbers are supported
  2579. check_asm xmm_clobbers '"":::"%xmm0"'
  2580. # check whether binutils is new enough to compile SSSE3/MMX2
  2581. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2582. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2583. check_asm bswap '"bswap %%eax" ::: "%eax"'
  2584. if ! disabled_any asm mmx yasm; then
  2585. if check_cmd $yasmexe --version; then
  2586. enabled x86_64 && yasm_extra="-m amd64"
  2587. yasm_debug="-g dwarf2"
  2588. elif check_cmd nasm -v; then
  2589. yasmexe=nasm
  2590. yasm_debug="-g -F dwarf"
  2591. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  2592. fi
  2593. YASMFLAGS="-f $objformat $yasm_extra"
  2594. enabled pic && append YASMFLAGS "-DPIC"
  2595. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2596. case "$objformat" in
  2597. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  2598. esac
  2599. check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
  2600. die "yasm not found, use --disable-yasm for a crippled build"
  2601. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx
  2602. fi
  2603. case "$cpu" in
  2604. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2605. disable fast_clz
  2606. ;;
  2607. esac
  2608. fi
  2609. if enabled asm; then
  2610. as=${gas:=$as}
  2611. check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
  2612. $nogas "GNU assembler not found, install gas-preprocessor"
  2613. fi
  2614. check_ldflags -Wl,--as-needed
  2615. if check_func dlopen; then
  2616. ldl=
  2617. elif check_func dlopen -ldl; then
  2618. ldl=-ldl
  2619. fi
  2620. if enabled network; then
  2621. check_type "sys/types.h sys/socket.h" socklen_t
  2622. check_type netdb.h "struct addrinfo"
  2623. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  2624. check_type netinet/in.h "struct sockaddr_in6"
  2625. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2626. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2627. # Prefer arpa/inet.h over winsock2
  2628. if check_header arpa/inet.h ; then
  2629. check_func closesocket
  2630. elif check_header winsock2.h ; then
  2631. check_func_headers winsock2.h closesocket -lws2 && \
  2632. network_extralibs="-lws2" || \
  2633. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2634. network_extralibs="-lws2_32"; }
  2635. check_type ws2tcpip.h socklen_t
  2636. check_type ws2tcpip.h "struct addrinfo"
  2637. check_type ws2tcpip.h "struct ipv6_mreq"
  2638. check_type ws2tcpip.h "struct sockaddr_in6"
  2639. check_type ws2tcpip.h "struct sockaddr_storage"
  2640. check_struct winsock2.h "struct sockaddr" sa_len
  2641. else
  2642. disable network
  2643. fi
  2644. fi
  2645. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2646. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2647. check_func fcntl
  2648. check_func fork
  2649. check_func getaddrinfo $network_extralibs
  2650. check_func gethrtime
  2651. check_func getrusage
  2652. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2653. check_func inet_aton $network_extralibs
  2654. check_func isatty
  2655. check_func localtime_r
  2656. check_func ${malloc_prefix}memalign && enable memalign
  2657. check_func mkstemp
  2658. check_func mmap
  2659. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2660. check_func setrlimit
  2661. check_func strerror_r
  2662. check_func strptime
  2663. check_func strtok_r
  2664. check_func_headers conio.h kbhit
  2665. check_func_headers windows.h PeekNamedPipe
  2666. check_func_headers io.h setmode
  2667. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2668. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2669. check_func_headers windows.h GetProcessTimes
  2670. check_func_headers windows.h MapViewOfFile
  2671. check_func_headers windows.h VirtualAlloc
  2672. check_header dlfcn.h
  2673. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  2674. check_header libcrystalhd/libcrystalhd_if.h
  2675. check_header malloc.h
  2676. check_header poll.h
  2677. check_header sys/mman.h
  2678. check_header sys/resource.h
  2679. check_header sys/select.h
  2680. check_header termios.h
  2681. check_header vdpau/vdpau.h
  2682. check_header vdpau/vdpau_x11.h
  2683. check_header X11/extensions/XvMClib.h
  2684. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2685. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2686. # check for some common methods of building with pthread support
  2687. # do this before the optional library checks as some of them require pthreads
  2688. if ! disabled pthreads && ! enabled w32threads; then
  2689. enable pthreads
  2690. if check_func pthread_create; then
  2691. :
  2692. elif check_func pthread_create -pthread; then
  2693. add_cflags -pthread
  2694. add_extralibs -pthread
  2695. elif check_func pthread_create -pthreads; then
  2696. add_cflags -pthreads
  2697. add_extralibs -pthreads
  2698. elif check_func pthread_create -lpthreadGC2; then
  2699. add_extralibs -lpthreadGC2
  2700. elif ! check_lib pthread.h pthread_create -lpthread; then
  2701. disable pthreads
  2702. fi
  2703. fi
  2704. for thread in $THREADS_LIST; do
  2705. if enabled $thread; then
  2706. test -n "$thread_type" &&
  2707. die "ERROR: Only one thread type must be selected." ||
  2708. thread_type="$thread"
  2709. fi
  2710. done
  2711. check_lib math.h sin -lm && LIBM="-lm"
  2712. disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  2713. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  2714. check_mathfunc exp2
  2715. check_mathfunc exp2f
  2716. check_mathfunc llrint
  2717. check_mathfunc llrintf
  2718. check_mathfunc log2
  2719. check_mathfunc log2f
  2720. check_mathfunc lrint
  2721. check_mathfunc lrintf
  2722. check_mathfunc round
  2723. check_mathfunc roundf
  2724. check_mathfunc trunc
  2725. check_mathfunc truncf
  2726. # these are off by default, so fail if requested and not available
  2727. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2728. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0
  2729. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  2730. enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
  2731. enabled libdc1394 && require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new
  2732. enabled libdirac && require_pkg_config dirac \
  2733. "libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
  2734. "dirac_decoder_init dirac_encoder_init"
  2735. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2736. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  2737. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2738. enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
  2739. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  2740. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2741. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  2742. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  2743. enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
  2744. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2745. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  2746. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  2747. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2748. enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
  2749. media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
  2750. media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder
  2751. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2752. enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
  2753. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  2754. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  2755. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2756. enabled libvpx && {
  2757. enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  2758. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  2759. enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx ||
  2760. die "ERROR: libvpx encoder version must be >=0.9.6"; } }
  2761. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  2762. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  2763. die "ERROR: libx264 version must be >= 0.118."; }
  2764. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  2765. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2766. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  2767. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  2768. die "ERROR: openal not found"; } &&
  2769. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  2770. die "ERROR: openal version must be 1.1 or compatible"; }
  2771. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2772. SDL_CONFIG="${cross_prefix}sdl-config"
  2773. if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
  2774. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2775. enable sdl &&
  2776. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2777. else
  2778. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  2779. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  2780. sdl_libs=$("${SDL_CONFIG}" --libs)
  2781. check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  2782. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2783. enable sdl &&
  2784. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2785. fi
  2786. fi
  2787. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
  2788. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2789. check_header linux/fb.h
  2790. check_header linux/videodev.h
  2791. check_header linux/videodev2.h
  2792. check_header sys/videoio.h
  2793. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2794. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  2795. # w32api 3.12 had it defined wrong
  2796. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  2797. check_type "dshow.h" IBaseFilter
  2798. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2799. { check_header dev/bktr/ioctl_meteor.h &&
  2800. check_header dev/bktr/ioctl_bt848.h; } ||
  2801. { check_header machine/ioctl_meteor.h &&
  2802. check_header machine/ioctl_bt848.h; } ||
  2803. { check_header dev/video/meteor/ioctl_meteor.h &&
  2804. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2805. check_header dev/ic/bt8xx.h
  2806. check_header sndio.h
  2807. if check_struct sys/soundcard.h audio_buf_info bytes; then
  2808. enable_safe sys/soundcard.h
  2809. else
  2810. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  2811. #include <sys/soundcard.h>
  2812. audio_buf_info abc;
  2813. EOF
  2814. fi
  2815. check_header soundcard.h
  2816. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2817. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait
  2818. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  2819. enabled libcdio &&
  2820. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open "-lcdio_paranoia -lcdio_cdda -lcdio"
  2821. enabled x11grab &&
  2822. check_header X11/Xlib.h &&
  2823. check_header X11/extensions/XShm.h &&
  2824. check_header X11/extensions/Xfixes.h &&
  2825. check_func XOpenDisplay -lX11 &&
  2826. check_func XShmCreateImage -lX11 -lXext &&
  2827. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2828. if ! disabled vaapi; then
  2829. check_lib va/va.h vaInitialize -lva && {
  2830. check_cpp_condition va/va_version.h "VA_CHECK_VERSION(0,32,0)" ||
  2831. warn "Please upgrade to VA-API >= 0.32 if you would like full VA-API support.";
  2832. } || disable vaapi
  2833. fi
  2834. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2835. check_cpp_condition \
  2836. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2837. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2838. disable vdpau; }
  2839. fi
  2840. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2841. # add some useful compiler flags if supported
  2842. check_cflags -Wdeclaration-after-statement
  2843. check_cflags -Wall
  2844. check_cflags -Wno-parentheses
  2845. check_cflags -Wno-switch
  2846. check_cflags -Wno-format-zero-length
  2847. check_cflags -Wdisabled-optimization
  2848. check_cflags -Wpointer-arith
  2849. check_cflags -Wredundant-decls
  2850. check_cflags -Wno-pointer-sign
  2851. check_cflags -Wcast-qual
  2852. check_cflags -Wwrite-strings
  2853. check_cflags -Wtype-limits
  2854. check_cflags -Wundef
  2855. check_cflags -Wmissing-prototypes
  2856. check_cflags -Wno-pointer-to-int-cast
  2857. check_cflags -Wstrict-prototypes
  2858. enabled extra_warnings && check_cflags -Winline
  2859. # add some linker flags
  2860. check_ldflags -Wl,--warn-common
  2861. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
  2862. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  2863. echo "X{};" > $TMPV
  2864. if test_ldflags -Wl,--version-script,$TMPV; then
  2865. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2866. check_cc <<EOF && enable symver_asm_label
  2867. void ff_foo(void) __asm__ ("av_foo@VERSION");
  2868. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  2869. EOF
  2870. check_cc <<EOF && enable symver_gnu_asm
  2871. __asm__(".symver ff_foo,av_foo@VERSION");
  2872. void ff_foo(void) {}
  2873. EOF
  2874. fi
  2875. if [ -n "$optflags" ]; then
  2876. add_cflags $optflags
  2877. elif enabled small; then
  2878. add_cflags $size_cflags
  2879. elif enabled optimizations; then
  2880. add_cflags $speed_cflags
  2881. else
  2882. add_cflags $noopt_cflags
  2883. fi
  2884. check_cflags -fno-math-errno
  2885. check_cflags -fno-signed-zeros
  2886. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  2887. int x;
  2888. EOF
  2889. if enabled icc; then
  2890. # Just warnings, no remarks
  2891. check_cflags -w1
  2892. # -wd: Disable following warnings
  2893. # 144, 167, 556: -Wno-pointer-sign
  2894. # 1292: attribute "foo" ignored
  2895. # 10006: ignoring unknown option -fno-signed-zeros
  2896. # 10148: ignoring unknown option -Wno-parentheses
  2897. # 10156: ignoring option '-W'; no argument required
  2898. check_cflags -wd144,167,556,1292,10006,10148,10156
  2899. # 11030: Warning unknown option --as-needed
  2900. # 10156: ignoring option '-export'; no argument required
  2901. check_ldflags -wd10156,11030
  2902. # Allow to compile with optimizations
  2903. check_ldflags -march=$cpu
  2904. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2905. enable ebp_available
  2906. if enabled x86_32; then
  2907. test ${icc_version%%.*} -ge 11 && \
  2908. check_cflags -falign-stack=maintain-16-byte || \
  2909. disable aligned_stack
  2910. fi
  2911. elif enabled ccc; then
  2912. # disable some annoying warnings
  2913. add_cflags -msg_disable cvtu32to64
  2914. add_cflags -msg_disable embedcomment
  2915. add_cflags -msg_disable needconstext
  2916. add_cflags -msg_disable nomainieee
  2917. add_cflags -msg_disable ptrmismatch1
  2918. add_cflags -msg_disable unreachcode
  2919. elif enabled gcc; then
  2920. check_cflags -fno-tree-vectorize
  2921. check_cflags -Werror=implicit-function-declaration
  2922. check_cflags -Werror=missing-prototypes
  2923. elif enabled llvm_gcc; then
  2924. check_cflags -mllvm -stack-alignment=16
  2925. elif enabled clang; then
  2926. check_cflags -mllvm -stack-alignment=16
  2927. check_cflags -Qunused-arguments
  2928. elif enabled armcc; then
  2929. # 2523: use of inline assembler is deprecated
  2930. add_cflags -W${armcc_opt},--diag_suppress=2523
  2931. add_cflags -W${armcc_opt},--diag_suppress=1207
  2932. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  2933. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  2934. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  2935. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  2936. elif enabled tms470; then
  2937. add_cflags -pds=824 -pds=837
  2938. elif enabled pathscale; then
  2939. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  2940. fi
  2941. enabled_any $THREADS_LIST && enable threads
  2942. check_deps $CONFIG_LIST \
  2943. $CONFIG_EXTRA \
  2944. $HAVE_LIST \
  2945. $DECODER_LIST \
  2946. $ENCODER_LIST \
  2947. $HWACCEL_LIST \
  2948. $PARSER_LIST \
  2949. $BSF_LIST \
  2950. $DEMUXER_LIST \
  2951. $MUXER_LIST \
  2952. $FILTER_LIST \
  2953. $INDEV_LIST \
  2954. $OUTDEV_LIST \
  2955. $PROTOCOL_LIST \
  2956. $ACODEC_TESTS \
  2957. $VCODEC_TESTS \
  2958. $LAVF_TESTS \
  2959. $LAVFI_TESTS \
  2960. $SEEK_TESTS \
  2961. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  2962. if test $target_os = "haiku"; then
  2963. disable memalign
  2964. disable posix_memalign
  2965. fi
  2966. ! enabled_any memalign posix_memalign malloc_aligned &&
  2967. enabled_any $need_memalign && enable memalign_hack
  2968. echo "install prefix $prefix"
  2969. echo "source path $source_path"
  2970. echo "C compiler $cc"
  2971. echo "ARCH $arch ($cpu)"
  2972. if test "$build_suffix" != ""; then
  2973. echo "build suffix $build_suffix"
  2974. fi
  2975. if test "$progs_suffix" != ""; then
  2976. echo "progs suffix $progs_suffix"
  2977. fi
  2978. if test "$extra_version" != ""; then
  2979. echo "version string suffix $extra_version"
  2980. fi
  2981. echo "big-endian ${bigendian-no}"
  2982. echo "runtime cpu detection ${runtime_cpudetect-no}"
  2983. if enabled x86; then
  2984. echo "${yasmexe} ${yasm-no}"
  2985. echo "MMX enabled ${mmx-no}"
  2986. echo "MMX2 enabled ${mmx2-no}"
  2987. echo "3DNow! enabled ${amd3dnow-no}"
  2988. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2989. echo "SSE enabled ${sse-no}"
  2990. echo "SSSE3 enabled ${ssse3-no}"
  2991. echo "AVX enabled ${avx-no}"
  2992. echo "CMOV enabled ${cmov-no}"
  2993. echo "CMOV is fast ${fast_cmov-no}"
  2994. echo "EBX available ${ebx_available-no}"
  2995. echo "EBP available ${ebp_available-no}"
  2996. fi
  2997. if enabled arm; then
  2998. echo "ARMv5TE enabled ${armv5te-no}"
  2999. echo "ARMv6 enabled ${armv6-no}"
  3000. echo "ARMv6T2 enabled ${armv6t2-no}"
  3001. echo "ARM VFP enabled ${armvfp-no}"
  3002. echo "IWMMXT enabled ${iwmmxt-no}"
  3003. echo "NEON enabled ${neon-no}"
  3004. fi
  3005. if enabled mips; then
  3006. echo "MMI enabled ${mmi-no}"
  3007. fi
  3008. if enabled ppc; then
  3009. echo "AltiVec enabled ${altivec-no}"
  3010. echo "PPC 4xx optimizations ${ppc4xx-no}"
  3011. echo "dcbzl available ${dcbzl-no}"
  3012. fi
  3013. if enabled sparc; then
  3014. echo "VIS enabled ${vis-no}"
  3015. fi
  3016. echo "debug symbols ${debug-no}"
  3017. echo "strip symbols ${stripping-no}"
  3018. echo "optimize for size ${small-no}"
  3019. echo "optimizations ${optimizations-no}"
  3020. echo "static ${static-no}"
  3021. echo "shared ${shared-no}"
  3022. echo "postprocessing support ${postproc-no}"
  3023. echo "new filter support ${avfilter-no}"
  3024. echo "network support ${network-no}"
  3025. echo "threading support ${thread_type-no}"
  3026. echo "SDL support ${sdl-no}"
  3027. echo "Sun medialib support ${mlib-no}"
  3028. echo "libdxva2 enabled ${dxva2-no}"
  3029. echo "libva enabled ${vaapi-no}"
  3030. echo "libvdpau enabled ${vdpau-no}"
  3031. echo "AVISynth enabled ${avisynth-no}"
  3032. echo "libcelt enabled ${libcelt-no}"
  3033. echo "frei0r enabled ${frei0r-no}"
  3034. echo "libcdio support ${libcdio-no}"
  3035. echo "libdc1394 support ${libdc1394-no}"
  3036. echo "libdirac enabled ${libdirac-no}"
  3037. echo "libfaac enabled ${libfaac-no}"
  3038. echo "libaacplus enabled ${libaacplus-no}"
  3039. echo "libgsm enabled ${libgsm-no}"
  3040. echo "libmodplug enabled ${libmodplug-no}"
  3041. echo "libmp3lame enabled ${libmp3lame-no}"
  3042. echo "libnut enabled ${libnut-no}"
  3043. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  3044. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  3045. echo "libopencv support ${libopencv-no}"
  3046. echo "libopenjpeg enabled ${libopenjpeg-no}"
  3047. echo "librtmp enabled ${librtmp-no}"
  3048. echo "libschroedinger enabled ${libschroedinger-no}"
  3049. echo "libspeex enabled ${libspeex-no}"
  3050. echo "libstagefright-h264 enabled ${libstagefright_h264-no}"
  3051. echo "libtheora enabled ${libtheora-no}"
  3052. echo "libutvideo enabled ${libutvideo-no}"
  3053. echo "libvo-aacenc support ${libvo_aacenc-no}"
  3054. echo "libvo-amrwbenc support ${libvo_amrwbenc-no}"
  3055. echo "libvorbis enabled ${libvorbis-no}"
  3056. echo "libvpx enabled ${libvpx-no}"
  3057. echo "libx264 enabled ${libx264-no}"
  3058. echo "libxavs enabled ${libxavs-no}"
  3059. echo "libxvid enabled ${libxvid-no}"
  3060. echo "openal enabled ${openal-no}"
  3061. echo "zlib enabled ${zlib-no}"
  3062. echo "bzlib enabled ${bzlib-no}"
  3063. echo
  3064. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  3065. echo "Enabled ${type}s:"
  3066. eval list=\$$(toupper $type)_LIST
  3067. print_enabled '_*' $list | sort | pr -r -3 -t
  3068. echo
  3069. done
  3070. license="LGPL version 2.1 or later"
  3071. if enabled nonfree; then
  3072. license="nonfree and unredistributable"
  3073. elif enabled gplv3; then
  3074. license="GPL version 3 or later"
  3075. elif enabled lgplv3; then
  3076. license="LGPL version 3 or later"
  3077. elif enabled gpl; then
  3078. license="GPL version 2 or later"
  3079. fi
  3080. echo "License: $license"
  3081. echo "Creating config.mak and config.h..."
  3082. test -e Makefile || $ln_s "$source_path/Makefile" .
  3083. enabled stripping || strip="echo skipping strip"
  3084. config_files="$TMPH config.mak"
  3085. cat > config.mak <<EOF
  3086. # Automatically generated by configure - do not modify!
  3087. ifndef FFMPEG_CONFIG_MAK
  3088. FFMPEG_CONFIG_MAK=1
  3089. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  3090. prefix=$prefix
  3091. LIBDIR=\$(DESTDIR)$libdir
  3092. SHLIBDIR=\$(DESTDIR)$shlibdir
  3093. INCDIR=\$(DESTDIR)$incdir
  3094. BINDIR=\$(DESTDIR)$bindir
  3095. DATADIR=\$(DESTDIR)$datadir
  3096. MANDIR=\$(DESTDIR)$mandir
  3097. SRC_PATH=$source_path
  3098. ifndef MAIN_MAKEFILE
  3099. SRC_PATH:=\$(SRC_PATH:.%=..%)
  3100. endif
  3101. CC_IDENT=$cc_ident
  3102. ARCH=$arch
  3103. CC=$cc
  3104. CXX=$cxx
  3105. AS=$as
  3106. LD=$ld
  3107. DEPCC=$dep_cc
  3108. YASM=$yasmexe
  3109. YASMDEP=$yasmexe
  3110. AR=$ar
  3111. RANLIB=$ranlib
  3112. CP=cp -p
  3113. LN_S=$ln_s
  3114. STRIP=$strip
  3115. CPPFLAGS=$CPPFLAGS
  3116. CFLAGS=$CFLAGS
  3117. CXXFLAGS=$CXXFLAGS
  3118. ASFLAGS=$ASFLAGS
  3119. AS_O=$CC_O
  3120. CC_O=$CC_O
  3121. CXX_O=$CXX_O
  3122. LDFLAGS=$LDFLAGS
  3123. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  3124. SHFLAGS=$SHFLAGS
  3125. YASMFLAGS=$YASMFLAGS
  3126. BUILDSUF=$build_suffix
  3127. PROGSSUF=$progs_suffix
  3128. FULLNAME=$FULLNAME
  3129. LIBPREF=$LIBPREF
  3130. LIBSUF=$LIBSUF
  3131. LIBNAME=$LIBNAME
  3132. SLIBPREF=$SLIBPREF
  3133. SLIBSUF=$SLIBSUF
  3134. EXESUF=$EXESUF
  3135. EXTRA_VERSION=$extra_version
  3136. DEPFLAGS=$DEPFLAGS
  3137. CCDEP=$CCDEP
  3138. CXXDEP=$CXXDEP
  3139. ASDEP=$ASDEP
  3140. CC_DEPFLAGS=$CC_DEPFLAGS
  3141. AS_DEPFLAGS=$AS_DEPFLAGS
  3142. HOSTCC=$host_cc
  3143. HOSTCFLAGS=$host_cflags
  3144. HOSTEXESUF=$HOSTEXESUF
  3145. HOSTLDFLAGS=$host_ldflags
  3146. HOSTLIBS=$host_libs
  3147. TARGET_EXEC=$target_exec
  3148. TARGET_PATH=$target_path
  3149. SDL_LIBS=$sdl_libs
  3150. SDL_CFLAGS=$sdl_cflags
  3151. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  3152. EXTRALIBS=$extralibs
  3153. INSTALL=$install
  3154. LIBTARGET=${LIBTARGET}
  3155. SLIBNAME=${SLIBNAME}
  3156. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  3157. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  3158. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  3159. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  3160. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  3161. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  3162. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  3163. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  3164. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  3165. NOREDZONE_FLAGS=$noredzone_flags
  3166. EOF
  3167. get_version(){
  3168. name=$1
  3169. file=$source_path/$2
  3170. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  3171. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  3172. lcname=$(tolower $name)
  3173. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  3174. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  3175. }
  3176. get_version LIBSWSCALE libswscale/swscale.h
  3177. get_version LIBSWRESAMPLE libswresample/swresample.h
  3178. get_version LIBPOSTPROC libpostproc/postprocess.h
  3179. get_version LIBAVCODEC libavcodec/version.h
  3180. get_version LIBAVDEVICE libavdevice/avdevice.h
  3181. get_version LIBAVFORMAT libavformat/version.h
  3182. get_version LIBAVUTIL libavutil/avutil.h
  3183. get_version LIBAVFILTER libavfilter/avfilter.h
  3184. cat > $TMPH <<EOF
  3185. /* Automatically generated by configure - do not modify! */
  3186. #ifndef FFMPEG_CONFIG_H
  3187. #define FFMPEG_CONFIG_H
  3188. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  3189. #define FFMPEG_LICENSE "$(c_escape $license)"
  3190. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  3191. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  3192. #define CC_TYPE "$cc_type"
  3193. #define CC_VERSION $cc_version
  3194. #define restrict $_restrict
  3195. #define EXTERN_PREFIX "${extern_prefix}"
  3196. #define EXTERN_ASM ${extern_prefix}
  3197. #define SLIBSUF "$SLIBSUF"
  3198. EOF
  3199. test -n "$malloc_prefix" &&
  3200. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  3201. if enabled small || disabled optimizations; then
  3202. echo "#undef av_always_inline" >> $TMPH
  3203. if enabled small; then
  3204. echo "#define av_always_inline inline" >> $TMPH
  3205. else
  3206. echo "#define av_always_inline av_unused" >> $TMPH
  3207. fi
  3208. fi
  3209. if enabled yasm; then
  3210. append config_files $TMPASM
  3211. printf '' >$TMPASM
  3212. fi
  3213. print_config ARCH_ "$config_files" $ARCH_LIST
  3214. print_config HAVE_ "$config_files" $HAVE_LIST
  3215. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  3216. $CONFIG_EXTRA \
  3217. $DECODER_LIST \
  3218. $ENCODER_LIST \
  3219. $HWACCEL_LIST \
  3220. $PARSER_LIST \
  3221. $BSF_LIST \
  3222. $DEMUXER_LIST \
  3223. $MUXER_LIST \
  3224. $FILTER_LIST \
  3225. $PROTOCOL_LIST \
  3226. $INDEV_LIST \
  3227. $OUTDEV_LIST \
  3228. cat >>config.mak <<EOF
  3229. ACODEC_TESTS=$(print_enabled -n _test $ACODEC_TESTS)
  3230. VCODEC_TESTS=$(print_enabled -n _test $VCODEC_TESTS)
  3231. LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS)
  3232. LAVFI_TESTS=$(print_enabled -n _test $LAVFI_TESTS)
  3233. SEEK_TESTS=$(print_enabled -n _test $SEEK_TESTS)
  3234. EOF
  3235. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  3236. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  3237. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  3238. cp_if_changed $TMPH config.h
  3239. touch .config
  3240. enabled yasm && cp_if_changed $TMPASM config.asm
  3241. cat > $TMPH <<EOF
  3242. /* Generated by ffconf */
  3243. #ifndef AVUTIL_AVCONFIG_H
  3244. #define AVUTIL_AVCONFIG_H
  3245. EOF
  3246. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  3247. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  3248. cp_if_changed $TMPH libavutil/avconfig.h
  3249. test -n "$WARNINGS" && printf "\n$WARNINGS"
  3250. # build pkg-config files
  3251. pkgconfig_generate(){
  3252. name=$1
  3253. shortname=${name#lib}${build_suffix}
  3254. comment=$2
  3255. version=$3
  3256. libs=$4
  3257. requires=$5
  3258. enabled ${name#lib} || return 0
  3259. mkdir -p $name
  3260. cat <<EOF > $name/$name.pc
  3261. prefix=$prefix
  3262. exec_prefix=\${prefix}
  3263. libdir=$libdir
  3264. includedir=$incdir
  3265. Name: $name
  3266. Description: $comment
  3267. Version: $version
  3268. Requires: $(enabled shared || echo $requires)
  3269. Requires.private: $(enabled shared && echo $requires)
  3270. Conflicts:
  3271. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3272. Libs.private: $(enabled shared && echo $libs)
  3273. Cflags: -I\${includedir}
  3274. EOF
  3275. cat <<EOF > $name/$name-uninstalled.pc
  3276. prefix=
  3277. exec_prefix=
  3278. libdir=\${pcfiledir}
  3279. includedir=${source_path}
  3280. Name: $name
  3281. Description: $comment
  3282. Version: $version
  3283. Requires: $requires
  3284. Conflicts:
  3285. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  3286. Cflags: -I\${includedir}
  3287. EOF
  3288. }
  3289. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  3290. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3291. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  3292. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  3293. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
  3294. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
  3295. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"
  3296. pkgconfig_generate libswresample "FFmpeg audio rescaling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"