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.

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