configure 88 KB

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