configure 82 KB

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