configure 98 KB

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