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.

4628 lines
137KB

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