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.

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