configure 93 KB

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