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.

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