configure 89 KB

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