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.

5412 lines
162KB

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