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.

5465 lines
163KB

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