configure 74 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589
  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. FFMPEG_CONFIGURATION="$@"
  1115. find_things(){
  1116. thing=$1
  1117. pattern=$2
  1118. file=$source_path/$3
  1119. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1120. }
  1121. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1122. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1123. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1124. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1125. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1126. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1127. OUTDEV_LIST=$(find_things muxer _MUX libavdevice/alldevices.c)
  1128. INDEV_LIST=$(find_things demuxer DEMUX libavdevice/alldevices.c)
  1129. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1130. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1131. enable $ARCH_EXT_LIST \
  1132. $DECODER_LIST \
  1133. $ENCODER_LIST \
  1134. $PARSER_LIST \
  1135. $BSF_LIST \
  1136. $DEMUXER_LIST \
  1137. $MUXER_LIST \
  1138. $FILTER_LIST \
  1139. $PROTOCOL_LIST \
  1140. $INDEV_LIST \
  1141. $OUTDEV_LIST \
  1142. die_unknown(){
  1143. echo "Unknown option \"$1\"."
  1144. echo "See $0 --help for available options."
  1145. exit 1
  1146. }
  1147. show_list() {
  1148. suffix=_$1
  1149. shift
  1150. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
  1151. exit 0
  1152. }
  1153. for opt do
  1154. optval="${opt#*=}"
  1155. case "$opt" in
  1156. --extra-cflags=*) add_cflags $optval
  1157. ;;
  1158. --extra-ldflags=*) add_ldflags $optval
  1159. ;;
  1160. --extra-libs=*) add_extralibs $optval
  1161. ;;
  1162. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1163. ;;
  1164. --enable-debug=*) debuglevel="$optval"
  1165. ;;
  1166. --enable-*=*|--disable-*=*)
  1167. eval $(echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/')
  1168. case "$thing" in
  1169. encoder|decoder|muxer|demuxer|parser|bsf|protocol|filter) $action ${optval}_${thing} ;;
  1170. *) die_unknown "$opt" ;;
  1171. esac
  1172. ;;
  1173. --enable-?*|--disable-?*)
  1174. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1175. if is_in $option $COMPONENT_LIST; then
  1176. eval $action \$$(toupper ${option%s})_LIST
  1177. elif is_in $option $CMDLINE_SELECT; then
  1178. $action $option
  1179. else
  1180. die_unknown $opt
  1181. fi
  1182. ;;
  1183. --list-*)
  1184. NAME="${opt#--list-}"
  1185. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1186. NAME=${NAME%s}
  1187. eval show_list $NAME \$$(toupper $NAME)_LIST
  1188. ;;
  1189. --help|-h) show_help
  1190. ;;
  1191. *)
  1192. optname="${opt%%=*}"
  1193. optname="${optname#--}"
  1194. optname=$(echo "$optname" | sed 's/-/_/g')
  1195. is_in $optname $CMDLINE_SET || die_unknown $opt
  1196. eval $optname='$optval'
  1197. ;;
  1198. esac
  1199. done
  1200. disabled logging && logfile=/dev/null
  1201. echo "# $0 $@" > $logfile
  1202. set >> $logfile
  1203. test -n "$cross_prefix" && enable cross_compile
  1204. ar="${cross_prefix}${ar}"
  1205. cc_default="${cross_prefix}${cc_default}"
  1206. nm_default="${cross_prefix}${nm_default}"
  1207. ranlib="${cross_prefix}${ranlib}"
  1208. strip="${cross_prefix}${strip}"
  1209. sysinclude_default="${sysroot}/usr/include"
  1210. set_default cc nm sysinclude
  1211. as_default=$cc
  1212. enabled cross_compile || host_cc_default=$cc
  1213. set_default host_cc
  1214. exesuf() {
  1215. case $1 in
  1216. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
  1217. esac
  1218. }
  1219. EXESUF=$(exesuf $target_os)
  1220. HOSTEXESUF=$(exesuf $host_os)
  1221. # set temporary file name
  1222. : ${TMPDIR:=$TEMPDIR}
  1223. : ${TMPDIR:=$TMP}
  1224. : ${TMPDIR:=/tmp}
  1225. if ! check_cmd type mktemp; then
  1226. # simple replacement for missing mktemp
  1227. # NOT SAFE FOR GENERAL USE
  1228. mktemp(){
  1229. echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
  1230. }
  1231. fi
  1232. tmpfile(){
  1233. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1234. (set -C; exec > $tmp) 2>/dev/null ||
  1235. die "Unable to create temoporary file in $TMPDIR."
  1236. append TMPFILES $tmp
  1237. eval $1=$tmp
  1238. }
  1239. trap 'rm -f -- $TMPFILES' EXIT
  1240. trap exit HUP INT TERM
  1241. tmpfile TMPC .c
  1242. tmpfile TMPE $EXESUF
  1243. tmpfile TMPH .h
  1244. tmpfile TMPO .o
  1245. tmpfile TMPS .S
  1246. tmpfile TMPSH .sh
  1247. unset -f mktemp
  1248. # make sure we can execute files in $TMPDIR
  1249. cat > $TMPSH 2>> $logfile <<EOF
  1250. #! /bin/sh
  1251. EOF
  1252. chmod +x $TMPSH >> $logfile 2>&1
  1253. if ! $TMPSH >> $logfile 2>&1; then
  1254. cat <<EOF
  1255. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1256. variable to another directory and make sure that it is not mounted noexec.
  1257. EOF
  1258. die "Sanity test failed."
  1259. fi
  1260. if $cc --version 2>/dev/null | grep -qi gcc; then
  1261. cc_type=gcc
  1262. elif $cc --version 2>/dev/null | grep -q Intel; then
  1263. cc_type=icc
  1264. elif $cc -v 2>&1 | grep -q xlc; then
  1265. cc_type=xlc
  1266. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1267. cc_type=ccc
  1268. DEPEND_CMD='$(CC) $(CFLAGS) -M $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o,"'
  1269. debuglevel=3
  1270. add_ldflags -Wl,-z,now # calls to libots crash without this
  1271. elif $cc --vsn 2>/dev/null | grep -q RVCT; then
  1272. test -d "$sysroot" || die "No valid sysroot specified."
  1273. cc_type=armcc
  1274. armcc_conf="$PWD/armcc.conf"
  1275. $cc --arm_linux_configure \
  1276. --arm_linux_config_file="$armcc_conf" \
  1277. --configure_sysroot="$sysroot" \
  1278. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1279. die "Error creating armcc configuration file."
  1280. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1281. as_default="${cross_prefix}gcc"
  1282. fi
  1283. test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
  1284. set_default as
  1285. if test -n "$sysroot"; then
  1286. case "$cc_type" in
  1287. gcc)
  1288. add_cflags --sysroot="$sysroot"
  1289. add_ldflags --sysroot="$sysroot"
  1290. ;;
  1291. esac
  1292. fi
  1293. # compiler sanity check
  1294. check_exec <<EOF
  1295. int main(void){ return 0; }
  1296. EOF
  1297. if test "$?" != 0; then
  1298. echo "$cc is unable to create an executable file."
  1299. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1300. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  1301. echo "Only do this if you know what cross compiling means."
  1302. fi
  1303. die "C compiler test failed."
  1304. fi
  1305. check_cflags -std=c99
  1306. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cflags -D_FILE_OFFSET_BITS=64
  1307. #include <stdlib.h>
  1308. EOF
  1309. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cflags -D_LARGEFILE_SOURCE
  1310. #include <stdlib.h>
  1311. EOF
  1312. case "$arch" in
  1313. alpha)
  1314. arch="alpha"
  1315. enable fast_64bit
  1316. check_cflags -mieee
  1317. ;;
  1318. arm|armv[4567]*l)
  1319. arch="arm"
  1320. ;;
  1321. avr32)
  1322. ;;
  1323. bfin)
  1324. arch="bfin"
  1325. ;;
  1326. ia64)
  1327. arch="ia64"
  1328. enable fast_64bit
  1329. ;;
  1330. m68k)
  1331. arch="m68k"
  1332. ;;
  1333. mips|mipsel|IP*)
  1334. arch="mips"
  1335. ;;
  1336. mips64)
  1337. arch="mips"
  1338. enable fast_64bit
  1339. ;;
  1340. parisc|hppa)
  1341. arch="parisc"
  1342. ;;
  1343. parisc64|hppa64)
  1344. arch="parisc"
  1345. enable fast_64bit
  1346. ;;
  1347. "Power Macintosh"|ppc|powerpc)
  1348. arch="ppc"
  1349. enable fast_unaligned
  1350. ;;
  1351. ppc64)
  1352. arch="ppc"
  1353. enable fast_64bit
  1354. enable fast_unaligned
  1355. ;;
  1356. s390|s390x)
  1357. arch="s390"
  1358. ;;
  1359. sh4|sh)
  1360. arch="sh4"
  1361. ;;
  1362. sparc)
  1363. arch="sparc"
  1364. ;;
  1365. sun4u|sparc64)
  1366. arch="sparc"
  1367. subarch="sparc64"
  1368. enable fast_64bit
  1369. ;;
  1370. i386|i486|i586|i686|i86pc|BePC)
  1371. arch="x86"
  1372. subarch="x86_32"
  1373. enable fast_unaligned
  1374. ;;
  1375. x86_64|amd64)
  1376. arch="x86"
  1377. subarch="x86_32"
  1378. enable cmov
  1379. enable fast_cmov
  1380. enable fast_unaligned
  1381. check_cc <<EOF && enable fast_64bit && subarch="x86_64"
  1382. int test[sizeof(char*) - 7];
  1383. EOF
  1384. ;;
  1385. *)
  1386. arch="unknown"
  1387. ;;
  1388. esac
  1389. enable $arch $subarch
  1390. # OS specific
  1391. case $target_os in
  1392. beos|haiku|zeta)
  1393. prefix_default="$HOME/config"
  1394. # helps building libavcodec
  1395. add_cflags -DPIC -fomit-frame-pointer
  1396. # 3 gcc releases known for BeOS, each with ugly bugs
  1397. gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
  1398. case "$gcc_version" in
  1399. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1400. disable mmx
  1401. ;;
  1402. *20010315*) echo "BeBits gcc"
  1403. add_cflags -fno-expensive-optimizations
  1404. ;;
  1405. esac
  1406. SHFLAGS=-nostart
  1407. # enable BeOS things
  1408. enable audio_beos
  1409. # no need for libm, but the inet stuff
  1410. # Check for BONE
  1411. # XXX: actually should check for NOT net_server
  1412. if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
  1413. network_extralibs="-lbind -lsocket"
  1414. else
  1415. enable beos_netserver
  1416. network_extralibs="-lnet"
  1417. fi ;;
  1418. sunos)
  1419. FFSERVERLDFLAGS=""
  1420. SHFLAGS='-shared -Wl,-h,$$(@F)'
  1421. network_extralibs="-lsocket -lnsl"
  1422. add_cflags -D__EXTENSIONS__
  1423. ;;
  1424. netbsd)
  1425. oss_demuxer_extralibs="-lossaudio"
  1426. oss_muxer_extralibs="-lossaudio"
  1427. ;;
  1428. openbsd)
  1429. disable need_memalign
  1430. LIBOBJFLAGS='$(PIC)'
  1431. SHFLAGS='-shared'
  1432. oss_demuxer_extralibs="-lossaudio"
  1433. oss_muxer_extralibs="-lossaudio"
  1434. ;;
  1435. freebsd)
  1436. disable need_memalign
  1437. ;;
  1438. bsd/os)
  1439. osextralibs="-lpoll -lgnugetopt"
  1440. strip="strip -d"
  1441. ;;
  1442. darwin)
  1443. disable need_memalign
  1444. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  1445. strip="strip -x"
  1446. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1447. SLIBSUF=".dylib"
  1448. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1449. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1450. FFSERVERLDFLAGS=-Wl,-bind_at_load
  1451. objformat="macho"
  1452. enabled x86_64 && objformat="macho64"
  1453. ;;
  1454. mingw32*)
  1455. target_os=mingw32
  1456. LIBTARGET=i386
  1457. if enabled x86_64; then
  1458. disable need_memalign
  1459. LIBTARGET=x64
  1460. fi
  1461. shlibdir_default="$bindir_default"
  1462. disable ffserver
  1463. SLIBPREF=""
  1464. SLIBSUF=".dll"
  1465. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1466. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1467. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  1468. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  1469. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
  1470. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  1471. 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'
  1472. objformat="win32"
  1473. enable dos_paths
  1474. if ! enabled x86_64; then
  1475. check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  1476. die "ERROR: MinGW runtime version must be >= 3.15."
  1477. enabled_any avisynth vfwcap_demuxer &&
  1478. { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" ||
  1479. die "ERROR: avisynth and vfwcap_demuxer require w32api version 3.13 or later."; }
  1480. fi
  1481. ;;
  1482. cygwin*)
  1483. target_os=cygwin
  1484. shlibdir_default="$bindir_default"
  1485. SLIBPREF="cyg"
  1486. SLIBSUF=".dll"
  1487. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1488. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1489. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  1490. objformat="win32"
  1491. enable dos_paths
  1492. ;;
  1493. *-dos|freedos|opendos)
  1494. disable ffplay ffserver
  1495. disable $INDEV_LIST $OUTDEV_LIST
  1496. network_extralibs="-lsocket"
  1497. objformat="coff"
  1498. enable dos_paths
  1499. ;;
  1500. linux)
  1501. enable dv1394
  1502. ;;
  1503. irix*)
  1504. target_os=irix
  1505. ranlib="echo ignoring ranlib"
  1506. ;;
  1507. os/2*)
  1508. strip="lxlite"
  1509. ln_s="cp -f"
  1510. FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  1511. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  1512. FFSERVERLDFLAGS=""
  1513. LIBSUF="_s.a"
  1514. SLIBPREF=""
  1515. SLIBSUF=".dll"
  1516. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  1517. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  1518. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  1519. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  1520. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  1521. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  1522. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  1523. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  1524. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  1525. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  1526. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  1527. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  1528. enable dos_paths
  1529. ;;
  1530. *)
  1531. die "Unknown OS '$target_os'."
  1532. ;;
  1533. esac
  1534. set_default $PATHS_LIST
  1535. add_extralibs $osextralibs
  1536. # Combine FFLDFLAGS and the LDFLAGS environment variable.
  1537. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  1538. # we need to build at least one lib type
  1539. if ! enabled_any static shared; then
  1540. cat <<EOF
  1541. At least one library type must be built.
  1542. Specify --enable-static to build the static libraries or --enable-shared to
  1543. build the shared libraries as well. To only build the shared libraries specify
  1544. --disable-static in addition to --enable-shared.
  1545. EOF
  1546. exit 1;
  1547. fi
  1548. disabled static && LIBNAME=""
  1549. if enabled_any libfaad libfaadbin ; then
  1550. if check_header faad.h; then
  1551. check_cc <<EOF
  1552. #include <faad.h>
  1553. #ifndef FAAD2_VERSION
  1554. ok faad1
  1555. #endif
  1556. int main(void) { return 0; }
  1557. EOF
  1558. test $? = 0 && enable libfaad2
  1559. else
  1560. die "FAAD test failed."
  1561. fi
  1562. fi
  1563. if ! enabled gpl; then
  1564. die_gpl_disabled(){
  1565. name=$1
  1566. shift
  1567. enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified."
  1568. }
  1569. die_gpl_disabled "The Postprocessing code" postproc
  1570. die_gpl_disabled "libx264" libx264
  1571. die_gpl_disabled "libxvidcore" libxvid
  1572. die_gpl_disabled "FAAD2" libfaad2
  1573. die_gpl_disabled "The X11 grabber" x11grab
  1574. fi
  1575. if ! enabled nonfree && enabled_any libamr_nb libamr_wb; then
  1576. die "libamr is nonfree and --enable-nonfree is not specified."
  1577. fi
  1578. check_deps $ARCH_EXT_LIST
  1579. test -z "$need_memalign" && need_memalign="$mmx"
  1580. #Darwin CC versions
  1581. if test $target_os = darwin; then
  1582. if enabled xlc; then
  1583. add_cflags -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto
  1584. else
  1585. add_cflags -pipe
  1586. check_cflags -force_cpusubtype_ALL
  1587. check_cflags -Wno-sign-compare
  1588. enabled shared || check_cflags -mdynamic-no-pic
  1589. fi
  1590. fi
  1591. disabled optimizations || check_cflags -fomit-frame-pointer
  1592. # Add processor-specific flags
  1593. if test $cpu != "generic"; then
  1594. warn_altivec(){
  1595. $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
  1596. }
  1597. case $cpu in
  1598. 601|ppc601|PowerPC601)
  1599. add_cflags -mcpu=601
  1600. warn_altivec enabled PPC601
  1601. ;;
  1602. 603*|ppc603*|PowerPC603*)
  1603. add_cflags -mcpu=603
  1604. warn_altivec enabled PPC603
  1605. ;;
  1606. 604*|ppc604*|PowerPC604*)
  1607. add_cflags -mcpu=604
  1608. warn_altivec enabled PPC604
  1609. ;;
  1610. G3|g3|75*|ppc75*|PowerPC75*)
  1611. add_cflags -mcpu=750 -mpowerpc-gfxopt
  1612. warn_altivec enabled PPC75x
  1613. ;;
  1614. G4|g4|745*|ppc745*|PowerPC745*)
  1615. add_cflags -mcpu=7450 -mpowerpc-gfxopt
  1616. warn_altivec disabled PPC745x
  1617. ;;
  1618. 74*|ppc74*|PowerPC74*)
  1619. add_cflags -mcpu=7400 -mpowerpc-gfxopt
  1620. warn_altivec disabled PPC74xx
  1621. ;;
  1622. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  1623. add_cflags -mcpu=970 -mpowerpc-gfxopt -mpowerpc64
  1624. warn_altivec disabled PPC970
  1625. enable ppc64
  1626. ;;
  1627. Cell|CELL|cell)
  1628. add_cflags -mcpu=cell
  1629. warn_altivec disabled Cell
  1630. enable ppc64
  1631. ;;
  1632. # targets that do NOT support conditional mov (cmov)
  1633. i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1634. add_cflags -march=$cpu
  1635. disable cmov
  1636. ;;
  1637. # targets that do support conditional mov (cmov)
  1638. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
  1639. add_cflags -march=$cpu
  1640. enable cmov
  1641. enable fast_cmov
  1642. ;;
  1643. # targets that do support conditional mov but on which it's slow
  1644. pentium4|pentium4m|prescott|nocona)
  1645. add_cflags -march=$cpu
  1646. enable cmov
  1647. disable fast_cmov
  1648. ;;
  1649. sparc64)
  1650. add_cflags -mcpu=v9
  1651. ;;
  1652. arm11*|cortex*)
  1653. add_cflags -mcpu=$cpu
  1654. enable fast_unaligned
  1655. ;;
  1656. armv*)
  1657. add_cflags -march=$cpu
  1658. ;;
  1659. arm*)
  1660. add_cflags -mcpu=$cpu
  1661. ;;
  1662. ev4|ev45|ev5|ev56|pca56|ev6|ev67)
  1663. enabled ccc && add_cflags -arch $cpu || add_cflags -mcpu=$cpu
  1664. ;;
  1665. *)
  1666. echo "WARNING: Unknown CPU \"$cpu\", ignored."
  1667. ;;
  1668. esac
  1669. fi
  1670. check_cc <<EOF || die "Symbol mangling check failed."
  1671. int ff_extern;
  1672. EOF
  1673. sym=$($nm -P -g $TMPO | grep ff_extern)
  1674. extern_prefix=${sym%%ff_extern*}
  1675. check_cc <<EOF && enable inline_asm
  1676. void foo(void) { __asm__ volatile ("" ::); }
  1677. EOF
  1678. if enabled x86; then
  1679. # check whether EBP is available on x86
  1680. # As 'i' is stored on the stack, this program will crash
  1681. # if the base pointer is used to access it because the
  1682. # base pointer is cleared in the inline assembly code.
  1683. check_exec_crash <<EOF && enable ebp_available
  1684. volatile int i=0;
  1685. __asm__ volatile (
  1686. "xorl %%ebp, %%ebp"
  1687. ::: "%ebp");
  1688. return i;
  1689. EOF
  1690. # check wether EBX is available on x86
  1691. check_asm ebx_available '"":::"%ebx"'
  1692. # check whether more than 10 operands are supported
  1693. check_cc <<EOF && enable ten_operands
  1694. int main(void) {
  1695. int x=0;
  1696. __asm__ volatile(
  1697. ""
  1698. :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
  1699. );
  1700. return 0;
  1701. }
  1702. EOF
  1703. # check whether binutils is new enough to compile SSSE3/MMX2
  1704. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  1705. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  1706. check_asm bswap '"bswap %%eax" ::: "%eax"'
  1707. YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
  1708. enabled x86_64 && append YASMFLAGS "-m amd64"
  1709. enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
  1710. case "$objformat" in
  1711. elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
  1712. macho64) append YASMFLAGS "-DPIC -DPREFIX" ;;
  1713. *) append YASMFLAGS "-DPREFIX" ;;
  1714. esac
  1715. disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; }
  1716. fi
  1717. # check for assembler specific support
  1718. enabled ppc && check_asm dcbzl '"dcbzl 0, 1"'
  1719. enabled ppc && check_asm ppc4xx '"maclhw r10, r11, r12"'
  1720. # check for SIMD availability
  1721. # AltiVec flags: The FSF version of GCC differs from the Apple version
  1722. if enabled altivec; then
  1723. check_cflags -maltivec -mabi=altivec &&
  1724. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  1725. check_cflags -faltivec
  1726. # check if our compiler supports Motorola AltiVec C API
  1727. check_cc <<EOF || disable altivec
  1728. $inc_altivec_h
  1729. int main(void) {
  1730. vector signed int v1, v2, v3;
  1731. v1 = vec_add(v2,v3);
  1732. return 0;
  1733. }
  1734. EOF
  1735. # check if our compiler supports braces for vector declarations
  1736. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  1737. $inc_altivec_h
  1738. int main (void) { (vector int) {1}; return 0; }
  1739. EOF
  1740. fi
  1741. # We have to check if pld is a nop and disable it.
  1742. enabled arm && check_asm pld '"pld [r0]"'
  1743. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  1744. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  1745. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  1746. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  1747. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  1748. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  1749. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  1750. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
  1751. enabled vis && add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  1752. # ---
  1753. # big/little-endian test
  1754. check_cc <<EOF || die "endian test failed"
  1755. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  1756. EOF
  1757. od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  1758. # ---
  1759. # check availability of some header files
  1760. if check_func dlopen; then
  1761. ldl=
  1762. elif check_func dlopen -ldl; then
  1763. ldl=-ldl
  1764. fi
  1765. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  1766. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  1767. check_func fork
  1768. check_func gethrtime
  1769. check_func getrusage
  1770. check_func inet_aton $network_extralibs
  1771. check_func memalign
  1772. check_func mkstemp
  1773. check_func posix_memalign
  1774. check_func_headers io.h setmode
  1775. check_func_headers windows.h GetProcessTimes
  1776. check_func_headers windows.h VirtualAlloc
  1777. check_header conio.h
  1778. check_header dlfcn.h
  1779. check_header malloc.h
  1780. check_header poll.h
  1781. check_header sys/mman.h
  1782. check_header sys/resource.h
  1783. check_header sys/select.h
  1784. check_header termios.h
  1785. check_header vdpau/vdpau.h
  1786. check_header vdpau/vdpau_x11.h
  1787. check_header X11/extensions/XvMClib.h
  1788. if ! enabled_any memalign memalign_hack posix_memalign && enabled need_memalign ; then
  1789. die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
  1790. fi
  1791. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  1792. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  1793. # check for some common methods of building with pthread support
  1794. # do this before the optional library checks as some of them require pthreads
  1795. if enabled pthreads; then
  1796. if check_func pthread_create; then
  1797. :
  1798. elif check_func pthread_create -pthread; then
  1799. add_cflags -pthread
  1800. add_extralibs -pthread
  1801. elif check_func pthread_create -pthreads; then
  1802. add_cflags -pthreads
  1803. add_extralibs -pthreads
  1804. elif check_func pthread_create -lpthreadGC2; then
  1805. add_extralibs -lpthreadGC2
  1806. elif ! check_lib pthread.h pthread_create -lpthread; then
  1807. die "ERROR: can't find pthreads library"
  1808. fi
  1809. fi
  1810. for thread in $THREADS_LIST; do
  1811. if enabled $thread; then
  1812. test -n "$thread_type" &&
  1813. die "ERROR: Only one thread type must be selected." ||
  1814. thread_type="$thread"
  1815. fi
  1816. done
  1817. check_lib math.h sin -lm
  1818. # test for C99 functions in math.h
  1819. for func in llrint lrint lrintf round roundf truncf; do
  1820. check_exec <<EOF && enable $func || disable $func
  1821. #include <math.h>
  1822. int main(void) { return ($func(3.999f) > 0)?0:1; }
  1823. EOF
  1824. done
  1825. # these are off by default, so fail if requested and not available
  1826. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
  1827. enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
  1828. enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
  1829. enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
  1830. require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder &&
  1831. require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder
  1832. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  1833. enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
  1834. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  1835. enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm
  1836. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  1837. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  1838. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  1839. require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  1840. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  1841. enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg
  1842. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  1843. enabled libx264 && require libx264 x264.h x264_encoder_open -lx264 -lm &&
  1844. { check_cpp_condition x264.h "X264_BUILD >= 65" ||
  1845. die "ERROR: libx264 version must be >= 0.65."; }
  1846. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  1847. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  1848. # libdc1394 check
  1849. if enabled libdc1394; then
  1850. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  1851. enable libdc1394_2; } ||
  1852. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  1853. enable libdc1394_1; } ||
  1854. die "ERROR: No version of libdc1394 found "
  1855. fi
  1856. _restrict=
  1857. for restrict_keyword in restrict __restrict__ __restrict; do
  1858. check_cc <<EOF && _restrict=$restrict_keyword && break
  1859. void foo(char * $restrict_keyword p);
  1860. EOF
  1861. done
  1862. ##########################################
  1863. # SDL check
  1864. disable sdl_too_old
  1865. disable sdl
  1866. SDL_CONFIG="${cross_prefix}sdl-config"
  1867. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  1868. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  1869. temp_cflags $sdl_cflags
  1870. temp_extralibs $("${SDL_CONFIG}" --libs)
  1871. if check_lib2 SDL.h SDL_Init; then
  1872. _sdlversion=$("${SDL_CONFIG}" --version | sed 's/[^0-9]//g')
  1873. if test "$_sdlversion" -lt 121 ; then
  1874. enable sdl_too_old
  1875. else
  1876. enable sdl
  1877. check_cc $sdl_cflags <<EOF && enable sdl_video_size
  1878. #include <SDL.h>
  1879. int main(int argc, char **argv){
  1880. const SDL_VideoInfo *vi = SDL_GetVideoInfo();
  1881. int w = vi->current_w;
  1882. return 0;
  1883. }
  1884. EOF
  1885. fi
  1886. fi
  1887. restore_flags
  1888. fi
  1889. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  1890. ##########################################
  1891. # Network check
  1892. if enabled network; then
  1893. check_type "sys/types.h sys/socket.h" socklen_t
  1894. # Prefer arpa/inet.h over winsock2
  1895. if check_header arpa/inet.h ; then
  1896. check_func closesocket
  1897. elif check_header winsock2.h ; then
  1898. network_extralibs="-lws2_32"
  1899. check_type ws2tcpip.h socklen_t
  1900. check_func_headers winsock2.h closesocket
  1901. fi
  1902. fi
  1903. ##########################################
  1904. # IPv6 check
  1905. enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
  1906. #include <sys/types.h>
  1907. #include <sys/socket.h>
  1908. #include <netinet/in.h>
  1909. #include <netdb.h>
  1910. int main(void) {
  1911. struct sockaddr_storage saddr;
  1912. struct ipv6_mreq mreq6;
  1913. getaddrinfo(0,0,0,0);
  1914. getnameinfo(0,0,0,0,0,0,0);
  1915. IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
  1916. }
  1917. EOF
  1918. check_header linux/videodev.h
  1919. check_header linux/videodev2.h
  1920. check_header sys/videoio.h
  1921. check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
  1922. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  1923. { check_header dev/bktr/ioctl_meteor.h &&
  1924. check_header dev/bktr/ioctl_bt848.h; } ||
  1925. { check_header machine/ioctl_meteor.h &&
  1926. check_header machine/ioctl_bt848.h; } ||
  1927. { check_header dev/video/meteor/ioctl_meteor.h &&
  1928. check_header dev/video/bktr/ioctl_bt848.h; } ||
  1929. check_header dev/ic/bt8xx.h
  1930. check_header sys/soundcard.h
  1931. check_header soundcard.h
  1932. check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  1933. # deal with the X11 frame grabber
  1934. enabled x11grab &&
  1935. check_header X11/Xlib.h &&
  1936. check_header X11/extensions/XShm.h &&
  1937. check_func XOpenDisplay -lX11 &&
  1938. check_func XShmCreateImage -lX11 -lXext
  1939. enabled debug && add_cflags -g"$debuglevel"
  1940. # add some useful compiler flags if supported
  1941. check_cflags -Wdeclaration-after-statement
  1942. check_cflags -Wall
  1943. check_cflags -Wno-switch
  1944. check_cflags -Wdisabled-optimization
  1945. check_cflags -Wpointer-arith
  1946. check_cflags -Wredundant-decls
  1947. check_cflags -Wno-pointer-sign
  1948. check_cflags -Wcast-qual
  1949. check_cflags -Wwrite-strings
  1950. check_cflags -Wtype-limits
  1951. check_cflags -Wundef
  1952. enabled extra_warnings && check_cflags -Winline
  1953. # add some linker flags
  1954. check_ldflags -Wl,--warn-common
  1955. check_ldflags -Wl,--as-needed
  1956. 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'
  1957. check_ldflags -Wl,-Bsymbolic
  1958. if enabled small; then
  1959. check_cflags -Os # not all compilers support -Os
  1960. optimizations="small"
  1961. elif enabled optimizations; then
  1962. if enabled xlc; then
  1963. add_cflags -O5
  1964. add_ldflags -O5
  1965. elif enabled ccc; then
  1966. add_cflags -fast
  1967. else
  1968. add_cflags -O3
  1969. fi
  1970. fi
  1971. check_cflags -fno-math-errno
  1972. check_cflags -fno-signed-zeros
  1973. # add some flags for Intel C Compiler
  1974. if enabled icc; then
  1975. # Just warnings, no remarks
  1976. check_cflags -w1
  1977. # -wd: Disable following warnings
  1978. # 144, 167, 556: -Wno-pointer-sign
  1979. # 10006: ignoring unknown option -fno-signed-zeros
  1980. # 10156: ignoring option '-W'; no argument required
  1981. check_cflags -wd144,167,556,10006,10156
  1982. # 11030: Warning unknown option --as-needed
  1983. # 10156: ignoring option '-export'; no argument required
  1984. check_ldflags -wd10156,11030
  1985. # Allow to compile with optimizations
  1986. check_ldflags -march=$cpu
  1987. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  1988. enable ebp_available
  1989. elif enabled ccc; then
  1990. # disable some annoying warnings
  1991. add_cflags -msg_disable cvtu32to64
  1992. add_cflags -msg_disable embedcomment
  1993. add_cflags -msg_disable needconstext
  1994. add_cflags -msg_disable nomainieee
  1995. add_cflags -msg_disable ptrmismatch1
  1996. add_cflags -msg_disable unreachcode
  1997. fi
  1998. # PIC flags for shared library objects where they are needed
  1999. if enabled shared; then
  2000. # LIBOBJFLAGS may have already been set in the OS configuration
  2001. if test -z "$LIBOBJFLAGS" ; then
  2002. case "${subarch-$arch}" in
  2003. x86_64|ia64|alpha|sparc*|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;;
  2004. esac
  2005. fi
  2006. fi
  2007. if enabled gprof; then
  2008. add_cflags -p
  2009. add_ldflags -p
  2010. fi
  2011. # Find out if the .align argument is a power of two or not.
  2012. check_asm asmalign_pot '".align 3"'
  2013. enabled_any $DECODER_LIST && enable decoders
  2014. enabled_any $ENCODER_LIST && enable encoders
  2015. enabled_any $BSF_LIST && enable bsfs
  2016. enabled_any $DEMUXER_LIST && enable demuxers
  2017. enabled_any $MUXER_LIST && enable muxers
  2018. enabled_any $FILTER_LIST && enable filters
  2019. enabled_any $INDEV_LIST && enable demuxers
  2020. enabled_any $OUTDEV_LIST && enable muxers
  2021. enabled_any $PROTOCOL_LIST && enable protocols
  2022. enabled_any $THREADS_LIST && enable threads
  2023. check_deps $CONFIG_LIST \
  2024. $CONFIG_EXTRA \
  2025. $HAVE_LIST \
  2026. $DECODER_LIST \
  2027. $ENCODER_LIST \
  2028. $PARSER_LIST \
  2029. $BSF_LIST \
  2030. $DEMUXER_LIST \
  2031. $MUXER_LIST \
  2032. $FILTER_LIST \
  2033. $INDEV_LIST \
  2034. $OUTDEV_LIST \
  2035. $PROTOCOL_LIST \
  2036. echo "install prefix $prefix"
  2037. echo "source path $source_path"
  2038. echo "C compiler $cc"
  2039. echo ".align is power-of-two $asmalign_pot"
  2040. echo "ARCH $arch ($cpu)"
  2041. if test "$build_suffix" != ""; then
  2042. echo "build suffix $build_suffix"
  2043. fi
  2044. if test "$extra_version" != ""; then
  2045. echo "version string suffix $extra_version"
  2046. fi
  2047. echo "big-endian ${bigendian-no}"
  2048. if enabled x86; then
  2049. echo "yasm ${yasm-no}"
  2050. echo "MMX enabled ${mmx-no}"
  2051. echo "MMX2 enabled ${mmx2-no}"
  2052. echo "3DNow! enabled ${amd3dnow-no}"
  2053. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2054. echo "SSE enabled ${sse-no}"
  2055. echo "SSSE3 enabled ${ssse3-no}"
  2056. echo "CMOV enabled ${cmov-no}"
  2057. echo "CMOV is fast ${fast_cmov-no}"
  2058. echo "EBX available ${ebx_available-no}"
  2059. echo "EBP available ${ebp_available-no}"
  2060. echo "10 operands supported ${ten_operands-no}"
  2061. fi
  2062. if enabled arm; then
  2063. echo "ARMv5TE enabled ${armv5te-no}"
  2064. echo "ARMv6 enabled ${armv6-no}"
  2065. echo "ARMv6T2 enabled ${armv6t2-no}"
  2066. echo "ARM VFP enabled ${armvfp-no}"
  2067. echo "IWMMXT enabled ${iwmmxt-no}"
  2068. echo "NEON enabled ${neon-no}"
  2069. fi
  2070. if enabled mips; then
  2071. echo "MMI enabled ${mmi-no}"
  2072. fi
  2073. if enabled ppc; then
  2074. echo "AltiVec enabled ${altivec-no}"
  2075. echo "PPC 4xx optimizations ${ppc4xx-no}"
  2076. echo "dcbzl available ${dcbzl-no}"
  2077. echo "performance report ${powerpc_perf-no}"
  2078. fi
  2079. if enabled sparc; then
  2080. echo "VIS enabled ${vis-no}"
  2081. fi
  2082. echo "gprof enabled ${gprof-no}"
  2083. echo "debug symbols ${debug-no}"
  2084. echo "strip symbols ${stripping-no}"
  2085. echo "optimizations ${optimizations-no}"
  2086. echo "static ${static-no}"
  2087. echo "shared ${shared-no}"
  2088. echo "postprocessing support ${postproc-no}"
  2089. echo "new filter support ${avfilter-no}"
  2090. echo "filters using lavformat ${avfilter_lavf-no}"
  2091. echo "network support ${network-no}"
  2092. if enabled network; then
  2093. echo "IPv6 support ${ipv6-no}"
  2094. fi
  2095. echo "threading support ${thread_type-no}"
  2096. echo "SDL support ${sdl-no}"
  2097. if enabled sdl_too_old; then
  2098. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
  2099. fi
  2100. echo "Sun medialib support ${mlib-no}"
  2101. echo "AVISynth enabled ${avisynth-no}"
  2102. echo "libamr-nb support ${libamr_nb-no}"
  2103. echo "libamr-wb support ${libamr_wb-no}"
  2104. echo "libdc1394 support ${libdc1394-no}"
  2105. echo "libdirac enabled ${libdirac-no}"
  2106. echo "libfaac enabled ${libfaac-no}"
  2107. echo "libfaad enabled ${libfaad-no}"
  2108. echo "libfaad dlopened ${libfaadbin-no}"
  2109. echo "libgsm enabled ${libgsm-no}"
  2110. echo "libmp3lame enabled ${libmp3lame-no}"
  2111. echo "libnut enabled ${libnut-no}"
  2112. echo "libopenjpeg enabled ${libopenjpeg-no}"
  2113. echo "libschroedinger enabled ${libschroedinger-no}"
  2114. echo "libspeex enabled ${libspeex-no}"
  2115. echo "libtheora enabled ${libtheora-no}"
  2116. echo "libvorbis enabled ${libvorbis-no}"
  2117. echo "libx264 enabled ${libx264-no}"
  2118. echo "libxvid enabled ${libxvid-no}"
  2119. echo "zlib enabled ${zlib-no}"
  2120. echo "bzlib enabled ${bzlib-no}"
  2121. echo
  2122. for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do
  2123. echo "Enabled ${type}s:"
  2124. eval list=\$$(toupper $type)_LIST
  2125. for part in $list; do
  2126. enabled $part && echo ${part%_*}
  2127. done | sort | pr -3 -t
  2128. echo
  2129. done
  2130. license="LGPL"
  2131. if enabled nonfree; then
  2132. license="unredistributable"
  2133. elif enabled gpl; then
  2134. license="GPL"
  2135. fi
  2136. echo "License: $license"
  2137. echo "Creating config.mak and config.h..."
  2138. echo "# Automatically generated by configure - do not modify!" > config.mak
  2139. echo "/* Automatically generated by configure - do not modify! */" > $TMPH
  2140. echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
  2141. echo "#define FFMPEG_CONFIG_H" >> $TMPH
  2142. echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
  2143. echo "#define FFMPEG_DATADIR \"$(eval c_escape $datadir)\"" >> $TMPH
  2144. echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak
  2145. echo "prefix=$prefix" >> config.mak
  2146. echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
  2147. echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
  2148. echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
  2149. echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
  2150. echo "DATADIR=\$(DESTDIR)$datadir" >> config.mak
  2151. echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
  2152. echo "SRC_PATH=\"$source_path\"" >> config.mak
  2153. echo "SRC_PATH_BARE=$source_path" >> config.mak
  2154. echo "BUILD_ROOT=\"$PWD\"" >> config.mak
  2155. echo "CC=$cc" >> config.mak
  2156. echo "AS=$as" >> config.mak
  2157. echo "YASM=$yasmexe" >> config.mak
  2158. echo "AR=$ar" >> config.mak
  2159. echo "RANLIB=$ranlib" >> config.mak
  2160. echo "LN_S=$ln_s" >> config.mak
  2161. enabled stripping &&
  2162. echo "STRIP=$strip" >> config.mak ||
  2163. echo "STRIP=echo ignoring strip" >> config.mak
  2164. echo "OPTFLAGS=$CFLAGS" >> config.mak
  2165. echo "LDFLAGS=$LDFLAGS" >> config.mak
  2166. echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
  2167. echo "SHFLAGS=$SHFLAGS" >> config.mak
  2168. echo "YASMFLAGS=$YASMFLAGS" >> config.mak
  2169. echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
  2170. echo "BUILD_STATIC=$static" >> config.mak
  2171. echo "BUILDSUF=$build_suffix" >> config.mak
  2172. echo "FULLNAME=$FULLNAME" >> config.mak
  2173. echo "LIBPREF=$LIBPREF" >> config.mak
  2174. echo "LIBSUF=$LIBSUF" >> config.mak
  2175. echo "LIBNAME=$LIBNAME" >> config.mak
  2176. echo "SLIBPREF=$SLIBPREF" >> config.mak
  2177. echo "SLIBSUF=$SLIBSUF" >> config.mak
  2178. echo "EXESUF=$EXESUF" >> config.mak
  2179. echo "EXTRA_VERSION=$extra_version" >> config.mak
  2180. echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
  2181. echo "HOSTCC=$host_cc" >> config.mak
  2182. echo "HOSTCFLAGS=$host_cflags" >> config.mak
  2183. echo "HOSTEXESUF=$HOSTEXESUF" >> config.mak
  2184. echo "HOSTLDFLAGS=$host_ldflags" >> config.mak
  2185. echo "HOSTLIBS=$host_libs" >> config.mak
  2186. echo "TARGET_EXEC=$target_exec" >> config.mak
  2187. echo "TARGET_PATH=$target_path" >> config.mak
  2188. if enabled bigendian; then
  2189. echo "WORDS_BIGENDIAN=yes" >> config.mak
  2190. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  2191. fi
  2192. if enabled sdl; then
  2193. echo "SDL_LIBS=$("${SDL_CONFIG}" --libs)" >> config.mak
  2194. echo "SDL_CFLAGS=$("${SDL_CONFIG}" --cflags)" >> config.mak
  2195. fi
  2196. if enabled texi2html; then
  2197. echo "BUILD_DOC=yes" >> config.mak
  2198. fi
  2199. get_version(){
  2200. name=$1
  2201. file=$source_path/$2
  2202. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2203. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2204. lcname=$(tolower $name)
  2205. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2206. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2207. }
  2208. get_version LIBSWSCALE libswscale/swscale.h
  2209. get_version LIBPOSTPROC libpostproc/postprocess.h
  2210. get_version LIBAVCODEC libavcodec/avcodec.h
  2211. get_version LIBAVDEVICE libavdevice/avdevice.h
  2212. get_version LIBAVFORMAT libavformat/avformat.h
  2213. get_version LIBAVUTIL libavutil/avutil.h
  2214. get_version LIBAVFILTER libavfilter/avfilter.h
  2215. if enabled shared; then
  2216. echo "BUILD_SHARED=yes" >> config.mak
  2217. echo "PIC=-fPIC -DPIC" >> config.mak
  2218. echo "LIBTARGET=${LIBTARGET}" >> config.mak
  2219. echo "SLIBNAME=${SLIBNAME}" >> config.mak
  2220. echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
  2221. echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
  2222. echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
  2223. echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
  2224. echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
  2225. echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
  2226. fi
  2227. echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
  2228. echo "EXTRALIBS=$extralibs" >> config.mak
  2229. echo "ARCH=$arch" >> config.mak
  2230. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  2231. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  2232. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  2233. $CONFIG_EXTRA \
  2234. $DECODER_LIST \
  2235. $ENCODER_LIST \
  2236. $PARSER_LIST \
  2237. $BSF_LIST \
  2238. $DEMUXER_LIST \
  2239. $MUXER_LIST \
  2240. $FILTER_LIST \
  2241. $PROTOCOL_LIST \
  2242. $INDEV_LIST \
  2243. $OUTDEV_LIST \
  2244. echo "#define restrict $_restrict" >> $TMPH
  2245. if enabled small; then
  2246. echo "#define av_always_inline" >> $TMPH
  2247. fi
  2248. # Apparently it's not possible to portably echo a backslash.
  2249. enabled asmalign_pot &&
  2250. printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
  2251. printf '#define ASMALIGN(ZEROBITS) ".align 1 << " #ZEROBITS "\\n\\t"\n' >> $TMPH
  2252. echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
  2253. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  2254. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  2255. cmp -s $TMPH config.h &&
  2256. echo "config.h is unchanged" ||
  2257. mv -f $TMPH config.h
  2258. # build tree in object directory if source path is different from current one
  2259. if enabled source_path_used; then
  2260. DIRS="\
  2261. doc \
  2262. libavcodec \
  2263. libavcodec/alpha \
  2264. libavcodec/arm \
  2265. libavcodec/bfin \
  2266. libavcodec/mlib \
  2267. libavcodec/ppc \
  2268. libavcodec/sh4 \
  2269. libavcodec/sparc \
  2270. libavcodec/x86 \
  2271. libavdevice \
  2272. libavfilter \
  2273. libavformat \
  2274. libavutil \
  2275. libpostproc \
  2276. libswscale \
  2277. libswscale/bfin \
  2278. libswscale/mlib \
  2279. libswscale/ppc \
  2280. libswscale/sparc \
  2281. libswscale/x86 \
  2282. tests \
  2283. tools \
  2284. "
  2285. FILES="\
  2286. Makefile \
  2287. common.mak \
  2288. subdir.mak \
  2289. doc/texi2pod.pl \
  2290. libavcodec/Makefile \
  2291. libavdevice/Makefile \
  2292. libavfilter/Makefile \
  2293. libavformat/Makefile \
  2294. libavutil/Makefile \
  2295. libpostproc/Makefile \
  2296. libswscale/Makefile \
  2297. "
  2298. for dir in $DIRS ; do
  2299. mkdir -p $dir
  2300. done
  2301. for f in $FILES ; do
  2302. $ln_s "$source_path/$f" $f
  2303. done
  2304. fi
  2305. # build pkg-config files
  2306. pkgconfig_generate(){
  2307. name=$1
  2308. shortname=${name#lib}${build_suffix}
  2309. comment=$2
  2310. version=$3
  2311. libs=$4
  2312. requires=$5
  2313. cat <<EOF > $name/$name.pc
  2314. prefix=$prefix
  2315. exec_prefix=\${prefix}
  2316. libdir=$libdir
  2317. includedir=$incdir
  2318. Name: $name
  2319. Description: $comment
  2320. Version: $version
  2321. Requires: $(disabled shared && echo $requires)
  2322. Requires.private: $(enabled shared && echo $requires)
  2323. Conflicts:
  2324. Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
  2325. Libs.private: $(enabled shared && echo $libs)
  2326. Cflags: -I\${includedir}
  2327. EOF
  2328. cat <<EOF > $name/$name-uninstalled.pc
  2329. prefix=
  2330. exec_prefix=
  2331. libdir=\${pcfiledir}
  2332. includedir=${source_path}
  2333. Name: $name
  2334. Description: $comment
  2335. Version: $version
  2336. Requires: $requires
  2337. Conflicts:
  2338. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  2339. Cflags: -I\${includedir}
  2340. EOF
  2341. }
  2342. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  2343. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2344. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  2345. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  2346. enabled avfilter &&
  2347. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2348. enabled postproc &&
  2349. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  2350. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"