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.

5030 lines
149KB

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