configure 84 KB

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