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.

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