configure 96 KB

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