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.

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