configure 88 KB

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