configure 100 KB

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