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