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.

5413 lines
162KB

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