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.

4954 lines
147KB

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