configure 88 KB

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