configure 73 KB

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