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.

5554 lines
167KB

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