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.

5153 lines
154KB

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