configure 87 KB

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