configure 89 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183
  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.err]
  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-ffplay disable ffplay build
  76. --disable-ffprobe disable ffprobe build
  77. --disable-ffserver disable ffserver build
  78. --disable-avdevice disable libavdevice build
  79. --disable-avcodec disable libavcodec build
  80. --disable-avformat disable libavformat build
  81. --disable-swscale disable libswscale build
  82. --enable-postproc enable GPLed postprocessing support [no]
  83. --enable-avfilter video filter support [no]
  84. --enable-avfilter-lavf video filters dependent on avformat [no]
  85. --enable-beosthreads use BeOS threads [no]
  86. --enable-os2threads use OS/2 threads [no]
  87. --enable-pthreads use pthreads [no]
  88. --enable-w32threads use Win32 threads [no]
  89. --enable-x11grab enable X11 grabbing [no]
  90. --disable-network disable network support [no]
  91. --disable-mpegaudio-hp faster (but less accurate) MPEG audio decoding [no]
  92. --enable-gray enable full grayscale support (slower color)
  93. --disable-swscale-alpha disable alpha channel support in swscale
  94. --disable-fastdiv disable table-based division
  95. --enable-small optimize for size instead of speed
  96. --disable-aandct disable AAN DCT code
  97. --disable-dct disable DCT code
  98. --disable-fft disable FFT code
  99. --disable-golomb disable Golomb code
  100. --disable-lpc disable LPC code
  101. --disable-mdct disable MDCT code
  102. --disable-rdft disable RDFT code
  103. --disable-vaapi disable VAAPI code
  104. --disable-vdpau disable VDPAU code
  105. --disable-dxva2 disable DXVA2 code
  106. --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  107. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  108. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  109. --enable-beos-netserver enable BeOS netserver
  110. --disable-everything disable all components listed below
  111. --disable-encoder=NAME disable encoder NAME
  112. --enable-encoder=NAME enable encoder NAME
  113. --disable-encoders disable all encoders
  114. --disable-decoder=NAME disable decoder NAME
  115. --enable-decoder=NAME enable decoder NAME
  116. --disable-decoders disable all decoders
  117. --disable-hwaccel=NAME disable hwaccel NAME
  118. --enable-hwaccel=NAME enable hwaccel NAME
  119. --disable-hwaccels disable all hwaccels
  120. --disable-muxer=NAME disable muxer NAME
  121. --enable-muxer=NAME enable muxer NAME
  122. --disable-muxers disable all muxers
  123. --disable-demuxer=NAME disable demuxer NAME
  124. --enable-demuxer=NAME enable demuxer NAME
  125. --disable-demuxers disable all demuxers
  126. --enable-parser=NAME enable parser NAME
  127. --disable-parser=NAME disable parser NAME
  128. --disable-parsers disable all parsers
  129. --enable-bsf=NAME enable bitstream filter NAME
  130. --disable-bsf=NAME disable bitstream filter NAME
  131. --disable-bsfs disable all bitstream filters
  132. --enable-protocol=NAME enable protocol NAME
  133. --disable-protocol=NAME disable protocol NAME
  134. --disable-protocols disable all protocols
  135. --disable-indev=NAME disable input device NAME
  136. --disable-outdev=NAME disable output device NAME
  137. --disable-indevs disable input devices
  138. --disable-outdevs disable output devices
  139. --disable-devices disable all devices
  140. --enable-filter=NAME enable filter NAME
  141. --disable-filter=NAME disable filter NAME
  142. --disable-filters disable all filters
  143. --list-decoders show all available decoders
  144. --list-encoders show all available encoders
  145. --list-hwaccels show all available hardware accelerators
  146. --list-muxers show all available muxers
  147. --list-demuxers show all available demuxers
  148. --list-parsers show all available parsers
  149. --list-protocols show all available protocols
  150. --list-bsfs show all available bitstream filters
  151. --list-indevs show all available input devices
  152. --list-outdevs show all available output devices
  153. --list-filters show all available filters
  154. External library support:
  155. --enable-avisynth enable reading of AVISynth script files [no]
  156. --enable-bzlib enable bzlib [autodetect]
  157. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  158. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  159. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  160. and libraw1394 [no]
  161. --enable-libdirac enable Dirac support via libdirac [no]
  162. --enable-libfaac enable FAAC support via libfaac [no]
  163. --enable-libfaad enable FAAD support via libfaad [no]
  164. --enable-libfaadbin open libfaad.so.0 at runtime [no]
  165. --enable-libgsm enable GSM support via libgsm [no]
  166. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  167. --enable-libnut enable NUT (de)muxing via libnut,
  168. native (de)muxer exists [no]
  169. --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]
  170. --enable-librtmp enable RTMP[E] support via librtmp [no]
  171. --enable-libschroedinger enable Dirac support via libschroedinger [no]
  172. --enable-libspeex enable Speex decoding via libspeex [no]
  173. --enable-libtheora enable Theora encoding via libtheora [no]
  174. --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
  175. --enable-libvorbis enable Vorbis encoding via libvorbis,
  176. native implementation exists [no]
  177. --enable-libvpx enable VP8 support via libvpx [no]
  178. --enable-libx264 enable H.264 encoding via x264 [no]
  179. --enable-libxvid enable Xvid encoding via xvidcore,
  180. native MPEG-4/Xvid encoder exists [no]
  181. --enable-mlib enable Sun medialib [no]
  182. --enable-zlib enable zlib [autodetect]
  183. Advanced options (experts only):
  184. --source-path=PATH path to source code [$source_path]
  185. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  186. --enable-cross-compile assume a cross-compiler is used
  187. --sysroot=PATH root of cross-build tree
  188. --sysinclude=PATH location of cross-build system headers
  189. --target-os=OS compiler targets OS [$target_os]
  190. --target-exec=CMD command to run executables on target
  191. --target-path=DIR path to view of build directory on target
  192. --nm=NM use nm tool
  193. --ar=AR use archive tool AR [$ar_default]
  194. --as=AS use assembler AS [$as_default]
  195. --cc=CC use C compiler CC [$cc_default]
  196. --ld=LD use linker LD
  197. --host-cc=HOSTCC use host C compiler HOSTCC
  198. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  199. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  200. --host-libs=HLIBS use libs HLIBS when linking for host
  201. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  202. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  203. --extra-libs=ELIBS add ELIBS [$ELIBS]
  204. --extra-version=STRING version string suffix []
  205. --build-suffix=SUFFIX library name suffix []
  206. --arch=ARCH select architecture [$arch]
  207. --cpu=CPU select the minimum required CPU (affects
  208. instruction selection, may crash on older CPUs)
  209. --enable-powerpc-perf enable performance report on PPC
  210. (requires enabling PMC)
  211. --disable-asm disable all assembler optimizations
  212. --disable-altivec disable AltiVec optimizations
  213. --disable-amd3dnow disable 3DNow! optimizations
  214. --disable-amd3dnowext disable 3DNow! extended optimizations
  215. --disable-mmx disable MMX optimizations
  216. --disable-mmx2 disable MMX2 optimizations
  217. --disable-sse disable SSE optimizations
  218. --disable-ssse3 disable SSSE3 optimizations
  219. --disable-armv5te disable armv5te optimizations
  220. --disable-armv6 disable armv6 optimizations
  221. --disable-armv6t2 disable armv6t2 optimizations
  222. --disable-armvfp disable ARM VFP optimizations
  223. --disable-iwmmxt disable iwmmxt optimizations
  224. --disable-mmi disable MMI optimizations
  225. --disable-neon disable neon optimizations
  226. --disable-vis disable VIS optimizations
  227. --disable-yasm disable use of yasm assembler
  228. --enable-pic build position-independent code
  229. --malloc-prefix=PFX prefix malloc and related names with PFX
  230. --enable-sram allow use of on-chip SRAM
  231. Developer options (useful when working on FFmpeg itself):
  232. --disable-debug disable debugging symbols
  233. --enable-debug=LEVEL set the debug level [$debuglevel]
  234. --enable-gprof enable profiling with gprof [$gprof]
  235. --disable-optimizations disable compiler optimizations
  236. --enable-extra-warnings enable more compiler warnings
  237. --disable-stripping disable stripping of executables and shared libraries
  238. --samples=PATH location of test samples for FATE
  239. NOTE: Object files are built at the place where configure is launched.
  240. EOF
  241. exit 0
  242. }
  243. quotes='""'
  244. log(){
  245. echo "$@" >> $logfile
  246. }
  247. log_file(){
  248. log BEGIN $1
  249. pr -n -t $1 >> $logfile
  250. log END $1
  251. }
  252. echolog(){
  253. log "$@"
  254. echo "$@"
  255. }
  256. die(){
  257. echolog "$@"
  258. cat <<EOF
  259. If you think configure made a mistake, make sure you are using the latest
  260. version from SVN. If the latest version fails, report the problem to the
  261. ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
  262. EOF
  263. if disabled logging; then
  264. cat <<EOF
  265. Rerun configure with logging enabled (do not use --disable-logging), and
  266. include the log this produces with your report.
  267. EOF
  268. else
  269. cat <<EOF
  270. Include the log file "$logfile" produced by configure as this will help
  271. solving the problem.
  272. EOF
  273. fi
  274. exit 1
  275. }
  276. # Avoid locale weirdness, besides we really just want to translate ASCII.
  277. toupper(){
  278. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  279. }
  280. tolower(){
  281. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  282. }
  283. c_escape(){
  284. echo "$*" | sed 's/["\\]/\\\0/g'
  285. }
  286. sh_quote(){
  287. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  288. test "$v" = "${v#*[ |&;<>()$\`\\\"\'*?\[\]#~=%]}" || v="'$v'"
  289. echo "$v"
  290. }
  291. filter(){
  292. pat=$1
  293. shift
  294. for v; do
  295. eval "case $v in $pat) echo $v ;; esac"
  296. done
  297. }
  298. map(){
  299. m=$1
  300. shift
  301. for v; do eval $m; done
  302. }
  303. set_all(){
  304. value=$1
  305. shift
  306. for var in $*; do
  307. eval $var=$value
  308. done
  309. }
  310. set_weak(){
  311. value=$1
  312. shift
  313. for var; do
  314. eval : \${$var:=$value}
  315. done
  316. }
  317. pushvar(){
  318. for var in $*; do
  319. eval level=\${${var}_level:=0}
  320. eval ${var}_${level}="\$$var"
  321. eval ${var}_level=$(($level+1))
  322. done
  323. }
  324. popvar(){
  325. for var in $*; do
  326. eval level=\${${var}_level:-0}
  327. test $level = 0 && continue
  328. eval level=$(($level-1))
  329. eval $var="\${${var}_${level}}"
  330. eval ${var}_level=$level
  331. eval unset ${var}_${level}
  332. done
  333. }
  334. enable(){
  335. set_all yes $*
  336. }
  337. disable(){
  338. set_all no $*
  339. }
  340. enable_weak(){
  341. set_weak yes $*
  342. }
  343. disable_weak(){
  344. set_weak no $*
  345. }
  346. enable_safe(){
  347. for var; do
  348. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  349. done
  350. }
  351. disable_safe(){
  352. for var; do
  353. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  354. done
  355. }
  356. do_enable_deep(){
  357. for var; do
  358. enabled $var && continue
  359. eval sel="\$${var}_select"
  360. eval sgs="\$${var}_suggest"
  361. pushvar var sgs
  362. enable_deep $sel
  363. popvar sgs
  364. enable_deep_weak $sgs
  365. popvar var
  366. done
  367. }
  368. enable_deep(){
  369. do_enable_deep $*
  370. enable $*
  371. }
  372. enable_deep_weak(){
  373. do_enable_deep $*
  374. enable_weak $*
  375. }
  376. enabled(){
  377. test "${1#!}" = "$1" && op== || op=!=
  378. eval test "x\$${1#!}" $op "xyes"
  379. }
  380. disabled(){
  381. test "${1#!}" = "$1" && op== || op=!=
  382. eval test "x\$${1#!}" $op "xno"
  383. }
  384. enabled_all(){
  385. for opt; do
  386. enabled $opt || return 1
  387. done
  388. }
  389. disabled_all(){
  390. for opt; do
  391. disabled $opt || return 1
  392. done
  393. }
  394. enabled_any(){
  395. for opt; do
  396. enabled $opt && return 0
  397. done
  398. }
  399. disabled_any(){
  400. for opt; do
  401. disabled $opt && return 0
  402. done
  403. return 1
  404. }
  405. set_default(){
  406. for opt; do
  407. eval : \${$opt:=\$${opt}_default}
  408. done
  409. }
  410. is_in(){
  411. value=$1
  412. shift
  413. for var in $*; do
  414. [ $var = $value ] && return 0
  415. done
  416. return 1
  417. }
  418. check_deps(){
  419. for cfg; do
  420. cfg="${cfg#!}"
  421. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  422. disabled ${cfg}_checking && continue
  423. enable ${cfg}_checking
  424. eval dep_all="\$${cfg}_deps"
  425. eval dep_any="\$${cfg}_deps_any"
  426. eval dep_sel="\$${cfg}_select"
  427. eval dep_sgs="\$${cfg}_suggest"
  428. eval dep_ifa="\$${cfg}_if"
  429. eval dep_ifn="\$${cfg}_if_any"
  430. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  431. check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  432. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  433. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  434. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  435. enabled_all $dep_all || disable $cfg
  436. enabled_any $dep_any || disable $cfg
  437. disabled_any $dep_sel && disable $cfg
  438. if enabled $cfg; then
  439. eval dep_extralibs="\$${cfg}_extralibs"
  440. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  441. enable_deep $dep_sel
  442. enable_deep_weak $dep_sgs
  443. fi
  444. disable ${cfg}_checking
  445. done
  446. }
  447. print_config(){
  448. pfx=$1
  449. header=$2
  450. makefile=$3
  451. shift 3
  452. for cfg; do
  453. ucname="$(toupper $cfg)"
  454. if enabled $cfg; then
  455. echo "#define ${pfx}${ucname} 1" >> $header
  456. echo "${pfx}${ucname}=yes" >> $makefile
  457. else
  458. echo "#define ${pfx}${ucname} 0" >> $header
  459. echo "!${pfx}${ucname}=yes" >> $makefile
  460. fi
  461. done
  462. }
  463. flags_saved(){
  464. (: ${SAVE_CFLAGS?}) 2> /dev/null
  465. }
  466. save_flags(){
  467. flags_saved && return
  468. SAVE_CFLAGS="$CFLAGS"
  469. SAVE_LDFLAGS="$LDFLAGS"
  470. SAVE_extralibs="$extralibs"
  471. }
  472. restore_flags(){
  473. flags_saved || return
  474. CFLAGS="$SAVE_CFLAGS"
  475. LDFLAGS="$SAVE_LDFLAGS"
  476. extralibs="$SAVE_extralibs"
  477. unset SAVE_CFLAGS
  478. unset SAVE_LDFLAGS
  479. unset SAVE_extralibs
  480. }
  481. temp_cflags(){
  482. save_flags
  483. CFLAGS="$CFLAGS $*"
  484. }
  485. temp_ldflags(){
  486. save_flags
  487. LDFLAGS="$LDFLAGS $*"
  488. }
  489. temp_extralibs(){
  490. save_flags
  491. extralibs="$extralibs $*"
  492. }
  493. append(){
  494. var=$1
  495. shift
  496. flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
  497. eval "$var=\"\$$var $*\""
  498. }
  499. add_cppflags(){
  500. append CPPFLAGS $($filter_cppflags "$@")
  501. }
  502. add_cflags(){
  503. append CFLAGS $($filter_cflags "$@")
  504. }
  505. add_asflags(){
  506. append ASFLAGS $($filter_asflags "$@")
  507. }
  508. add_ldflags(){
  509. append LDFLAGS "$@"
  510. }
  511. add_extralibs(){
  512. append extralibs "$@"
  513. }
  514. check_cmd(){
  515. log "$@"
  516. "$@" >> $logfile 2>&1
  517. }
  518. check_cc(){
  519. log check_cc "$@"
  520. cat > $TMPC
  521. log_file $TMPC
  522. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
  523. }
  524. check_cpp(){
  525. log check_cpp "$@"
  526. cat > $TMPC
  527. log_file $TMPC
  528. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
  529. }
  530. check_as(){
  531. log check_as "$@"
  532. cat > $TMPC
  533. log_file $TMPC
  534. check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
  535. }
  536. check_asm(){
  537. log check_asm "$@"
  538. name="$1"
  539. code="$2"
  540. shift 2
  541. disable $name
  542. check_as "$@" <<EOF && enable $name
  543. void foo(void){ __asm__ volatile($code); }
  544. EOF
  545. }
  546. check_yasm(){
  547. log check_yasm "$@"
  548. echo "$1" > $TMPS
  549. log_file $TMPS
  550. shift 1
  551. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  552. }
  553. check_ld(){
  554. log check_ld "$@"
  555. flags=''
  556. libs=''
  557. for f; do
  558. test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
  559. done
  560. check_cc $($filter_cflags $flags) || return
  561. check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
  562. }
  563. check_cppflags(){
  564. log check_cppflags "$@"
  565. set -- $($filter_cppflags "$@")
  566. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  567. int x;
  568. EOF
  569. }
  570. check_cflags(){
  571. log check_cflags "$@"
  572. set -- $($filter_cflags "$@")
  573. check_cc "$@" <<EOF && append CFLAGS "$@"
  574. int x;
  575. EOF
  576. }
  577. test_ldflags(){
  578. log test_ldflags "$@"
  579. check_ld "$@" <<EOF
  580. int main(void){ return 0; }
  581. EOF
  582. }
  583. check_ldflags(){
  584. log check_ldflags "$@"
  585. test_ldflags "$@" && add_ldflags "$@"
  586. }
  587. check_header(){
  588. log check_header "$@"
  589. header=$1
  590. shift
  591. disable_safe $header
  592. check_cpp "$@" <<EOF && enable_safe $header
  593. #include <$header>
  594. int x;
  595. EOF
  596. }
  597. check_func(){
  598. log check_func "$@"
  599. func=$1
  600. shift
  601. disable $func
  602. check_ld "$@" <<EOF && enable $func
  603. extern int $func();
  604. int main(void){ $func(); }
  605. EOF
  606. }
  607. check_mathfunc(){
  608. log check_mathfunc "$@"
  609. func=$1
  610. shift
  611. disable $func
  612. check_ld "$@" <<EOF && enable $func
  613. #include <math.h>
  614. float foo(float f) { return $func(f); }
  615. int main(void){ return 0; }
  616. EOF
  617. }
  618. check_func_headers(){
  619. log check_func_headers "$@"
  620. headers=$1
  621. func=$2
  622. shift 2
  623. disable $func
  624. incs=""
  625. for hdr in $headers; do
  626. incs="$incs
  627. #include <$hdr>"
  628. done
  629. check_ld "$@" <<EOF && enable $func && enable_safe $headers
  630. $incs
  631. int main(int argc, char **argv){
  632. return (long) $func;
  633. }
  634. EOF
  635. }
  636. check_cpp_condition(){
  637. log check_cpp_condition "$@"
  638. header=$1
  639. condition=$2
  640. shift 2
  641. check_cpp $($filter_cppflags "$@") <<EOF
  642. #include <$header>
  643. #if !($condition)
  644. #error "unsatisfied condition: $condition"
  645. #endif
  646. EOF
  647. }
  648. check_lib(){
  649. log check_lib "$@"
  650. header="$1"
  651. func="$2"
  652. shift 2
  653. temp_extralibs "$@"
  654. check_header $header && check_func $func && add_extralibs "$@"
  655. err=$?
  656. restore_flags
  657. return $err
  658. }
  659. check_lib2(){
  660. log check_lib2 "$@"
  661. headers="$1"
  662. func="$2"
  663. shift 2
  664. check_func_headers "$headers" $func "$@" && add_extralibs "$@"
  665. }
  666. check_exec(){
  667. check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  668. }
  669. check_exec_crash(){
  670. code=$(cat)
  671. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  672. # are safe but may not be available everywhere. Thus we use
  673. # raise(SIGTERM) instead. The check is run in a subshell so we
  674. # can redirect the "Terminated" message from the shell. SIGBUS
  675. # is not defined by standard C so it is used conditionally.
  676. (check_exec "$@") >> $logfile 2>&1 <<EOF
  677. #include <signal.h>
  678. static void sighandler(int sig){
  679. raise(SIGTERM);
  680. }
  681. int main(void){
  682. signal(SIGILL, sighandler);
  683. signal(SIGFPE, sighandler);
  684. signal(SIGSEGV, sighandler);
  685. #ifdef SIGBUS
  686. signal(SIGBUS, sighandler);
  687. #endif
  688. { $code }
  689. }
  690. EOF
  691. }
  692. check_type(){
  693. log check_type "$@"
  694. headers=$1
  695. type=$2
  696. shift 2
  697. disable_safe "$type"
  698. incs=""
  699. for hdr in $headers; do
  700. incs="$incs
  701. #include <$hdr>"
  702. done
  703. check_cc "$@" <<EOF && enable_safe "$type"
  704. $incs
  705. $type v;
  706. EOF
  707. }
  708. check_struct(){
  709. log check_type "$@"
  710. headers=$1
  711. struct=$2
  712. member=$3
  713. shift 3
  714. disable_safe "${struct}_${member}"
  715. incs=""
  716. for hdr in $headers; do
  717. incs="$incs
  718. #include <$hdr>"
  719. done
  720. check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
  721. $incs
  722. const void *p = &(($struct *)0)->$member;
  723. EOF
  724. }
  725. require(){
  726. name="$1"
  727. header="$2"
  728. func="$3"
  729. shift 3
  730. check_lib $header $func "$@" || die "ERROR: $name not found"
  731. }
  732. require2(){
  733. name="$1"
  734. headers="$2"
  735. func="$3"
  736. shift 3
  737. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  738. }
  739. check_foo_config(){
  740. cfg=$1
  741. pkg=$2
  742. header=$3
  743. func=$4
  744. shift 4
  745. disable $cfg
  746. check_cmd ${pkg}-config --version
  747. err=$?
  748. if test "$err" = 0; then
  749. temp_cflags $(${pkg}-config --cflags)
  750. temp_extralibs $(${pkg}-config --libs)
  751. check_lib "$@" $header $func && enable $cfg
  752. fi
  753. return $err
  754. }
  755. check_host_cc(){
  756. log check_host_cc "$@"
  757. cat > $TMPC
  758. log_file $TMPC
  759. check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
  760. }
  761. check_host_cflags(){
  762. log check_host_cflags "$@"
  763. check_host_cc "$@" <<EOF && append host_cflags "$@"
  764. int x;
  765. EOF
  766. }
  767. apply(){
  768. file=$1
  769. shift
  770. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  771. }
  772. cp_if_changed(){
  773. cmp -s "$1" "$2" &&
  774. echo "$2 is unchanged" ||
  775. cp -f "$1" "$2"
  776. }
  777. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  778. # system-dependent things.
  779. COMPONENT_LIST="
  780. bsfs
  781. decoders
  782. demuxers
  783. encoders
  784. filters
  785. hwaccels
  786. indevs
  787. muxers
  788. outdevs
  789. parsers
  790. protocols
  791. "
  792. CONFIG_LIST="
  793. $COMPONENT_LIST
  794. aandct
  795. avcodec
  796. avdevice
  797. avfilter
  798. avfilter_lavf
  799. avformat
  800. avisynth
  801. beos_netserver
  802. bzlib
  803. dct
  804. doc
  805. dwt
  806. dxva2
  807. fastdiv
  808. ffmpeg
  809. ffplay
  810. ffprobe
  811. ffserver
  812. fft
  813. golomb
  814. gpl
  815. gprof
  816. gray
  817. h264dsp
  818. hardcoded_tables
  819. libdc1394
  820. libdirac
  821. libfaac
  822. libfaad
  823. libfaadbin
  824. libgsm
  825. libmp3lame
  826. libnut
  827. libopencore_amrnb
  828. libopencore_amrwb
  829. libopenjpeg
  830. librtmp
  831. libschroedinger
  832. libspeex
  833. libtheora
  834. libvo_aacenc
  835. libvorbis
  836. libvpx
  837. libx264
  838. libxvid
  839. lpc
  840. lsp
  841. mdct
  842. memalign_hack
  843. mlib
  844. mpegaudio_hp
  845. network
  846. nonfree
  847. pic
  848. postproc
  849. powerpc_perf
  850. rdft
  851. runtime_cpudetect
  852. shared
  853. small
  854. sram
  855. static
  856. swscale
  857. swscale_alpha
  858. vaapi
  859. vdpau
  860. version3
  861. x11grab
  862. zlib
  863. "
  864. THREADS_LIST='
  865. beosthreads
  866. os2threads
  867. pthreads
  868. w32threads
  869. '
  870. ARCH_LIST='
  871. alpha
  872. arm
  873. avr32
  874. avr32_ap
  875. avr32_uc
  876. bfin
  877. ia64
  878. m68k
  879. mips
  880. mips64
  881. parisc
  882. ppc
  883. ppc64
  884. s390
  885. sh4
  886. sparc
  887. sparc64
  888. tomi
  889. x86
  890. x86_32
  891. x86_64
  892. '
  893. ARCH_EXT_LIST='
  894. altivec
  895. amd3dnow
  896. amd3dnowext
  897. armv5te
  898. armv6
  899. armv6t2
  900. armvfp
  901. iwmmxt
  902. mmi
  903. mmx
  904. mmx2
  905. neon
  906. ppc4xx
  907. sse
  908. ssse3
  909. vis
  910. '
  911. HAVE_LIST_PUB='
  912. bigendian
  913. '
  914. HAVE_LIST="
  915. $ARCH_EXT_LIST
  916. $HAVE_LIST_PUB
  917. $THREADS_LIST
  918. alsa_asoundlib_h
  919. altivec_h
  920. arpa_inet_h
  921. attribute_may_alias
  922. attribute_packed
  923. bswap
  924. closesocket
  925. cmov
  926. conio_h
  927. dcbzl
  928. dev_bktr_ioctl_bt848_h
  929. dev_bktr_ioctl_meteor_h
  930. dev_ic_bt8xx_h
  931. dev_video_meteor_ioctl_meteor_h
  932. dev_video_bktr_ioctl_bt848_h
  933. dlfcn_h
  934. dlopen
  935. dos_paths
  936. dxva_h
  937. ebp_available
  938. ebx_available
  939. exp2
  940. exp2f
  941. fast_64bit
  942. fast_clz
  943. fast_cmov
  944. fast_unaligned
  945. fork
  946. getaddrinfo
  947. gethrtime
  948. GetProcessMemoryInfo
  949. GetProcessTimes
  950. getrusage
  951. struct_rusage_ru_maxrss
  952. inet_aton
  953. inline_asm
  954. isatty
  955. ldbrx
  956. libdc1394_1
  957. libdc1394_2
  958. llrint
  959. llrintf
  960. local_aligned_16
  961. local_aligned_8
  962. log2
  963. log2f
  964. loongson
  965. lrint
  966. lrintf
  967. lzo1x_999_compress
  968. machine_ioctl_bt848_h
  969. machine_ioctl_meteor_h
  970. malloc_h
  971. memalign
  972. mkstemp
  973. pld
  974. posix_memalign
  975. round
  976. roundf
  977. sdl
  978. sdl_video_size
  979. setmode
  980. socklen_t
  981. soundcard_h
  982. poll_h
  983. setrlimit
  984. strerror_r
  985. struct_addrinfo
  986. struct_ipv6_mreq
  987. struct_sockaddr_in6
  988. struct_sockaddr_sa_len
  989. struct_sockaddr_storage
  990. symver
  991. symver_gnu_asm
  992. symver_asm_label
  993. sys_mman_h
  994. sys_resource_h
  995. sys_select_h
  996. sys_soundcard_h
  997. sys_videoio_h
  998. ten_operands
  999. termios_h
  1000. threads
  1001. truncf
  1002. vfp_args
  1003. VirtualAlloc
  1004. winsock2_h
  1005. xform_asm
  1006. yasm
  1007. "
  1008. # options emitted with CONFIG_ prefix but not available on command line
  1009. CONFIG_EXTRA="
  1010. avutil
  1011. gplv3
  1012. lgplv3
  1013. "
  1014. CMDLINE_SELECT="
  1015. $ARCH_EXT_LIST
  1016. $CONFIG_LIST
  1017. $THREADS_LIST
  1018. asm
  1019. cross_compile
  1020. debug
  1021. extra_warnings
  1022. logging
  1023. optimizations
  1024. stripping
  1025. yasm
  1026. "
  1027. PATHS_LIST='
  1028. bindir
  1029. datadir
  1030. incdir
  1031. libdir
  1032. mandir
  1033. prefix
  1034. shlibdir
  1035. '
  1036. CMDLINE_SET="
  1037. $PATHS_LIST
  1038. ar
  1039. arch
  1040. as
  1041. build_suffix
  1042. cc
  1043. cpu
  1044. cross_prefix
  1045. dep_cc
  1046. extra_version
  1047. host_cc
  1048. host_cflags
  1049. host_ldflags
  1050. host_libs
  1051. host_os
  1052. ld
  1053. logfile
  1054. malloc_prefix
  1055. nm
  1056. samples
  1057. source_path
  1058. strip
  1059. sysinclude
  1060. sysroot
  1061. target_exec
  1062. target_os
  1063. target_path
  1064. "
  1065. CMDLINE_APPEND="
  1066. extra_cflags
  1067. "
  1068. # code dependency declarations
  1069. # architecture extensions
  1070. armv5te_deps="arm"
  1071. armv6_deps="arm"
  1072. armv6t2_deps="arm"
  1073. armvfp_deps="arm"
  1074. iwmmxt_deps="arm"
  1075. neon_deps="arm"
  1076. mmi_deps="mips"
  1077. altivec_deps="ppc"
  1078. ppc4xx_deps="ppc"
  1079. vis_deps="sparc"
  1080. x86_64_suggest="cmov fast_cmov"
  1081. amd3dnow_deps="mmx"
  1082. amd3dnowext_deps="amd3dnow"
  1083. mmx_deps="x86"
  1084. mmx2_deps="mmx"
  1085. sse_deps="mmx"
  1086. ssse3_deps="sse"
  1087. fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1088. fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
  1089. fast_unaligned_if_any="armv6 ppc x86"
  1090. need_memalign="altivec neon sse"
  1091. inline_asm_deps="!tms470"
  1092. symver_if_any="symver_asm_label symver_gnu_asm"
  1093. # subsystems
  1094. mdct_select="fft"
  1095. rdft_select="fft"
  1096. # decoders / encoders / hardware accelerators
  1097. aac_decoder_select="mdct rdft aac_parser"
  1098. aac_encoder_select="mdct"
  1099. ac3_decoder_select="mdct ac3_parser"
  1100. alac_encoder_select="lpc"
  1101. amrnb_decoder_select="lsp"
  1102. atrac1_decoder_select="mdct"
  1103. atrac3_decoder_select="mdct"
  1104. binkaudio_dct_decoder_select="mdct rdft dct"
  1105. binkaudio_rdft_decoder_select="mdct rdft"
  1106. cavs_decoder_select="golomb"
  1107. cook_decoder_select="mdct"
  1108. cscd_decoder_suggest="zlib"
  1109. dca_decoder_select="mdct"
  1110. dnxhd_encoder_select="aandct"
  1111. dxa_decoder_select="zlib"
  1112. eac3_decoder_select="ac3_decoder"
  1113. eamad_decoder_select="aandct"
  1114. eatgq_decoder_select="aandct"
  1115. eatqi_decoder_select="aandct"
  1116. ffv1_decoder_select="golomb"
  1117. flac_decoder_select="golomb"
  1118. flac_encoder_select="golomb lpc"
  1119. flashsv_decoder_select="zlib"
  1120. flashsv_encoder_select="zlib"
  1121. flv_decoder_select="h263_decoder"
  1122. flv_encoder_select="h263_encoder"
  1123. h261_encoder_select="aandct"
  1124. h263_decoder_select="h263_parser"
  1125. h263_encoder_select="aandct"
  1126. h263_vaapi_hwaccel_select="vaapi h263_decoder"
  1127. h263i_decoder_select="h263_decoder"
  1128. h263p_encoder_select="h263_encoder"
  1129. h264_decoder_select="golomb h264dsp"
  1130. h264_dxva2_hwaccel_deps="dxva2api_h"
  1131. h264_dxva2_hwaccel_select="dxva2 h264_decoder"
  1132. h264_vaapi_hwaccel_select="vaapi"
  1133. h264_vdpau_decoder_select="vdpau h264_decoder"
  1134. imc_decoder_select="fft mdct"
  1135. jpegls_decoder_select="golomb"
  1136. jpegls_encoder_select="golomb"
  1137. ljpeg_encoder_select="aandct"
  1138. loco_decoder_select="golomb"
  1139. mjpeg_encoder_select="aandct"
  1140. mlp_decoder_select="mlp_parser"
  1141. mpeg1video_encoder_select="aandct"
  1142. mpeg2video_encoder_select="aandct"
  1143. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1144. mpeg4_encoder_select="h263_encoder"
  1145. mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
  1146. mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
  1147. mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
  1148. mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
  1149. mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
  1150. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1151. mpeg_xvmc_decoder_select="mpegvideo_decoder"
  1152. msmpeg4v1_decoder_select="h263_decoder"
  1153. msmpeg4v1_encoder_select="h263_encoder"
  1154. msmpeg4v2_decoder_select="h263_decoder"
  1155. msmpeg4v2_encoder_select="h263_encoder"
  1156. msmpeg4v3_decoder_select="h263_decoder"
  1157. msmpeg4v3_encoder_select="h263_encoder"
  1158. nellymoser_decoder_select="mdct"
  1159. nellymoser_encoder_select="mdct"
  1160. png_decoder_select="zlib"
  1161. png_encoder_select="zlib"
  1162. qcelp_decoder_select="lsp"
  1163. qdm2_decoder_select="mdct rdft"
  1164. rv10_decoder_select="h263_decoder"
  1165. rv10_encoder_select="h263_encoder"
  1166. rv20_decoder_select="h263_decoder"
  1167. rv20_encoder_select="h263_encoder"
  1168. rv30_decoder_select="golomb h264dsp"
  1169. rv40_decoder_select="golomb h264dsp"
  1170. shorten_decoder_select="golomb"
  1171. sipr_decoder_select="lsp"
  1172. snow_decoder_select="dwt"
  1173. snow_encoder_select="aandct dwt"
  1174. sonic_decoder_select="golomb"
  1175. sonic_encoder_select="golomb"
  1176. sonic_ls_encoder_select="golomb"
  1177. svq1_encoder_select="aandct"
  1178. svq3_decoder_select="golomb h264dsp"
  1179. svq3_decoder_suggest="zlib"
  1180. theora_decoder_select="vp3_decoder"
  1181. tiff_decoder_suggest="zlib"
  1182. tiff_encoder_suggest="zlib"
  1183. truehd_decoder_select="mlp_decoder"
  1184. tscc_decoder_select="zlib"
  1185. twinvq_decoder_select="mdct lsp"
  1186. vc1_decoder_select="h263_decoder"
  1187. vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
  1188. vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
  1189. vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
  1190. vc1_vdpau_decoder_select="vdpau vc1_decoder"
  1191. vorbis_decoder_select="mdct"
  1192. vorbis_encoder_select="mdct"
  1193. vp6a_decoder_select="vp6_decoder"
  1194. vp6f_decoder_select="vp6_decoder"
  1195. wmapro_decoder_select="mdct"
  1196. wmav1_decoder_select="mdct"
  1197. wmav1_encoder_select="mdct"
  1198. wmav2_decoder_select="mdct"
  1199. wmav2_encoder_select="mdct"
  1200. wmavoice_decoder_select="lsp rdft dct"
  1201. wmv1_decoder_select="h263_decoder"
  1202. wmv1_encoder_select="h263_encoder"
  1203. wmv2_decoder_select="h263_decoder"
  1204. wmv2_encoder_select="h263_encoder"
  1205. wmv3_decoder_select="vc1_decoder"
  1206. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1207. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1208. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1209. zlib_decoder_select="zlib"
  1210. zlib_encoder_select="zlib"
  1211. zmbv_decoder_select="zlib"
  1212. zmbv_encoder_select="zlib"
  1213. vaapi_deps="va_va_h"
  1214. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1215. # parsers
  1216. h264_parser_select="golomb h264dsp"
  1217. # bitstream_filters
  1218. aac_adtstoasc_bsf_select="aac_parser"
  1219. # external libraries
  1220. libdirac_decoder_deps="libdirac !libschroedinger"
  1221. libdirac_encoder_deps="libdirac"
  1222. libfaac_encoder_deps="libfaac"
  1223. libfaad_decoder_deps="libfaad"
  1224. libfaadbin_extralibs='$ldl'
  1225. libgsm_decoder_deps="libgsm"
  1226. libgsm_encoder_deps="libgsm"
  1227. libgsm_ms_decoder_deps="libgsm"
  1228. libgsm_ms_encoder_deps="libgsm"
  1229. libmp3lame_encoder_deps="libmp3lame"
  1230. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1231. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1232. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1233. libopenjpeg_decoder_deps="libopenjpeg"
  1234. libschroedinger_decoder_deps="libschroedinger"
  1235. libschroedinger_encoder_deps="libschroedinger"
  1236. libspeex_decoder_deps="libspeex"
  1237. libtheora_encoder_deps="libtheora"
  1238. libvo_aacenc_encoder_deps="libvo_aacenc"
  1239. libvorbis_encoder_deps="libvorbis"
  1240. libvpx_decoder_deps="libvpx"
  1241. libvpx_encoder_deps="libvpx"
  1242. libx264_encoder_deps="libx264"
  1243. libxvid_encoder_deps="libxvid"
  1244. # demuxers / muxers
  1245. ac3_demuxer_deps="ac3_parser"
  1246. asf_stream_muxer_select="asf_muxer"
  1247. avisynth_demuxer_deps="avisynth"
  1248. dirac_demuxer_deps="dirac_parser"
  1249. eac3_demuxer_select="ac3_parser"
  1250. ipod_muxer_select="mov_muxer"
  1251. libnut_demuxer_deps="libnut"
  1252. libnut_muxer_deps="libnut"
  1253. matroska_audio_muxer_select="matroska_muxer"
  1254. matroska_demuxer_suggest="zlib bzlib"
  1255. mov_demuxer_suggest="zlib"
  1256. mp3_demuxer_deps="mpegaudio_parser"
  1257. mp4_muxer_select="mov_muxer"
  1258. mpegtsraw_demuxer_select="mpegts_demuxer"
  1259. mxf_d10_muxer_select="mxf_muxer"
  1260. ogg_demuxer_select="golomb"
  1261. psp_muxer_select="mov_muxer"
  1262. rtsp_demuxer_deps="sdp_demuxer"
  1263. rtsp_muxer_deps="sdp_demuxer"
  1264. rtsp_muxer_select="rtp_muxer"
  1265. sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
  1266. sdp_demuxer_select="asf_demuxer rm_demuxer"
  1267. spdif_muxer_select="aac_parser"
  1268. tg2_muxer_select="mov_muxer"
  1269. tgp_muxer_select="mov_muxer"
  1270. w64_demuxer_deps="wav_demuxer"
  1271. # indevs / outdevs
  1272. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1273. alsa_indev_extralibs="-lasound"
  1274. alsa_outdev_deps="alsa_asoundlib_h"
  1275. alsa_outdev_extralibs="-lasound"
  1276. audio_beos_indev_deps="audio_beos"
  1277. audio_beos_indev_extralibs="-lmedia -lbe"
  1278. audio_beos_outdev_deps="audio_beos"
  1279. audio_beos_outdev_extralibs="-lmedia -lbe"
  1280. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1281. dv1394_indev_deps="dv1394 dv_demuxer"
  1282. jack_indev_deps="jack_jack_h"
  1283. jack_indev_extralibs="-ljack"
  1284. libdc1394_indev_deps="libdc1394"
  1285. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1286. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1287. v4l_indev_deps="linux_videodev_h"
  1288. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1289. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1290. vfwcap_indev_extralibs="-lavicap32"
  1291. x11_grab_device_indev_deps="x11grab XShmCreateImage"
  1292. x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
  1293. # protocols
  1294. gopher_protocol_deps="network"
  1295. http_protocol_deps="network"
  1296. http_protocol_select="tcp_protocol"
  1297. rtmp_protocol_deps="tcp_protocol"
  1298. rtp_protocol_deps="udp_protocol"
  1299. tcp_protocol_deps="network"
  1300. udp_protocol_deps="network"
  1301. # filters
  1302. movie_filter_deps="avfilter_lavf"
  1303. avfilter_lavf_deps="avformat"
  1304. # libraries
  1305. avdevice_deps="avcodec avformat"
  1306. avformat_deps="avcodec"
  1307. # programs
  1308. ffmpeg_deps="avcodec avformat swscale"
  1309. ffplay_deps="avcodec avformat swscale sdl"
  1310. ffplay_select="rdft"
  1311. ffprobe_deps="avcodec avformat"
  1312. ffserver_deps="avformat ffm_muxer rtp_protocol rtsp_demuxer"
  1313. ffserver_extralibs='$ldl'
  1314. doc_deps="texi2html"
  1315. # default parameters
  1316. logfile="config.err"
  1317. # installation paths
  1318. prefix_default="/usr/local"
  1319. bindir_default='${prefix}/bin'
  1320. datadir_default='${prefix}/share/ffmpeg'
  1321. incdir_default='${prefix}/include'
  1322. libdir_default='${prefix}/lib'
  1323. mandir_default='${prefix}/share/man'
  1324. shlibdir_default="$libdir_default"
  1325. # toolchain
  1326. ar_default="ar"
  1327. cc_default="gcc"
  1328. cc_version=\"unknown\"
  1329. host_cc_default="gcc"
  1330. ln_s="ln -sf"
  1331. nm_default="nm"
  1332. objformat="elf"
  1333. ranlib="ranlib"
  1334. strip_default="strip"
  1335. yasmexe="yasm"
  1336. nm_opts='-g'
  1337. # machine
  1338. arch_default=$(uname -m)
  1339. cpu="generic"
  1340. # OS
  1341. target_os_default=$(tolower $(uname -s))
  1342. host_os=$target_os_default
  1343. # configurable options
  1344. enable avcodec
  1345. enable avdevice
  1346. enable avformat
  1347. enable avutil
  1348. enable asm
  1349. enable debug
  1350. enable doc
  1351. enable fastdiv
  1352. enable ffmpeg
  1353. enable ffplay
  1354. enable ffprobe
  1355. enable ffserver
  1356. enable mpegaudio_hp
  1357. enable network
  1358. enable optimizations
  1359. enable protocols
  1360. enable static
  1361. enable stripping
  1362. enable swscale
  1363. enable swscale_alpha
  1364. # build settings
  1365. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1366. FFSERVERLDFLAGS=-Wl,-E
  1367. LIBPREF="lib"
  1368. LIBSUF=".a"
  1369. FULLNAME='$(NAME)$(BUILDSUF)'
  1370. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1371. SLIBPREF="lib"
  1372. SLIBSUF=".so"
  1373. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1374. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1375. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1376. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1377. CC_O='-o $@'
  1378. host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
  1379. host_libs='-lm'
  1380. target_path='$(CURDIR)'
  1381. # gcc stupidly only outputs the basename of targets with -MM, but we need the
  1382. # full relative path for objects in subdirectories for non-recursive Make.
  1383. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1384. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
  1385. # find source path
  1386. source_path="$(dirname "$0")"
  1387. enable source_path_used
  1388. if test -f configure; then
  1389. source_path="$(pwd)"
  1390. disable source_path_used
  1391. else
  1392. source_path="$(cd "$source_path"; pwd)"
  1393. echo "$source_path" | grep -q '[[:blank:]]' &&
  1394. die "Out of tree builds are impossible with whitespace in source path."
  1395. test -e "$source_path/config.h" &&
  1396. die "Out of tree builds are impossible with config.h in source dir."
  1397. fi
  1398. for v in "$@"; do
  1399. r=${v#*=}
  1400. l=${v%"$r"}
  1401. r=$(sh_quote "$r")
  1402. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  1403. done
  1404. find_things(){
  1405. thing=$1
  1406. pattern=$2
  1407. file=$source_path/$3
  1408. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1409. }
  1410. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1411. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1412. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1413. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1414. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1415. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1416. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1417. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1418. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1419. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1420. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1421. for n in $COMPONENT_LIST; do
  1422. v=$(toupper ${n%s})_LIST
  1423. eval enable \$$v
  1424. eval ${n}_if_any="\$$v"
  1425. done
  1426. enable $ARCH_EXT_LIST
  1427. die_unknown(){
  1428. echo "Unknown option \"$1\"."
  1429. echo "See $0 --help for available options."
  1430. exit 1
  1431. }
  1432. show_list() {
  1433. suffix=_$1
  1434. shift
  1435. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1436. exit 0
  1437. }
  1438. for opt do
  1439. optval="${opt#*=}"
  1440. case "$opt" in
  1441. --extra-ldflags=*) add_ldflags $optval
  1442. ;;
  1443. --extra-libs=*) add_extralibs $optval
  1444. ;;
  1445. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1446. ;;
  1447. --enable-debug=*) debuglevel="$optval"
  1448. ;;
  1449. --disable-everything)
  1450. map 'eval disable \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1451. ;;
  1452. --enable-*=*|--disable-*=*)
  1453. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1454. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1455. eval list=\$$(toupper $thing)_LIST
  1456. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1457. $action $(filter "$name" $list)
  1458. ;;
  1459. --enable-?*|--disable-?*)
  1460. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1461. if is_in $option $COMPONENT_LIST; then
  1462. test $action = disable && action=unset
  1463. eval $action \$$(toupper ${option%s})_LIST
  1464. elif is_in $option $CMDLINE_SELECT; then
  1465. $action $option
  1466. else
  1467. die_unknown $opt
  1468. fi
  1469. ;;
  1470. --list-*)
  1471. NAME="${opt#--list-}"
  1472. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1473. NAME=${NAME%s}
  1474. eval show_list $NAME \$$(toupper $NAME)_LIST
  1475. ;;
  1476. --help|-h) show_help
  1477. ;;
  1478. *)
  1479. optname="${opt%%=*}"
  1480. optname="${optname#--}"
  1481. optname=$(echo "$optname" | sed 's/-/_/g')
  1482. if is_in $optname $CMDLINE_SET; then
  1483. eval $optname='$optval'
  1484. elif is_in $optname $CMDLINE_APPEND; then
  1485. append $optname "$optval"
  1486. else
  1487. die_unknown $opt
  1488. fi
  1489. ;;
  1490. esac
  1491. done
  1492. disabled logging && logfile=/dev/null
  1493. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  1494. set >> $logfile
  1495. test -n "$cross_prefix" && enable cross_compile
  1496. if enabled cross_compile; then
  1497. test -n "$arch" && test -n "$target_os" ||
  1498. die "Must specify target arch and OS when cross-compiling"
  1499. fi
  1500. set_default arch target_os
  1501. ar_default="${cross_prefix}${ar_default}"
  1502. cc_default="${cross_prefix}${cc_default}"
  1503. nm_default="${cross_prefix}${nm_default}"
  1504. ranlib="${cross_prefix}${ranlib}"
  1505. strip_default="${cross_prefix}${strip_default}"
  1506. sysinclude_default="${sysroot}/usr/include"
  1507. set_default cc nm strip sysinclude
  1508. enabled cross_compile || host_cc_default=$cc
  1509. set_default host_cc
  1510. exesuf() {
  1511. case $1 in
  1512. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
  1513. esac
  1514. }
  1515. EXESUF=$(exesuf $target_os)
  1516. HOSTEXESUF=$(exesuf $host_os)
  1517. # set temporary file name
  1518. : ${TMPDIR:=$TEMPDIR}
  1519. : ${TMPDIR:=$TMP}
  1520. : ${TMPDIR:=/tmp}
  1521. if ! check_cmd type mktemp; then
  1522. # simple replacement for missing mktemp
  1523. # NOT SAFE FOR GENERAL USE
  1524. mktemp(){
  1525. echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
  1526. }
  1527. fi
  1528. tmpfile(){
  1529. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1530. (set -C; exec > $tmp) 2>/dev/null ||
  1531. die "Unable to create temporary file in $TMPDIR."
  1532. append TMPFILES $tmp
  1533. eval $1=$tmp
  1534. }
  1535. trap 'rm -f -- $TMPFILES' EXIT
  1536. trap exit HUP INT TERM
  1537. tmpfile TMPC .c
  1538. tmpfile TMPE $EXESUF
  1539. tmpfile TMPH .h
  1540. tmpfile TMPO .o
  1541. tmpfile TMPS .S
  1542. tmpfile TMPV .ver
  1543. tmpfile TMPSH .sh
  1544. unset -f mktemp
  1545. # make sure we can execute files in $TMPDIR
  1546. cat > $TMPSH 2>> $logfile <<EOF
  1547. #! /bin/sh
  1548. EOF
  1549. chmod +x $TMPSH >> $logfile 2>&1
  1550. if ! $TMPSH >> $logfile 2>&1; then
  1551. cat <<EOF
  1552. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1553. variable to another directory and make sure that it is not mounted noexec.
  1554. EOF
  1555. die "Sanity test failed."
  1556. fi
  1557. filter_cflags=echo
  1558. filter_cppflags=echo
  1559. filter_asflags=echo
  1560. if $cc -v 2>&1 | grep -qi ^gcc; then
  1561. cc_type=gcc
  1562. cc_version=__VERSION__
  1563. if ! $cc -dumpversion | grep -q '^2\.'; then
  1564. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1565. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1566. fi
  1567. speed_cflags='-O3'
  1568. size_cflags='-Os'
  1569. elif $cc --version 2>/dev/null | grep -q Intel; then
  1570. cc_type=icc
  1571. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1572. CC_DEPFLAGS='-MMD'
  1573. AS_DEPFLAGS='-MMD'
  1574. speed_cflags='-O3'
  1575. size_cflags='-Os'
  1576. noopt_cflags='-O1'
  1577. elif $cc -v 2>&1 | grep -q xlc; then
  1578. cc_type=xlc
  1579. cc_version="AV_STRINGIFY(__IBMC__)"
  1580. speed_cflags='-O5'
  1581. size_cflags='-O5 -qcompact'
  1582. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1583. cc_type=ccc
  1584. cc_version="AV_STRINGIFY(__DECC_VER)"
  1585. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1586. debuglevel=3
  1587. add_ldflags -Wl,-z,now # calls to libots crash without this
  1588. speed_cflags='-fast'
  1589. size_cflags='-O1'
  1590. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1591. test -d "$sysroot" || die "No valid sysroot specified."
  1592. cc_type=armcc
  1593. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1594. armcc_conf="$PWD/armcc.conf"
  1595. $cc --arm_linux_configure \
  1596. --arm_linux_config_file="$armcc_conf" \
  1597. --configure_sysroot="$sysroot" \
  1598. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1599. die "Error creating armcc configuration file."
  1600. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1601. as_default="${cross_prefix}gcc"
  1602. CC_DEPFLAGS='-MMD'
  1603. AS_DEPFLAGS='-MMD'
  1604. speed_cflags='-O3'
  1605. size_cflags='-Os'
  1606. elif $cc -version 2>/dev/null | grep -q TMS470; then
  1607. cc_type=tms470
  1608. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  1609. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  1610. CC_O='-fr=$(@D)'
  1611. as_default="${cross_prefix}gcc"
  1612. ld_default="${cross_prefix}gcc"
  1613. TMPO=$(basename $TMPC .c).o
  1614. append TMPFILES $TMPO
  1615. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  1616. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  1617. AS_DEPFLAGS='-MMD'
  1618. speed_cflags='-O3 -mf=5'
  1619. size_cflags='-O3 -mf=2'
  1620. filter_cflags=tms470_flags
  1621. tms470_flags(){
  1622. for flag; do
  1623. case $flag in
  1624. -march=*|-mcpu=*)
  1625. case "${flag#*=}" in
  1626. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1627. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1628. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1629. armv6*|arm11*) echo -mv=6 ;;
  1630. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1631. echo -mv=5e ;;
  1632. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1633. esac
  1634. ;;
  1635. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1636. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1637. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1638. -msoft-float) echo --float_support=vfplib ;;
  1639. -O[0-3]|-mf=*) echo $flag ;;
  1640. -g) echo -g -mn ;;
  1641. -pds=*) echo $flag ;;
  1642. esac
  1643. done
  1644. }
  1645. elif $cc -v 2>&1 | grep -q clang; then
  1646. cc_type=clang
  1647. cc_version=__VERSION__
  1648. CC_DEPFLAGS='-MMD'
  1649. AS_DEPFLAGS='-MMD'
  1650. speed_cflags='-O3'
  1651. size_cflags='-Os'
  1652. elif $cc -V 2>&1 | grep -q Sun; then
  1653. cc_type=suncc
  1654. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  1655. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  1656. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  1657. speed_cflags='-O5'
  1658. size_cflags='-O5 -xspace'
  1659. filter_cflags=suncc_flags
  1660. suncc_flags(){
  1661. for flag; do
  1662. case $flag in
  1663. -march=*|-mcpu=*)
  1664. case "${flag#*=}" in
  1665. native) echo -xtarget=native ;;
  1666. v9) echo -xarch=sparc ;;
  1667. ultrasparc) echo -xarch=sparcvis ;;
  1668. ultrasparc3|niagara*) echo -xarch=sparcvis2 ;;
  1669. i586|pentium) echo -xchip=pentium ;;
  1670. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1671. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  1672. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  1673. pentium4*) echo -xtarget=pentium4 ;;
  1674. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  1675. *-sse3) echo -xarch=sse3 ;;
  1676. core2) echo -xarch=ssse3 -xchip=core2 ;;
  1677. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  1678. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  1679. k8|opteron|athlon64|athlon-fx)
  1680. echo -xarch=sse2a ;;
  1681. athlon*) echo -xarch=pentium_proa ;;
  1682. esac
  1683. ;;
  1684. -std=c99) echo -xc99 ;;
  1685. -fomit-frame-pointer) echo -xregs=frameptr ;;
  1686. -fPIC) echo -KPIC -xcode=pic32 ;;
  1687. -W*,*) echo $flag ;;
  1688. -f*-*|-W*) ;;
  1689. *) echo $flag ;;
  1690. esac
  1691. done
  1692. }
  1693. fi
  1694. test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
  1695. : ${as_default:=$cc}
  1696. : ${dep_cc_default:=$cc}
  1697. : ${ld_default:=$cc}
  1698. set_default ar as dep_cc ld
  1699. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  1700. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  1701. add_cflags $extra_cflags
  1702. add_asflags $extra_cflags
  1703. if test -n "$sysroot"; then
  1704. case "$cc_type" in
  1705. gcc)
  1706. add_cppflags --sysroot="$sysroot"
  1707. add_ldflags --sysroot="$sysroot"
  1708. ;;
  1709. tms470)
  1710. add_cppflags -I"$sysinclude"
  1711. add_ldflags --sysroot="$sysroot"
  1712. ;;
  1713. clang)
  1714. add_cppflags -isysroot "$sysroot"
  1715. add_ldflags -isysroot "$sysroot"
  1716. ;;
  1717. esac
  1718. fi
  1719. if test "$cpu" = host; then
  1720. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  1721. case "$cc_type" in
  1722. gcc)
  1723. check_native(){
  1724. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  1725. sed -n "/$1=/{
  1726. s/.*$1=\\([^ ]*\\).*/\\1/
  1727. p
  1728. q
  1729. }" $TMPE
  1730. }
  1731. cpu=$(check_native -march || check_native -mcpu)
  1732. ;;
  1733. esac
  1734. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  1735. fi
  1736. # Deal with common $arch aliases
  1737. case "$arch" in
  1738. arm*)
  1739. arch="arm"
  1740. ;;
  1741. mips|mipsel|IP*)
  1742. arch="mips"
  1743. ;;
  1744. mips64*)
  1745. arch="mips"
  1746. subarch="mips64"
  1747. ;;
  1748. parisc|hppa)
  1749. arch="parisc"
  1750. ;;
  1751. parisc64|hppa64)
  1752. arch="parisc"
  1753. subarch="parisc64"
  1754. ;;
  1755. "Power Macintosh"|ppc|powerpc)
  1756. arch="ppc"
  1757. ;;
  1758. ppc64|powerpc64)
  1759. arch="ppc"
  1760. subarch="ppc64"
  1761. ;;
  1762. s390|s390x)
  1763. arch="s390"
  1764. ;;
  1765. sh4|sh)
  1766. arch="sh4"
  1767. ;;
  1768. sun4u|sparc64)
  1769. arch="sparc"
  1770. subarch="sparc64"
  1771. ;;
  1772. i[3-6]86|i86pc|BePC|x86_64|amd64)
  1773. arch="x86"
  1774. ;;
  1775. esac
  1776. is_in $arch $ARCH_LIST || echo "WARNING: unknown arch $arch"
  1777. enable $arch
  1778. # Add processor-specific flags
  1779. if test "$cpu" = generic; then
  1780. : do nothing
  1781. elif enabled ppc; then
  1782. case $(tolower $cpu) in
  1783. 601|ppc601|powerpc601)
  1784. cpuflags="-mcpu=601"
  1785. disable altivec
  1786. ;;
  1787. 603*|ppc603*|powerpc603*)
  1788. cpuflags="-mcpu=603"
  1789. disable altivec
  1790. ;;
  1791. 604*|ppc604*|powerpc604*)
  1792. cpuflags="-mcpu=604"
  1793. disable altivec
  1794. ;;
  1795. g3|75*|ppc75*|powerpc75*)
  1796. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  1797. disable altivec
  1798. ;;
  1799. g4|745*|ppc745*|powerpc745*)
  1800. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  1801. ;;
  1802. 74*|ppc74*|powerpc74*)
  1803. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  1804. ;;
  1805. g5|970|ppc970|powerpc970|power4*)
  1806. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1807. ;;
  1808. cell)
  1809. cpuflags="-mcpu=cell"
  1810. enable ldbrx
  1811. ;;
  1812. e500v2)
  1813. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  1814. disable altivec
  1815. ;;
  1816. e500)
  1817. cpuflags="-mcpu=8540 -mhard-float"
  1818. disable altivec
  1819. ;;
  1820. esac
  1821. elif enabled x86; then
  1822. case $cpu in
  1823. i[345]86|pentium)
  1824. cpuflags="-march=$cpu"
  1825. disable mmx
  1826. ;;
  1827. # targets that do NOT support conditional mov (cmov)
  1828. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1829. cpuflags="-march=$cpu"
  1830. disable cmov
  1831. ;;
  1832. # targets that do support conditional mov (cmov)
  1833. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10)
  1834. cpuflags="-march=$cpu"
  1835. enable cmov
  1836. enable fast_cmov
  1837. ;;
  1838. # targets that do support conditional mov but on which it's slow
  1839. pentium4|pentium4m|prescott|nocona)
  1840. cpuflags="-march=$cpu"
  1841. enable cmov
  1842. disable fast_cmov
  1843. ;;
  1844. esac
  1845. elif enabled sparc; then
  1846. case $cpu in
  1847. sparc64)
  1848. cpuflags="-mcpu=v9"
  1849. ;;
  1850. esac
  1851. elif enabled arm; then
  1852. case $cpu in
  1853. armv*)
  1854. cpuflags="-march=$cpu"
  1855. ;;
  1856. *)
  1857. cpuflags="-mcpu=$cpu"
  1858. ;;
  1859. esac
  1860. elif enabled alpha; then
  1861. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  1862. elif enabled bfin; then
  1863. cpuflags="-mcpu=$cpu"
  1864. elif enabled mips; then
  1865. cpuflags="-march=$cpu"
  1866. elif enabled avr32; then
  1867. case $cpu in
  1868. ap7[02]0[0-2])
  1869. subarch="avr32_ap"
  1870. cpuflags="-mpart=$cpu"
  1871. ;;
  1872. ap)
  1873. subarch="avr32_ap"
  1874. cpuflags="-march=$cpu"
  1875. ;;
  1876. uc3[ab]*)
  1877. subarch="avr32_uc"
  1878. cpuflags="-mcpu=$cpu"
  1879. ;;
  1880. uc)
  1881. subarch="avr32_uc"
  1882. cpuflags="-march=$cpu"
  1883. ;;
  1884. esac
  1885. fi
  1886. add_cflags $cpuflags
  1887. add_asflags $cpuflags
  1888. # compiler sanity check
  1889. check_exec <<EOF
  1890. int main(void){ return 0; }
  1891. EOF
  1892. if test "$?" != 0; then
  1893. echo "$cc is unable to create an executable file."
  1894. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1895. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  1896. echo "Only do this if you know what cross compiling means."
  1897. fi
  1898. die "C compiler test failed."
  1899. fi
  1900. add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
  1901. check_cflags -std=c99
  1902. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  1903. #include <stdlib.h>
  1904. EOF
  1905. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  1906. #include <stdlib.h>
  1907. EOF
  1908. check_host_cflags -std=c99
  1909. case "$arch" in
  1910. alpha|ia64|mips|parisc|sparc)
  1911. spic=$shared
  1912. ;;
  1913. x86)
  1914. subarch="x86_32"
  1915. check_cc <<EOF && subarch="x86_64"
  1916. int test[(int)sizeof(char*) - 7];
  1917. EOF
  1918. if test "$subarch" = "x86_64"; then
  1919. spic=$shared
  1920. fi
  1921. ;;
  1922. esac
  1923. enable $subarch
  1924. enabled spic && enable pic
  1925. # OS specific
  1926. case $target_os in
  1927. beos|haiku|zeta)
  1928. prefix_default="$HOME/config"
  1929. # 3 gcc releases known for BeOS, each with ugly bugs
  1930. gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
  1931. case "$gcc_version" in
  1932. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1933. disable mmx
  1934. ;;
  1935. *20010315*) echo "BeBits gcc"
  1936. add_cflags -fno-expensive-optimizations
  1937. ;;
  1938. esac
  1939. SHFLAGS=-nostart
  1940. # enable BeOS things
  1941. enable audio_beos
  1942. # no need for libm, but the inet stuff
  1943. # Check for BONE
  1944. # XXX: actually should check for NOT net_server
  1945. if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
  1946. network_extralibs="-lbind -lsocket"
  1947. else
  1948. enable beos_netserver
  1949. network_extralibs="-lnet"
  1950. fi ;;
  1951. sunos)
  1952. FFSERVERLDFLAGS=""
  1953. SHFLAGS='-shared -Wl,-h,$$(@F)'
  1954. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  1955. network_extralibs="-lsocket -lnsl"
  1956. add_cppflags -D__EXTENSIONS__
  1957. nm_opts='-P -g'
  1958. ;;
  1959. netbsd)
  1960. oss_indev_extralibs="-lossaudio"
  1961. oss_outdev_extralibs="-lossaudio"
  1962. add_cppflags -D_XOPEN_SOURCE=600
  1963. ;;
  1964. openbsd)
  1965. enable malloc_aligned
  1966. # On OpenBSD 4.5. the compiler does not use PIC unless
  1967. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  1968. # however the generated executable will not do anything
  1969. # (simply quits with exit-code 1, no crash, no output).
  1970. # Thus explicitly enable PIC here.
  1971. enable pic
  1972. SHFLAGS='-shared'
  1973. oss_indev_extralibs="-lossaudio"
  1974. oss_outdev_extralibs="-lossaudio"
  1975. ;;
  1976. freebsd|dragonfly)
  1977. enable malloc_aligned
  1978. ;;
  1979. bsd/os)
  1980. osextralibs="-lpoll -lgnugetopt"
  1981. strip="strip -d"
  1982. ;;
  1983. darwin)
  1984. enable malloc_aligned
  1985. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  1986. strip="strip -x"
  1987. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1988. SLIBSUF=".dylib"
  1989. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1990. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1991. FFSERVERLDFLAGS=-Wl,-bind_at_load
  1992. objformat="macho"
  1993. enabled x86_64 && objformat="macho64"
  1994. enabled_any pic shared ||
  1995. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  1996. ;;
  1997. mingw32*)
  1998. if test $target_os = "mingw32ce"; then
  1999. disable network
  2000. else
  2001. target_os=mingw32
  2002. fi
  2003. LIBTARGET=i386
  2004. if enabled x86_64; then
  2005. enable malloc_aligned
  2006. LIBTARGET="i386:x86-64"
  2007. elif enabled arm; then
  2008. LIBTARGET=arm
  2009. fi
  2010. shlibdir_default="$bindir_default"
  2011. disable ffserver
  2012. SLIBPREF=""
  2013. SLIBSUF=".dll"
  2014. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2015. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2016. SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  2017. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  2018. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
  2019. install -d "$(LIBDIR)"; \
  2020. install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
  2021. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  2022. 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'
  2023. objformat="win32"
  2024. dlltool="${cross_prefix}dlltool"
  2025. enable dos_paths
  2026. check_cflags -fno-common
  2027. check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
  2028. || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2029. die "ERROR: MinGW runtime version must be >= 3.15."
  2030. ;;
  2031. cygwin*)
  2032. target_os=cygwin
  2033. shlibdir_default="$bindir_default"
  2034. SLIBPREF="cyg"
  2035. SLIBSUF=".dll"
  2036. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2037. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2038. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2039. objformat="win32"
  2040. enable dos_paths
  2041. check_cflags -fno-common
  2042. ;;
  2043. *-dos|freedos|opendos)
  2044. disable ffplay ffserver
  2045. disable $INDEV_LIST $OUTDEV_LIST
  2046. network_extralibs="-lsocket"
  2047. objformat="coff"
  2048. enable dos_paths
  2049. ;;
  2050. linux)
  2051. enable dv1394
  2052. ;;
  2053. irix*)
  2054. target_os=irix
  2055. ranlib="echo ignoring ranlib"
  2056. ;;
  2057. os/2*)
  2058. strip="lxlite"
  2059. ln_s="cp -f"
  2060. FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  2061. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2062. FFSERVERLDFLAGS=""
  2063. LIBSUF="_s.a"
  2064. SLIBPREF=""
  2065. SLIBSUF=".dll"
  2066. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2067. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2068. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2069. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2070. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2071. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2072. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2073. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2074. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2075. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2076. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  2077. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  2078. enable dos_paths
  2079. ;;
  2080. gnu/kfreebsd)
  2081. ;;
  2082. gnu)
  2083. ;;
  2084. none)
  2085. ;;
  2086. *)
  2087. die "Unknown OS '$target_os'."
  2088. ;;
  2089. esac
  2090. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2091. set_default $PATHS_LIST
  2092. add_extralibs $osextralibs
  2093. # Combine FFLDFLAGS and the LDFLAGS environment variable.
  2094. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  2095. # we need to build at least one lib type
  2096. if ! enabled_any static shared; then
  2097. cat <<EOF
  2098. At least one library type must be built.
  2099. Specify --enable-static to build the static libraries or --enable-shared to
  2100. build the shared libraries as well. To only build the shared libraries specify
  2101. --disable-static in addition to --enable-shared.
  2102. EOF
  2103. exit 1;
  2104. fi
  2105. disabled static && LIBNAME=""
  2106. if enabled_any libfaad libfaadbin ; then
  2107. if check_header faad.h; then
  2108. check_cc <<EOF
  2109. #include <faad.h>
  2110. #ifndef FAAD2_VERSION
  2111. ok faad1
  2112. #endif
  2113. int main(void) { return 0; }
  2114. EOF
  2115. test $? = 0 && enable libfaad2
  2116. else
  2117. die "FAAD test failed."
  2118. fi
  2119. fi
  2120. die_license_disabled() {
  2121. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2122. }
  2123. die_license_disabled gpl libfaad2
  2124. die_license_disabled gpl libx264
  2125. die_license_disabled gpl libxvid
  2126. die_license_disabled gpl postproc
  2127. die_license_disabled gpl x11grab
  2128. die_license_disabled nonfree libfaac
  2129. die_license_disabled version3 libopencore_amrnb
  2130. die_license_disabled version3 libopencore_amrwb
  2131. die_license_disabled version3 libvo_aacenc
  2132. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2133. check_deps $ARCH_EXT_LIST
  2134. disabled optimizations || check_cflags -fomit-frame-pointer
  2135. enable_pic() {
  2136. enable pic
  2137. add_cppflags -DPIC
  2138. add_cflags -fPIC
  2139. add_asflags -fPIC
  2140. }
  2141. enabled pic && enable_pic
  2142. check_cc <<EOF || die "Symbol mangling check failed."
  2143. int ff_extern;
  2144. EOF
  2145. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2146. extern_prefix=${sym%%ff_extern*}
  2147. check_cc <<EOF && enable inline_asm
  2148. void foo(void) { __asm__ volatile ("" ::); }
  2149. EOF
  2150. _restrict=
  2151. for restrict_keyword in restrict __restrict__ __restrict; do
  2152. check_cc <<EOF && _restrict=$restrict_keyword && break
  2153. void foo(char * $restrict_keyword p);
  2154. EOF
  2155. done
  2156. check_cc <<EOF && enable attribute_packed
  2157. struct { int x; } __attribute__((packed)) x;
  2158. EOF
  2159. check_cc <<EOF && enable attribute_may_alias
  2160. union { int x; } __attribute__((may_alias)) x;
  2161. EOF
  2162. check_cc <<EOF || die "endian test failed"
  2163. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2164. EOF
  2165. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2166. if enabled alpha; then
  2167. check_cflags -mieee
  2168. elif enabled arm; then
  2169. check_cflags -marm
  2170. check_ld <<EOF && enable vfp_args
  2171. __asm__ (".eabi_attribute 28, 1");
  2172. int main(void) { return 0; }
  2173. EOF
  2174. # We have to check if pld is a nop and disable it.
  2175. check_asm pld '"pld [r0]"'
  2176. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2177. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2178. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2179. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2180. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2181. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2182. enabled_all armv6t2 shared !pic && enable_pic
  2183. elif enabled mips; then
  2184. check_asm loongson '"dmult.g $1, $2, $3"'
  2185. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2186. elif enabled ppc; then
  2187. enable local_aligned_8 local_aligned_16
  2188. check_asm dcbzl '"dcbzl 0, 1"'
  2189. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2190. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2191. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2192. if enabled altivec; then
  2193. check_cflags -maltivec -mabi=altivec &&
  2194. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2195. check_cflags -faltivec
  2196. # check if our compiler supports Motorola AltiVec C API
  2197. check_cc <<EOF || disable altivec
  2198. $inc_altivec_h
  2199. int main(void) {
  2200. vector signed int v1, v2, v3;
  2201. v1 = vec_add(v2,v3);
  2202. return 0;
  2203. }
  2204. EOF
  2205. # check if our compiler supports braces for vector declarations
  2206. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2207. $inc_altivec_h
  2208. int main (void) { (vector int) {1}; return 0; }
  2209. EOF
  2210. fi
  2211. elif enabled sparc; then
  2212. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2213. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2214. elif enabled x86; then
  2215. enable local_aligned_8 local_aligned_16
  2216. # check whether EBP is available on x86
  2217. # As 'i' is stored on the stack, this program will crash
  2218. # if the base pointer is used to access it because the
  2219. # base pointer is cleared in the inline assembly code.
  2220. check_exec_crash <<EOF && enable ebp_available
  2221. volatile int i=0;
  2222. __asm__ volatile (
  2223. "xorl %%ebp, %%ebp"
  2224. ::: "%ebp");
  2225. return i;
  2226. EOF
  2227. # check whether EBX is available on x86
  2228. check_asm ebx_available '""::"b"(0)' &&
  2229. check_asm ebx_available '"":::"%ebx"'
  2230. # check whether more than 10 operands are supported
  2231. check_cc <<EOF && enable ten_operands
  2232. int main(void) {
  2233. int x=0;
  2234. __asm__ volatile(
  2235. ""
  2236. :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
  2237. );
  2238. return 0;
  2239. }
  2240. EOF
  2241. # check whether binutils is new enough to compile SSSE3/MMX2
  2242. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2243. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2244. check_asm bswap '"bswap %%eax" ::: "%eax"'
  2245. YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
  2246. enabled x86_64 && append YASMFLAGS "-m amd64"
  2247. enabled pic && append YASMFLAGS "-DPIC"
  2248. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2249. case "$objformat" in
  2250. elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
  2251. esac
  2252. disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; }
  2253. case "$cpu" in
  2254. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2255. disable fast_clz
  2256. ;;
  2257. esac
  2258. fi
  2259. if check_func dlopen; then
  2260. ldl=
  2261. elif check_func dlopen -ldl; then
  2262. ldl=-ldl
  2263. fi
  2264. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2265. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2266. check_func fork
  2267. check_func getaddrinfo $network_extralibs
  2268. check_func gethrtime
  2269. check_func getrusage
  2270. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2271. check_func inet_aton $network_extralibs
  2272. check_func isatty
  2273. check_func ${malloc_prefix}memalign && enable memalign
  2274. check_func mkstemp
  2275. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2276. check_func setrlimit
  2277. check_func strerror_r
  2278. check_func_headers io.h setmode
  2279. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2280. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2281. check_func_headers windows.h GetProcessTimes
  2282. check_func_headers windows.h VirtualAlloc
  2283. check_header conio.h
  2284. check_header dlfcn.h
  2285. check_header dxva.h
  2286. check_header dxva2api.h
  2287. check_header malloc.h
  2288. check_header poll.h
  2289. check_header sys/mman.h
  2290. check_header sys/resource.h
  2291. check_header sys/select.h
  2292. check_header termios.h
  2293. check_header vdpau/vdpau.h
  2294. check_header vdpau/vdpau_x11.h
  2295. check_header X11/extensions/XvMClib.h
  2296. check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
  2297. if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
  2298. enabled_any $need_memalign ; then
  2299. die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
  2300. fi
  2301. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2302. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2303. # check for some common methods of building with pthread support
  2304. # do this before the optional library checks as some of them require pthreads
  2305. if enabled pthreads; then
  2306. if check_func pthread_create; then
  2307. :
  2308. elif check_func pthread_create -pthread; then
  2309. add_cflags -pthread
  2310. add_extralibs -pthread
  2311. elif check_func pthread_create -pthreads; then
  2312. add_cflags -pthreads
  2313. add_extralibs -pthreads
  2314. elif check_func pthread_create -lpthreadGC2; then
  2315. add_extralibs -lpthreadGC2
  2316. elif ! check_lib pthread.h pthread_create -lpthread; then
  2317. die "ERROR: can't find pthreads library"
  2318. fi
  2319. fi
  2320. for thread in $THREADS_LIST; do
  2321. if enabled $thread; then
  2322. test -n "$thread_type" &&
  2323. die "ERROR: Only one thread type must be selected." ||
  2324. thread_type="$thread"
  2325. fi
  2326. done
  2327. check_lib math.h sin -lm
  2328. check_lib va/va.h vaInitialize -lva
  2329. check_mathfunc exp2
  2330. check_mathfunc exp2f
  2331. check_mathfunc llrint
  2332. check_mathfunc llrintf
  2333. check_mathfunc log2
  2334. check_mathfunc log2f
  2335. check_mathfunc lrint
  2336. check_mathfunc lrintf
  2337. check_mathfunc round
  2338. check_mathfunc roundf
  2339. check_mathfunc truncf
  2340. # these are off by default, so fail if requested and not available
  2341. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2342. enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
  2343. require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
  2344. require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
  2345. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2346. enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
  2347. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2348. enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm
  2349. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2350. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb -lm
  2351. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -lm
  2352. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2353. enabled librtmp && require librtmp librtmp/rtmp.h RTMP_Init $(pkg-config --libs librtmp)
  2354. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  2355. require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  2356. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2357. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2358. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  2359. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2360. enabled libvpx && require2 libvpx "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver" -lvpx &&
  2361. require2 libvpx "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver" -lvpx
  2362. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 -lm &&
  2363. { check_cpp_condition x264.h "X264_BUILD >= 83" ||
  2364. die "ERROR: libx264 version must be >= 0.83."; }
  2365. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2366. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2367. # libdc1394 check
  2368. if enabled libdc1394; then
  2369. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  2370. enable libdc1394_2; } ||
  2371. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  2372. enable libdc1394_1; } ||
  2373. die "ERROR: No version of libdc1394 found "
  2374. fi
  2375. SDL_CONFIG="${cross_prefix}sdl-config"
  2376. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  2377. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  2378. sdl_libs=$("${SDL_CONFIG}" --libs)
  2379. check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
  2380. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2381. enable sdl &&
  2382. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2383. fi
  2384. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2385. if enabled network; then
  2386. check_type "sys/types.h sys/socket.h" socklen_t
  2387. check_type netdb.h "struct addrinfo"
  2388. check_type netinet/in.h "struct ipv6_mreq"
  2389. check_type netinet/in.h "struct sockaddr_in6"
  2390. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2391. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2392. # Prefer arpa/inet.h over winsock2
  2393. if check_header arpa/inet.h ; then
  2394. check_func closesocket
  2395. elif check_header winsock2.h ; then
  2396. check_func_headers winsock2.h closesocket -lws2 && \
  2397. network_extralibs="-lws2" || \
  2398. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2399. network_extralibs="-lws2_32"; }
  2400. check_type ws2tcpip.h socklen_t
  2401. check_type ws2tcpip.h "struct addrinfo"
  2402. check_type ws2tcpip.h "struct ipv6_mreq"
  2403. check_type ws2tcpip.h "struct sockaddr_in6"
  2404. check_type ws2tcpip.h "struct sockaddr_storage"
  2405. check_struct winsock2.h "struct sockaddr" sa_len
  2406. else
  2407. disable network
  2408. fi
  2409. fi
  2410. check_header linux/videodev.h
  2411. check_header linux/videodev2.h
  2412. check_header sys/videoio.h
  2413. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2414. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  2415. # w32api 3.12 had it defined wrong
  2416. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  2417. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2418. { check_header dev/bktr/ioctl_meteor.h &&
  2419. check_header dev/bktr/ioctl_bt848.h; } ||
  2420. { check_header machine/ioctl_meteor.h &&
  2421. check_header machine/ioctl_bt848.h; } ||
  2422. { check_header dev/video/meteor/ioctl_meteor.h &&
  2423. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2424. check_header dev/ic/bt8xx.h
  2425. check_header sys/soundcard.h
  2426. check_header soundcard.h
  2427. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2428. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
  2429. enabled x11grab &&
  2430. check_header X11/Xlib.h &&
  2431. check_header X11/extensions/XShm.h &&
  2432. check_header X11/extensions/Xfixes.h &&
  2433. check_func XOpenDisplay -lX11 &&
  2434. check_func XShmCreateImage -lX11 -lXext &&
  2435. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2436. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2437. check_cpp_condition \
  2438. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2439. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2440. disable vdpau; }
  2441. fi
  2442. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2443. # add some useful compiler flags if supported
  2444. check_cflags -Wdeclaration-after-statement
  2445. check_cflags -Wall
  2446. check_cflags -Wno-switch
  2447. check_cflags -Wdisabled-optimization
  2448. check_cflags -Wpointer-arith
  2449. check_cflags -Wredundant-decls
  2450. check_cflags -Wno-pointer-sign
  2451. check_cflags -Wcast-qual
  2452. check_cflags -Wwrite-strings
  2453. check_cflags -Wtype-limits
  2454. check_cflags -Wundef
  2455. check_cflags -Wmissing-prototypes
  2456. enabled extra_warnings && check_cflags -Winline
  2457. # add some linker flags
  2458. check_ldflags -Wl,--warn-common
  2459. check_ldflags -Wl,--as-needed
  2460. check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
  2461. check_ldflags -Wl,-Bsymbolic
  2462. echo "X{};" > $TMPV
  2463. if test_ldflags -Wl,--version-script,$TMPV; then
  2464. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2465. check_cc <<EOF && enable symver_asm_label
  2466. void ff_foo(void) __asm__ ("av_foo@VERSION");
  2467. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  2468. EOF
  2469. check_cc <<EOF && enable symver_gnu_asm
  2470. __asm__(".symver ff_foo,av_foo@VERSION");
  2471. void ff_foo(void) {}
  2472. EOF
  2473. fi
  2474. if enabled small; then
  2475. add_cflags $size_cflags
  2476. optimizations="small"
  2477. elif enabled optimizations; then
  2478. add_cflags $speed_cflags
  2479. else
  2480. add_cflags $noopt_cflags
  2481. fi
  2482. check_cflags -fno-math-errno
  2483. check_cflags -fno-signed-zeros
  2484. if enabled icc; then
  2485. # Just warnings, no remarks
  2486. check_cflags -w1
  2487. # -wd: Disable following warnings
  2488. # 144, 167, 556: -Wno-pointer-sign
  2489. # 10006: ignoring unknown option -fno-signed-zeros
  2490. # 10156: ignoring option '-W'; no argument required
  2491. check_cflags -wd144,167,556,10006,10156
  2492. # 11030: Warning unknown option --as-needed
  2493. # 10156: ignoring option '-export'; no argument required
  2494. check_ldflags -wd10156,11030
  2495. # Allow to compile with optimizations
  2496. check_ldflags -march=$cpu
  2497. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2498. enable ebp_available
  2499. elif enabled ccc; then
  2500. # disable some annoying warnings
  2501. add_cflags -msg_disable cvtu32to64
  2502. add_cflags -msg_disable embedcomment
  2503. add_cflags -msg_disable needconstext
  2504. add_cflags -msg_disable nomainieee
  2505. add_cflags -msg_disable ptrmismatch1
  2506. add_cflags -msg_disable unreachcode
  2507. elif enabled gcc; then
  2508. check_cflags -fno-tree-vectorize
  2509. check_cflags -Werror=implicit
  2510. check_cflags -Werror=missing-prototypes
  2511. check_cflags -Werror=return-type
  2512. elif enabled clang; then
  2513. check_cflags -Qunused-arguments
  2514. check_cflags -Werror=return-type
  2515. elif enabled armcc; then
  2516. # 2523: use of inline assembler is deprecated
  2517. add_cflags -Wrvct,--diag_suppress=2523
  2518. add_cflags -Wrvct,--diag_suppress=1207
  2519. elif enabled tms470; then
  2520. add_cflags -pds=824 -pds=837
  2521. fi
  2522. if enabled gprof; then
  2523. add_cflags -p
  2524. add_ldflags -p
  2525. fi
  2526. # Find out if the .align argument is a power of two or not.
  2527. check_asm asmalign_pot '".align 3"'
  2528. enabled_any $THREADS_LIST && enable threads
  2529. check_deps $CONFIG_LIST \
  2530. $CONFIG_EXTRA \
  2531. $HAVE_LIST \
  2532. $DECODER_LIST \
  2533. $ENCODER_LIST \
  2534. $HWACCEL_LIST \
  2535. $PARSER_LIST \
  2536. $BSF_LIST \
  2537. $DEMUXER_LIST \
  2538. $MUXER_LIST \
  2539. $FILTER_LIST \
  2540. $INDEV_LIST \
  2541. $OUTDEV_LIST \
  2542. $PROTOCOL_LIST \
  2543. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  2544. echo "install prefix $prefix"
  2545. echo "source path $source_path"
  2546. echo "C compiler $cc"
  2547. echo ".align is power-of-two $asmalign_pot"
  2548. echo "ARCH $arch ($cpu)"
  2549. if test "$build_suffix" != ""; then
  2550. echo "build suffix $build_suffix"
  2551. fi
  2552. if test "$extra_version" != ""; then
  2553. echo "version string suffix $extra_version"
  2554. fi
  2555. echo "big-endian ${bigendian-no}"
  2556. echo "runtime cpu detection ${runtime_cpudetect-no}"
  2557. if enabled x86; then
  2558. echo "yasm ${yasm-no}"
  2559. echo "MMX enabled ${mmx-no}"
  2560. echo "MMX2 enabled ${mmx2-no}"
  2561. echo "3DNow! enabled ${amd3dnow-no}"
  2562. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2563. echo "SSE enabled ${sse-no}"
  2564. echo "SSSE3 enabled ${ssse3-no}"
  2565. echo "CMOV enabled ${cmov-no}"
  2566. echo "CMOV is fast ${fast_cmov-no}"
  2567. echo "EBX available ${ebx_available-no}"
  2568. echo "EBP available ${ebp_available-no}"
  2569. echo "10 operands supported ${ten_operands-no}"
  2570. fi
  2571. if enabled arm; then
  2572. echo "ARMv5TE enabled ${armv5te-no}"
  2573. echo "ARMv6 enabled ${armv6-no}"
  2574. echo "ARMv6T2 enabled ${armv6t2-no}"
  2575. echo "ARM VFP enabled ${armvfp-no}"
  2576. echo "IWMMXT enabled ${iwmmxt-no}"
  2577. echo "NEON enabled ${neon-no}"
  2578. fi
  2579. if enabled mips; then
  2580. echo "MMI enabled ${mmi-no}"
  2581. fi
  2582. if enabled ppc; then
  2583. echo "AltiVec enabled ${altivec-no}"
  2584. echo "PPC 4xx optimizations ${ppc4xx-no}"
  2585. echo "dcbzl available ${dcbzl-no}"
  2586. echo "performance report ${powerpc_perf-no}"
  2587. fi
  2588. if enabled sparc; then
  2589. echo "VIS enabled ${vis-no}"
  2590. fi
  2591. echo "gprof enabled ${gprof-no}"
  2592. echo "debug symbols ${debug-no}"
  2593. echo "strip symbols ${stripping-no}"
  2594. echo "optimizations ${optimizations-no}"
  2595. echo "static ${static-no}"
  2596. echo "shared ${shared-no}"
  2597. echo "postprocessing support ${postproc-no}"
  2598. echo "new filter support ${avfilter-no}"
  2599. echo "filters using lavformat ${avfilter_lavf-no}"
  2600. echo "network support ${network-no}"
  2601. echo "threading support ${thread_type-no}"
  2602. echo "SDL support ${sdl-no}"
  2603. echo "Sun medialib support ${mlib-no}"
  2604. echo "AVISynth enabled ${avisynth-no}"
  2605. echo "libdc1394 support ${libdc1394-no}"
  2606. echo "libdirac enabled ${libdirac-no}"
  2607. echo "libfaac enabled ${libfaac-no}"
  2608. echo "libfaad enabled ${libfaad-no}"
  2609. echo "libfaad dlopened ${libfaadbin-no}"
  2610. echo "libgsm enabled ${libgsm-no}"
  2611. echo "libmp3lame enabled ${libmp3lame-no}"
  2612. echo "libnut enabled ${libnut-no}"
  2613. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  2614. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  2615. echo "libopenjpeg enabled ${libopenjpeg-no}"
  2616. echo "librtmp enabled ${librtmp-no}"
  2617. echo "libschroedinger enabled ${libschroedinger-no}"
  2618. echo "libspeex enabled ${libspeex-no}"
  2619. echo "libtheora enabled ${libtheora-no}"
  2620. echo "libvo-aacenc support ${libvo_aacenc-no}"
  2621. echo "libvorbis enabled ${libvorbis-no}"
  2622. echo "libvpx enabled ${libvpx-no}"
  2623. echo "libx264 enabled ${libx264-no}"
  2624. echo "libxvid enabled ${libxvid-no}"
  2625. echo "zlib enabled ${zlib-no}"
  2626. echo "bzlib enabled ${bzlib-no}"
  2627. echo
  2628. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  2629. echo "Enabled ${type}s:"
  2630. eval list=\$$(toupper $type)_LIST
  2631. for part in $list; do
  2632. enabled $part && echo ${part%_*}
  2633. done | sort | pr -3 -t
  2634. echo
  2635. done
  2636. license="LGPL version 2.1 or later"
  2637. if enabled nonfree; then
  2638. license="nonfree and unredistributable"
  2639. elif enabled gplv3; then
  2640. license="GPL version 3 or later"
  2641. elif enabled lgplv3; then
  2642. license="LGPL version 3 or later"
  2643. elif enabled gpl; then
  2644. license="GPL version 2 or later"
  2645. fi
  2646. echo "License: $license"
  2647. echo "Creating config.mak and config.h..."
  2648. # build tree in object directory if source path is different from current one
  2649. if enabled source_path_used; then
  2650. DIRS="
  2651. doc
  2652. libavcodec
  2653. libavcodec/$arch
  2654. libavdevice
  2655. libavfilter
  2656. libavformat
  2657. libavutil
  2658. libavutil/$arch
  2659. libpostproc
  2660. libswscale
  2661. libswscale/$arch
  2662. tests
  2663. tools
  2664. "
  2665. FILES="
  2666. Makefile
  2667. common.mak
  2668. subdir.mak
  2669. doc/texi2pod.pl
  2670. libavcodec/Makefile
  2671. libavcodec/${arch}/Makefile
  2672. libavdevice/Makefile
  2673. libavfilter/Makefile
  2674. libavformat/Makefile
  2675. libavutil/Makefile
  2676. libpostproc/Makefile
  2677. libswscale/Makefile
  2678. "
  2679. map 'mkdir -p $v' $DIRS;
  2680. map 'test -f "$source_path/$v" && $ln_s "$source_path/$v" $v' $FILES
  2681. fi
  2682. enabled stripping || strip="echo skipping strip"
  2683. cat > config.mak <<EOF
  2684. # Automatically generated by configure - do not modify!
  2685. ifndef FFMPEG_CONFIG_MAK
  2686. FFMPEG_CONFIG_MAK=1
  2687. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  2688. prefix=$prefix
  2689. LIBDIR=\$(DESTDIR)$libdir
  2690. SHLIBDIR=\$(DESTDIR)$shlibdir
  2691. INCDIR=\$(DESTDIR)$incdir
  2692. BINDIR=\$(DESTDIR)$bindir
  2693. DATADIR=\$(DESTDIR)$datadir
  2694. MANDIR=\$(DESTDIR)$mandir
  2695. SRC_PATH="$source_path"
  2696. SRC_PATH_BARE=$source_path
  2697. BUILD_ROOT="$PWD"
  2698. ARCH=$arch
  2699. CC=$cc
  2700. AS=$as
  2701. LD=$ld
  2702. DEPCC=$dep_cc
  2703. YASM=$yasmexe
  2704. YASMDEP=$yasmexe
  2705. AR=$ar
  2706. RANLIB=$ranlib
  2707. CP=cp -p
  2708. LN_S=$ln_s
  2709. STRIP=$strip
  2710. CPPFLAGS=$CPPFLAGS
  2711. CFLAGS=$CFLAGS
  2712. ASFLAGS=$ASFLAGS
  2713. CC_O=$CC_O
  2714. DLLTOOL=$dlltool
  2715. LDFLAGS=$LDFLAGS
  2716. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  2717. SHFLAGS=$SHFLAGS
  2718. YASMFLAGS=$YASMFLAGS
  2719. BUILDSUF=$build_suffix
  2720. FULLNAME=$FULLNAME
  2721. LIBPREF=$LIBPREF
  2722. LIBSUF=$LIBSUF
  2723. LIBNAME=$LIBNAME
  2724. SLIBPREF=$SLIBPREF
  2725. SLIBSUF=$SLIBSUF
  2726. EXESUF=$EXESUF
  2727. EXTRA_VERSION=$extra_version
  2728. DEPFLAGS=$DEPFLAGS
  2729. CCDEP=$CCDEP
  2730. ASDEP=$ASDEP
  2731. CC_DEPFLAGS=$CC_DEPFLAGS
  2732. AS_DEPFLAGS=$AS_DEPFLAGS
  2733. HOSTCC=$host_cc
  2734. HOSTCFLAGS=$host_cflags
  2735. HOSTEXESUF=$HOSTEXESUF
  2736. HOSTLDFLAGS=$host_ldflags
  2737. HOSTLIBS=$host_libs
  2738. TARGET_EXEC=$target_exec
  2739. TARGET_PATH=$target_path
  2740. SDL_LIBS=$sdl_libs
  2741. SDL_CFLAGS=$sdl_cflags
  2742. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  2743. EXTRALIBS=$extralibs
  2744. INSTALL=install
  2745. LIBTARGET=${LIBTARGET}
  2746. SLIBNAME=${SLIBNAME}
  2747. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  2748. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  2749. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  2750. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  2751. SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
  2752. SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
  2753. SAMPLES=$samples
  2754. EOF
  2755. get_version(){
  2756. name=$1
  2757. file=$source_path/$2
  2758. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2759. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2760. lcname=$(tolower $name)
  2761. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2762. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2763. }
  2764. get_version LIBSWSCALE libswscale/swscale.h
  2765. get_version LIBPOSTPROC libpostproc/postprocess.h
  2766. get_version LIBAVCODEC libavcodec/avcodec.h
  2767. get_version LIBAVDEVICE libavdevice/avdevice.h
  2768. get_version LIBAVFORMAT libavformat/avformat.h
  2769. get_version LIBAVUTIL libavutil/avutil.h
  2770. get_version LIBAVFILTER libavfilter/avfilter.h
  2771. enabled asmalign_pot || align_shift="1 <<"
  2772. cat > $TMPH <<EOF
  2773. /* Automatically generated by configure - do not modify! */
  2774. #ifndef FFMPEG_CONFIG_H
  2775. #define FFMPEG_CONFIG_H
  2776. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  2777. #define FFMPEG_LICENSE "$(c_escape $license)"
  2778. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  2779. #define CC_TYPE "$cc_type"
  2780. #define CC_VERSION $cc_version
  2781. #define restrict $_restrict
  2782. #define ASMALIGN(ZEROBITS) ".align $align_shift " #ZEROBITS "\\n\\t"
  2783. #define EXTERN_PREFIX "${extern_prefix}"
  2784. #define EXTERN_ASM ${extern_prefix}
  2785. EOF
  2786. test -n "$malloc_prefix" &&
  2787. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  2788. if enabled small || disabled optimizations; then
  2789. echo "#undef av_always_inline" >> $TMPH
  2790. echo "#define av_always_inline" >> $TMPH
  2791. fi
  2792. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  2793. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  2794. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  2795. $CONFIG_EXTRA \
  2796. $DECODER_LIST \
  2797. $ENCODER_LIST \
  2798. $HWACCEL_LIST \
  2799. $PARSER_LIST \
  2800. $BSF_LIST \
  2801. $DEMUXER_LIST \
  2802. $MUXER_LIST \
  2803. $FILTER_LIST \
  2804. $PROTOCOL_LIST \
  2805. $INDEV_LIST \
  2806. $OUTDEV_LIST \
  2807. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  2808. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  2809. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  2810. cp_if_changed $TMPH config.h
  2811. cat > $TMPH <<EOF
  2812. /* Generated by ffconf */
  2813. #ifndef AVUTIL_AVCONFIG_H
  2814. #define AVUTIL_AVCONFIG_H
  2815. EOF
  2816. print_config AV_HAVE_ $TMPH /dev/null $HAVE_LIST_PUB
  2817. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  2818. cp_if_changed $TMPH libavutil/avconfig.h
  2819. # build pkg-config files
  2820. pkgconfig_generate(){
  2821. name=$1
  2822. shortname=${name#lib}${build_suffix}
  2823. comment=$2
  2824. version=$3
  2825. libs=$4
  2826. requires=$5
  2827. cat <<EOF > $name/$name.pc
  2828. prefix=$prefix
  2829. exec_prefix=\${prefix}
  2830. libdir=$libdir
  2831. includedir=$incdir
  2832. Name: $name
  2833. Description: $comment
  2834. Version: $version
  2835. Requires: $(enabled shared || echo $requires)
  2836. Requires.private: $(enabled shared && echo $requires)
  2837. Conflicts:
  2838. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  2839. Libs.private: $(enabled shared && echo $libs)
  2840. Cflags: -I\${includedir}
  2841. EOF
  2842. cat <<EOF > $name/$name-uninstalled.pc
  2843. prefix=
  2844. exec_prefix=
  2845. libdir=\${pcfiledir}
  2846. includedir=${source_path}
  2847. Name: $name
  2848. Description: $comment
  2849. Version: $version
  2850. Requires: $requires
  2851. Conflicts:
  2852. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  2853. Cflags: -I\${includedir}
  2854. EOF
  2855. }
  2856. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  2857. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2858. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  2859. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  2860. enabled avfilter &&
  2861. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2862. enabled postproc &&
  2863. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  2864. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"