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.

4670 lines
137KB

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