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.

5496 lines
165KB

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