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.

5524 lines
166KB

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