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.

5027 lines
149KB

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