configure 87 KB

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