You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3034 lines
85KB

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