configure 83 KB

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