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.

5635 lines
170KB

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