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.

5595 lines
169KB

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