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.

5478 lines
164KB

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