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.

5115 lines
152KB

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