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.

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