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.

5431 lines
162KB

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