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.

5618 lines
169KB

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