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.

5402 lines
162KB

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