configure 75 KB

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