configure 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273
  1. #!/bin/sh
  2. #
  3. # FFmpeg configure script
  4. #
  5. # Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  6. # Copyright (c) 2005-2006 Diego Biurrun
  7. # Copyright (c) 2005-2006 Mans Rullgard
  8. #
  9. # make sure we are running under a compatible shell
  10. # try to make this part work with most shells
  11. try_exec(){
  12. echo "Trying shell $1"
  13. type "$1" > /dev/null 2>&1 && exec "$@"
  14. }
  15. unset foo
  16. (: ${foo%%bar}) 2> /dev/null
  17. E1="$?"
  18. (: ${foo?}) 2> /dev/null
  19. E2="$?"
  20. if test "$E1" != 0 || test "$E2" = 0; then
  21. echo "Broken shell detected. Trying alternatives."
  22. export FF_CONF_EXEC
  23. if test "0$FF_CONF_EXEC" -lt 1; then
  24. FF_CONF_EXEC=1
  25. try_exec bash "$0" "$@"
  26. fi
  27. if test "0$FF_CONF_EXEC" -lt 2; then
  28. FF_CONF_EXEC=2
  29. try_exec ksh "$0" "$@"
  30. fi
  31. if test "0$FF_CONF_EXEC" -lt 3; then
  32. FF_CONF_EXEC=3
  33. try_exec /usr/xpg4/bin/sh "$0" "$@"
  34. fi
  35. echo "No compatible shell script interpreter found."
  36. echo "This configure script requires a POSIX-compatible shell"
  37. echo "such as bash or ksh."
  38. echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
  39. echo "Instead, install a working POSIX-compatible shell."
  40. echo "Disabling this configure test will create a broken FFmpeg."
  41. if test "$BASH_VERSION" = '2.04.0(1)-release'; then
  42. echo "This bash version ($BASH_VERSION) is broken on your platform."
  43. echo "Upgrade to a later version if available."
  44. fi
  45. exit 1
  46. fi
  47. show_help(){
  48. echo "Usage: configure [options]"
  49. echo "Options: [defaults in brackets after descriptions]"
  50. echo
  51. echo "Standard options:"
  52. echo " --help print this message"
  53. echo " --logfile=FILE log tests and output to FILE [config.err]"
  54. echo " --disable-logging do not log configure debug information"
  55. echo " --prefix=PREFIX install in PREFIX [$prefix]"
  56. echo " --bindir=DIR install binaries in DIR [PREFIX/bin]"
  57. echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
  58. echo " --shlibdir=DIR install shared libs in DIR [PREFIX/lib]"
  59. echo " --incdir=DIR install includes in DIR [PREFIX/include]"
  60. echo " --mandir=DIR install man page in DIR [PREFIX/share/man]"
  61. echo " --enable-static build static libraries [default=yes]"
  62. echo " --disable-static do not build static libraries [default=no]"
  63. echo " --enable-shared build shared libraries [default=no]"
  64. echo " --disable-shared do not build shared libraries [default=yes]"
  65. echo " --enable-gpl allow use of GPL code, the resulting libav*"
  66. echo " and ffmpeg will be under GPL [default=no]"
  67. echo " --enable-nonfree allow use of nonfree code, the resulting libav*"
  68. echo " and ffmpeg will be unredistributable [default=no]"
  69. echo " --enable-postproc enable GPLed postprocessing support [default=no]"
  70. echo " --enable-swscale software scaler support [default=no]"
  71. echo " --enable-avfilter video filter support (replaces vhook) [default=no]"
  72. echo " --enable-avfilter-lavf video filters dependant on avformat [default=no]"
  73. echo " --enable-beosthreads use BeOS threads [default=no]"
  74. echo " --enable-os2threads use OS/2 threads [default=no]"
  75. echo " --enable-pthreads use pthreads [default=no]"
  76. echo " --enable-w32threads use Win32 threads [default=no]"
  77. echo " --enable-x11grab enable X11 grabbing [default=no]"
  78. echo
  79. echo "External library support:"
  80. echo " --enable-mlib use Sun medialib [default=no]"
  81. echo " --enable-liba52 enable GPLed liba52 support [default=no]"
  82. echo " --enable-liba52bin open liba52.so.0 at runtime [default=no]"
  83. echo " --enable-avisynth allow reading AVISynth script files [default=no]"
  84. echo " --enable-libamr-nb enable libamr-nb floating point audio codec"
  85. echo " --enable-libamr-wb enable libamr-wb floating point audio codec"
  86. echo " --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394"
  87. echo " and libraw1394 [default=no]"
  88. echo " --enable-libdirac enable Dirac support via libdirac [default=no]"
  89. echo " --enable-libfaac enable FAAC support via libfaac [default=no]"
  90. echo " --enable-libfaad enable FAAD support via libfaad [default=no]"
  91. echo " --enable-libfaadbin open libfaad.so.0 at runtime [default=no]"
  92. echo " --enable-libgsm enable GSM support via libgsm [default=no]"
  93. echo " --enable-libmp3lame enable MP3 encoding via libmp3lame [default=no]"
  94. echo " --enable-libnut enable NUT (de)muxing via libnut,"
  95. echo " native demuxer exists [default=no]"
  96. echo " --enable-libschroedinger enable Dirac support via libschroedinger [default=no]"
  97. echo " --enable-libtheora enable Theora encoding via libtheora [default=no]"
  98. echo " --enable-libvorbis enable Vorbis encoding via libvorbis,"
  99. echo " native implementation exists [default=no]"
  100. echo " --enable-libx264 enable H.264 encoding via x264 [default=no]"
  101. echo " --enable-libxvid enable Xvid encoding via xvidcore,"
  102. echo " native MPEG-4/Xvid encoder exists [default=no]"
  103. echo ""
  104. echo "Advanced options (experts only):"
  105. echo " --source-path=PATH path to source code [$source_path]"
  106. echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
  107. echo " --enable-cross-compile assume a cross-compiler is used"
  108. echo " --target-os=OS compiler targets OS [$target_os]"
  109. echo " --cc=CC use C compiler CC [$cc]"
  110. echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
  111. echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
  112. echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
  113. echo " --build-suffix=SUFFIX suffix for application specific build []"
  114. echo " --arch=ARCH select architecture [$arch]"
  115. echo " --cpu=CPU selects the minimum cpu required (affects"
  116. echo " instruction selection, may crash on older CPUs)"
  117. echo " --enable-powerpc-perf enable performance report on PPC"
  118. echo " (requires enabling PMC)"
  119. echo " --disable-mmx disable MMX usage"
  120. echo " --disable-mmx2 disable MMX2 usage"
  121. echo " --disable-ssse3 disable SSSE3 usage"
  122. echo " --disable-armv5te disable armv5te usage"
  123. echo " --disable-armv6 disable armv6 usage"
  124. echo " --disable-armvfp disable ARM VFP usage"
  125. echo " --disable-iwmmxt disable iwmmxt usage"
  126. echo " --disable-altivec disable AltiVec usage"
  127. echo " --disable-network disable network support [default=no]"
  128. echo " --disable-ipv6 disable ipv6 support [default=no]"
  129. echo " --disable-zlib disable zlib [default=no]"
  130. echo " --disable-bzlib disable bzlib [default=no]"
  131. echo " --disable-vhook disable video hooking support"
  132. echo " --disable-mpegaudio-hp faster (but less accurate)"
  133. echo " MPEG audio decoding [default=no]"
  134. echo " --enable-gray enable full grayscale support (slower color)"
  135. echo " --disable-ffmpeg disable ffmpeg build"
  136. echo " --disable-ffserver disable ffserver build"
  137. echo " --disable-ffplay disable ffplay build"
  138. echo " --enable-small optimize for size instead of speed"
  139. echo " --enable-hardcoded-tables use hardcoded tables instead of runtime generation"
  140. echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
  141. echo " --disable-encoder=NAME disables encoder NAME"
  142. echo " --enable-encoder=NAME enables encoder NAME"
  143. echo " --disable-decoder=NAME disables decoder NAME"
  144. echo " --enable-decoder=NAME enables decoder NAME"
  145. echo " --disable-encoders disables all encoders"
  146. echo " --disable-decoders disables all decoders"
  147. echo " --disable-muxer=NAME disables muxer NAME"
  148. echo " --enable-muxer=NAME enables muxer NAME"
  149. echo " --disable-muxers disables all muxers"
  150. echo " --disable-demuxer=NAME disables demuxer NAME"
  151. echo " --enable-demuxer=NAME enables demuxer NAME"
  152. echo " --disable-demuxers disables all demuxers"
  153. echo " --enable-parser=NAME enables parser NAME"
  154. echo " --disable-parser=NAME disables parser NAME"
  155. echo " --disable-parsers disables all parsers"
  156. echo " --enable-bsf=NAME enables bitstream filter NAME"
  157. echo " --disable-bsf=NAME disables bitstream filter NAME"
  158. echo " --disable-bsfs disables all bitstream filters"
  159. echo " --enable-protocol=NAME enables protocol NAME"
  160. echo " --disable-protocol=NAME disables protocol NAME"
  161. echo " --disable-protocols disables all protocols"
  162. echo " --disable-devices disables all devices"
  163. echo " --list-decoders show all available decoders"
  164. echo " --list-encoders show all available encoders"
  165. echo " --list-muxers show all available muxers"
  166. echo " --list-demuxers show all available demuxers"
  167. echo " --list-parsers show all available parsers"
  168. echo " --list-protocols show all available protocols"
  169. echo " --list-bsfs show all available bitstream filters"
  170. echo " --list-indevs show all available input devices"
  171. echo " --list-outdevs show all available output devices"
  172. echo
  173. echo "Developer options (useful when working on FFmpeg itself):"
  174. echo " --disable-debug disable debugging symbols"
  175. echo " --enable-debug=LEVEL set the debug level [$debuglevel]"
  176. echo " --enable-gprof enable profiling with gprof [$gprof]"
  177. echo " --disable-optimizations disable compiler optimizations"
  178. echo " --enable-extra-warnings enable more compiler warnings"
  179. echo " --disable-stripping disable stripping of executables and shared libraries"
  180. echo ""
  181. echo "NOTE: Object files are built at the place where configure is launched."
  182. exit 1
  183. }
  184. log(){
  185. echo "$@" >> $logfile
  186. }
  187. log_file(){
  188. log BEGIN $1
  189. pr -n -t $1 >> $logfile
  190. log END $1
  191. }
  192. echolog(){
  193. log "$@"
  194. echo "$@"
  195. }
  196. die(){
  197. echolog "$@"
  198. cat <<EOF
  199. If you think configure made a mistake, make sure you are using the latest
  200. version from SVN. If the latest version fails, report the problem to the
  201. ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
  202. EOF
  203. if disabled logging; then
  204. cat <<EOF
  205. Rerun configure with logging enabled (do not use --disable-logging), and
  206. include the log this produces with your report.
  207. EOF
  208. else
  209. cat <<EOF
  210. Include the log file "$logfile" produced by configure as this will help
  211. solving the problem.
  212. EOF
  213. fi
  214. rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
  215. exit 1
  216. }
  217. # Avoid locale weirdness, besides we really just want to translate ASCII.
  218. toupper(){
  219. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  220. }
  221. tolower(){
  222. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  223. }
  224. set_all(){
  225. value=$1
  226. shift
  227. for var in $*; do
  228. eval $var=$value
  229. done
  230. }
  231. pushvar(){
  232. for var in $*; do
  233. eval level=\${${var}_level:=0}
  234. eval ${var}_${level}="\$$var"
  235. eval ${var}_level=$(($level+1))
  236. done
  237. }
  238. popvar(){
  239. for var in $*; do
  240. eval level=\${${var}_level:-0}
  241. test $level = 0 && continue
  242. eval level=$(($level-1))
  243. eval $var="\${${var}_${level}}"
  244. eval ${var}_level=$level
  245. eval unset ${var}_${level}
  246. done
  247. }
  248. enable(){
  249. set_all yes $*
  250. }
  251. disable(){
  252. set_all no $*
  253. }
  254. enabled(){
  255. test "${1#!}" = "$1" && op== || op=!=
  256. eval test "x\$${1#!}" $op "xyes"
  257. }
  258. disabled(){
  259. test "${1#!}" = "$1" && op== || op=!=
  260. eval test "x\$${1#!}" $op "xno"
  261. }
  262. enabled_all(){
  263. for opt; do
  264. enabled $opt || return 1
  265. done
  266. }
  267. disabled_all(){
  268. for opt; do
  269. disabled $opt || return 1
  270. done
  271. }
  272. enabled_any(){
  273. for opt; do
  274. enabled $opt && return 0
  275. done
  276. }
  277. disabled_any(){
  278. for opt; do
  279. disabled $opt && return 0
  280. done
  281. }
  282. set_default(){
  283. for opt; do
  284. eval test -z "\$$opt" && eval $opt=\$${opt}_default
  285. done
  286. }
  287. is_in(){
  288. value=$1
  289. shift
  290. for var in $*; do
  291. [ $var = $value ] && return 0
  292. done
  293. return 1
  294. }
  295. check_deps(){
  296. for cfg; do
  297. cfg="${cfg#!}"
  298. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  299. disabled ${cfg}_checking && continue
  300. enable ${cfg}_checking
  301. eval dep_all="\$${cfg}_deps"
  302. eval dep_any="\$${cfg}_deps_any"
  303. pushvar cfg dep_all dep_any
  304. check_deps $dep_all $dep_any
  305. popvar cfg dep_all dep_any
  306. enabled_all $dep_all || disable $cfg
  307. enabled_any $dep_any || disable $cfg
  308. if enabled $cfg; then
  309. eval dep_extralibs="\$${cfg}_extralibs"
  310. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  311. fi
  312. disable ${cfg}_checking
  313. done
  314. }
  315. print_config(){
  316. pfx=$1
  317. header=$2
  318. makefile=$3
  319. shift 3
  320. for cfg; do
  321. ucname="`toupper $cfg`"
  322. if enabled $cfg; then
  323. echo "#define ${pfx}${ucname} 1" >> $header
  324. echo "#define ENABLE_${ucname} 1" >> $header
  325. echo "${pfx}${ucname}=yes" >> $makefile
  326. else
  327. echo "#define ENABLE_${ucname} 0" >> $header
  328. fi
  329. done
  330. }
  331. flags_saved(){
  332. (: ${SAVE_CFLAGS?}) 2> /dev/null
  333. }
  334. save_flags(){
  335. flags_saved && return
  336. SAVE_CFLAGS="$CFLAGS"
  337. SAVE_LDFLAGS="$LDFLAGS"
  338. SAVE_extralibs="$extralibs"
  339. }
  340. restore_flags(){
  341. flags_saved || return
  342. CFLAGS="$SAVE_CFLAGS"
  343. LDFLAGS="$SAVE_LDFLAGS"
  344. extralibs="$SAVE_extralibs"
  345. unset SAVE_CFLAGS
  346. unset SAVE_LDFLAGS
  347. unset SAVE_extralibs
  348. }
  349. temp_cflags(){
  350. save_flags
  351. CFLAGS="$CFLAGS $*"
  352. }
  353. temp_ldflags(){
  354. save_flags
  355. LDFLAGS="$LDFLAGS $*"
  356. }
  357. temp_extralibs(){
  358. save_flags
  359. extralibs="$extralibs $*"
  360. }
  361. append(){
  362. var=$1
  363. shift
  364. flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
  365. eval "$var=\"\$$var $*\""
  366. }
  367. add_cflags(){
  368. append CFLAGS "$@"
  369. }
  370. add_ldflags(){
  371. append LDFLAGS "$@"
  372. }
  373. add_extralibs(){
  374. append extralibs "$@"
  375. }
  376. check_cmd(){
  377. log "$@"
  378. "$@" >> $logfile 2>&1
  379. }
  380. check_cc(){
  381. log check_cc "$@"
  382. cat > $TMPC
  383. log_file $TMPC
  384. check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
  385. }
  386. check_cpp(){
  387. log check_cpp "$@"
  388. cat > $TMPC
  389. log_file $TMPC
  390. check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
  391. }
  392. check_asm(){
  393. log check_asm "$@"
  394. name="$1"
  395. asm="$2"
  396. shift 2
  397. check_cc "$@" <<EOF && enable $name || disable $name
  398. int foo(void){ asm volatile($asm); }
  399. EOF
  400. }
  401. check_yasm(){
  402. log check_yasm "$@"
  403. echo "$1" > $TMPS
  404. log_file $TMPS
  405. shift 1
  406. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  407. }
  408. check_ld(){
  409. log check_ld "$@"
  410. check_cc || return
  411. flags=''
  412. libs=''
  413. for f; do
  414. test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
  415. done
  416. check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
  417. }
  418. check_cflags(){
  419. log check_cflags "$@"
  420. check_cc "$@" <<EOF && add_cflags "$@"
  421. int x;
  422. EOF
  423. }
  424. check_ldflags(){
  425. log check_ldflags "$@"
  426. check_ld "$@" <<EOF && add_ldflags "$@"
  427. int main(void){ return 0; }
  428. EOF
  429. }
  430. check_header(){
  431. log check_header "$@"
  432. header=$1
  433. shift
  434. var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
  435. disable $var
  436. check_cpp "$@" <<EOF && enable $var
  437. #include <$header>
  438. int x;
  439. EOF
  440. }
  441. check_func(){
  442. log check_func "$@"
  443. func=$1
  444. shift
  445. disable $func
  446. check_ld "$@" <<EOF && enable $func
  447. extern int $func();
  448. int main(void){ $func(); }
  449. EOF
  450. }
  451. check_func_headers(){
  452. log check_func_headers "$@"
  453. headers=$1
  454. func=$2
  455. shift 2
  456. disable $func
  457. incs=""
  458. for hdr in $headers; do
  459. incs="$incs
  460. #include <$hdr>"
  461. done
  462. check_ld "$@" <<EOF && enable $func
  463. $incs
  464. int main(int argc, char **argv){
  465. (void) $func;
  466. return 0;
  467. }
  468. EOF
  469. }
  470. check_lib(){
  471. log check_lib "$@"
  472. header="$1"
  473. func="$2"
  474. shift 2
  475. temp_extralibs "$@"
  476. check_header $header && check_func $func && add_extralibs "$@"
  477. err=$?
  478. restore_flags
  479. return $err
  480. }
  481. check_lib2(){
  482. log check_lib2 "$@"
  483. headers="$1"
  484. func="$2"
  485. shift 2
  486. temp_extralibs "$@"
  487. check_func_headers "$headers" $func && add_extralibs "$@"
  488. err=$?
  489. restore_flags
  490. return $err
  491. }
  492. check_exec(){
  493. check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  494. }
  495. check_exec_crash(){
  496. code=`cat`
  497. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  498. # are safe but may not be available everywhere. Thus we use
  499. # raise(SIGTERM) instead. The check is run in a subshell so we
  500. # can redirect the "Terminated" message from the shell. SIGBUS
  501. # is not defined by standard C so it is used conditionally.
  502. (check_exec "$@") >> $logfile 2>&1 <<EOF
  503. #include <signal.h>
  504. static void sighandler(int sig){
  505. raise(SIGTERM);
  506. }
  507. int main(void){
  508. signal(SIGILL, sighandler);
  509. signal(SIGFPE, sighandler);
  510. signal(SIGSEGV, sighandler);
  511. #ifdef SIGBUS
  512. signal(SIGBUS, sighandler);
  513. #endif
  514. { $code }
  515. }
  516. EOF
  517. }
  518. check_type(){
  519. log check_type "$@"
  520. headers=$1
  521. type=$2
  522. shift 2
  523. disable $type
  524. incs=""
  525. for hdr in $headers; do
  526. incs="$incs
  527. #include <$hdr>"
  528. done
  529. check_cc "$@" <<EOF && enable $type
  530. $incs
  531. $type v;
  532. EOF
  533. }
  534. require(){
  535. name="$1"
  536. header="$2"
  537. func="$3"
  538. shift 3
  539. check_lib $header $func "$@" || die "ERROR: $name not found"
  540. }
  541. require2(){
  542. name="$1"
  543. headers="$2"
  544. func="$3"
  545. shift 3
  546. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  547. }
  548. check_foo_config(){
  549. cfg=$1
  550. pkg=$2
  551. header=$3
  552. func=$4
  553. shift 4
  554. disable $cfg
  555. check_cmd ${pkg}-config --version
  556. err=$?
  557. if test "$err" = 0; then
  558. temp_cflags `${pkg}-config --cflags`
  559. temp_extralibs `${pkg}-config --libs`
  560. check_lib "$@" $header $func && enable $cfg
  561. fi
  562. return $err
  563. }
  564. apply(){
  565. file=$1
  566. shift
  567. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  568. }
  569. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  570. # system-dependent things.
  571. COMPONENT_LIST="
  572. bsfs
  573. decoders
  574. demuxers
  575. encoders
  576. filters
  577. indevs
  578. muxers
  579. outdevs
  580. parsers
  581. protocols
  582. "
  583. CONFIG_LIST="
  584. $COMPONENT_LIST
  585. avfilter
  586. avfilter_lavf
  587. avisynth
  588. beos_netserver
  589. bzlib
  590. ffmpeg
  591. ffplay
  592. ffserver
  593. gpl
  594. gprof
  595. gray
  596. hardcoded_tables
  597. ipv6
  598. liba52
  599. liba52bin
  600. libamr_nb
  601. libamr_wb
  602. libdc1394
  603. libdirac
  604. libfaac
  605. libfaad
  606. libfaadbin
  607. libgsm
  608. libmp3lame
  609. libnut
  610. libschroedinger
  611. libtheora
  612. libvorbis
  613. libx264
  614. libxvid
  615. memalign_hack
  616. mlib
  617. mpegaudio_hp
  618. network
  619. nonfree
  620. postproc
  621. powerpc_perf
  622. small
  623. swscale
  624. vhook
  625. x11grab
  626. zlib
  627. "
  628. THREADS_LIST='
  629. beosthreads
  630. os2threads
  631. pthreads
  632. w32threads
  633. '
  634. ARCH_LIST='
  635. alpha
  636. armv4l
  637. bfin
  638. ia64
  639. m68k
  640. mips
  641. parisc
  642. powerpc
  643. s390
  644. sh4
  645. sparc
  646. sparc64
  647. x86
  648. x86_32
  649. x86_64
  650. '
  651. ARCH_EXT_LIST='
  652. altivec
  653. armv5te
  654. armv6
  655. armvfp
  656. iwmmxt
  657. mmi
  658. mmx
  659. mmx2
  660. neon
  661. ssse3
  662. vis
  663. '
  664. HAVE_LIST="
  665. $ARCH_EXT_LIST
  666. $THREADS_LIST
  667. altivec_h
  668. arpa_inet_h
  669. bswap
  670. byteswap_h
  671. closesocket
  672. cmov
  673. conio_h
  674. dcbzl
  675. dev_bktr_ioctl_bt848_h
  676. dev_bktr_ioctl_meteor_h
  677. dev_ic_bt8xx_h
  678. dev_video_meteor_ioctl_meteor_h
  679. dev_video_bktr_ioctl_bt848_h
  680. dlfcn_h
  681. dlopen
  682. ebp_available
  683. ebx_available
  684. fast_64bit
  685. fast_cmov
  686. fast_unaligned
  687. fork
  688. freetype2
  689. gethrtime
  690. GetProcessTimes
  691. getrusage
  692. imlib2
  693. inet_aton
  694. inline_asm
  695. libdc1394_1
  696. libdc1394_2
  697. llrint
  698. lrint
  699. lrintf
  700. machine_ioctl_bt848_h
  701. machine_ioctl_meteor_h
  702. malloc_h
  703. memalign
  704. mkstemp
  705. pld
  706. ppc64
  707. round
  708. roundf
  709. sdl
  710. sdl_video_size
  711. socklen_t
  712. soundcard_h
  713. poll_h
  714. sys_mman_h
  715. sys_resource_h
  716. sys_select_h
  717. sys_soundcard_h
  718. sys_videoio_h
  719. termios_h
  720. threads
  721. winsock2_h
  722. yasm
  723. "
  724. CMDLINE_SELECT="
  725. $ARCH_EXT_LIST
  726. $CONFIG_LIST
  727. $THREADS_LIST
  728. cross_compile
  729. debug
  730. extra_warnings
  731. logging
  732. optimizations
  733. shared
  734. static
  735. stripping
  736. "
  737. PATHS_LIST='
  738. bindir
  739. incdir
  740. libdir
  741. mandir
  742. prefix
  743. shlibdir
  744. '
  745. CMDLINE_SET="
  746. $PATHS_LIST
  747. arch
  748. build_suffix
  749. cc
  750. cpu
  751. cross_prefix
  752. logfile
  753. source_path
  754. target_os
  755. "
  756. # code dependency declarations
  757. # architecture extensions
  758. altivec_deps="powerpc"
  759. armv5te_deps="armv4l"
  760. armv6_deps="armv4l"
  761. armvfp_deps="armv4l"
  762. iwmmxt_deps="armv4l"
  763. mmi_deps="mips"
  764. mmx_deps="x86"
  765. mmx2_deps="x86 mmx"
  766. neon_deps="armv4l"
  767. ssse3_deps="x86"
  768. vis_deps="sparc"
  769. # system headers and functions
  770. byteswap_h_deps="!armv4l"
  771. # decoders / encoders
  772. ac3_decoder_deps="gpl !liba52"
  773. dxa_decoder_deps="zlib"
  774. eac3_decoder_deps="gpl"
  775. flashsv_decoder_deps="zlib"
  776. flashsv_encoder_deps="zlib"
  777. mlp_decoder_deps="mlp_parser"
  778. mpeg_xvmc_decoder_deps="xvmc"
  779. png_decoder_deps="zlib"
  780. png_encoder_deps="zlib"
  781. zmbv_decoder_deps="zlib"
  782. zmbv_encoder_deps="zlib"
  783. # external libraries
  784. liba52_decoder_deps="liba52"
  785. liba52bin_decoder_extralibs='$ldl'
  786. libamr_nb_decoder_deps="libamr_nb"
  787. libamr_nb_encoder_deps="libamr_nb"
  788. libamr_wb_decoder_deps="libamr_wb"
  789. libamr_wb_encoder_deps="libamr_wb"
  790. libdirac_decoder_deps="libdirac !libschroedinger"
  791. libdirac_encoder_deps="libdirac"
  792. libfaac_encoder_deps="libfaac"
  793. libfaad_decoder_deps="libfaad"
  794. libfaadbin_decoder_extralibs='$ldl'
  795. libgsm_decoder_deps="libgsm"
  796. libgsm_encoder_deps="libgsm"
  797. libgsm_ms_decoder_deps="libgsm"
  798. libgsm_ms_encoder_deps="libgsm"
  799. libmp3lame_encoder_deps="libmp3lame"
  800. libschroedinger_decoder_deps="libschroedinger"
  801. libschroedinger_encoder_deps="libschroedinger"
  802. libtheora_encoder_deps="libtheora"
  803. libvorbis_encoder_deps="libvorbis"
  804. libx264_encoder_deps="libx264"
  805. libxvid_encoder_deps="libxvid"
  806. mpeg4aac_decoder_deps="libfaad"
  807. # demuxers / muxers
  808. ac3_demuxer_deps="ac3_parser"
  809. audio_beos_demuxer_deps="audio_beos"
  810. audio_beos_demuxer_extralibs="-lmedia -lbe"
  811. audio_beos_muxer_deps="audio_beos"
  812. audio_beos_muxer_extralibs="-lmedia -lbe"
  813. avisynth_demuxer_deps="avisynth"
  814. bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  815. dirac_demuxer_deps="dirac_parser"
  816. dv1394_demuxer_deps="dv1394 dv_demuxer"
  817. libdc1394_demuxer_deps="libdc1394"
  818. libnut_demuxer_deps="libnut"
  819. libnut_muxer_deps="libnut"
  820. mp3_demuxer_deps="mpegaudio_parser"
  821. oss_demuxer_deps_any="soundcard_h sys_soundcard_h"
  822. oss_muxer_deps_any="soundcard_h sys_soundcard_h"
  823. redir_demuxer_deps="network"
  824. rtp_muxer_deps="network rtp_protocol"
  825. rtsp_demuxer_deps="sdp_demuxer"
  826. sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
  827. v4l_demuxer_deps="linux_videodev_h"
  828. v4l2_demuxer_deps_any="linux_videodev2_h sys_videoio_h"
  829. vfwcap_demuxer_deps="capCreateCaptureWindow"
  830. vfwcap_demuxer_extralibs="-lvfw32"
  831. x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
  832. x11_grab_device_demuxer_extralibs="-lX11 -lXext"
  833. # protocols
  834. http_protocol_deps="network"
  835. rtp_protocol_deps="udp_protocol"
  836. tcp_protocol_deps="network"
  837. udp_protocol_deps="network"
  838. # filters
  839. movie_filter_deps="avfilter_lavf"
  840. # programs
  841. ffplay_deps="sdl"
  842. ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
  843. ffserver_extralibs='$ldl'
  844. vhook_extralibs='$ldl'
  845. # default parameters
  846. logfile="config.err"
  847. # installation paths
  848. prefix_default="/usr/local"
  849. bindir_default='${prefix}/bin'
  850. incdir_default='${prefix}/include'
  851. libdir_default='${prefix}/lib'
  852. mandir_default='${prefix}/share/man'
  853. shlibdir_default="$libdir_default"
  854. # toolchain
  855. cc="gcc"
  856. yasmexe="yasm"
  857. ar="ar"
  858. nm="nm"
  859. ranlib="ranlib"
  860. strip="strip"
  861. asmalign_pot="unknown"
  862. ln_s="ln -sf"
  863. objformat="elf"
  864. # machine
  865. arch=`uname -m`
  866. cpu="generic"
  867. # OS
  868. target_os=$(tolower $(uname -s))
  869. # libraries
  870. enable bzlib
  871. enable zlib
  872. # configurable options
  873. enable debug
  874. enable ffmpeg
  875. enable ffplay
  876. enable ffserver
  877. enable ipv6
  878. enable mpegaudio_hp
  879. enable network
  880. enable optimizations
  881. enable protocols
  882. enable static
  883. enable stripping
  884. vhook="default"
  885. # build settings
  886. add_cflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
  887. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  888. VHOOKSHFLAGS='$(SHFLAGS)'
  889. FFSERVERLDFLAGS=-Wl,-E
  890. LIBPREF="lib"
  891. LIBSUF=".a"
  892. FULLNAME='$(NAME)$(BUILDSUF)'
  893. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  894. SLIBPREF="lib"
  895. SLIBSUF=".so"
  896. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  897. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  898. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  899. LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  900. # gcc stupidly only outputs the basename of targets with -MM
  901. DEPEND_CMD='$(CC) $(CFLAGS) -MM -MG $< | sed -e "/^\#.*/d" -e "1s,^,$(@D)/," -e "s,\\([[:space:]]\\)\\(version\\.h\\),\\1\$$(BUILD_ROOT_REL)/\\2,"'
  902. # find source path
  903. source_path="`dirname \"$0\"`"
  904. enable source_path_used
  905. if test -z "$source_path" -o "$source_path" = "." ; then
  906. source_path="`pwd`"
  907. disable source_path_used
  908. else
  909. source_path="`cd \"$source_path\"; pwd`"
  910. echo "$source_path" | grep -q '[[:blank:]]' &&
  911. die "Out of tree builds are impossible with whitespace in source path."
  912. fi
  913. FFMPEG_CONFIGURATION="$@"
  914. find_things(){
  915. thing=$1
  916. pattern=$2
  917. file=$source_path/$3
  918. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  919. }
  920. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  921. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  922. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  923. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  924. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  925. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  926. OUTDEV_LIST=$(find_things muxer _MUX libavdevice/alldevices.c)
  927. INDEV_LIST=$(find_things demuxer DEMUX libavdevice/alldevices.c)
  928. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  929. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  930. enable $ARCH_EXT_LIST \
  931. $DECODER_LIST \
  932. $ENCODER_LIST \
  933. $PARSER_LIST \
  934. $BSF_LIST \
  935. $DEMUXER_LIST \
  936. $MUXER_LIST \
  937. $FILTER_LIST \
  938. $PROTOCOL_LIST \
  939. $INDEV_LIST \
  940. $OUTDEV_LIST \
  941. die_unknown(){
  942. echo "Unknown option \"$1\"."
  943. echo "See $0 --help for available options."
  944. exit 1
  945. }
  946. show_list() {
  947. suffix=_$1
  948. shift
  949. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
  950. exit 0
  951. }
  952. for opt do
  953. optval="${opt#*=}"
  954. case "$opt" in
  955. --extra-cflags=*) add_cflags "$optval"
  956. ;;
  957. --extra-ldflags=*) add_ldflags "$optval"
  958. ;;
  959. --extra-libs=*) add_extralibs "$optval"
  960. ;;
  961. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  962. ;;
  963. --enable-debug=*) debuglevel="$optval"
  964. ;;
  965. --enable-*=*|--disable-*=*)
  966. eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
  967. case "$thing" in
  968. encoder|decoder|muxer|demuxer|parser|bsf|protocol|filter) $action ${optval}_${thing} ;;
  969. *) die_unknown "$opt" ;;
  970. esac
  971. ;;
  972. --enable-?*|--disable-?*)
  973. eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
  974. if is_in $option $COMPONENT_LIST; then
  975. eval $action \$$(toupper ${option%s})_LIST
  976. elif is_in $option $CMDLINE_SELECT; then
  977. $action $option
  978. else
  979. die_unknown $opt
  980. fi
  981. ;;
  982. --list-*)
  983. NAME="${opt#--list-}"
  984. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  985. NAME=${NAME%s}
  986. eval show_list $NAME \$$(toupper $NAME)_LIST
  987. ;;
  988. --help|-h) show_help
  989. ;;
  990. *)
  991. optname="${opt%=*}"
  992. optname="${optname#--}"
  993. optname=$(echo "$optname" | sed 's/-/_/g')
  994. is_in $optname $CMDLINE_SET || die_unknown $opt
  995. eval $optname='$optval'
  996. ;;
  997. esac
  998. done
  999. disabled logging && logfile=/dev/null
  1000. echo "# $0 $@" > $logfile
  1001. set >> $logfile
  1002. cc="${cross_prefix}${cc}"
  1003. yasmexe="${cross_prefix}${yasmexe}"
  1004. ar="${cross_prefix}${ar}"
  1005. nm="${cross_prefix}${nm}"
  1006. ranlib="${cross_prefix}${ranlib}"
  1007. strip="${cross_prefix}${strip}"
  1008. # set temporary file name
  1009. if test ! -z "$TMPDIR" ; then
  1010. TMPDIR1="${TMPDIR}"
  1011. elif test ! -z "$TEMPDIR" ; then
  1012. TMPDIR1="${TEMPDIR}"
  1013. else
  1014. TMPDIR1="/tmp"
  1015. fi
  1016. TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
  1017. TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}${EXESUF}"
  1018. TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
  1019. TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
  1020. TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
  1021. TMPSH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
  1022. check_cflags -fasm
  1023. check_cflags -std=c99
  1024. case "$arch" in
  1025. i386|i486|i586|i686|i86pc|BePC)
  1026. arch="x86_32"
  1027. enable fast_unaligned
  1028. ;;
  1029. x86_64|amd64)
  1030. arch="x86_32"
  1031. enable fast_unaligned
  1032. check_cc <<EOF && enable fast_64bit && arch="x86_64"
  1033. int test[sizeof(char*) - 7];
  1034. EOF
  1035. ;;
  1036. # armv4l is a subset of armv[567]*l
  1037. arm|armv[4567]*l)
  1038. arch="armv4l"
  1039. ;;
  1040. alpha)
  1041. arch="alpha"
  1042. enable fast_64bit
  1043. ;;
  1044. "Power Macintosh"|ppc|powerpc)
  1045. arch="powerpc"
  1046. ;;
  1047. ppc64)
  1048. arch="powerpc"
  1049. enable fast_64bit
  1050. ;;
  1051. mips|mipsel|IP*)
  1052. arch="mips"
  1053. ;;
  1054. sun4u|sparc64)
  1055. arch="sparc64"
  1056. enable fast_64bit
  1057. ;;
  1058. sparc)
  1059. arch="sparc"
  1060. ;;
  1061. sh4)
  1062. arch="sh4"
  1063. ;;
  1064. parisc)
  1065. arch="parisc"
  1066. ;;
  1067. parisc64)
  1068. arch="parisc"
  1069. enable fast_64bit
  1070. ;;
  1071. s390|s390x)
  1072. arch="s390"
  1073. ;;
  1074. m68k)
  1075. arch="m68k"
  1076. ;;
  1077. ia64)
  1078. arch="ia64"
  1079. enable fast_64bit
  1080. ;;
  1081. bfin)
  1082. arch="bfin"
  1083. ;;
  1084. *)
  1085. arch="unknown"
  1086. ;;
  1087. esac
  1088. enable $arch
  1089. enabled_any x86_32 x86_64 && enable x86
  1090. enabled sparc64 && enable sparc
  1091. # OS specific
  1092. case $target_os in
  1093. beos|haiku|zeta)
  1094. prefix_default="$HOME/config"
  1095. # helps building libavcodec
  1096. add_cflags "-DPIC -fomit-frame-pointer"
  1097. # 3 gcc releases known for BeOS, each with ugly bugs
  1098. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  1099. case "$gcc_version" in
  1100. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1101. disable mmx
  1102. ;;
  1103. *20010315*) echo "BeBits gcc"
  1104. add_cflags "-fno-expensive-optimizations"
  1105. ;;
  1106. esac
  1107. SHFLAGS=-nostart
  1108. # enable BeOS things
  1109. enable audio_beos
  1110. # no need for libm, but the inet stuff
  1111. # Check for BONE
  1112. # XXX: actually should check for NOT net_server
  1113. if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
  1114. network_extralibs="-lbind -lsocket"
  1115. else
  1116. enable beos_netserver
  1117. network_extralibs="-lnet"
  1118. fi ;;
  1119. sunos)
  1120. FFSERVERLDFLAGS=""
  1121. SHFLAGS='-shared -Wl,-h,$$(@F)'
  1122. network_extralibs="-lsocket -lnsl"
  1123. ;;
  1124. netbsd)
  1125. oss_demuxer_extralibs="-lossaudio"
  1126. oss_muxer_extralibs="-lossaudio"
  1127. ;;
  1128. openbsd)
  1129. disable need_memalign
  1130. LIBOBJFLAGS='$(PIC)'
  1131. SHFLAGS='-shared'
  1132. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF).$(LIBVERSION)'
  1133. SLIBNAME_WITH_VERSION='$(SLIBNAME)'
  1134. SLIBNAME_WITH_MAJOR='$(SLIBNAME)'
  1135. oss_demuxer_extralibs="-lossaudio"
  1136. oss_muxer_extralibs="-lossaudio"
  1137. ;;
  1138. freebsd)
  1139. disable need_memalign
  1140. ;;
  1141. bsd/os)
  1142. osextralibs="-lpoll -lgnugetopt"
  1143. strip="strip -d"
  1144. ;;
  1145. darwin)
  1146. disable need_memalign
  1147. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  1148. VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$$(@F)'
  1149. strip="strip -x"
  1150. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1151. SLIBSUF=".dylib"
  1152. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1153. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1154. FFSERVERLDFLAGS=-Wl,-bind_at_load
  1155. objformat="macho"
  1156. enabled x86_64 && objformat="macho64"
  1157. ;;
  1158. mingw32*)
  1159. target_os=mingw32
  1160. LIBTARGET=i386
  1161. if test $arch = x86_64; then
  1162. disable need_memalign
  1163. LIBTARGET=x64
  1164. fi
  1165. shlibdir_default="$bindir_default"
  1166. VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
  1167. VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
  1168. if enabled swscale; then
  1169. VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
  1170. VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
  1171. fi
  1172. disable ffserver
  1173. SLIBPREF=""
  1174. SLIBSUF=".dll"
  1175. EXESUF=".exe"
  1176. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1177. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1178. SLIB_EXTRA_CMD='-lib /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  1179. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  1180. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
  1181. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  1182. SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  1183. objformat="win32"
  1184. ;;
  1185. cygwin*)
  1186. target_os=cygwin
  1187. shlibdir_default="$bindir_default"
  1188. VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
  1189. VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
  1190. if enabled swscale; then
  1191. VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
  1192. VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
  1193. fi
  1194. EXESUF=".exe"
  1195. SLIBPREF="cyg"
  1196. SLIBSUF=".dll"
  1197. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  1198. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  1199. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  1200. objformat="win32"
  1201. ;;
  1202. *-dos|freedos|opendos)
  1203. disable ffplay ffserver vhook
  1204. disable $INDEV_LIST $OUTDEV_LIST
  1205. network_extralibs="-lsocket"
  1206. EXESUF=".exe"
  1207. objformat="win32"
  1208. ;;
  1209. linux)
  1210. enable dv1394
  1211. ;;
  1212. irix*)
  1213. target_os=irix
  1214. ranlib="echo ignoring ranlib"
  1215. ;;
  1216. os/2*)
  1217. strip="lxlite"
  1218. ln_s="cp -f"
  1219. EXESUF=".exe"
  1220. FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  1221. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  1222. FFSERVERLDFLAGS=""
  1223. LIBSUF="_s.a"
  1224. SLIBPREF=""
  1225. SLIBSUF=".dll"
  1226. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  1227. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  1228. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  1229. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  1230. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  1231. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  1232. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  1233. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  1234. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  1235. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  1236. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  1237. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  1238. disable vhook
  1239. ;;
  1240. interix)
  1241. disable vhook
  1242. ;;
  1243. *)
  1244. target_os="${target_os}-UNKNOWN"
  1245. ;;
  1246. esac
  1247. set_default $PATHS_LIST
  1248. add_extralibs $osextralibs
  1249. # Combine FFLDFLAGS and the LDFLAGS environment variable.
  1250. LDFLAGS="$FFLDFLAGS $LDFLAGS"
  1251. test -n "$cross_prefix" && enable cross_compile
  1252. # we need to build at least one lib type
  1253. if ! enabled_any static shared; then
  1254. cat <<EOF
  1255. At least one library type must be built.
  1256. Specify --enable-static to build the static libraries or --enable-shared to
  1257. build the shared libraries as well. To only build the shared libraries specify
  1258. --disable-static in addition to --enable-shared.
  1259. EOF
  1260. exit 1;
  1261. fi
  1262. disabled static && LIBNAME=""
  1263. if enabled_any libfaad libfaadbin ; then
  1264. if check_header faad.h; then
  1265. check_cc << EOF
  1266. #include <faad.h>
  1267. #ifndef FAAD2_VERSION
  1268. ok faad1
  1269. #endif
  1270. int main(void) { return 0; }
  1271. EOF
  1272. test $? = 0 && enable libfaad2
  1273. else
  1274. die "FAAD test failed."
  1275. fi
  1276. fi
  1277. if ! enabled gpl; then
  1278. die_gpl_disabled(){
  1279. name=$1
  1280. shift
  1281. enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified."
  1282. }
  1283. die_gpl_disabled "The Postprocessing code" postproc
  1284. die_gpl_disabled "liba52" liba52
  1285. die_gpl_disabled "libx264" libx264
  1286. die_gpl_disabled "libxvidcore" libxvid
  1287. die_gpl_disabled "FAAD2" libfaad2
  1288. die_gpl_disabled "The X11 grabber" x11grab
  1289. die_gpl_disabled "The software scaler" swscale
  1290. fi
  1291. if ! enabled nonfree && enabled_any libamr_nb libamr_wb; then
  1292. die "libamr is nonfree and --enable-nonfree is not specified."
  1293. fi
  1294. check_deps $ARCH_EXT_LIST
  1295. test -z "$need_memalign" && need_memalign="$mmx"
  1296. #Darwin CC versions
  1297. if test $target_os = darwin; then
  1298. if $cc -v 2>&1 | grep -q xlc; then
  1299. add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
  1300. else
  1301. add_cflags "-pipe"
  1302. check_cflags "-force_cpusubtype_ALL"
  1303. check_cflags "-Wno-sign-compare"
  1304. enabled shared || check_cflags -mdynamic-no-pic
  1305. fi
  1306. fi
  1307. disabled optimizations || check_cflags -fomit-frame-pointer
  1308. # Add processor-specific flags
  1309. if test $cpu != "generic"; then
  1310. warn_altivec(){
  1311. $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
  1312. }
  1313. case $cpu in
  1314. 601|ppc601|PowerPC601)
  1315. add_cflags "-mcpu=601"
  1316. warn_altivec enabled PPC601
  1317. ;;
  1318. 603*|ppc603*|PowerPC603*)
  1319. add_cflags "-mcpu=603"
  1320. warn_altivec enabled PPC603
  1321. ;;
  1322. 604*|ppc604*|PowerPC604*)
  1323. add_cflags "-mcpu=604"
  1324. warn_altivec enabled PPC604
  1325. ;;
  1326. G3|g3|75*|ppc75*|PowerPC75*)
  1327. add_cflags "-mcpu=750 -mpowerpc-gfxopt"
  1328. warn_altivec enabled PPC75x
  1329. ;;
  1330. G4|g4|745*|ppc745*|PowerPC745*)
  1331. add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
  1332. warn_altivec disabled PPC745x
  1333. ;;
  1334. 74*|ppc74*|PowerPC74*)
  1335. add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
  1336. warn_altivec disabled PPC74xx
  1337. ;;
  1338. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  1339. add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1340. warn_altivec disabled PPC970
  1341. enable ppc64
  1342. ;;
  1343. Cell|CELL|cell)
  1344. add_cflags "-mcpu=cell"
  1345. warn_altivec disabled Cell
  1346. enable ppc64
  1347. ;;
  1348. # targets that do NOT support conditional mov (cmov)
  1349. i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1350. add_cflags "-march=$cpu"
  1351. disable cmov
  1352. ;;
  1353. # targets that do support conditional mov (cmov)
  1354. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
  1355. add_cflags "-march=$cpu"
  1356. enable cmov
  1357. enable fast_cmov
  1358. ;;
  1359. # targets that do support conditional mov but on which it's slow
  1360. pentium4|pentium4m|prescott|nocona)
  1361. add_cflags "-march=$cpu"
  1362. enable cmov
  1363. disable fast_cmov
  1364. ;;
  1365. sparc64)
  1366. add_cflags "-mcpu=v9"
  1367. ;;
  1368. arm*|cortex*)
  1369. add_cflags "-mcpu=$cpu"
  1370. ;;
  1371. *)
  1372. echo "WARNING: Unknown CPU \"$cpu\", ignored."
  1373. ;;
  1374. esac
  1375. fi
  1376. # make sure we can execute files in $TMPDIR
  1377. cat > $TMPSH 2>> $logfile <<EOF
  1378. #! /bin/sh
  1379. EOF
  1380. chmod +x $TMPSH >> $logfile 2>&1
  1381. if ! $TMPSH >> $logfile 2>&1; then
  1382. cat <<EOF
  1383. Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
  1384. variable to another directory and make sure that $TMPDIR1 is not mounted
  1385. noexec.
  1386. EOF
  1387. die "Sanity test failed."
  1388. fi
  1389. rm $TMPSH
  1390. # compiler sanity check
  1391. check_exec <<EOF
  1392. int main(void){ return 0; }
  1393. EOF
  1394. if test "$?" != 0; then
  1395. echo "$cc is unable to create an executable file."
  1396. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1397. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  1398. echo "Only do this if you know what cross compiling means."
  1399. fi
  1400. die "C compiler test failed."
  1401. fi
  1402. check_cc <<EOF || die "Symbol mangling check failed."
  1403. int ff_extern;
  1404. EOF
  1405. sym=$($nm -P -g $TMPO | grep ff_extern)
  1406. extern_prefix=${sym%%ff_extern*}
  1407. check_asm inline_asm '""'
  1408. if enabled x86; then
  1409. # check whether EBP is available on x86
  1410. # As 'i' is stored on the stack, this program will crash
  1411. # if the base pointer is used to access it because the
  1412. # base pointer is cleared in the inline assembly code.
  1413. check_exec_crash <<EOF && enable ebp_available
  1414. volatile int i=0;
  1415. asm volatile (
  1416. "xorl %%ebp, %%ebp"
  1417. ::: "%ebp");
  1418. return i;
  1419. EOF
  1420. # check wether EBX is available on x86
  1421. check_asm ebx_available '"":::"%ebx"'
  1422. # check whether binutils is new enough to compile SSSE3/MMX2
  1423. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  1424. enabled mmx2 && check_asm mmx2 '"movss %xmm0, %xmm0"'
  1425. check_asm bswap '"bswap %%eax" ::: "%eax"'
  1426. YASMFLAGS="-f $objformat -DARCH_$(toupper $arch)"
  1427. enabled x86_64 && append YASMFLAGS "-m amd64"
  1428. enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
  1429. case "$objformat" in
  1430. elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
  1431. macho64) append YASMFLAGS "-DPIC -DPREFIX" ;;
  1432. *) append YASMFLAGS "-DPREFIX" ;;
  1433. esac
  1434. check_yasm "pabsw xmm0, xmm0" && enable yasm
  1435. fi
  1436. # check for assembler specific support
  1437. if test $arch = "powerpc"; then
  1438. check_cc <<EOF && enable dcbzl
  1439. int main(void) {
  1440. register long zero = 0;
  1441. char data[1024];
  1442. asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
  1443. return 0;
  1444. }
  1445. EOF
  1446. fi
  1447. # check for SIMD availability
  1448. # AltiVec flags: The FSF version of GCC differs from the Apple version
  1449. if enabled altivec; then
  1450. check_cflags -maltivec -mabi=altivec &&
  1451. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  1452. check_cflags -faltivec
  1453. # check if our compiler supports Motorola AltiVec C API
  1454. check_cc <<EOF || disable altivec
  1455. $inc_altivec_h
  1456. int main(void) {
  1457. vector signed int v1, v2, v3;
  1458. v1 = vec_add(v2,v3);
  1459. return 0;
  1460. }
  1461. EOF
  1462. # check if our compiler supports braces for vector declarations
  1463. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  1464. $inc_altivec_h
  1465. int main (void) { (vector int) {1}; return 0; }
  1466. EOF
  1467. fi
  1468. # We have to check if pld is a nop and disable it.
  1469. enabled armv4l && check_asm pld '"pld [r0]"'
  1470. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  1471. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  1472. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  1473. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  1474. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  1475. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  1476. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
  1477. enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc"
  1478. # ---
  1479. # big/little-endian test
  1480. check_cc <<EOF || die "endian test failed"
  1481. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  1482. EOF
  1483. od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  1484. # ---
  1485. # check availability of some header files
  1486. if check_func dlopen; then
  1487. ldl=
  1488. elif check_func dlopen -ldl; then
  1489. ldl=-ldl
  1490. fi
  1491. check_func fork
  1492. check_func gethrtime
  1493. check_func getrusage
  1494. check_func inet_aton $network_extralibs
  1495. check_func memalign
  1496. check_func mkstemp
  1497. check_func_headers windows.h GetProcessTimes
  1498. check_header byteswap.h
  1499. check_header conio.h
  1500. check_header dlfcn.h
  1501. check_header malloc.h
  1502. check_header poll.h
  1503. check_header sys/mman.h
  1504. check_header sys/resource.h
  1505. check_header sys/select.h
  1506. check_header termios.h
  1507. if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
  1508. die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
  1509. fi
  1510. enabled zlib && check_lib zlib.h zlibVersion -lz || disable zlib
  1511. enabled bzlib && check_lib bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  1512. # check for some common methods of building with pthread support
  1513. # do this before the optional library checks as some of them require pthreads
  1514. if enabled pthreads; then
  1515. if check_func pthread_create; then
  1516. :
  1517. elif check_func pthread_create -pthread; then
  1518. add_cflags -pthread
  1519. add_extralibs -pthread
  1520. elif check_func pthread_create -pthreads; then
  1521. add_cflags -pthreads
  1522. add_extralibs -pthreads
  1523. elif check_func pthread_create -lpthreadGC2; then
  1524. add_extralibs -lpthreadGC2
  1525. elif ! check_lib pthread.h pthread_create -lpthread; then
  1526. die "ERROR: can't find pthreads library"
  1527. fi
  1528. fi
  1529. for thread in $THREADS_LIST; do
  1530. if enabled $thread; then
  1531. test -n "$thread_type" &&
  1532. die "ERROR: Only one thread type must be selected." ||
  1533. thread_type="$thread"
  1534. fi
  1535. done
  1536. check_lib math.h sin -lm
  1537. # test for C99 functions in math.h
  1538. for func in llrint lrint lrintf round roundf; do
  1539. check_exec <<EOF && enable $func || disable $func
  1540. #include <math.h>
  1541. int main(void) { return ($func(3.999f) > 0)?0:1; }
  1542. EOF
  1543. done
  1544. # these are off by default, so fail if requested and not available
  1545. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
  1546. enabled liba52 && require liba52 a52dec/a52.h a52_init -la52
  1547. enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
  1548. enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
  1549. enabled libdirac && add_cflags "$(pkg-config --cflags dirac)" \
  1550. && require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder \
  1551. && require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder
  1552. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  1553. enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
  1554. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  1555. enabled libmp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
  1556. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  1557. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) \
  1558. && require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  1559. enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg
  1560. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  1561. enabled libx264 && require x264 x264.h x264_encoder_open -lx264 -lm
  1562. enabled libxvid && require Xvid xvid.h xvid_global -lxvidcore
  1563. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  1564. # libdc1394 check
  1565. if enabled libdc1394; then
  1566. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  1567. enable libdc1394_2; } ||
  1568. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  1569. enable libdc1394_1; } ||
  1570. die "ERROR: No version of libdc1394 found "
  1571. fi
  1572. _restrict=
  1573. for restrict_keyword in restrict __restrict__ __restrict; do
  1574. check_cc <<EOF && _restrict=$restrict_keyword && break
  1575. void foo(char * $restrict_keyword p);
  1576. EOF
  1577. done
  1578. test "$vhook" = "default" && vhook="$dlopen"
  1579. if test "$target_os" = cygwin -o "$target_os" = mingw32 && enabled_all static vhook ; then
  1580. disable vhook
  1581. echo
  1582. echo "At the moment vhooks don't work on Cygwin or MinGW static builds."
  1583. echo "Patches welcome."
  1584. echo
  1585. fi
  1586. if enabled vhook; then
  1587. check_ldflags -rdynamic
  1588. check_ldflags -export-dynamic
  1589. fi
  1590. check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
  1591. check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
  1592. ##########################################
  1593. # SDL check
  1594. disable sdl_too_old
  1595. disable sdl
  1596. SDL_CONFIG="${cross_prefix}sdl-config"
  1597. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  1598. sdl_cflags=`"${SDL_CONFIG}" --cflags`
  1599. temp_cflags $sdl_cflags
  1600. temp_extralibs `"${SDL_CONFIG}" --libs`
  1601. if check_lib2 SDL.h SDL_Init; then
  1602. _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
  1603. if test "$_sdlversion" -lt 121 ; then
  1604. enable sdl_too_old
  1605. else
  1606. enable sdl
  1607. check_cc $sdl_cflags <<EOF && enable sdl_video_size
  1608. #include <SDL.h>
  1609. int main(int argc, char **argv){
  1610. const SDL_VideoInfo *vi = SDL_GetVideoInfo();
  1611. int w = vi->current_w;
  1612. return 0;
  1613. }
  1614. EOF
  1615. fi
  1616. fi
  1617. restore_flags
  1618. fi
  1619. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  1620. ##########################################
  1621. # Network check
  1622. if enabled network; then
  1623. check_type sys/socket.h socklen_t
  1624. # Prefer arpa/inet.h over winsock2
  1625. if check_header arpa/inet.h ; then
  1626. check_func closesocket
  1627. elif check_header winsock2.h ; then
  1628. network_extralibs="-lws2_32"
  1629. check_type ws2tcpip.h socklen_t
  1630. check_func_headers winsock2.h closesocket
  1631. fi
  1632. fi
  1633. ##########################################
  1634. # IPv6 check
  1635. enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
  1636. #include <sys/types.h>
  1637. #include <sys/socket.h>
  1638. #include <netinet/in.h>
  1639. #include <netdb.h>
  1640. int main(void) {
  1641. struct sockaddr_storage saddr;
  1642. struct ipv6_mreq mreq6;
  1643. getaddrinfo(0,0,0,0);
  1644. getnameinfo(0,0,0,0,0,0,0);
  1645. IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
  1646. }
  1647. EOF
  1648. check_header linux/videodev.h
  1649. check_header linux/videodev2.h
  1650. check_header sys/videoio.h
  1651. check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
  1652. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  1653. { check_header dev/bktr/ioctl_meteor.h &&
  1654. check_header dev/bktr/ioctl_bt848.h; } ||
  1655. { check_header machine/ioctl_meteor.h &&
  1656. check_header machine/ioctl_bt848.h; } ||
  1657. { check_header dev/video/meteor/ioctl_meteor.h &&
  1658. check_header dev/video/bktr/ioctl_bt848.h; } ||
  1659. check_header dev/ic/bt8xx.h
  1660. check_header sys/soundcard.h
  1661. check_header soundcard.h
  1662. # deal with the X11 frame grabber
  1663. enabled x11grab &&
  1664. check_header X11/Xlib.h &&
  1665. check_header X11/extensions/XShm.h &&
  1666. check_func XOpenDisplay -lX11 &&
  1667. check_func XShmCreateImage -lX11 -lXext
  1668. enabled debug && add_cflags -g"$debuglevel"
  1669. # add some useful compiler flags if supported
  1670. check_cflags -Wdeclaration-after-statement
  1671. check_cflags -Wall
  1672. check_cflags -Wno-switch
  1673. check_cflags -Wdisabled-optimization
  1674. check_cflags -Wpointer-arith
  1675. check_cflags -Wredundant-decls
  1676. check_cflags -Wno-pointer-sign
  1677. check_cflags -Wcast-qual
  1678. check_cflags -Wwrite-strings
  1679. check_cflags -Wtype-limits
  1680. enabled extra_warnings && check_cflags -Winline
  1681. # add some linker flags
  1682. check_ldflags -Wl,--warn-common
  1683. check_ldflags -Wl,--as-needed
  1684. 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'
  1685. check_ldflags -Wl,-Bsymbolic
  1686. if enabled small; then
  1687. check_cflags -Os # not all compilers support -Os
  1688. optimizations="small"
  1689. elif enabled optimizations; then
  1690. if $cc -v 2>&1 | grep -q xlc; then
  1691. add_cflags "-O5"
  1692. add_ldflags "-O5"
  1693. else
  1694. add_cflags "-O3"
  1695. fi
  1696. fi
  1697. check_cflags -fno-math-errno
  1698. check_cflags -fno-signed-zeros
  1699. # add some flags for Intel C Compiler
  1700. if $cc --version | grep -q Intel; then
  1701. # Just warnings, no remarks
  1702. check_cflags -w1
  1703. # -wd: Disable following warnings
  1704. # 144, 167, 556: -Wno-pointer-sign
  1705. # 10006: ignoring unknown option -fno-signed-zeros
  1706. # 10156: ignoring option '-W'; no argument required
  1707. check_cflags -wd144,167,556,10006,10156
  1708. # 11030: Warning unknown option --as-needed
  1709. # 10156: ignoring option '-export'; no argument required
  1710. check_ldflags -wd10156,11030
  1711. # Allow to compile with optimizations
  1712. check_ldflags -march=$cpu
  1713. fi
  1714. # PIC flags for shared library objects where they are needed
  1715. if enabled shared; then
  1716. # LIBOBJFLAGS may have already been set in the OS configuration
  1717. if test -z "$LIBOBJFLAGS" ; then
  1718. case "$arch" in
  1719. x86_64|ia64|alpha|sparc*|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;;
  1720. esac
  1721. fi
  1722. fi
  1723. if enabled gprof; then
  1724. add_cflags "-p"
  1725. add_ldflags "-p"
  1726. fi
  1727. VHOOKCFLAGS="-fPIC"
  1728. # Find out if the .align argument is a power of two or not.
  1729. if test $asmalign_pot = "unknown"; then
  1730. disable asmalign_pot
  1731. echo 'asm (".align 3");' | check_cc && enable asmalign_pot
  1732. fi
  1733. enabled_any $DECODER_LIST && enable decoders
  1734. enabled_any $ENCODER_LIST && enable encoders
  1735. enabled_any $BSF_LIST && enable bsfs
  1736. enabled_any $DEMUXER_LIST && enable demuxers
  1737. enabled_any $MUXER_LIST && enable muxers
  1738. enabled_any $FILTER_LIST && enable filters
  1739. enabled_any $INDEV_LIST && enable demuxers
  1740. enabled_any $OUTDEV_LIST && enable muxers
  1741. enabled_any $PROTOCOL_LIST && enable protocols
  1742. enabled_any $THREADS_LIST && enable threads
  1743. check_deps $CONFIG_LIST \
  1744. $HAVE_LIST \
  1745. $DECODER_LIST \
  1746. $ENCODER_LIST \
  1747. $PARSER_LIST \
  1748. $BSF_LIST \
  1749. $DEMUXER_LIST \
  1750. $MUXER_LIST \
  1751. $FILTER_LIST \
  1752. $INDEV_LIST \
  1753. $OUTDEV_LIST \
  1754. $PROTOCOL_LIST \
  1755. enabled libdc1394 && append pkg_requires "libraw1394"
  1756. enabled libdirac && append pkg_requires "dirac"
  1757. enabled libtheora && append pkg_requires "theora"
  1758. enabled libvorbis && append pkg_requires "vorbisenc"
  1759. echo "install prefix $prefix"
  1760. echo "source path $source_path"
  1761. echo "C compiler $cc"
  1762. echo ".align is power-of-two $asmalign_pot"
  1763. echo "ARCH $arch ($cpu)"
  1764. if test "$build_suffix" != ""; then
  1765. echo "build suffix $build_suffix"
  1766. fi
  1767. echo "big-endian ${bigendian-no}"
  1768. if test $arch = "x86_32" -o $arch = "x86_64"; then
  1769. echo "yasm ${yasm-no}"
  1770. echo "MMX enabled ${mmx-no}"
  1771. echo "CMOV enabled ${cmov-no}"
  1772. echo "CMOV is fast ${fast_cmov-no}"
  1773. echo "EBX available ${ebx_available-no}"
  1774. echo "EBP available ${ebp_available-no}"
  1775. fi
  1776. if test $arch = "armv4l"; then
  1777. echo "ARMv5TE enabled ${armv5te-no}"
  1778. echo "ARMv6 enabled ${armv6-no}"
  1779. echo "ARM VFP enabled ${armvfp-no}"
  1780. echo "IWMMXT enabled ${iwmmxt-no}"
  1781. echo "NEON enabled ${neon-no}"
  1782. fi
  1783. if test $arch = "mips"; then
  1784. echo "MMI enabled ${mmi-no}"
  1785. fi
  1786. if test $arch = "powerpc"; then
  1787. echo "AltiVec enabled ${altivec-no}"
  1788. echo "dcbzl available ${dcbzl-no}"
  1789. fi
  1790. echo "gprof enabled ${gprof-no}"
  1791. echo "debug symbols ${debug-no}"
  1792. echo "strip symbols ${stripping-no}"
  1793. echo "optimizations ${optimizations-no}"
  1794. echo "static ${static-no}"
  1795. echo "shared ${shared-no}"
  1796. echo "postprocessing support ${postproc-no}"
  1797. echo "software scaler enabled ${swscale-no}"
  1798. echo "new filter support ${avfilter-no}"
  1799. echo "filters using lavformat ${avfilter_lavf-no}"
  1800. echo "video hooking ${vhook-no}"
  1801. if enabled vhook; then
  1802. echo "Imlib2 support ${imlib2-no}"
  1803. echo "FreeType support ${freetype2-no}"
  1804. fi
  1805. echo "network support ${network-no}"
  1806. if enabled network; then
  1807. echo "IPv6 support ${ipv6-no}"
  1808. fi
  1809. echo "threading support ${thread_type-no}"
  1810. echo "SDL support ${sdl-no}"
  1811. if enabled sdl_too_old; then
  1812. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
  1813. fi
  1814. echo "Sun medialib support ${mlib-no}"
  1815. echo "AVISynth enabled ${avisynth-no}"
  1816. echo "liba52 support ${liba52-no}"
  1817. echo "liba52 dlopened ${liba52bin-no}"
  1818. echo "libamr-nb support ${libamr_nb-no}"
  1819. echo "libamr-wb support ${libamr_wb-no}"
  1820. echo "libdc1394 support ${libdc1394-no}"
  1821. echo "libdirac enabled ${libdirac-no}"
  1822. echo "libfaac enabled ${libfaac-no}"
  1823. echo "libfaad enabled ${libfaad-no}"
  1824. echo "libfaad dlopened ${libfaadbin-no}"
  1825. echo "libgsm enabled ${libgsm-no}"
  1826. echo "libmp3lame enabled ${libmp3lame-no}"
  1827. echo "libnut enabled ${libnut-no}"
  1828. echo "libschroedinger enabled ${libschroedinger-no}"
  1829. echo "libtheora enabled ${libtheora-no}"
  1830. echo "libvorbis enabled ${libvorbis-no}"
  1831. echo "libx264 enabled ${libx264-no}"
  1832. echo "libxvid enabled ${libxvid-no}"
  1833. echo "zlib enabled ${zlib-no}"
  1834. echo "bzlib enabled ${bzlib-no}"
  1835. echo
  1836. for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do
  1837. echo "Enabled ${type}s:"
  1838. eval list=\$$(toupper $type)_LIST
  1839. for part in $list; do
  1840. enabled $part && echo ${part%_*}
  1841. done | sort | pr -3 -t
  1842. echo
  1843. done
  1844. license="LGPL"
  1845. if enabled nonfree; then
  1846. license="unredistributable"
  1847. elif enabled gpl; then
  1848. license="GPL"
  1849. fi
  1850. echo "License: $license"
  1851. echo "Creating config.mak and config.h..."
  1852. echo "# Automatically generated by configure - do not modify!" > config.mak
  1853. echo "/* Automatically generated by configure - do not modify! */" > $TMPH
  1854. echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
  1855. echo "#define FFMPEG_CONFIG_H" >> $TMPH
  1856. echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
  1857. echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak
  1858. echo "prefix=$prefix" >> config.mak
  1859. echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
  1860. echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
  1861. echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
  1862. echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
  1863. echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
  1864. echo "CC=$cc" >> config.mak
  1865. echo "YASM=$yasmexe" >> config.mak
  1866. echo "AR=$ar" >> config.mak
  1867. echo "RANLIB=$ranlib" >> config.mak
  1868. echo "LN_S=$ln_s" >> config.mak
  1869. enabled stripping &&
  1870. echo "STRIP=$strip" >> config.mak ||
  1871. echo "STRIP=echo ignoring strip" >> config.mak
  1872. echo "OPTFLAGS=$CFLAGS" >> config.mak
  1873. echo "VHOOKCFLAGS=$VHOOKCFLAGS" >> config.mak
  1874. echo "LDFLAGS=$LDFLAGS" >> config.mak
  1875. echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
  1876. echo "SHFLAGS=$SHFLAGS" >> config.mak
  1877. echo "YASMFLAGS=$YASMFLAGS" >> config.mak
  1878. echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
  1879. echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
  1880. echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
  1881. echo "BUILD_STATIC=$static" >> config.mak
  1882. echo "BUILDSUF=$build_suffix" >> config.mak
  1883. echo "FULLNAME=$FULLNAME" >> config.mak
  1884. echo "LIBPREF=$LIBPREF" >> config.mak
  1885. echo "LIBSUF=$LIBSUF" >> config.mak
  1886. echo "LIBNAME=$LIBNAME" >> config.mak
  1887. echo "SLIBPREF=$SLIBPREF" >> config.mak
  1888. echo "SLIBSUF=$SLIBSUF" >> config.mak
  1889. echo "EXESUF=$EXESUF" >> config.mak
  1890. echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
  1891. if enabled bigendian; then
  1892. echo "WORDS_BIGENDIAN=yes" >> config.mak
  1893. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  1894. fi
  1895. if enabled sdl; then
  1896. echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
  1897. echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
  1898. fi
  1899. if enabled texi2html; then
  1900. echo "BUILD_DOC=yes" >> config.mak
  1901. fi
  1902. get_version(){
  1903. name=$1
  1904. file=$source_path/$2
  1905. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  1906. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  1907. lcname=$(tolower $name)
  1908. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  1909. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  1910. }
  1911. get_version LIBSWSCALE libswscale/swscale.h
  1912. get_version LIBPOSTPROC libpostproc/postprocess.h
  1913. get_version LIBAVCODEC libavcodec/avcodec.h
  1914. get_version LIBAVDEVICE libavdevice/avdevice.h
  1915. get_version LIBAVFORMAT libavformat/avformat.h
  1916. get_version LIBAVUTIL libavutil/avutil.h
  1917. get_version LIBAVFILTER libavfilter/avfilter.h
  1918. if enabled shared; then
  1919. echo "BUILD_SHARED=yes" >> config.mak
  1920. echo "PIC=-fPIC -DPIC" >> config.mak
  1921. echo "LIBTARGET=${LIBTARGET}" >> config.mak
  1922. echo "SLIBNAME=${SLIBNAME}" >> config.mak
  1923. echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
  1924. echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
  1925. echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
  1926. echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
  1927. echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
  1928. echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
  1929. fi
  1930. echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
  1931. echo "EXTRALIBS=$extralibs" >> config.mak
  1932. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  1933. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  1934. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  1935. $DECODER_LIST \
  1936. $ENCODER_LIST \
  1937. $PARSER_LIST \
  1938. $BSF_LIST \
  1939. $DEMUXER_LIST \
  1940. $MUXER_LIST \
  1941. $FILTER_LIST \
  1942. $PROTOCOL_LIST \
  1943. $INDEV_LIST \
  1944. $OUTDEV_LIST \
  1945. echo "#define restrict $_restrict" >> $TMPH
  1946. if enabled small; then
  1947. echo "#define av_always_inline" >> $TMPH
  1948. fi
  1949. echo "SRC_PATH=\"$source_path\"" >> config.mak
  1950. echo "SRC_PATH_BARE=$source_path" >> config.mak
  1951. echo "BUILD_ROOT=\"$PWD\"" >> config.mak
  1952. # Apparently it's not possible to portably echo a backslash.
  1953. enabled asmalign_pot &&
  1954. printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
  1955. printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
  1956. echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
  1957. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  1958. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  1959. cmp -s $TMPH config.h &&
  1960. echo "config.h is unchanged" ||
  1961. mv -f $TMPH config.h
  1962. rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
  1963. # build tree in object directory if source path is different from current one
  1964. if enabled source_path_used; then
  1965. DIRS="\
  1966. doc \
  1967. libavcodec \
  1968. libavcodec/alpha \
  1969. libavcodec/armv4l \
  1970. libavcodec/bfin \
  1971. libavcodec/i386 \
  1972. libavcodec/mlib \
  1973. libavcodec/ppc \
  1974. libavcodec/sh4 \
  1975. libavcodec/sparc \
  1976. libavdevice \
  1977. libavfilter \
  1978. libavformat \
  1979. libavutil \
  1980. libpostproc \
  1981. libswscale \
  1982. tests \
  1983. tools \
  1984. vhook \
  1985. "
  1986. FILES="\
  1987. Makefile \
  1988. common.mak \
  1989. subdir.mak \
  1990. doc/texi2pod.pl \
  1991. libavcodec/Makefile \
  1992. libavdevice/Makefile \
  1993. libavfilter/Makefile \
  1994. libavformat/Makefile \
  1995. libavutil/Makefile \
  1996. libpostproc/Makefile \
  1997. libswscale/Makefile \
  1998. "
  1999. for dir in $DIRS ; do
  2000. mkdir -p $dir
  2001. done
  2002. for f in $FILES ; do
  2003. $ln_s "$source_path/$f" $f
  2004. done
  2005. fi
  2006. # build pkg-config files
  2007. pkgconfig_generate(){
  2008. name=$1
  2009. shortname=${name#lib}
  2010. comment=$2
  2011. version=$3
  2012. libs=$4
  2013. requires=$5
  2014. cat <<EOF > $name/$name.pc
  2015. prefix=$prefix
  2016. exec_prefix=\${prefix}
  2017. libdir=$libdir
  2018. includedir=$incdir
  2019. Name: $name
  2020. Description: $comment
  2021. Version: $version
  2022. Requires: $(disabled shared && echo $requires)
  2023. Requires.private: $(enabled shared && echo $requires)
  2024. Conflicts:
  2025. Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
  2026. Libs.private: $(enabled shared && echo $libs)
  2027. Cflags: -I\${includedir}
  2028. EOF
  2029. cat <<EOF > $name/$name-uninstalled.pc
  2030. prefix=
  2031. exec_prefix=
  2032. libdir=\${pcfiledir}
  2033. includedir=\${pcfiledir}/..
  2034. Name: $name
  2035. Description: $comment
  2036. Version: $version
  2037. Requires: $requires
  2038. Conflicts:
  2039. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  2040. Cflags: -I\${includedir}
  2041. EOF
  2042. }
  2043. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  2044. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
  2045. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
  2046. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
  2047. enabled avfilter &&
  2048. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
  2049. enabled postproc &&
  2050. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  2051. if enabled swscale; then
  2052. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
  2053. else
  2054. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
  2055. apply libswscale/libswscale.pc sed s/^Libs:.*$/Libs:/
  2056. fi