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.

5489 lines
164KB

  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. sdl
  1518. vaapi_1
  1519. vaapi_drm
  1520. vaapi_x11
  1521. vdpau_x11
  1522. wincrypt
  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. CONDITION_VARIABLE_Ptr
  1545. CUVIDDECODECREATEINFO_bitDepthMinus8
  1546. socklen_t
  1547. struct_addrinfo
  1548. struct_group_source_req
  1549. struct_ip_mreq_source
  1550. struct_ipv6_mreq
  1551. struct_pollfd
  1552. struct_rusage_ru_maxrss
  1553. struct_sockaddr_in6
  1554. struct_sockaddr_sa_len
  1555. struct_sockaddr_storage
  1556. struct_v4l2_frmivalenum_discrete
  1557. "
  1558. HAVE_LIST="
  1559. $ARCH_EXT_LIST
  1560. $(add_suffix _external $ARCH_EXT_LIST)
  1561. $(add_suffix _inline $ARCH_EXT_LIST)
  1562. $ARCH_FEATURES
  1563. $BUILTIN_LIST
  1564. $HAVE_LIST_CMDLINE
  1565. $HAVE_LIST_PUB
  1566. $HEADERS_LIST
  1567. $INTRINSICS_LIST
  1568. $MATH_FUNCS
  1569. $SYSTEM_FEATURES
  1570. $SYSTEM_FUNCS
  1571. $SYSTEM_LIBRARIES
  1572. $THREADS_LIST
  1573. $TOOLCHAIN_FEATURES
  1574. $TYPES_LIST
  1575. "
  1576. # options emitted with CONFIG_ prefix but not available on the command line
  1577. CONFIG_EXTRA="
  1578. aandcttables
  1579. ac3dsp
  1580. adts_header
  1581. audio_frame_queue
  1582. audiodsp
  1583. blockdsp
  1584. bswapdsp
  1585. cabac
  1586. cbs
  1587. cbs_h264
  1588. cbs_h265
  1589. cbs_mpeg2
  1590. dirac_parse
  1591. dvprofile
  1592. faandct
  1593. faanidct
  1594. fdctdsp
  1595. flacdsp
  1596. fmtconvert
  1597. g722dsp
  1598. gmp
  1599. golomb
  1600. gplv3
  1601. h263dsp
  1602. h264chroma
  1603. h264dsp
  1604. h264parse
  1605. h264pred
  1606. h264qpel
  1607. hevcparse
  1608. hpeldsp
  1609. huffman
  1610. huffyuvdsp
  1611. huffyuvencdsp
  1612. idctdsp
  1613. iirfilter
  1614. imdct15
  1615. intrax8
  1616. iso_media
  1617. ividsp
  1618. jpegtables
  1619. lgplv3
  1620. libx262
  1621. libxcb_shape
  1622. lpc
  1623. lzf
  1624. me_cmp
  1625. mpeg_er
  1626. mpegaudio
  1627. mpegaudiodsp
  1628. mpegaudioheader
  1629. mpegvideo
  1630. mpegvideoenc
  1631. mss34dsp
  1632. pixblockdsp
  1633. qpeldsp
  1634. qsv
  1635. qsvdec
  1636. qsvenc
  1637. qsvvpp
  1638. rangecoder
  1639. riffdec
  1640. riffenc
  1641. rtpdec
  1642. rtpenc_chain
  1643. rv34dsp
  1644. sinewin
  1645. snappy
  1646. srtp
  1647. startcode
  1648. texturedsp
  1649. texturedspenc
  1650. tpeldsp
  1651. vaapi_encode
  1652. vc1dsp
  1653. videodsp
  1654. vp3dsp
  1655. vp56dsp
  1656. vp8dsp
  1657. wma_freqs
  1658. wmv2dsp
  1659. "
  1660. CMDLINE_SELECT="
  1661. $ARCH_EXT_LIST
  1662. $CONFIG_LIST
  1663. $HAVE_LIST_CMDLINE
  1664. $THREADS_LIST
  1665. asm
  1666. cross_compile
  1667. debug
  1668. extra_warnings
  1669. logging
  1670. lto
  1671. optimizations
  1672. rpath
  1673. "
  1674. PATHS_LIST="
  1675. bindir
  1676. datadir
  1677. docdir
  1678. incdir
  1679. libdir
  1680. mandir
  1681. prefix
  1682. shlibdir
  1683. "
  1684. CMDLINE_SET="
  1685. $PATHS_LIST
  1686. ar
  1687. arch
  1688. as
  1689. cc
  1690. objcc
  1691. cpu
  1692. cross_prefix
  1693. custom_allocator
  1694. dep_cc
  1695. env
  1696. extra_version
  1697. host_cc
  1698. host_cflags
  1699. host_extralibs
  1700. host_ld
  1701. host_ldflags
  1702. host_os
  1703. ignore_tests
  1704. ld
  1705. logfile
  1706. malloc_prefix
  1707. nm
  1708. optflags
  1709. pkg_config
  1710. pkg_config_flags
  1711. samples
  1712. sysinclude
  1713. sysroot
  1714. target_exec
  1715. target_os
  1716. target_path
  1717. target_samples
  1718. toolchain
  1719. x86asmexe
  1720. "
  1721. CMDLINE_APPEND="
  1722. extra_cflags
  1723. extra_objcflags
  1724. host_cppflags
  1725. "
  1726. # code dependency declarations
  1727. # architecture extensions
  1728. armv5te_deps="arm"
  1729. armv6_deps="arm"
  1730. armv6t2_deps="arm"
  1731. armv8_deps="aarch64"
  1732. neon_deps_any="aarch64 arm"
  1733. intrinsics_neon_deps="neon"
  1734. vfp_deps_any="aarch64 arm"
  1735. vfpv3_deps="vfp"
  1736. map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
  1737. altivec_deps="ppc"
  1738. dcbzl_deps="ppc"
  1739. ldbrx_deps="ppc"
  1740. ppc4xx_deps="ppc"
  1741. vsx_deps="altivec"
  1742. power8_deps="vsx"
  1743. loongson_deps="mips"
  1744. mips32r1_deps="mips32"
  1745. mips32r2_deps="mips32"
  1746. mips32r6_deps="mips32"
  1747. mips64r1_deps="mips64"
  1748. mips64r2_deps="mips64"
  1749. mips64r6_deps="mips64"
  1750. vis_deps="sparc"
  1751. cpunop_deps="i686"
  1752. x86_64_select="i686"
  1753. x86_64_suggest="fast_cmov"
  1754. amd3dnow_deps="mmx"
  1755. amd3dnowext_deps="amd3dnow"
  1756. i686_deps="x86"
  1757. mmx_deps="x86"
  1758. mmxext_deps="mmx"
  1759. sse_deps="mmxext"
  1760. sse2_deps="sse"
  1761. sse3_deps="sse2"
  1762. ssse3_deps="sse3"
  1763. sse4_deps="ssse3"
  1764. sse42_deps="sse4"
  1765. avx_deps="sse42"
  1766. xop_deps="avx"
  1767. fma3_deps="avx"
  1768. fma4_deps="avx"
  1769. avx2_deps="avx"
  1770. mmx_external_deps="x86asm"
  1771. mmx_inline_deps="inline_asm x86"
  1772. mmx_suggest="mmx_external mmx_inline"
  1773. for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
  1774. eval dep=\$${ext}_deps
  1775. eval ${ext}_external_deps='"${dep}_external"'
  1776. eval ${ext}_inline_deps='"${dep}_inline"'
  1777. eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
  1778. done
  1779. aligned_stack_if_any="aarch64 ppc x86"
  1780. fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1781. fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
  1782. fast_unaligned_if_any="aarch64 ppc x86"
  1783. simd_align_16_if_any="altivec neon sse"
  1784. simd_align_32_if_any="avx"
  1785. # system capabilities
  1786. symver_if_any="symver_asm_label symver_gnu_asm"
  1787. valgrind_backtrace_conflict="optimizations"
  1788. valgrind_backtrace_deps="valgrind_valgrind_h"
  1789. # threading support
  1790. atomics_gcc_if="sync_val_compare_and_swap"
  1791. atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
  1792. atomics_win32_if="MemoryBarrier"
  1793. atomics_native_if_any="$ATOMICS_LIST"
  1794. w32threads_deps="atomics_native"
  1795. threads_if_any="$THREADS_LIST"
  1796. # subsystems
  1797. cbs_h264_select="cbs golomb"
  1798. cbs_h265_select="cbs golomb"
  1799. cbs_mpeg2_select="cbs"
  1800. dct_select="rdft"
  1801. dirac_parse_select="golomb"
  1802. error_resilience_select="me_cmp"
  1803. faandct_deps="faan"
  1804. faandct_select="fdctdsp"
  1805. faanidct_deps="faan"
  1806. faanidct_select="idctdsp"
  1807. h264dsp_select="startcode"
  1808. hevcparse_select="golomb"
  1809. intrax8_select="blockdsp idctdsp"
  1810. mdct_select="fft"
  1811. rdft_select="fft"
  1812. me_cmp_select="fdctdsp idctdsp pixblockdsp"
  1813. mpeg_er_select="error_resilience"
  1814. mpegaudio_select="mpegaudiodsp mpegaudioheader"
  1815. mpegaudiodsp_select="dct"
  1816. mpegvideo_select="blockdsp hpeldsp idctdsp me_cmp mpeg_er videodsp"
  1817. mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
  1818. vc1dsp_select="h264chroma qpeldsp startcode"
  1819. # decoders / encoders
  1820. aac_decoder_select="adts_header imdct15 mdct sinewin"
  1821. aac_encoder_select="audio_frame_queue iirfilter mdct sinewin"
  1822. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1823. ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
  1824. ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
  1825. ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
  1826. adpcm_g722_decoder_select="g722dsp"
  1827. adpcm_g722_encoder_select="g722dsp"
  1828. aic_decoder_select="golomb idctdsp"
  1829. alac_encoder_select="lpc"
  1830. als_decoder_select="bswapdsp"
  1831. amrnb_decoder_select="lsp"
  1832. amrwb_decoder_select="lsp"
  1833. amv_decoder_select="sp5x_decoder"
  1834. ape_decoder_select="bswapdsp"
  1835. asv1_decoder_select="blockdsp bswapdsp idctdsp"
  1836. asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
  1837. asv2_decoder_select="blockdsp bswapdsp idctdsp"
  1838. asv2_encoder_select="bswapdsp fdctdsp pixblockdsp"
  1839. atrac1_decoder_select="mdct sinewin"
  1840. atrac3_decoder_select="mdct"
  1841. atrac3p_decoder_select="mdct sinewin"
  1842. bink_decoder_select="blockdsp hpeldsp"
  1843. binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
  1844. binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
  1845. cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
  1846. clearvideo_decoder_select="idctdsp"
  1847. cllc_decoder_select="bswapdsp"
  1848. comfortnoise_encoder_select="lpc"
  1849. cook_decoder_select="audiodsp mdct sinewin"
  1850. cscd_decoder_select="lzo"
  1851. cscd_decoder_suggest="zlib"
  1852. dca_decoder_select="fmtconvert mdct"
  1853. dds_decoder_select="texturedsp"
  1854. dnxhd_decoder_select="blockdsp idctdsp"
  1855. dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
  1856. dvvideo_decoder_select="dvprofile idctdsp"
  1857. dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
  1858. dxa_decoder_deps="zlib"
  1859. dxv_decoder_select="lzf texturedsp"
  1860. eac3_decoder_select="ac3_decoder"
  1861. eac3_encoder_select="ac3_encoder"
  1862. eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
  1863. eatgq_decoder_select="aandcttables idctdsp"
  1864. eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
  1865. exr_decoder_deps="zlib"
  1866. ffv1_decoder_select="rangecoder"
  1867. ffv1_encoder_select="rangecoder"
  1868. ffvhuff_decoder_select="huffyuv_decoder"
  1869. ffvhuff_encoder_select="huffyuv_encoder"
  1870. fic_decoder_select="golomb"
  1871. flac_decoder_select="flacdsp"
  1872. flac_encoder_select="bswapdsp flacdsp lpc"
  1873. flashsv_decoder_deps="zlib"
  1874. flashsv_encoder_deps="zlib"
  1875. flashsv2_decoder_deps="zlib"
  1876. flv_decoder_select="h263_decoder"
  1877. flv_encoder_select="h263_encoder"
  1878. fourxm_decoder_select="blockdsp bswapdsp"
  1879. fraps_decoder_select="bswapdsp huffman"
  1880. g2m_decoder_deps="zlib"
  1881. g2m_decoder_select="blockdsp idctdsp jpegtables"
  1882. h261_decoder_select="mpeg_er mpegvideo"
  1883. h261_encoder_select="aandcttables mpegvideoenc"
  1884. h263_decoder_select="error_resilience h263_parser h263dsp mpeg_er mpegvideo qpeldsp"
  1885. h263_encoder_select="aandcttables h263dsp mpegvideoenc"
  1886. h263i_decoder_select="h263_decoder"
  1887. h263p_encoder_select="h263_encoder"
  1888. h264_decoder_select="cabac golomb h264chroma h264dsp h264parse h264pred h264qpel videodsp"
  1889. h264_decoder_suggest="error_resilience"
  1890. hap_decoder_select="snappy texturedsp"
  1891. hap_encoder_deps="libsnappy"
  1892. hap_encoder_select="texturedspenc"
  1893. hevc_decoder_select="bswapdsp cabac hevcparse videodsp"
  1894. huffyuv_decoder_select="bswapdsp huffyuvdsp"
  1895. huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp"
  1896. iac_decoder_select="imc_decoder"
  1897. imc_decoder_select="bswapdsp fft mdct sinewin"
  1898. indeo3_decoder_select="hpeldsp"
  1899. indeo4_decoder_select="ividsp"
  1900. indeo5_decoder_select="ividsp"
  1901. interplay_video_decoder_select="hpeldsp"
  1902. jpegls_decoder_select="mjpeg_decoder"
  1903. jv_decoder_select="blockdsp"
  1904. lagarith_decoder_select="huffyuvdsp"
  1905. ljpeg_encoder_select="aandcttables idctdsp jpegtables"
  1906. magicyuv_decoder_select="huffyuvdsp"
  1907. mdec_decoder_select="blockdsp idctdsp mpegvideo"
  1908. metasound_decoder_select="lsp mdct sinewin"
  1909. mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
  1910. mjpeg_decoder_select="blockdsp hpeldsp idctdsp jpegtables"
  1911. mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc"
  1912. mjpegb_decoder_select="mjpeg_decoder"
  1913. mlp_decoder_select="mlp_parser"
  1914. motionpixels_decoder_select="bswapdsp"
  1915. mp1_decoder_select="mpegaudio"
  1916. mp1float_decoder_select="mpegaudio"
  1917. mp2_decoder_select="mpegaudio"
  1918. mp2float_decoder_select="mpegaudio"
  1919. mp3_decoder_select="mpegaudio"
  1920. mp3adu_decoder_select="mpegaudio"
  1921. mp3adufloat_decoder_select="mpegaudio"
  1922. mp3float_decoder_select="mpegaudio"
  1923. mp3on4_decoder_select="mpegaudio"
  1924. mp3on4float_decoder_select="mpegaudio"
  1925. mpc7_decoder_select="bswapdsp mpegaudiodsp"
  1926. mpc8_decoder_select="mpegaudiodsp"
  1927. mpeg1video_decoder_select="error_resilience mpeg_er mpegvideo"
  1928. mpeg1video_encoder_select="aandcttables mpegvideoenc"
  1929. mpeg2video_decoder_select="error_resilience mpeg_er mpegvideo"
  1930. mpeg2video_encoder_select="aandcttables mpegvideoenc"
  1931. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1932. mpeg4_encoder_select="h263_encoder"
  1933. msa1_decoder_select="mss34dsp"
  1934. msmpeg4v1_decoder_select="h263_decoder"
  1935. msmpeg4v2_decoder_select="h263_decoder"
  1936. msmpeg4v2_encoder_select="h263_encoder"
  1937. msmpeg4v3_decoder_select="h263_decoder"
  1938. msmpeg4v3_encoder_select="h263_encoder"
  1939. mss2_decoder_select="error_resilience mpeg_er mpegvideo qpeldsp vc1_decoder"
  1940. mts2_decoder_select="mss34dsp"
  1941. mxpeg_decoder_select="mjpeg_decoder"
  1942. nellymoser_decoder_select="mdct sinewin"
  1943. nellymoser_encoder_select="audio_frame_queue mdct sinewin"
  1944. nuv_decoder_select="idctdsp lzo"
  1945. on2avc_decoder_select="mdct"
  1946. opus_decoder_deps="avresample"
  1947. opus_decoder_select="imdct15"
  1948. png_decoder_deps="zlib"
  1949. png_encoder_deps="zlib"
  1950. png_encoder_select="huffyuvencdsp"
  1951. prores_decoder_select="idctdsp"
  1952. prores_encoder_select="fdctdsp"
  1953. qcelp_decoder_select="lsp"
  1954. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1955. ra_144_encoder_select="audio_frame_queue lpc"
  1956. ralf_decoder_select="golomb"
  1957. rscc_decoder_deps="zlib"
  1958. rv10_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
  1959. rv10_encoder_select="h263_encoder"
  1960. rv20_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
  1961. rv20_encoder_select="h263_encoder"
  1962. rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo rv34dsp videodsp"
  1963. rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo rv34dsp videodsp"
  1964. screenpresso_decoder_deps="zlib"
  1965. sipr_decoder_select="lsp"
  1966. sp5x_decoder_select="mjpeg_decoder"
  1967. svq1_decoder_select="hpeldsp"
  1968. svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
  1969. svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp videodsp"
  1970. svq3_decoder_suggest="zlib"
  1971. tak_decoder_select="audiodsp"
  1972. tdsc_decoder_deps="zlib"
  1973. tdsc_decoder_select="mjpeg_decoder"
  1974. theora_decoder_select="vp3_decoder"
  1975. thp_decoder_select="mjpeg_decoder"
  1976. tiff_decoder_suggest="zlib"
  1977. tiff_encoder_suggest="zlib"
  1978. truehd_decoder_select="mlp_decoder"
  1979. truemotion2_decoder_select="bswapdsp"
  1980. truespeech_decoder_select="bswapdsp"
  1981. tscc_decoder_deps="zlib"
  1982. txd_decoder_select="texturedsp"
  1983. twinvq_decoder_select="mdct lsp sinewin"
  1984. utvideo_decoder_select="bswapdsp huffyuvdsp"
  1985. utvideo_encoder_select="bswapdsp huffman huffyuvencdsp"
  1986. vble_decoder_select="huffyuvdsp"
  1987. vc1_decoder_select="blockdsp error_resilience h263_decoder h264qpel intrax8 mpeg_er mpegvideo vc1dsp"
  1988. vc1image_decoder_select="vc1_decoder"
  1989. vorbis_decoder_select="mdct"
  1990. vorbis_encoder_select="mdct"
  1991. vp3_decoder_select="hpeldsp vp3dsp videodsp"
  1992. vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp"
  1993. vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp vp56dsp"
  1994. vp6a_decoder_select="vp6_decoder"
  1995. vp6f_decoder_select="vp6_decoder"
  1996. vp7_decoder_select="h264pred videodsp vp8dsp"
  1997. vp8_decoder_select="h264pred videodsp vp8dsp"
  1998. vp9_decoder_select="videodsp vp9_superframe_split_bsf"
  1999. webp_decoder_select="vp8_decoder"
  2000. wmapro_decoder_select="mdct sinewin wma_freqs"
  2001. wmav1_decoder_select="mdct sinewin wma_freqs"
  2002. wmav1_encoder_select="mdct sinewin wma_freqs"
  2003. wmav2_decoder_select="mdct sinewin wma_freqs"
  2004. wmav2_encoder_select="mdct sinewin wma_freqs"
  2005. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  2006. wmv1_decoder_select="h263_decoder"
  2007. wmv1_encoder_select="h263_encoder"
  2008. wmv2_decoder_select="blockdsp error_resilience h263_decoder idctdsp intrax8 videodsp wmv2dsp"
  2009. wmv2_encoder_select="h263_encoder wmv2dsp"
  2010. wmv3_decoder_select="vc1_decoder"
  2011. wmv3image_decoder_select="wmv3_decoder"
  2012. zerocodec_decoder_deps="zlib"
  2013. zlib_decoder_deps="zlib"
  2014. zlib_encoder_deps="zlib"
  2015. zmbv_decoder_deps="zlib"
  2016. zmbv_encoder_deps="zlib"
  2017. # hardware accelerators
  2018. d3d11va_deps="dxva_h ID3D11VideoDecoder"
  2019. dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32"
  2020. vda_deps="VideoDecodeAcceleration_VDADecoder_h blocks_extension pthreads"
  2021. vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
  2022. h263_vaapi_hwaccel_deps="vaapi"
  2023. h263_vaapi_hwaccel_select="h263_decoder"
  2024. h264_cuvid_hwaccel_deps="cuvid CUVIDH264PICPARAMS"
  2025. h264_cuvid_hwaccel_select="h264_decoder"
  2026. h264_d3d11va_hwaccel_deps="d3d11va"
  2027. h264_d3d11va_hwaccel_select="h264_decoder"
  2028. h264_d3d11va2_hwaccel_deps="d3d11va"
  2029. h264_d3d11va2_hwaccel_select="h264_decoder"
  2030. h264_dxva2_hwaccel_deps="dxva2"
  2031. h264_dxva2_hwaccel_select="h264_decoder"
  2032. h264_vaapi_hwaccel_deps="vaapi"
  2033. h264_vaapi_hwaccel_select="h264_decoder"
  2034. h264_vda_hwaccel_deps="vda"
  2035. h264_vda_hwaccel_select="h264_decoder"
  2036. h264_vda_old_hwaccel_deps="vda"
  2037. h264_vda_old_hwaccel_select="h264_decoder"
  2038. h264_vdpau_hwaccel_deps="vdpau"
  2039. h264_vdpau_hwaccel_select="h264_decoder"
  2040. hevc_cuvid_hwaccel_deps="cuvid CUVIDHEVCPICPARAMS"
  2041. hevc_cuvid_hwaccel_select="hevc_decoder"
  2042. hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
  2043. hevc_d3d11va_hwaccel_select="hevc_decoder"
  2044. hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
  2045. hevc_d3d11va2_hwaccel_select="hevc_decoder"
  2046. hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
  2047. hevc_dxva2_hwaccel_select="hevc_decoder"
  2048. hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
  2049. hevc_vaapi_hwaccel_select="hevc_decoder"
  2050. hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
  2051. hevc_vdpau_hwaccel_select="hevc_decoder"
  2052. mpeg1_vdpau_hwaccel_deps="vdpau"
  2053. mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
  2054. mpeg2_d3d11va_hwaccel_deps="d3d11va"
  2055. mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
  2056. mpeg2_d3d11va2_hwaccel_deps="d3d11va"
  2057. mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder"
  2058. mpeg2_dxva2_hwaccel_deps="dxva2"
  2059. mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
  2060. mpeg2_vaapi_hwaccel_deps="vaapi"
  2061. mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
  2062. mpeg2_vdpau_hwaccel_deps="vdpau"
  2063. mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
  2064. mpeg4_vaapi_hwaccel_deps="vaapi"
  2065. mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
  2066. mpeg4_vdpau_hwaccel_deps="vdpau"
  2067. mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
  2068. vc1_d3d11va_hwaccel_deps="d3d11va"
  2069. vc1_d3d11va_hwaccel_select="vc1_decoder"
  2070. vc1_d3d11va2_hwaccel_deps="d3d11va"
  2071. vc1_d3d11va2_hwaccel_select="vc1_decoder"
  2072. vc1_dxva2_hwaccel_deps="dxva2"
  2073. vc1_dxva2_hwaccel_select="vc1_decoder"
  2074. vc1_vaapi_hwaccel_deps="vaapi"
  2075. vc1_vaapi_hwaccel_select="vc1_decoder"
  2076. vc1_vdpau_hwaccel_deps="vdpau"
  2077. vc1_vdpau_hwaccel_select="vc1_decoder"
  2078. vp8_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferVP8"
  2079. vp8_vaapi_hwaccel_select="vp8_decoder"
  2080. wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
  2081. wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel"
  2082. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  2083. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  2084. wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
  2085. # hardware-accelerated codecs
  2086. amf_deps_any="libdl LoadLibrary"
  2087. nvenc_deps_any="libdl LoadLibrary"
  2088. omx_deps="libdl pthreads"
  2089. omx_rpi_select="omx"
  2090. qsv_deps="libmfx"
  2091. qsvdec_select="qsv"
  2092. qsvenc_select="qsv"
  2093. qsvvpp_select="qsv"
  2094. vaapi_encode_deps="vaapi"
  2095. hwupload_cuda_filter_deps="cuda"
  2096. scale_npp_filter_deps="cuda libnpp"
  2097. h264_amf_encoder_deps="amf"
  2098. h264_mmal_decoder_deps="mmal"
  2099. h264_nvenc_encoder_deps="nvenc"
  2100. h264_omx_encoder_deps="omx"
  2101. h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec"
  2102. h264_qsv_encoder_select="qsvenc"
  2103. h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
  2104. h264_vaapi_encoder_select="cbs_h264 vaapi_encode"
  2105. hevc_amf_encoder_deps="amf"
  2106. hevc_nvenc_encoder_deps="nvenc"
  2107. hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec"
  2108. hevc_qsv_encoder_select="hevcparse qsvenc"
  2109. hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
  2110. hevc_vaapi_encoder_select="cbs_h265 vaapi_encode"
  2111. mjpeg_qsv_encoder_deps="libmfx"
  2112. mjpeg_qsv_encoder_select="qsvenc"
  2113. mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
  2114. mjpeg_vaapi_encoder_select="vaapi_encode jpegtables"
  2115. mpeg2_mmal_decoder_deps="mmal"
  2116. mpeg2_qsv_decoder_select="qsvdec mpegvideo_parser"
  2117. mpeg2_qsv_encoder_select="qsvenc"
  2118. mpeg2_vaapi_encoder_deps="VAEncPictureParameterBufferMPEG2"
  2119. mpeg2_vaapi_encoder_select="cbs_mpeg2 vaapi_encode"
  2120. mpeg4_omx_encoder_deps="omx"
  2121. vc1_mmal_decoder_deps="mmal"
  2122. vc1_qsv_decoder_select="qsvdec vc1_parser"
  2123. vp8_qsv_decoder_select="qsvdec vp8_parser"
  2124. vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
  2125. vp8_vaapi_encoder_select="vaapi_encode"
  2126. vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9"
  2127. vp9_vaapi_encoder_select="vaapi_encode"
  2128. nvenc_h264_encoder_select="h264_nvenc_encoder"
  2129. nvenc_hevc_encoder_select="hevc_nvenc_encoder"
  2130. # parsers
  2131. aac_parser_select="adts_header"
  2132. h264_parser_select="golomb h264dsp h264parse"
  2133. hevc_parser_select="hevcparse"
  2134. mpegaudio_parser_select="mpegaudioheader"
  2135. mpegvideo_parser_select="mpegvideo"
  2136. mpeg4video_parser_select="error_resilience h263dsp mpegvideo qpeldsp"
  2137. vc1_parser_select="vc1dsp"
  2138. # bitstream_filters
  2139. aac_adtstoasc_bsf_select="adts_header"
  2140. h264_metadata_bsf_select="cbs_h264"
  2141. h264_redundant_pps_bsf_select="cbs_h264"
  2142. hevc_metadata_bsf_select="cbs_h265"
  2143. mjpeg2jpeg_bsf_select="jpegtables"
  2144. mpeg2_metadata_bsf_select="cbs_mpeg2"
  2145. trace_headers_bsf_select="cbs_h264 cbs_h265 cbs_mpeg2"
  2146. # external libraries
  2147. avisynth_deps="LoadLibrary"
  2148. avxsynth_deps="libdl"
  2149. avisynth_demuxer_deps_any="avisynth avxsynth"
  2150. avisynth_demuxer_select="riffdec"
  2151. libaom_av1_decoder_deps="libaom"
  2152. libaom_av1_encoder_deps="libaom"
  2153. libdcadec_decoder_deps="libdcadec"
  2154. libfaac_encoder_deps="libfaac"
  2155. libfaac_encoder_select="audio_frame_queue"
  2156. libfdk_aac_decoder_deps="libfdk_aac"
  2157. libfdk_aac_encoder_deps="libfdk_aac"
  2158. libfdk_aac_encoder_select="audio_frame_queue"
  2159. libgsm_decoder_deps="libgsm"
  2160. libgsm_encoder_deps="libgsm"
  2161. libgsm_ms_decoder_deps="libgsm"
  2162. libgsm_ms_encoder_deps="libgsm"
  2163. libilbc_decoder_deps="libilbc"
  2164. libilbc_encoder_deps="libilbc"
  2165. libkvazaar_encoder_deps="libkvazaar"
  2166. libmp3lame_encoder_deps="libmp3lame"
  2167. libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
  2168. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  2169. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  2170. libopencore_amrnb_encoder_select="audio_frame_queue"
  2171. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  2172. libopenh264_decoder_deps="libopenh264"
  2173. libopenh264_decoder_select="h264_mp4toannexb_bsf"
  2174. libopenh264_encoder_deps="libopenh264"
  2175. libopenjpeg_decoder_deps="libopenjpeg"
  2176. libopenjpeg_encoder_deps="libopenjpeg"
  2177. libopus_decoder_deps="libopus"
  2178. libopus_encoder_deps="libopus"
  2179. libopus_encoder_select="audio_frame_queue"
  2180. libschroedinger_decoder_deps="libschroedinger"
  2181. libschroedinger_encoder_deps="libschroedinger"
  2182. libspeex_decoder_deps="libspeex"
  2183. libspeex_encoder_deps="libspeex"
  2184. libspeex_encoder_select="audio_frame_queue"
  2185. libtheora_encoder_deps="libtheora"
  2186. libtwolame_encoder_deps="libtwolame"
  2187. libvo_aacenc_encoder_deps="libvo_aacenc"
  2188. libvo_aacenc_encoder_select="audio_frame_queue"
  2189. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  2190. libvorbis_encoder_deps="libvorbis"
  2191. libvorbis_encoder_select="audio_frame_queue"
  2192. libvpx_vp8_decoder_deps="libvpx"
  2193. libvpx_vp8_encoder_deps="libvpx"
  2194. libvpx_vp9_decoder_deps="libvpx"
  2195. libvpx_vp9_encoder_deps="libvpx"
  2196. libwavpack_encoder_deps="libwavpack"
  2197. libwavpack_encoder_select="audio_frame_queue"
  2198. libwebp_encoder_deps="libwebp"
  2199. libx262_encoder_deps="libx262"
  2200. libx264_encoder_deps="libx264"
  2201. libx265_encoder_deps="libx265"
  2202. libxavs_encoder_deps="libxavs"
  2203. libxvid_encoder_deps="libxvid mkstemp"
  2204. # demuxers / muxers
  2205. ac3_demuxer_select="ac3_parser"
  2206. asf_demuxer_select="riffdec"
  2207. asf_muxer_select="riffenc"
  2208. asf_stream_muxer_select="asf_muxer"
  2209. avi_demuxer_select="iso_media riffdec"
  2210. avi_muxer_select="riffenc"
  2211. caf_demuxer_select="iso_media riffdec"
  2212. dash_muxer_select="mp4_muxer"
  2213. dirac_demuxer_select="dirac_parser"
  2214. dv_demuxer_select="dvprofile"
  2215. dv_muxer_select="dvprofile"
  2216. dxa_demuxer_select="riffdec"
  2217. eac3_demuxer_select="ac3_parser"
  2218. f4v_muxer_select="mov_muxer"
  2219. flac_demuxer_select="flac_parser"
  2220. hds_muxer_select="flv_muxer"
  2221. hls_muxer_select="mpegts_muxer"
  2222. ipod_muxer_select="mov_muxer"
  2223. ismv_muxer_select="mov_muxer"
  2224. matroska_audio_muxer_select="matroska_muxer"
  2225. matroska_demuxer_select="iso_media riffdec"
  2226. matroska_demuxer_suggest="bzlib lzo zlib"
  2227. matroska_muxer_select="iso_media riffenc"
  2228. mmf_muxer_select="riffenc"
  2229. mov_demuxer_select="iso_media riffdec"
  2230. mov_demuxer_suggest="zlib"
  2231. mov_muxer_select="iso_media riffenc rtpenc_chain"
  2232. mp3_demuxer_select="mpegaudio_parser"
  2233. mp3_muxer_select="mpegaudioheader"
  2234. mp4_muxer_select="mov_muxer"
  2235. mpegts_demuxer_select="iso_media"
  2236. mpegts_muxer_select="adts_muxer latm_muxer"
  2237. mpegtsraw_demuxer_select="mpegts_demuxer"
  2238. mxf_d10_muxer_select="mxf_muxer"
  2239. nut_muxer_select="riffenc"
  2240. nuv_demuxer_select="riffdec"
  2241. oga_muxer_select="ogg_muxer"
  2242. ogg_demuxer_select="dirac_parse"
  2243. opus_muxer_select="ogg_muxer"
  2244. psp_muxer_select="mov_muxer"
  2245. rtp_demuxer_select="sdp_demuxer"
  2246. rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
  2247. rtsp_demuxer_select="http_protocol rtpdec"
  2248. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  2249. sap_demuxer_select="sdp_demuxer"
  2250. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  2251. sdp_demuxer_select="rtpdec"
  2252. smoothstreaming_muxer_select="ismv_muxer"
  2253. spdif_demuxer_select="adts_header"
  2254. spdif_muxer_select="adts_header"
  2255. spx_muxer_select="ogg_muxer"
  2256. swf_demuxer_suggest="zlib"
  2257. tak_demuxer_select="tak_parser"
  2258. tg2_muxer_select="mov_muxer"
  2259. tgp_muxer_select="mov_muxer"
  2260. w64_demuxer_select="wav_demuxer"
  2261. wav_demuxer_select="riffdec"
  2262. wav_muxer_select="riffenc"
  2263. webm_muxer_select="iso_media riffenc"
  2264. wtv_demuxer_select="mpegts_demuxer riffdec"
  2265. xmv_demuxer_select="riffdec"
  2266. xwma_demuxer_select="riffdec"
  2267. # indevs
  2268. alsa_indev_deps="alsa"
  2269. avfoundation_indev_deps="AVFoundation_AVFoundation_h objc_arc pthreads"
  2270. avfoundation_indev_extralibs="-framework Foundation -framework AVFoundation -framework CoreVideo -framework CoreMedia"
  2271. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  2272. fbdev_indev_deps="linux_fb_h"
  2273. jack_indev_deps="libjack"
  2274. jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
  2275. libcdio_indev_deps="libcdio"
  2276. libdc1394_indev_deps="libdc1394"
  2277. oss_indev_deps_any="sys_soundcard_h"
  2278. pulse_indev_deps="libpulse"
  2279. sndio_indev_deps="sndio"
  2280. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  2281. vfwcap_indev_deps="vfw32 vfwcap_defines"
  2282. xcbgrab_indev_deps="libxcb libxcb_shape"
  2283. xcbgrab_indev_suggest="libxcb_shm libxcb_xfixes"
  2284. # protocols
  2285. ffrtmpcrypt_protocol_conflict="librtmp_protocol"
  2286. ffrtmpcrypt_protocol_deps_any="gmp openssl"
  2287. ffrtmpcrypt_protocol_select="tcp_protocol"
  2288. ffrtmphttp_protocol_conflict="librtmp_protocol"
  2289. ffrtmphttp_protocol_select="http_protocol"
  2290. gopher_protocol_select="network"
  2291. http_protocol_select="tcp_protocol"
  2292. http_protocol_suggest="zlib"
  2293. httpproxy_protocol_select="tcp_protocol"
  2294. httpproxy_protocol_suggest="zlib"
  2295. https_protocol_select="tls_protocol"
  2296. https_protocol_suggest="zlib"
  2297. icecast_protocol_select="http_protocol"
  2298. librtmp_protocol_deps="librtmp"
  2299. librtmpe_protocol_deps="librtmp"
  2300. librtmps_protocol_deps="librtmp"
  2301. librtmpt_protocol_deps="librtmp"
  2302. librtmpte_protocol_deps="librtmp"
  2303. mmsh_protocol_select="http_protocol"
  2304. mmst_protocol_select="network"
  2305. libsrt_protocol_deps="libsrt"
  2306. libsrt_protocol_select="network"
  2307. rtmp_protocol_conflict="librtmp_protocol"
  2308. rtmp_protocol_select="tcp_protocol"
  2309. rtmp_protocol_suggest="zlib"
  2310. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  2311. rtmpe_protocol_suggest="zlib"
  2312. rtmps_protocol_conflict="librtmp_protocol"
  2313. rtmps_protocol_select="tls_protocol"
  2314. rtmps_protocol_suggest="zlib"
  2315. rtmpt_protocol_select="ffrtmphttp_protocol"
  2316. rtmpt_protocol_suggest="zlib"
  2317. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  2318. rtmpte_protocol_suggest="zlib"
  2319. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  2320. rtmpts_protocol_suggest="zlib"
  2321. rtp_protocol_select="udp_protocol"
  2322. sctp_protocol_deps="struct_sctp_event_subscribe"
  2323. sctp_protocol_select="network"
  2324. srtp_protocol_select="rtp_protocol srtp"
  2325. tcp_protocol_select="network"
  2326. tls_protocol_deps_any="gnutls openssl"
  2327. tls_protocol_select="tcp_protocol"
  2328. udp_protocol_select="network"
  2329. unix_protocol_deps="sys_un_h"
  2330. unix_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="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 wincrypt_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. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  3746. elif test_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  3747. eval ${pfx}libc_type=mingw64
  3748. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3749. eval test \$${pfx_no_}cc_type = "gcc" &&
  3750. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3751. elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  3752. test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  3753. eval ${pfx}libc_type=mingw32
  3754. test_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  3755. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  3756. die "ERROR: MinGW32 runtime version must be >= 3.15."
  3757. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3758. test_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
  3759. add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
  3760. test_${pfx}cpp_condition windows.h "defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0502" &&
  3761. add_${pfx}cppflags -D_WIN32_WINNT=0x0502
  3762. eval test \$${pfx_no_}cc_type = "gcc" &&
  3763. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3764. elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  3765. eval ${pfx}libc_type=msvcrt
  3766. if test_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
  3767. if [ "$pfx" = host_ ]; then
  3768. add_host_cppflags -Dsnprintf=_snprintf
  3769. else
  3770. add_compat strtod.o strtod=avpriv_strtod
  3771. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  3772. _snprintf=avpriv_snprintf \
  3773. vsnprintf=avpriv_vsnprintf
  3774. fi
  3775. fi
  3776. add_${pfx}cppflags -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS
  3777. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  3778. # 0x601 by default unless something else is set by the user.
  3779. # This can easily lead to us detecting functions only present
  3780. # in such new versions and producing binaries requiring windows 7.0.
  3781. # Therefore explicitly set the default to XP unless the user has
  3782. # set something else on the command line.
  3783. # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
  3784. # family. For these cases, configure is free to use any functions
  3785. # found in the SDK headers by default. (Alternatively, we could force
  3786. # _WIN32_WINNT to 0x0602 in that case.)
  3787. test_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  3788. { test_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0502; }
  3789. #ifdef WINAPI_FAMILY
  3790. #include <winapifamily.h>
  3791. #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  3792. #error not desktop
  3793. #endif
  3794. #endif
  3795. EOF
  3796. if [ "$pfx" = "" ]; then
  3797. check_func strtoll || add_cflags -Dstrtoll=_strtoi64
  3798. fi
  3799. elif test_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  3800. eval ${pfx}libc_type=klibc
  3801. elif test_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  3802. eval ${pfx}libc_type=bionic
  3803. elif test_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  3804. eval ${pfx}libc_type=solaris
  3805. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  3806. else
  3807. eval ${pfx}libc_type=default
  3808. add_${pfx}cppflags -D_DEFAULT_SOURCE
  3809. fi
  3810. eval test -n "\${${pfx}libc_type}" && enable ${pfx}libc_${libc_type}
  3811. }
  3812. probe_libc
  3813. probe_libc host_
  3814. # hacks for compiler/libc/os combinations
  3815. case $libc_type in
  3816. bionic)
  3817. add_compat strtod.o strtod=avpriv_strtod
  3818. ;;
  3819. esac
  3820. check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
  3821. add_cppflags '-I\$(SRC_PATH)/compat/float'
  3822. test_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  3823. set_default $PATHS_LIST
  3824. set_default nm
  3825. disabled optimizations || check_cflags -fomit-frame-pointer
  3826. enable_weak_pic() {
  3827. disabled pic && return
  3828. enable pic
  3829. add_cppflags -DPIC
  3830. case "$target_os" in
  3831. mingw*|cygwin*|win*)
  3832. ;;
  3833. *)
  3834. add_cflags -fPIC
  3835. add_asflags -fPIC
  3836. ;;
  3837. esac
  3838. }
  3839. enabled pic && enable_weak_pic
  3840. test_cc <<EOF || die "Symbol mangling check failed."
  3841. int ff_extern;
  3842. EOF
  3843. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3844. extern_prefix=${sym%%ff_extern*}
  3845. ! disabled inline_asm && check_inline_asm inline_asm '"" ::'
  3846. for restrict_keyword in restrict __restrict__ __restrict ""; do
  3847. test_code cc "" "char * $restrict_keyword p" && break
  3848. done
  3849. check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
  3850. # The global variable ensures the bits appear unchanged in the object file.
  3851. test_cc <<EOF || die "endian test failed"
  3852. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3853. EOF
  3854. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3855. check_gas() {
  3856. log "check_gas using '$as' as AS"
  3857. # :vararg is used on aarch64, arm and ppc altivec
  3858. check_as vararg "
  3859. .macro m n, y:vararg=0
  3860. \n: .int \y
  3861. .endm
  3862. m x" || return 1
  3863. # .altmacro is only used in arm asm
  3864. ! enabled arm || check_as gnu_as ".altmacro"
  3865. }
  3866. if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
  3867. nogas=:
  3868. enabled_any arm aarch64 && nogas=die
  3869. enabled_all ppc altivec && nogas=warn
  3870. as_noop=-v
  3871. case $as_type in
  3872. arm*) gaspp_as_type=armasm; as_noop=-h ;;
  3873. gcc) gaspp_as_type=gas ;;
  3874. *) gaspp_as_type=$as_type ;;
  3875. esac
  3876. [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
  3877. test_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as $as_noop &&
  3878. gas="gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as"
  3879. if ! check_gas ; then
  3880. as=${gas:=$as}
  3881. check_gas || \
  3882. $nogas "GNU assembler not found, install/update gas-preprocessor"
  3883. fi
  3884. check_as as_func ".func test
  3885. .endfunc"
  3886. fi
  3887. check_inline_asm inline_asm_labels '"1:\n"'
  3888. if enabled aarch64; then
  3889. enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
  3890. # internal assembler in clang 3.3 does not support this instruction
  3891. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  3892. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  3893. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  3894. elif enabled alpha; then
  3895. check_cflags -mieee
  3896. elif enabled arm; then
  3897. enabled msvc && check_cpp_condition thumb stddef.h "defined _M_ARMT"
  3898. test_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
  3899. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3900. if check_cpp_condition vfp_args stddef.h "defined __ARM_PCS_VFP"; then
  3901. :
  3902. elif check_cpp_condition vfp_args stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then
  3903. :
  3904. elif ! test_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then
  3905. case "${cross_prefix:-$cc}" in
  3906. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3907. *) check_ld vfp_args <<EOF && fpabi=vfp || fpabi=soft ;;
  3908. __asm__ (".eabi_attribute 28, 1");
  3909. int main(void) { return 0; }
  3910. EOF
  3911. esac
  3912. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3913. fi
  3914. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3915. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3916. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3917. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3918. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3919. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3920. [ $target_os = linux ] || [ $target_os = android ] ||
  3921. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3922. $ARCH_EXT_LIST_ARM
  3923. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3924. check_as as_arch_directive ".arch armv7-a"
  3925. check_as as_fpu_directive ".fpu neon"
  3926. # llvm's integrated assembler supports .object_arch from llvm 3.5
  3927. [ "$objformat" = elf32 ] || [ "$objformat" = elf64 ] &&
  3928. check_as as_object_arch ".object_arch armv4"
  3929. # MS armasm fails to assemble our PIC constructs
  3930. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  3931. elif enabled mips; then
  3932. # make sure that only one instruction set is enabled
  3933. disable $ARCH_EXT_LIST_MIPS
  3934. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3935. if enabled mips64; then
  3936. check_inline_asm mips64r6 '"dlsa $0, $0, $0, 1"' ||
  3937. check_inline_asm mips64r2 '"dext $0, $0, 0, 1"' ||
  3938. check_inline_asm mips64r1 '"daddi $0, $0, 0"'
  3939. else
  3940. check_inline_asm mips32r6 '"aui $0, $0, 0"' ||
  3941. check_inline_asm mips32r2 '"ext $0, $0, 0, 1"' ||
  3942. check_inline_asm mips32r1 '"addi $0, $0, 0"'
  3943. fi
  3944. elif enabled parisc; then
  3945. if enabled gcc; then
  3946. case $($cc -dumpversion) in
  3947. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3948. esac
  3949. fi
  3950. elif enabled ppc; then
  3951. enable local_aligned_8 local_aligned_16 local_aligned_32
  3952. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3953. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3954. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3955. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3956. if enabled altivec; then
  3957. check_cflags -maltivec -mabi=altivec
  3958. # check if our compiler supports Motorola AltiVec C API
  3959. check_cc altivec altivec.h "vector signed int v1 = (vector signed int) { 0 };
  3960. vector signed int v2 = (vector signed int) { 1 };
  3961. v1 = vec_add(v1, v2);"
  3962. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3963. fi
  3964. if enabled vsx; then
  3965. check_cflags -mvsx &&
  3966. check_cc vsx altivec.h "int v[4] = { 0 };
  3967. vector signed int v1 = vec_vsx_ld(0, v);"
  3968. fi
  3969. if enabled power8; then
  3970. check_cpp_condition power8 altivec.h "defined(_ARCH_PWR8)"
  3971. fi
  3972. elif enabled x86; then
  3973. check_builtin rdtsc intrin.h "__rdtsc()"
  3974. check_builtin mm_empty mmintrin.h "_mm_empty()"
  3975. enable local_aligned_8 local_aligned_16 local_aligned_32
  3976. # check whether EBP is available on x86
  3977. # As 'i' is stored on the stack, this program will crash
  3978. # if the base pointer is used to access it because the
  3979. # base pointer is cleared in the inline assembly code.
  3980. check_exec_crash <<EOF && enable ebp_available
  3981. volatile int i=0;
  3982. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3983. return i;
  3984. EOF
  3985. # check whether EBX is available on x86
  3986. check_inline_asm ebx_available '""::"b"(0)' &&
  3987. check_inline_asm ebx_available '"":::"%ebx"'
  3988. # check whether xmm clobbers are supported
  3989. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3990. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3991. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3992. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3993. probe_x86asm(){
  3994. x86asmexe_probe=$1
  3995. if test_cmd $x86asmexe_probe -v; then
  3996. x86asmexe=$x86asmexe_probe
  3997. x86asm_type=nasm
  3998. x86asm_debug="-g -F dwarf"
  3999. X86ASMDEP=
  4000. X86ASM_DEPFLAGS='-MD $(@:.o=.d)'
  4001. elif test_cmd $x86asmexe_probe --version; then
  4002. x86asmexe=$x86asmexe_probe
  4003. x86asm_type=yasm
  4004. x86asm_debug="-g dwarf2"
  4005. X86ASMDEP='$(DEPX86ASM) $(X86ASMFLAGS) -M $(X86ASM_O) $< > $(@:.o=.d)'
  4006. X86ASM_DEPFLAGS=
  4007. fi
  4008. check_x86asm x86asm "movbe ecx, [5]"
  4009. }
  4010. if ! disabled_any asm mmx x86asm; then
  4011. disable x86asm
  4012. for program in $x86asmexe nasm yasm; do
  4013. probe_x86asm $program && break
  4014. done
  4015. disabled x86asm && die "nasm/yasm not found or too old. Use --disable-x86asm for a crippled build."
  4016. X86ASMFLAGS="-f $objformat"
  4017. enabled pic && append X86ASMFLAGS "-DPIC"
  4018. test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX"
  4019. case "$objformat" in
  4020. elf*) enabled debug && append X86ASMFLAGS $x86asm_debug ;;
  4021. esac
  4022. check_x86asm avx2_external "vextracti128 xmm0, ymm0, 0"
  4023. check_x86asm xop_external "vpmacsdd xmm0, xmm1, xmm2, xmm3"
  4024. check_x86asm fma3_external "vfmadd132ps ymm0, ymm1, ymm2"
  4025. check_x86asm fma4_external "vfmaddps ymm0, ymm1, ymm2, ymm3"
  4026. check_x86asm cpunop "CPU amdnop"
  4027. fi
  4028. case "$cpu" in
  4029. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  4030. disable fast_clz
  4031. ;;
  4032. esac
  4033. fi
  4034. check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)"
  4035. check_ldflags -Wl,--as-needed
  4036. if ! disabled network; then
  4037. check_func getaddrinfo $network_extralibs
  4038. check_func inet_aton $network_extralibs
  4039. check_type netdb.h "struct addrinfo"
  4040. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  4041. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  4042. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  4043. check_type poll.h "struct pollfd"
  4044. check_type netinet/sctp.h "struct sctp_event_subscribe"
  4045. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  4046. check_type netinet/in.h "struct sockaddr_in6"
  4047. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  4048. check_type "sys/types.h sys/socket.h" socklen_t
  4049. # Prefer arpa/inet.h over winsock2
  4050. if check_header arpa/inet.h ; then
  4051. check_func closesocket
  4052. elif check_header winsock2.h ; then
  4053. check_func_headers winsock2.h closesocket -lws2 &&
  4054. network_extralibs="-lws2" ||
  4055. { check_func_headers winsock2.h closesocket -lws2_32 &&
  4056. network_extralibs="-lws2_32"; } || disable winsock2_h network
  4057. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  4058. check_type ws2tcpip.h socklen_t
  4059. check_type ws2tcpip.h "struct addrinfo"
  4060. check_type ws2tcpip.h "struct group_source_req"
  4061. check_type ws2tcpip.h "struct ip_mreq_source"
  4062. check_type ws2tcpip.h "struct ipv6_mreq"
  4063. check_type winsock2.h "struct pollfd"
  4064. check_struct winsock2.h "struct sockaddr" sa_len
  4065. check_type ws2tcpip.h "struct sockaddr_in6"
  4066. check_type ws2tcpip.h "struct sockaddr_storage"
  4067. else
  4068. disable network
  4069. fi
  4070. fi
  4071. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  4072. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  4073. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  4074. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  4075. case "$custom_allocator" in
  4076. jemalloc)
  4077. # jemalloc by default does not use a prefix
  4078. require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc
  4079. ;;
  4080. tcmalloc)
  4081. require_pkg_config libtcmalloc libtcmalloc gperftools/tcmalloc.h tc_malloc
  4082. malloc_prefix=tc_
  4083. ;;
  4084. esac
  4085. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  4086. check_func ${malloc_prefix}memalign && enable memalign
  4087. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  4088. test_cpp_condition unistd.h "defined(_POSIX_MONOTONIC_CLOCK)" &&
  4089. { check_lib clock_gettime time.h clock_gettime ||
  4090. check_lib clock_gettime time.h clock_gettime -lrt; }
  4091. check_func fcntl
  4092. check_func gethrtime
  4093. check_func getopt
  4094. check_func getrusage
  4095. check_func gettimeofday
  4096. check_func gmtime_r
  4097. check_func isatty
  4098. check_func localtime_r
  4099. check_func mkstemp
  4100. check_func mmap
  4101. check_func mprotect
  4102. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  4103. check_func_headers time.h nanosleep || check_lib nanosleep time.h nanosleep -lrt
  4104. check_func sched_getaffinity
  4105. check_func setrlimit
  4106. check_func strerror_r
  4107. check_func sysconf
  4108. check_func sysctl
  4109. check_func usleep
  4110. check_func_headers io.h setmode
  4111. check_func_headers mach/mach_time.h mach_absolute_time
  4112. check_func_headers stdlib.h getenv
  4113. check_func_headers windows.h GetProcessAffinityMask
  4114. check_func_headers windows.h GetProcessTimes
  4115. check_func_headers windows.h GetSystemTimeAsFileTime
  4116. check_func_headers windows.h LoadLibrary
  4117. check_func_headers windows.h MapViewOfFile
  4118. check_func_headers windows.h SetConsoleTextAttribute
  4119. check_func_headers windows.h Sleep
  4120. check_func_headers windows.h VirtualAlloc
  4121. check_struct windows.h "CONDITION_VARIABLE" Ptr
  4122. check_header direct.h
  4123. check_header dxgidebug.h
  4124. check_header dxva.h
  4125. check_header dxva2api.h
  4126. check_header io.h
  4127. check_header malloc.h
  4128. check_header poll.h
  4129. check_header sys/param.h
  4130. check_header sys/resource.h
  4131. check_header sys/select.h
  4132. check_header sys/time.h
  4133. check_header sys/un.h
  4134. check_header unistd.h
  4135. check_header valgrind/valgrind.h
  4136. check_header VideoDecodeAcceleration/VDADecoder.h
  4137. check_header windows.h
  4138. # it seems there are versions of clang in some distros that try to use the
  4139. # gcc headers, which explodes for stdatomic
  4140. # so we also check that atomics actually work here
  4141. check_builtin stdatomic stdatomic.h "atomic_int foo; atomic_store(&foo, 0)"
  4142. check_lib ole32 "windows.h" CoTaskMemFree -lole32
  4143. check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  4144. check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  4145. check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  4146. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  4147. check_type "cuviddec.h" "CUVIDH264PICPARAMS"
  4148. check_type "cuviddec.h" "CUVIDHEVCPICPARAMS"
  4149. check_struct "cuviddec.h" "CUVIDDECODECREATEINFO" bitDepthMinus8
  4150. check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  4151. check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
  4152. check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
  4153. check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
  4154. check_type "va/va.h va/va_dec_vp8.h" "VAPictureParameterBufferVP8"
  4155. check_type "va/va.h va/va_vpp.h" "VAProcPipelineParameterBuffer"
  4156. check_type "va/va.h va/va_enc_h264.h" "VAEncPictureParameterBufferH264"
  4157. check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
  4158. check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
  4159. check_type "va/va.h va/va_enc_mpeg2.h" "VAEncPictureParameterBufferMPEG2"
  4160. check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8"
  4161. check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9"
  4162. check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
  4163. if ! disabled w32threads && ! enabled pthreads; then
  4164. check_lib w32threads "windows.h process.h" _beginthreadex
  4165. fi
  4166. # check for some common methods of building with pthread support
  4167. # do this before the optional library checks as some of them require pthreads
  4168. if ! disabled pthreads && ! enabled w32threads; then
  4169. if check_lib pthreads pthread.h pthread_join -pthread; then
  4170. add_cflags -pthread
  4171. elif check_lib pthreads pthread.h pthread_join -pthreads; then
  4172. add_cflags -pthreads
  4173. elif check_lib pthreads pthread.h pthread_join -lpthreadGC2; then
  4174. :
  4175. elif check_lib pthreads pthread.h pthread_join -lpthread; then
  4176. :
  4177. elif check_func pthread_join; then
  4178. enable pthreads
  4179. fi
  4180. enabled pthreads &&
  4181. check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
  4182. fi
  4183. disabled zlib || check_lib zlib zlib.h zlibVersion -lz
  4184. disabled bzlib || check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
  4185. # On some systems dynamic loading requires no extra linker flags
  4186. check_lib libdl dlfcn.h dlopen || check_lib libdl dlfcn.h dlopen -ldl
  4187. check_lib libm math.h sin -lm
  4188. atan2f_args=2
  4189. ldexpf_args=2
  4190. powf_args=2
  4191. for func in $MATH_FUNCS; do
  4192. eval check_mathfunc $func \${${func}_args:-1} $libm_extralibs
  4193. done
  4194. # these are off by default, so fail if requested and not available
  4195. 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"
  4196. enabled avisynth && require_header avisynth/avisynth_c.h
  4197. enabled avxsynth && require_header avxsynth/avxsynth_c.h
  4198. enabled cuda && require cuda cuda.h cuInit -lcuda
  4199. enabled cuvid && require cuvid cuviddec.h cuvidCreateDecoder -lnvcuvid
  4200. enabled frei0r && require_header frei0r.h
  4201. enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init &&
  4202. check_lib gmp gmp.h mpz_export -lgmp
  4203. enabled libaom && require_pkg_config libaom "aom >= 0.1.0" aom/aom_codec.h aom_codec_version
  4204. enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open
  4205. enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
  4206. enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec
  4207. enabled libfaac && require libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  4208. enabled libfdk_aac && require_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen
  4209. enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
  4210. enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
  4211. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  4212. enabled libhdcd && require_pkg_config libhdcd libhdcd "hdcd/hdcd_simple.h" hdcd_new
  4213. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  4214. enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
  4215. enabled libmfx && require_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit
  4216. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  4217. enabled libnpp && require libnpp npp.h nppGetLibVersion -lnppi -lnppc
  4218. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  4219. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  4220. enabled libopencv && require_pkg_config libopencv opencv opencv/cv.h cvCreateImageHeader
  4221. enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
  4222. enabled libopenjpeg && { check_lib libopenjpeg openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
  4223. require_pkg_config libopenjpeg libopenjpeg1 openjpeg.h opj_version -DOPJ_STATIC; }
  4224. enabled libopus && require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
  4225. enabled libpulse && require_pkg_config libpulse libpulse-simple pulse/simple.h pa_simple_new
  4226. enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
  4227. enabled libschroedinger && require_pkg_config libschroedinger schroedinger-1.0 schroedinger/schro.h schro_init
  4228. enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy
  4229. enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
  4230. enabled libsrt && require_pkg_config libsrt "srt >= 1.2.0" srt/srt.h srt_socket
  4231. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  4232. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame
  4233. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  4234. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  4235. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  4236. enabled libvpx && require_pkg_config libvpx "vpx >= 1.3.0" vpx/vpx_codec.h vpx_codec_version &&
  4237. { enabled libvpx_vp8_decoder &&
  4238. check_pkg_config libvpx_vp8_decoder vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx
  4239. enabled libvpx_vp8_encoder &&
  4240. check_pkg_config libvpx_vp8_encoder vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx
  4241. enabled libvpx_vp9_decoder &&
  4242. check_pkg_config libvpx_vp9_decoder vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx
  4243. enabled libvpx_vp9_encoder &&
  4244. check_pkg_config libvpx_vp9_encoder vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx
  4245. disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder &&
  4246. die "libvpx enabled but no supported decoders/encoders found"
  4247. }
  4248. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  4249. enabled libwebp && require_pkg_config libwebp libwebp webp/encode.h WebPGetEncoderVersion
  4250. enabled libx264 && require_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode &&
  4251. require_cpp_condition x264.h "X264_BUILD >= 118" &&
  4252. check_cpp_condition libx262 x264.h "X264_MPEG2"
  4253. enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get &&
  4254. require_cpp_condition x265.h "X265_BUILD >= 57"
  4255. enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs
  4256. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  4257. enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
  4258. { ! enabled cross_compile &&
  4259. add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline &&
  4260. add_ldflags -L/opt/vc/lib/ &&
  4261. check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
  4262. die "ERROR: mmal not found" &&
  4263. check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
  4264. enabled nvenc && require_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6"
  4265. enabled omx && require_header OMX_Core.h
  4266. enabled omx_rpi && { check_header OMX_Core.h ||
  4267. { ! enabled cross_compile && add_cflags -isystem/opt/vc/include/IL && check_header OMX_Core.h ; } ||
  4268. die "ERROR: OpenMAX IL headers not found"; } && enable omx
  4269. enabled openssl && { { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
  4270. check_pkg_config openssl openssl openssl/ssl.h SSL_library_init; } ||
  4271. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  4272. check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  4273. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  4274. die "ERROR: openssl not found"; }
  4275. # SDL adds some CFLAGS that should not be part of the general CFLAGS.
  4276. enabled avplay &&
  4277. test_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent
  4278. check_header linux/fb.h
  4279. check_header linux/videodev2.h
  4280. check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
  4281. check_header AVFoundation/AVFoundation.h
  4282. check_header sys/videoio.h
  4283. check_lib user32 "windows.h winuser.h" GetShellWindow -luser32
  4284. check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
  4285. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  4286. # w32api 3.12 had it defined wrong
  4287. check_cpp_condition vfwcap_defines vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER"
  4288. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  4289. check_header "dev/bktr/ioctl_meteor.h dev/bktr/ioctl_bt848.h" ||
  4290. check_header "machine/ioctl_meteor.h machine/ioctl_bt848.h" ||
  4291. check_header "dev/video/meteor/ioctl_meteor.h dev/video/bktr/ioctl_bt848.h" ||
  4292. check_header "dev/ic/bt8xx.h"
  4293. check_header sys/soundcard.h
  4294. enabled alsa_indev &&
  4295. check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound
  4296. enabled libjack &&
  4297. require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range
  4298. enabled sndio_indev && check_lib sndio sndio.h sio_open -lsndio
  4299. if enabled libcdio; then
  4300. check_lib libcdio "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4301. check_lib libcdio "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4302. die "ERROR: No usable libcdio/cdparanoia found"
  4303. fi
  4304. if enabled libxcb; then
  4305. require_pkg_config libxcb xcb xcb/xcb.h xcb_connect
  4306. require_pkg_config libxcb_shape xcb-shape xcb/shape.h xcb_shape_rectangles
  4307. disabled libxcb_shm ||
  4308. check_pkg_config libxcb_shm xcb-shm xcb/shm.h xcb_shm_attach
  4309. disabled libxcb_xfixes ||
  4310. check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image
  4311. fi
  4312. # d3d11va requires linking directly to dxgi and d3d11 if not building for
  4313. # the desktop api partition
  4314. test_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
  4315. #ifdef WINAPI_FAMILY
  4316. #include <winapifamily.h>
  4317. #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  4318. #error desktop, not uwp
  4319. #else
  4320. // WINAPI_FAMILY_APP, WINAPI_FAMILY_PHONE_APP => UWP
  4321. #endif
  4322. #else
  4323. #error no family set
  4324. #endif
  4325. EOF
  4326. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  4327. if enabled vaapi; then
  4328. require_cc vaapi "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)"
  4329. check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm
  4330. check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11
  4331. fi
  4332. enabled vaapi &&
  4333. test_cpp_condition "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" &&
  4334. enable vaapi_1
  4335. enabled vdpau &&
  4336. check_cpp_condition vdpau vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP"
  4337. enabled vdpau &&
  4338. check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
  4339. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  4340. # add some useful compiler flags if supported
  4341. check_cflags -Wdeclaration-after-statement
  4342. check_cflags -Wall
  4343. check_cflags -Wdisabled-optimization
  4344. check_cflags -Wpointer-arith
  4345. check_cflags -Wredundant-decls
  4346. check_cflags -Wwrite-strings
  4347. check_cflags -Wtype-limits
  4348. check_cflags -Wundef
  4349. check_cflags -Wmissing-prototypes
  4350. check_cflags -Wstrict-prototypes
  4351. if enabled extra_warnings; then
  4352. check_cflags -Wcast-qual
  4353. check_cflags -Wextra
  4354. check_cflags -Wpedantic
  4355. fi
  4356. check_disable_warning(){
  4357. warning_flag=-W${1#-Wno-}
  4358. test_cflags $warning_flag && add_cflags $1
  4359. }
  4360. check_disable_warning -Wno-parentheses
  4361. check_disable_warning -Wno-switch
  4362. check_disable_warning -Wno-format-zero-length
  4363. check_disable_warning -Wno-pointer-sign
  4364. check_disable_warning_headers(){
  4365. warning_flag=-W${1#-Wno-}
  4366. test_cflags $warning_flag && add_cflags_headers $1
  4367. }
  4368. check_disable_warning_headers -Wno-deprecated-declarations
  4369. check_disable_warning_headers -Wno-unused-variable
  4370. check_objcflags -fobjc-arc && enable objc_arc
  4371. test_cc <<EOF && enable blocks_extension
  4372. void (^block)(void);
  4373. EOF
  4374. # add some linker flags
  4375. check_ldflags -Wl,--warn-common
  4376. check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  4377. enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir
  4378. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  4379. # add some strip flags
  4380. # -wN '..@*' is more selective than -x, but not available everywhere.
  4381. check_stripflags -wN \'..@*\' || check_stripflags -x || strip='true'
  4382. enabled neon_clobber_test &&
  4383. check_ldflags -Wl,--wrap,avcodec_open2 \
  4384. -Wl,--wrap,avcodec_decode_audio4 \
  4385. -Wl,--wrap,avcodec_decode_video2 \
  4386. -Wl,--wrap,avcodec_decode_subtitle2 \
  4387. -Wl,--wrap,avcodec_encode_audio2 \
  4388. -Wl,--wrap,avcodec_encode_video2 \
  4389. -Wl,--wrap,avcodec_encode_subtitle \
  4390. -Wl,--wrap,avcodec_send_packet \
  4391. -Wl,--wrap,avcodec_receive_packet \
  4392. -Wl,--wrap,avcodec_send_frame \
  4393. -Wl,--wrap,avcodec_receive_frame \
  4394. -Wl,--wrap,avresample_convert ||
  4395. disable neon_clobber_test
  4396. enabled xmm_clobber_test &&
  4397. check_ldflags -Wl,--wrap,avcodec_open2 \
  4398. -Wl,--wrap,avcodec_decode_audio4 \
  4399. -Wl,--wrap,avcodec_decode_video2 \
  4400. -Wl,--wrap,avcodec_decode_subtitle2 \
  4401. -Wl,--wrap,avcodec_encode_audio2 \
  4402. -Wl,--wrap,avcodec_encode_video2 \
  4403. -Wl,--wrap,avcodec_encode_subtitle \
  4404. -Wl,--wrap,avcodec_send_packet \
  4405. -Wl,--wrap,avcodec_receive_packet \
  4406. -Wl,--wrap,avcodec_send_frame \
  4407. -Wl,--wrap,avcodec_receive_frame \
  4408. -Wl,--wrap,avresample_convert \
  4409. -Wl,--wrap,sws_scale ||
  4410. disable xmm_clobber_test
  4411. check_ld proper_dce <<EOF
  4412. extern const int array[512];
  4413. static inline int func(void) { return array[0]; }
  4414. int main(void) { return 0; }
  4415. EOF
  4416. if enabled proper_dce; then
  4417. echo "X { local: *; };" > $TMPV
  4418. if test_ldflags -Wl,${version_script},$TMPV; then
  4419. append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
  4420. quotes='""'
  4421. test_cc <<EOF && enable symver_asm_label
  4422. void ff_foo(void) __asm__ ("av_foo@VERSION");
  4423. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  4424. EOF
  4425. test_cc <<EOF && enable symver_gnu_asm
  4426. __asm__(".symver ff_foo,av_foo@VERSION");
  4427. void ff_foo(void) {}
  4428. EOF
  4429. fi
  4430. fi
  4431. if [ -z "$optflags" ]; then
  4432. if enabled small; then
  4433. optflags=$cflags_size
  4434. elif enabled optimizations; then
  4435. optflags=$cflags_speed
  4436. else
  4437. optflags=$cflags_noopt
  4438. fi
  4439. fi
  4440. check_optflags(){
  4441. check_cflags "$@"
  4442. enabled lto && check_ldflags "$@"
  4443. }
  4444. check_optflags $optflags
  4445. check_optflags -fno-math-errno
  4446. check_optflags -fno-signed-zeros
  4447. if enabled lto; then
  4448. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  4449. check_cflags -flto
  4450. check_ldflags -flto $cpuflags
  4451. fi
  4452. if enabled icc; then
  4453. # Just warnings, no remarks
  4454. check_cflags -w1
  4455. # -wd: Disable following warnings
  4456. # 144, 167, 556: -Wno-pointer-sign
  4457. # 1292: attribute "foo" ignored
  4458. # 1419: external declaration in primary source file
  4459. # 10006: ignoring unknown option -fno-signed-zeros
  4460. # 10148: ignoring unknown option -Wno-parentheses
  4461. # 10156: ignoring option '-W'; no argument required
  4462. check_cflags -wd144,167,556,1292,1419,10006,10148,10156
  4463. # 11030: Warning unknown option --as-needed
  4464. # 10156: ignoring option '-export'; no argument required
  4465. check_ldflags -wd10156,11030
  4466. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  4467. enable ebp_available
  4468. if enabled x86_32; then
  4469. icc_version=$($cc -dumpversion)
  4470. test ${icc_version%%.*} -ge 11 &&
  4471. check_cflags -falign-stack=maintain-16-byte ||
  4472. disable aligned_stack
  4473. fi
  4474. elif enabled gcc; then
  4475. check_optflags -fno-tree-vectorize
  4476. check_cflags -Werror=implicit-function-declaration
  4477. check_cflags -Werror=missing-prototypes
  4478. check_cflags -Werror=return-type
  4479. check_cflags -Werror=declaration-after-statement
  4480. check_cflags -Werror=vla
  4481. check_cflags -Werror=format-security
  4482. check_cflags -fdiagnostics-color=auto
  4483. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  4484. if enabled x86_32; then
  4485. case $target_os in
  4486. *bsd*)
  4487. # BSDs don't guarantee a 16 byte aligned stack, but we can
  4488. # request GCC to try to maintain 16 byte alignment throughout
  4489. # function calls. Library entry points that might call assembly
  4490. # functions align the stack. (The parameter means 2^4 bytes.)
  4491. check_cflags -mpreferred-stack-boundary=4
  4492. ;;
  4493. esac
  4494. fi
  4495. elif enabled llvm_gcc; then
  4496. check_cflags -mllvm -stack-alignment=16
  4497. elif enabled clang; then
  4498. if enabled x86_32; then
  4499. # Clang doesn't support maintaining alignment without assuming the
  4500. # same alignment in every function. If 16 byte alignment would be
  4501. # enabled, one would also have to either add attribute_align_arg on
  4502. # every single entry point into the libraries or enable -mstackrealign
  4503. # (doing stack realignment in every single function).
  4504. case $target_os in
  4505. mingw32|win32|*bsd*)
  4506. disable aligned_stack
  4507. ;;
  4508. *)
  4509. check_cflags -mllvm -stack-alignment=16
  4510. ;;
  4511. esac
  4512. else
  4513. check_cflags -mllvm -stack-alignment=16
  4514. fi
  4515. check_cflags -Qunused-arguments
  4516. check_cflags -Werror=implicit-function-declaration
  4517. check_cflags -Werror=missing-prototypes
  4518. check_cflags -Werror=return-type
  4519. elif enabled cparser; then
  4520. add_cflags -Wno-missing-variable-declarations
  4521. add_cflags -Wno-empty-statement
  4522. elif enabled armcc; then
  4523. add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
  4524. add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
  4525. # 2523: use of inline assembly is deprecated
  4526. add_cflags -W${armcc_opt},--diag_suppress=2523
  4527. add_cflags -W${armcc_opt},--diag_suppress=1207
  4528. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  4529. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  4530. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  4531. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  4532. elif enabled pathscale; then
  4533. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  4534. disable inline_asm
  4535. elif enabled_any msvc icl; then
  4536. enabled x86_32 && disable aligned_stack
  4537. enabled_all x86_32 debug && add_cflags -Oy-
  4538. enabled debug && add_ldflags -debug
  4539. enable pragma_deprecated
  4540. if enabled icl; then
  4541. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  4542. # (correctly) on icl 13.x.
  4543. test_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  4544. add_cflags -Qansi-alias
  4545. # icl will pass the inline asm tests but inline asm is currently
  4546. # not supported (build will fail)
  4547. disable inline_asm
  4548. fi
  4549. # msvcrt10 x64 incorrectly enables log2, only msvcrt12 (MSVC 2013) onwards actually has log2.
  4550. check_cpp_condition log2 crtversion.h "_VC_CRT_MAJOR_VERSION >= 12"
  4551. # The CRT headers contain __declspec(restrict) in a few places, but if redefining
  4552. # restrict, this might break. MSVC 2010 and 2012 fail with __declspec(__restrict)
  4553. # (as it ends up if the restrict redefine is done before including stdlib.h), while
  4554. # MSVC 2013 and newer can handle it fine.
  4555. # If this declspec fails, force including stdlib.h before the restrict redefinition
  4556. # happens in config.h.
  4557. if [ $restrict_keyword != restrict ]; then
  4558. test_cc <<EOF || add_cflags -FIstdlib.h
  4559. __declspec($restrict_keyword) void *foo(int);
  4560. EOF
  4561. fi
  4562. fi
  4563. for pfx in "" host_; do
  4564. varname=${pfx%_}cc_type
  4565. eval "type=\$$varname"
  4566. if [ "$type" = "msvc" ]; then
  4567. test_${pfx}cc <<EOF || add_${pfx}cflags -Dinline=__inline
  4568. static inline int foo(int a) { return a; }
  4569. EOF
  4570. fi
  4571. done
  4572. case $as_type in
  4573. clang)
  4574. add_asflags -Qunused-arguments
  4575. ;;
  4576. esac
  4577. case $ld_type in
  4578. clang)
  4579. check_ldflags -Qunused-arguments
  4580. ;;
  4581. esac
  4582. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  4583. check_cmd pod2man --help
  4584. check_cmd texi2html -version
  4585. check_deps $CONFIG_LIST \
  4586. $CONFIG_EXTRA \
  4587. $HAVE_LIST \
  4588. $ALL_COMPONENTS \
  4589. flatten_extralibs(){
  4590. unset nested_entries
  4591. list_name=$1
  4592. eval list=\$${1}
  4593. for entry in $list; do
  4594. entry_copy=$entry
  4595. resolve entry_copy
  4596. append nested_entries $(filter '*_extralibs' $entry_copy)
  4597. flat_entries=$(filter_out '*_extralibs' $entry_copy)
  4598. eval $entry="\$flat_entries"
  4599. done
  4600. append $list_name "$nested_entries"
  4601. resolve nested_entries
  4602. if test -n "$(filter '*_extralibs' $nested_entries)"; then
  4603. flatten_extralibs $list_name
  4604. fi
  4605. }
  4606. for linkunit in $LIBRARY_LIST; do
  4607. unset current_extralibs
  4608. eval components=\$$(toupper ${linkunit})_COMPONENTS_LIST
  4609. for comp in ${components}; do
  4610. enabled $comp || continue
  4611. comp_extralibs="${comp}_extralibs"
  4612. append current_extralibs $comp_extralibs
  4613. done
  4614. eval prepend ${linkunit}_extralibs $current_extralibs
  4615. done
  4616. for linkunit in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
  4617. flatten_extralibs ${linkunit}_extralibs
  4618. unique ${linkunit}_extralibs
  4619. resolve ${linkunit}_extralibs
  4620. eval ${linkunit}_extralibs=\$\(\$ldflags_filter \$${linkunit}_extralibs\)
  4621. done
  4622. map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
  4623. for thread in $THREADS_LIST; do
  4624. if enabled $thread; then
  4625. test -n "$thread_type" &&
  4626. die "ERROR: Only one thread type must be selected." ||
  4627. thread_type="$thread"
  4628. fi
  4629. done
  4630. if disabled stdatomic; then
  4631. if enabled atomics_gcc; then
  4632. add_cppflags '-I\$(SRC_PATH)/compat/atomics/gcc'
  4633. elif enabled atomics_win32; then
  4634. add_cppflags '-I\$(SRC_PATH)/compat/atomics/win32'
  4635. elif enabled atomics_suncc; then
  4636. add_cppflags '-I\$(SRC_PATH)/compat/atomics/suncc'
  4637. elif enabled pthreads; then
  4638. add_compat atomics/pthread/stdatomic.o
  4639. add_cppflags '-I\$(SRC_PATH)/compat/atomics/pthread'
  4640. else
  4641. enabled threads && die "Threading is enabled, but no atomics are available"
  4642. add_cppflags '-I\$(SRC_PATH)/compat/atomics/dummy'
  4643. fi
  4644. fi
  4645. enabled zlib && add_cppflags -DZLIB_CONST
  4646. # conditional library dependencies, in linking order
  4647. enabled movie_filter && prepend avfilter_deps "avformat avcodec"
  4648. enabled_any asyncts_filter resample_filter &&
  4649. prepend avfilter_deps "avresample"
  4650. enabled scale_filter && prepend avfilter_deps "swscale"
  4651. enabled opus_decoder && prepend avcodec_deps "avresample"
  4652. expand_deps(){
  4653. lib_deps=${1}_deps
  4654. eval "deps=\$$lib_deps"
  4655. append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
  4656. unique $lib_deps
  4657. }
  4658. map 'expand_deps $v' $LIBRARY_LIST
  4659. if test "$quiet" != "yes"; then
  4660. echo "install prefix $prefix"
  4661. echo "source path $source_path"
  4662. echo "C compiler $cc"
  4663. echo "C library $libc_type"
  4664. if test "$host_cc" != "$cc"; then
  4665. echo "host C compiler $host_cc"
  4666. echo "host C library $host_libc_type"
  4667. fi
  4668. echo "ARCH $arch ($cpu)"
  4669. if test "$extra_version" != ""; then
  4670. echo "version string suffix $extra_version"
  4671. fi
  4672. echo "big-endian ${bigendian-no}"
  4673. echo "runtime cpu detection ${runtime_cpudetect-no}"
  4674. if enabled x86; then
  4675. echo "standalone assembly ${x86asm-no}"
  4676. echo "x86 assembler ${x86asmexe}"
  4677. echo "MMX enabled ${mmx-no}"
  4678. echo "MMXEXT enabled ${mmxext-no}"
  4679. echo "3DNow! enabled ${amd3dnow-no}"
  4680. echo "3DNow! extended enabled ${amd3dnowext-no}"
  4681. echo "SSE enabled ${sse-no}"
  4682. echo "SSSE3 enabled ${ssse3-no}"
  4683. echo "AVX enabled ${avx-no}"
  4684. echo "XOP enabled ${xop-no}"
  4685. echo "FMA3 enabled ${fma3-no}"
  4686. echo "FMA4 enabled ${fma4-no}"
  4687. echo "i686 features enabled ${i686-no}"
  4688. echo "CMOV is fast ${fast_cmov-no}"
  4689. echo "EBX available ${ebx_available-no}"
  4690. echo "EBP available ${ebp_available-no}"
  4691. fi
  4692. if enabled aarch64; then
  4693. echo "NEON enabled ${neon-no}"
  4694. echo "VFP enabled ${vfp-no}"
  4695. fi
  4696. if enabled arm; then
  4697. echo "ARMv5TE enabled ${armv5te-no}"
  4698. echo "ARMv6 enabled ${armv6-no}"
  4699. echo "ARMv6T2 enabled ${armv6t2-no}"
  4700. echo "VFP enabled ${vfp-no}"
  4701. echo "NEON enabled ${neon-no}"
  4702. fi
  4703. if enabled ppc; then
  4704. echo "AltiVec enabled ${altivec-no}"
  4705. echo "VSX enabled ${vsx-no}"
  4706. echo "POWER8 enabled ${power8-no}"
  4707. echo "PPC 4xx optimizations ${ppc4xx-no}"
  4708. echo "dcbzl available ${dcbzl-no}"
  4709. fi
  4710. echo "debug symbols ${debug-no}"
  4711. echo "optimize for size ${small-no}"
  4712. echo "optimizations ${optimizations-no}"
  4713. echo "static ${static-no}"
  4714. echo "shared ${shared-no}"
  4715. echo "network support ${network-no}"
  4716. echo "threading support ${thread_type-no}"
  4717. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  4718. echo "External libraries:"
  4719. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  4720. echo
  4721. echo "External libraries providing hardware acceleration:"
  4722. print_enabled '' $HWACCEL_LIBRARY_LIST | print_3_columns
  4723. echo
  4724. echo "Libraries:"
  4725. print_enabled '' $LIBRARY_LIST | print_3_columns
  4726. echo
  4727. echo "Programs:"
  4728. print_enabled '' $PROGRAM_LIST | print_3_columns
  4729. echo
  4730. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev; do
  4731. echo "Enabled ${type}s:"
  4732. eval list=\$$(toupper $type)_LIST
  4733. print_enabled '_*' $list | print_3_columns
  4734. echo
  4735. done
  4736. if test -n "$ignore_tests"; then
  4737. ignore_tests=$(echo $ignore_tests | tr ',' ' ')
  4738. echo "Ignored FATE tests:"
  4739. echo $ignore_tests | print_3_columns
  4740. echo
  4741. fi
  4742. echo "License: $license"
  4743. fi # test "$quiet" != "yes"
  4744. test -n "$WARNINGS" && printf "\n$WARNINGS"
  4745. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  4746. esc(){
  4747. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  4748. }
  4749. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" > avbuild/config.fate
  4750. config_files="$TMPH avbuild/config.mak"
  4751. cat > avbuild/config.mak <<EOF
  4752. # Automatically generated by configure - do not modify!
  4753. LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
  4754. prefix=$prefix
  4755. LIBDIR=\$(DESTDIR)$libdir
  4756. SHLIBDIR=\$(DESTDIR)$shlibdir
  4757. INCDIR=\$(DESTDIR)$incdir
  4758. BINDIR=\$(DESTDIR)$bindir
  4759. DATADIR=\$(DESTDIR)$datadir
  4760. DOCDIR=\$(DESTDIR)$docdir
  4761. MANDIR=\$(DESTDIR)$mandir
  4762. SRC_PATH=$source_path
  4763. CC_IDENT=$cc_ident
  4764. ARCH=$arch
  4765. INTRINSICS=$intrinsics
  4766. EXTERN_PREFIX=$extern_prefix
  4767. CC=$cc
  4768. AS=$as
  4769. OBJCC=$objcc
  4770. LD=$ld
  4771. DEPCC=$dep_cc
  4772. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  4773. DEPAS=$as
  4774. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  4775. X86ASM=$x86asmexe
  4776. DEPX86ASM=$x86asmexe
  4777. DEPX86ASMFLAGS=\$(X86ASMFLAGS)
  4778. AR=$ar
  4779. ARFLAGS=$arflags
  4780. AR_O=$ar_o
  4781. AR_CMD=$ar
  4782. NM_CMD=$nm
  4783. RANLIB=$ranlib
  4784. STRIP=$strip
  4785. LN_S=$ln_s
  4786. CPPFLAGS=$CPPFLAGS
  4787. CFLAGS=$CFLAGS
  4788. OBJCFLAGS=$OBJCFLAGS
  4789. ASFLAGS=$ASFLAGS
  4790. AS_C=$AS_C
  4791. AS_O=$AS_O
  4792. OBJCC_C=$OBJCC_C
  4793. OBJCC_E=$OBJCC_E
  4794. OBJCC_O=$OBJCC_O
  4795. CC_C=$CC_C
  4796. CC_E=$CC_E
  4797. CC_O=$CC_O
  4798. X86ASM_O=$X86ASM_O
  4799. LD_O=$LD_O
  4800. LD_LIB=$LD_LIB
  4801. LD_PATH=$LD_PATH
  4802. DLLTOOL=$dlltool
  4803. LDFLAGS=$LDFLAGS
  4804. LDEXEFLAGS=$LDEXEFLAGS
  4805. LDSOFLAGS=$LDSOFLAGS
  4806. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  4807. STRIPFLAGS=$STRIPFLAGS
  4808. X86ASMFLAGS=$X86ASMFLAGS
  4809. LIBPREF=$LIBPREF
  4810. LIBSUF=$LIBSUF
  4811. LIBNAME=$LIBNAME
  4812. SLIBPREF=$SLIBPREF
  4813. SLIBSUF=$SLIBSUF
  4814. EXESUF=$EXESUF
  4815. EXTRA_VERSION=$extra_version
  4816. CCDEP=$CCDEP
  4817. CCDEP_FLAGS=$CCDEP_FLAGS
  4818. ASDEP=$ASDEP
  4819. ASDEP_FLAGS=$ASDEP_FLAGS
  4820. X86ASMDEP=$X86ASMDEP
  4821. X86ASMDEP_FLAGS=$X86ASMDEP_FLAGS
  4822. CC_DEPFLAGS=$CC_DEPFLAGS
  4823. AS_DEPFLAGS=$AS_DEPFLAGS
  4824. X86ASM_DEPFLAGS=$X86ASM_DEPFLAGS
  4825. HOSTCC=$host_cc
  4826. HOSTLD=$host_ld
  4827. HOSTCFLAGS=$host_cflags
  4828. HOSTCPPFLAGS=$host_cppflags
  4829. HOSTEXESUF=$HOSTEXESUF
  4830. HOSTLDFLAGS=$host_ldflags
  4831. HOSTEXTRALIBS=$host_extralibs
  4832. DEPHOSTCC=$host_cc
  4833. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  4834. HOSTCCDEP=$HOSTCCDEP
  4835. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  4836. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  4837. HOSTCC_C=$HOSTCC_C
  4838. HOSTCC_O=$HOSTCC_O
  4839. HOSTLD_O=$HOSTLD_O
  4840. TARGET_EXEC=$target_exec $target_exec_args
  4841. TARGET_PATH=$target_path
  4842. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  4843. CFLAGS-avplay=$sdl_cflags
  4844. CFLAGS_HEADERS=$CFLAGS_HEADERS
  4845. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  4846. EXTRALIBS=$extralibs
  4847. COMPAT_OBJS=$compat_objs
  4848. INSTALL=install
  4849. LIBTARGET=${LIBTARGET}
  4850. SLIBNAME=${SLIBNAME}
  4851. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  4852. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  4853. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  4854. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  4855. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  4856. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  4857. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  4858. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  4859. VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
  4860. SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
  4861. IGNORE_TESTS=$ignore_tests
  4862. EOF
  4863. map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> avbuild/config.mak' $LIBRARY_LIST
  4864. for entry in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
  4865. eval echo "EXTRALIBS-${entry}=\$${entry}_extralibs" >> avbuild/config.mak
  4866. done
  4867. cat > $TMPH <<EOF
  4868. /* Automatically generated by configure - do not modify! */
  4869. #ifndef LIBAV_CONFIG_H
  4870. #define LIBAV_CONFIG_H
  4871. #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
  4872. #define LIBAV_LICENSE "$(c_escape $license)"
  4873. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  4874. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  4875. #define EXTERN_PREFIX "${extern_prefix}"
  4876. #define EXTERN_ASM ${extern_prefix}
  4877. #define SLIBSUF "$SLIBSUF"
  4878. EOF
  4879. test $restrict_keyword != restrict &&
  4880. echo "#define restrict $restrict_keyword" >> $TMPH
  4881. test -n "$malloc_prefix" &&
  4882. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  4883. if enabled x86asm; then
  4884. append config_files $TMPASM
  4885. cat > $TMPASM <<EOF
  4886. ; Automatically generated by configure - do not modify!
  4887. EOF
  4888. fi
  4889. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  4890. print_config ARCH_ "$config_files" $ARCH_LIST
  4891. print_config HAVE_ "$config_files" $HAVE_LIST
  4892. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  4893. $CONFIG_EXTRA \
  4894. $ALL_COMPONENTS \
  4895. echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
  4896. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  4897. cp_if_changed $TMPH config.h
  4898. touch avbuild/.config
  4899. enabled x86asm && cp_if_changed $TMPASM config.asm
  4900. cat > $TMPH <<EOF
  4901. /* Generated by libav configure */
  4902. #ifndef AVUTIL_AVCONFIG_H
  4903. #define AVUTIL_AVCONFIG_H
  4904. EOF
  4905. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  4906. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  4907. cp_if_changed $TMPH libavutil/avconfig.h
  4908. # generate the lists of enabled components
  4909. print_enabled_components(){
  4910. file=$1
  4911. struct_name=$2
  4912. name=$3
  4913. shift 3
  4914. echo "static const $struct_name * const $name[] = {" > $TMPH
  4915. for c in $*; do
  4916. enabled $c && printf " &ff_%s,\n" $c >> $TMPH
  4917. done
  4918. echo " NULL };" >> $TMPH
  4919. cp_if_changed $TMPH $file
  4920. }
  4921. print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
  4922. print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
  4923. # Settings for pkg-config files
  4924. cat > $TMPH <<EOF
  4925. # Automatically generated by configure - do not modify!
  4926. shared=$shared
  4927. prefix=$prefix
  4928. libdir=$libdir
  4929. incdir=$incdir
  4930. source_path=${source_path}
  4931. LIBPREF=${LIBPREF}
  4932. LIBSUF=${LIBSUF}
  4933. extralibs_avutil="$avutil_extralibs"
  4934. extralibs_avcodec="$avcodec_extralibs"
  4935. extralibs_avformat="$avformat_extralibs"
  4936. extralibs_avdevice="$avdevice_extralibs"
  4937. extralibs_avfilter="$avfilter_extralibs"
  4938. extralibs_avresample="$avresample_extralibs"
  4939. extralibs_swscale="$swscale_extralibs"
  4940. EOF
  4941. for lib in $LIBRARY_LIST; do
  4942. lib_deps="$(eval echo \$${lib}_deps)"
  4943. echo ${lib}_deps=\"$lib_deps\" >> $TMPH
  4944. done
  4945. cp_if_changed $TMPH avbuild/config.sh