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.

5495 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. mmsh_protocol_select="http_protocol"
  2298. mmst_protocol_select="network"
  2299. rtmp_protocol_conflict="librtmp_protocol"
  2300. rtmp_protocol_select="tcp_protocol"
  2301. rtmp_protocol_suggest="zlib"
  2302. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  2303. rtmpe_protocol_suggest="zlib"
  2304. rtmps_protocol_conflict="librtmp_protocol"
  2305. rtmps_protocol_select="tls_protocol"
  2306. rtmps_protocol_suggest="zlib"
  2307. rtmpt_protocol_select="ffrtmphttp_protocol"
  2308. rtmpt_protocol_suggest="zlib"
  2309. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  2310. rtmpte_protocol_suggest="zlib"
  2311. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  2312. rtmpts_protocol_suggest="zlib"
  2313. rtp_protocol_select="udp_protocol"
  2314. sctp_protocol_deps="struct_sctp_event_subscribe"
  2315. sctp_protocol_select="network"
  2316. srtp_protocol_select="rtp_protocol srtp"
  2317. tcp_protocol_select="network"
  2318. tls_protocol_deps_any="gnutls openssl"
  2319. tls_protocol_select="tcp_protocol"
  2320. udp_protocol_select="network"
  2321. unix_protocol_deps="sys_un_h"
  2322. unix_protocol_select="network"
  2323. # external library protocols
  2324. librtmp_protocol_deps="librtmp"
  2325. librtmpe_protocol_deps="librtmp"
  2326. librtmps_protocol_deps="librtmp"
  2327. librtmpt_protocol_deps="librtmp"
  2328. librtmpte_protocol_deps="librtmp"
  2329. libsrt_protocol_deps="libsrt"
  2330. libsrt_protocol_select="network"
  2331. # filters
  2332. asyncts_filter_deps="avresample"
  2333. blackframe_filter_deps="gpl"
  2334. boxblur_filter_deps="gpl"
  2335. bs2b_filter_deps="libbs2b"
  2336. cropdetect_filter_deps="gpl"
  2337. deinterlace_qsv_filter_deps="libmfx"
  2338. deinterlace_vaapi_filter_deps="vaapi"
  2339. delogo_filter_deps="gpl"
  2340. drawtext_filter_deps="libfreetype"
  2341. drawtext_filter_suggest="libfontconfig"
  2342. frei0r_filter_deps="frei0r libdl"
  2343. frei0r_src_filter_deps="frei0r libdl"
  2344. hdcd_filter_deps="libhdcd"
  2345. hqdn3d_filter_deps="gpl"
  2346. interlace_filter_deps="gpl"
  2347. movie_filter_deps="avcodec avformat"
  2348. ocv_filter_deps="libopencv"
  2349. overlay_qsv_filter_deps="libmfx"
  2350. overlay_qsv_filter_select="qsvvpp"
  2351. resample_filter_deps="avresample"
  2352. scale_filter_deps="swscale"
  2353. scale_qsv_filter_deps="libmfx"
  2354. scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
  2355. vpp_qsv_filter_deps="libmfx"
  2356. vpp_qsv_filter_select="qsvvpp"
  2357. # examples
  2358. decode_audio_example_deps="avcodec avutil"
  2359. decode_video_example_deps="avcodec avutil"
  2360. encode_audio_example_deps="avcodec avutil"
  2361. encode_video_example_deps="avcodec avutil"
  2362. filter_audio_example_deps="avfilter avutil"
  2363. metadata_example_deps="avformat avutil"
  2364. output_example_deps="avcodec avformat avresample avutil swscale"
  2365. qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
  2366. transcode_aac_example_deps="avcodec avformat avresample"
  2367. # EXTRALIBS_LIST
  2368. cpu_init_extralibs="pthreads_extralibs"
  2369. cws2fws_extralibs="zlib_extralibs"
  2370. # libraries, in linking order
  2371. avcodec_deps="avutil"
  2372. avcodec_select="null_bsf"
  2373. avdevice_deps="avformat avcodec avutil"
  2374. avfilter_deps="avutil"
  2375. avformat_deps="avcodec avutil"
  2376. avformat_suggest="network"
  2377. avresample_deps="avutil"
  2378. swscale_deps="avutil"
  2379. avcodec_extralibs="pthreads_extralibs libm_extralibs"
  2380. avdevice_extralibs="libm_extralibs"
  2381. avformat_extralibs="libm_extralibs"
  2382. avfilter_extralibs="pthreads_extralibs libm_extralibs"
  2383. avresample_extralibs="libm_extralibs"
  2384. 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"
  2385. swscale_extralibs="libm_extralibs"
  2386. # programs
  2387. avconv_deps="avcodec avfilter avformat avresample swscale"
  2388. avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter
  2389. fps_filter null_filter resample_filter scale_filter
  2390. trim_filter"
  2391. avconv_suggest="psapi shell32"
  2392. avplay_deps="avcodec avfilter avformat avresample sdl"
  2393. avplay_select="rdft format_filter transpose_filter hflip_filter vflip_filter"
  2394. avplay_suggest="shell32"
  2395. avprobe_deps="avcodec avformat"
  2396. avprobe_suggest="shell32"
  2397. # documentation
  2398. pod2man_deps="doc"
  2399. texi2html_deps="doc"
  2400. # default parameters
  2401. logfile="avbuild/config.log"
  2402. # installation paths
  2403. prefix_default="/usr/local"
  2404. bindir_default='${prefix}/bin'
  2405. datadir_default='${prefix}/share/avconv'
  2406. docdir_default='${prefix}/share/doc/libav'
  2407. incdir_default='${prefix}/include'
  2408. libdir_default='${prefix}/lib'
  2409. mandir_default='${prefix}/share/man'
  2410. shlibdir_default="$libdir_default"
  2411. # toolchain
  2412. ar_default="ar"
  2413. cc_default="gcc"
  2414. host_cc_default="gcc"
  2415. x86asmexe_default="nasm"
  2416. ln_s="ln -s -f"
  2417. nm_default="nm -g"
  2418. pkg_config_default=pkg-config
  2419. ranlib="ranlib"
  2420. strip="strip"
  2421. version_script='--version-script'
  2422. objformat="elf32"
  2423. # machine
  2424. arch_default=$(uname -m)
  2425. cpu="generic"
  2426. intrinsics="none"
  2427. # OS
  2428. target_os_default=$(tolower $(uname -s))
  2429. host_os=$target_os_default
  2430. # configurable options
  2431. enable $EXAMPLE_LIST $LIBRARY_LIST $PROGRAM_LIST
  2432. enable asm
  2433. enable debug
  2434. enable doc
  2435. enable faan faandct faanidct
  2436. enable optimizations
  2437. enable safe_bitstream_reader
  2438. enable static
  2439. enable swscale_alpha
  2440. enable valgrind_backtrace
  2441. # By default, enable only those hwaccels that have no external dependencies.
  2442. enable d3d11va dxva2 vda vdpau
  2443. # internal components are enabled by default
  2444. enable $EXTRALIBS_LIST
  2445. # Avoid external, non-system, libraries getting enabled by dependency resolution
  2446. disable $EXTERNAL_LIBRARY_LIST
  2447. # build settings
  2448. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  2449. LIBPREF="lib"
  2450. LIBSUF=".a"
  2451. LIBNAME='$(LIBPREF)$(NAME)$(LIBSUF)'
  2452. SLIBPREF="lib"
  2453. SLIBSUF=".so"
  2454. SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
  2455. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  2456. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  2457. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  2458. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  2459. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  2460. VERSION_SCRIPT_POSTPROCESS_CMD="cat"
  2461. asflags_filter=echo
  2462. cflags_filter=echo
  2463. ldflags_filter=echo
  2464. AS_C='-c'
  2465. AS_O='-o $@'
  2466. CC_C='-c'
  2467. CC_E='-E -o $@'
  2468. CC_O='-o $@'
  2469. OBJCC_C='-c'
  2470. OBJCC_E='-E -o $@'
  2471. OBJCC_O='-o $@'
  2472. X86ASM_O='-o $@'
  2473. LD_O='-o $@'
  2474. LD_LIB='-l%'
  2475. LD_PATH='-L'
  2476. HOSTCC_C='-c'
  2477. HOSTCC_E='-E -o $@'
  2478. HOSTCC_O='-o $@'
  2479. HOSTLD_O='-o $@'
  2480. host_extralibs='-lm'
  2481. host_cflags_filter=echo
  2482. host_ldflags_filter=echo
  2483. target_path='$(CURDIR)'
  2484. # since the object filename is not given with the -MM flag, the compiler
  2485. # is only able to print the basename, and we must add the path ourselves
  2486. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  2487. DEPFLAGS='-MM'
  2488. mkdir -p avbuild
  2489. # find source path
  2490. if test -f configure; then
  2491. source_path=.
  2492. else
  2493. source_path=$(cd $(dirname "$0"); pwd)
  2494. echo "$source_path" | grep -q '[[:blank:]]' &&
  2495. die "Out of tree builds are impossible with whitespace in source path."
  2496. test -e "$source_path/config.h" &&
  2497. die "Out of tree builds are impossible with config.h in source dir."
  2498. fi
  2499. for v in "$@"; do
  2500. r=${v#*=}
  2501. l=${v%"$r"}
  2502. r=$(sh_quote "$r")
  2503. LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
  2504. done
  2505. find_things(){
  2506. thing=$1
  2507. pattern=$2
  2508. file=$source_path/$3
  2509. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  2510. }
  2511. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  2512. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  2513. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  2514. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  2515. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  2516. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  2517. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  2518. find_things_extern(){
  2519. thing=$1
  2520. pattern=$2
  2521. file=$source_path/$3
  2522. sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file"
  2523. }
  2524. BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
  2525. HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h)
  2526. PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
  2527. AVCODEC_COMPONENTS_LIST="
  2528. $BSF_LIST
  2529. $DECODER_LIST
  2530. $ENCODER_LIST
  2531. $HWACCEL_LIST
  2532. $PARSER_LIST
  2533. "
  2534. AVDEVICE_COMPONENTS_LIST="
  2535. $INDEV_LIST
  2536. "
  2537. AVFILTER_COMPONENTS_LIST="
  2538. $FILTER_LIST
  2539. "
  2540. AVFORMAT_COMPONENTS_LIST="
  2541. $DEMUXER_LIST
  2542. $MUXER_LIST
  2543. $PROTOCOL_LIST
  2544. "
  2545. ALL_COMPONENTS="
  2546. $AVCODEC_COMPONENTS_LIST
  2547. $AVDEVICE_COMPONENTS_LIST
  2548. $AVFILTER_COMPONENTS_LIST
  2549. $AVFORMAT_COMPONENTS_LIST
  2550. "
  2551. for n in $COMPONENT_LIST; do
  2552. v=$(toupper ${n%s})_LIST
  2553. eval enable \$$v
  2554. eval ${n}_if_any="\$$v"
  2555. done
  2556. enable $ARCH_EXT_LIST
  2557. die_unknown(){
  2558. echo "Unknown option \"$1\"."
  2559. echo "See $0 --help for available options."
  2560. exit 1
  2561. }
  2562. print_3_columns() {
  2563. printf "%-25s %-25s %-25s\n" $(cat | tr ' ' '\n' | sort)
  2564. }
  2565. show_list() {
  2566. suffix=_$1
  2567. shift
  2568. echo $* | sed s/$suffix//g | print_3_columns
  2569. exit 0
  2570. }
  2571. for opt do
  2572. optval="${opt#*=}"
  2573. case "$opt" in
  2574. --extra-ldflags=*)
  2575. add_ldflags $optval
  2576. ;;
  2577. --extra-ldexeflags=*)
  2578. add_ldexeflags $optval
  2579. ;;
  2580. --extra-ldsoflags=*)
  2581. add_ldsoflags $optval
  2582. ;;
  2583. --extra-libs=*)
  2584. add_extralibs $optval
  2585. ;;
  2586. --disable-devices)
  2587. disable $INDEV_LIST
  2588. ;;
  2589. --enable-debug=*)
  2590. debuglevel="$optval"
  2591. ;;
  2592. --disable-programs)
  2593. disable $PROGRAM_LIST
  2594. ;;
  2595. --disable-everything)
  2596. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2597. ;;
  2598. --disable-all)
  2599. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2600. disable $LIBRARY_LIST $PROGRAM_LIST doc
  2601. ;;
  2602. --enable-*=*|--disable-*=*)
  2603. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  2604. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  2605. eval list=\$$(toupper $thing)_LIST
  2606. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  2607. $action $(filter "$name" $list)
  2608. ;;
  2609. --enable-yasm|--disable-yasm)
  2610. warn "The ${opt} option is only provided for compatibility and will be\n"\
  2611. "removed in the future. Use --enable-x86asm / --disable-x86asm instead."
  2612. test $opt = --enable-yasm && x86asm=yes || x86asm=no
  2613. ;;
  2614. --enable-?*|--disable-?*)
  2615. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  2616. if is_in $option $COMPONENT_LIST; then
  2617. test $action = disable && action=unset
  2618. eval $action \$$(toupper ${option%s})_LIST
  2619. elif is_in $option $CMDLINE_SELECT; then
  2620. $action $option
  2621. else
  2622. die_unknown $opt
  2623. fi
  2624. ;;
  2625. --list-*)
  2626. NAME="${opt#--list-}"
  2627. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  2628. NAME=${NAME%s}
  2629. eval show_list $NAME \$$(toupper $NAME)_LIST
  2630. ;;
  2631. --help|-h) show_help
  2632. ;;
  2633. --quiet|-q) quiet=yes
  2634. ;;
  2635. *)
  2636. optname="${opt%%=*}"
  2637. optname="${optname#--}"
  2638. optname=$(echo "$optname" | sed 's/-/_/g')
  2639. if is_in $optname $CMDLINE_SET; then
  2640. eval $optname='$optval'
  2641. elif is_in $optname $CMDLINE_APPEND; then
  2642. append $optname "$optval"
  2643. else
  2644. die_unknown $opt
  2645. fi
  2646. ;;
  2647. esac
  2648. done
  2649. for e in $env; do
  2650. eval "export $e"
  2651. done
  2652. disabled logging && logfile=/dev/null
  2653. # command line configuration sanity checks
  2654. # we need to build at least one lib type
  2655. if ! enabled_any static shared; then
  2656. cat <<EOF
  2657. At least one library type must be built.
  2658. Specify --enable-static to build the static libraries or --enable-shared to
  2659. build the shared libraries as well. To only build the shared libraries specify
  2660. --disable-static in addition to --enable-shared.
  2661. EOF
  2662. exit 1
  2663. fi
  2664. # Die early if licensing-related configure options are incompatible.
  2665. die_license_disabled() {
  2666. enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; }
  2667. }
  2668. map "die_license_disabled gpl" $EXTERNAL_LIBRARY_GPL_LIST
  2669. map "die_license_disabled nonfree" $EXTERNAL_LIBRARY_NONFREE_LIST $HWACCEL_LIBRARY_NONFREE_LIST
  2670. map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST
  2671. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2672. if enabled nonfree; then
  2673. license="nonfree and unredistributable"
  2674. elif enabled gplv3; then
  2675. license="GPL version 3 or later"
  2676. elif enabled lgplv3; then
  2677. license="LGPL version 3 or later"
  2678. elif enabled gpl; then
  2679. license="GPL version 2 or later"
  2680. else
  2681. license="LGPL version 2.1 or later"
  2682. fi
  2683. enabled_all gnutls openssl &&
  2684. die "GnuTLS and OpenSSL must not be enabled at the same time."
  2685. # Disable all the library-specific components if the library itself
  2686. # is disabled, see AVCODEC_LIST and following _LIST variables.
  2687. disable_components(){
  2688. disabled ${1} && disable $(
  2689. eval components="\$$(toupper ${1})_COMPONENTS"
  2690. map 'eval echo \${$(toupper ${v%s})_LIST}' $components
  2691. )
  2692. }
  2693. map 'disable_components $v' $LIBRARY_LIST
  2694. echo "# $0 $LIBAV_CONFIGURATION" > $logfile
  2695. set >> $logfile
  2696. case "$toolchain" in
  2697. *-asan)
  2698. cc_default="${toolchain%-asan}"
  2699. add_cflags -fsanitize=address
  2700. add_ldflags -fsanitize=address
  2701. ;;
  2702. *-msan)
  2703. cc_default="${toolchain%-msan}"
  2704. add_cflags -fsanitize=memory -fsanitize-memory-track-origins
  2705. add_ldflags -fsanitize=memory
  2706. ;;
  2707. *-tsan)
  2708. cc_default="${toolchain%-tsan}"
  2709. add_cflags -fsanitize=thread -fPIE
  2710. add_ldflags -fsanitize=thread -pie
  2711. case "$toolchain" in
  2712. gcc-tsan)
  2713. add_cflags -fPIC
  2714. add_ldflags -fPIC
  2715. ;;
  2716. esac
  2717. ;;
  2718. *-usan)
  2719. cc_default="${toolchain%-usan}"
  2720. add_cflags -fsanitize=undefined
  2721. add_ldflags -fsanitize=undefined
  2722. case "$toolchain" in
  2723. clang-usan)
  2724. add_cflags -O1
  2725. ;;
  2726. esac
  2727. ;;
  2728. valgrind-*)
  2729. target_exec_default="valgrind"
  2730. case "$toolchain" in
  2731. valgrind-massif)
  2732. target_exec_args="--alloc-fn=av_malloc --alloc-fn=av_mallocz"
  2733. ;;
  2734. valgrind-memcheck)
  2735. target_exec_args="--track-origins=yes --leak-check=full"
  2736. ;;
  2737. esac
  2738. ;;
  2739. msvc)
  2740. # Check whether the current MSVC version needs the C99 converter.
  2741. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  2742. # support enough of C99 to build libav. Default to the new
  2743. # behaviour if the regexp was unable to match anything, since this
  2744. # successfully parses the version number of existing supported
  2745. # versions that require the converter (MSVC 2010 and 2012).
  2746. cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  2747. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  2748. cc_default="cl"
  2749. else
  2750. cc_default="c99wrap cl"
  2751. fi
  2752. ld_default="$source_path/compat/windows/mslink"
  2753. nm_default="dumpbin -symbols"
  2754. ar_default="lib"
  2755. case "$arch" in
  2756. aarch64|arm64)
  2757. as_default="armasm64"
  2758. ;;
  2759. arm*)
  2760. as_default="armasm"
  2761. ;;
  2762. esac
  2763. target_os_default="win32"
  2764. # Use a relative path for TMPDIR. This makes sure all the
  2765. # ffconf temp files are written with a relative path, avoiding
  2766. # issues with msys/win32 path conversion for MSVC parameters
  2767. # such as -Fo<file> or -out:<file>.
  2768. TMPDIR=.
  2769. ;;
  2770. icl)
  2771. cc_default="icl"
  2772. ld_default="xilink"
  2773. nm_default="dumpbin -symbols"
  2774. ar_default="xilib"
  2775. target_os_default="win32"
  2776. TMPDIR=.
  2777. ;;
  2778. gcov)
  2779. add_cflags -fprofile-arcs -ftest-coverage
  2780. add_ldflags -fprofile-arcs -ftest-coverage
  2781. ;;
  2782. llvm-cov)
  2783. add_cflags -fprofile-arcs -ftest-coverage
  2784. add_ldflags --coverage
  2785. ;;
  2786. hardened)
  2787. add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
  2788. add_cflags -fno-strict-overflow -fstack-protector-all
  2789. add_ldflags -Wl,-z,relro -Wl,-z,now
  2790. ;;
  2791. ?*)
  2792. die "Unknown toolchain $toolchain"
  2793. ;;
  2794. esac
  2795. if test -n "$cross_prefix"; then
  2796. test -n "$arch" && test -n "$target_os" ||
  2797. die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling"
  2798. enable cross_compile
  2799. fi
  2800. ar_default="${cross_prefix}${ar_default}"
  2801. cc_default="${cross_prefix}${cc_default}"
  2802. objcc_default="${cross_prefix}${objcc_default}"
  2803. x86asmexe_default="${cross_prefix}${x86asmexe_default}"
  2804. nm_default="${cross_prefix}${nm_default}"
  2805. pkg_config_default="${cross_prefix}${pkg_config_default}"
  2806. ranlib="${cross_prefix}${ranlib}"
  2807. strip="${cross_prefix}${strip}"
  2808. sysinclude_default="${sysroot}/usr/include"
  2809. set_default arch cc pkg_config sysinclude target_exec target_os x86asmexe
  2810. enabled cross_compile || host_cc_default=$cc
  2811. set_default host_cc
  2812. if ! $pkg_config --version >/dev/null 2>&1; then
  2813. warn "$pkg_config not found, library detection may fail."
  2814. pkg_config=false
  2815. fi
  2816. exesuf() {
  2817. case $1 in
  2818. mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2819. esac
  2820. }
  2821. EXESUF=$(exesuf $target_os)
  2822. HOSTEXESUF=$(exesuf $host_os)
  2823. # set temporary file name
  2824. : ${TMPDIR:=$TEMPDIR}
  2825. : ${TMPDIR:=$TMP}
  2826. : ${TMPDIR:=/tmp}
  2827. if ! test_cmd mktemp -u XXXXXX; then
  2828. # simple replacement for missing mktemp
  2829. # NOT SAFE FOR GENERAL USE
  2830. mktemp(){
  2831. tmpname="${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2832. echo "$tmpname"
  2833. mkdir "$tmpname"
  2834. }
  2835. fi
  2836. AVTMPDIR=$(mktemp -d "${TMPDIR}/avconf.XXXXXXXX" 2> /dev/null) ||
  2837. die "Unable to create temporary directory in $TMPDIR."
  2838. tmpfile(){
  2839. tmp="${AVTMPDIR}/test"$2
  2840. (set -C; exec > $tmp) 2> /dev/null ||
  2841. die "Unable to create temporary file in $AVTMPDIR."
  2842. eval $1=$tmp
  2843. }
  2844. trap 'rm -rf -- "$AVTMPDIR"' EXIT
  2845. trap 'exit 2' INT
  2846. tmpfile TMPASM .asm
  2847. tmpfile TMPC .c
  2848. tmpfile TMPE $EXESUF
  2849. tmpfile TMPH .h
  2850. tmpfile TMPO .o
  2851. tmpfile TMPS .S
  2852. tmpfile TMPSH .sh
  2853. tmpfile TMPV .ver
  2854. unset -f mktemp
  2855. chmod +x $TMPE
  2856. # make sure we can execute files in $TMPDIR
  2857. cat > $TMPSH 2>> $logfile <<EOF
  2858. #! /bin/sh
  2859. EOF
  2860. chmod +x $TMPSH >> $logfile 2>&1
  2861. if ! $TMPSH >> $logfile 2>&1; then
  2862. cat <<EOF
  2863. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2864. variable to another directory and make sure that it is not mounted noexec.
  2865. EOF
  2866. die "Sanity test failed."
  2867. fi
  2868. armasm_flags(){
  2869. for flag; do
  2870. case $flag in
  2871. # Filter out MSVC cl.exe options from cflags that shouldn't
  2872. # be passed to gas-preprocessor
  2873. -M[TD]*) ;;
  2874. *) echo $flag ;;
  2875. esac
  2876. done
  2877. }
  2878. cparser_flags(){
  2879. for flag; do
  2880. case $flag in
  2881. -Wno-switch) echo -Wno-switch-enum ;;
  2882. -Wno-format-zero-length) ;;
  2883. -Wdisabled-optimization) ;;
  2884. -Wno-pointer-sign) echo -Wno-other ;;
  2885. *) echo $flag ;;
  2886. esac
  2887. done
  2888. }
  2889. msvc_common_flags(){
  2890. for flag; do
  2891. case $flag in
  2892. # In addition to specifying certain flags under the compiler
  2893. # specific filters, they must be specified here as well or else the
  2894. # generic catch all at the bottom will print the original flag.
  2895. -Wall) ;;
  2896. -Wextra) ;;
  2897. -std=c99) ;;
  2898. # Common flags
  2899. -fomit-frame-pointer) ;;
  2900. -g) echo -Z7 ;;
  2901. -fno-math-errno) ;;
  2902. -fno-common) ;;
  2903. -fno-signed-zeros) ;;
  2904. -fPIC) ;;
  2905. -mthumb) ;;
  2906. -march=*) ;;
  2907. -lz) echo zlib.lib ;;
  2908. -lx264) echo libx264.lib ;;
  2909. -l*) echo ${flag#-l}.lib ;;
  2910. -L*) echo -libpath:${flag#-L} ;;
  2911. *) echo $flag ;;
  2912. esac
  2913. done
  2914. }
  2915. msvc_flags(){
  2916. msvc_common_flags "$@"
  2917. for flag; do
  2918. case $flag in
  2919. -Wall) echo -W3 -wd4018 -wd4146 -wd4244 -wd4305 \
  2920. -wd4554 ;;
  2921. -Wextra) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2922. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2923. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2924. -wd4273 -wd4554 -wd4701 -wd4703 ;;
  2925. esac
  2926. done
  2927. }
  2928. icl_flags(){
  2929. msvc_common_flags "$@"
  2930. for flag; do
  2931. case $flag in
  2932. # Despite what Intel's documentation says -Wall, which is supported
  2933. # on Windows, does enable remarks so disable them here.
  2934. -Wall) echo $flag -Qdiag-disable:remark ;;
  2935. -std=c99) echo -Qstd=c99 ;;
  2936. esac
  2937. done
  2938. }
  2939. suncc_flags(){
  2940. for flag; do
  2941. case $flag in
  2942. -march=*|-mcpu=*)
  2943. case "${flag#*=}" in
  2944. native) echo -xtarget=native ;;
  2945. v9|niagara) echo -xarch=sparc ;;
  2946. ultrasparc) echo -xarch=sparcvis ;;
  2947. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2948. i586|pentium) echo -xchip=pentium ;;
  2949. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2950. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2951. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2952. pentium4*) echo -xtarget=pentium4 ;;
  2953. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2954. *-sse3) echo -xarch=sse3 ;;
  2955. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2956. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2957. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2958. amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
  2959. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2960. k8|opteron|athlon64|athlon-fx)
  2961. echo -xarch=sse2a ;;
  2962. athlon*) echo -xarch=pentium_proa ;;
  2963. esac
  2964. ;;
  2965. -std=c99) echo -xc99 ;;
  2966. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2967. -fPIC) echo -KPIC -xcode=pic32 ;;
  2968. -W*,*) echo $flag ;;
  2969. -f*-*|-W*|-mimpure-text) ;;
  2970. -shared) echo -G ;;
  2971. *) echo $flag ;;
  2972. esac
  2973. done
  2974. }
  2975. probe_cc(){
  2976. pfx=$1
  2977. _cc=$2
  2978. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2979. unset _ld_o _ldflags _ld_lib _ld_path
  2980. unset _depflags _DEPCMD _DEPFLAGS
  2981. _flags_filter=echo
  2982. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2983. _type=llvm_gcc
  2984. gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
  2985. _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
  2986. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2987. _cflags_speed='-O3'
  2988. _cflags_size='-Os'
  2989. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2990. _type=gcc
  2991. gcc_version=$($_cc --version | head -n1)
  2992. gcc_basever=$($_cc -dumpversion)
  2993. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2994. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2995. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2996. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2997. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2998. fi
  2999. _cflags_speed='-O3'
  3000. _cflags_size='-Os'
  3001. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  3002. _type=icc
  3003. _ident=$($_cc --version | head -n1)
  3004. _depflags='-MMD'
  3005. _cflags_speed='-O3'
  3006. _cflags_size='-Os'
  3007. _cflags_noopt='-O1'
  3008. elif $_cc -v 2>&1 | grep -q xlc; then
  3009. _type=xlc
  3010. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  3011. _cflags_speed='-O5'
  3012. _cflags_size='-O5 -qcompact'
  3013. elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
  3014. test -d "$sysroot" || die "No valid sysroot specified."
  3015. _type=armcc
  3016. _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
  3017. armcc_conf="$PWD/armcc.conf"
  3018. $_cc --arm_linux_configure \
  3019. --arm_linux_config_file="$armcc_conf" \
  3020. --configure_sysroot="$sysroot" \
  3021. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  3022. die "Error creating armcc configuration file."
  3023. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  3024. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  3025. as_default="${cross_prefix}gcc"
  3026. _depflags='-MMD'
  3027. _cflags_speed='-O3'
  3028. _cflags_size='-Os'
  3029. elif $_cc -v 2>&1 | grep -q clang; then
  3030. _type=clang
  3031. _ident=$($_cc --version 2>/dev/null | head -n1)
  3032. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3033. _cflags_speed='-O3'
  3034. _cflags_size='-Os'
  3035. elif $_cc -V 2>&1 | grep -q Sun; then
  3036. _type=suncc
  3037. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  3038. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  3039. _DEPFLAGS='-xM1 -xc99'
  3040. _ldflags='-std=c99'
  3041. _cflags_speed='-O5'
  3042. _cflags_size='-O5 -xspace'
  3043. _flags_filter=suncc_flags
  3044. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  3045. _type=pathscale
  3046. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  3047. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3048. _cflags_speed='-O2'
  3049. _cflags_size='-Os'
  3050. _flags_filter='filter_out -Wdisabled-optimization'
  3051. elif $_cc -v 2>&1 | grep -q Open64; then
  3052. _type=open64
  3053. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  3054. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3055. _cflags_speed='-O2'
  3056. _cflags_size='-Os'
  3057. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  3058. elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
  3059. _type=armasm
  3060. _ident=$($_cc | head -n1)
  3061. # 4509: "This form of conditional instruction is deprecated"
  3062. _flags="-nologo -ignore 4509"
  3063. _flags_filter=armasm_flags
  3064. elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
  3065. _type=msvc
  3066. _ident=$($_cc 2>&1 | head -n1)
  3067. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  3068. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  3069. _cflags_speed="-O2"
  3070. _cflags_size="-O1"
  3071. _cflags_noopt="-O1"
  3072. if $_cc -nologo- 2>&1 | grep -q Linker; then
  3073. _ld_o='-out:$@'
  3074. else
  3075. _ld_o='-Fe$@'
  3076. fi
  3077. _cc_o='-Fo$@'
  3078. _cc_e='-P -Fi$@'
  3079. _flags_filter=msvc_flags
  3080. _ld_lib='lib%.a'
  3081. _ld_path='-libpath:'
  3082. _flags='-nologo'
  3083. elif $_cc 2>&1 | grep -q Intel; then
  3084. _type=icl
  3085. _ident=$($_cc 2>&1 | head -n1)
  3086. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  3087. # Not only is O3 broken on 13.x+ but it is slower on all previous
  3088. # versions (tested) as well.
  3089. _cflags_speed="-O2"
  3090. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  3091. if $_cc 2>&1 | grep -q Linker; then
  3092. _ld_o='-out:$@'
  3093. else
  3094. _ld_o='-Fe$@'
  3095. fi
  3096. _cc_o='-Fo$@'
  3097. _cc_e='-P'
  3098. _flags_filter=icl_flags
  3099. _ld_lib='lib%.a'
  3100. _ld_path='-libpath:'
  3101. # -Qdiag-error to make icl error when seeing certain unknown arguments
  3102. _flags='-nologo -Qdiag-error:4044,10157'
  3103. # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
  3104. # with MSVC which enables it by default.
  3105. _cflags='-Qms0 -Qvec- -Qsimd- -GS'
  3106. elif $_cc -? 2>/dev/null | grep -q 'LLVM.*Linker'; then
  3107. # lld can emulate multiple different linkers; in ms link.exe mode,
  3108. # the -? parameter gives the help output which contains an identifyable
  3109. # string, while it gives an error in other modes.
  3110. _type=lld-link
  3111. # The link.exe mode doesn't have a switch for getting the version,
  3112. # but we can force it back to gnu mode and get the version from there.
  3113. _ident=$($_cc -flavor gnu --version 2>/dev/null)
  3114. _ld_o='-out:$@'
  3115. _flags_filter=msvc_flags
  3116. _ld_lib='lib%.a'
  3117. _ld_path='-libpath:'
  3118. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  3119. _type=cparser
  3120. _ident=$($_cc --version | head -n1)
  3121. _depflags='-MMD'
  3122. _cflags_speed='-O4'
  3123. _cflags_size='-O2'
  3124. _flags_filter=cparser_flags
  3125. fi
  3126. eval ${pfx}_type=\$_type
  3127. eval ${pfx}_ident=\$_ident
  3128. }
  3129. set_ccvars(){
  3130. eval ${1}_C=\${_cc_c-\${${1}_C}}
  3131. eval ${1}_E=\${_cc_e-\${${1}_E}}
  3132. eval ${1}_O=\${_cc_o-\${${1}_O}}
  3133. if [ -n "$_depflags" ]; then
  3134. eval ${1}_DEPFLAGS=\$_depflags
  3135. else
  3136. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  3137. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  3138. eval DEP${1}FLAGS=\$_flags
  3139. fi
  3140. }
  3141. probe_cc cc "$cc"
  3142. cflags_filter=$_flags_filter
  3143. cflags_speed=$_cflags_speed
  3144. cflags_size=$_cflags_size
  3145. cflags_noopt=$_cflags_noopt
  3146. add_cflags $_flags $_cflags
  3147. cc_ldflags=$_ldflags
  3148. set_ccvars CC
  3149. probe_cc hostcc "$host_cc"
  3150. host_cflags_filter=$_flags_filter
  3151. host_cflags_speed=$_cflags_speed
  3152. add_host_cflags $_flags $_cflags
  3153. set_ccvars HOSTCC
  3154. test -n "$cc_type" && enable $cc_type ||
  3155. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  3156. : ${as_default:=$cc}
  3157. : ${objcc_default:=$cc}
  3158. : ${dep_cc_default:=$cc}
  3159. : ${ld_default:=$cc}
  3160. : ${host_ld_default:=$host_cc}
  3161. set_default ar as objcc dep_cc ld host_ld
  3162. probe_cc as "$as"
  3163. asflags_filter=$_flags_filter
  3164. add_asflags $_flags $_cflags
  3165. set_ccvars AS
  3166. probe_cc objcc "$objcc"
  3167. objcflags_filter=$_flags_filter
  3168. add_objcflags $_flags $_cflags
  3169. set_ccvars OBJC
  3170. probe_cc ld "$ld"
  3171. ldflags_filter=$_flags_filter
  3172. add_ldflags $_flags $_ldflags
  3173. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  3174. LD_O=${_ld_o-$LD_O}
  3175. LD_LIB=${_ld_lib-$LD_LIB}
  3176. LD_PATH=${_ld_path-$LD_PATH}
  3177. probe_cc hostld "$host_ld"
  3178. host_ldflags_filter=$_flags_filter
  3179. add_host_ldflags $_flags $_ldflags
  3180. HOSTLD_O=${_ld_o-$HOSTLD_O}
  3181. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  3182. probe_cc depcc "$dep_cc"
  3183. CCDEP=${_DEPCMD:-$DEPCMD}
  3184. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  3185. DEPCCFLAGS=$_flags
  3186. fi
  3187. if $ar 2>&1 | grep -q Microsoft; then
  3188. arflags="-nologo"
  3189. ar_o='-out:$@'
  3190. else
  3191. arflags="rc"
  3192. ar_o='$@'
  3193. fi
  3194. add_cflags $extra_cflags
  3195. add_objcflags $extra_objcflags
  3196. add_asflags $extra_cflags
  3197. if test -n "$sysroot"; then
  3198. case "$cc_type" in
  3199. gcc|llvm_gcc|clang)
  3200. add_cppflags --sysroot="$sysroot"
  3201. add_ldflags --sysroot="$sysroot"
  3202. ;;
  3203. esac
  3204. fi
  3205. if test "$cpu" = host; then
  3206. enabled cross_compile &&
  3207. die "--cpu=host makes no sense when cross-compiling."
  3208. case "$cc_type" in
  3209. gcc|llvm_gcc)
  3210. check_native(){
  3211. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  3212. sed -n "/cc1.*$1=/{
  3213. s/.*$1=\\([^ ]*\\).*/\\1/
  3214. p
  3215. q
  3216. }" $TMPE
  3217. }
  3218. cpu=$(check_native -march || check_native -mcpu)
  3219. ;;
  3220. esac
  3221. test "${cpu:-host}" = host &&
  3222. die "--cpu=host not supported with compiler $cc"
  3223. fi
  3224. # Deal with common $arch aliases
  3225. case "$arch" in
  3226. aarch64|arm64)
  3227. arch="aarch64"
  3228. ;;
  3229. arm*)
  3230. arch="arm"
  3231. ;;
  3232. mips*|IP*)
  3233. case "$arch" in
  3234. *el)
  3235. add_cppflags -EL
  3236. add_ldflags -EL
  3237. ;;
  3238. *eb)
  3239. add_cppflags -EB
  3240. add_ldflags -EB
  3241. ;;
  3242. esac
  3243. arch="mips"
  3244. ;;
  3245. parisc*|hppa*)
  3246. arch="parisc"
  3247. ;;
  3248. "Power Macintosh"|ppc*|powerpc*)
  3249. arch="ppc"
  3250. ;;
  3251. s390|s390x)
  3252. arch="s390"
  3253. ;;
  3254. sh4|sh)
  3255. arch="sh4"
  3256. ;;
  3257. sun4u|sparc*)
  3258. arch="sparc"
  3259. ;;
  3260. tilegx|tile-gx)
  3261. arch="tilegx"
  3262. ;;
  3263. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  3264. arch="x86"
  3265. ;;
  3266. esac
  3267. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  3268. enable $arch
  3269. # Add processor-specific flags
  3270. if enabled aarch64; then
  3271. case $cpu in
  3272. armv*)
  3273. cpuflags="-march=$cpu"
  3274. ;;
  3275. *)
  3276. cpuflags="-mcpu=$cpu"
  3277. ;;
  3278. esac
  3279. elif enabled alpha; then
  3280. cpuflags="-mcpu=$cpu"
  3281. elif enabled arm; then
  3282. check_arm_arch() {
  3283. test_cpp_condition stddef.h \
  3284. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  3285. $cpuflags
  3286. }
  3287. probe_arm_arch() {
  3288. if check_arm_arch 4; then echo armv4
  3289. elif check_arm_arch 4T; then echo armv4t
  3290. elif check_arm_arch 5; then echo armv5
  3291. elif check_arm_arch 5E; then echo armv5e
  3292. elif check_arm_arch 5T; then echo armv5t
  3293. elif check_arm_arch 5TE; then echo armv5te
  3294. elif check_arm_arch 5TEJ; then echo armv5te
  3295. elif check_arm_arch 6; then echo armv6
  3296. elif check_arm_arch 6J; then echo armv6j
  3297. elif check_arm_arch 6K; then echo armv6k
  3298. elif check_arm_arch 6Z; then echo armv6z
  3299. elif check_arm_arch 6ZK; then echo armv6zk
  3300. elif check_arm_arch 6T2; then echo armv6t2
  3301. elif check_arm_arch 7; then echo armv7
  3302. elif check_arm_arch 7A 7_A; then echo armv7-a
  3303. elif check_arm_arch 7S; then echo armv7-a
  3304. elif check_arm_arch 7R 7_R; then echo armv7-r
  3305. elif check_arm_arch 7M 7_M; then echo armv7-m
  3306. elif check_arm_arch 7EM 7E_M; then echo armv7-m
  3307. elif check_arm_arch 8A 8_A; then echo armv8-a
  3308. fi
  3309. }
  3310. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  3311. case $cpu in
  3312. armv*)
  3313. cpuflags="-march=$cpu"
  3314. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  3315. ;;
  3316. *)
  3317. cpuflags="-mcpu=$cpu"
  3318. case $cpu in
  3319. cortex-a*) subarch=armv7a ;;
  3320. cortex-r*) subarch=armv7r ;;
  3321. cortex-m*) enable thumb; subarch=armv7m ;;
  3322. arm11*) subarch=armv6 ;;
  3323. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  3324. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  3325. *) subarch=$(probe_arm_arch) ;;
  3326. esac
  3327. ;;
  3328. esac
  3329. case "$subarch" in
  3330. armv5t*) enable fast_clz ;;
  3331. armv[6-8]*) enable fast_clz fast_unaligned ;;
  3332. esac
  3333. elif enabled avr32; then
  3334. case $cpu in
  3335. ap7[02]0[0-2])
  3336. subarch="avr32_ap"
  3337. cpuflags="-mpart=$cpu"
  3338. ;;
  3339. ap)
  3340. subarch="avr32_ap"
  3341. cpuflags="-march=$cpu"
  3342. ;;
  3343. uc3[ab]*)
  3344. subarch="avr32_uc"
  3345. cpuflags="-mcpu=$cpu"
  3346. ;;
  3347. uc)
  3348. subarch="avr32_uc"
  3349. cpuflags="-march=$cpu"
  3350. ;;
  3351. esac
  3352. elif enabled bfin; then
  3353. cpuflags="-mcpu=$cpu"
  3354. elif enabled mips; then
  3355. cpuflags="-march=$cpu"
  3356. elif enabled ppc; then
  3357. disable ldbrx
  3358. case $(tolower $cpu) in
  3359. 601|ppc601|powerpc601)
  3360. cpuflags="-mcpu=601"
  3361. disable altivec
  3362. ;;
  3363. 603*|ppc603*|powerpc603*)
  3364. cpuflags="-mcpu=603"
  3365. disable altivec
  3366. ;;
  3367. 604*|ppc604*|powerpc604*)
  3368. cpuflags="-mcpu=604"
  3369. disable altivec
  3370. ;;
  3371. g3|75*|ppc75*|powerpc75*)
  3372. cpuflags="-mcpu=750"
  3373. disable altivec
  3374. ;;
  3375. g4|745*|ppc745*|powerpc745*)
  3376. cpuflags="-mcpu=7450"
  3377. disable vsx
  3378. ;;
  3379. 74*|ppc74*|powerpc74*)
  3380. cpuflags="-mcpu=7400"
  3381. disable vsx
  3382. ;;
  3383. g5|970|ppc970|powerpc970)
  3384. cpuflags="-mcpu=970"
  3385. disable vsx
  3386. ;;
  3387. power[3-6]*)
  3388. cpuflags="-mcpu=$cpu"
  3389. disable vsx
  3390. ;;
  3391. power[7-8]*)
  3392. cpuflags="-mcpu=$cpu"
  3393. enable ldbrx
  3394. ;;
  3395. cell)
  3396. cpuflags="-mcpu=cell"
  3397. enable ldbrx
  3398. disable vsx
  3399. ;;
  3400. e500mc)
  3401. cpuflags="-mcpu=e500mc"
  3402. disable altivec
  3403. ;;
  3404. e500v2)
  3405. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  3406. disable altivec
  3407. disable dcbzl
  3408. ;;
  3409. e500)
  3410. cpuflags="-mcpu=8540 -mhard-float"
  3411. disable altivec
  3412. disable dcbzl
  3413. ;;
  3414. esac
  3415. elif enabled sparc; then
  3416. case $cpu in
  3417. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  3418. cpuflags="-mcpu=$cpu"
  3419. ;;
  3420. ultrasparc*|niagara[234])
  3421. cpuflags="-mcpu=$cpu"
  3422. ;;
  3423. esac
  3424. elif enabled x86; then
  3425. case $cpu in
  3426. i[345]86|pentium)
  3427. cpuflags="-march=$cpu"
  3428. disable i686
  3429. disable mmx
  3430. ;;
  3431. # targets that do NOT support nopl and conditional mov (cmov)
  3432. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  3433. cpuflags="-march=$cpu"
  3434. disable i686
  3435. ;;
  3436. # targets that do support nopl and conditional mov (cmov)
  3437. 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*)
  3438. cpuflags="-march=$cpu"
  3439. enable i686
  3440. enable fast_cmov
  3441. ;;
  3442. # targets that do support conditional mov but on which it's slow
  3443. pentium4|pentium4m|prescott|nocona)
  3444. cpuflags="-march=$cpu"
  3445. enable i686
  3446. disable fast_cmov
  3447. ;;
  3448. esac
  3449. fi
  3450. if [ "$cpu" != generic ]; then
  3451. add_cflags $cpuflags
  3452. add_asflags $cpuflags
  3453. test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
  3454. fi
  3455. # compiler sanity check
  3456. test_exec <<EOF
  3457. int main(void){ return 0; }
  3458. EOF
  3459. if test "$?" != 0; then
  3460. echo "$cc is unable to create an executable file."
  3461. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  3462. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  3463. echo "Only do this if you know what cross compiling means."
  3464. fi
  3465. die "C compiler test failed."
  3466. fi
  3467. add_cppflags -D_ISOC99_SOURCE
  3468. # some compilers silently accept -std=c11, so we also need to check that the
  3469. # version macro is defined properly
  3470. test_cpp_condition stdlib.h "__STDC_VERSION__ >= 201112L" -std=c11 &&
  3471. add_cflags -std=c11 ||
  3472. check_cflags -std=c99
  3473. check_cppflags -D_FILE_OFFSET_BITS=64
  3474. check_cppflags -D_LARGEFILE_SOURCE
  3475. add_host_cppflags -D_ISOC99_SOURCE
  3476. check_host_cflags -std=c99
  3477. check_host_cflags -Wall
  3478. check_host_cflags $host_cflags_speed
  3479. check_64bit(){
  3480. arch32=$1
  3481. arch64=$2
  3482. expr=${3:-'sizeof(void *) > 4'}
  3483. test_code cc "" "int test[2*($expr) - 1]" &&
  3484. subarch=$arch64 || subarch=$arch32
  3485. enable $subarch
  3486. }
  3487. case "$arch" in
  3488. aarch64|alpha|ia64)
  3489. enabled shared && enable_weak pic
  3490. ;;
  3491. mips)
  3492. check_64bit mips mips64 '_MIPS_SIM > 1'
  3493. enabled shared && enable_weak pic
  3494. ;;
  3495. parisc)
  3496. check_64bit parisc parisc64
  3497. enabled shared && enable_weak pic
  3498. ;;
  3499. ppc)
  3500. check_64bit ppc ppc64
  3501. enabled shared && enable_weak pic
  3502. ;;
  3503. s390)
  3504. check_64bit s390 s390x
  3505. enabled shared && enable_weak pic
  3506. ;;
  3507. sparc)
  3508. check_64bit sparc sparc64
  3509. enabled shared && enable_weak pic
  3510. ;;
  3511. x86)
  3512. check_64bit x86_32 x86_64
  3513. if enabled x86_64; then
  3514. enabled shared && enable_weak pic
  3515. objformat=elf64
  3516. fi
  3517. ;;
  3518. esac
  3519. # OS specific
  3520. case $target_os in
  3521. aix)
  3522. SHFLAGS=-shared
  3523. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  3524. enabled shared && add_ldflags -Wl,-brtl
  3525. arflags='-Xany -r -c'
  3526. ;;
  3527. android)
  3528. disable symver
  3529. enable section_data_rel_ro
  3530. SLIB_INSTALL_NAME='$(SLIBNAME)'
  3531. SLIB_INSTALL_LINKS=
  3532. SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
  3533. ;;
  3534. haiku)
  3535. prefix_default="/boot/common"
  3536. network_extralibs="-lnetwork"
  3537. host_extralibs=
  3538. ;;
  3539. sunos)
  3540. SHFLAGS='-shared -Wl,-h,$$(@F)'
  3541. enabled x86 && append SHFLAGS -mimpure-text
  3542. network_extralibs="-lsocket -lnsl"
  3543. # When using suncc to build, the Solaris linker will mark
  3544. # an executable with each instruction set encountered by
  3545. # the Solaris assembler. As our libraries contain their own
  3546. # guards for processor-specific code, instead suppress
  3547. # generation of the HWCAPS ELF section on Solaris x86 only.
  3548. enabled_all suncc x86 &&
  3549. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  3550. add_ldflags -Wl,-M,mapfile
  3551. nm_default='nm -P -g'
  3552. version_script='-M'
  3553. VERSION_SCRIPT_POSTPROCESS_CMD='perl $(SRC_PATH)/compat/solaris/make_sunver.pl - $(OBJS)'
  3554. ;;
  3555. netbsd)
  3556. disable symver
  3557. oss_indev_extralibs="-lossaudio"
  3558. ;;
  3559. openbsd|bitrig)
  3560. disable symver
  3561. SHFLAGS='-shared'
  3562. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  3563. SLIB_INSTALL_LINKS=
  3564. oss_indev_extralibs="-lossaudio"
  3565. ;;
  3566. dragonfly)
  3567. disable symver
  3568. ;;
  3569. freebsd)
  3570. ;;
  3571. bsd/os)
  3572. add_extralibs -lpoll -lgnugetopt
  3573. ;;
  3574. darwin)
  3575. enabled ppc && add_asflags -force_cpusubtype_ALL
  3576. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  3577. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  3578. add_ldflags -Wl,-dynamic,-search_paths_first
  3579. check_cflags -Werror=partial-availability
  3580. SLIBSUF=".dylib"
  3581. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
  3582. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
  3583. enabled x86_64 && objformat="macho64" || objformat="macho32"
  3584. enabled_any pic shared ||
  3585. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  3586. check_header dispatch/dispatch.h &&
  3587. add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore'
  3588. if test -n "$sysroot"; then
  3589. is_in -isysroot $cc $CPPFLAGS $CFLAGS || check_cppflags -isysroot $sysroot
  3590. is_in -isysroot $ld $LDFLAGS || check_ldflags -isysroot $sysroot
  3591. fi
  3592. ;;
  3593. msys*)
  3594. die "Native MSYS builds are discouraged, please use the MINGW environment."
  3595. ;;
  3596. mingw32*|mingw64*)
  3597. target_os=mingw32
  3598. LIBTARGET=i386
  3599. if enabled x86_64; then
  3600. LIBTARGET="i386:x86-64"
  3601. elif enabled arm; then
  3602. LIBTARGET="arm"
  3603. elif enabled aarch64; then
  3604. LIBTARGET="arm64"
  3605. fi
  3606. if enabled shared; then
  3607. # Cannot build both shared and static libs when using dllimport.
  3608. disable static
  3609. fi
  3610. check_ldflags -Wl,--nxcompat
  3611. check_ldflags -Wl,--dynamicbase
  3612. shlibdir_default="$bindir_default"
  3613. SLIBPREF=""
  3614. SLIBSUF=".dll"
  3615. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3616. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
  3617. SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  3618. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3619. SLIB_INSTALL_LINKS=
  3620. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3621. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3622. 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)'
  3623. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-auto-image-base $$(@:$(SLIBSUF)=.def)'
  3624. enabled x86_64 && objformat="win64" || objformat="win32"
  3625. dlltool="${cross_prefix}dlltool"
  3626. ranlib=:
  3627. enable dos_paths
  3628. ;;
  3629. win32|win64)
  3630. disable symver
  3631. if enabled shared; then
  3632. # Link to the import library instead of the normal static library
  3633. # for shared libs.
  3634. LD_LIB='%.lib'
  3635. # Cannot build both shared and static libs with MSVC or icl.
  3636. disable static
  3637. fi
  3638. shlibdir_default="$bindir_default"
  3639. SLIBPREF=""
  3640. SLIBSUF=".dll"
  3641. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3642. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
  3643. SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3644. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3645. SLIB_INSTALL_LINKS=
  3646. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3647. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3648. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3649. enabled x86_64 && objformat="win64" || objformat="win32"
  3650. ranlib=:
  3651. enable dos_paths
  3652. ;;
  3653. cygwin*)
  3654. target_os=cygwin
  3655. shlibdir_default="$bindir_default"
  3656. SLIBPREF="cyg"
  3657. SLIBSUF=".dll"
  3658. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3659. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
  3660. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3661. SLIB_INSTALL_LINKS=
  3662. SLIB_INSTALL_EXTRA_LIB='lib$(NAME).dll.a'
  3663. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(NAME).dll.a'
  3664. enabled x86_64 && objformat="win64" || objformat="win32"
  3665. enable dos_paths
  3666. ;;
  3667. *-dos|freedos|opendos)
  3668. network_extralibs="-lsocket"
  3669. objformat="coff"
  3670. enable dos_paths
  3671. add_cppflags -U__STRICT_ANSI__
  3672. ;;
  3673. linux)
  3674. enable section_data_rel_ro
  3675. ;;
  3676. irix*)
  3677. target_os=irix
  3678. ranlib="echo ignoring ranlib"
  3679. ;;
  3680. os/2*)
  3681. ln_s="cp -f"
  3682. objformat="aout"
  3683. add_cppflags -D_GNU_SOURCE
  3684. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zhigh-mem -Zmap
  3685. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  3686. LIBSUF="_s.a"
  3687. SLIBPREF=""
  3688. SLIBSUF=".dll"
  3689. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3690. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  3691. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  3692. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  3693. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  3694. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  3695. emxexp $(OBJS) >> $(SUBDIR)$(NAME).def'
  3696. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  3697. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  3698. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  3699. enable dos_paths
  3700. ;;
  3701. gnu/kfreebsd)
  3702. add_cppflags -D_BSD_SOURCE
  3703. ;;
  3704. gnu)
  3705. ;;
  3706. qnx)
  3707. add_cppflags -D_QNX_SOURCE
  3708. network_extralibs="-lsocket"
  3709. ;;
  3710. symbian)
  3711. SLIBSUF=".dll"
  3712. enable dos_paths
  3713. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  3714. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  3715. add_ldflags -Wl,--target1-abs,--no-undefined \
  3716. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  3717. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  3718. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  3719. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  3720. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  3721. ;;
  3722. minix)
  3723. ;;
  3724. none)
  3725. ;;
  3726. *)
  3727. die "Unknown OS '$target_os'."
  3728. ;;
  3729. esac
  3730. # determine libc flavour
  3731. probe_libc(){
  3732. pfx=$1
  3733. pfx_no_=${pfx%_}
  3734. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  3735. if test_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
  3736. eval ${pfx}libc_type=uclibc
  3737. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3738. elif test_${pfx}cpp_condition features.h "defined __GLIBC__"; then
  3739. eval ${pfx}libc_type=glibc
  3740. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3741. # MinGW headers can be installed on Cygwin, so check for newlib first.
  3742. elif test_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  3743. eval ${pfx}libc_type=newlib
  3744. add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
  3745. test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
  3746. add_${pfx}cppflags -D_WIN32_WINNT=0x0600
  3747. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  3748. elif test_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  3749. eval ${pfx}libc_type=mingw64
  3750. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3751. eval test \$${pfx_no_}cc_type = "gcc" &&
  3752. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3753. test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
  3754. add_${pfx}cppflags -D_WIN32_WINNT=0x0600
  3755. elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  3756. test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  3757. eval ${pfx}libc_type=mingw32
  3758. test_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  3759. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  3760. die "ERROR: MinGW32 runtime version must be >= 3.15."
  3761. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3762. test_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
  3763. add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
  3764. test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
  3765. add_${pfx}cppflags -D_WIN32_WINNT=0x0600
  3766. eval test \$${pfx_no_}cc_type = "gcc" &&
  3767. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3768. elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  3769. eval ${pfx}libc_type=msvcrt
  3770. if test_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
  3771. if [ "$pfx" = host_ ]; then
  3772. add_host_cppflags -Dsnprintf=_snprintf
  3773. else
  3774. add_compat strtod.o strtod=avpriv_strtod
  3775. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  3776. _snprintf=avpriv_snprintf \
  3777. vsnprintf=avpriv_vsnprintf
  3778. fi
  3779. fi
  3780. add_${pfx}cppflags -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS
  3781. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  3782. # 0x601 by default unless something else is set by the user.
  3783. # This can easily lead to us detecting functions only present
  3784. # in such new versions and producing binaries requiring windows 7.0.
  3785. # Therefore explicitly set the default to Vista unless the user has
  3786. # set something else on the command line.
  3787. # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
  3788. # family. For these cases, configure is free to use any functions
  3789. # found in the SDK headers by default. (Alternatively, we could force
  3790. # _WIN32_WINNT to 0x0602 in that case.)
  3791. test_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  3792. { test_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0600; }
  3793. #ifdef WINAPI_FAMILY
  3794. #include <winapifamily.h>
  3795. #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  3796. #error not desktop
  3797. #endif
  3798. #endif
  3799. EOF
  3800. if [ "$pfx" = "" ]; then
  3801. check_func strtoll || add_cflags -Dstrtoll=_strtoi64
  3802. fi
  3803. elif test_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  3804. eval ${pfx}libc_type=klibc
  3805. elif test_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  3806. eval ${pfx}libc_type=bionic
  3807. elif test_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  3808. eval ${pfx}libc_type=solaris
  3809. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  3810. else
  3811. eval ${pfx}libc_type=default
  3812. add_${pfx}cppflags -D_DEFAULT_SOURCE
  3813. fi
  3814. eval test -n "\${${pfx}libc_type}" && enable ${pfx}libc_${libc_type}
  3815. }
  3816. probe_libc
  3817. probe_libc host_
  3818. # hacks for compiler/libc/os combinations
  3819. case $libc_type in
  3820. bionic)
  3821. add_compat strtod.o strtod=avpriv_strtod
  3822. ;;
  3823. esac
  3824. check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
  3825. add_cppflags '-I\$(SRC_PATH)/compat/float'
  3826. test_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  3827. set_default $PATHS_LIST
  3828. set_default nm
  3829. disabled optimizations || check_cflags -fomit-frame-pointer
  3830. enable_weak_pic() {
  3831. disabled pic && return
  3832. enable pic
  3833. add_cppflags -DPIC
  3834. case "$target_os" in
  3835. mingw*|cygwin*|win*)
  3836. ;;
  3837. *)
  3838. add_cflags -fPIC
  3839. add_asflags -fPIC
  3840. ;;
  3841. esac
  3842. }
  3843. enabled pic && enable_weak_pic
  3844. test_cc <<EOF || die "Symbol mangling check failed."
  3845. int ff_extern;
  3846. EOF
  3847. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3848. extern_prefix=${sym%%ff_extern*}
  3849. ! disabled inline_asm && check_inline_asm inline_asm '"" ::'
  3850. for restrict_keyword in restrict __restrict__ __restrict ""; do
  3851. test_code cc "" "char * $restrict_keyword p" && break
  3852. done
  3853. check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
  3854. # The global variable ensures the bits appear unchanged in the object file.
  3855. test_cc <<EOF || die "endian test failed"
  3856. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3857. EOF
  3858. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3859. check_gas() {
  3860. log "check_gas using '$as' as AS"
  3861. # :vararg is used on aarch64, arm and ppc altivec
  3862. check_as vararg "
  3863. .macro m n, y:vararg=0
  3864. \n: .int \y
  3865. .endm
  3866. m x" || return 1
  3867. # .altmacro is only used in arm asm
  3868. ! enabled arm || check_as gnu_as ".altmacro"
  3869. }
  3870. if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
  3871. nogas=:
  3872. enabled_any arm aarch64 && nogas=die
  3873. enabled_all ppc altivec && nogas=warn
  3874. as_noop=-v
  3875. case $as_type in
  3876. arm*) gaspp_as_type=armasm; as_noop=-h ;;
  3877. gcc) gaspp_as_type=gas ;;
  3878. *) gaspp_as_type=$as_type ;;
  3879. esac
  3880. [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
  3881. test_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as $as_noop &&
  3882. gas="gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as"
  3883. if ! check_gas ; then
  3884. as=${gas:=$as}
  3885. check_gas || \
  3886. $nogas "GNU assembler not found, install/update gas-preprocessor"
  3887. fi
  3888. check_as as_func ".func test
  3889. .endfunc"
  3890. fi
  3891. check_inline_asm inline_asm_labels '"1:\n"'
  3892. if enabled aarch64; then
  3893. enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
  3894. # internal assembler in clang 3.3 does not support this instruction
  3895. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  3896. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  3897. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  3898. elif enabled alpha; then
  3899. check_cflags -mieee
  3900. elif enabled arm; then
  3901. enabled msvc && check_cpp_condition thumb stddef.h "defined _M_ARMT"
  3902. test_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
  3903. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3904. if check_cpp_condition vfp_args stddef.h "defined __ARM_PCS_VFP"; then
  3905. :
  3906. elif check_cpp_condition vfp_args stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then
  3907. :
  3908. elif ! test_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then
  3909. case "${cross_prefix:-$cc}" in
  3910. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3911. *) check_ld vfp_args <<EOF && fpabi=vfp || fpabi=soft ;;
  3912. __asm__ (".eabi_attribute 28, 1");
  3913. int main(void) { return 0; }
  3914. EOF
  3915. esac
  3916. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3917. fi
  3918. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3919. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3920. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3921. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3922. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3923. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3924. [ $target_os = linux ] || [ $target_os = android ] ||
  3925. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3926. $ARCH_EXT_LIST_ARM
  3927. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3928. check_as as_arch_directive ".arch armv7-a"
  3929. check_as as_fpu_directive ".fpu neon"
  3930. # llvm's integrated assembler supports .object_arch from llvm 3.5
  3931. [ "$objformat" = elf32 ] || [ "$objformat" = elf64 ] &&
  3932. check_as as_object_arch ".object_arch armv4"
  3933. # MS armasm fails to assemble our PIC constructs
  3934. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  3935. elif enabled mips; then
  3936. # make sure that only one instruction set is enabled
  3937. disable $ARCH_EXT_LIST_MIPS
  3938. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3939. if enabled mips64; then
  3940. check_inline_asm mips64r6 '"dlsa $0, $0, $0, 1"' ||
  3941. check_inline_asm mips64r2 '"dext $0, $0, 0, 1"' ||
  3942. check_inline_asm mips64r1 '"daddi $0, $0, 0"'
  3943. else
  3944. check_inline_asm mips32r6 '"aui $0, $0, 0"' ||
  3945. check_inline_asm mips32r2 '"ext $0, $0, 0, 1"' ||
  3946. check_inline_asm mips32r1 '"addi $0, $0, 0"'
  3947. fi
  3948. elif enabled parisc; then
  3949. if enabled gcc; then
  3950. case $($cc -dumpversion) in
  3951. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3952. esac
  3953. fi
  3954. elif enabled ppc; then
  3955. enable local_aligned_8 local_aligned_16 local_aligned_32
  3956. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3957. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3958. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3959. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3960. if enabled altivec; then
  3961. check_cflags -maltivec -mabi=altivec
  3962. # check if our compiler supports Motorola AltiVec C API
  3963. check_cc altivec altivec.h "vector signed int v1 = (vector signed int) { 0 };
  3964. vector signed int v2 = (vector signed int) { 1 };
  3965. v1 = vec_add(v1, v2);"
  3966. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3967. fi
  3968. if enabled vsx; then
  3969. check_cflags -mvsx &&
  3970. check_cc vsx altivec.h "int v[4] = { 0 };
  3971. vector signed int v1 = vec_vsx_ld(0, v);"
  3972. fi
  3973. if enabled power8; then
  3974. check_cpp_condition power8 altivec.h "defined(_ARCH_PWR8)"
  3975. fi
  3976. elif enabled x86; then
  3977. check_builtin rdtsc intrin.h "__rdtsc()"
  3978. check_builtin mm_empty mmintrin.h "_mm_empty()"
  3979. enable local_aligned_8 local_aligned_16 local_aligned_32
  3980. # check whether EBP is available on x86
  3981. # As 'i' is stored on the stack, this program will crash
  3982. # if the base pointer is used to access it because the
  3983. # base pointer is cleared in the inline assembly code.
  3984. check_exec_crash <<EOF && enable ebp_available
  3985. volatile int i=0;
  3986. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3987. return i;
  3988. EOF
  3989. # check whether EBX is available on x86
  3990. check_inline_asm ebx_available '""::"b"(0)' &&
  3991. check_inline_asm ebx_available '"":::"%ebx"'
  3992. # check whether xmm clobbers are supported
  3993. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3994. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3995. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3996. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3997. probe_x86asm(){
  3998. x86asmexe_probe=$1
  3999. if test_cmd $x86asmexe_probe -v; then
  4000. x86asmexe=$x86asmexe_probe
  4001. x86asm_type=nasm
  4002. x86asm_debug="-g -F dwarf"
  4003. X86ASMDEP=
  4004. X86ASM_DEPFLAGS='-MD $(@:.o=.d)'
  4005. elif test_cmd $x86asmexe_probe --version; then
  4006. x86asmexe=$x86asmexe_probe
  4007. x86asm_type=yasm
  4008. x86asm_debug="-g dwarf2"
  4009. X86ASMDEP='$(DEPX86ASM) $(X86ASMFLAGS) -M $(X86ASM_O) $< > $(@:.o=.d)'
  4010. X86ASM_DEPFLAGS=
  4011. fi
  4012. check_x86asm x86asm "movbe ecx, [5]"
  4013. }
  4014. if ! disabled_any asm mmx x86asm; then
  4015. disable x86asm
  4016. for program in $x86asmexe nasm yasm; do
  4017. probe_x86asm $program && break
  4018. done
  4019. disabled x86asm && die "nasm/yasm not found or too old. Use --disable-x86asm for a crippled build."
  4020. X86ASMFLAGS="-f $objformat"
  4021. enabled pic && append X86ASMFLAGS "-DPIC"
  4022. test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX"
  4023. case "$objformat" in
  4024. elf*) enabled debug && append X86ASMFLAGS $x86asm_debug ;;
  4025. esac
  4026. check_x86asm avx2_external "vextracti128 xmm0, ymm0, 0"
  4027. check_x86asm xop_external "vpmacsdd xmm0, xmm1, xmm2, xmm3"
  4028. check_x86asm fma3_external "vfmadd132ps ymm0, ymm1, ymm2"
  4029. check_x86asm fma4_external "vfmaddps ymm0, ymm1, ymm2, ymm3"
  4030. check_x86asm cpunop "CPU amdnop"
  4031. fi
  4032. case "$cpu" in
  4033. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  4034. disable fast_clz
  4035. ;;
  4036. esac
  4037. fi
  4038. check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)"
  4039. check_ldflags -Wl,--as-needed
  4040. if ! disabled network; then
  4041. check_func getaddrinfo $network_extralibs
  4042. check_func inet_aton $network_extralibs
  4043. check_type netdb.h "struct addrinfo"
  4044. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  4045. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  4046. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  4047. check_type poll.h "struct pollfd"
  4048. check_type netinet/sctp.h "struct sctp_event_subscribe"
  4049. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  4050. check_type netinet/in.h "struct sockaddr_in6"
  4051. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  4052. check_type "sys/types.h sys/socket.h" socklen_t
  4053. # Prefer arpa/inet.h over winsock2
  4054. if check_header arpa/inet.h ; then
  4055. check_func closesocket
  4056. elif check_header winsock2.h ; then
  4057. check_func_headers winsock2.h closesocket -lws2 &&
  4058. network_extralibs="-lws2" ||
  4059. { check_func_headers winsock2.h closesocket -lws2_32 &&
  4060. network_extralibs="-lws2_32"; } || disable winsock2_h network
  4061. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  4062. check_type ws2tcpip.h socklen_t
  4063. check_type ws2tcpip.h "struct addrinfo"
  4064. check_type ws2tcpip.h "struct group_source_req"
  4065. check_type ws2tcpip.h "struct ip_mreq_source"
  4066. check_type ws2tcpip.h "struct ipv6_mreq"
  4067. check_type winsock2.h "struct pollfd"
  4068. check_struct winsock2.h "struct sockaddr" sa_len
  4069. check_type ws2tcpip.h "struct sockaddr_in6"
  4070. check_type ws2tcpip.h "struct sockaddr_storage"
  4071. else
  4072. disable network
  4073. fi
  4074. fi
  4075. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  4076. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  4077. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  4078. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  4079. case "$custom_allocator" in
  4080. jemalloc)
  4081. # jemalloc by default does not use a prefix
  4082. require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc
  4083. ;;
  4084. tcmalloc)
  4085. require_pkg_config libtcmalloc libtcmalloc gperftools/tcmalloc.h tc_malloc
  4086. malloc_prefix=tc_
  4087. ;;
  4088. esac
  4089. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  4090. check_func ${malloc_prefix}memalign && enable memalign
  4091. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  4092. test_cpp_condition unistd.h "defined(_POSIX_MONOTONIC_CLOCK)" &&
  4093. { check_lib clock_gettime time.h clock_gettime ||
  4094. check_lib clock_gettime time.h clock_gettime -lrt; }
  4095. check_func fcntl
  4096. check_func gethrtime
  4097. check_func getopt
  4098. check_func getrusage
  4099. check_func gettimeofday
  4100. check_func gmtime_r
  4101. check_func isatty
  4102. check_func localtime_r
  4103. check_func mkstemp
  4104. check_func mmap
  4105. check_func mprotect
  4106. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  4107. check_func_headers time.h nanosleep || check_lib nanosleep time.h nanosleep -lrt
  4108. check_func sched_getaffinity
  4109. check_func setrlimit
  4110. check_func strerror_r
  4111. check_func sysconf
  4112. check_func sysctl
  4113. check_func usleep
  4114. check_func_headers io.h setmode
  4115. check_func_headers mach/mach_time.h mach_absolute_time
  4116. check_func_headers stdlib.h getenv
  4117. check_func_headers windows.h GetProcessAffinityMask
  4118. check_func_headers windows.h GetProcessTimes
  4119. check_func_headers windows.h GetSystemTimeAsFileTime
  4120. check_func_headers windows.h LoadLibrary
  4121. check_func_headers windows.h MapViewOfFile
  4122. check_func_headers windows.h SetConsoleTextAttribute
  4123. check_func_headers windows.h Sleep
  4124. check_func_headers windows.h VirtualAlloc
  4125. check_header direct.h
  4126. check_header dxgidebug.h
  4127. check_header dxva.h
  4128. check_header dxva2api.h
  4129. check_header io.h
  4130. check_header malloc.h
  4131. check_header poll.h
  4132. check_header sys/param.h
  4133. check_header sys/resource.h
  4134. check_header sys/select.h
  4135. check_header sys/time.h
  4136. check_header sys/un.h
  4137. check_header unistd.h
  4138. check_header valgrind/valgrind.h
  4139. check_header VideoDecodeAcceleration/VDADecoder.h
  4140. check_header windows.h
  4141. # it seems there are versions of clang in some distros that try to use the
  4142. # gcc headers, which explodes for stdatomic
  4143. # so we also check that atomics actually work here
  4144. check_builtin stdatomic stdatomic.h "atomic_int foo; atomic_store(&foo, 0)"
  4145. check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt &&
  4146. check_cpp_condition bcrypt bcrypt.h "defined BCRYPT_RNG_ALGORITHM"
  4147. check_lib ole32 "windows.h" CoTaskMemFree -lole32
  4148. check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  4149. check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  4150. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  4151. check_type "cuviddec.h" "CUVIDH264PICPARAMS"
  4152. check_type "cuviddec.h" "CUVIDHEVCPICPARAMS"
  4153. check_struct "cuviddec.h" "CUVIDDECODECREATEINFO" bitDepthMinus8
  4154. check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  4155. check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
  4156. check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
  4157. check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
  4158. check_type "va/va.h va/va_dec_vp8.h" "VAPictureParameterBufferVP8"
  4159. check_type "va/va.h va/va_vpp.h" "VAProcPipelineParameterBuffer"
  4160. check_type "va/va.h va/va_enc_h264.h" "VAEncPictureParameterBufferH264"
  4161. check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
  4162. check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
  4163. check_type "va/va.h va/va_enc_mpeg2.h" "VAEncPictureParameterBufferMPEG2"
  4164. check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8"
  4165. check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9"
  4166. check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
  4167. if ! disabled w32threads && ! enabled pthreads; then
  4168. check_lib w32threads "windows.h process.h" _beginthreadex &&
  4169. check_type "windows.h" CONDITION_VARIABLE
  4170. fi
  4171. # check for some common methods of building with pthread support
  4172. # do this before the optional library checks as some of them require pthreads
  4173. if ! disabled pthreads && ! enabled w32threads; then
  4174. if check_lib pthreads pthread.h pthread_join -pthread; then
  4175. add_cflags -pthread
  4176. elif check_lib pthreads pthread.h pthread_join -pthreads; then
  4177. add_cflags -pthreads
  4178. elif check_lib pthreads pthread.h pthread_join -lpthreadGC2; then
  4179. :
  4180. elif check_lib pthreads pthread.h pthread_join -lpthread; then
  4181. :
  4182. elif check_func pthread_join; then
  4183. enable pthreads
  4184. fi
  4185. enabled pthreads &&
  4186. check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
  4187. fi
  4188. disabled zlib || check_lib zlib zlib.h zlibVersion -lz
  4189. disabled bzlib || check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
  4190. # On some systems dynamic loading requires no extra linker flags
  4191. check_lib libdl dlfcn.h dlopen || check_lib libdl dlfcn.h dlopen -ldl
  4192. check_lib libm math.h sin -lm
  4193. atan2f_args=2
  4194. ldexpf_args=2
  4195. powf_args=2
  4196. for func in $MATH_FUNCS; do
  4197. eval check_mathfunc $func \${${func}_args:-1} $libm_extralibs
  4198. done
  4199. # these are off by default, so fail if requested and not available
  4200. 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"
  4201. enabled avisynth && require_header avisynth/avisynth_c.h
  4202. enabled avxsynth && require_header avxsynth/avxsynth_c.h
  4203. enabled cuda && require cuda cuda.h cuInit -lcuda
  4204. enabled cuvid && require cuvid cuviddec.h cuvidCreateDecoder -lnvcuvid
  4205. enabled frei0r && require_header frei0r.h
  4206. enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init &&
  4207. check_lib gmp gmp.h mpz_export -lgmp
  4208. enabled libaom && require_pkg_config libaom "aom >= 0.1.0" aom/aom_codec.h aom_codec_version
  4209. enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open
  4210. enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
  4211. enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec
  4212. enabled libfaac && require libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  4213. enabled libfdk_aac && require_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen
  4214. enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
  4215. enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
  4216. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  4217. enabled libhdcd && require_pkg_config libhdcd libhdcd "hdcd/hdcd_simple.h" hdcd_new
  4218. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  4219. enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
  4220. enabled libmfx && require_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit
  4221. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  4222. enabled libnpp && require libnpp npp.h nppGetLibVersion -lnppi -lnppc
  4223. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  4224. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  4225. enabled libopencv && require_pkg_config libopencv opencv opencv/cv.h cvCreateImageHeader
  4226. enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
  4227. enabled libopenjpeg && { check_lib libopenjpeg openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
  4228. require_pkg_config libopenjpeg libopenjpeg1 openjpeg.h opj_version -DOPJ_STATIC; }
  4229. enabled libopus && require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
  4230. enabled libpulse && require_pkg_config libpulse libpulse-simple pulse/simple.h pa_simple_new
  4231. enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
  4232. enabled libschroedinger && require_pkg_config libschroedinger schroedinger-1.0 schroedinger/schro.h schro_init
  4233. enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy
  4234. enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
  4235. enabled libsrt && require_pkg_config libsrt "srt >= 1.2.0" srt/srt.h srt_socket
  4236. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  4237. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame
  4238. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  4239. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  4240. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  4241. enabled libvpx && require_pkg_config libvpx "vpx >= 1.3.0" vpx/vpx_codec.h vpx_codec_version &&
  4242. { enabled libvpx_vp8_decoder &&
  4243. check_pkg_config libvpx_vp8_decoder vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx
  4244. enabled libvpx_vp8_encoder &&
  4245. check_pkg_config libvpx_vp8_encoder vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx
  4246. enabled libvpx_vp9_decoder &&
  4247. check_pkg_config libvpx_vp9_decoder vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx
  4248. enabled libvpx_vp9_encoder &&
  4249. check_pkg_config libvpx_vp9_encoder vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx
  4250. disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder &&
  4251. die "libvpx enabled but no supported decoders/encoders found"
  4252. }
  4253. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  4254. enabled libwebp && require_pkg_config libwebp libwebp webp/encode.h WebPGetEncoderVersion
  4255. enabled libx264 && require_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode &&
  4256. require_cpp_condition x264.h "X264_BUILD >= 118" &&
  4257. check_cpp_condition libx262 x264.h "X264_MPEG2"
  4258. enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get &&
  4259. require_cpp_condition x265.h "X265_BUILD >= 57"
  4260. enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs
  4261. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  4262. enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
  4263. { ! enabled cross_compile &&
  4264. add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline &&
  4265. add_ldflags -L/opt/vc/lib/ &&
  4266. check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
  4267. die "ERROR: mmal not found" &&
  4268. check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
  4269. enabled nvenc && require_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6"
  4270. enabled omx && require_header OMX_Core.h
  4271. enabled omx_rpi && { check_header OMX_Core.h ||
  4272. { ! enabled cross_compile && add_cflags -isystem/opt/vc/include/IL && check_header OMX_Core.h ; } ||
  4273. die "ERROR: OpenMAX IL headers not found"; } && enable omx
  4274. enabled openssl && { { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
  4275. check_pkg_config openssl openssl openssl/ssl.h SSL_library_init; } ||
  4276. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  4277. check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  4278. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  4279. die "ERROR: openssl not found"; }
  4280. # SDL adds some CFLAGS that should not be part of the general CFLAGS.
  4281. enabled avplay &&
  4282. test_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent
  4283. check_header linux/fb.h
  4284. check_header linux/videodev2.h
  4285. check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
  4286. check_header AVFoundation/AVFoundation.h
  4287. check_header sys/videoio.h
  4288. check_lib user32 "windows.h winuser.h" GetShellWindow -luser32
  4289. check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
  4290. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  4291. # w32api 3.12 had it defined wrong
  4292. check_cpp_condition vfwcap_defines vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER"
  4293. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  4294. check_header "dev/bktr/ioctl_meteor.h dev/bktr/ioctl_bt848.h" ||
  4295. check_header "machine/ioctl_meteor.h machine/ioctl_bt848.h" ||
  4296. check_header "dev/video/meteor/ioctl_meteor.h dev/video/bktr/ioctl_bt848.h" ||
  4297. check_header "dev/ic/bt8xx.h"
  4298. check_header sys/soundcard.h
  4299. enabled alsa_indev &&
  4300. check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound
  4301. enabled libjack &&
  4302. require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range
  4303. enabled sndio_indev && check_lib sndio sndio.h sio_open -lsndio
  4304. if enabled libcdio; then
  4305. check_lib libcdio "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4306. check_lib libcdio "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4307. die "ERROR: No usable libcdio/cdparanoia found"
  4308. fi
  4309. if enabled libxcb; then
  4310. require_pkg_config libxcb xcb xcb/xcb.h xcb_connect
  4311. require_pkg_config libxcb_shape xcb-shape xcb/shape.h xcb_shape_rectangles
  4312. disabled libxcb_shm ||
  4313. check_pkg_config libxcb_shm xcb-shm xcb/shm.h xcb_shm_attach
  4314. disabled libxcb_xfixes ||
  4315. check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image
  4316. fi
  4317. # d3d11va requires linking directly to dxgi and d3d11 if not building for
  4318. # the desktop api partition
  4319. test_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
  4320. #ifdef WINAPI_FAMILY
  4321. #include <winapifamily.h>
  4322. #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  4323. #error desktop, not uwp
  4324. #else
  4325. // WINAPI_FAMILY_APP, WINAPI_FAMILY_PHONE_APP => UWP
  4326. #endif
  4327. #else
  4328. #error no family set
  4329. #endif
  4330. EOF
  4331. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  4332. if enabled vaapi; then
  4333. require_cc vaapi "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)"
  4334. check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm
  4335. check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11
  4336. fi
  4337. enabled vaapi &&
  4338. test_cpp_condition "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" &&
  4339. enable vaapi_1
  4340. enabled vdpau &&
  4341. check_cpp_condition vdpau vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP"
  4342. enabled vdpau &&
  4343. check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
  4344. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  4345. # add some useful compiler flags if supported
  4346. check_cflags -Wdeclaration-after-statement
  4347. check_cflags -Wall
  4348. check_cflags -Wdisabled-optimization
  4349. check_cflags -Wpointer-arith
  4350. check_cflags -Wredundant-decls
  4351. check_cflags -Wwrite-strings
  4352. check_cflags -Wtype-limits
  4353. check_cflags -Wundef
  4354. check_cflags -Wmissing-prototypes
  4355. check_cflags -Wstrict-prototypes
  4356. if enabled extra_warnings; then
  4357. check_cflags -Wcast-qual
  4358. check_cflags -Wextra
  4359. check_cflags -Wpedantic
  4360. fi
  4361. check_disable_warning(){
  4362. warning_flag=-W${1#-Wno-}
  4363. test_cflags $warning_flag && add_cflags $1
  4364. }
  4365. check_disable_warning -Wno-parentheses
  4366. check_disable_warning -Wno-switch
  4367. check_disable_warning -Wno-format-zero-length
  4368. check_disable_warning -Wno-pointer-sign
  4369. check_disable_warning_headers(){
  4370. warning_flag=-W${1#-Wno-}
  4371. test_cflags $warning_flag && add_cflags_headers $1
  4372. }
  4373. check_disable_warning_headers -Wno-deprecated-declarations
  4374. check_disable_warning_headers -Wno-unused-variable
  4375. check_objcflags -fobjc-arc && enable objc_arc
  4376. test_cc <<EOF && enable blocks_extension
  4377. void (^block)(void);
  4378. EOF
  4379. # add some linker flags
  4380. check_ldflags -Wl,--warn-common
  4381. check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  4382. enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir
  4383. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  4384. # add some strip flags
  4385. # -wN '..@*' is more selective than -x, but not available everywhere.
  4386. check_stripflags -wN \'..@*\' || check_stripflags -x || strip='true'
  4387. enabled neon_clobber_test &&
  4388. check_ldflags -Wl,--wrap,avcodec_open2 \
  4389. -Wl,--wrap,avcodec_decode_audio4 \
  4390. -Wl,--wrap,avcodec_decode_video2 \
  4391. -Wl,--wrap,avcodec_decode_subtitle2 \
  4392. -Wl,--wrap,avcodec_encode_audio2 \
  4393. -Wl,--wrap,avcodec_encode_video2 \
  4394. -Wl,--wrap,avcodec_encode_subtitle \
  4395. -Wl,--wrap,avcodec_send_packet \
  4396. -Wl,--wrap,avcodec_receive_packet \
  4397. -Wl,--wrap,avcodec_send_frame \
  4398. -Wl,--wrap,avcodec_receive_frame \
  4399. -Wl,--wrap,avresample_convert ||
  4400. disable neon_clobber_test
  4401. enabled xmm_clobber_test &&
  4402. check_ldflags -Wl,--wrap,avcodec_open2 \
  4403. -Wl,--wrap,avcodec_decode_audio4 \
  4404. -Wl,--wrap,avcodec_decode_video2 \
  4405. -Wl,--wrap,avcodec_decode_subtitle2 \
  4406. -Wl,--wrap,avcodec_encode_audio2 \
  4407. -Wl,--wrap,avcodec_encode_video2 \
  4408. -Wl,--wrap,avcodec_encode_subtitle \
  4409. -Wl,--wrap,avcodec_send_packet \
  4410. -Wl,--wrap,avcodec_receive_packet \
  4411. -Wl,--wrap,avcodec_send_frame \
  4412. -Wl,--wrap,avcodec_receive_frame \
  4413. -Wl,--wrap,avresample_convert \
  4414. -Wl,--wrap,sws_scale ||
  4415. disable xmm_clobber_test
  4416. check_ld proper_dce <<EOF
  4417. extern const int array[512];
  4418. static inline int func(void) { return array[0]; }
  4419. int main(void) { return 0; }
  4420. EOF
  4421. if enabled proper_dce; then
  4422. echo "X { local: *; };" > $TMPV
  4423. if test_ldflags -Wl,${version_script},$TMPV; then
  4424. append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
  4425. quotes='""'
  4426. test_cc <<EOF && enable symver_asm_label
  4427. void ff_foo(void) __asm__ ("av_foo@VERSION");
  4428. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  4429. EOF
  4430. test_cc <<EOF && enable symver_gnu_asm
  4431. __asm__(".symver ff_foo,av_foo@VERSION");
  4432. void ff_foo(void) {}
  4433. EOF
  4434. fi
  4435. fi
  4436. if [ -z "$optflags" ]; then
  4437. if enabled small; then
  4438. optflags=$cflags_size
  4439. elif enabled optimizations; then
  4440. optflags=$cflags_speed
  4441. else
  4442. optflags=$cflags_noopt
  4443. fi
  4444. fi
  4445. check_optflags(){
  4446. check_cflags "$@"
  4447. enabled lto && check_ldflags "$@"
  4448. }
  4449. check_optflags $optflags
  4450. check_optflags -fno-math-errno
  4451. check_optflags -fno-signed-zeros
  4452. if enabled lto; then
  4453. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  4454. check_cflags -flto
  4455. check_ldflags -flto $cpuflags
  4456. fi
  4457. if enabled icc; then
  4458. # Just warnings, no remarks
  4459. check_cflags -w1
  4460. # -wd: Disable following warnings
  4461. # 144, 167, 556: -Wno-pointer-sign
  4462. # 1292: attribute "foo" ignored
  4463. # 1419: external declaration in primary source file
  4464. # 10006: ignoring unknown option -fno-signed-zeros
  4465. # 10148: ignoring unknown option -Wno-parentheses
  4466. # 10156: ignoring option '-W'; no argument required
  4467. check_cflags -wd144,167,556,1292,1419,10006,10148,10156
  4468. # 11030: Warning unknown option --as-needed
  4469. # 10156: ignoring option '-export'; no argument required
  4470. check_ldflags -wd10156,11030
  4471. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  4472. enable ebp_available
  4473. if enabled x86_32; then
  4474. icc_version=$($cc -dumpversion)
  4475. test ${icc_version%%.*} -ge 11 &&
  4476. check_cflags -falign-stack=maintain-16-byte ||
  4477. disable aligned_stack
  4478. fi
  4479. elif enabled gcc; then
  4480. check_optflags -fno-tree-vectorize
  4481. check_cflags -Werror=implicit-function-declaration
  4482. check_cflags -Werror=missing-prototypes
  4483. check_cflags -Werror=return-type
  4484. check_cflags -Werror=declaration-after-statement
  4485. check_cflags -Werror=vla
  4486. check_cflags -Werror=format-security
  4487. check_cflags -fdiagnostics-color=auto
  4488. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  4489. if enabled x86_32; then
  4490. case $target_os in
  4491. *bsd*)
  4492. # BSDs don't guarantee a 16 byte aligned stack, but we can
  4493. # request GCC to try to maintain 16 byte alignment throughout
  4494. # function calls. Library entry points that might call assembly
  4495. # functions align the stack. (The parameter means 2^4 bytes.)
  4496. check_cflags -mpreferred-stack-boundary=4
  4497. ;;
  4498. esac
  4499. fi
  4500. elif enabled llvm_gcc; then
  4501. check_cflags -mllvm -stack-alignment=16
  4502. elif enabled clang; then
  4503. if enabled x86_32; then
  4504. # Clang doesn't support maintaining alignment without assuming the
  4505. # same alignment in every function. If 16 byte alignment would be
  4506. # enabled, one would also have to either add attribute_align_arg on
  4507. # every single entry point into the libraries or enable -mstackrealign
  4508. # (doing stack realignment in every single function).
  4509. case $target_os in
  4510. mingw32|win32|*bsd*)
  4511. disable aligned_stack
  4512. ;;
  4513. *)
  4514. check_cflags -mllvm -stack-alignment=16
  4515. ;;
  4516. esac
  4517. else
  4518. check_cflags -mllvm -stack-alignment=16
  4519. fi
  4520. check_cflags -Qunused-arguments
  4521. check_cflags -Werror=implicit-function-declaration
  4522. check_cflags -Werror=missing-prototypes
  4523. check_cflags -Werror=return-type
  4524. elif enabled cparser; then
  4525. add_cflags -Wno-missing-variable-declarations
  4526. add_cflags -Wno-empty-statement
  4527. elif enabled armcc; then
  4528. add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
  4529. add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
  4530. # 2523: use of inline assembly is deprecated
  4531. add_cflags -W${armcc_opt},--diag_suppress=2523
  4532. add_cflags -W${armcc_opt},--diag_suppress=1207
  4533. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  4534. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  4535. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  4536. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  4537. elif enabled pathscale; then
  4538. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  4539. disable inline_asm
  4540. elif enabled_any msvc icl; then
  4541. enabled x86_32 && disable aligned_stack
  4542. enabled_all x86_32 debug && add_cflags -Oy-
  4543. enabled debug && add_ldflags -debug
  4544. enable pragma_deprecated
  4545. if enabled icl; then
  4546. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  4547. # (correctly) on icl 13.x.
  4548. test_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  4549. add_cflags -Qansi-alias
  4550. # icl will pass the inline asm tests but inline asm is currently
  4551. # not supported (build will fail)
  4552. disable inline_asm
  4553. fi
  4554. # msvcrt10 x64 incorrectly enables log2, only msvcrt12 (MSVC 2013) onwards actually has log2.
  4555. check_cpp_condition log2 crtversion.h "_VC_CRT_MAJOR_VERSION >= 12"
  4556. # The CRT headers contain __declspec(restrict) in a few places, but if redefining
  4557. # restrict, this might break. MSVC 2010 and 2012 fail with __declspec(__restrict)
  4558. # (as it ends up if the restrict redefine is done before including stdlib.h), while
  4559. # MSVC 2013 and newer can handle it fine.
  4560. # If this declspec fails, force including stdlib.h before the restrict redefinition
  4561. # happens in config.h.
  4562. if [ $restrict_keyword != restrict ]; then
  4563. test_cc <<EOF || add_cflags -FIstdlib.h
  4564. __declspec($restrict_keyword) void *foo(int);
  4565. EOF
  4566. fi
  4567. fi
  4568. for pfx in "" host_; do
  4569. varname=${pfx%_}cc_type
  4570. eval "type=\$$varname"
  4571. if [ "$type" = "msvc" ]; then
  4572. test_${pfx}cc <<EOF || add_${pfx}cflags -Dinline=__inline
  4573. static inline int foo(int a) { return a; }
  4574. EOF
  4575. fi
  4576. done
  4577. case $as_type in
  4578. clang)
  4579. add_asflags -Qunused-arguments
  4580. ;;
  4581. esac
  4582. case $ld_type in
  4583. clang)
  4584. check_ldflags -Qunused-arguments
  4585. ;;
  4586. esac
  4587. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  4588. check_cmd pod2man --help
  4589. check_cmd texi2html -version
  4590. check_deps $CONFIG_LIST \
  4591. $CONFIG_EXTRA \
  4592. $HAVE_LIST \
  4593. $ALL_COMPONENTS \
  4594. flatten_extralibs(){
  4595. unset nested_entries
  4596. list_name=$1
  4597. eval list=\$${1}
  4598. for entry in $list; do
  4599. entry_copy=$entry
  4600. resolve entry_copy
  4601. append nested_entries $(filter '*_extralibs' $entry_copy)
  4602. flat_entries=$(filter_out '*_extralibs' $entry_copy)
  4603. eval $entry="\$flat_entries"
  4604. done
  4605. append $list_name "$nested_entries"
  4606. resolve nested_entries
  4607. if test -n "$(filter '*_extralibs' $nested_entries)"; then
  4608. flatten_extralibs $list_name
  4609. fi
  4610. }
  4611. for linkunit in $LIBRARY_LIST; do
  4612. unset current_extralibs
  4613. eval components=\$$(toupper ${linkunit})_COMPONENTS_LIST
  4614. for comp in ${components}; do
  4615. enabled $comp || continue
  4616. comp_extralibs="${comp}_extralibs"
  4617. append current_extralibs $comp_extralibs
  4618. done
  4619. eval prepend ${linkunit}_extralibs $current_extralibs
  4620. done
  4621. for linkunit in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
  4622. flatten_extralibs ${linkunit}_extralibs
  4623. unique ${linkunit}_extralibs
  4624. resolve ${linkunit}_extralibs
  4625. eval ${linkunit}_extralibs=\$\(\$ldflags_filter \$${linkunit}_extralibs\)
  4626. done
  4627. map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
  4628. for thread in $THREADS_LIST; do
  4629. if enabled $thread; then
  4630. test -n "$thread_type" &&
  4631. die "ERROR: Only one thread type must be selected." ||
  4632. thread_type="$thread"
  4633. fi
  4634. done
  4635. if disabled stdatomic; then
  4636. if enabled atomics_gcc; then
  4637. add_cppflags '-I\$(SRC_PATH)/compat/atomics/gcc'
  4638. elif enabled atomics_win32; then
  4639. add_cppflags '-I\$(SRC_PATH)/compat/atomics/win32'
  4640. elif enabled atomics_suncc; then
  4641. add_cppflags '-I\$(SRC_PATH)/compat/atomics/suncc'
  4642. elif enabled pthreads; then
  4643. add_compat atomics/pthread/stdatomic.o
  4644. add_cppflags '-I\$(SRC_PATH)/compat/atomics/pthread'
  4645. else
  4646. enabled threads && die "Threading is enabled, but no atomics are available"
  4647. add_cppflags '-I\$(SRC_PATH)/compat/atomics/dummy'
  4648. fi
  4649. fi
  4650. enabled zlib && add_cppflags -DZLIB_CONST
  4651. # conditional library dependencies, in linking order
  4652. enabled movie_filter && prepend avfilter_deps "avformat avcodec"
  4653. enabled_any asyncts_filter resample_filter &&
  4654. prepend avfilter_deps "avresample"
  4655. enabled scale_filter && prepend avfilter_deps "swscale"
  4656. enabled opus_decoder && prepend avcodec_deps "avresample"
  4657. expand_deps(){
  4658. lib_deps=${1}_deps
  4659. eval "deps=\$$lib_deps"
  4660. append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
  4661. unique $lib_deps
  4662. }
  4663. map 'expand_deps $v' $LIBRARY_LIST
  4664. if test "$quiet" != "yes"; then
  4665. echo "install prefix $prefix"
  4666. echo "source path $source_path"
  4667. echo "C compiler $cc"
  4668. echo "C library $libc_type"
  4669. if test "$host_cc" != "$cc"; then
  4670. echo "host C compiler $host_cc"
  4671. echo "host C library $host_libc_type"
  4672. fi
  4673. echo "ARCH $arch ($cpu)"
  4674. if test "$extra_version" != ""; then
  4675. echo "version string suffix $extra_version"
  4676. fi
  4677. echo "big-endian ${bigendian-no}"
  4678. echo "runtime cpu detection ${runtime_cpudetect-no}"
  4679. if enabled x86; then
  4680. echo "standalone assembly ${x86asm-no}"
  4681. echo "x86 assembler ${x86asmexe}"
  4682. echo "MMX enabled ${mmx-no}"
  4683. echo "MMXEXT enabled ${mmxext-no}"
  4684. echo "3DNow! enabled ${amd3dnow-no}"
  4685. echo "3DNow! extended enabled ${amd3dnowext-no}"
  4686. echo "SSE enabled ${sse-no}"
  4687. echo "SSSE3 enabled ${ssse3-no}"
  4688. echo "AVX enabled ${avx-no}"
  4689. echo "XOP enabled ${xop-no}"
  4690. echo "FMA3 enabled ${fma3-no}"
  4691. echo "FMA4 enabled ${fma4-no}"
  4692. echo "i686 features enabled ${i686-no}"
  4693. echo "CMOV is fast ${fast_cmov-no}"
  4694. echo "EBX available ${ebx_available-no}"
  4695. echo "EBP available ${ebp_available-no}"
  4696. fi
  4697. if enabled aarch64; then
  4698. echo "NEON enabled ${neon-no}"
  4699. echo "VFP enabled ${vfp-no}"
  4700. fi
  4701. if enabled arm; then
  4702. echo "ARMv5TE enabled ${armv5te-no}"
  4703. echo "ARMv6 enabled ${armv6-no}"
  4704. echo "ARMv6T2 enabled ${armv6t2-no}"
  4705. echo "VFP enabled ${vfp-no}"
  4706. echo "NEON enabled ${neon-no}"
  4707. fi
  4708. if enabled ppc; then
  4709. echo "AltiVec enabled ${altivec-no}"
  4710. echo "VSX enabled ${vsx-no}"
  4711. echo "POWER8 enabled ${power8-no}"
  4712. echo "PPC 4xx optimizations ${ppc4xx-no}"
  4713. echo "dcbzl available ${dcbzl-no}"
  4714. fi
  4715. echo "debug symbols ${debug-no}"
  4716. echo "optimize for size ${small-no}"
  4717. echo "optimizations ${optimizations-no}"
  4718. echo "static ${static-no}"
  4719. echo "shared ${shared-no}"
  4720. echo "network support ${network-no}"
  4721. echo "threading support ${thread_type-no}"
  4722. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  4723. echo "External libraries:"
  4724. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  4725. echo
  4726. echo "External libraries providing hardware acceleration:"
  4727. print_enabled '' $HWACCEL_LIBRARY_LIST | print_3_columns
  4728. echo
  4729. echo "Libraries:"
  4730. print_enabled '' $LIBRARY_LIST | print_3_columns
  4731. echo
  4732. echo "Programs:"
  4733. print_enabled '' $PROGRAM_LIST | print_3_columns
  4734. echo
  4735. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev; do
  4736. echo "Enabled ${type}s:"
  4737. eval list=\$$(toupper $type)_LIST
  4738. print_enabled '_*' $list | print_3_columns
  4739. echo
  4740. done
  4741. if test -n "$ignore_tests"; then
  4742. ignore_tests=$(echo $ignore_tests | tr ',' ' ')
  4743. echo "Ignored FATE tests:"
  4744. echo $ignore_tests | print_3_columns
  4745. echo
  4746. fi
  4747. echo "License: $license"
  4748. fi # test "$quiet" != "yes"
  4749. test -n "$WARNINGS" && printf "\n$WARNINGS"
  4750. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  4751. esc(){
  4752. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  4753. }
  4754. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" > avbuild/config.fate
  4755. config_files="$TMPH avbuild/config.mak"
  4756. cat > avbuild/config.mak <<EOF
  4757. # Automatically generated by configure - do not modify!
  4758. LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
  4759. prefix=$prefix
  4760. LIBDIR=\$(DESTDIR)$libdir
  4761. SHLIBDIR=\$(DESTDIR)$shlibdir
  4762. INCDIR=\$(DESTDIR)$incdir
  4763. BINDIR=\$(DESTDIR)$bindir
  4764. DATADIR=\$(DESTDIR)$datadir
  4765. DOCDIR=\$(DESTDIR)$docdir
  4766. MANDIR=\$(DESTDIR)$mandir
  4767. SRC_PATH=$source_path
  4768. CC_IDENT=$cc_ident
  4769. ARCH=$arch
  4770. INTRINSICS=$intrinsics
  4771. EXTERN_PREFIX=$extern_prefix
  4772. CC=$cc
  4773. AS=$as
  4774. OBJCC=$objcc
  4775. LD=$ld
  4776. DEPCC=$dep_cc
  4777. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  4778. DEPAS=$as
  4779. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  4780. X86ASM=$x86asmexe
  4781. DEPX86ASM=$x86asmexe
  4782. DEPX86ASMFLAGS=\$(X86ASMFLAGS)
  4783. AR=$ar
  4784. ARFLAGS=$arflags
  4785. AR_O=$ar_o
  4786. AR_CMD=$ar
  4787. NM_CMD=$nm
  4788. RANLIB=$ranlib
  4789. STRIP=$strip
  4790. LN_S=$ln_s
  4791. CPPFLAGS=$CPPFLAGS
  4792. CFLAGS=$CFLAGS
  4793. OBJCFLAGS=$OBJCFLAGS
  4794. ASFLAGS=$ASFLAGS
  4795. AS_C=$AS_C
  4796. AS_O=$AS_O
  4797. OBJCC_C=$OBJCC_C
  4798. OBJCC_E=$OBJCC_E
  4799. OBJCC_O=$OBJCC_O
  4800. CC_C=$CC_C
  4801. CC_E=$CC_E
  4802. CC_O=$CC_O
  4803. X86ASM_O=$X86ASM_O
  4804. LD_O=$LD_O
  4805. LD_LIB=$LD_LIB
  4806. LD_PATH=$LD_PATH
  4807. DLLTOOL=$dlltool
  4808. LDFLAGS=$LDFLAGS
  4809. LDEXEFLAGS=$LDEXEFLAGS
  4810. LDSOFLAGS=$LDSOFLAGS
  4811. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  4812. STRIPFLAGS=$STRIPFLAGS
  4813. X86ASMFLAGS=$X86ASMFLAGS
  4814. LIBPREF=$LIBPREF
  4815. LIBSUF=$LIBSUF
  4816. LIBNAME=$LIBNAME
  4817. SLIBPREF=$SLIBPREF
  4818. SLIBSUF=$SLIBSUF
  4819. EXESUF=$EXESUF
  4820. EXTRA_VERSION=$extra_version
  4821. CCDEP=$CCDEP
  4822. CCDEP_FLAGS=$CCDEP_FLAGS
  4823. ASDEP=$ASDEP
  4824. ASDEP_FLAGS=$ASDEP_FLAGS
  4825. X86ASMDEP=$X86ASMDEP
  4826. X86ASMDEP_FLAGS=$X86ASMDEP_FLAGS
  4827. CC_DEPFLAGS=$CC_DEPFLAGS
  4828. AS_DEPFLAGS=$AS_DEPFLAGS
  4829. X86ASM_DEPFLAGS=$X86ASM_DEPFLAGS
  4830. HOSTCC=$host_cc
  4831. HOSTLD=$host_ld
  4832. HOSTCFLAGS=$host_cflags
  4833. HOSTCPPFLAGS=$host_cppflags
  4834. HOSTEXESUF=$HOSTEXESUF
  4835. HOSTLDFLAGS=$host_ldflags
  4836. HOSTEXTRALIBS=$host_extralibs
  4837. DEPHOSTCC=$host_cc
  4838. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  4839. HOSTCCDEP=$HOSTCCDEP
  4840. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  4841. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  4842. HOSTCC_C=$HOSTCC_C
  4843. HOSTCC_O=$HOSTCC_O
  4844. HOSTLD_O=$HOSTLD_O
  4845. TARGET_EXEC=$target_exec $target_exec_args
  4846. TARGET_PATH=$target_path
  4847. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  4848. CFLAGS-avplay=$sdl_cflags
  4849. CFLAGS_HEADERS=$CFLAGS_HEADERS
  4850. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  4851. EXTRALIBS=$extralibs
  4852. COMPAT_OBJS=$compat_objs
  4853. INSTALL=install
  4854. LIBTARGET=${LIBTARGET}
  4855. SLIBNAME=${SLIBNAME}
  4856. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  4857. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  4858. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  4859. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  4860. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  4861. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  4862. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  4863. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  4864. VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
  4865. SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
  4866. IGNORE_TESTS=$ignore_tests
  4867. EOF
  4868. map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> avbuild/config.mak' $LIBRARY_LIST
  4869. for entry in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
  4870. eval echo "EXTRALIBS-${entry}=\$${entry}_extralibs" >> avbuild/config.mak
  4871. done
  4872. cat > $TMPH <<EOF
  4873. /* Automatically generated by configure - do not modify! */
  4874. #ifndef LIBAV_CONFIG_H
  4875. #define LIBAV_CONFIG_H
  4876. #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
  4877. #define LIBAV_LICENSE "$(c_escape $license)"
  4878. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  4879. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  4880. #define EXTERN_PREFIX "${extern_prefix}"
  4881. #define EXTERN_ASM ${extern_prefix}
  4882. #define SLIBSUF "$SLIBSUF"
  4883. EOF
  4884. test $restrict_keyword != restrict &&
  4885. echo "#define restrict $restrict_keyword" >> $TMPH
  4886. test -n "$malloc_prefix" &&
  4887. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  4888. if enabled x86asm; then
  4889. append config_files $TMPASM
  4890. cat > $TMPASM <<EOF
  4891. ; Automatically generated by configure - do not modify!
  4892. EOF
  4893. fi
  4894. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  4895. print_config ARCH_ "$config_files" $ARCH_LIST
  4896. print_config HAVE_ "$config_files" $HAVE_LIST
  4897. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  4898. $CONFIG_EXTRA \
  4899. $ALL_COMPONENTS \
  4900. echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
  4901. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  4902. cp_if_changed $TMPH config.h
  4903. touch avbuild/.config
  4904. enabled x86asm && cp_if_changed $TMPASM config.asm
  4905. cat > $TMPH <<EOF
  4906. /* Generated by libav configure */
  4907. #ifndef AVUTIL_AVCONFIG_H
  4908. #define AVUTIL_AVCONFIG_H
  4909. EOF
  4910. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  4911. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  4912. cp_if_changed $TMPH libavutil/avconfig.h
  4913. # generate the lists of enabled components
  4914. print_enabled_components(){
  4915. file=$1
  4916. struct_name=$2
  4917. name=$3
  4918. shift 3
  4919. echo "static const $struct_name * const $name[] = {" > $TMPH
  4920. for c in $*; do
  4921. enabled $c && printf " &ff_%s,\n" $c >> $TMPH
  4922. done
  4923. echo " NULL };" >> $TMPH
  4924. cp_if_changed $TMPH $file
  4925. }
  4926. print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
  4927. print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
  4928. # Settings for pkg-config files
  4929. cat > $TMPH <<EOF
  4930. # Automatically generated by configure - do not modify!
  4931. shared=$shared
  4932. prefix=$prefix
  4933. libdir=$libdir
  4934. incdir=$incdir
  4935. source_path=${source_path}
  4936. LIBPREF=${LIBPREF}
  4937. LIBSUF=${LIBSUF}
  4938. extralibs_avutil="$avutil_extralibs"
  4939. extralibs_avcodec="$avcodec_extralibs"
  4940. extralibs_avformat="$avformat_extralibs"
  4941. extralibs_avdevice="$avdevice_extralibs"
  4942. extralibs_avfilter="$avfilter_extralibs"
  4943. extralibs_avresample="$avresample_extralibs"
  4944. extralibs_swscale="$swscale_extralibs"
  4945. EOF
  4946. for lib in $LIBRARY_LIST; do
  4947. lib_deps="$(eval echo \$${lib}_deps)"
  4948. echo ${lib}_deps=\"$lib_deps\" >> $TMPH
  4949. done
  4950. cp_if_changed $TMPH avbuild/config.sh