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.

5515 lines
166KB

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