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.

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