configure 84 KB

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