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.

5544 lines
167KB

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