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.

5486 lines
165KB

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