configure 94 KB

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