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.

5612 lines
169KB

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