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.

5571 lines
168KB

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