configure 86 KB

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