configure 89 KB

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