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.

5437 lines
163KB

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