configure 76 KB

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