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.

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