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.

4075 lines
119KB

  1. #!/bin/sh
  2. #
  3. # Libav configure script
  4. #
  5. # Copyright (c) 2000-2002 Fabrice Bellard
  6. # Copyright (c) 2005-2008 Diego Biurrun
  7. # Copyright (c) 2005-2008 Mans Rullgard
  8. #
  9. # Prevent locale nonsense from breaking basic text processing.
  10. LC_ALL=C
  11. export LC_ALL
  12. # make sure we are running under a compatible shell
  13. # try to make this part work with most shells
  14. try_exec(){
  15. echo "Trying shell $1"
  16. type "$1" > /dev/null 2>&1 && exec "$@"
  17. }
  18. unset foo
  19. (: ${foo%%bar}) 2> /dev/null
  20. E1="$?"
  21. (: ${foo?}) 2> /dev/null
  22. E2="$?"
  23. if test "$E1" != 0 || test "$E2" = 0; then
  24. echo "Broken shell detected. Trying alternatives."
  25. export FF_CONF_EXEC
  26. if test "0$FF_CONF_EXEC" -lt 1; then
  27. FF_CONF_EXEC=1
  28. try_exec bash "$0" "$@"
  29. fi
  30. if test "0$FF_CONF_EXEC" -lt 2; then
  31. FF_CONF_EXEC=2
  32. try_exec ksh "$0" "$@"
  33. fi
  34. if test "0$FF_CONF_EXEC" -lt 3; then
  35. FF_CONF_EXEC=3
  36. try_exec /usr/xpg4/bin/sh "$0" "$@"
  37. fi
  38. echo "No compatible shell script interpreter found."
  39. echo "This configure script requires a POSIX-compatible shell"
  40. echo "such as bash or ksh."
  41. echo "THIS IS NOT A BUG IN LIBAV, DO NOT REPORT IT AS SUCH."
  42. echo "Instead, install a working POSIX-compatible shell."
  43. echo "Disabling this configure test will create a broken Libav."
  44. if test "$BASH_VERSION" = '2.04.0(1)-release'; then
  45. echo "This bash version ($BASH_VERSION) is broken on your platform."
  46. echo "Upgrade to a later version if available."
  47. fi
  48. exit 1
  49. fi
  50. test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
  51. show_help(){
  52. cat <<EOF
  53. Usage: configure [options]
  54. Options: [defaults in brackets after descriptions]
  55. Help options:
  56. --help print this message
  57. --list-decoders show all available decoders
  58. --list-encoders show all available encoders
  59. --list-hwaccels show all available hardware accelerators
  60. --list-demuxers show all available demuxers
  61. --list-muxers show all available muxers
  62. --list-parsers show all available parsers
  63. --list-protocols show all available protocols
  64. --list-bsfs show all available bitstream filters
  65. --list-indevs show all available input devices
  66. --list-outdevs show all available output devices
  67. --list-filters show all available filters
  68. Standard options:
  69. --logfile=FILE log tests and output to FILE [config.log]
  70. --disable-logging do not log configure debug information
  71. --prefix=PREFIX install in PREFIX [$prefix]
  72. --bindir=DIR install binaries in DIR [PREFIX/bin]
  73. --datadir=DIR install data files in DIR [PREFIX/share/avconv]
  74. --libdir=DIR install libs in DIR [PREFIX/lib]
  75. --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
  76. --incdir=DIR install includes in DIR [PREFIX/include]
  77. --mandir=DIR install man page in DIR [PREFIX/share/man]
  78. Licensing options:
  79. --enable-gpl allow use of GPL code, the resulting libs
  80. and binaries will be under GPL [no]
  81. --enable-version3 upgrade (L)GPL to version 3 [no]
  82. --enable-nonfree allow use of nonfree code, the resulting libs
  83. and binaries will be unredistributable [no]
  84. Configuration options:
  85. --disable-static do not build static libraries [no]
  86. --enable-shared build shared libraries [no]
  87. --enable-small optimize for size instead of speed
  88. --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  89. --enable-gray enable full grayscale support (slower color)
  90. --disable-swscale-alpha disable alpha channel support in swscale
  91. --disable-all disable building components, libraries and programs
  92. Program options:
  93. --disable-programs do not build command line programs
  94. --disable-avconv disable avconv build
  95. --disable-avplay disable avplay build
  96. --disable-avprobe disable avprobe build
  97. --disable-avserver disable avserver build
  98. Component options:
  99. --disable-doc do not build documentation
  100. --disable-avdevice disable libavdevice build
  101. --disable-avcodec disable libavcodec build
  102. --disable-avformat disable libavformat build
  103. --disable-avutil disable libavutil build
  104. --disable-swscale disable libswscale build
  105. --disable-avfilter disable video filter support [no]
  106. --disable-avresample disable libavresample build [no]
  107. --disable-pthreads disable pthreads [auto]
  108. --disable-w32threads disable Win32 threads [auto]
  109. --enable-x11grab enable X11 grabbing [no]
  110. --disable-network disable network support [no]
  111. --disable-dct disable DCT code
  112. --disable-lsp disable LSP code
  113. --disable-lzo disable LZO decoder code
  114. --disable-mdct disable MDCT code
  115. --disable-rdft disable RDFT code
  116. --disable-fft disable FFT code
  117. Hardware accelerators:
  118. --enable-dxva2 enable DXVA2 code
  119. --enable-vaapi enable VAAPI code
  120. --enable-vda enable VDA code
  121. --enable-vdpau enable VDPAU code
  122. Individual component options:
  123. --disable-everything disable all components listed below
  124. --disable-encoder=NAME disable encoder NAME
  125. --enable-encoder=NAME enable encoder NAME
  126. --disable-encoders disable all encoders
  127. --disable-decoder=NAME disable decoder NAME
  128. --enable-decoder=NAME enable decoder NAME
  129. --disable-decoders disable all decoders
  130. --disable-hwaccel=NAME disable hwaccel NAME
  131. --enable-hwaccel=NAME enable hwaccel NAME
  132. --disable-hwaccels disable all hwaccels
  133. --disable-muxer=NAME disable muxer NAME
  134. --enable-muxer=NAME enable muxer NAME
  135. --disable-muxers disable all muxers
  136. --disable-demuxer=NAME disable demuxer NAME
  137. --enable-demuxer=NAME enable demuxer NAME
  138. --disable-demuxers disable all demuxers
  139. --enable-parser=NAME enable parser NAME
  140. --disable-parser=NAME disable parser NAME
  141. --disable-parsers disable all parsers
  142. --enable-bsf=NAME enable bitstream filter NAME
  143. --disable-bsf=NAME disable bitstream filter NAME
  144. --disable-bsfs disable all bitstream filters
  145. --enable-protocol=NAME enable protocol NAME
  146. --disable-protocol=NAME disable protocol NAME
  147. --disable-protocols disable all protocols
  148. --enable-indev=NAME enable input device NAME
  149. --disable-indev=NAME disable input device NAME
  150. --disable-indevs disable input devices
  151. --enable-outdev=NAME enable output device NAME
  152. --disable-outdev=NAME disable output device NAME
  153. --disable-outdevs disable output devices
  154. --disable-devices disable all devices
  155. --enable-filter=NAME enable filter NAME
  156. --disable-filter=NAME disable filter NAME
  157. --disable-filters disable all filters
  158. External library support:
  159. --enable-avisynth enable reading of AVISynth script files [no]
  160. --enable-bzlib enable bzlib [autodetect]
  161. --enable-frei0r enable frei0r video filtering
  162. --enable-gnutls enable gnutls [no]
  163. --enable-libcdio enable audio CD grabbing with libcdio
  164. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  165. and libraw1394 [no]
  166. --enable-libfaac enable AAC encoding via libfaac [no]
  167. --enable-libfdk-aac enable AAC encoding via libfdk-aac [no]
  168. --enable-libfreetype enable libfreetype [no]
  169. --enable-libgsm enable GSM de/encoding via libgsm [no]
  170. --enable-libilbc enable iLBC de/encoding via libilbc [no]
  171. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  172. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  173. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  174. --enable-libopencv enable video filtering via libopencv [no]
  175. --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
  176. --enable-libopus enable Opus decoding via libopus [no]
  177. --enable-libpulse enable Pulseaudio input via libpulse [no]
  178. --enable-librtmp enable RTMP[E] support via librtmp [no]
  179. --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
  180. --enable-libspeex enable Speex de/encoding via libspeex [no]
  181. --enable-libtheora enable Theora encoding via libtheora [no]
  182. --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
  183. --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
  184. --enable-libvorbis enable Vorbis encoding via libvorbis [no]
  185. --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
  186. --enable-libx264 enable H.264 encoding via x264 [no]
  187. --enable-libxavs enable AVS encoding via xavs [no]
  188. --enable-libxvid enable Xvid encoding via xvidcore,
  189. native MPEG-4/Xvid encoder exists [no]
  190. --enable-openssl enable openssl [no]
  191. --enable-zlib enable zlib [autodetect]
  192. Advanced options (experts only):
  193. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  194. --enable-cross-compile assume a cross-compiler is used
  195. --sysroot=PATH root of cross-build tree
  196. --sysinclude=PATH location of cross-build system headers
  197. --target-os=OS compiler targets OS [$target_os]
  198. --target-exec=CMD command to run executables on target
  199. --target-path=DIR path to view of build directory on target
  200. --toolchain=NAME set tool defaults according to NAME
  201. --nm=NM use nm tool
  202. --ar=AR use archive tool AR [$ar_default]
  203. --as=AS use assembler AS [$as_default]
  204. --cc=CC use C compiler CC [$cc_default]
  205. --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
  206. --ld=LD use linker LD
  207. --host-cc=HOSTCC use host C compiler HOSTCC
  208. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  209. --host-ld=HOSTLD use host linker HOSTLD
  210. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  211. --host-libs=HLIBS use libs HLIBS when linking for host
  212. --host-os=OS compiler host OS [$target_os]
  213. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  214. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  215. --extra-libs=ELIBS add ELIBS [$ELIBS]
  216. --extra-version=STRING version string suffix []
  217. --optflags=OPTFLAGS override optimization-related compiler flags
  218. --build-suffix=SUFFIX library name suffix []
  219. --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
  220. --arch=ARCH select architecture [$arch]
  221. --cpu=CPU select the minimum required CPU (affects
  222. instruction selection, may crash on older CPUs)
  223. --enable-pic build position-independent code
  224. --enable-sram allow use of on-chip SRAM
  225. --enable-thumb compile for Thumb instruction set
  226. --disable-symver disable symbol versioning
  227. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  228. --disable-safe-bitstream-reader
  229. disable buffer boundary checking in bitreaders
  230. (faster, but may crash)
  231. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  232. --enable-lto use link-time optimization
  233. Optimization options (experts only):
  234. --disable-asm disable all assembler optimizations
  235. --disable-altivec disable AltiVec optimizations
  236. --disable-amd3dnow disable 3DNow! optimizations
  237. --disable-amd3dnowext disable 3DNow! extended optimizations
  238. --disable-mmx disable MMX optimizations
  239. --disable-mmxext disable MMXEXT optimizations
  240. --disable-sse disable SSE optimizations
  241. --disable-sse2 disable SSE2 optimizations
  242. --disable-sse3 disable SSE3 optimizations
  243. --disable-ssse3 disable SSSE3 optimizations
  244. --disable-sse4 disable SSE4 optimizations
  245. --disable-sse42 disable SSE4.2 optimizations
  246. --disable-avx disable AVX optimizations
  247. --disable-fma4 disable FMA4 optimizations
  248. --disable-armv5te disable armv5te optimizations
  249. --disable-armv6 disable armv6 optimizations
  250. --disable-armv6t2 disable armv6t2 optimizations
  251. --disable-vfp disable VFP optimizations
  252. --disable-neon disable NEON optimizations
  253. --disable-vis disable VIS optimizations
  254. --disable-inline-asm disable use of inline assembler
  255. --disable-yasm disable use of yasm assembler
  256. Developer options (useful when working on Libav itself):
  257. --disable-debug disable debugging symbols
  258. --enable-debug=LEVEL set the debug level [$debuglevel]
  259. --disable-optimizations disable compiler optimizations
  260. --enable-extra-warnings enable more compiler warnings
  261. --samples=PATH location of test samples for FATE, if not set use
  262. \$LIBAV_SAMPLES at make invocation time.
  263. --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
  264. should be used only for debugging purposes)
  265. --enable-random randomly enable/disable components
  266. --disable-random
  267. --enable-random=LIST randomly enable/disable specific components or
  268. --disable-random=LIST component groups. LIST is a comma-separated list
  269. of NAME[:PROB] entries where NAME is a component
  270. (group) and PROB the probability associated with
  271. NAME (default 0.5).
  272. --random-seed=VALUE seed value for --enable/disable-random
  273. NOTE: Object files are built at the place where configure is launched.
  274. EOF
  275. exit 0
  276. }
  277. quotes='""'
  278. log(){
  279. echo "$@" >> $logfile
  280. }
  281. log_file(){
  282. log BEGIN $1
  283. pr -n -t $1 >> $logfile
  284. log END $1
  285. }
  286. echolog(){
  287. log "$@"
  288. echo "$@"
  289. }
  290. warn(){
  291. log "WARNING: $*"
  292. WARNINGS="${WARNINGS}WARNING: $*\n"
  293. }
  294. die(){
  295. echolog "$@"
  296. cat <<EOF
  297. If you think configure made a mistake, make sure you are using the latest
  298. version from Git. If the latest version fails, report the problem to the
  299. libav-user@libav.org mailing list or IRC #libav on irc.freenode.net.
  300. EOF
  301. if disabled logging; then
  302. cat <<EOF
  303. Rerun configure with logging enabled (do not use --disable-logging), and
  304. include the log this produces with your report.
  305. EOF
  306. else
  307. cat <<EOF
  308. Include the log file "$logfile" produced by configure as this will help
  309. solving the problem.
  310. EOF
  311. fi
  312. exit 1
  313. }
  314. # Avoid locale weirdness, besides we really just want to translate ASCII.
  315. toupper(){
  316. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  317. }
  318. tolower(){
  319. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  320. }
  321. c_escape(){
  322. echo "$*" | sed 's/["\\]/\\\0/g'
  323. }
  324. sh_quote(){
  325. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  326. test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
  327. echo "$v"
  328. }
  329. cleanws(){
  330. echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//'
  331. }
  332. filter(){
  333. pat=$1
  334. shift
  335. for v; do
  336. eval "case $v in $pat) echo $v ;; esac"
  337. done
  338. }
  339. filter_out(){
  340. pat=$1
  341. shift
  342. for v; do
  343. eval "case $v in $pat) ;; *) echo $v ;; esac"
  344. done
  345. }
  346. map(){
  347. m=$1
  348. shift
  349. for v; do eval $m; done
  350. }
  351. add_suffix(){
  352. suffix=$1
  353. shift
  354. for v; do echo ${v}${suffix}; done
  355. }
  356. set_all(){
  357. value=$1
  358. shift
  359. for var in $*; do
  360. eval $var=$value
  361. done
  362. }
  363. set_weak(){
  364. value=$1
  365. shift
  366. for var; do
  367. eval : \${$var:=$value}
  368. done
  369. }
  370. set_safe(){
  371. var=$1
  372. shift
  373. eval $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')='$*'
  374. }
  375. get_safe(){
  376. eval echo \$$(echo "$1" | sed 's/[^A-Za-z0-9_]/_/g')
  377. }
  378. pushvar(){
  379. for var in $*; do
  380. eval level=\${${var}_level:=0}
  381. eval ${var}_${level}="\$$var"
  382. eval ${var}_level=$(($level+1))
  383. done
  384. }
  385. popvar(){
  386. for var in $*; do
  387. eval level=\${${var}_level:-0}
  388. test $level = 0 && continue
  389. eval level=$(($level-1))
  390. eval $var="\${${var}_${level}}"
  391. eval ${var}_level=$level
  392. eval unset ${var}_${level}
  393. done
  394. }
  395. enable(){
  396. set_all yes $*
  397. }
  398. disable(){
  399. set_all no $*
  400. }
  401. enable_weak(){
  402. set_weak yes $*
  403. }
  404. disable_weak(){
  405. set_weak no $*
  406. }
  407. enable_safe(){
  408. for var; do
  409. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  410. done
  411. }
  412. disable_safe(){
  413. for var; do
  414. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  415. done
  416. }
  417. do_enable_deep(){
  418. for var; do
  419. enabled $var && continue
  420. eval sel="\$${var}_select"
  421. eval sgs="\$${var}_suggest"
  422. pushvar var sgs
  423. enable_deep $sel
  424. popvar sgs
  425. enable_deep_weak $sgs
  426. popvar var
  427. done
  428. }
  429. enable_deep(){
  430. do_enable_deep $*
  431. enable $*
  432. }
  433. enable_deep_weak(){
  434. do_enable_deep $*
  435. enable_weak $*
  436. }
  437. enabled(){
  438. test "${1#!}" = "$1" && op== || op=!=
  439. eval test "x\$${1#!}" $op "xyes"
  440. }
  441. disabled(){
  442. test "${1#!}" = "$1" && op== || op=!=
  443. eval test "x\$${1#!}" $op "xno"
  444. }
  445. enabled_all(){
  446. for opt; do
  447. enabled $opt || return 1
  448. done
  449. }
  450. disabled_all(){
  451. for opt; do
  452. disabled $opt || return 1
  453. done
  454. }
  455. enabled_any(){
  456. for opt; do
  457. enabled $opt && return 0
  458. done
  459. }
  460. disabled_any(){
  461. for opt; do
  462. disabled $opt && return 0
  463. done
  464. return 1
  465. }
  466. set_default(){
  467. for opt; do
  468. eval : \${$opt:=\$${opt}_default}
  469. done
  470. }
  471. is_in(){
  472. value=$1
  473. shift
  474. for var in $*; do
  475. [ $var = $value ] && return 0
  476. done
  477. return 1
  478. }
  479. do_check_deps(){
  480. for cfg; do
  481. cfg="${cfg#!}"
  482. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  483. disabled ${cfg}_checking && continue
  484. enable ${cfg}_checking
  485. append allopts $cfg
  486. eval dep_all="\$${cfg}_deps"
  487. eval dep_any="\$${cfg}_deps_any"
  488. eval dep_sel="\$${cfg}_select"
  489. eval dep_sgs="\$${cfg}_suggest"
  490. eval dep_ifa="\$${cfg}_if"
  491. eval dep_ifn="\$${cfg}_if_any"
  492. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  493. do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  494. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  495. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  496. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  497. enabled_all $dep_all || disable $cfg
  498. enabled_any $dep_any || disable $cfg
  499. disabled_any $dep_sel && disable $cfg
  500. if enabled $cfg; then
  501. enable_deep $dep_sel
  502. enable_deep_weak $dep_sgs
  503. fi
  504. disable ${cfg}_checking
  505. done
  506. }
  507. check_deps(){
  508. unset allopts
  509. do_check_deps "$@"
  510. for cfg in $allopts; do
  511. enabled $cfg || continue
  512. eval dep_extralibs="\$${cfg}_extralibs"
  513. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  514. done
  515. }
  516. print_config(){
  517. pfx=$1
  518. files=$2
  519. shift 2
  520. map 'eval echo "$v \${$v:-no}"' "$@" |
  521. awk "BEGIN { split(\"$files\", files) }
  522. {
  523. c = \"$pfx\" toupper(\$1);
  524. v = \$2;
  525. sub(/yes/, 1, v);
  526. sub(/no/, 0, v);
  527. for (f in files) {
  528. file = files[f];
  529. if (file ~ /\\.h\$/) {
  530. printf(\"#define %s %d\\n\", c, v) >>file;
  531. } else if (file ~ /\\.asm\$/) {
  532. printf(\"%%define %s %d\\n\", c, v) >>file;
  533. } else if (file ~ /\\.mak\$/) {
  534. n = -v ? \"\" : \"!\";
  535. printf(\"%s%s=yes\\n\", n, c) >>file;
  536. }
  537. }
  538. }"
  539. }
  540. print_enabled(){
  541. suf=$1
  542. shift
  543. for v; do
  544. enabled $v && printf "%s\n" ${v%$suf};
  545. done
  546. }
  547. append(){
  548. var=$1
  549. shift
  550. eval "$var=\"\$$var $*\""
  551. }
  552. prepend(){
  553. var=$1
  554. shift
  555. eval "$var=\"$* \$$var\""
  556. }
  557. add_cppflags(){
  558. append CPPFLAGS "$@"
  559. }
  560. add_cflags(){
  561. append CFLAGS $($cflags_filter "$@")
  562. }
  563. add_asflags(){
  564. append ASFLAGS $($asflags_filter "$@")
  565. }
  566. add_ldflags(){
  567. append LDFLAGS $($ldflags_filter "$@")
  568. }
  569. add_extralibs(){
  570. prepend extralibs $($ldflags_filter "$@")
  571. }
  572. add_host_cflags(){
  573. append host_cflags $($host_cflags_filter "$@")
  574. }
  575. add_host_ldflags(){
  576. append host_ldflags $($host_ldflags_filter "$@")
  577. }
  578. add_compat(){
  579. append compat_objs $1
  580. shift
  581. map 'add_cppflags -D$v' "$@"
  582. }
  583. check_cmd(){
  584. log "$@"
  585. "$@" >> $logfile 2>&1
  586. }
  587. cc_o(){
  588. eval printf '%s\\n' $CC_O
  589. }
  590. cc_e(){
  591. eval printf '%s\\n' $CC_E
  592. }
  593. check_cc(){
  594. log check_cc "$@"
  595. cat > $TMPC
  596. log_file $TMPC
  597. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
  598. }
  599. check_cpp(){
  600. log check_cpp "$@"
  601. cat > $TMPC
  602. log_file $TMPC
  603. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
  604. }
  605. as_o(){
  606. eval printf '%s\\n' $AS_O
  607. }
  608. check_as(){
  609. log check_as "$@"
  610. cat > $TMPS
  611. log_file $TMPS
  612. check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
  613. }
  614. check_inline_asm(){
  615. log check_inline_asm "$@"
  616. name="$1"
  617. code="$2"
  618. shift 2
  619. disable $name
  620. check_cc "$@" <<EOF && enable $name
  621. void foo(void){ __asm__ volatile($code); }
  622. EOF
  623. }
  624. check_insn(){
  625. log check_insn "$@"
  626. check_inline_asm ${1}_inline "\"$2\""
  627. echo "$2" | check_as && enable ${1}_external || disable ${1}_external
  628. }
  629. check_yasm(){
  630. log check_yasm "$@"
  631. echo "$1" > $TMPS
  632. log_file $TMPS
  633. shift 1
  634. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  635. }
  636. ld_o(){
  637. eval printf '%s\\n' $LD_O
  638. }
  639. check_ld(){
  640. log check_ld "$@"
  641. flags=$(filter_out '-l*' "$@")
  642. libs=$(filter '-l*' "$@")
  643. check_cc $($cflags_filter $flags) || return
  644. flags=$($ldflags_filter $flags)
  645. libs=$($ldflags_filter $libs)
  646. check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
  647. }
  648. check_code(){
  649. log check_code "$@"
  650. check=$1
  651. headers=$2
  652. code=$3
  653. shift 3
  654. {
  655. for hdr in $headers; do
  656. echo "#include <$hdr>"
  657. done
  658. echo "int main(void) { $code; return 0; }"
  659. } | check_$check "$@"
  660. }
  661. check_cppflags(){
  662. log check_cppflags "$@"
  663. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  664. int x;
  665. EOF
  666. }
  667. check_cflags(){
  668. log check_cflags "$@"
  669. set -- $($cflags_filter "$@")
  670. check_cc "$@" <<EOF && append CFLAGS "$@"
  671. int x;
  672. EOF
  673. }
  674. test_ldflags(){
  675. log test_ldflags "$@"
  676. check_ld "$@" <<EOF
  677. int main(void){ return 0; }
  678. EOF
  679. }
  680. check_ldflags(){
  681. log check_ldflags "$@"
  682. test_ldflags "$@" && add_ldflags "$@"
  683. }
  684. check_header(){
  685. log check_header "$@"
  686. header=$1
  687. shift
  688. disable_safe $header
  689. check_cpp "$@" <<EOF && enable_safe $header
  690. #include <$header>
  691. int x;
  692. EOF
  693. }
  694. check_func(){
  695. log check_func "$@"
  696. func=$1
  697. shift
  698. disable $func
  699. check_ld "$@" <<EOF && enable $func
  700. extern int $func();
  701. int main(void){ $func(); }
  702. EOF
  703. }
  704. check_mathfunc(){
  705. log check_mathfunc "$@"
  706. func=$1
  707. narg=$2
  708. shift 2
  709. test $narg = 2 && args="f, g" || args="f"
  710. disable $func
  711. check_ld "$@" <<EOF && enable $func
  712. #include <math.h>
  713. float foo(float f, float g) { return $func($args); }
  714. int main(void){ return 0; }
  715. EOF
  716. }
  717. check_func_headers(){
  718. log check_func_headers "$@"
  719. headers=$1
  720. funcs=$2
  721. shift 2
  722. {
  723. for hdr in $headers; do
  724. echo "#include <$hdr>"
  725. done
  726. for func in $funcs; do
  727. echo "long check_$func(void) { return (long) $func; }"
  728. done
  729. echo "int main(void) { return 0; }"
  730. } | check_ld "$@" && enable $funcs && enable_safe $headers
  731. }
  732. check_cpp_condition(){
  733. log check_cpp_condition "$@"
  734. header=$1
  735. condition=$2
  736. shift 2
  737. check_cpp "$@" <<EOF
  738. #include <$header>
  739. #if !($condition)
  740. #error "unsatisfied condition: $condition"
  741. #endif
  742. EOF
  743. }
  744. check_lib(){
  745. log check_lib "$@"
  746. header="$1"
  747. func="$2"
  748. shift 2
  749. check_header $header && check_func $func "$@" && add_extralibs "$@"
  750. }
  751. check_lib2(){
  752. log check_lib2 "$@"
  753. headers="$1"
  754. funcs="$2"
  755. shift 2
  756. check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
  757. }
  758. check_pkg_config(){
  759. log check_pkg_config "$@"
  760. pkg="$1"
  761. headers="$2"
  762. funcs="$3"
  763. shift 3
  764. $pkg_config --exists $pkg || return
  765. pkg_cflags=$($pkg_config --cflags $pkg)
  766. pkg_libs=$($pkg_config --libs $pkg)
  767. check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
  768. set_safe ${pkg}_cflags $pkg_cflags &&
  769. set_safe ${pkg}_libs $pkg_libs
  770. }
  771. check_exec(){
  772. check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  773. }
  774. check_exec_crash(){
  775. code=$(cat)
  776. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  777. # are safe but may not be available everywhere. Thus we use
  778. # raise(SIGTERM) instead. The check is run in a subshell so we
  779. # can redirect the "Terminated" message from the shell. SIGBUS
  780. # is not defined by standard C so it is used conditionally.
  781. (check_exec "$@") >> $logfile 2>&1 <<EOF
  782. #include <signal.h>
  783. static void sighandler(int sig){
  784. raise(SIGTERM);
  785. }
  786. int foo(void){
  787. $code
  788. }
  789. int main(void){
  790. signal(SIGILL, sighandler);
  791. signal(SIGFPE, sighandler);
  792. signal(SIGSEGV, sighandler);
  793. #ifdef SIGBUS
  794. signal(SIGBUS, sighandler);
  795. #endif
  796. foo();
  797. }
  798. EOF
  799. }
  800. check_type(){
  801. log check_type "$@"
  802. headers=$1
  803. type=$2
  804. shift 2
  805. disable_safe "$type"
  806. check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
  807. }
  808. check_struct(){
  809. log check_type "$@"
  810. headers=$1
  811. struct=$2
  812. member=$3
  813. shift 3
  814. disable_safe "${struct}_${member}"
  815. check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
  816. enable_safe "${struct}_${member}"
  817. }
  818. require(){
  819. name="$1"
  820. header="$2"
  821. func="$3"
  822. shift 3
  823. check_lib $header $func "$@" || die "ERROR: $name not found"
  824. }
  825. require2(){
  826. name="$1"
  827. headers="$2"
  828. func="$3"
  829. shift 3
  830. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  831. }
  832. require_pkg_config(){
  833. pkg="$1"
  834. check_pkg_config "$@" || die "ERROR: $pkg not found"
  835. add_cflags $(get_safe ${pkg}_cflags)
  836. add_extralibs $(get_safe ${pkg}_libs)
  837. }
  838. hostcc_o(){
  839. eval printf '%s\\n' $HOSTCC_O
  840. }
  841. check_host_cc(){
  842. log check_host_cc "$@"
  843. cat > $TMPC
  844. log_file $TMPC
  845. check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
  846. }
  847. check_host_cflags(){
  848. log check_host_cflags "$@"
  849. set -- $($host_cflags_filter "$@")
  850. check_host_cc "$@" <<EOF && append host_cflags "$@"
  851. int x;
  852. EOF
  853. }
  854. apply(){
  855. file=$1
  856. shift
  857. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  858. }
  859. cp_if_changed(){
  860. cmp -s "$1" "$2" && echo "$2 is unchanged" && return
  861. mkdir -p "$(dirname $2)"
  862. $cp_f "$1" "$2"
  863. }
  864. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  865. # system-dependent things.
  866. COMPONENT_LIST="
  867. bsfs
  868. decoders
  869. demuxers
  870. encoders
  871. filters
  872. hwaccels
  873. indevs
  874. muxers
  875. outdevs
  876. parsers
  877. protocols
  878. "
  879. HWACCEL_LIST="
  880. dxva2
  881. vaapi
  882. vda
  883. vdpau
  884. "
  885. LIBRARY_LIST="
  886. avcodec
  887. avdevice
  888. avfilter
  889. avformat
  890. avresample
  891. avutil
  892. swscale
  893. "
  894. PROGRAM_LIST="
  895. avconv
  896. avplay
  897. avprobe
  898. avserver
  899. "
  900. CONFIG_LIST="
  901. $COMPONENT_LIST
  902. $HWACCEL_LIST
  903. $LIBRARY_LIST
  904. $PROGRAM_LIST
  905. avisynth
  906. bzlib
  907. dct
  908. doc
  909. fft
  910. frei0r
  911. gnutls
  912. gpl
  913. gray
  914. hardcoded_tables
  915. libcdio
  916. libdc1394
  917. libfaac
  918. libfdk_aac
  919. libfreetype
  920. libgsm
  921. libilbc
  922. libmp3lame
  923. libopencore_amrnb
  924. libopencore_amrwb
  925. libopencv
  926. libopenjpeg
  927. libopus
  928. libpulse
  929. librtmp
  930. libschroedinger
  931. libspeex
  932. libtheora
  933. libvo_aacenc
  934. libvo_amrwbenc
  935. libvorbis
  936. libvpx
  937. libx264
  938. libxavs
  939. libxvid
  940. lsp
  941. lzo
  942. mdct
  943. memalign_hack
  944. network
  945. nonfree
  946. openssl
  947. pic
  948. rdft
  949. runtime_cpudetect
  950. safe_bitstream_reader
  951. shared
  952. small
  953. sram
  954. static
  955. swscale_alpha
  956. thumb
  957. version3
  958. xmm_clobber_test
  959. x11grab
  960. zlib
  961. "
  962. THREADS_LIST='
  963. pthreads
  964. w32threads
  965. '
  966. ARCH_LIST='
  967. aarch64
  968. alpha
  969. arm
  970. avr32
  971. avr32_ap
  972. avr32_uc
  973. bfin
  974. ia64
  975. m68k
  976. mips
  977. mips64
  978. parisc
  979. ppc
  980. ppc64
  981. s390
  982. sh4
  983. sparc
  984. sparc64
  985. tilegx
  986. tilepro
  987. tomi
  988. x86
  989. x86_32
  990. x86_64
  991. '
  992. ARCH_EXT_LIST_ARM='
  993. armv5te
  994. armv6
  995. armv6t2
  996. neon
  997. vfp
  998. vfpv3
  999. '
  1000. ARCH_EXT_LIST_X86='
  1001. amd3dnow
  1002. amd3dnowext
  1003. avx
  1004. fma4
  1005. mmx
  1006. mmxext
  1007. sse
  1008. sse2
  1009. sse3
  1010. sse4
  1011. sse42
  1012. ssse3
  1013. '
  1014. ARCH_EXT_LIST="
  1015. $ARCH_EXT_LIST_ARM
  1016. $ARCH_EXT_LIST_X86
  1017. altivec
  1018. ppc4xx
  1019. vis
  1020. "
  1021. HAVE_LIST_CMDLINE='
  1022. inline_asm
  1023. symver
  1024. yasm
  1025. '
  1026. HAVE_LIST_PUB='
  1027. bigendian
  1028. fast_unaligned
  1029. '
  1030. MATH_FUNCS="
  1031. atanf
  1032. atan2f
  1033. cbrtf
  1034. cosf
  1035. exp2
  1036. exp2f
  1037. expf
  1038. isinf
  1039. isnan
  1040. ldexpf
  1041. llrint
  1042. llrintf
  1043. log2
  1044. log2f
  1045. log10f
  1046. lrint
  1047. lrintf
  1048. powf
  1049. rint
  1050. round
  1051. roundf
  1052. sinf
  1053. trunc
  1054. truncf
  1055. "
  1056. HAVE_LIST="
  1057. $ARCH_EXT_LIST
  1058. $(add_suffix _external $ARCH_EXT_LIST)
  1059. $(add_suffix _inline $ARCH_EXT_LIST)
  1060. $HAVE_LIST_CMDLINE
  1061. $HAVE_LIST_PUB
  1062. $THREADS_LIST
  1063. $MATH_FUNCS
  1064. aligned_malloc
  1065. aligned_stack
  1066. alsa_asoundlib_h
  1067. altivec_h
  1068. arpa_inet_h
  1069. asm_mod_q
  1070. asm_mod_y
  1071. attribute_may_alias
  1072. attribute_packed
  1073. cdio_paranoia_h
  1074. cdio_paranoia_paranoia_h
  1075. closesocket
  1076. cmov
  1077. CommandLineToArgvW
  1078. cpunop
  1079. CryptGenRandom
  1080. dcbzl
  1081. dev_bktr_ioctl_bt848_h
  1082. dev_bktr_ioctl_meteor_h
  1083. dev_ic_bt8xx_h
  1084. dev_video_bktr_ioctl_bt848_h
  1085. dev_video_meteor_ioctl_meteor_h
  1086. direct_h
  1087. dlfcn_h
  1088. dlopen
  1089. dos_paths
  1090. dxva_h
  1091. ebp_available
  1092. ebx_available
  1093. fast_64bit
  1094. fast_clz
  1095. fast_cmov
  1096. fcntl
  1097. fork
  1098. getaddrinfo
  1099. gethrtime
  1100. getopt
  1101. GetProcessAffinityMask
  1102. GetProcessMemoryInfo
  1103. GetProcessTimes
  1104. GetSystemTimeAsFileTime
  1105. getrusage
  1106. getservbyport
  1107. gettimeofday
  1108. gnu_as
  1109. gsm_h
  1110. ibm_asm
  1111. inet_aton
  1112. io_h
  1113. isatty
  1114. jack_port_get_latency_range
  1115. ldbrx
  1116. libdc1394_1
  1117. libdc1394_2
  1118. local_aligned_16
  1119. local_aligned_8
  1120. localtime_r
  1121. loongson
  1122. machine_ioctl_bt848_h
  1123. machine_ioctl_meteor_h
  1124. malloc_h
  1125. MapViewOfFile
  1126. memalign
  1127. mkstemp
  1128. mm_empty
  1129. mmap
  1130. mprotect
  1131. msvcrt
  1132. nanosleep
  1133. poll_h
  1134. posix_memalign
  1135. rdtsc
  1136. sched_getaffinity
  1137. sdl
  1138. sdl_video_size
  1139. SetConsoleTextAttribute
  1140. setmode
  1141. setrlimit
  1142. Sleep
  1143. sndio_h
  1144. socklen_t
  1145. soundcard_h
  1146. strerror_r
  1147. strptime
  1148. strtok_r
  1149. struct_addrinfo
  1150. struct_group_source_req
  1151. struct_ip_mreq_source
  1152. struct_ipv6_mreq
  1153. struct_pollfd
  1154. struct_rusage_ru_maxrss
  1155. struct_sockaddr_in6
  1156. struct_sockaddr_sa_len
  1157. struct_sockaddr_storage
  1158. struct_v4l2_frmivalenum_discrete
  1159. symver_asm_label
  1160. symver_gnu_asm
  1161. sysconf
  1162. sysctl
  1163. sys_mman_h
  1164. sys_param_h
  1165. sys_resource_h
  1166. sys_select_h
  1167. sys_soundcard_h
  1168. sys_time_h
  1169. sys_videoio_h
  1170. threads
  1171. unistd_h
  1172. usleep
  1173. vfp_args
  1174. VirtualAlloc
  1175. windows_h
  1176. winsock2_h
  1177. xform_asm
  1178. xmm_clobbers
  1179. "
  1180. # options emitted with CONFIG_ prefix but not available on the command line
  1181. CONFIG_EXTRA="
  1182. aandcttables
  1183. ac3dsp
  1184. audio_frame_queue
  1185. error_resilience
  1186. gcrypt
  1187. golomb
  1188. gplv3
  1189. h264chroma
  1190. h264dsp
  1191. h264pred
  1192. h264qpel
  1193. huffman
  1194. lgplv3
  1195. lpc
  1196. mpegaudio
  1197. mpegaudiodsp
  1198. mpegvideo
  1199. mpegvideoenc
  1200. nettle
  1201. rangecoder
  1202. rtpdec
  1203. rtpenc_chain
  1204. sinewin
  1205. videodsp
  1206. vp3dsp
  1207. "
  1208. CMDLINE_SELECT="
  1209. $ARCH_EXT_LIST
  1210. $CONFIG_LIST
  1211. $HAVE_LIST_CMDLINE
  1212. $THREADS_LIST
  1213. asm
  1214. cross_compile
  1215. debug
  1216. extra_warnings
  1217. logging
  1218. lto
  1219. optimizations
  1220. "
  1221. PATHS_LIST='
  1222. bindir
  1223. datadir
  1224. incdir
  1225. libdir
  1226. mandir
  1227. prefix
  1228. shlibdir
  1229. '
  1230. CMDLINE_SET="
  1231. $PATHS_LIST
  1232. ar
  1233. arch
  1234. as
  1235. build_suffix
  1236. cc
  1237. cpu
  1238. cross_prefix
  1239. dep_cc
  1240. extra_version
  1241. host_cc
  1242. host_cflags
  1243. host_ld
  1244. host_ldflags
  1245. host_libs
  1246. host_os
  1247. ld
  1248. logfile
  1249. malloc_prefix
  1250. nm
  1251. optflags
  1252. pkg_config
  1253. random_seed
  1254. samples
  1255. sysinclude
  1256. sysroot
  1257. target_exec
  1258. target_os
  1259. target_path
  1260. toolchain
  1261. "
  1262. CMDLINE_APPEND="
  1263. extra_cflags
  1264. "
  1265. # code dependency declarations
  1266. # architecture extensions
  1267. armv5te_deps="arm"
  1268. armv6_deps="arm"
  1269. armv6t2_deps="arm"
  1270. neon_deps="arm"
  1271. vfp_deps="arm"
  1272. vfpv3_deps="vfp"
  1273. map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
  1274. altivec_deps="ppc"
  1275. ppc4xx_deps="ppc"
  1276. vis_deps="sparc"
  1277. x86_64_suggest="cmov fast_cmov"
  1278. amd3dnow_deps="mmx"
  1279. amd3dnowext_deps="amd3dnow"
  1280. mmx_deps="x86"
  1281. mmxext_deps="mmx"
  1282. sse_deps="mmxext"
  1283. sse2_deps="sse"
  1284. sse3_deps="sse2"
  1285. ssse3_deps="sse3"
  1286. sse4_deps="ssse3"
  1287. sse42_deps="sse4"
  1288. avx_deps="sse42"
  1289. fma4_deps="avx"
  1290. mmx_external_deps="yasm"
  1291. mmx_inline_deps="inline_asm"
  1292. mmx_suggest="mmx_external mmx_inline"
  1293. for ext in $(filter_out mmx $ARCH_EXT_LIST_X86); do
  1294. eval dep=\$${ext}_deps
  1295. eval ${ext}_external_deps='"${dep}_external"'
  1296. eval ${ext}_inline_deps='"${dep}_inline"'
  1297. eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
  1298. done
  1299. aligned_stack_if_any="ppc x86"
  1300. fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1301. fast_clz_if_any="alpha avr32 mips ppc x86"
  1302. fast_unaligned_if_any="ppc x86"
  1303. inline_asm_deps="!tms470"
  1304. need_memalign="altivec neon sse"
  1305. symver_if_any="symver_asm_label symver_gnu_asm"
  1306. log2_deps="!msvcrt"
  1307. # subsystems
  1308. dct_select="rdft"
  1309. mdct_select="fft"
  1310. rdft_select="fft"
  1311. mpegaudio_select="mpegaudiodsp"
  1312. mpegaudiodsp_select="dct"
  1313. mpegvideo_select="videodsp"
  1314. mpegvideoenc_select="mpegvideo"
  1315. # decoders / encoders
  1316. aac_decoder_select="mdct sinewin"
  1317. aac_encoder_select="audio_frame_queue mdct sinewin"
  1318. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1319. ac3_decoder_select="mdct ac3dsp ac3_parser"
  1320. ac3_encoder_select="mdct ac3dsp"
  1321. ac3_fixed_encoder_select="mdct ac3dsp"
  1322. alac_encoder_select="lpc"
  1323. amrnb_decoder_select="lsp"
  1324. amrwb_decoder_select="lsp"
  1325. atrac1_decoder_select="mdct sinewin"
  1326. atrac3_decoder_select="mdct"
  1327. binkaudio_dct_decoder_select="mdct rdft dct sinewin"
  1328. binkaudio_rdft_decoder_select="mdct rdft sinewin"
  1329. cavs_decoder_select="golomb mpegvideo"
  1330. comfortnoise_encoder_select="lpc"
  1331. cook_decoder_select="mdct sinewin"
  1332. cscd_decoder_select="lzo"
  1333. cscd_decoder_suggest="zlib"
  1334. dca_decoder_select="mdct"
  1335. dnxhd_encoder_select="aandcttables mpegvideoenc"
  1336. dxa_decoder_select="zlib"
  1337. eac3_decoder_select="ac3_decoder"
  1338. eac3_encoder_select="ac3_encoder"
  1339. eamad_decoder_select="aandcttables error_resilience mpegvideo"
  1340. eatgq_decoder_select="aandcttables"
  1341. eatqi_decoder_select="aandcttables error_resilience mpegvideo"
  1342. ffv1_decoder_select="golomb rangecoder"
  1343. ffv1_encoder_select="rangecoder"
  1344. ffvhuff_encoder_select="huffman"
  1345. flac_decoder_select="golomb"
  1346. flac_encoder_select="golomb lpc"
  1347. flashsv_decoder_select="zlib"
  1348. flashsv_encoder_select="zlib"
  1349. flashsv2_decoder_select="zlib"
  1350. flv_decoder_select="h263_decoder"
  1351. flv_encoder_select="h263_encoder"
  1352. fraps_decoder_select="huffman"
  1353. h261_decoder_select="error_resilience mpegvideo"
  1354. h261_encoder_select="aandcttables mpegvideoenc"
  1355. h263_decoder_select="error_resilience h263_parser mpegvideo"
  1356. h263_encoder_select="aandcttables error_resilience mpegvideoenc"
  1357. h263i_decoder_select="h263_decoder"
  1358. h263p_encoder_select="h263_encoder"
  1359. h264_decoder_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel mpegvideo"
  1360. huffyuv_encoder_select="huffman"
  1361. iac_decoder_select="fft mdct sinewin"
  1362. imc_decoder_select="fft mdct sinewin"
  1363. jpegls_decoder_select="golomb"
  1364. jpegls_encoder_select="golomb"
  1365. ljpeg_encoder_select="aandcttables mpegvideoenc"
  1366. loco_decoder_select="golomb"
  1367. mdec_decoder_select="error_resilience mpegvideo"
  1368. mjpeg_encoder_select="aandcttables mpegvideoenc"
  1369. mlp_decoder_select="mlp_parser"
  1370. mp1_decoder_select="mpegaudio"
  1371. mp1float_decoder_select="mpegaudio"
  1372. mp2_decoder_select="mpegaudio"
  1373. mp2float_decoder_select="mpegaudio"
  1374. mp3_decoder_select="mpegaudio"
  1375. mp3adu_decoder_select="mpegaudio"
  1376. mp3adufloat_decoder_select="mpegaudio"
  1377. mp3float_decoder_select="mpegaudio"
  1378. mp3on4_decoder_select="mpegaudio"
  1379. mp3on4float_decoder_select="mpegaudio"
  1380. mpc7_decoder_select="mpegaudiodsp"
  1381. mpc8_decoder_select="mpegaudiodsp"
  1382. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1383. mpeg_xvmc_decoder_select="mpegvideo_decoder"
  1384. mpeg1video_decoder_select="error_resilience mpegvideo"
  1385. mpeg1video_encoder_select="aandcttables error_resilience mpegvideoenc"
  1386. mpeg2video_decoder_select="error_resilience mpegvideo"
  1387. mpeg2video_encoder_select="aandcttables error_resilience mpegvideoenc"
  1388. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1389. mpeg4_encoder_select="h263_encoder"
  1390. msmpeg4v1_decoder_select="h263_decoder"
  1391. msmpeg4v1_encoder_select="h263_encoder"
  1392. msmpeg4v2_decoder_select="h263_decoder"
  1393. msmpeg4v2_encoder_select="h263_encoder"
  1394. msmpeg4v3_decoder_select="h263_decoder"
  1395. msmpeg4v3_encoder_select="h263_encoder"
  1396. mss2_decoder_select="vc1_decoder"
  1397. nellymoser_decoder_select="mdct sinewin"
  1398. nellymoser_encoder_select="audio_frame_queue mdct sinewin"
  1399. nuv_decoder_select="lzo"
  1400. png_decoder_select="zlib"
  1401. png_encoder_select="zlib"
  1402. qcelp_decoder_select="lsp"
  1403. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1404. ra_144_encoder_select="audio_frame_queue lpc"
  1405. ralf_decoder_select="golomb"
  1406. rv10_decoder_select="h263_decoder"
  1407. rv10_encoder_select="h263_encoder"
  1408. rv20_decoder_select="h263_decoder"
  1409. rv20_encoder_select="h263_encoder"
  1410. rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo"
  1411. rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo"
  1412. shorten_decoder_select="golomb"
  1413. sipr_decoder_select="lsp"
  1414. svq1_decoder_select="error_resilience mpegvideo"
  1415. svq1_encoder_select="aandcttables error_resilience mpegvideoenc"
  1416. svq3_decoder_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel mpegvideo"
  1417. svq3_decoder_suggest="zlib"
  1418. theora_decoder_select="vp3_decoder"
  1419. tiff_decoder_suggest="zlib"
  1420. tiff_encoder_suggest="zlib"
  1421. truehd_decoder_select="mlp_decoder"
  1422. tscc_decoder_select="zlib"
  1423. twinvq_decoder_select="mdct lsp sinewin"
  1424. utvideo_encoder_select="huffman"
  1425. vc1_decoder_select="h263_decoder h264chroma h264qpel"
  1426. vc1image_decoder_select="vc1_decoder"
  1427. vorbis_decoder_select="mdct"
  1428. vorbis_encoder_select="mdct"
  1429. vp3_decoder_select="vp3dsp videodsp"
  1430. vp5_decoder_select="vp3dsp videodsp"
  1431. vp6_decoder_select="huffman vp3dsp videodsp"
  1432. vp6a_decoder_select="vp6_decoder"
  1433. vp6f_decoder_select="vp6_decoder"
  1434. vp8_decoder_select="h264pred videodsp"
  1435. wmapro_decoder_select="mdct sinewin"
  1436. wmav1_decoder_select="mdct sinewin"
  1437. wmav1_encoder_select="mdct sinewin"
  1438. wmav2_decoder_select="mdct sinewin"
  1439. wmav2_encoder_select="mdct sinewin"
  1440. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1441. wmv1_decoder_select="h263_decoder"
  1442. wmv1_encoder_select="h263_encoder"
  1443. wmv2_decoder_select="h263_decoder"
  1444. wmv2_encoder_select="h263_encoder"
  1445. wmv3_decoder_select="vc1_decoder"
  1446. wmv3image_decoder_select="wmv3_decoder"
  1447. zerocodec_decoder_select="zlib"
  1448. zlib_decoder_select="zlib"
  1449. zlib_encoder_select="zlib"
  1450. zmbv_decoder_select="zlib"
  1451. zmbv_encoder_select="zlib"
  1452. # hardware accelerators
  1453. vaapi_deps="va_va_h"
  1454. vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
  1455. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1456. h263_vaapi_hwaccel_select="vaapi h263_decoder"
  1457. h263_vdpau_hwaccel_select="vdpau h263_decoder"
  1458. h264_dxva2_hwaccel_deps="dxva2api_h"
  1459. h264_dxva2_hwaccel_select="dxva2 h264_decoder"
  1460. h264_vaapi_hwaccel_select="vaapi h264_decoder"
  1461. h264_vda_hwaccel_select="vda h264_decoder"
  1462. h264_vdpau_decoder_select="vdpau h264_decoder"
  1463. h264_vdpau_hwaccel_select="vdpau h264_decoder"
  1464. mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
  1465. mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
  1466. mpeg1_vdpau_hwaccel_select="vdpau mpeg1video_decoder"
  1467. mpeg2_dxva2_hwaccel_deps="dxva2api_h"
  1468. mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
  1469. mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
  1470. mpeg2_vdpau_hwaccel_select="vdpau mpeg2video_decoder"
  1471. mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
  1472. mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
  1473. mpeg4_vdpau_hwaccel_select="vdpau mpeg4_decoder"
  1474. vc1_dxva2_hwaccel_deps="dxva2api_h"
  1475. vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
  1476. vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
  1477. vc1_vdpau_decoder_select="vdpau vc1_decoder"
  1478. vc1_vdpau_hwaccel_select="vdpau vc1_decoder"
  1479. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1480. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1481. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1482. wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
  1483. # parsers
  1484. h264_parser_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel mpegvideo"
  1485. mpeg4video_parser_select="error_resilience mpegvideo"
  1486. mpegvideo_parser_select="error_resilience mpegvideo"
  1487. vc1_parser_select="error_resilience mpegvideo"
  1488. # external libraries
  1489. libfaac_encoder_deps="libfaac"
  1490. libfaac_encoder_select="audio_frame_queue"
  1491. libfdk_aac_encoder_deps="libfdk_aac"
  1492. libfdk_aac_encoder_select="audio_frame_queue"
  1493. libgsm_decoder_deps="libgsm"
  1494. libgsm_encoder_deps="libgsm"
  1495. libgsm_ms_decoder_deps="libgsm"
  1496. libgsm_ms_encoder_deps="libgsm"
  1497. libilbc_decoder_deps="libilbc"
  1498. libilbc_encoder_deps="libilbc"
  1499. libmp3lame_encoder_deps="libmp3lame"
  1500. libmp3lame_encoder_select="audio_frame_queue"
  1501. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1502. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1503. libopencore_amrnb_encoder_select="audio_frame_queue"
  1504. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1505. libopenjpeg_decoder_deps="libopenjpeg"
  1506. libopenjpeg_encoder_deps="libopenjpeg"
  1507. libopus_decoder_deps="libopus"
  1508. libopus_encoder_deps="libopus"
  1509. libopus_encoder_select="audio_frame_queue"
  1510. libschroedinger_decoder_deps="libschroedinger"
  1511. libschroedinger_encoder_deps="libschroedinger"
  1512. libspeex_decoder_deps="libspeex"
  1513. libspeex_encoder_deps="libspeex"
  1514. libspeex_encoder_select="audio_frame_queue"
  1515. libtheora_encoder_deps="libtheora"
  1516. libvo_aacenc_encoder_deps="libvo_aacenc"
  1517. libvo_aacenc_encoder_select="audio_frame_queue"
  1518. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  1519. libvorbis_encoder_deps="libvorbis"
  1520. libvorbis_encoder_select="audio_frame_queue"
  1521. libvpx_vp8_decoder_deps="libvpx"
  1522. libvpx_vp8_encoder_deps="libvpx"
  1523. libvpx_vp9_decoder_deps="libvpx"
  1524. libvpx_vp9_encoder_deps="libvpx"
  1525. libx264_encoder_deps="libx264"
  1526. libxavs_encoder_deps="libxavs"
  1527. libxvid_encoder_deps="libxvid"
  1528. # demuxers / muxers
  1529. ac3_demuxer_select="ac3_parser"
  1530. asf_stream_muxer_select="asf_muxer"
  1531. avisynth_demuxer_deps="avisynth"
  1532. dirac_demuxer_select="dirac_parser"
  1533. eac3_demuxer_select="ac3_parser"
  1534. flac_demuxer_select="flac_parser"
  1535. ipod_muxer_select="mov_muxer"
  1536. ismv_muxer_select="mov_muxer"
  1537. matroska_audio_muxer_select="matroska_muxer"
  1538. matroska_demuxer_suggest="bzlib lzo zlib"
  1539. mov_demuxer_suggest="zlib"
  1540. mov_muxer_select="rtpenc_chain"
  1541. mp3_demuxer_select="mpegaudio_parser"
  1542. mp4_muxer_select="mov_muxer"
  1543. mpegts_muxer_select="adts_muxer latm_muxer mpegvideo"
  1544. mpegtsraw_demuxer_select="mpegts_demuxer"
  1545. mxf_d10_muxer_select="mxf_muxer"
  1546. ogg_demuxer_select="golomb"
  1547. psp_muxer_select="mov_muxer"
  1548. rtp_demuxer_select="sdp_demuxer"
  1549. rtp_muxer_select="mpegvideo"
  1550. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  1551. rtsp_demuxer_select="http_protocol rtpdec"
  1552. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  1553. sap_demuxer_select="sdp_demuxer"
  1554. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  1555. sdp_demuxer_select="rtpdec"
  1556. smoothstreaming_muxer_select="ismv_muxer"
  1557. spdif_muxer_select="aac_parser"
  1558. tak_demuxer_select="tak_parser"
  1559. tg2_muxer_select="mov_muxer"
  1560. tgp_muxer_select="mov_muxer"
  1561. w64_demuxer_deps="wav_demuxer"
  1562. # indevs / outdevs
  1563. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1564. alsa_outdev_deps="alsa_asoundlib_h"
  1565. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1566. dv1394_indev_deps="dv1394 dv_demuxer"
  1567. fbdev_indev_deps="linux_fb_h"
  1568. jack_indev_deps="jack_jack_h"
  1569. libcdio_indev_deps="libcdio"
  1570. libdc1394_indev_deps="libdc1394"
  1571. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1572. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1573. pulse_indev_deps="libpulse"
  1574. sndio_indev_deps="sndio_h"
  1575. sndio_outdev_deps="sndio_h"
  1576. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1577. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1578. vfwcap_indev_extralibs="-lavicap32"
  1579. x11grab_indev_deps="x11grab XShmCreateImage"
  1580. # protocols
  1581. ffrtmpcrypt_protocol_deps="!librtmp_protocol"
  1582. ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
  1583. ffrtmpcrypt_protocol_select="tcp_protocol"
  1584. ffrtmphttp_protocol_deps="!librtmp_protocol"
  1585. ffrtmphttp_protocol_select="http_protocol"
  1586. gopher_protocol_select="network"
  1587. httpproxy_protocol_select="tcp_protocol"
  1588. http_protocol_select="tcp_protocol"
  1589. https_protocol_select="tls_protocol"
  1590. librtmp_protocol_deps="librtmp"
  1591. librtmpe_protocol_deps="librtmp"
  1592. librtmps_protocol_deps="librtmp"
  1593. librtmpt_protocol_deps="librtmp"
  1594. librtmpte_protocol_deps="librtmp"
  1595. mmsh_protocol_select="http_protocol"
  1596. mmst_protocol_select="network"
  1597. rtmp_protocol_deps="!librtmp_protocol"
  1598. rtmp_protocol_select="tcp_protocol"
  1599. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  1600. rtmps_protocol_deps="!librtmp_protocol"
  1601. rtmps_protocol_select="tls_protocol"
  1602. rtmpt_protocol_select="ffrtmphttp_protocol"
  1603. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  1604. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  1605. rtp_protocol_select="udp_protocol"
  1606. sctp_protocol_deps="struct_sctp_event_subscribe"
  1607. sctp_protocol_select="network"
  1608. srtp_protocol_select="rtp_protocol"
  1609. tcp_protocol_select="network"
  1610. tls_protocol_deps_any="openssl gnutls"
  1611. tls_protocol_select="tcp_protocol"
  1612. udp_protocol_select="network"
  1613. # filters
  1614. blackframe_filter_deps="gpl"
  1615. boxblur_filter_deps="gpl"
  1616. cropdetect_filter_deps="gpl"
  1617. delogo_filter_deps="gpl"
  1618. drawtext_filter_deps="libfreetype"
  1619. frei0r_filter_deps="frei0r dlopen strtok_r"
  1620. frei0r_filter_extralibs='$ldl'
  1621. frei0r_src_filter_deps="frei0r dlopen strtok_r"
  1622. frei0r_src_filter_extralibs='$ldl'
  1623. hqdn3d_filter_deps="gpl"
  1624. resample_filter_deps="avresample"
  1625. ocv_filter_deps="libopencv"
  1626. scale_filter_deps="swscale"
  1627. yadif_filter_deps="gpl"
  1628. # libraries
  1629. avcodec_deps="avutil"
  1630. avdevice_deps="avutil avcodec avformat"
  1631. avfilter_deps="avutil"
  1632. avformat_deps="avutil avcodec"
  1633. avresample_deps="avutil"
  1634. swscale_deps="avutil"
  1635. # programs
  1636. avconv_deps="avcodec avfilter avformat avresample swscale"
  1637. avconv_select="aformat_filter anull_filter asyncts_filter format_filter
  1638. fps_filter null_filter resample_filter scale_filter
  1639. setpts_filter"
  1640. avplay_deps="avcodec avformat avresample swscale sdl"
  1641. avplay_select="rdft"
  1642. avprobe_deps="avcodec avformat"
  1643. avserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer !shared"
  1644. avserver_extralibs='$ldl'
  1645. doc_deps="texi2html"
  1646. # default parameters
  1647. logfile="config.log"
  1648. # installation paths
  1649. prefix_default="/usr/local"
  1650. bindir_default='${prefix}/bin'
  1651. datadir_default='${prefix}/share/avconv'
  1652. incdir_default='${prefix}/include'
  1653. libdir_default='${prefix}/lib'
  1654. mandir_default='${prefix}/share/man'
  1655. shlibdir_default="$libdir_default"
  1656. # toolchain
  1657. ar_default="ar"
  1658. cc_default="gcc"
  1659. host_cc_default="gcc"
  1660. cp_f="cp -f"
  1661. ln_s="ln -sf"
  1662. nm_default="nm -g"
  1663. objformat="elf"
  1664. pkg_config_default=pkg-config
  1665. ranlib="ranlib"
  1666. yasmexe="yasm"
  1667. nogas=":"
  1668. # machine
  1669. arch_default=$(uname -m)
  1670. cpu="generic"
  1671. # OS
  1672. target_os_default=$(tolower $(uname -s))
  1673. host_os=$target_os_default
  1674. # configurable options
  1675. enable $LIBRARY_LIST $PROGRAM_LIST
  1676. enable asm
  1677. enable debug
  1678. enable doc
  1679. enable optimizations
  1680. enable safe_bitstream_reader
  1681. enable static
  1682. enable swscale_alpha
  1683. # build settings
  1684. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1685. AVSERVERLDFLAGS=-Wl,-E
  1686. LIBPREF="lib"
  1687. LIBSUF=".a"
  1688. FULLNAME='$(NAME)$(BUILDSUF)'
  1689. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1690. SLIBPREF="lib"
  1691. SLIBSUF=".so"
  1692. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1693. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1694. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1695. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1696. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  1697. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  1698. asflags_filter=echo
  1699. cflags_filter=echo
  1700. ldflags_filter=echo
  1701. AS_C='-c'
  1702. AS_O='-o $@'
  1703. CC_C='-c'
  1704. CC_E='-E -o $@'
  1705. CC_O='-o $@'
  1706. LD_O='-o $@'
  1707. LD_LIB='-l%'
  1708. LD_PATH='-L'
  1709. HOSTCC_C='-c'
  1710. HOSTCC_O='-o $@'
  1711. HOSTLD_O='-o $@'
  1712. host_cflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600 -O3 -g'
  1713. host_libs='-lm'
  1714. host_cflags_filter=echo
  1715. host_ldflags_filter=echo
  1716. target_path='$(CURDIR)'
  1717. # since the object filename is not given with the -MM flag, the compiler
  1718. # is only able to print the basename, and we must add the path ourselves
  1719. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1720. DEPFLAGS='-MM'
  1721. # find source path
  1722. if test -f configure; then
  1723. source_path=.
  1724. else
  1725. source_path=$(cd $(dirname "$0"); pwd)
  1726. echo "$source_path" | grep -q '[[:blank:]]' &&
  1727. die "Out of tree builds are impossible with whitespace in source path."
  1728. test -e "$source_path/config.h" &&
  1729. die "Out of tree builds are impossible with config.h in source dir."
  1730. fi
  1731. for v in "$@"; do
  1732. r=${v#*=}
  1733. l=${v%"$r"}
  1734. r=$(sh_quote "$r")
  1735. LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
  1736. done
  1737. find_things(){
  1738. thing=$1
  1739. pattern=$2
  1740. file=$source_path/$3
  1741. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1742. }
  1743. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1744. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1745. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1746. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1747. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1748. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1749. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1750. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1751. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1752. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1753. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1754. ALL_COMPONENTS="
  1755. $BSF_LIST
  1756. $DECODER_LIST
  1757. $DEMUXER_LIST
  1758. $ENCODER_LIST
  1759. $FILTER_LIST
  1760. $HWACCEL_LIST
  1761. $INDEV_LIST
  1762. $MUXER_LIST
  1763. $OUTDEV_LIST
  1764. $PARSER_LIST
  1765. $PROTOCOL_LIST
  1766. "
  1767. for n in $COMPONENT_LIST; do
  1768. v=$(toupper ${n%s})_LIST
  1769. eval enable \$$v
  1770. eval ${n}_if_any="\$$v"
  1771. done
  1772. enable $ARCH_EXT_LIST
  1773. die_unknown(){
  1774. echo "Unknown option \"$1\"."
  1775. echo "See $0 --help for available options."
  1776. exit 1
  1777. }
  1778. show_list() {
  1779. suffix=_$1
  1780. shift
  1781. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1782. exit 0
  1783. }
  1784. rand_list(){
  1785. IFS=', '
  1786. set -- $*
  1787. unset IFS
  1788. for thing; do
  1789. comp=${thing%:*}
  1790. prob=${thing#$comp}
  1791. prob=${prob#:}
  1792. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  1793. echo "prob ${prob:-0.5}"
  1794. printf '%s\n' $comp
  1795. done
  1796. }
  1797. do_random(){
  1798. action=$1
  1799. shift
  1800. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  1801. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  1802. }
  1803. for opt do
  1804. optval="${opt#*=}"
  1805. case "$opt" in
  1806. --extra-ldflags=*)
  1807. add_ldflags $optval
  1808. ;;
  1809. --extra-libs=*)
  1810. add_extralibs $optval
  1811. ;;
  1812. --disable-devices)
  1813. disable $INDEV_LIST $OUTDEV_LIST
  1814. ;;
  1815. --enable-debug=*)
  1816. debuglevel="$optval"
  1817. ;;
  1818. --disable-programs)
  1819. disable $PROGRAM_LIST
  1820. ;;
  1821. --disable-everything)
  1822. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1823. ;;
  1824. --disable-all)
  1825. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1826. disable $LIBRARY_LIST $PROGRAM_LIST doc
  1827. ;;
  1828. --enable-random|--disable-random)
  1829. action=${opt%%-random}
  1830. do_random ${action#--} $COMPONENT_LIST
  1831. ;;
  1832. --enable-random=*|--disable-random=*)
  1833. action=${opt%%-random=*}
  1834. do_random ${action#--} $optval
  1835. ;;
  1836. --enable-*=*|--disable-*=*)
  1837. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1838. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1839. eval list=\$$(toupper $thing)_LIST
  1840. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1841. $action $(filter "$name" $list)
  1842. ;;
  1843. --enable-?*|--disable-?*)
  1844. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1845. if is_in $option $COMPONENT_LIST; then
  1846. test $action = disable && action=unset
  1847. eval $action \$$(toupper ${option%s})_LIST
  1848. elif is_in $option $CMDLINE_SELECT; then
  1849. $action $option
  1850. else
  1851. die_unknown $opt
  1852. fi
  1853. ;;
  1854. --list-*)
  1855. NAME="${opt#--list-}"
  1856. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1857. NAME=${NAME%s}
  1858. eval show_list $NAME \$$(toupper $NAME)_LIST
  1859. ;;
  1860. --help|-h) show_help
  1861. ;;
  1862. *)
  1863. optname="${opt%%=*}"
  1864. optname="${optname#--}"
  1865. optname=$(echo "$optname" | sed 's/-/_/g')
  1866. if is_in $optname $CMDLINE_SET; then
  1867. eval $optname='$optval'
  1868. elif is_in $optname $CMDLINE_APPEND; then
  1869. append $optname "$optval"
  1870. else
  1871. die_unknown $opt
  1872. fi
  1873. ;;
  1874. esac
  1875. done
  1876. disabled logging && logfile=/dev/null
  1877. echo "# $0 $LIBAV_CONFIGURATION" > $logfile
  1878. set >> $logfile
  1879. test -n "$cross_prefix" && enable cross_compile
  1880. if enabled cross_compile; then
  1881. test -n "$arch" && test -n "$target_os" ||
  1882. die "Must specify target arch and OS when cross-compiling"
  1883. fi
  1884. ar_default="${cross_prefix}${ar_default}"
  1885. cc_default="${cross_prefix}${cc_default}"
  1886. nm_default="${cross_prefix}${nm_default}"
  1887. pkg_config_default="${cross_prefix}${pkg_config_default}"
  1888. ranlib="${cross_prefix}${ranlib}"
  1889. sysinclude_default="${sysroot}/usr/include"
  1890. case "$toolchain" in
  1891. clang-asan)
  1892. cc_default="clang"
  1893. add_cflags -faddress-sanitizer
  1894. add_ldflags -faddress-sanitizer
  1895. ;;
  1896. clang-tsan)
  1897. cc_default="clang"
  1898. add_cflags -fthread-sanitizer
  1899. add_ldflags -fthread-sanitizer
  1900. ;;
  1901. msvc)
  1902. cc_default="c99wrap cl"
  1903. ld_default="c99wrap link"
  1904. nm_default="dumpbin -symbols"
  1905. ar_default="lib"
  1906. target_os_default="win32"
  1907. ;;
  1908. ?*)
  1909. die "Unknown toolchain $toolchain"
  1910. ;;
  1911. esac
  1912. set_default arch cc pkg_config sysinclude target_os
  1913. enabled cross_compile || host_cc_default=$cc
  1914. set_default host_cc
  1915. if ! $pkg_config --version >/dev/null 2>&1; then
  1916. warn "$pkg_config not found, library detection may fail."
  1917. pkg_config=false
  1918. fi
  1919. exesuf() {
  1920. case $1 in
  1921. mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  1922. esac
  1923. }
  1924. EXESUF=$(exesuf $target_os)
  1925. HOSTEXESUF=$(exesuf $host_os)
  1926. # set temporary file name
  1927. : ${TMPDIR:=$TEMPDIR}
  1928. : ${TMPDIR:=$TMP}
  1929. : ${TMPDIR:=/tmp}
  1930. if ! check_cmd mktemp -u XXXXXX; then
  1931. # simple replacement for missing mktemp
  1932. # NOT SAFE FOR GENERAL USE
  1933. mktemp(){
  1934. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  1935. }
  1936. fi
  1937. tmpfile(){
  1938. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1939. (set -C; exec > $tmp) 2>/dev/null ||
  1940. die "Unable to create temporary file in $TMPDIR."
  1941. append TMPFILES $tmp
  1942. eval $1=$tmp
  1943. }
  1944. trap 'rm -f -- $TMPFILES' EXIT
  1945. tmpfile TMPASM .asm
  1946. tmpfile TMPC .c
  1947. tmpfile TMPE $EXESUF
  1948. tmpfile TMPH .h
  1949. tmpfile TMPO .o
  1950. tmpfile TMPS .S
  1951. tmpfile TMPSH .sh
  1952. tmpfile TMPV .ver
  1953. unset -f mktemp
  1954. chmod +x $TMPE
  1955. # make sure we can execute files in $TMPDIR
  1956. cat > $TMPSH 2>> $logfile <<EOF
  1957. #! /bin/sh
  1958. EOF
  1959. chmod +x $TMPSH >> $logfile 2>&1
  1960. if ! $TMPSH >> $logfile 2>&1; then
  1961. cat <<EOF
  1962. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1963. variable to another directory and make sure that it is not mounted noexec.
  1964. EOF
  1965. die "Sanity test failed."
  1966. fi
  1967. ccc_flags(){
  1968. for flag; do
  1969. case $flag in
  1970. -std=c99) echo -c99 ;;
  1971. -mcpu=*) echo -arch ${flag#*=} ;;
  1972. -mieee) echo -ieee ;;
  1973. -O*|-fast) echo $flag ;;
  1974. -fno-math-errno) echo -assume nomath_errno ;;
  1975. -g) echo -g3 ;;
  1976. -Wall) echo -msg_enable level2 ;;
  1977. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  1978. -Wl,*) echo $flag ;;
  1979. -f*|-W*) ;;
  1980. *) echo $flag ;;
  1981. esac
  1982. done
  1983. }
  1984. msvc_flags(){
  1985. for flag; do
  1986. case $flag in
  1987. -fomit-frame-pointer) echo -Oy ;;
  1988. -g) echo -Z7 ;;
  1989. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  1990. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  1991. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  1992. -wd4996 -wd4273 ;;
  1993. -std=c99) ;;
  1994. -fno-math-errno) ;;
  1995. -fno-common) ;;
  1996. -fno-signed-zeros) ;;
  1997. -fPIC) ;;
  1998. -lz) echo zlib.lib ;;
  1999. -lavifil32) echo vfw32.lib ;;
  2000. -lavicap32) echo vfw32.lib user32.lib ;;
  2001. -l*) echo ${flag#-l}.lib ;;
  2002. *) echo $flag ;;
  2003. esac
  2004. done
  2005. }
  2006. pgi_flags(){
  2007. for flag; do
  2008. case $flag in
  2009. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2010. -fomit-frame-pointer) echo -Mnoframe ;;
  2011. -g) echo -gopt ;;
  2012. *) echo $flag ;;
  2013. esac
  2014. done
  2015. }
  2016. suncc_flags(){
  2017. for flag; do
  2018. case $flag in
  2019. -march=*|-mcpu=*)
  2020. case "${flag#*=}" in
  2021. native) echo -xtarget=native ;;
  2022. v9|niagara) echo -xarch=sparc ;;
  2023. ultrasparc) echo -xarch=sparcvis ;;
  2024. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2025. i586|pentium) echo -xchip=pentium ;;
  2026. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2027. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2028. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2029. pentium4*) echo -xtarget=pentium4 ;;
  2030. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2031. *-sse3) echo -xarch=sse3 ;;
  2032. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2033. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2034. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2035. amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
  2036. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2037. k8|opteron|athlon64|athlon-fx)
  2038. echo -xarch=sse2a ;;
  2039. athlon*) echo -xarch=pentium_proa ;;
  2040. esac
  2041. ;;
  2042. -std=c99) echo -xc99 ;;
  2043. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2044. -fPIC) echo -KPIC -xcode=pic32 ;;
  2045. -W*,*) echo $flag ;;
  2046. -f*-*|-W*|-mimpure-text) ;;
  2047. -shared) echo -G ;;
  2048. *) echo $flag ;;
  2049. esac
  2050. done
  2051. }
  2052. tms470_flags(){
  2053. for flag; do
  2054. case $flag in
  2055. -march=*|-mcpu=*)
  2056. case "${flag#*=}" in
  2057. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2058. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2059. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2060. armv6*|arm11*) echo -mv=6 ;;
  2061. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2062. echo -mv=5e ;;
  2063. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2064. esac
  2065. ;;
  2066. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2067. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2068. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2069. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2070. -msoft-float) echo --float_support=vfplib ;;
  2071. -O[0-3]|-mf=*) echo $flag ;;
  2072. -g) echo -g -mn ;;
  2073. -pds=*) echo $flag ;;
  2074. -D*|-I*) echo $flag ;;
  2075. --gcc|--abi=*) echo $flag ;;
  2076. -me) echo $flag ;;
  2077. esac
  2078. done
  2079. }
  2080. probe_cc(){
  2081. pfx=$1
  2082. _cc=$2
  2083. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2084. unset _ld_o _ldflags _ld_lib _ld_path
  2085. unset _depflags _DEPCMD _DEPFLAGS
  2086. _flags_filter=echo
  2087. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2088. _type=llvm_gcc
  2089. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  2090. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  2091. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2092. _cflags_speed='-O3'
  2093. _cflags_size='-Os'
  2094. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2095. _type=gcc
  2096. gcc_version=$($_cc --version | head -n1)
  2097. gcc_basever=$($_cc -dumpversion)
  2098. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2099. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2100. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2101. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2102. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2103. fi
  2104. _cflags_speed='-O3'
  2105. _cflags_size='-Os'
  2106. elif $_cc --version 2>/dev/null | grep -q Intel; then
  2107. _type=icc
  2108. _ident=$($_cc --version | head -n1)
  2109. _depflags='-MMD'
  2110. _cflags_speed='-O3'
  2111. _cflags_size='-Os'
  2112. _cflags_noopt='-O1'
  2113. elif $_cc -v 2>&1 | grep -q xlc; then
  2114. _type=xlc
  2115. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2116. _cflags_speed='-O5'
  2117. _cflags_size='-O5 -qcompact'
  2118. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2119. _type=ccc
  2120. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2121. _DEPFLAGS='-M'
  2122. _cflags_speed='-fast'
  2123. _cflags_size='-O1'
  2124. _flags_filter=ccc_flags
  2125. elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  2126. test -d "$sysroot" || die "No valid sysroot specified."
  2127. _type=armcc
  2128. _ident=$($_cc --vsn | head -n1)
  2129. armcc_conf="$PWD/armcc.conf"
  2130. $_cc --arm_linux_configure \
  2131. --arm_linux_config_file="$armcc_conf" \
  2132. --configure_sysroot="$sysroot" \
  2133. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2134. die "Error creating armcc configuration file."
  2135. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2136. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2137. as_default="${cross_prefix}gcc"
  2138. _depflags='-MMD'
  2139. _cflags_speed='-O3'
  2140. _cflags_size='-Os'
  2141. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2142. _type=tms470
  2143. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2144. _flags='--gcc --abi=eabi -me'
  2145. _cc_e='-ppl -fe=$@'
  2146. _cc_o='-fe=$@'
  2147. _depflags='-ppa -ppd=$(@:.o=.d)'
  2148. _cflags_speed='-O3 -mf=5'
  2149. _cflags_size='-O3 -mf=2'
  2150. _flags_filter=tms470_flags
  2151. elif $_cc -v 2>&1 | grep -q clang; then
  2152. _type=clang
  2153. _ident=$($_cc --version | head -n1)
  2154. _depflags='-MMD'
  2155. _cflags_speed='-O3'
  2156. _cflags_size='-Os'
  2157. elif $_cc -V 2>&1 | grep -q Sun; then
  2158. _type=suncc
  2159. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2160. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2161. _DEPFLAGS='-xM1 -xc99'
  2162. _ldflags='-std=c99'
  2163. _cflags_speed='-O5'
  2164. _cflags_size='-O5 -xspace'
  2165. _flags_filter=suncc_flags
  2166. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2167. _type=pathscale
  2168. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2169. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2170. _cflags_speed='-O2'
  2171. _cflags_size='-Os'
  2172. _flags_filter='filter_out -Wdisabled-optimization'
  2173. elif $_cc -v 2>&1 | grep -q Open64; then
  2174. _type=open64
  2175. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2176. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2177. _cflags_speed='-O2'
  2178. _cflags_size='-Os'
  2179. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2180. elif $_cc -V 2>&1 | grep -q Portland; then
  2181. _type=pgi
  2182. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2183. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  2184. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2185. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2186. _cflags_noopt="-O1"
  2187. _flags_filter=pgi_flags
  2188. elif $_cc 2>&1 | grep -q Microsoft; then
  2189. _type=msvc
  2190. _ident=$($cc 2>&1 | head -n1)
  2191. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  2192. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  2193. _cflags_speed="-O2"
  2194. _cflags_size="-O1"
  2195. # Nonstandard output options, to avoid msys path conversion issues, relies on wrapper to remap it
  2196. if $_cc 2>&1 | grep -q Linker; then
  2197. _ld_o='-out $@'
  2198. else
  2199. _ld_o='-Fe$@'
  2200. fi
  2201. _cc_o='-Fo $@'
  2202. _cc_e='-P -Fi $@'
  2203. _flags_filter=msvc_flags
  2204. _ld_lib='lib%.a'
  2205. _ld_path='-libpath:'
  2206. _flags='-nologo'
  2207. _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  2208. if [ $pfx = hostcc ]; then
  2209. append _cflags -Dsnprintf=_snprintf
  2210. fi
  2211. fi
  2212. eval ${pfx}_type=\$_type
  2213. eval ${pfx}_ident=\$_ident
  2214. }
  2215. set_ccvars(){
  2216. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2217. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2218. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2219. if [ -n "$_depflags" ]; then
  2220. eval ${1}_DEPFLAGS=\$_depflags
  2221. else
  2222. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2223. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2224. eval DEP${1}FLAGS=\$_flags
  2225. fi
  2226. }
  2227. probe_cc cc "$cc"
  2228. cflags_filter=$_flags_filter
  2229. cflags_speed=$_cflags_speed
  2230. cflags_size=$_cflags_size
  2231. cflags_noopt=$_cflags_noopt
  2232. add_cflags $_flags $_cflags
  2233. cc_ldflags=$_ldflags
  2234. set_ccvars CC
  2235. probe_cc hostcc "$host_cc"
  2236. host_cflags_filter=$_flags_filter
  2237. add_host_cflags $_flags $_cflags
  2238. set_ccvars HOSTCC
  2239. test -n "$cc_type" && enable $cc_type ||
  2240. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2241. : ${as_default:=$cc}
  2242. : ${dep_cc_default:=$cc}
  2243. : ${ld_default:=$cc}
  2244. : ${host_ld_default:=$host_cc}
  2245. set_default ar as dep_cc ld host_ld
  2246. probe_cc as "$as"
  2247. asflags_filter=$_flags_filter
  2248. add_asflags $_flags $_cflags
  2249. set_ccvars AS
  2250. probe_cc ld "$ld"
  2251. ldflags_filter=$_flags_filter
  2252. add_ldflags $_flags $_ldflags
  2253. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2254. LD_O=${_ld_o-$LD_O}
  2255. LD_LIB=${_ld_lib-$LD_LIB}
  2256. LD_PATH=${_ld_path-$LD_PATH}
  2257. probe_cc hostld "$host_ld"
  2258. host_ldflags_filter=$_flags_filter
  2259. add_host_ldflags $_flags $_ldflags
  2260. HOSTLD_O=${_ld_o-$HOSTLD_O}
  2261. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2262. probe_cc depcc "$dep_cc"
  2263. CCDEP=${_DEPCMD:-$DEPCMD}
  2264. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2265. DEPCCFLAGS=$_flags
  2266. fi
  2267. if $ar 2>&1 | grep -q Microsoft; then
  2268. arflags="-nologo"
  2269. ar_o='-out:$@'
  2270. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  2271. arflags="rq"
  2272. ar_o='$@'
  2273. else
  2274. arflags="rc"
  2275. ar_o='$@'
  2276. fi
  2277. add_cflags $extra_cflags
  2278. add_asflags $extra_cflags
  2279. if test -n "$sysroot"; then
  2280. case "$cc_type" in
  2281. gcc|llvm_gcc|clang)
  2282. add_cppflags --sysroot="$sysroot"
  2283. add_ldflags --sysroot="$sysroot"
  2284. ;;
  2285. tms470)
  2286. add_cppflags -I"$sysinclude"
  2287. add_ldflags --sysroot="$sysroot"
  2288. ;;
  2289. esac
  2290. fi
  2291. if test "$cpu" = host; then
  2292. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  2293. case "$cc_type" in
  2294. gcc|llvm_gcc)
  2295. check_native(){
  2296. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2297. sed -n "/cc1.*$1=/{
  2298. s/.*$1=\\([^ ]*\\).*/\\1/
  2299. p
  2300. q
  2301. }" $TMPE
  2302. }
  2303. cpu=$(check_native -march || check_native -mcpu)
  2304. ;;
  2305. esac
  2306. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  2307. fi
  2308. # Deal with common $arch aliases
  2309. case "$arch" in
  2310. aarch64|arm64)
  2311. arch="aarch64"
  2312. ;;
  2313. arm*)
  2314. arch="arm"
  2315. ;;
  2316. mips*|IP*)
  2317. arch="mips"
  2318. ;;
  2319. parisc*|hppa*)
  2320. arch="parisc"
  2321. ;;
  2322. "Power Macintosh"|ppc*|powerpc*)
  2323. arch="ppc"
  2324. ;;
  2325. s390|s390x)
  2326. arch="s390"
  2327. ;;
  2328. sh4|sh)
  2329. arch="sh4"
  2330. ;;
  2331. sun4u|sparc*)
  2332. arch="sparc"
  2333. ;;
  2334. tilegx|tile-gx)
  2335. arch="tilegx"
  2336. ;;
  2337. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  2338. arch="x86"
  2339. ;;
  2340. esac
  2341. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2342. enable $arch
  2343. # Add processor-specific flags
  2344. if enabled aarch64; then
  2345. case $cpu in
  2346. armv*)
  2347. cpuflags="-march=$cpu"
  2348. ;;
  2349. *)
  2350. cpuflags="-mcpu=$cpu"
  2351. ;;
  2352. esac
  2353. elif enabled alpha; then
  2354. cpuflags="-mcpu=$cpu"
  2355. elif enabled arm; then
  2356. check_arm_arch() {
  2357. check_cpp_condition stddef.h \
  2358. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  2359. $cpuflags
  2360. }
  2361. probe_arm_arch() {
  2362. if check_arm_arch 4; then echo armv4;
  2363. elif check_arm_arch 4T; then echo armv4t;
  2364. elif check_arm_arch 5; then echo armv5;
  2365. elif check_arm_arch 5E; then echo armv5e;
  2366. elif check_arm_arch 5T; then echo armv5t;
  2367. elif check_arm_arch 5TE; then echo armv5te;
  2368. elif check_arm_arch 5TEJ; then echo armv5te;
  2369. elif check_arm_arch 6; then echo armv6;
  2370. elif check_arm_arch 6J; then echo armv6j;
  2371. elif check_arm_arch 6K; then echo armv6k;
  2372. elif check_arm_arch 6Z; then echo armv6z;
  2373. elif check_arm_arch 6ZK; then echo armv6zk;
  2374. elif check_arm_arch 6T2; then echo armv6t2;
  2375. elif check_arm_arch 7; then echo armv7;
  2376. elif check_arm_arch 7A 7_A; then echo armv7-a;
  2377. elif check_arm_arch 7R 7_R; then echo armv7-r;
  2378. elif check_arm_arch 7M 7_M; then echo armv7-m;
  2379. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  2380. elif check_arm_arch 8A 8_A; then echo armv8-a;
  2381. fi
  2382. }
  2383. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  2384. case $cpu in
  2385. armv*)
  2386. cpuflags="-march=$cpu"
  2387. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2388. ;;
  2389. *)
  2390. cpuflags="-mcpu=$cpu"
  2391. case $cpu in
  2392. cortex-a*) subarch=armv7a ;;
  2393. cortex-r*) subarch=armv7r ;;
  2394. cortex-m*) enable thumb; subarch=armv7m ;;
  2395. arm11*) subarch=armv6 ;;
  2396. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2397. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2398. *) subarch=$(probe_arm_arch) ;;
  2399. esac
  2400. ;;
  2401. esac
  2402. case "$subarch" in
  2403. armv5t*) enable fast_clz ;;
  2404. armv[6-8]*) enable fast_clz fast_unaligned ;;
  2405. esac
  2406. elif enabled avr32; then
  2407. case $cpu in
  2408. ap7[02]0[0-2])
  2409. subarch="avr32_ap"
  2410. cpuflags="-mpart=$cpu"
  2411. ;;
  2412. ap)
  2413. subarch="avr32_ap"
  2414. cpuflags="-march=$cpu"
  2415. ;;
  2416. uc3[ab]*)
  2417. subarch="avr32_uc"
  2418. cpuflags="-mcpu=$cpu"
  2419. ;;
  2420. uc)
  2421. subarch="avr32_uc"
  2422. cpuflags="-march=$cpu"
  2423. ;;
  2424. esac
  2425. elif enabled bfin; then
  2426. cpuflags="-mcpu=$cpu"
  2427. elif enabled mips; then
  2428. cpuflags="-march=$cpu"
  2429. elif enabled ppc; then
  2430. case $(tolower $cpu) in
  2431. 601|ppc601|powerpc601)
  2432. cpuflags="-mcpu=601"
  2433. disable altivec
  2434. ;;
  2435. 603*|ppc603*|powerpc603*)
  2436. cpuflags="-mcpu=603"
  2437. disable altivec
  2438. ;;
  2439. 604*|ppc604*|powerpc604*)
  2440. cpuflags="-mcpu=604"
  2441. disable altivec
  2442. ;;
  2443. g3|75*|ppc75*|powerpc75*)
  2444. cpuflags="-mcpu=750"
  2445. disable altivec
  2446. ;;
  2447. g4|745*|ppc745*|powerpc745*)
  2448. cpuflags="-mcpu=7450"
  2449. ;;
  2450. 74*|ppc74*|powerpc74*)
  2451. cpuflags="-mcpu=7400"
  2452. ;;
  2453. g5|970|ppc970|powerpc970)
  2454. cpuflags="-mcpu=970"
  2455. ;;
  2456. power[3-7]*)
  2457. cpuflags="-mcpu=$cpu"
  2458. ;;
  2459. cell)
  2460. cpuflags="-mcpu=cell"
  2461. enable ldbrx
  2462. ;;
  2463. e500mc)
  2464. cpuflags="-mcpu=e500mc"
  2465. disable altivec
  2466. ;;
  2467. e500v2)
  2468. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2469. disable altivec
  2470. ;;
  2471. e500)
  2472. cpuflags="-mcpu=8540 -mhard-float"
  2473. disable altivec
  2474. ;;
  2475. esac
  2476. elif enabled sparc; then
  2477. case $cpu in
  2478. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  2479. cpuflags="-mcpu=$cpu"
  2480. disable vis
  2481. ;;
  2482. ultrasparc*|niagara[234])
  2483. cpuflags="-mcpu=$cpu"
  2484. ;;
  2485. esac
  2486. elif enabled x86; then
  2487. case $cpu in
  2488. i[345]86|pentium)
  2489. cpuflags="-march=$cpu"
  2490. disable mmx
  2491. ;;
  2492. # targets that do NOT support conditional mov (cmov)
  2493. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2494. cpuflags="-march=$cpu"
  2495. disable cmov
  2496. ;;
  2497. # targets that do support conditional mov (cmov)
  2498. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|corei7*|amdfam10|barcelona|atom|bdver*)
  2499. cpuflags="-march=$cpu"
  2500. enable cmov
  2501. enable fast_cmov
  2502. ;;
  2503. # targets that do support conditional mov but on which it's slow
  2504. pentium4|pentium4m|prescott|nocona)
  2505. cpuflags="-march=$cpu"
  2506. enable cmov
  2507. disable fast_cmov
  2508. ;;
  2509. esac
  2510. fi
  2511. if [ "$cpu" != generic ]; then
  2512. add_cflags $cpuflags
  2513. add_asflags $cpuflags
  2514. fi
  2515. # compiler sanity check
  2516. check_exec <<EOF
  2517. int main(void){ return 0; }
  2518. EOF
  2519. if test "$?" != 0; then
  2520. echo "$cc is unable to create an executable file."
  2521. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2522. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2523. echo "Only do this if you know what cross compiling means."
  2524. fi
  2525. die "C compiler test failed."
  2526. fi
  2527. add_cppflags -D_ISOC99_SOURCE
  2528. check_cflags -std=c99
  2529. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2530. #include <stdlib.h>
  2531. EOF
  2532. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2533. #include <stdlib.h>
  2534. EOF
  2535. check_host_cflags -std=c99
  2536. check_host_cflags -Wall
  2537. check_64bit(){
  2538. arch32=$1
  2539. arch64=$2
  2540. expr=$3
  2541. check_code cc "" "int test[2*($expr) - 1]" &&
  2542. subarch=$arch64 || subarch=$arch32
  2543. }
  2544. case "$arch" in
  2545. aarch64|alpha|ia64)
  2546. spic=$shared
  2547. ;;
  2548. mips)
  2549. check_64bit mips mips64 '_MIPS_SIM > 1'
  2550. spic=$shared
  2551. ;;
  2552. parisc)
  2553. check_64bit parisc parisc64 'sizeof(void *) > 4'
  2554. spic=$shared
  2555. ;;
  2556. ppc)
  2557. check_64bit ppc ppc64 'sizeof(void *) > 4'
  2558. spic=$shared
  2559. ;;
  2560. sparc)
  2561. check_64bit sparc sparc64 'sizeof(void *) > 4'
  2562. spic=$shared
  2563. ;;
  2564. x86)
  2565. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  2566. if test "$subarch" = "x86_64"; then
  2567. spic=$shared
  2568. fi
  2569. ;;
  2570. esac
  2571. enable $subarch
  2572. enabled spic && enable pic
  2573. # OS specific
  2574. case $target_os in
  2575. haiku)
  2576. prefix_default="/boot/common"
  2577. network_extralibs="-lnetwork"
  2578. host_libs=
  2579. ;;
  2580. sunos)
  2581. AVSERVERLDFLAGS=""
  2582. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2583. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2584. network_extralibs="-lsocket -lnsl"
  2585. add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  2586. # When using suncc to build, the Solaris linker will mark
  2587. # an executable with each instruction set encountered by
  2588. # the Solaris assembler. As our libraries contain their own
  2589. # guards for processor-specific code, instead suppress
  2590. # generation of the HWCAPS ELF section on Solaris x86 only.
  2591. enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
  2592. nm_default='nm -P -g'
  2593. ;;
  2594. netbsd)
  2595. disable symver
  2596. oss_indev_extralibs="-lossaudio"
  2597. oss_outdev_extralibs="-lossaudio"
  2598. ;;
  2599. openbsd|bitrig)
  2600. disable symver
  2601. SHFLAGS='-shared'
  2602. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  2603. SLIB_INSTALL_LINKS=
  2604. oss_indev_extralibs="-lossaudio"
  2605. oss_outdev_extralibs="-lossaudio"
  2606. ;;
  2607. dragonfly)
  2608. disable symver
  2609. ;;
  2610. freebsd)
  2611. ;;
  2612. bsd/os)
  2613. add_extralibs -lpoll -lgnugetopt
  2614. ;;
  2615. darwin)
  2616. gas="gas-preprocessor.pl $cc"
  2617. enabled ppc && add_asflags -force_cpusubtype_ALL
  2618. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  2619. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  2620. add_ldflags -Wl,-dynamic,-search_paths_first
  2621. SLIBSUF=".dylib"
  2622. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2623. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2624. AVSERVERLDFLAGS=-Wl,-bind_at_load
  2625. objformat="macho"
  2626. enabled x86_64 && objformat="macho64"
  2627. enabled_any pic shared ||
  2628. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2629. ;;
  2630. mingw32*)
  2631. if test $target_os = "mingw32ce"; then
  2632. disable network
  2633. else
  2634. target_os=mingw32
  2635. fi
  2636. LIBTARGET=i386
  2637. if enabled x86_64; then
  2638. LIBTARGET="i386:x86-64"
  2639. elif enabled arm; then
  2640. LIBTARGET=arm-wince
  2641. fi
  2642. shlibdir_default="$bindir_default"
  2643. SLIBPREF=""
  2644. SLIBSUF=".dll"
  2645. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2646. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2647. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  2648. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2649. SLIB_INSTALL_LINKS=
  2650. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  2651. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  2652. SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  2653. objformat="win32"
  2654. dlltool="${cross_prefix}dlltool"
  2655. ranlib=:
  2656. enable dos_paths
  2657. ;;
  2658. win32|win64)
  2659. if enabled shared; then
  2660. # Link to the import library instead of the normal static library
  2661. # for shared libs.
  2662. LD_LIB='%.lib'
  2663. # Cannot build shared and static libraries at the same time with
  2664. # MSVC.
  2665. disable static
  2666. fi
  2667. shlibdir_default="$bindir_default"
  2668. SLIBPREF=""
  2669. SLIBSUF=".dll"
  2670. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2671. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2672. SLIB_CREATE_DEF_CMD='makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  2673. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2674. SLIB_INSTALL_LINKS=
  2675. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  2676. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  2677. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  2678. objformat="win32"
  2679. ranlib=:
  2680. enable dos_paths
  2681. ;;
  2682. cygwin*)
  2683. target_os=cygwin
  2684. shlibdir_default="$bindir_default"
  2685. SLIBPREF="cyg"
  2686. SLIBSUF=".dll"
  2687. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2688. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2689. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2690. SLIB_INSTALL_LINKS=
  2691. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  2692. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  2693. objformat="win32"
  2694. enable dos_paths
  2695. ;;
  2696. *-dos|freedos|opendos)
  2697. network_extralibs="-lsocket"
  2698. objformat="coff"
  2699. enable dos_paths
  2700. add_cppflags -U__STRICT_ANSI__
  2701. ;;
  2702. linux)
  2703. enable dv1394
  2704. ;;
  2705. irix*)
  2706. target_os=irix
  2707. ranlib="echo ignoring ranlib"
  2708. ;;
  2709. os/2*)
  2710. ln_s="cp -f"
  2711. objformat="aout"
  2712. add_cppflags -D_GNU_SOURCE
  2713. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2714. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2715. AVSERVERLDFLAGS=""
  2716. LIBSUF="_s.a"
  2717. SLIBPREF=""
  2718. SLIBSUF=".dll"
  2719. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2720. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2721. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2722. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2723. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2724. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2725. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2726. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2727. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2728. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2729. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  2730. enable dos_paths
  2731. ;;
  2732. gnu/kfreebsd)
  2733. add_cppflags -D_BSD_SOURCE
  2734. ;;
  2735. gnu)
  2736. ;;
  2737. qnx)
  2738. add_cppflags -D_QNX_SOURCE
  2739. network_extralibs="-lsocket"
  2740. ;;
  2741. symbian)
  2742. SLIBSUF=".dll"
  2743. enable dos_paths
  2744. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  2745. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  2746. add_ldflags -Wl,--target1-abs,--no-undefined \
  2747. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  2748. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  2749. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  2750. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  2751. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  2752. ;;
  2753. osf1)
  2754. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  2755. AVSERVERLDFLAGS=
  2756. ;;
  2757. minix)
  2758. ;;
  2759. plan9)
  2760. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  2761. -D_REENTRANT_SOURCE \
  2762. -D_RESEARCH_SOURCE \
  2763. -DFD_SETSIZE=96 \
  2764. -DHAVE_SOCK_OPTS
  2765. add_compat strtod.o strtod=avpriv_strtod
  2766. network_extralibs='-lbsd'
  2767. exeobjs=compat/plan9/main.o
  2768. disable avserver
  2769. ln_s='ln -s -f'
  2770. cp_f='cp'
  2771. ;;
  2772. none)
  2773. ;;
  2774. *)
  2775. die "Unknown OS '$target_os'."
  2776. ;;
  2777. esac
  2778. # determine libc flavour
  2779. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  2780. if check_cpp_condition features.h "defined __UCLIBC__"; then
  2781. libc_type=uclibc
  2782. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2783. elif check_cpp_condition features.h "defined __GLIBC__"; then
  2784. libc_type=glibc
  2785. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2786. # MinGW headers can be installed on Cygwin, so check for newlib first.
  2787. elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  2788. libc_type=newlib
  2789. add_cppflags -U__STRICT_ANSI__
  2790. elif check_header _mingw.h; then
  2791. libc_type=mingw
  2792. check_cpp_condition _mingw.h \
  2793. "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || \
  2794. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2795. die "ERROR: MinGW runtime version must be >= 3.15."
  2796. add_cppflags -U__STRICT_ANSI__
  2797. elif check_func_headers stdlib.h _get_doserrno; then
  2798. libc_type=msvcrt
  2799. add_compat strtod.o strtod=avpriv_strtod
  2800. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  2801. _snprintf=avpriv_snprintf \
  2802. vsnprintf=avpriv_vsnprintf
  2803. elif check_cpp_condition stddef.h "defined __KLIBC__"; then
  2804. libc_type=klibc
  2805. fi
  2806. test -n "$libc_type" && enable $libc_type
  2807. # hacks for compiler/libc/os combinations
  2808. if enabled_all tms470 glibc; then
  2809. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  2810. add_cppflags -D__USER_LABEL_PREFIX__=
  2811. add_cppflags -D__builtin_memset=memset
  2812. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  2813. add_cflags -pds=48 # incompatible redefinition of macro
  2814. fi
  2815. if enabled_all ccc glibc; then
  2816. add_ldflags -Wl,-z,now # calls to libots crash without this
  2817. fi
  2818. esc(){
  2819. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  2820. }
  2821. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate
  2822. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2823. set_default $PATHS_LIST
  2824. set_default nm
  2825. # we need to build at least one lib type
  2826. if ! enabled_any static shared; then
  2827. cat <<EOF
  2828. At least one library type must be built.
  2829. Specify --enable-static to build the static libraries or --enable-shared to
  2830. build the shared libraries as well. To only build the shared libraries specify
  2831. --disable-static in addition to --enable-shared.
  2832. EOF
  2833. exit 1;
  2834. fi
  2835. die_license_disabled() {
  2836. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2837. }
  2838. die_license_disabled gpl libcdio
  2839. die_license_disabled gpl libx264
  2840. die_license_disabled gpl libxavs
  2841. die_license_disabled gpl libxvid
  2842. die_license_disabled gpl x11grab
  2843. die_license_disabled nonfree libfaac
  2844. die_license_disabled nonfree libfdk_aac
  2845. die_license_disabled nonfree openssl
  2846. die_license_disabled version3 libopencore_amrnb
  2847. die_license_disabled version3 libopencore_amrwb
  2848. die_license_disabled version3 libvo_aacenc
  2849. die_license_disabled version3 libvo_amrwbenc
  2850. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2851. disabled optimizations || check_cflags -fomit-frame-pointer
  2852. enable_pic() {
  2853. enable pic
  2854. add_cppflags -DPIC
  2855. add_cflags -fPIC
  2856. add_asflags -fPIC
  2857. }
  2858. enabled pic && enable_pic
  2859. check_cc <<EOF || die "Symbol mangling check failed."
  2860. int ff_extern;
  2861. EOF
  2862. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2863. extern_prefix=${sym%%ff_extern*}
  2864. check_cc <<EOF && enable_weak inline_asm
  2865. void foo(void) { __asm__ volatile ("" ::); }
  2866. EOF
  2867. _restrict=
  2868. for restrict_keyword in restrict __restrict__ __restrict; do
  2869. check_cc <<EOF && _restrict=$restrict_keyword && break
  2870. void foo(char * $restrict_keyword p);
  2871. EOF
  2872. done
  2873. check_cc <<EOF && enable attribute_packed
  2874. struct { int x; } __attribute__((packed)) x;
  2875. EOF
  2876. check_cc <<EOF && enable attribute_may_alias
  2877. union { int x; } __attribute__((may_alias)) x;
  2878. EOF
  2879. check_cc <<EOF || die "endian test failed"
  2880. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2881. EOF
  2882. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2883. if enabled alpha; then
  2884. check_cflags -mieee
  2885. elif enabled arm; then
  2886. check_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
  2887. enabled thumb && check_cflags -mthumb || check_cflags -marm
  2888. nogas=die
  2889. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  2890. enable vfp_args
  2891. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  2892. case "${cross_prefix:-$cc}" in
  2893. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  2894. *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  2895. __asm__ (".eabi_attribute 28, 1");
  2896. int main(void) { return 0; }
  2897. EOF
  2898. esac
  2899. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  2900. fi
  2901. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  2902. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  2903. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  2904. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  2905. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  2906. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  2907. [ $target_os = linux ] ||
  2908. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  2909. $ARCH_EXT_LIST_ARM
  2910. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  2911. check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  2912. enabled_all armv6t2 shared !pic && enable_pic
  2913. elif enabled mips; then
  2914. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  2915. elif enabled parisc; then
  2916. if enabled gcc; then
  2917. case $($cc -dumpversion) in
  2918. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  2919. esac
  2920. fi
  2921. elif enabled ppc; then
  2922. enable local_aligned_8 local_aligned_16
  2923. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  2924. check_inline_asm ibm_asm '"add 0, 0, 0"'
  2925. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  2926. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2927. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2928. if enabled altivec; then
  2929. nogas=warn
  2930. check_cflags -maltivec -mabi=altivec &&
  2931. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2932. check_cflags -faltivec
  2933. # check if our compiler supports Motorola AltiVec C API
  2934. check_cc <<EOF || disable altivec
  2935. $inc_altivec_h
  2936. int main(void) {
  2937. vector signed int v1 = (vector signed int) { 0 };
  2938. vector signed int v2 = (vector signed int) { 1 };
  2939. v1 = vec_add(v1, v2);
  2940. return 0;
  2941. }
  2942. EOF
  2943. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  2944. fi
  2945. elif enabled sparc; then
  2946. enabled vis && check_inline_asm vis '"pdist %f0, %f0, %f0"'
  2947. elif enabled x86; then
  2948. check_code ld intrin.h "__rdtsc()" && enable rdtsc
  2949. check_code ld mmintrin.h "_mm_empty()" && enable mm_empty
  2950. enable local_aligned_8 local_aligned_16
  2951. # check whether EBP is available on x86
  2952. # As 'i' is stored on the stack, this program will crash
  2953. # if the base pointer is used to access it because the
  2954. # base pointer is cleared in the inline assembly code.
  2955. check_exec_crash <<EOF && enable ebp_available
  2956. volatile int i=0;
  2957. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  2958. return i;
  2959. EOF
  2960. # check whether EBX is available on x86
  2961. check_inline_asm ebx_available '""::"b"(0)' &&
  2962. check_inline_asm ebx_available '"":::"%ebx"'
  2963. # check whether xmm clobbers are supported
  2964. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  2965. # check whether binutils is new enough to compile SSSE3/MMXEXT
  2966. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  2967. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  2968. if ! disabled_any asm mmx yasm; then
  2969. if check_cmd $yasmexe --version; then
  2970. enabled x86_64 && yasm_extra="-m amd64"
  2971. yasm_debug="-g dwarf2"
  2972. elif check_cmd nasm -v; then
  2973. yasmexe=nasm
  2974. yasm_debug="-g -F dwarf"
  2975. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  2976. fi
  2977. YASMFLAGS="-f $objformat $yasm_extra"
  2978. enabled pic && append YASMFLAGS "-DPIC"
  2979. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2980. case "$objformat" in
  2981. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  2982. esac
  2983. check_yasm "vextractf128 xmm0, ymm0, 0" && enable yasm ||
  2984. die "yasm not found, use --disable-yasm for a crippled build"
  2985. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  2986. check_yasm "CPU amdnop" && enable cpunop
  2987. fi
  2988. case "$cpu" in
  2989. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2990. disable fast_clz
  2991. ;;
  2992. esac
  2993. fi
  2994. if enabled asm; then
  2995. as=${gas:=$as}
  2996. check_as <<EOF && enable gnu_as || \
  2997. $nogas "GNU assembler not found, install gas-preprocessor"
  2998. .macro m n
  2999. \n: .int 0
  3000. .endm
  3001. m x
  3002. EOF
  3003. fi
  3004. check_ldflags -Wl,--as-needed
  3005. if check_func dlopen; then
  3006. ldl=
  3007. elif check_func dlopen -ldl; then
  3008. ldl=-ldl
  3009. fi
  3010. if ! disabled network; then
  3011. check_type "sys/types.h sys/socket.h" socklen_t
  3012. check_type netdb.h "struct addrinfo"
  3013. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3014. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3015. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3016. check_type netinet/in.h "struct sockaddr_in6"
  3017. check_type poll.h "struct pollfd"
  3018. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3019. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3020. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3021. check_func getaddrinfo $network_extralibs
  3022. check_func getservbyport $network_extralibs
  3023. # Prefer arpa/inet.h over winsock2
  3024. if check_header arpa/inet.h ; then
  3025. check_func closesocket
  3026. elif check_header winsock2.h ; then
  3027. check_func_headers winsock2.h closesocket -lws2 &&
  3028. network_extralibs="-lws2" ||
  3029. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3030. network_extralibs="-lws2_32"; }
  3031. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3032. check_type ws2tcpip.h socklen_t
  3033. check_type ws2tcpip.h "struct addrinfo"
  3034. check_type ws2tcpip.h "struct group_source_req"
  3035. check_type ws2tcpip.h "struct ip_mreq_source"
  3036. check_type ws2tcpip.h "struct ipv6_mreq"
  3037. check_type winsock2.h "struct pollfd"
  3038. check_type ws2tcpip.h "struct sockaddr_in6"
  3039. check_type ws2tcpip.h "struct sockaddr_storage"
  3040. check_struct winsock2.h "struct sockaddr" sa_len
  3041. else
  3042. disable network
  3043. fi
  3044. fi
  3045. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3046. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  3047. check_func fcntl
  3048. check_func fork
  3049. check_func gethrtime
  3050. check_func getopt
  3051. check_func getrusage
  3052. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  3053. check_func gettimeofday
  3054. check_func inet_aton $network_extralibs
  3055. check_func isatty
  3056. check_func localtime_r
  3057. check_func ${malloc_prefix}memalign && enable memalign
  3058. check_func mkstemp
  3059. check_func mmap
  3060. check_func mprotect
  3061. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3062. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3063. check_func setrlimit
  3064. check_func strerror_r
  3065. check_func strptime
  3066. check_func strtok_r
  3067. check_func sched_getaffinity
  3068. check_func sysconf
  3069. check_func sysctl
  3070. check_func usleep
  3071. check_func_headers io.h setmode
  3072. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  3073. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  3074. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  3075. check_func_headers windows.h GetProcessAffinityMask
  3076. check_func_headers windows.h GetProcessTimes
  3077. check_func_headers windows.h GetSystemTimeAsFileTime
  3078. check_func_headers windows.h MapViewOfFile
  3079. check_func_headers windows.h SetConsoleTextAttribute
  3080. check_func_headers windows.h Sleep
  3081. check_func_headers windows.h VirtualAlloc
  3082. check_header direct.h
  3083. check_header dlfcn.h
  3084. check_header dxva.h
  3085. check_header dxva2api.h
  3086. check_header io.h
  3087. check_header malloc.h
  3088. check_header poll.h
  3089. check_header sys/mman.h
  3090. check_header sys/param.h
  3091. check_header sys/resource.h
  3092. check_header sys/select.h
  3093. check_header sys/time.h
  3094. check_header unistd.h
  3095. check_header vdpau/vdpau.h
  3096. check_header vdpau/vdpau_x11.h
  3097. check_header windows.h
  3098. check_header X11/extensions/XvMClib.h
  3099. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  3100. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  3101. if ! disabled w32threads && ! enabled pthreads; then
  3102. check_func_headers "windows.h process.h" _beginthreadex && enable w32threads
  3103. fi
  3104. # check for some common methods of building with pthread support
  3105. # do this before the optional library checks as some of them require pthreads
  3106. if ! disabled pthreads && ! enabled w32threads; then
  3107. enable pthreads
  3108. if check_func pthread_create; then
  3109. :
  3110. elif check_func pthread_create -pthread; then
  3111. add_cflags -pthread
  3112. add_extralibs -pthread
  3113. elif check_func pthread_create -pthreads; then
  3114. add_cflags -pthreads
  3115. add_extralibs -pthreads
  3116. elif check_func pthread_create -lpthreadGC2; then
  3117. add_extralibs -lpthreadGC2
  3118. elif ! check_lib pthread.h pthread_create -lpthread; then
  3119. disable pthreads
  3120. fi
  3121. fi
  3122. for thread in $THREADS_LIST; do
  3123. if enabled $thread; then
  3124. test -n "$thread_type" &&
  3125. die "ERROR: Only one thread type must be selected." ||
  3126. thread_type="$thread"
  3127. fi
  3128. done
  3129. check_lib math.h sin -lm && LIBM="-lm"
  3130. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  3131. atan2f_args=2
  3132. ldexpf_args=2
  3133. powf_args=2
  3134. for func in $MATH_FUNCS; do
  3135. eval check_mathfunc $func \${${func}_args:-1}
  3136. done
  3137. # these are off by default, so fail if requested and not available
  3138. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  3139. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  3140. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  3141. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  3142. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  3143. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  3144. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  3145. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  3146. done || die "ERROR: libgsm not found"; }
  3147. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  3148. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  3149. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  3150. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  3151. enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
  3152. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  3153. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  3154. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  3155. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  3156. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  3157. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  3158. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  3159. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  3160. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  3161. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  3162. enabled libvpx && {
  3163. enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  3164. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  3165. enabled libvpx_vp8_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx ||
  3166. die "ERROR: libvpx encoder version must be >=0.9.6"; }
  3167. enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
  3168. enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx" -lvpx || disable libvpx_vp9_encoder; } }
  3169. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  3170. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  3171. die "ERROR: libx264 version must be >= 0.118."; }
  3172. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  3173. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  3174. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  3175. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  3176. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  3177. die "ERROR: openssl not found"; }
  3178. if enabled gnutls; then
  3179. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  3180. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  3181. fi
  3182. # libdc1394 check
  3183. if enabled libdc1394; then
  3184. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  3185. enable libdc1394_2; } ||
  3186. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  3187. enable libdc1394_1; } ||
  3188. die "ERROR: No version of libdc1394 found "
  3189. fi
  3190. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  3191. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3192. enable sdl &&
  3193. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  3194. fi
  3195. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  3196. check_header linux/fb.h
  3197. check_header linux/videodev2.h
  3198. check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
  3199. check_header sys/videoio.h
  3200. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  3201. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  3202. # w32api 3.12 had it defined wrong
  3203. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  3204. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  3205. { check_header dev/bktr/ioctl_meteor.h &&
  3206. check_header dev/bktr/ioctl_bt848.h; } ||
  3207. { check_header machine/ioctl_meteor.h &&
  3208. check_header machine/ioctl_bt848.h; } ||
  3209. { check_header dev/video/meteor/ioctl_meteor.h &&
  3210. check_header dev/video/bktr/ioctl_bt848.h; } ||
  3211. check_header dev/ic/bt8xx.h
  3212. check_header sndio.h
  3213. check_header sys/soundcard.h
  3214. check_header soundcard.h
  3215. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  3216. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack &&
  3217. check_func jack_port_get_latency_range -ljack
  3218. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  3219. if enabled libcdio; then
  3220. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio
  3221. fi
  3222. enabled x11grab &&
  3223. require X11 X11/Xlib.h XOpenDisplay -lX11 &&
  3224. require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
  3225. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
  3226. # check for VDA header
  3227. if ! disabled vda && check_header VideoDecodeAcceleration/VDADecoder.h; then
  3228. enable vda && add_extralibs -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore
  3229. fi
  3230. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  3231. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  3232. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." && disable vdpau; }
  3233. fi
  3234. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  3235. # add some useful compiler flags if supported
  3236. check_cflags -Wdeclaration-after-statement
  3237. check_cflags -Wall
  3238. check_cflags -Wno-parentheses
  3239. check_cflags -Wno-switch
  3240. check_cflags -Wno-format-zero-length
  3241. check_cflags -Wdisabled-optimization
  3242. check_cflags -Wpointer-arith
  3243. check_cflags -Wredundant-decls
  3244. check_cflags -Wno-pointer-sign
  3245. check_cflags -Wcast-qual
  3246. check_cflags -Wwrite-strings
  3247. check_cflags -Wtype-limits
  3248. check_cflags -Wundef
  3249. check_cflags -Wmissing-prototypes
  3250. check_cflags -Wstrict-prototypes
  3251. enabled extra_warnings && check_cflags -Winline
  3252. # add some linker flags
  3253. check_ldflags -Wl,--warn-common
  3254. check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  3255. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  3256. enabled xmm_clobber_test &&
  3257. check_ldflags -Wl,--wrap,avcodec_open2 \
  3258. -Wl,--wrap,avcodec_decode_audio4 \
  3259. -Wl,--wrap,avcodec_decode_video2 \
  3260. -Wl,--wrap,avcodec_decode_subtitle2 \
  3261. -Wl,--wrap,avcodec_encode_audio2 \
  3262. -Wl,--wrap,avcodec_encode_video \
  3263. -Wl,--wrap,avcodec_encode_subtitle \
  3264. -Wl,--wrap,sws_scale ||
  3265. disable xmm_clobber_test
  3266. echo "X{};" > $TMPV
  3267. if test_ldflags -Wl,--version-script,$TMPV; then
  3268. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  3269. check_cc <<EOF && enable symver_asm_label
  3270. void ff_foo(void) __asm__ ("av_foo@VERSION");
  3271. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  3272. EOF
  3273. check_cc <<EOF && enable symver_gnu_asm
  3274. __asm__(".symver ff_foo,av_foo@VERSION");
  3275. void ff_foo(void) {}
  3276. EOF
  3277. fi
  3278. if [ -z "$optflags" ]; then
  3279. if enabled small; then
  3280. optflags=$cflags_size
  3281. elif enabled optimizations; then
  3282. optflags=$cflags_speed
  3283. else
  3284. optflags=$cflags_noopt
  3285. fi
  3286. fi
  3287. check_optflags(){
  3288. check_cflags "$@"
  3289. enabled lto && check_ldflags "$@"
  3290. }
  3291. if enabled lto; then
  3292. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  3293. check_cflags -flto
  3294. check_ldflags -flto $cpuflags
  3295. fi
  3296. check_optflags $optflags
  3297. check_optflags -fno-math-errno
  3298. check_optflags -fno-signed-zeros
  3299. if enabled icc; then
  3300. # Just warnings, no remarks
  3301. check_cflags -w1
  3302. # -wd: Disable following warnings
  3303. # 144, 167, 556: -Wno-pointer-sign
  3304. # 1292: attribute "foo" ignored
  3305. # 1419: external declaration in primary source file
  3306. # 10006: ignoring unknown option -fno-signed-zeros
  3307. # 10148: ignoring unknown option -Wno-parentheses
  3308. # 10156: ignoring option '-W'; no argument required
  3309. check_cflags -wd144,167,556,1292,1419,10006,10148,10156
  3310. # 11030: Warning unknown option --as-needed
  3311. # 10156: ignoring option '-export'; no argument required
  3312. check_ldflags -wd10156,11030
  3313. # Allow to compile with optimizations
  3314. check_ldflags -march=$cpu
  3315. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  3316. enable ebp_available
  3317. if enabled x86_32; then
  3318. icc_version=$($cc -dumpversion)
  3319. test ${icc_version%%.*} -ge 11 &&
  3320. check_cflags -falign-stack=maintain-16-byte ||
  3321. disable aligned_stack
  3322. fi
  3323. elif enabled ccc; then
  3324. # disable some annoying warnings
  3325. add_cflags -msg_disable bitnotint
  3326. add_cflags -msg_disable mixfuncvoid
  3327. add_cflags -msg_disable nonstandcast
  3328. add_cflags -msg_disable unsupieee
  3329. elif enabled gcc; then
  3330. check_optflags -fno-tree-vectorize
  3331. check_cflags -Werror=implicit-function-declaration
  3332. check_cflags -Werror=missing-prototypes
  3333. check_cflags -Werror=return-type
  3334. check_cflags -Werror=declaration-after-statement
  3335. check_cflags -Werror=vla
  3336. elif enabled llvm_gcc; then
  3337. check_cflags -mllvm -stack-alignment=16
  3338. elif enabled clang; then
  3339. check_cflags -mllvm -stack-alignment=16
  3340. check_cflags -Qunused-arguments
  3341. check_cflags -Werror=implicit-function-declaration
  3342. check_cflags -Werror=missing-prototypes
  3343. check_cflags -Werror=return-type
  3344. elif enabled armcc; then
  3345. # 2523: use of inline assembler is deprecated
  3346. add_cflags -W${armcc_opt},--diag_suppress=2523
  3347. add_cflags -W${armcc_opt},--diag_suppress=1207
  3348. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  3349. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  3350. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  3351. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  3352. elif enabled tms470; then
  3353. add_cflags -pds=824 -pds=837
  3354. elif enabled pathscale; then
  3355. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  3356. elif enabled msvc; then
  3357. enabled x86_32 && disable aligned_stack
  3358. fi
  3359. case $target_os in
  3360. osf1)
  3361. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  3362. ;;
  3363. plan9)
  3364. add_cppflags -Dmain=plan9_main
  3365. ;;
  3366. esac
  3367. enabled_any $THREADS_LIST && enable threads
  3368. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  3369. check_deps $CONFIG_LIST \
  3370. $CONFIG_EXTRA \
  3371. $HAVE_LIST \
  3372. $ALL_COMPONENTS \
  3373. ! enabled_any memalign posix_memalign aligned_malloc &&
  3374. enabled_any $need_memalign && enable memalign_hack
  3375. echo "install prefix $prefix"
  3376. echo "source path $source_path"
  3377. echo "C compiler $cc"
  3378. echo "ARCH $arch ($cpu)"
  3379. if test "$build_suffix" != ""; then
  3380. echo "build suffix $build_suffix"
  3381. fi
  3382. if test "$extra_version" != ""; then
  3383. echo "version string suffix $extra_version"
  3384. fi
  3385. echo "big-endian ${bigendian-no}"
  3386. echo "runtime cpu detection ${runtime_cpudetect-no}"
  3387. if enabled x86; then
  3388. echo "${yasmexe} ${yasm-no}"
  3389. echo "MMX enabled ${mmx-no}"
  3390. echo "MMXEXT enabled ${mmxext-no}"
  3391. echo "3DNow! enabled ${amd3dnow-no}"
  3392. echo "3DNow! extended enabled ${amd3dnowext-no}"
  3393. echo "SSE enabled ${sse-no}"
  3394. echo "SSSE3 enabled ${ssse3-no}"
  3395. echo "AVX enabled ${avx-no}"
  3396. echo "FMA4 enabled ${fma4-no}"
  3397. echo "CMOV enabled ${cmov-no}"
  3398. echo "CMOV is fast ${fast_cmov-no}"
  3399. echo "EBX available ${ebx_available-no}"
  3400. echo "EBP available ${ebp_available-no}"
  3401. fi
  3402. if enabled arm; then
  3403. echo "ARMv5TE enabled ${armv5te-no}"
  3404. echo "ARMv6 enabled ${armv6-no}"
  3405. echo "ARMv6T2 enabled ${armv6t2-no}"
  3406. echo "VFP enabled ${vfp-no}"
  3407. echo "NEON enabled ${neon-no}"
  3408. fi
  3409. if enabled ppc; then
  3410. echo "AltiVec enabled ${altivec-no}"
  3411. echo "PPC 4xx optimizations ${ppc4xx-no}"
  3412. echo "dcbzl available ${dcbzl-no}"
  3413. fi
  3414. if enabled sparc; then
  3415. echo "VIS enabled ${vis-no}"
  3416. fi
  3417. echo "debug symbols ${debug-no}"
  3418. echo "optimize for size ${small-no}"
  3419. echo "optimizations ${optimizations-no}"
  3420. echo "static ${static-no}"
  3421. echo "shared ${shared-no}"
  3422. echo "new filter support ${avfilter-no}"
  3423. echo "network support ${network-no}"
  3424. echo "threading support ${thread_type-no}"
  3425. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  3426. echo "SDL support ${sdl-no}"
  3427. echo "libdxva2 enabled ${dxva2-no}"
  3428. echo "libva enabled ${vaapi-no}"
  3429. echo "libvdpau enabled ${vdpau-no}"
  3430. echo "AVISynth enabled ${avisynth-no}"
  3431. echo "frei0r enabled ${frei0r-no}"
  3432. echo "gnutls enabled ${gnutls-no}"
  3433. echo "libcdio support ${libcdio-no}"
  3434. echo "libdc1394 support ${libdc1394-no}"
  3435. echo "libfaac enabled ${libfaac-no}"
  3436. echo "libfdk-aac enabled ${libfdk_aac-no}"
  3437. echo "libgsm enabled ${libgsm-no}"
  3438. echo "libilbc enabled ${libilbc-no}"
  3439. echo "libmp3lame enabled ${libmp3lame-no}"
  3440. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  3441. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  3442. echo "libopencv support ${libopencv-no}"
  3443. echo "libopenjpeg enabled ${libopenjpeg-no}"
  3444. echo "libopus enabled ${libopus-no}"
  3445. echo "libpulse enabled ${libpulse-no}"
  3446. echo "librtmp enabled ${librtmp-no}"
  3447. echo "libschroedinger enabled ${libschroedinger-no}"
  3448. echo "libspeex enabled ${libspeex-no}"
  3449. echo "libtheora enabled ${libtheora-no}"
  3450. echo "libvo-aacenc support ${libvo_aacenc-no}"
  3451. echo "libvo-amrwbenc support ${libvo_amrwbenc-no}"
  3452. echo "libvorbis enabled ${libvorbis-no}"
  3453. echo "libvpx enabled ${libvpx-no}"
  3454. echo "libx264 enabled ${libx264-no}"
  3455. echo "libxavs enabled ${libxavs-no}"
  3456. echo "libxvid enabled ${libxvid-no}"
  3457. echo "openssl enabled ${openssl-no}"
  3458. echo "zlib enabled ${zlib-no}"
  3459. echo "bzlib enabled ${bzlib-no}"
  3460. test -n "$random_seed" &&
  3461. echo "random seed ${random_seed}"
  3462. echo
  3463. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  3464. echo "Enabled ${type}s:"
  3465. eval list=\$$(toupper $type)_LIST
  3466. print_enabled '_*' $list | sort | pr -r -3 -t
  3467. echo
  3468. done
  3469. license="LGPL version 2.1 or later"
  3470. if enabled nonfree; then
  3471. license="nonfree and unredistributable"
  3472. elif enabled gplv3; then
  3473. license="GPL version 3 or later"
  3474. elif enabled lgplv3; then
  3475. license="LGPL version 3 or later"
  3476. elif enabled gpl; then
  3477. license="GPL version 2 or later"
  3478. fi
  3479. echo "License: $license"
  3480. echo "Creating config.mak and config.h..."
  3481. test -e Makefile || $ln_s "$source_path/Makefile" .
  3482. config_files="$TMPH config.mak"
  3483. cat > config.mak <<EOF
  3484. # Automatically generated by configure - do not modify!
  3485. LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
  3486. prefix=$prefix
  3487. LIBDIR=\$(DESTDIR)$libdir
  3488. SHLIBDIR=\$(DESTDIR)$shlibdir
  3489. INCDIR=\$(DESTDIR)$incdir
  3490. BINDIR=\$(DESTDIR)$bindir
  3491. DATADIR=\$(DESTDIR)$datadir
  3492. MANDIR=\$(DESTDIR)$mandir
  3493. SRC_PATH=$source_path
  3494. CC_IDENT=$cc_ident
  3495. ARCH=$arch
  3496. CC=$cc
  3497. AS=$as
  3498. LD=$ld
  3499. DEPCC=$dep_cc
  3500. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  3501. DEPAS=$as
  3502. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  3503. YASM=$yasmexe
  3504. DEPYASM=$yasmexe
  3505. AR=$ar
  3506. ARFLAGS=$arflags
  3507. AR_O=$ar_o
  3508. RANLIB=$ranlib
  3509. LN_S=$ln_s
  3510. CPPFLAGS=$CPPFLAGS
  3511. CFLAGS=$CFLAGS
  3512. ASFLAGS=$ASFLAGS
  3513. AS_C=$AS_C
  3514. AS_O=$AS_O
  3515. CC_C=$CC_C
  3516. CC_E=$CC_E
  3517. CC_O=$CC_O
  3518. LD_O=$LD_O
  3519. LD_LIB=$LD_LIB
  3520. LD_PATH=$LD_PATH
  3521. DLLTOOL=$dlltool
  3522. LDFLAGS=$LDFLAGS
  3523. LDFLAGS-avserver=$AVSERVERLDFLAGS
  3524. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  3525. YASMFLAGS=$YASMFLAGS
  3526. BUILDSUF=$build_suffix
  3527. FULLNAME=$FULLNAME
  3528. LIBPREF=$LIBPREF
  3529. LIBSUF=$LIBSUF
  3530. LIBNAME=$LIBNAME
  3531. SLIBPREF=$SLIBPREF
  3532. SLIBSUF=$SLIBSUF
  3533. EXESUF=$EXESUF
  3534. EXTRA_VERSION=$extra_version
  3535. CCDEP=$CCDEP
  3536. CCDEP_FLAGS=$CCDEP_FLAGS
  3537. ASDEP=$ASDEP
  3538. ASDEP_FLAGS=$ASDEP_FLAGS
  3539. CC_DEPFLAGS=$CC_DEPFLAGS
  3540. AS_DEPFLAGS=$AS_DEPFLAGS
  3541. HOSTCC=$host_cc
  3542. HOSTLD=$host_ld
  3543. HOSTCFLAGS=$host_cflags
  3544. HOSTEXESUF=$HOSTEXESUF
  3545. HOSTLDFLAGS=$host_ldflags
  3546. HOSTLIBS=$host_libs
  3547. DEPHOSTCC=$host_cc
  3548. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  3549. HOSTCCDEP=$HOSTCCDEP
  3550. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  3551. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  3552. HOSTCC_C=$HOSTCC_C
  3553. HOSTCC_O=$HOSTCC_O
  3554. HOSTLD_O=$HOSTLD_O
  3555. TARGET_EXEC=$target_exec
  3556. TARGET_PATH=$target_path
  3557. LIBS-avplay=$sdl_libs
  3558. CFLAGS-avplay=$sdl_cflags
  3559. ZLIB=$($ldflags_filter -lz)
  3560. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  3561. EXTRALIBS=$extralibs
  3562. COMPAT_OBJS=$compat_objs
  3563. EXEOBJS=$exeobjs
  3564. INSTALL=install
  3565. LIBTARGET=${LIBTARGET}
  3566. SLIBNAME=${SLIBNAME}
  3567. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  3568. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  3569. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  3570. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  3571. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  3572. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  3573. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  3574. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  3575. SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
  3576. EOF
  3577. get_version(){
  3578. lcname=lib${1}
  3579. name=$(toupper $lcname)
  3580. file=$source_path/$lcname/version.h
  3581. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  3582. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  3583. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  3584. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  3585. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  3586. }
  3587. map 'get_version $v' $LIBRARY_LIST
  3588. cat > $TMPH <<EOF
  3589. /* Automatically generated by configure - do not modify! */
  3590. #ifndef LIBAV_CONFIG_H
  3591. #define LIBAV_CONFIG_H
  3592. #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
  3593. #define LIBAV_LICENSE "$(c_escape $license)"
  3594. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  3595. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  3596. #define restrict $_restrict
  3597. #define EXTERN_PREFIX "${extern_prefix}"
  3598. #define EXTERN_ASM ${extern_prefix}
  3599. #define SLIBSUF "$SLIBSUF"
  3600. EOF
  3601. test -n "$malloc_prefix" &&
  3602. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  3603. if enabled yasm; then
  3604. append config_files $TMPASM
  3605. printf '' >$TMPASM
  3606. fi
  3607. print_config ARCH_ "$config_files" $ARCH_LIST
  3608. print_config HAVE_ "$config_files" $HAVE_LIST
  3609. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  3610. $CONFIG_EXTRA \
  3611. $ALL_COMPONENTS \
  3612. echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
  3613. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  3614. cp_if_changed $TMPH config.h
  3615. touch .config
  3616. enabled yasm && cp_if_changed $TMPASM config.asm
  3617. cat > $TMPH <<EOF
  3618. /* Generated by ffconf */
  3619. #ifndef AVUTIL_AVCONFIG_H
  3620. #define AVUTIL_AVCONFIG_H
  3621. EOF
  3622. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  3623. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  3624. cp_if_changed $TMPH libavutil/avconfig.h
  3625. test -n "$WARNINGS" && printf "\n$WARNINGS"
  3626. # build pkg-config files
  3627. pkgconfig_generate(){
  3628. name=$1
  3629. shortname=${name#lib}${build_suffix}
  3630. comment=$2
  3631. version=$3
  3632. libs=$4
  3633. requires=$5
  3634. enabled ${name#lib} || return 0
  3635. mkdir -p $name
  3636. cat <<EOF > $name/$name.pc
  3637. prefix=$prefix
  3638. exec_prefix=\${prefix}
  3639. libdir=$libdir
  3640. includedir=$incdir
  3641. Name: $name
  3642. Description: $comment
  3643. Version: $version
  3644. Requires: $(enabled shared || echo $requires)
  3645. Requires.private: $(enabled shared && echo $requires)
  3646. Conflicts:
  3647. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3648. Libs.private: $(enabled shared && echo $libs)
  3649. Cflags: -I\${includedir}
  3650. EOF
  3651. cat <<EOF > $name/$name-uninstalled.pc
  3652. prefix=
  3653. exec_prefix=
  3654. libdir=\${pcfiledir}
  3655. includedir=${source_path}
  3656. Name: $name
  3657. Description: $comment
  3658. Version: $version
  3659. Requires: $requires
  3660. Conflicts:
  3661. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  3662. Cflags: -I\${includedir}
  3663. EOF
  3664. }
  3665. pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  3666. pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3667. pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  3668. pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  3669. pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3670. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3671. pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"