configure 80 KB

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