configure 98 KB

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