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.

5583 lines
168KB

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