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.

5491 lines
165KB

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