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.

5480 lines
164KB

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