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.

5480 lines
164KB

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