configure 78 KB

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