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.

5018 lines
149KB

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