configure 76 KB

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