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.

4985 lines
148KB

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