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.

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