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.

5489 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. aarch64|arm64)
  2680. as_default="armasm64"
  2681. ;;
  2682. arm*)
  2683. as_default="armasm"
  2684. ;;
  2685. esac
  2686. target_os_default="win32"
  2687. # Use a relative path for TMPDIR. This makes sure all the
  2688. # ffconf temp files are written with a relative path, avoiding
  2689. # issues with msys/win32 path conversion for MSVC parameters
  2690. # such as -Fo<file> or -out:<file>.
  2691. TMPDIR=.
  2692. ;;
  2693. icl)
  2694. cc_default="icl"
  2695. ld_default="xilink"
  2696. nm_default="dumpbin -symbols"
  2697. ar_default="xilib"
  2698. target_os_default="win32"
  2699. TMPDIR=.
  2700. ;;
  2701. gcov)
  2702. add_cflags -fprofile-arcs -ftest-coverage
  2703. add_ldflags -fprofile-arcs -ftest-coverage
  2704. ;;
  2705. llvm-cov)
  2706. add_cflags -fprofile-arcs -ftest-coverage
  2707. add_ldflags --coverage
  2708. ;;
  2709. hardened)
  2710. add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
  2711. add_cflags -fno-strict-overflow -fstack-protector-all
  2712. add_ldflags -Wl,-z,relro -Wl,-z,now
  2713. ;;
  2714. ?*)
  2715. die "Unknown toolchain $toolchain"
  2716. ;;
  2717. esac
  2718. test -n "$cross_prefix" && enable cross_compile
  2719. if enabled cross_compile; then
  2720. test -n "$arch" && test -n "$target_os" ||
  2721. die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling"
  2722. fi
  2723. ar_default="${cross_prefix}${ar_default}"
  2724. cc_default="${cross_prefix}${cc_default}"
  2725. objcc_default="${cross_prefix}${objcc_default}"
  2726. x86asmexe_default="${cross_prefix}${x86asmexe_default}"
  2727. nm_default="${cross_prefix}${nm_default}"
  2728. pkg_config_default="${cross_prefix}${pkg_config_default}"
  2729. ranlib="${cross_prefix}${ranlib}"
  2730. strip="${cross_prefix}${strip}"
  2731. sysinclude_default="${sysroot}/usr/include"
  2732. set_default arch cc pkg_config sysinclude target_exec target_os x86asmexe
  2733. enabled cross_compile || host_cc_default=$cc
  2734. set_default host_cc
  2735. if ! $pkg_config --version >/dev/null 2>&1; then
  2736. warn "$pkg_config not found, library detection may fail."
  2737. pkg_config=false
  2738. fi
  2739. exesuf() {
  2740. case $1 in
  2741. mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2742. esac
  2743. }
  2744. EXESUF=$(exesuf $target_os)
  2745. HOSTEXESUF=$(exesuf $host_os)
  2746. # set temporary file name
  2747. : ${TMPDIR:=$TEMPDIR}
  2748. : ${TMPDIR:=$TMP}
  2749. : ${TMPDIR:=/tmp}
  2750. if ! check_cmd mktemp -u XXXXXX; then
  2751. # simple replacement for missing mktemp
  2752. # NOT SAFE FOR GENERAL USE
  2753. mktemp(){
  2754. tmpname="${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2755. echo "$tmpname"
  2756. mkdir "$tmpname"
  2757. }
  2758. fi
  2759. AVTMPDIR=$(mktemp -d "${TMPDIR}/avconf.XXXXXXXX" 2> /dev/null) ||
  2760. die "Unable to create temporary directory in $TMPDIR."
  2761. tmpfile(){
  2762. tmp="${AVTMPDIR}/test"$2
  2763. (set -C; exec > $tmp) 2> /dev/null ||
  2764. die "Unable to create temporary file in $AVTMPDIR."
  2765. eval $1=$tmp
  2766. }
  2767. trap 'rm -rf -- "$AVTMPDIR"' EXIT
  2768. trap 'exit 2' INT
  2769. tmpfile TMPASM .asm
  2770. tmpfile TMPC .c
  2771. tmpfile TMPE $EXESUF
  2772. tmpfile TMPH .h
  2773. tmpfile TMPO .o
  2774. tmpfile TMPS .S
  2775. tmpfile TMPSH .sh
  2776. tmpfile TMPV .ver
  2777. unset -f mktemp
  2778. chmod +x $TMPE
  2779. # make sure we can execute files in $TMPDIR
  2780. cat > $TMPSH 2>> $logfile <<EOF
  2781. #! /bin/sh
  2782. EOF
  2783. chmod +x $TMPSH >> $logfile 2>&1
  2784. if ! $TMPSH >> $logfile 2>&1; then
  2785. cat <<EOF
  2786. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2787. variable to another directory and make sure that it is not mounted noexec.
  2788. EOF
  2789. die "Sanity test failed."
  2790. fi
  2791. armasm_flags(){
  2792. for flag; do
  2793. case $flag in
  2794. # Filter out MSVC cl.exe options from cflags that shouldn't
  2795. # be passed to gas-preprocessor
  2796. -M[TD]*) ;;
  2797. *) echo $flag ;;
  2798. esac
  2799. done
  2800. }
  2801. cparser_flags(){
  2802. for flag; do
  2803. case $flag in
  2804. -Wno-switch) echo -Wno-switch-enum ;;
  2805. -Wno-format-zero-length) ;;
  2806. -Wdisabled-optimization) ;;
  2807. -Wno-pointer-sign) echo -Wno-other ;;
  2808. *) echo $flag ;;
  2809. esac
  2810. done
  2811. }
  2812. msvc_common_flags(){
  2813. for flag; do
  2814. case $flag in
  2815. # In addition to specifying certain flags under the compiler
  2816. # specific filters, they must be specified here as well or else the
  2817. # generic catch all at the bottom will print the original flag.
  2818. -Wall) ;;
  2819. -Wextra) ;;
  2820. -std=c99) ;;
  2821. # Common flags
  2822. -fomit-frame-pointer) ;;
  2823. -g) echo -Z7 ;;
  2824. -fno-math-errno) ;;
  2825. -fno-common) ;;
  2826. -fno-signed-zeros) ;;
  2827. -fPIC) ;;
  2828. -mthumb) ;;
  2829. -march=*) ;;
  2830. -lz) echo zlib.lib ;;
  2831. -lx264) echo libx264.lib ;;
  2832. -l*) echo ${flag#-l}.lib ;;
  2833. -L*) echo -libpath:${flag#-L} ;;
  2834. *) echo $flag ;;
  2835. esac
  2836. done
  2837. }
  2838. msvc_flags(){
  2839. msvc_common_flags "$@"
  2840. for flag; do
  2841. case $flag in
  2842. -Wall) echo -W3 -wd4018 -wd4146 -wd4244 -wd4305 \
  2843. -wd4554 ;;
  2844. -Wextra) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2845. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2846. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2847. -wd4273 -wd4554 -wd4701 -wd4703 ;;
  2848. esac
  2849. done
  2850. }
  2851. icl_flags(){
  2852. msvc_common_flags "$@"
  2853. for flag; do
  2854. case $flag in
  2855. # Despite what Intel's documentation says -Wall, which is supported
  2856. # on Windows, does enable remarks so disable them here.
  2857. -Wall) echo $flag -Qdiag-disable:remark ;;
  2858. -std=c99) echo -Qstd=c99 ;;
  2859. esac
  2860. done
  2861. }
  2862. pgi_flags(){
  2863. for flag; do
  2864. case $flag in
  2865. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2866. -fomit-frame-pointer) echo -Mnoframe ;;
  2867. -g) echo -gopt ;;
  2868. *) echo $flag ;;
  2869. esac
  2870. done
  2871. }
  2872. suncc_flags(){
  2873. for flag; do
  2874. case $flag in
  2875. -march=*|-mcpu=*)
  2876. case "${flag#*=}" in
  2877. native) echo -xtarget=native ;;
  2878. v9|niagara) echo -xarch=sparc ;;
  2879. ultrasparc) echo -xarch=sparcvis ;;
  2880. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2881. i586|pentium) echo -xchip=pentium ;;
  2882. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2883. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2884. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2885. pentium4*) echo -xtarget=pentium4 ;;
  2886. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2887. *-sse3) echo -xarch=sse3 ;;
  2888. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2889. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2890. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2891. amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
  2892. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2893. k8|opteron|athlon64|athlon-fx)
  2894. echo -xarch=sse2a ;;
  2895. athlon*) echo -xarch=pentium_proa ;;
  2896. esac
  2897. ;;
  2898. -std=c99) echo -xc99 ;;
  2899. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2900. -fPIC) echo -KPIC -xcode=pic32 ;;
  2901. -W*,*) echo $flag ;;
  2902. -f*-*|-W*|-mimpure-text) ;;
  2903. -shared) echo -G ;;
  2904. *) echo $flag ;;
  2905. esac
  2906. done
  2907. }
  2908. tms470_flags(){
  2909. for flag; do
  2910. case $flag in
  2911. -march=*|-mcpu=*)
  2912. case "${flag#*=}" in
  2913. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2914. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2915. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2916. armv6*|arm11*) echo -mv=6 ;;
  2917. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2918. echo -mv=5e ;;
  2919. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2920. esac
  2921. ;;
  2922. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2923. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2924. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2925. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2926. -msoft-float) echo --float_support=vfplib ;;
  2927. -O[0-3]|-mf=*) echo $flag ;;
  2928. -g) echo -g -mn ;;
  2929. -pds=*) echo $flag ;;
  2930. -D*|-I*) echo $flag ;;
  2931. --gcc|--abi=*) echo $flag ;;
  2932. -me) echo $flag ;;
  2933. esac
  2934. done
  2935. }
  2936. probe_cc(){
  2937. pfx=$1
  2938. _cc=$2
  2939. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2940. unset _ld_o _ldflags _ld_lib _ld_path
  2941. unset _depflags _DEPCMD _DEPFLAGS
  2942. _flags_filter=echo
  2943. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2944. _type=llvm_gcc
  2945. gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
  2946. _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
  2947. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2948. _cflags_speed='-O3'
  2949. _cflags_size='-Os'
  2950. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2951. _type=gcc
  2952. gcc_version=$($_cc --version | head -n1)
  2953. gcc_basever=$($_cc -dumpversion)
  2954. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2955. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2956. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2957. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2958. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2959. fi
  2960. _cflags_speed='-O3'
  2961. _cflags_size='-Os'
  2962. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  2963. _type=icc
  2964. _ident=$($_cc --version | head -n1)
  2965. _depflags='-MMD'
  2966. _cflags_speed='-O3'
  2967. _cflags_size='-Os'
  2968. _cflags_noopt='-O1'
  2969. elif $_cc -v 2>&1 | grep -q xlc; then
  2970. _type=xlc
  2971. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2972. _cflags_speed='-O5'
  2973. _cflags_size='-O5 -qcompact'
  2974. elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
  2975. test -d "$sysroot" || die "No valid sysroot specified."
  2976. _type=armcc
  2977. _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
  2978. armcc_conf="$PWD/armcc.conf"
  2979. $_cc --arm_linux_configure \
  2980. --arm_linux_config_file="$armcc_conf" \
  2981. --configure_sysroot="$sysroot" \
  2982. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2983. die "Error creating armcc configuration file."
  2984. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2985. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2986. as_default="${cross_prefix}gcc"
  2987. _depflags='-MMD'
  2988. _cflags_speed='-O3'
  2989. _cflags_size='-Os'
  2990. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2991. _type=tms470
  2992. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2993. _flags='--gcc --abi=eabi -me'
  2994. _cc_e='-ppl -fe=$@'
  2995. _cc_o='-fe=$@'
  2996. _depflags='-ppa -ppd=$(@:.o=.d)'
  2997. _cflags_speed='-O3 -mf=5'
  2998. _cflags_size='-O3 -mf=2'
  2999. _flags_filter=tms470_flags
  3000. elif $_cc -v 2>&1 | grep -q clang; then
  3001. _type=clang
  3002. _ident=$($_cc --version 2>/dev/null | head -n1)
  3003. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3004. _cflags_speed='-O3'
  3005. _cflags_size='-Os'
  3006. elif $_cc -V 2>&1 | grep -q Sun; then
  3007. _type=suncc
  3008. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  3009. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  3010. _DEPFLAGS='-xM1 -xc99'
  3011. _ldflags='-std=c99'
  3012. _cflags_speed='-O5'
  3013. _cflags_size='-O5 -xspace'
  3014. _flags_filter=suncc_flags
  3015. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  3016. _type=pathscale
  3017. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  3018. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3019. _cflags_speed='-O2'
  3020. _cflags_size='-Os'
  3021. _flags_filter='filter_out -Wdisabled-optimization'
  3022. elif $_cc -v 2>&1 | grep -q Open64; then
  3023. _type=open64
  3024. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  3025. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  3026. _cflags_speed='-O2'
  3027. _cflags_size='-Os'
  3028. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  3029. elif $_cc -V 2>&1 | grep -q Portland; then
  3030. _type=pgi
  3031. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  3032. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  3033. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  3034. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  3035. _cflags_noopt="-O1"
  3036. _flags_filter=pgi_flags
  3037. elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
  3038. _type=armasm
  3039. _ident=$($_cc | head -n1)
  3040. # 4509: "This form of conditional instruction is deprecated"
  3041. _flags="-nologo -ignore 4509"
  3042. _flags_filter=armasm_flags
  3043. elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
  3044. _type=msvc
  3045. _ident=$($_cc 2>&1 | head -n1)
  3046. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  3047. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  3048. _cflags_speed="-O2"
  3049. _cflags_size="-O1"
  3050. _cflags_noopt="-O1"
  3051. if $_cc -nologo- 2>&1 | grep -q Linker; then
  3052. _ld_o='-out:$@'
  3053. else
  3054. _ld_o='-Fe$@'
  3055. fi
  3056. _cc_o='-Fo$@'
  3057. _cc_e='-P -Fi$@'
  3058. _flags_filter=msvc_flags
  3059. _ld_lib='lib%.a'
  3060. _ld_path='-libpath:'
  3061. _flags='-nologo'
  3062. elif $_cc 2>&1 | grep -q Intel; then
  3063. _type=icl
  3064. _ident=$($_cc 2>&1 | head -n1)
  3065. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  3066. # Not only is O3 broken on 13.x+ but it is slower on all previous
  3067. # versions (tested) as well.
  3068. _cflags_speed="-O2"
  3069. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  3070. if $_cc 2>&1 | grep -q Linker; then
  3071. _ld_o='-out:$@'
  3072. else
  3073. _ld_o='-Fe$@'
  3074. fi
  3075. _cc_o='-Fo$@'
  3076. _cc_e='-P'
  3077. _flags_filter=icl_flags
  3078. _ld_lib='lib%.a'
  3079. _ld_path='-libpath:'
  3080. # -Qdiag-error to make icl error when seeing certain unknown arguments
  3081. _flags='-nologo -Qdiag-error:4044,10157'
  3082. # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
  3083. # with MSVC which enables it by default.
  3084. _cflags='-Qms0 -Qvec- -Qsimd- -GS'
  3085. elif $_cc -? 2>/dev/null | grep -q 'LLVM.*Linker'; then
  3086. # lld can emulate multiple different linkers; in ms link.exe mode,
  3087. # the -? parameter gives the help output which contains an identifyable
  3088. # string, while it gives an error in other modes.
  3089. _type=lld-link
  3090. # The link.exe mode doesn't have a switch for getting the version,
  3091. # but we can force it back to gnu mode and get the version from there.
  3092. _ident=$($_cc -flavor gnu --version 2>/dev/null)
  3093. _ld_o='-out:$@'
  3094. _flags_filter=msvc_flags
  3095. _ld_lib='lib%.a'
  3096. _ld_path='-libpath:'
  3097. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  3098. _type=cparser
  3099. _ident=$($_cc --version | head -n1)
  3100. _depflags='-MMD'
  3101. _cflags_speed='-O4'
  3102. _cflags_size='-O2'
  3103. _flags_filter=cparser_flags
  3104. fi
  3105. eval ${pfx}_type=\$_type
  3106. eval ${pfx}_ident=\$_ident
  3107. }
  3108. set_ccvars(){
  3109. eval ${1}_C=\${_cc_c-\${${1}_C}}
  3110. eval ${1}_E=\${_cc_e-\${${1}_E}}
  3111. eval ${1}_O=\${_cc_o-\${${1}_O}}
  3112. if [ -n "$_depflags" ]; then
  3113. eval ${1}_DEPFLAGS=\$_depflags
  3114. else
  3115. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  3116. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  3117. eval DEP${1}FLAGS=\$_flags
  3118. fi
  3119. }
  3120. probe_cc cc "$cc"
  3121. cflags_filter=$_flags_filter
  3122. cflags_speed=$_cflags_speed
  3123. cflags_size=$_cflags_size
  3124. cflags_noopt=$_cflags_noopt
  3125. add_cflags $_flags $_cflags
  3126. cc_ldflags=$_ldflags
  3127. set_ccvars CC
  3128. probe_cc hostcc "$host_cc"
  3129. host_cflags_filter=$_flags_filter
  3130. host_cflags_speed=$_cflags_speed
  3131. add_host_cflags $_flags $_cflags
  3132. set_ccvars HOSTCC
  3133. test -n "$cc_type" && enable $cc_type ||
  3134. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  3135. : ${as_default:=$cc}
  3136. : ${objcc_default:=$cc}
  3137. : ${dep_cc_default:=$cc}
  3138. : ${ld_default:=$cc}
  3139. : ${host_ld_default:=$host_cc}
  3140. set_default ar as objcc dep_cc ld host_ld
  3141. probe_cc as "$as"
  3142. asflags_filter=$_flags_filter
  3143. add_asflags $_flags $_cflags
  3144. set_ccvars AS
  3145. probe_cc objcc "$objcc"
  3146. objcflags_filter=$_flags_filter
  3147. add_objcflags $_flags $_cflags
  3148. set_ccvars OBJC
  3149. probe_cc ld "$ld"
  3150. ldflags_filter=$_flags_filter
  3151. add_ldflags $_flags $_ldflags
  3152. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  3153. LD_O=${_ld_o-$LD_O}
  3154. LD_LIB=${_ld_lib-$LD_LIB}
  3155. LD_PATH=${_ld_path-$LD_PATH}
  3156. probe_cc hostld "$host_ld"
  3157. host_ldflags_filter=$_flags_filter
  3158. add_host_ldflags $_flags $_ldflags
  3159. HOSTLD_O=${_ld_o-$HOSTLD_O}
  3160. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  3161. probe_cc depcc "$dep_cc"
  3162. CCDEP=${_DEPCMD:-$DEPCMD}
  3163. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  3164. DEPCCFLAGS=$_flags
  3165. fi
  3166. if $ar 2>&1 | grep -q Microsoft; then
  3167. arflags="-nologo"
  3168. ar_o='-out:$@'
  3169. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  3170. arflags="rq"
  3171. ar_o='$@'
  3172. elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
  3173. arflags='-Xany -r -c'
  3174. ar_o='$@'
  3175. else
  3176. arflags="rc"
  3177. ar_o='$@'
  3178. fi
  3179. add_cflags $extra_cflags
  3180. add_objcflags $extra_objcflags
  3181. add_asflags $extra_cflags
  3182. if test -n "$sysroot"; then
  3183. case "$cc_type" in
  3184. gcc|llvm_gcc|clang)
  3185. add_cppflags --sysroot="$sysroot"
  3186. add_ldflags --sysroot="$sysroot"
  3187. ;;
  3188. tms470)
  3189. add_cppflags -I"$sysinclude"
  3190. add_ldflags --sysroot="$sysroot"
  3191. ;;
  3192. esac
  3193. fi
  3194. if test "$cpu" = host; then
  3195. enabled cross_compile &&
  3196. die "--cpu=host makes no sense when cross-compiling."
  3197. case "$cc_type" in
  3198. gcc|llvm_gcc)
  3199. check_native(){
  3200. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  3201. sed -n "/cc1.*$1=/{
  3202. s/.*$1=\\([^ ]*\\).*/\\1/
  3203. p
  3204. q
  3205. }" $TMPE
  3206. }
  3207. cpu=$(check_native -march || check_native -mcpu)
  3208. ;;
  3209. esac
  3210. test "${cpu:-host}" = host &&
  3211. die "--cpu=host not supported with compiler $cc"
  3212. fi
  3213. # Deal with common $arch aliases
  3214. case "$arch" in
  3215. aarch64|arm64)
  3216. arch="aarch64"
  3217. ;;
  3218. arm*)
  3219. arch="arm"
  3220. ;;
  3221. mips*|IP*)
  3222. case "$arch" in
  3223. *el)
  3224. add_cppflags -EL
  3225. add_ldflags -EL
  3226. ;;
  3227. *eb)
  3228. add_cppflags -EB
  3229. add_ldflags -EB
  3230. ;;
  3231. esac
  3232. arch="mips"
  3233. ;;
  3234. parisc*|hppa*)
  3235. arch="parisc"
  3236. ;;
  3237. "Power Macintosh"|ppc*|powerpc*)
  3238. arch="ppc"
  3239. ;;
  3240. s390|s390x)
  3241. arch="s390"
  3242. ;;
  3243. sh4|sh)
  3244. arch="sh4"
  3245. ;;
  3246. sun4u|sparc*)
  3247. arch="sparc"
  3248. ;;
  3249. tilegx|tile-gx)
  3250. arch="tilegx"
  3251. ;;
  3252. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  3253. arch="x86"
  3254. ;;
  3255. esac
  3256. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  3257. enable $arch
  3258. # Add processor-specific flags
  3259. if enabled aarch64; then
  3260. case $cpu in
  3261. armv*)
  3262. cpuflags="-march=$cpu"
  3263. ;;
  3264. *)
  3265. cpuflags="-mcpu=$cpu"
  3266. ;;
  3267. esac
  3268. elif enabled alpha; then
  3269. cpuflags="-mcpu=$cpu"
  3270. elif enabled arm; then
  3271. check_arm_arch() {
  3272. check_cpp_condition stddef.h \
  3273. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  3274. $cpuflags
  3275. }
  3276. probe_arm_arch() {
  3277. if check_arm_arch 4; then echo armv4
  3278. elif check_arm_arch 4T; then echo armv4t
  3279. elif check_arm_arch 5; then echo armv5
  3280. elif check_arm_arch 5E; then echo armv5e
  3281. elif check_arm_arch 5T; then echo armv5t
  3282. elif check_arm_arch 5TE; then echo armv5te
  3283. elif check_arm_arch 5TEJ; then echo armv5te
  3284. elif check_arm_arch 6; then echo armv6
  3285. elif check_arm_arch 6J; then echo armv6j
  3286. elif check_arm_arch 6K; then echo armv6k
  3287. elif check_arm_arch 6Z; then echo armv6z
  3288. elif check_arm_arch 6ZK; then echo armv6zk
  3289. elif check_arm_arch 6T2; then echo armv6t2
  3290. elif check_arm_arch 7; then echo armv7
  3291. elif check_arm_arch 7A 7_A; then echo armv7-a
  3292. elif check_arm_arch 7S; then echo armv7-a
  3293. elif check_arm_arch 7R 7_R; then echo armv7-r
  3294. elif check_arm_arch 7M 7_M; then echo armv7-m
  3295. elif check_arm_arch 7EM 7E_M; then echo armv7-m
  3296. elif check_arm_arch 8A 8_A; then echo armv8-a
  3297. fi
  3298. }
  3299. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  3300. case $cpu in
  3301. armv*)
  3302. cpuflags="-march=$cpu"
  3303. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  3304. ;;
  3305. *)
  3306. cpuflags="-mcpu=$cpu"
  3307. case $cpu in
  3308. cortex-a*) subarch=armv7a ;;
  3309. cortex-r*) subarch=armv7r ;;
  3310. cortex-m*) enable thumb; subarch=armv7m ;;
  3311. arm11*) subarch=armv6 ;;
  3312. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  3313. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  3314. *) subarch=$(probe_arm_arch) ;;
  3315. esac
  3316. ;;
  3317. esac
  3318. case "$subarch" in
  3319. armv5t*) enable fast_clz ;;
  3320. armv[6-8]*) enable fast_clz fast_unaligned ;;
  3321. esac
  3322. elif enabled avr32; then
  3323. case $cpu in
  3324. ap7[02]0[0-2])
  3325. subarch="avr32_ap"
  3326. cpuflags="-mpart=$cpu"
  3327. ;;
  3328. ap)
  3329. subarch="avr32_ap"
  3330. cpuflags="-march=$cpu"
  3331. ;;
  3332. uc3[ab]*)
  3333. subarch="avr32_uc"
  3334. cpuflags="-mcpu=$cpu"
  3335. ;;
  3336. uc)
  3337. subarch="avr32_uc"
  3338. cpuflags="-march=$cpu"
  3339. ;;
  3340. esac
  3341. elif enabled bfin; then
  3342. cpuflags="-mcpu=$cpu"
  3343. elif enabled mips; then
  3344. cpuflags="-march=$cpu"
  3345. elif enabled ppc; then
  3346. disable ldbrx
  3347. case $(tolower $cpu) in
  3348. 601|ppc601|powerpc601)
  3349. cpuflags="-mcpu=601"
  3350. disable altivec
  3351. ;;
  3352. 603*|ppc603*|powerpc603*)
  3353. cpuflags="-mcpu=603"
  3354. disable altivec
  3355. ;;
  3356. 604*|ppc604*|powerpc604*)
  3357. cpuflags="-mcpu=604"
  3358. disable altivec
  3359. ;;
  3360. g3|75*|ppc75*|powerpc75*)
  3361. cpuflags="-mcpu=750"
  3362. disable altivec
  3363. ;;
  3364. g4|745*|ppc745*|powerpc745*)
  3365. cpuflags="-mcpu=7450"
  3366. disable vsx
  3367. ;;
  3368. 74*|ppc74*|powerpc74*)
  3369. cpuflags="-mcpu=7400"
  3370. disable vsx
  3371. ;;
  3372. g5|970|ppc970|powerpc970)
  3373. cpuflags="-mcpu=970"
  3374. disable vsx
  3375. ;;
  3376. power[3-6]*)
  3377. cpuflags="-mcpu=$cpu"
  3378. disable vsx
  3379. ;;
  3380. power[7-8]*)
  3381. cpuflags="-mcpu=$cpu"
  3382. enable ldbrx
  3383. ;;
  3384. cell)
  3385. cpuflags="-mcpu=cell"
  3386. enable ldbrx
  3387. disable vsx
  3388. ;;
  3389. e500mc)
  3390. cpuflags="-mcpu=e500mc"
  3391. disable altivec
  3392. ;;
  3393. e500v2)
  3394. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  3395. disable altivec
  3396. disable dcbzl
  3397. ;;
  3398. e500)
  3399. cpuflags="-mcpu=8540 -mhard-float"
  3400. disable altivec
  3401. disable dcbzl
  3402. ;;
  3403. esac
  3404. elif enabled sparc; then
  3405. case $cpu in
  3406. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  3407. cpuflags="-mcpu=$cpu"
  3408. ;;
  3409. ultrasparc*|niagara[234])
  3410. cpuflags="-mcpu=$cpu"
  3411. ;;
  3412. esac
  3413. elif enabled x86; then
  3414. case $cpu in
  3415. i[345]86|pentium)
  3416. cpuflags="-march=$cpu"
  3417. disable i686
  3418. disable mmx
  3419. ;;
  3420. # targets that do NOT support nopl and conditional mov (cmov)
  3421. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  3422. cpuflags="-march=$cpu"
  3423. disable i686
  3424. ;;
  3425. # targets that do support nopl and conditional mov (cmov)
  3426. 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*)
  3427. cpuflags="-march=$cpu"
  3428. enable i686
  3429. enable fast_cmov
  3430. ;;
  3431. # targets that do support conditional mov but on which it's slow
  3432. pentium4|pentium4m|prescott|nocona)
  3433. cpuflags="-march=$cpu"
  3434. enable i686
  3435. disable fast_cmov
  3436. ;;
  3437. esac
  3438. fi
  3439. if [ "$cpu" != generic ]; then
  3440. add_cflags $cpuflags
  3441. add_asflags $cpuflags
  3442. test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
  3443. fi
  3444. # compiler sanity check
  3445. check_exec <<EOF
  3446. int main(void){ return 0; }
  3447. EOF
  3448. if test "$?" != 0; then
  3449. echo "$cc is unable to create an executable file."
  3450. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  3451. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  3452. echo "Only do this if you know what cross compiling means."
  3453. fi
  3454. die "C compiler test failed."
  3455. fi
  3456. add_cppflags -D_ISOC99_SOURCE
  3457. # some compilers silently accept -std=c11, so we also need to check that the
  3458. # version macro is defined properly
  3459. check_cpp_condition stdlib.h "__STDC_VERSION__ >= 201112L" -std=c11 &&
  3460. add_cflags -std=c11 ||
  3461. check_cflags -std=c99
  3462. check_cppflags -D_FILE_OFFSET_BITS=64
  3463. check_cppflags -D_LARGEFILE_SOURCE
  3464. add_host_cppflags -D_ISOC99_SOURCE
  3465. check_host_cflags -std=c99
  3466. check_host_cflags -Wall
  3467. check_host_cflags $host_cflags_speed
  3468. check_64bit(){
  3469. arch32=$1
  3470. arch64=$2
  3471. expr=$3
  3472. check_code cc "" "int test[2*($expr) - 1]" &&
  3473. subarch=$arch64 || subarch=$arch32
  3474. }
  3475. case "$arch" in
  3476. aarch64|alpha|ia64)
  3477. spic=$shared
  3478. ;;
  3479. mips)
  3480. check_64bit mips mips64 '_MIPS_SIM > 1'
  3481. spic=$shared
  3482. ;;
  3483. parisc)
  3484. check_64bit parisc parisc64 'sizeof(void *) > 4'
  3485. spic=$shared
  3486. ;;
  3487. ppc)
  3488. check_64bit ppc ppc64 'sizeof(void *) > 4'
  3489. spic=$shared
  3490. ;;
  3491. s390)
  3492. check_64bit s390 s390x 'sizeof(void *) > 4'
  3493. spic=$shared
  3494. ;;
  3495. sparc)
  3496. check_64bit sparc sparc64 'sizeof(void *) > 4'
  3497. spic=$shared
  3498. ;;
  3499. x86)
  3500. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  3501. if test "$subarch" = "x86_64"; then
  3502. spic=$shared
  3503. fi
  3504. ;;
  3505. esac
  3506. enable $subarch
  3507. enabled spic && enable_weak pic
  3508. enabled x86_64 && objformat=elf64 || objformat="elf32"
  3509. # OS specific
  3510. case $target_os in
  3511. aix)
  3512. SHFLAGS=-shared
  3513. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  3514. enabled shared && add_ldflags -Wl,-brtl
  3515. ;;
  3516. android)
  3517. disable symver
  3518. enable section_data_rel_ro
  3519. SLIB_INSTALL_NAME='$(SLIBNAME)'
  3520. SLIB_INSTALL_LINKS=
  3521. SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
  3522. ;;
  3523. haiku)
  3524. prefix_default="/boot/common"
  3525. network_extralibs="-lnetwork"
  3526. host_extralibs=
  3527. ;;
  3528. sunos)
  3529. SHFLAGS='-shared -Wl,-h,$$(@F)'
  3530. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  3531. network_extralibs="-lsocket -lnsl"
  3532. # When using suncc to build, the Solaris linker will mark
  3533. # an executable with each instruction set encountered by
  3534. # the Solaris assembler. As our libraries contain their own
  3535. # guards for processor-specific code, instead suppress
  3536. # generation of the HWCAPS ELF section on Solaris x86 only.
  3537. enabled_all suncc x86 &&
  3538. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  3539. add_ldflags -Wl,-M,mapfile
  3540. nm_default='nm -P -g'
  3541. version_script='-M'
  3542. VERSION_SCRIPT_POSTPROCESS_CMD='perl $(SRC_PATH)/compat/solaris/make_sunver.pl - $(OBJS)'
  3543. ;;
  3544. netbsd)
  3545. disable symver
  3546. oss_indev_extralibs="-lossaudio"
  3547. ;;
  3548. openbsd|bitrig)
  3549. disable symver
  3550. SHFLAGS='-shared'
  3551. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  3552. SLIB_INSTALL_LINKS=
  3553. oss_indev_extralibs="-lossaudio"
  3554. ;;
  3555. dragonfly)
  3556. disable symver
  3557. ;;
  3558. freebsd)
  3559. ;;
  3560. bsd/os)
  3561. add_extralibs -lpoll -lgnugetopt
  3562. ;;
  3563. darwin)
  3564. enabled ppc && add_asflags -force_cpusubtype_ALL
  3565. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  3566. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  3567. add_ldflags -Wl,-dynamic,-search_paths_first
  3568. check_cflags -Werror=partial-availability
  3569. SLIBSUF=".dylib"
  3570. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
  3571. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
  3572. enabled x86_64 && objformat="macho64" || objformat="macho32"
  3573. enabled_any pic shared ||
  3574. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  3575. check_header dispatch/dispatch.h &&
  3576. add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore'
  3577. if test -n "$sysroot"; then
  3578. is_in -isysroot $cc $CPPFLAGS $CFLAGS || check_cppflags -isysroot $sysroot
  3579. is_in -isysroot $ld $LDFLAGS || check_ldflags -isysroot $sysroot
  3580. fi
  3581. ;;
  3582. msys*)
  3583. die "Native MSYS builds are discouraged, please use the MINGW environment."
  3584. ;;
  3585. mingw32*|mingw64*)
  3586. target_os=mingw32
  3587. LIBTARGET=i386
  3588. if enabled x86_64; then
  3589. LIBTARGET="i386:x86-64"
  3590. fi
  3591. if enabled shared; then
  3592. # Cannot build both shared and static libs when using dllexport.
  3593. disable static
  3594. fi
  3595. check_ldflags -Wl,--nxcompat
  3596. check_ldflags -Wl,--dynamicbase
  3597. shlibdir_default="$bindir_default"
  3598. SLIBPREF=""
  3599. SLIBSUF=".dll"
  3600. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3601. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
  3602. SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  3603. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3604. SLIB_INSTALL_LINKS=
  3605. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3606. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3607. SLIB_CREATE_DEF_CMD='ARCH="$(ARCH)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3608. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-auto-image-base $$(@:$(SLIBSUF)=.def)'
  3609. enabled x86_64 && objformat="win64" || objformat="win32"
  3610. dlltool="${cross_prefix}dlltool"
  3611. ranlib=:
  3612. enable dos_paths
  3613. ;;
  3614. win32|win64)
  3615. disable symver
  3616. if enabled shared; then
  3617. # Link to the import library instead of the normal static library
  3618. # for shared libs.
  3619. LD_LIB='%.lib'
  3620. # Cannot build both shared and static libs with MSVC or icl.
  3621. disable static
  3622. fi
  3623. shlibdir_default="$bindir_default"
  3624. SLIBPREF=""
  3625. SLIBSUF=".dll"
  3626. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3627. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
  3628. SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3629. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3630. SLIB_INSTALL_LINKS=
  3631. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3632. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3633. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3634. enabled x86_64 && objformat="win64" || objformat="win32"
  3635. ranlib=:
  3636. enable dos_paths
  3637. ;;
  3638. cygwin*)
  3639. target_os=cygwin
  3640. shlibdir_default="$bindir_default"
  3641. SLIBPREF="cyg"
  3642. SLIBSUF=".dll"
  3643. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3644. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
  3645. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3646. SLIB_INSTALL_LINKS=
  3647. SLIB_INSTALL_EXTRA_LIB='lib$(NAME).dll.a'
  3648. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(NAME).dll.a'
  3649. enabled x86_64 && objformat="win64" || objformat="win32"
  3650. enable dos_paths
  3651. ;;
  3652. *-dos|freedos|opendos)
  3653. network_extralibs="-lsocket"
  3654. objformat="coff"
  3655. enable dos_paths
  3656. add_cppflags -U__STRICT_ANSI__
  3657. ;;
  3658. linux)
  3659. enable section_data_rel_ro
  3660. ;;
  3661. irix*)
  3662. target_os=irix
  3663. ranlib="echo ignoring ranlib"
  3664. ;;
  3665. os/2*)
  3666. ln_s="cp -f"
  3667. objformat="aout"
  3668. add_cppflags -D_GNU_SOURCE
  3669. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zhigh-mem -Zmap
  3670. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  3671. LIBSUF="_s.a"
  3672. SLIBPREF=""
  3673. SLIBSUF=".dll"
  3674. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3675. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  3676. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  3677. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  3678. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  3679. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  3680. emxexp $(OBJS) >> $(SUBDIR)$(NAME).def'
  3681. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  3682. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  3683. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  3684. enable dos_paths
  3685. ;;
  3686. gnu/kfreebsd)
  3687. add_cppflags -D_BSD_SOURCE
  3688. ;;
  3689. gnu)
  3690. ;;
  3691. qnx)
  3692. add_cppflags -D_QNX_SOURCE
  3693. network_extralibs="-lsocket"
  3694. ;;
  3695. symbian)
  3696. SLIBSUF=".dll"
  3697. enable dos_paths
  3698. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  3699. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  3700. add_ldflags -Wl,--target1-abs,--no-undefined \
  3701. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  3702. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  3703. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  3704. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  3705. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  3706. ;;
  3707. minix)
  3708. ;;
  3709. none)
  3710. ;;
  3711. *)
  3712. die "Unknown OS '$target_os'."
  3713. ;;
  3714. esac
  3715. # determine libc flavour
  3716. probe_libc(){
  3717. pfx=$1
  3718. pfx_no_=${pfx%_}
  3719. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  3720. if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
  3721. eval ${pfx}libc_type=uclibc
  3722. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3723. elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then
  3724. eval ${pfx}libc_type=glibc
  3725. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3726. # MinGW headers can be installed on Cygwin, so check for newlib first.
  3727. elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  3728. eval ${pfx}libc_type=newlib
  3729. add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
  3730. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  3731. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  3732. eval ${pfx}libc_type=mingw64
  3733. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3734. eval test \$${pfx_no_}cc_type = "gcc" &&
  3735. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3736. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  3737. check_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  3738. eval ${pfx}libc_type=mingw32
  3739. check_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  3740. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  3741. die "ERROR: MinGW32 runtime version must be >= 3.15."
  3742. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3743. check_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
  3744. add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
  3745. check_${pfx}cpp_condition windows.h "defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0502" &&
  3746. add_${pfx}cppflags -D_WIN32_WINNT=0x0502
  3747. eval test \$${pfx_no_}cc_type = "gcc" &&
  3748. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3749. elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  3750. eval ${pfx}libc_type=msvcrt
  3751. if check_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
  3752. if [ "$pfx" = host_ ]; then
  3753. add_host_cppflags -Dsnprintf=_snprintf
  3754. else
  3755. add_compat strtod.o strtod=avpriv_strtod
  3756. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  3757. _snprintf=avpriv_snprintf \
  3758. vsnprintf=avpriv_vsnprintf
  3759. fi
  3760. fi
  3761. add_${pfx}cppflags -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS
  3762. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  3763. # 0x601 by default unless something else is set by the user.
  3764. # This can easily lead to us detecting functions only present
  3765. # in such new versions and producing binaries requiring windows 7.0.
  3766. # Therefore explicitly set the default to XP unless the user has
  3767. # set something else on the command line.
  3768. # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
  3769. # family. For these cases, configure is free to use any functions
  3770. # found in the SDK headers by default. (Alternatively, we could force
  3771. # _WIN32_WINNT to 0x0602 in that case.)
  3772. check_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  3773. { check_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0502; }
  3774. #ifdef WINAPI_FAMILY
  3775. #include <winapifamily.h>
  3776. #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  3777. #error not desktop
  3778. #endif
  3779. #endif
  3780. EOF
  3781. if [ "$pfx" = "" ]; then
  3782. check_func strtoll || add_cflags -Dstrtoll=_strtoi64
  3783. fi
  3784. elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  3785. eval ${pfx}libc_type=klibc
  3786. elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  3787. eval ${pfx}libc_type=bionic
  3788. elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  3789. eval ${pfx}libc_type=solaris
  3790. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  3791. else
  3792. eval ${pfx}libc_type=default
  3793. add_${pfx}cppflags -D_DEFAULT_SOURCE
  3794. fi
  3795. }
  3796. probe_libc
  3797. test -n "$libc_type" && enable libc_$libc_type
  3798. probe_libc host_
  3799. test -n "$host_libc_type" && enable host_libc_$host_libc_type
  3800. # hacks for compiler/libc/os combinations
  3801. case $libc_type in
  3802. bionic)
  3803. add_compat strtod.o strtod=avpriv_strtod
  3804. ;;
  3805. glibc)
  3806. if enabled tms470; then
  3807. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  3808. add_cppflags -D__USER_LABEL_PREFIX__=
  3809. add_cppflags -D__builtin_memset=memset
  3810. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  3811. add_cflags -pds=48 # incompatible redefinition of macro
  3812. fi
  3813. ;;
  3814. esac
  3815. check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
  3816. add_cppflags '-I\$(SRC_PATH)/compat/float'
  3817. esc(){
  3818. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  3819. }
  3820. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" > avbuild/config.fate
  3821. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  3822. set_default $PATHS_LIST
  3823. set_default nm
  3824. # we need to build at least one lib type
  3825. if ! enabled_any static shared; then
  3826. cat <<EOF
  3827. At least one library type must be built.
  3828. Specify --enable-static to build the static libraries or --enable-shared to
  3829. build the shared libraries as well. To only build the shared libraries specify
  3830. --disable-static in addition to --enable-shared.
  3831. EOF
  3832. exit 1
  3833. fi
  3834. disabled optimizations || check_cflags -fomit-frame-pointer
  3835. enable_weak_pic() {
  3836. disabled pic && return
  3837. enable pic
  3838. add_cppflags -DPIC
  3839. case "$target_os" in
  3840. mingw*|cygwin*|win*)
  3841. ;;
  3842. *)
  3843. add_cflags -fPIC
  3844. add_asflags -fPIC
  3845. ;;
  3846. esac
  3847. }
  3848. enabled pic && enable_weak_pic
  3849. check_cc <<EOF || die "Symbol mangling check failed."
  3850. int ff_extern;
  3851. EOF
  3852. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3853. extern_prefix=${sym%%ff_extern*}
  3854. ! disabled inline_asm && check_inline_asm inline_asm '"" ::'
  3855. _restrict=
  3856. for restrict_keyword in restrict __restrict__ __restrict; do
  3857. check_cc <<EOF && _restrict=$restrict_keyword && break
  3858. void foo(char * $restrict_keyword p);
  3859. EOF
  3860. done
  3861. check_cc <<EOF && enable pragma_deprecated
  3862. void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
  3863. EOF
  3864. check_cc <<EOF || die "endian test failed"
  3865. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3866. EOF
  3867. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3868. check_gas() {
  3869. log "check_gas using '$as' as AS"
  3870. # :vararg is used on aarch64, arm and ppc altivec
  3871. check_as <<EOF || return 1
  3872. .macro m n, y:vararg=0
  3873. \n: .int \y
  3874. .endm
  3875. m x
  3876. EOF
  3877. # .altmacro is only used in arm asm
  3878. ! enabled arm || check_as <<EOF || return 1
  3879. .altmacro
  3880. EOF
  3881. enable gnu_as
  3882. return 0
  3883. }
  3884. if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
  3885. nogas=:
  3886. enabled_any arm aarch64 && nogas=die
  3887. enabled_all ppc altivec && nogas=warn
  3888. as_noop=-v
  3889. case $as_type in
  3890. arm*) gaspp_as_type=armasm; as_noop=-h ;;
  3891. gcc) gaspp_as_type=gas ;;
  3892. *) gaspp_as_type=$as_type ;;
  3893. esac
  3894. [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
  3895. check_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as $as_noop &&
  3896. gas="gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as"
  3897. if ! check_gas ; then
  3898. as=${gas:=$as}
  3899. check_gas || \
  3900. $nogas "GNU assembler not found, install/update gas-preprocessor"
  3901. fi
  3902. check_as <<EOF && enable as_func
  3903. .func test
  3904. .endfunc
  3905. EOF
  3906. fi
  3907. check_inline_asm inline_asm_labels '"1:\n"'
  3908. if enabled aarch64; then
  3909. enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
  3910. # internal assembler in clang 3.3 does not support this instruction
  3911. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  3912. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  3913. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  3914. elif enabled alpha; then
  3915. check_cflags -mieee
  3916. elif enabled arm; then
  3917. enabled msvc && check_cpp_condition stddef.h "defined _M_ARMT" && enable thumb
  3918. check_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
  3919. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3920. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  3921. enable vfp_args
  3922. elif check_cpp_condition stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then
  3923. enable vfp_args
  3924. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then
  3925. case "${cross_prefix:-$cc}" in
  3926. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3927. *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  3928. __asm__ (".eabi_attribute 28, 1");
  3929. int main(void) { return 0; }
  3930. EOF
  3931. esac
  3932. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3933. fi
  3934. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3935. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3936. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3937. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3938. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3939. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3940. [ $target_os = linux ] || [ $target_os = android ] ||
  3941. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3942. $ARCH_EXT_LIST_ARM
  3943. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3944. check_as <<EOF && enable as_arch_directive
  3945. .arch armv7-a
  3946. EOF
  3947. check_as <<EOF && enable as_fpu_directive
  3948. .fpu neon
  3949. EOF
  3950. # llvm's integrated assembler supports .object_arch from llvm 3.5
  3951. [ "$objformat" = elf32 ] || [ "$objformat" = elf64 ] &&
  3952. check_as <<EOF && enable as_object_arch
  3953. .object_arch armv4
  3954. EOF
  3955. # MS armasm fails to assemble our PIC constructs
  3956. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  3957. elif enabled mips; then
  3958. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3959. # make sure that only an instruction set is enabled
  3960. disable mips64r6 mips32r6 mips64r2 mips32r2 mips64r1 mips32r1
  3961. if enabled mips64; then
  3962. check_inline_asm mips64r6 '"dlsa $0, $0, $0, 1"' ||
  3963. check_inline_asm mips64r2 '"dext $0, $0, 0, 1"' ||
  3964. check_inline_asm mips64r1 '"daddi $0, $0, 0"'
  3965. else
  3966. check_inline_asm mips32r6 '"aui $0, $0, 0"' ||
  3967. check_inline_asm mips32r2 '"ext $0, $0, 0, 1"' ||
  3968. check_inline_asm mips32r1 '"addi $0, $0, 0"'
  3969. fi
  3970. elif enabled parisc; then
  3971. if enabled gcc; then
  3972. case $($cc -dumpversion) in
  3973. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3974. esac
  3975. fi
  3976. elif enabled ppc; then
  3977. enable local_aligned_8 local_aligned_16 local_aligned_32
  3978. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3979. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3980. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3981. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3982. if enabled altivec; then
  3983. check_cflags -maltivec -mabi=altivec
  3984. # check if our compiler supports Motorola AltiVec C API
  3985. check_code cc altivec.h "vector signed int v1 = (vector signed int) { 0 };
  3986. vector signed int v2 = (vector signed int) { 1 };
  3987. v1 = vec_add(v1, v2);" ||
  3988. disable altivec
  3989. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3990. fi
  3991. if enabled vsx; then
  3992. check_cflags -mvsx &&
  3993. check_code cc altivec.h "int v[4] = { 0 };
  3994. vector signed int v1 = vec_vsx_ld(0, v);" ||
  3995. disable vsx
  3996. fi
  3997. if enabled power8; then
  3998. check_cpp_condition "altivec.h" "defined(_ARCH_PWR8)" || disable power8
  3999. fi
  4000. elif enabled x86; then
  4001. check_builtin rdtsc intrin.h "__rdtsc()"
  4002. check_builtin mm_empty mmintrin.h "_mm_empty()"
  4003. enable local_aligned_8 local_aligned_16 local_aligned_32
  4004. # check whether EBP is available on x86
  4005. # As 'i' is stored on the stack, this program will crash
  4006. # if the base pointer is used to access it because the
  4007. # base pointer is cleared in the inline assembly code.
  4008. check_exec_crash <<EOF && enable ebp_available
  4009. volatile int i=0;
  4010. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  4011. return i;
  4012. EOF
  4013. # check whether EBX is available on x86
  4014. check_inline_asm ebx_available '""::"b"(0)' &&
  4015. check_inline_asm ebx_available '"":::"%ebx"'
  4016. # check whether xmm clobbers are supported
  4017. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  4018. # check whether binutils is new enough to compile SSSE3/MMXEXT
  4019. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  4020. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  4021. probe_x86asm(){
  4022. x86asmexe_probe=$1
  4023. if check_cmd $x86asmexe_probe -v; then
  4024. x86asmexe=$x86asmexe_probe
  4025. x86asm_type=nasm
  4026. x86asm_debug="-g -F dwarf"
  4027. X86ASMDEP=
  4028. X86ASM_DEPFLAGS='-MD $(@:.o=.d)'
  4029. elif check_cmd $x86asmexe_probe --version; then
  4030. x86asmexe=$x86asmexe_probe
  4031. x86asm_type=yasm
  4032. x86asm_debug="-g dwarf2"
  4033. X86ASMDEP='$(DEPX86ASM) $(X86ASMFLAGS) -M $(X86ASM_O) $< > $(@:.o=.d)'
  4034. X86ASM_DEPFLAGS=
  4035. fi
  4036. check_x86asm "movbe ecx, [5]" && enable x86asm
  4037. }
  4038. if ! disabled_any asm mmx x86asm; then
  4039. disable x86asm
  4040. for program in $x86asmexe nasm yasm; do
  4041. probe_x86asm $program && break
  4042. done
  4043. disabled x86asm && die "nasm/yasm not found or too old. Use --disable-x86asm for a crippled build."
  4044. X86ASMFLAGS="-f $objformat"
  4045. enabled pic && append X86ASMFLAGS "-DPIC"
  4046. test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX"
  4047. case "$objformat" in
  4048. elf*) enabled debug && append X86ASMFLAGS $x86asm_debug ;;
  4049. esac
  4050. check_x86asm "vextracti128 xmm0, ymm0, 0" || disable avx2_external
  4051. check_x86asm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
  4052. check_x86asm "vfmadd132ps ymm0, ymm1, ymm2" || disable fma3_external
  4053. check_x86asm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  4054. check_x86asm "CPU amdnop" || disable cpunop
  4055. fi
  4056. case "$cpu" in
  4057. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  4058. disable fast_clz
  4059. ;;
  4060. esac
  4061. fi
  4062. check_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_neon
  4063. check_ldflags -Wl,--as-needed
  4064. if ! disabled network; then
  4065. check_func getaddrinfo $network_extralibs
  4066. check_func inet_aton $network_extralibs
  4067. check_type netdb.h "struct addrinfo"
  4068. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  4069. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  4070. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  4071. check_type poll.h "struct pollfd"
  4072. check_type netinet/sctp.h "struct sctp_event_subscribe"
  4073. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  4074. check_type netinet/in.h "struct sockaddr_in6"
  4075. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  4076. check_type "sys/types.h sys/socket.h" socklen_t
  4077. # Prefer arpa/inet.h over winsock2
  4078. if check_header arpa/inet.h ; then
  4079. check_func closesocket
  4080. elif check_header winsock2.h ; then
  4081. check_func_headers winsock2.h closesocket -lws2 &&
  4082. network_extralibs="-lws2" ||
  4083. { check_func_headers winsock2.h closesocket -lws2_32 &&
  4084. network_extralibs="-lws2_32"; } || disable winsock2_h network
  4085. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  4086. check_type ws2tcpip.h socklen_t
  4087. check_type ws2tcpip.h "struct addrinfo"
  4088. check_type ws2tcpip.h "struct group_source_req"
  4089. check_type ws2tcpip.h "struct ip_mreq_source"
  4090. check_type ws2tcpip.h "struct ipv6_mreq"
  4091. check_type winsock2.h "struct pollfd"
  4092. check_struct winsock2.h "struct sockaddr" sa_len
  4093. check_type ws2tcpip.h "struct sockaddr_in6"
  4094. check_type ws2tcpip.h "struct sockaddr_storage"
  4095. else
  4096. disable network
  4097. fi
  4098. fi
  4099. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  4100. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  4101. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  4102. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  4103. case "$custom_allocator" in
  4104. jemalloc)
  4105. # jemalloc by default does not use a prefix
  4106. require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc
  4107. ;;
  4108. tcmalloc)
  4109. require_pkg_config libtcmalloc libtcmalloc gperftools/tcmalloc.h tc_malloc
  4110. malloc_prefix=tc_
  4111. ;;
  4112. esac
  4113. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  4114. check_func ${malloc_prefix}memalign && enable memalign
  4115. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  4116. check_cpp_condition unistd.h "defined(_POSIX_MONOTONIC_CLOCK)" &&
  4117. { check_lib clock_gettime time.h clock_gettime ||
  4118. check_lib clock_gettime time.h clock_gettime -lrt; }
  4119. check_func fcntl
  4120. check_func gethrtime
  4121. check_func getopt
  4122. check_func getrusage
  4123. check_func gettimeofday
  4124. check_func gmtime_r
  4125. check_func isatty
  4126. check_func localtime_r
  4127. check_func mkstemp
  4128. check_func mmap
  4129. check_func mprotect
  4130. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  4131. check_func_headers time.h nanosleep || check_lib nanosleep time.h nanosleep -lrt
  4132. check_func sched_getaffinity
  4133. check_func setrlimit
  4134. check_func strerror_r
  4135. check_func sysconf
  4136. check_func sysctl
  4137. check_func usleep
  4138. check_func_headers io.h setmode
  4139. check_func_headers mach/mach_time.h mach_absolute_time
  4140. check_func_headers stdlib.h getenv
  4141. check_func_headers windows.h GetProcessAffinityMask
  4142. check_func_headers windows.h GetProcessTimes
  4143. check_func_headers windows.h GetSystemTimeAsFileTime
  4144. check_func_headers windows.h LoadLibrary
  4145. check_func_headers windows.h MapViewOfFile
  4146. check_func_headers windows.h SetConsoleTextAttribute
  4147. check_func_headers windows.h Sleep
  4148. check_func_headers windows.h VirtualAlloc
  4149. check_struct windows.h "CONDITION_VARIABLE" Ptr
  4150. check_header direct.h
  4151. check_header dxgidebug.h
  4152. check_header dxva.h
  4153. check_header dxva2api.h
  4154. check_header io.h
  4155. check_header malloc.h
  4156. check_header poll.h
  4157. check_header sys/param.h
  4158. check_header sys/resource.h
  4159. check_header sys/select.h
  4160. check_header sys/time.h
  4161. check_header sys/un.h
  4162. check_header unistd.h
  4163. check_header valgrind/valgrind.h
  4164. check_header VideoDecodeAcceleration/VDADecoder.h
  4165. check_header windows.h
  4166. # it seems there are versions of clang in some distros that try to use the
  4167. # gcc headers, which explodes for stdatomic
  4168. # so we also check that atomics actually work here
  4169. check_builtin stdatomic stdatomic.h "atomic_int foo; atomic_store(&foo, 0)"
  4170. check_lib ole32 "windows.h" CoTaskMemFree -lole32
  4171. check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  4172. check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  4173. check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  4174. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  4175. check_type "cuviddec.h" "CUVIDH264PICPARAMS"
  4176. check_type "cuviddec.h" "CUVIDHEVCPICPARAMS"
  4177. check_struct "cuviddec.h" "CUVIDDECODECREATEINFO" bitDepthMinus8
  4178. check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
  4179. check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
  4180. check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
  4181. check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
  4182. check_type "va/va.h va/va_dec_vp8.h" "VAPictureParameterBufferVP8"
  4183. check_type "va/va.h va/va_vpp.h" "VAProcPipelineParameterBuffer"
  4184. check_type "va/va.h va/va_enc_h264.h" "VAEncPictureParameterBufferH264"
  4185. check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
  4186. check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
  4187. check_type "va/va.h va/va_enc_mpeg2.h" "VAEncPictureParameterBufferMPEG2"
  4188. check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8"
  4189. check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9"
  4190. check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
  4191. if ! disabled w32threads && ! enabled pthreads; then
  4192. check_lib w32threads "windows.h process.h" _beginthreadex
  4193. fi
  4194. # check for some common methods of building with pthread support
  4195. # do this before the optional library checks as some of them require pthreads
  4196. if ! disabled pthreads && ! enabled w32threads; then
  4197. if check_lib pthreads pthread.h pthread_join -pthread; then
  4198. add_cflags -pthread
  4199. elif check_lib pthreads pthread.h pthread_join -pthreads; then
  4200. add_cflags -pthreads
  4201. elif check_lib pthreads pthread.h pthread_join -lpthreadGC2; then
  4202. :
  4203. elif check_lib pthreads pthread.h pthread_join -lpthread; then
  4204. :
  4205. elif check_func pthread_join; then
  4206. enable pthreads
  4207. fi
  4208. fi
  4209. enabled pthreads &&
  4210. check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
  4211. disabled zlib || check_lib zlib zlib.h zlibVersion -lz
  4212. disabled bzlib || check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
  4213. # On some systems dynamic loading requires no extra linker flags
  4214. check_lib libdl dlfcn.h dlopen || check_lib libdl dlfcn.h dlopen -ldl
  4215. check_lib libm math.h sin -lm
  4216. atan2f_args=2
  4217. ldexpf_args=2
  4218. powf_args=2
  4219. for func in $MATH_FUNCS; do
  4220. eval check_mathfunc $func \${${func}_args:-1} $libm_extralibs
  4221. done
  4222. # these are off by default, so fail if requested and not available
  4223. enabled avisynth && require_header avisynth/avisynth_c.h
  4224. enabled avxsynth && require_header avxsynth/avxsynth_c.h
  4225. enabled cuda && require cuda cuda.h cuInit -lcuda
  4226. enabled cuvid && require cuvid cuviddec.h cuvidCreateDecoder -lnvcuvid
  4227. enabled frei0r && require_header frei0r.h
  4228. enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init &&
  4229. check_lib gmp gmp.h mpz_export -lgmp
  4230. enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open
  4231. enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
  4232. enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec
  4233. enabled libfaac && require libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  4234. enabled libfdk_aac && require_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen
  4235. enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
  4236. enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
  4237. enabled libgsm && require libgsm gsm.h gsm_create -lgsm
  4238. enabled libhdcd && require_pkg_config libhdcd libhdcd "hdcd/hdcd_simple.h" hdcd_new
  4239. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  4240. enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
  4241. enabled libmfx && require_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit
  4242. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  4243. enabled libnpp && require libnpp npp.h nppGetLibVersion -lnppi -lnppc
  4244. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  4245. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  4246. enabled libopencv && require_pkg_config libopencv opencv opencv/cv.h cvCreateImageHeader
  4247. enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
  4248. enabled libopenjpeg && { check_lib libopenjpeg openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
  4249. require_pkg_config libopenjpeg libopenjpeg1 openjpeg.h opj_version -DOPJ_STATIC; }
  4250. enabled libopus && require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
  4251. enabled libpulse && require_pkg_config libpulse libpulse-simple pulse/simple.h pa_simple_new
  4252. enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
  4253. enabled libschroedinger && require_pkg_config libschroedinger schroedinger-1.0 schroedinger/schro.h schro_init
  4254. enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy
  4255. enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
  4256. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  4257. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame
  4258. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  4259. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  4260. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  4261. enabled libvpx && require_pkg_config libvpx "vpx >= 1.3.0" vpx/vpx_codec.h vpx_codec_version &&
  4262. { enabled libvpx_vp8_decoder &&
  4263. check_pkg_config libvpx_vp8_decoder vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx
  4264. enabled libvpx_vp8_encoder &&
  4265. check_pkg_config libvpx_vp8_encoder vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx
  4266. enabled libvpx_vp9_decoder &&
  4267. check_pkg_config libvpx_vp9_decoder vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx
  4268. enabled libvpx_vp9_encoder &&
  4269. check_pkg_config libvpx_vp9_encoder vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx
  4270. disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder &&
  4271. die "libvpx enabled but no supported decoders/encoders found"
  4272. }
  4273. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  4274. enabled libwebp && require_pkg_config libwebp libwebp webp/encode.h WebPGetEncoderVersion
  4275. enabled libx264 && require_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode &&
  4276. require_cpp_condition x264.h "X264_BUILD >= 118" &&
  4277. { check_cpp_condition x264.h "X264_MPEG2" &&
  4278. enable libx262; }
  4279. enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get &&
  4280. require_cpp_condition x265.h "X265_BUILD >= 57"
  4281. enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs
  4282. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  4283. enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
  4284. { ! enabled cross_compile &&
  4285. add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline &&
  4286. add_ldflags -L/opt/vc/lib/ &&
  4287. check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
  4288. die "ERROR: mmal not found" &&
  4289. check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
  4290. enabled nvenc && require_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6"
  4291. enabled omx && require_header OMX_Core.h
  4292. enabled omx_rpi && { check_header OMX_Core.h ||
  4293. { ! enabled cross_compile && add_cflags -isystem/opt/vc/include/IL && check_header OMX_Core.h ; } ||
  4294. die "ERROR: OpenMAX IL headers not found"; } && enable omx
  4295. enabled openssl && { { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
  4296. check_pkg_config openssl openssl openssl/ssl.h SSL_library_init; } ||
  4297. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  4298. check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  4299. check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  4300. die "ERROR: openssl not found"; }
  4301. # SDL adds some CFLAGS that should not be part of the general CFLAGS.
  4302. enabled avplay &&
  4303. test_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent
  4304. ! disabled pod2man && check_cmd pod2man --help && enable pod2man || disable pod2man
  4305. ! disabled texi2html && check_cmd texi2html -version && enable texi2html || disable texi2html
  4306. check_header linux/fb.h
  4307. check_header linux/videodev2.h
  4308. check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
  4309. check_header AVFoundation/AVFoundation.h
  4310. check_header sys/videoio.h
  4311. check_lib user32 "windows.h winuser.h" GetShellWindow -luser32
  4312. check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
  4313. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  4314. # w32api 3.12 had it defined wrong
  4315. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  4316. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  4317. check_header "dev/bktr/ioctl_meteor.h dev/bktr/ioctl_bt848.h" ||
  4318. check_header "machine/ioctl_meteor.h machine/ioctl_bt848.h" ||
  4319. check_header "dev/video/meteor/ioctl_meteor.h dev/video/bktr/ioctl_bt848.h" ||
  4320. check_header "dev/ic/bt8xx.h"
  4321. check_header sys/soundcard.h
  4322. enabled alsa_indev &&
  4323. check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound
  4324. enabled libjack &&
  4325. require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range
  4326. enabled sndio_indev && check_lib sndio sndio.h sio_open -lsndio
  4327. if enabled libcdio; then
  4328. check_lib libcdio "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4329. check_lib libcdio "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4330. die "ERROR: No usable libcdio/cdparanoia found"
  4331. fi
  4332. if enabled libxcb; then
  4333. require_pkg_config libxcb xcb xcb/xcb.h xcb_connect
  4334. require_pkg_config libxcb_shape xcb-shape xcb/shape.h xcb_shape_rectangles
  4335. disabled libxcb_shm ||
  4336. check_pkg_config libxcb_shm xcb-shm xcb/shm.h xcb_shm_attach
  4337. disabled libxcb_xfixes ||
  4338. check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image
  4339. fi
  4340. # d3d11va requires linking directly to dxgi and d3d11 if not building for
  4341. # the desktop api partition
  4342. check_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
  4343. #ifdef WINAPI_FAMILY
  4344. #include <winapifamily.h>
  4345. #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  4346. #error desktop, not uwp
  4347. #else
  4348. // WINAPI_FAMILY_APP, WINAPI_FAMILY_PHONE_APP => UWP
  4349. #endif
  4350. #else
  4351. #error no family set
  4352. #endif
  4353. EOF
  4354. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  4355. enabled vaapi &&
  4356. check_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" ||
  4357. disable vaapi
  4358. enabled vaapi &&
  4359. check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm
  4360. enabled vaapi &&
  4361. check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11
  4362. enabled vdpau &&
  4363. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  4364. disable vdpau
  4365. enabled vdpau &&
  4366. check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
  4367. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  4368. # add some useful compiler flags if supported
  4369. check_cflags -Wdeclaration-after-statement
  4370. check_cflags -Wall
  4371. check_cflags -Wdisabled-optimization
  4372. check_cflags -Wpointer-arith
  4373. check_cflags -Wredundant-decls
  4374. check_cflags -Wwrite-strings
  4375. check_cflags -Wtype-limits
  4376. check_cflags -Wundef
  4377. check_cflags -Wmissing-prototypes
  4378. check_cflags -Wstrict-prototypes
  4379. if enabled extra_warnings; then
  4380. check_cflags -Wcast-qual
  4381. check_cflags -Wextra
  4382. check_cflags -Wpedantic
  4383. fi
  4384. check_disable_warning(){
  4385. warning_flag=-W${1#-Wno-}
  4386. test_cflags $warning_flag && add_cflags $1
  4387. }
  4388. check_disable_warning -Wno-parentheses
  4389. check_disable_warning -Wno-switch
  4390. check_disable_warning -Wno-format-zero-length
  4391. check_disable_warning -Wno-pointer-sign
  4392. check_disable_warning_headers(){
  4393. warning_flag=-W${1#-Wno-}
  4394. test_cflags $warning_flag && add_cflags_headers $1
  4395. }
  4396. check_disable_warning_headers -Wno-deprecated-declarations
  4397. check_disable_warning_headers -Wno-unused-variable
  4398. check_objcflags -fobjc-arc && enable objc_arc
  4399. check_cc <<EOF && enable blocks_extension
  4400. void (^block)(void);
  4401. EOF
  4402. # add some linker flags
  4403. check_ldflags -Wl,--warn-common
  4404. check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  4405. enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir
  4406. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  4407. # add some strip flags
  4408. # -wN '..@*' is more selective than -x, but not available everywhere.
  4409. check_stripflags -wN \'..@*\' || check_stripflags -x || strip='true'
  4410. enabled neon_clobber_test &&
  4411. check_ldflags -Wl,--wrap,avcodec_open2 \
  4412. -Wl,--wrap,avcodec_decode_audio4 \
  4413. -Wl,--wrap,avcodec_decode_video2 \
  4414. -Wl,--wrap,avcodec_decode_subtitle2 \
  4415. -Wl,--wrap,avcodec_encode_audio2 \
  4416. -Wl,--wrap,avcodec_encode_video2 \
  4417. -Wl,--wrap,avcodec_encode_subtitle \
  4418. -Wl,--wrap,avcodec_send_packet \
  4419. -Wl,--wrap,avcodec_receive_packet \
  4420. -Wl,--wrap,avcodec_send_frame \
  4421. -Wl,--wrap,avcodec_receive_frame \
  4422. -Wl,--wrap,avresample_convert ||
  4423. disable neon_clobber_test
  4424. enabled xmm_clobber_test &&
  4425. check_ldflags -Wl,--wrap,avcodec_open2 \
  4426. -Wl,--wrap,avcodec_decode_audio4 \
  4427. -Wl,--wrap,avcodec_decode_video2 \
  4428. -Wl,--wrap,avcodec_decode_subtitle2 \
  4429. -Wl,--wrap,avcodec_encode_audio2 \
  4430. -Wl,--wrap,avcodec_encode_video2 \
  4431. -Wl,--wrap,avcodec_encode_subtitle \
  4432. -Wl,--wrap,avcodec_send_packet \
  4433. -Wl,--wrap,avcodec_receive_packet \
  4434. -Wl,--wrap,avcodec_send_frame \
  4435. -Wl,--wrap,avcodec_receive_frame \
  4436. -Wl,--wrap,avresample_convert \
  4437. -Wl,--wrap,sws_scale ||
  4438. disable xmm_clobber_test
  4439. check_ld <<EOF && enable proper_dce
  4440. extern const int array[512];
  4441. static inline int func(void) { return array[0]; }
  4442. int main(void) { return 0; }
  4443. EOF
  4444. if enabled proper_dce; then
  4445. echo "X { local: *; };" > $TMPV
  4446. if test_ldflags -Wl,${version_script},$TMPV; then
  4447. append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
  4448. check_cc <<EOF && enable symver_asm_label
  4449. void ff_foo(void) __asm__ ("av_foo@VERSION");
  4450. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  4451. EOF
  4452. check_cc <<EOF && enable symver_gnu_asm
  4453. __asm__(".symver ff_foo,av_foo@VERSION");
  4454. void ff_foo(void) {}
  4455. EOF
  4456. fi
  4457. fi
  4458. if [ -z "$optflags" ]; then
  4459. if enabled small; then
  4460. optflags=$cflags_size
  4461. elif enabled optimizations; then
  4462. optflags=$cflags_speed
  4463. else
  4464. optflags=$cflags_noopt
  4465. fi
  4466. fi
  4467. check_optflags(){
  4468. check_cflags "$@"
  4469. enabled lto && check_ldflags "$@"
  4470. }
  4471. check_optflags $optflags
  4472. check_optflags -fno-math-errno
  4473. check_optflags -fno-signed-zeros
  4474. if enabled lto; then
  4475. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  4476. check_cflags -flto
  4477. check_ldflags -flto $cpuflags
  4478. fi
  4479. if enabled icc; then
  4480. # Just warnings, no remarks
  4481. check_cflags -w1
  4482. # -wd: Disable following warnings
  4483. # 144, 167, 556: -Wno-pointer-sign
  4484. # 1292: attribute "foo" ignored
  4485. # 1419: external declaration in primary source file
  4486. # 10006: ignoring unknown option -fno-signed-zeros
  4487. # 10148: ignoring unknown option -Wno-parentheses
  4488. # 10156: ignoring option '-W'; no argument required
  4489. check_cflags -wd144,167,556,1292,1419,10006,10148,10156
  4490. # 11030: Warning unknown option --as-needed
  4491. # 10156: ignoring option '-export'; no argument required
  4492. check_ldflags -wd10156,11030
  4493. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  4494. enable ebp_available
  4495. if enabled x86_32; then
  4496. icc_version=$($cc -dumpversion)
  4497. test ${icc_version%%.*} -ge 11 &&
  4498. check_cflags -falign-stack=maintain-16-byte ||
  4499. disable aligned_stack
  4500. fi
  4501. elif enabled gcc; then
  4502. check_optflags -fno-tree-vectorize
  4503. check_cflags -Werror=implicit-function-declaration
  4504. check_cflags -Werror=missing-prototypes
  4505. check_cflags -Werror=return-type
  4506. check_cflags -Werror=declaration-after-statement
  4507. check_cflags -Werror=vla
  4508. check_cflags -Werror=format-security
  4509. check_cflags -fdiagnostics-color=auto
  4510. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  4511. elif enabled llvm_gcc; then
  4512. check_cflags -mllvm -stack-alignment=16
  4513. elif enabled clang; then
  4514. check_cflags -mllvm -stack-alignment=16
  4515. check_cflags -Qunused-arguments
  4516. check_cflags -Werror=implicit-function-declaration
  4517. check_cflags -Werror=missing-prototypes
  4518. check_cflags -Werror=return-type
  4519. elif enabled cparser; then
  4520. add_cflags -Wno-missing-variable-declarations
  4521. add_cflags -Wno-empty-statement
  4522. elif enabled armcc; then
  4523. add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
  4524. add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
  4525. # 2523: use of inline assembly is deprecated
  4526. add_cflags -W${armcc_opt},--diag_suppress=2523
  4527. add_cflags -W${armcc_opt},--diag_suppress=1207
  4528. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  4529. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  4530. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  4531. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  4532. elif enabled tms470; then
  4533. add_cflags -pds=824 -pds=837
  4534. disable inline_asm
  4535. elif enabled pathscale; then
  4536. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  4537. disable inline_asm
  4538. elif enabled_any msvc icl; then
  4539. enabled x86_32 && disable aligned_stack
  4540. enabled_all x86_32 debug && add_cflags -Oy-
  4541. enabled debug && add_ldflags -debug
  4542. enable pragma_deprecated
  4543. if enabled icl; then
  4544. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  4545. # (correctly) on icl 13.x.
  4546. check_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  4547. add_cflags -Qansi-alias
  4548. # icl will pass the inline asm tests but inline asm is currently
  4549. # not supported (build will fail)
  4550. disable inline_asm
  4551. fi
  4552. # msvcrt10 x64 incorrectly enables log2, only msvcrt12 (MSVC 2013) onwards actually has log2.
  4553. check_cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION >= 12" || disable log2
  4554. # The CRT headers contain __declspec(restrict) in a few places, but if redefining
  4555. # restrict, this might break. MSVC 2010 and 2012 fail with __declspec(__restrict)
  4556. # (as it ends up if the restrict redefine is done before including stdlib.h), while
  4557. # MSVC 2013 and newer can handle it fine.
  4558. # If this declspec fails, force including stdlib.h before the restrict redefinition
  4559. # happens in config.h.
  4560. if [ $_restrict != restrict ]; then
  4561. check_cc <<EOF || add_cflags -FIstdlib.h
  4562. __declspec($_restrict) void* foo(int);
  4563. EOF
  4564. fi
  4565. fi
  4566. for pfx in "" host_; do
  4567. varname=${pfx%_}cc_type
  4568. eval "type=\$$varname"
  4569. if [ "$type" = "msvc" ]; then
  4570. check_${pfx}cc <<EOF || add_${pfx}cflags -Dinline=__inline
  4571. static inline int foo(int a) { return a; }
  4572. EOF
  4573. fi
  4574. done
  4575. case $as_type in
  4576. clang)
  4577. add_asflags -Qunused-arguments
  4578. ;;
  4579. esac
  4580. case $ld_type in
  4581. clang)
  4582. check_ldflags -Qunused-arguments
  4583. ;;
  4584. esac
  4585. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  4586. check_deps $CONFIG_LIST \
  4587. $CONFIG_EXTRA \
  4588. $HAVE_LIST \
  4589. $ALL_COMPONENTS \
  4590. flatten_extralibs(){
  4591. unset nested_entries
  4592. list_name=$1
  4593. eval list=\$${1}
  4594. for entry in $list; do
  4595. entry_copy=$entry
  4596. resolve entry_copy
  4597. append nested_entries $(filter '*_extralibs' $entry_copy)
  4598. flat_entries=$(filter_out '*_extralibs' $entry_copy)
  4599. eval $entry="\$flat_entries"
  4600. done
  4601. append $list_name "$nested_entries"
  4602. resolve nested_entries
  4603. if test -n "$(filter '*_extralibs' $nested_entries)"; then
  4604. flatten_extralibs $list_name
  4605. fi
  4606. }
  4607. for linkunit in $LIBRARY_LIST; do
  4608. unset current_extralibs
  4609. eval components=\$$(toupper ${linkunit})_COMPONENTS_LIST
  4610. for comp in ${components}; do
  4611. enabled $comp || continue
  4612. comp_extralibs="${comp}_extralibs"
  4613. append current_extralibs $comp_extralibs
  4614. done
  4615. eval prepend ${linkunit}_extralibs $current_extralibs
  4616. done
  4617. for linkunit in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
  4618. flatten_extralibs ${linkunit}_extralibs
  4619. unique ${linkunit}_extralibs
  4620. resolve ${linkunit}_extralibs
  4621. eval ${linkunit}_extralibs=\$\(\$ldflags_filter \$${linkunit}_extralibs\)
  4622. done
  4623. map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
  4624. for thread in $THREADS_LIST; do
  4625. if enabled $thread; then
  4626. test -n "$thread_type" &&
  4627. die "ERROR: Only one thread type must be selected." ||
  4628. thread_type="$thread"
  4629. fi
  4630. done
  4631. if disabled stdatomic; then
  4632. if enabled atomics_gcc; then
  4633. add_cppflags '-I\$(SRC_PATH)/compat/atomics/gcc'
  4634. elif enabled atomics_win32; then
  4635. add_cppflags '-I\$(SRC_PATH)/compat/atomics/win32'
  4636. elif enabled atomics_suncc; then
  4637. add_cppflags '-I\$(SRC_PATH)/compat/atomics/suncc'
  4638. elif enabled pthreads; then
  4639. add_compat atomics/pthread/stdatomic.o
  4640. add_cppflags '-I\$(SRC_PATH)/compat/atomics/pthread'
  4641. else
  4642. enabled threads && die "Threading is enabled, but no atomics are available"
  4643. add_cppflags '-I\$(SRC_PATH)/compat/atomics/dummy'
  4644. fi
  4645. fi
  4646. enabled zlib && add_cppflags -DZLIB_CONST
  4647. # conditional library dependencies, in linking order
  4648. enabled movie_filter && prepend avfilter_deps "avformat avcodec"
  4649. enabled_any asyncts_filter resample_filter &&
  4650. prepend avfilter_deps "avresample"
  4651. enabled scale_filter && prepend avfilter_deps "swscale"
  4652. enabled opus_decoder && prepend avcodec_deps "avresample"
  4653. expand_deps(){
  4654. lib_deps=${1}_deps
  4655. eval "deps=\$$lib_deps"
  4656. append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
  4657. unique $lib_deps
  4658. }
  4659. map 'expand_deps $v' $LIBRARY_LIST
  4660. if test "$quiet" != "yes"; then
  4661. echo "install prefix $prefix"
  4662. echo "source path $source_path"
  4663. echo "C compiler $cc"
  4664. echo "C library $libc_type"
  4665. if test "$host_cc" != "$cc"; then
  4666. echo "host C compiler $host_cc"
  4667. echo "host C library $host_libc_type"
  4668. fi
  4669. echo "ARCH $arch ($cpu)"
  4670. if test "$extra_version" != ""; then
  4671. echo "version string suffix $extra_version"
  4672. fi
  4673. echo "big-endian ${bigendian-no}"
  4674. echo "runtime cpu detection ${runtime_cpudetect-no}"
  4675. if enabled x86; then
  4676. echo "standalone assembly ${x86asm-no}"
  4677. echo "x86 assembler ${x86asmexe}"
  4678. echo "MMX enabled ${mmx-no}"
  4679. echo "MMXEXT enabled ${mmxext-no}"
  4680. echo "3DNow! enabled ${amd3dnow-no}"
  4681. echo "3DNow! extended enabled ${amd3dnowext-no}"
  4682. echo "SSE enabled ${sse-no}"
  4683. echo "SSSE3 enabled ${ssse3-no}"
  4684. echo "AVX enabled ${avx-no}"
  4685. echo "XOP enabled ${xop-no}"
  4686. echo "FMA3 enabled ${fma3-no}"
  4687. echo "FMA4 enabled ${fma4-no}"
  4688. echo "i686 features enabled ${i686-no}"
  4689. echo "CMOV is fast ${fast_cmov-no}"
  4690. echo "EBX available ${ebx_available-no}"
  4691. echo "EBP available ${ebp_available-no}"
  4692. fi
  4693. if enabled aarch64; then
  4694. echo "NEON enabled ${neon-no}"
  4695. echo "VFP enabled ${vfp-no}"
  4696. fi
  4697. if enabled arm; then
  4698. echo "ARMv5TE enabled ${armv5te-no}"
  4699. echo "ARMv6 enabled ${armv6-no}"
  4700. echo "ARMv6T2 enabled ${armv6t2-no}"
  4701. echo "VFP enabled ${vfp-no}"
  4702. echo "NEON enabled ${neon-no}"
  4703. fi
  4704. if enabled ppc; then
  4705. echo "AltiVec enabled ${altivec-no}"
  4706. echo "VSX enabled ${vsx-no}"
  4707. echo "POWER8 enabled ${power8-no}"
  4708. echo "PPC 4xx optimizations ${ppc4xx-no}"
  4709. echo "dcbzl available ${dcbzl-no}"
  4710. fi
  4711. echo "debug symbols ${debug-no}"
  4712. echo "optimize for size ${small-no}"
  4713. echo "optimizations ${optimizations-no}"
  4714. echo "static ${static-no}"
  4715. echo "shared ${shared-no}"
  4716. echo "network support ${network-no}"
  4717. echo "threading support ${thread_type-no}"
  4718. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  4719. echo "External libraries:"
  4720. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  4721. echo
  4722. echo "External libraries providing hardware acceleration:"
  4723. print_enabled '' $HWACCEL_LIBRARY_LIST | print_3_columns
  4724. echo
  4725. echo "Libraries:"
  4726. print_enabled '' $LIBRARY_LIST | print_3_columns
  4727. echo
  4728. echo "Programs:"
  4729. print_enabled '' $PROGRAM_LIST | print_3_columns
  4730. echo
  4731. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev; do
  4732. echo "Enabled ${type}s:"
  4733. eval list=\$$(toupper $type)_LIST
  4734. print_enabled '_*' $list | print_3_columns
  4735. echo
  4736. done
  4737. if test -n "$ignore_tests"; then
  4738. ignore_tests=$(echo $ignore_tests | tr ',' ' ')
  4739. echo "Ignored FATE tests:"
  4740. echo $ignore_tests | print_3_columns
  4741. echo
  4742. fi
  4743. license="LGPL version 2.1 or later"
  4744. if enabled nonfree; then
  4745. license="nonfree and unredistributable"
  4746. elif enabled gplv3; then
  4747. license="GPL version 3 or later"
  4748. elif enabled lgplv3; then
  4749. license="LGPL version 3 or later"
  4750. elif enabled gpl; then
  4751. license="GPL version 2 or later"
  4752. fi
  4753. echo "License: $license"
  4754. echo "Creating configuration files ..."
  4755. fi # test "$quiet" != "yes"
  4756. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  4757. config_files="$TMPH avbuild/config.mak"
  4758. cat > avbuild/config.mak <<EOF
  4759. # Automatically generated by configure - do not modify!
  4760. LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
  4761. prefix=$prefix
  4762. LIBDIR=\$(DESTDIR)$libdir
  4763. SHLIBDIR=\$(DESTDIR)$shlibdir
  4764. INCDIR=\$(DESTDIR)$incdir
  4765. BINDIR=\$(DESTDIR)$bindir
  4766. DATADIR=\$(DESTDIR)$datadir
  4767. DOCDIR=\$(DESTDIR)$docdir
  4768. MANDIR=\$(DESTDIR)$mandir
  4769. SRC_PATH=$source_path
  4770. CC_IDENT=$cc_ident
  4771. ARCH=$arch
  4772. INTRINSICS=$intrinsics
  4773. CC=$cc
  4774. AS=$as
  4775. OBJCC=$objcc
  4776. LD=$ld
  4777. DEPCC=$dep_cc
  4778. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  4779. DEPAS=$as
  4780. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  4781. X86ASM=$x86asmexe
  4782. DEPX86ASM=$x86asmexe
  4783. DEPX86ASMFLAGS=\$(X86ASMFLAGS)
  4784. AR=$ar
  4785. ARFLAGS=$arflags
  4786. AR_O=$ar_o
  4787. AR_CMD=$ar
  4788. NM_CMD=$nm
  4789. RANLIB=$ranlib
  4790. STRIP=$strip
  4791. LN_S=$ln_s
  4792. CPPFLAGS=$CPPFLAGS
  4793. CFLAGS=$CFLAGS
  4794. OBJCFLAGS=$OBJCFLAGS
  4795. ASFLAGS=$ASFLAGS
  4796. AS_C=$AS_C
  4797. AS_O=$AS_O
  4798. OBJCC_C=$OBJCC_C
  4799. OBJCC_E=$OBJCC_E
  4800. OBJCC_O=$OBJCC_O
  4801. CC_C=$CC_C
  4802. CC_E=$CC_E
  4803. CC_O=$CC_O
  4804. X86ASM_O=$X86ASM_O
  4805. LD_O=$LD_O
  4806. LD_LIB=$LD_LIB
  4807. LD_PATH=$LD_PATH
  4808. DLLTOOL=$dlltool
  4809. LDFLAGS=$LDFLAGS
  4810. LDEXEFLAGS=$LDEXEFLAGS
  4811. LDSOFLAGS=$LDSOFLAGS
  4812. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  4813. STRIPFLAGS=$STRIPFLAGS
  4814. X86ASMFLAGS=$X86ASMFLAGS
  4815. LIBPREF=$LIBPREF
  4816. LIBSUF=$LIBSUF
  4817. LIBNAME=$LIBNAME
  4818. SLIBPREF=$SLIBPREF
  4819. SLIBSUF=$SLIBSUF
  4820. EXESUF=$EXESUF
  4821. EXTRA_VERSION=$extra_version
  4822. CCDEP=$CCDEP
  4823. CCDEP_FLAGS=$CCDEP_FLAGS
  4824. ASDEP=$ASDEP
  4825. ASDEP_FLAGS=$ASDEP_FLAGS
  4826. X86ASMDEP=$X86ASMDEP
  4827. X86ASMDEP_FLAGS=$X86ASMDEP_FLAGS
  4828. CC_DEPFLAGS=$CC_DEPFLAGS
  4829. AS_DEPFLAGS=$AS_DEPFLAGS
  4830. X86ASM_DEPFLAGS=$X86ASM_DEPFLAGS
  4831. HOSTCC=$host_cc
  4832. HOSTLD=$host_ld
  4833. HOSTCFLAGS=$host_cflags
  4834. HOSTCPPFLAGS=$host_cppflags
  4835. HOSTEXESUF=$HOSTEXESUF
  4836. HOSTLDFLAGS=$host_ldflags
  4837. HOSTEXTRALIBS=$host_extralibs
  4838. DEPHOSTCC=$host_cc
  4839. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  4840. HOSTCCDEP=$HOSTCCDEP
  4841. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  4842. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  4843. HOSTCC_C=$HOSTCC_C
  4844. HOSTCC_O=$HOSTCC_O
  4845. HOSTLD_O=$HOSTLD_O
  4846. TARGET_EXEC=$target_exec $target_exec_args
  4847. TARGET_PATH=$target_path
  4848. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  4849. CFLAGS-avplay=$sdl_cflags
  4850. CFLAGS_HEADERS=$CFLAGS_HEADERS
  4851. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  4852. EXTRALIBS=$extralibs
  4853. COMPAT_OBJS=$compat_objs
  4854. INSTALL=install
  4855. LIBTARGET=${LIBTARGET}
  4856. SLIBNAME=${SLIBNAME}
  4857. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  4858. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  4859. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  4860. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  4861. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  4862. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  4863. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  4864. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  4865. VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
  4866. SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
  4867. IGNORE_TESTS=$ignore_tests
  4868. EOF
  4869. map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> avbuild/config.mak' $LIBRARY_LIST
  4870. for entry in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
  4871. eval echo "EXTRALIBS-${entry}=\$${entry}_extralibs" >> avbuild/config.mak
  4872. done
  4873. cat > $TMPH <<EOF
  4874. /* Automatically generated by configure - do not modify! */
  4875. #ifndef LIBAV_CONFIG_H
  4876. #define LIBAV_CONFIG_H
  4877. #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
  4878. #define LIBAV_LICENSE "$(c_escape $license)"
  4879. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  4880. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  4881. #define restrict $_restrict
  4882. #define EXTERN_PREFIX "${extern_prefix}"
  4883. #define EXTERN_ASM ${extern_prefix}
  4884. #define SLIBSUF "$SLIBSUF"
  4885. EOF
  4886. test -n "$malloc_prefix" &&
  4887. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  4888. if enabled x86asm; then
  4889. append config_files $TMPASM
  4890. printf '' >$TMPASM
  4891. fi
  4892. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  4893. print_config ARCH_ "$config_files" $ARCH_LIST
  4894. print_config HAVE_ "$config_files" $HAVE_LIST
  4895. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  4896. $CONFIG_EXTRA \
  4897. $ALL_COMPONENTS \
  4898. echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
  4899. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  4900. cp_if_changed $TMPH config.h
  4901. touch avbuild/.config
  4902. enabled x86asm && cp_if_changed $TMPASM config.asm
  4903. cat > $TMPH <<EOF
  4904. /* Generated by ffconf */
  4905. #ifndef AVUTIL_AVCONFIG_H
  4906. #define AVUTIL_AVCONFIG_H
  4907. EOF
  4908. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  4909. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  4910. cp_if_changed $TMPH libavutil/avconfig.h
  4911. # generate the lists of enabled components
  4912. print_enabled_components(){
  4913. file=$1
  4914. struct_name=$2
  4915. name=$3
  4916. shift 3
  4917. echo "static const $struct_name * const $name[] = {" > $TMPH
  4918. for c in $*; do
  4919. enabled $c && printf " &ff_%s,\n" $c >> $TMPH
  4920. done
  4921. echo " NULL };" >> $TMPH
  4922. cp_if_changed $TMPH $file
  4923. }
  4924. print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
  4925. print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
  4926. test -n "$WARNINGS" && printf "\n$WARNINGS"
  4927. # Settings for pkg-config files
  4928. cat > avbuild/config.sh <<EOF
  4929. # Automatically generated by configure - do not modify!
  4930. shared=$shared
  4931. prefix=$prefix
  4932. libdir=$libdir
  4933. incdir=$incdir
  4934. source_path=${source_path}
  4935. LIBPREF=${LIBPREF}
  4936. LIBSUF=${LIBSUF}
  4937. extralibs_avutil="$avutil_extralibs"
  4938. extralibs_avcodec="$avcodec_extralibs"
  4939. extralibs_avformat="$avformat_extralibs"
  4940. extralibs_avdevice="$avdevice_extralibs"
  4941. extralibs_avfilter="$avfilter_extralibs"
  4942. extralibs_avresample="$avresample_extralibs"
  4943. extralibs_swscale="$swscale_extralibs"
  4944. EOF
  4945. for lib in $LIBRARY_LIST; do
  4946. lib_deps="$(eval echo \$${lib}_deps)"
  4947. echo ${lib}_deps=\"$lib_deps\" >> avbuild/config.sh
  4948. done