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.

5500 lines
166KB

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