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.

5424 lines
162KB

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