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.

5420 lines
161KB

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