configure 88 KB

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