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.

5503 lines
165KB

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