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.

4945 lines
146KB

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