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.

5011 lines
149KB

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