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.

5566 lines
168KB

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