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.

5418 lines
162KB

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