configure 77 KB

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