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. log2_deps="!libc_msvcrt"
  1567. symver_if_any="symver_asm_label symver_gnu_asm"
  1568. valgrind_backtrace_deps="!optimizations valgrind_valgrind_h"
  1569. # threading support
  1570. atomics_gcc_if="sync_val_compare_and_swap"
  1571. atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
  1572. atomics_win32_if="MemoryBarrier"
  1573. atomics_native_if_any="$ATOMICS_LIST"
  1574. w32threads_deps="atomics_native"
  1575. threads_if_any="$THREADS_LIST"
  1576. # subsystems
  1577. dct_select="rdft"
  1578. error_resilience_select="me_cmp"
  1579. faandct_deps="faan fdctdsp"
  1580. faanidct_deps="faan idctdsp"
  1581. intrax8_select="error_resilience"
  1582. mdct_select="fft"
  1583. rdft_select="fft"
  1584. me_cmp_select="fdctdsp idctdsp pixblockdsp"
  1585. mpeg_er_select="error_resilience"
  1586. mpegaudio_select="mpegaudiodsp"
  1587. mpegaudiodsp_select="dct"
  1588. mpegvideo_select="blockdsp hpeldsp idctdsp me_cmp videodsp"
  1589. mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
  1590. qsvdec_select="qsv"
  1591. qsvenc_select="qsv"
  1592. # decoders / encoders
  1593. aac_decoder_select="imdct15 mdct sinewin"
  1594. aac_encoder_select="audio_frame_queue iirfilter mdct sinewin"
  1595. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1596. ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
  1597. ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
  1598. ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
  1599. aic_decoder_select="golomb idctdsp"
  1600. alac_encoder_select="lpc"
  1601. als_decoder_select="bswapdsp"
  1602. amrnb_decoder_select="lsp"
  1603. amrwb_decoder_select="lsp"
  1604. amv_decoder_select="sp5x_decoder"
  1605. ape_decoder_select="bswapdsp"
  1606. asv1_decoder_select="blockdsp bswapdsp idctdsp"
  1607. asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
  1608. asv2_decoder_select="blockdsp bswapdsp idctdsp"
  1609. asv2_encoder_select="bswapdsp fdctdsp pixblockdsp"
  1610. atrac1_decoder_select="mdct sinewin"
  1611. atrac3_decoder_select="mdct"
  1612. atrac3p_decoder_select="mdct sinewin"
  1613. bink_decoder_select="blockdsp hpeldsp"
  1614. binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
  1615. binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
  1616. cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
  1617. cllc_decoder_select="bswapdsp"
  1618. comfortnoise_encoder_select="lpc"
  1619. cook_decoder_select="audiodsp mdct sinewin"
  1620. cscd_decoder_select="lzo"
  1621. cscd_decoder_suggest="zlib"
  1622. dca_decoder_select="fmtconvert mdct"
  1623. dnxhd_decoder_select="blockdsp idctdsp"
  1624. dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
  1625. dvvideo_decoder_select="dvprofile idctdsp"
  1626. dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
  1627. dxa_decoder_deps="zlib"
  1628. eac3_decoder_select="ac3_decoder"
  1629. eac3_encoder_select="ac3_encoder"
  1630. eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
  1631. eatgq_decoder_select="aandcttables idctdsp"
  1632. eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpeg1video_decoder"
  1633. exr_decoder_deps="zlib"
  1634. ffv1_decoder_select="golomb rangecoder"
  1635. ffv1_encoder_select="rangecoder"
  1636. ffvhuff_decoder_select="huffyuv_decoder"
  1637. ffvhuff_encoder_select="huffyuv_encoder"
  1638. fic_decoder_select="golomb"
  1639. flac_decoder_select="golomb"
  1640. flac_encoder_select="bswapdsp golomb lpc"
  1641. flashsv_decoder_deps="zlib"
  1642. flashsv_encoder_deps="zlib"
  1643. flashsv2_decoder_deps="zlib"
  1644. flv_decoder_select="h263_decoder"
  1645. flv_encoder_select="h263_encoder"
  1646. fourxm_decoder_select="blockdsp bswapdsp"
  1647. fraps_decoder_select="bswapdsp huffman"
  1648. g2m_decoder_deps="zlib"
  1649. g2m_decoder_select="blockdsp idctdsp jpegtables"
  1650. h261_decoder_select="mpeg_er mpegvideo"
  1651. h261_encoder_select="aandcttables mpegvideoenc"
  1652. h263_decoder_select="error_resilience h263_parser h263dsp mpeg_er mpegvideo qpeldsp"
  1653. h263_encoder_select="aandcttables h263dsp mpegvideoenc"
  1654. h263i_decoder_select="h263_decoder"
  1655. h263p_encoder_select="h263_encoder"
  1656. h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel startcode videodsp"
  1657. h264_decoder_suggest="error_resilience"
  1658. h264_qsv_decoder_deps="libmfx"
  1659. h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel"
  1660. h264_qsv_encoder_deps="libmfx"
  1661. h264_qsv_encoder_select="qsvenc"
  1662. hevc_decoder_select="bswapdsp cabac golomb videodsp"
  1663. huffyuv_decoder_select="bswapdsp huffyuvdsp"
  1664. huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp"
  1665. iac_decoder_select="imc_decoder"
  1666. imc_decoder_select="bswapdsp fft mdct sinewin"
  1667. indeo3_decoder_select="hpeldsp"
  1668. interplay_video_decoder_select="hpeldsp"
  1669. jpegls_decoder_select="golomb mjpeg_decoder"
  1670. jpegls_encoder_select="golomb"
  1671. jv_decoder_select="blockdsp"
  1672. lagarith_decoder_select="huffyuvdsp"
  1673. ljpeg_encoder_select="aandcttables idctdsp jpegtables"
  1674. loco_decoder_select="golomb"
  1675. mdec_decoder_select="blockdsp idctdsp mpegvideo"
  1676. metasound_decoder_select="lsp mdct sinewin"
  1677. mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
  1678. mjpeg_decoder_select="blockdsp hpeldsp idctdsp jpegtables"
  1679. mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc"
  1680. mjpegb_decoder_select="mjpeg_decoder"
  1681. mlp_decoder_select="mlp_parser"
  1682. motionpixels_decoder_select="bswapdsp"
  1683. mp1_decoder_select="mpegaudio"
  1684. mp1float_decoder_select="mpegaudio"
  1685. mp2_decoder_select="mpegaudio"
  1686. mp2float_decoder_select="mpegaudio"
  1687. mp3_decoder_select="mpegaudio"
  1688. mp3adu_decoder_select="mpegaudio"
  1689. mp3adufloat_decoder_select="mpegaudio"
  1690. mp3float_decoder_select="mpegaudio"
  1691. mp3on4_decoder_select="mpegaudio"
  1692. mp3on4float_decoder_select="mpegaudio"
  1693. mpc7_decoder_select="bswapdsp mpegaudiodsp"
  1694. mpc8_decoder_select="mpegaudiodsp"
  1695. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1696. mpeg_xvmc_decoder_select="mpeg2video_decoder"
  1697. mpeg1video_decoder_select="error_resilience mpeg_er mpegvideo"
  1698. mpeg1video_encoder_select="aandcttables mpegvideoenc"
  1699. mpeg2video_decoder_select="error_resilience mpeg_er mpegvideo"
  1700. mpeg2video_encoder_select="aandcttables mpegvideoenc"
  1701. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1702. mpeg4_encoder_select="h263_encoder"
  1703. msmpeg4v1_decoder_select="h263_decoder"
  1704. msmpeg4v2_decoder_select="h263_decoder"
  1705. msmpeg4v2_encoder_select="h263_encoder"
  1706. msmpeg4v3_decoder_select="h263_decoder"
  1707. msmpeg4v3_encoder_select="h263_encoder"
  1708. mss2_decoder_select="error_resilience mpeg_er qpeldsp vc1_decoder"
  1709. mxpeg_decoder_select="mjpeg_decoder"
  1710. nellymoser_decoder_select="mdct sinewin"
  1711. nellymoser_encoder_select="audio_frame_queue mdct sinewin"
  1712. nuv_decoder_select="idctdsp lzo"
  1713. on2avc_decoder_select="mdct"
  1714. opus_decoder_deps="avresample"
  1715. opus_decoder_select="imdct15"
  1716. png_decoder_deps="zlib"
  1717. png_encoder_deps="zlib"
  1718. png_encoder_select="huffyuvencdsp"
  1719. prores_decoder_select="idctdsp"
  1720. prores_encoder_select="fdctdsp"
  1721. qcelp_decoder_select="lsp"
  1722. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1723. ra_144_encoder_select="audio_frame_queue lpc"
  1724. ralf_decoder_select="golomb"
  1725. rv10_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
  1726. rv10_encoder_select="h263_encoder"
  1727. rv20_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
  1728. rv20_encoder_select="h263_encoder"
  1729. rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo videodsp"
  1730. rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo videodsp"
  1731. shorten_decoder_select="golomb"
  1732. sipr_decoder_select="lsp"
  1733. sp5x_decoder_select="mjpeg_decoder"
  1734. svq1_decoder_select="hpeldsp"
  1735. svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
  1736. svq3_decoder_select="h264_decoder hpeldsp tpeldsp"
  1737. svq3_decoder_suggest="zlib"
  1738. tak_decoder_select="audiodsp"
  1739. tdsc_decoder_deps="zlib"
  1740. tdsc_decoder_select="mjpeg_decoder"
  1741. theora_decoder_select="vp3_decoder"
  1742. thp_decoder_select="mjpeg_decoder"
  1743. tiff_decoder_suggest="zlib"
  1744. tiff_encoder_suggest="zlib"
  1745. truehd_decoder_select="mlp_decoder"
  1746. truemotion2_decoder_select="bswapdsp"
  1747. truespeech_decoder_select="bswapdsp"
  1748. tscc_decoder_deps="zlib"
  1749. twinvq_decoder_select="mdct lsp sinewin"
  1750. utvideo_decoder_select="bswapdsp"
  1751. utvideo_encoder_select="bswapdsp huffman huffyuvencdsp"
  1752. vble_decoder_select="huffyuvdsp"
  1753. vc1_decoder_select="blockdsp error_resilience h263_decoder h264chroma h264qpel intrax8 mpeg_er qpeldsp startcode"
  1754. vc1image_decoder_select="vc1_decoder"
  1755. vorbis_decoder_select="mdct"
  1756. vorbis_encoder_select="mdct"
  1757. vp3_decoder_select="hpeldsp vp3dsp videodsp"
  1758. vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp"
  1759. vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
  1760. vp6a_decoder_select="vp6_decoder"
  1761. vp6f_decoder_select="vp6_decoder"
  1762. vp7_decoder_select="h264pred videodsp"
  1763. vp8_decoder_select="h264pred videodsp"
  1764. vp9_decoder_select="videodsp"
  1765. webp_decoder_select="vp8_decoder"
  1766. wmapro_decoder_select="mdct sinewin wma_freqs"
  1767. wmav1_decoder_select="mdct sinewin wma_freqs"
  1768. wmav1_encoder_select="mdct sinewin wma_freqs"
  1769. wmav2_decoder_select="mdct sinewin wma_freqs"
  1770. wmav2_encoder_select="mdct sinewin wma_freqs"
  1771. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1772. wmv1_decoder_select="h263_decoder"
  1773. wmv1_encoder_select="h263_encoder"
  1774. wmv2_decoder_select="blockdsp h263_decoder idctdsp intrax8 videodsp"
  1775. wmv2_encoder_select="h263_encoder"
  1776. wmv3_decoder_select="vc1_decoder"
  1777. wmv3image_decoder_select="wmv3_decoder"
  1778. zerocodec_decoder_deps="zlib"
  1779. zlib_decoder_deps="zlib"
  1780. zlib_encoder_deps="zlib"
  1781. zmbv_decoder_deps="zlib"
  1782. zmbv_encoder_deps="zlib"
  1783. # hardware accelerators
  1784. dxva2_deps="dxva2api_h"
  1785. vaapi_deps="va_va_h"
  1786. vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
  1787. vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
  1788. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1789. h263_vaapi_hwaccel_deps="vaapi"
  1790. h263_vaapi_hwaccel_select="h263_decoder"
  1791. h263_vdpau_hwaccel_deps="vdpau"
  1792. h263_vdpau_hwaccel_select="h263_decoder"
  1793. h264_dxva2_hwaccel_deps="dxva2"
  1794. h264_dxva2_hwaccel_select="h264_decoder"
  1795. h264_mmal_decoder_deps="mmal"
  1796. h264_mmal_hwaccel_deps="mmal"
  1797. h264_mmal_decoder_select="h264_decoder"
  1798. h264_mmal_encoder_deps="mmal"
  1799. h264_qsv_hwaccel_deps="libmfx"
  1800. h264_vaapi_hwaccel_deps="vaapi"
  1801. h264_vaapi_hwaccel_select="h264_decoder"
  1802. h264_vda_hwaccel_deps="vda"
  1803. h264_vda_hwaccel_select="h264_decoder"
  1804. h264_vda_old_hwaccel_deps="vda"
  1805. h264_vda_old_hwaccel_select="h264_decoder"
  1806. h264_vdpau_hwaccel_deps="vdpau"
  1807. h264_vdpau_hwaccel_select="h264_decoder"
  1808. hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
  1809. hevc_dxva2_hwaccel_select="hevc_decoder"
  1810. mpeg1_vdpau_hwaccel_deps="vdpau"
  1811. mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
  1812. mpeg2_dxva2_hwaccel_deps="dxva2"
  1813. mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
  1814. mpeg2_vaapi_hwaccel_deps="vaapi"
  1815. mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
  1816. mpeg2_vdpau_hwaccel_deps="vdpau"
  1817. mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
  1818. mpeg4_vaapi_hwaccel_deps="vaapi"
  1819. mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
  1820. mpeg4_vdpau_hwaccel_deps="vdpau"
  1821. mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
  1822. vc1_dxva2_hwaccel_deps="dxva2"
  1823. vc1_dxva2_hwaccel_select="vc1_decoder"
  1824. vc1_vaapi_hwaccel_deps="vaapi"
  1825. vc1_vaapi_hwaccel_select="vc1_decoder"
  1826. vc1_vdpau_hwaccel_deps="vdpau"
  1827. vc1_vdpau_hwaccel_select="vc1_decoder"
  1828. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1829. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1830. wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
  1831. # parsers
  1832. h264_parser_select="h264_decoder"
  1833. mpegvideo_parser_select="mpegvideo"
  1834. mpeg4video_parser_select="error_resilience h263dsp mpeg_er mpegvideo qpeldsp"
  1835. vc1_parser_select="mpegvideo startcode vc1_decoder"
  1836. # bitstream_filters
  1837. mjpeg2jpeg_bsf_select="jpegtables"
  1838. # external libraries
  1839. libdcadec_decoder_deps="libdcadec"
  1840. libfaac_encoder_deps="libfaac"
  1841. libfaac_encoder_select="audio_frame_queue"
  1842. libfdk_aac_decoder_deps="libfdk_aac"
  1843. libfdk_aac_encoder_deps="libfdk_aac"
  1844. libfdk_aac_encoder_select="audio_frame_queue"
  1845. libgsm_decoder_deps="libgsm"
  1846. libgsm_encoder_deps="libgsm"
  1847. libgsm_ms_decoder_deps="libgsm"
  1848. libgsm_ms_encoder_deps="libgsm"
  1849. libilbc_decoder_deps="libilbc"
  1850. libilbc_encoder_deps="libilbc"
  1851. libmp3lame_encoder_deps="libmp3lame"
  1852. libmp3lame_encoder_select="audio_frame_queue"
  1853. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1854. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1855. libopencore_amrnb_encoder_select="audio_frame_queue"
  1856. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1857. libopenh264_encoder_deps="libopenh264"
  1858. libopenjpeg_decoder_deps="libopenjpeg"
  1859. libopenjpeg_encoder_deps="libopenjpeg"
  1860. libopus_decoder_deps="libopus"
  1861. libopus_encoder_deps="libopus"
  1862. libopus_encoder_select="audio_frame_queue"
  1863. libschroedinger_decoder_deps="libschroedinger"
  1864. libschroedinger_encoder_deps="libschroedinger"
  1865. libspeex_decoder_deps="libspeex"
  1866. libspeex_encoder_deps="libspeex"
  1867. libspeex_encoder_select="audio_frame_queue"
  1868. libtheora_encoder_deps="libtheora"
  1869. libtwolame_encoder_deps="libtwolame"
  1870. libvo_aacenc_encoder_deps="libvo_aacenc"
  1871. libvo_aacenc_encoder_select="audio_frame_queue"
  1872. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  1873. libvorbis_encoder_deps="libvorbis"
  1874. libvorbis_encoder_select="audio_frame_queue"
  1875. libvpx_vp8_decoder_deps="libvpx"
  1876. libvpx_vp8_encoder_deps="libvpx"
  1877. libvpx_vp9_decoder_deps="libvpx"
  1878. libvpx_vp9_encoder_deps="libvpx"
  1879. libwavpack_encoder_deps="libwavpack"
  1880. libwebp_encoder_deps="libwebp"
  1881. libx264_encoder_deps="libx264"
  1882. libx265_encoder_deps="libx265"
  1883. libxavs_encoder_deps="libxavs"
  1884. libxvid_encoder_deps="libxvid"
  1885. # demuxers / muxers
  1886. ac3_demuxer_select="ac3_parser"
  1887. asf_demuxer_select="riffdec"
  1888. asf_muxer_select="riffenc"
  1889. asf_stream_muxer_select="asf_muxer"
  1890. avi_demuxer_select="riffdec"
  1891. avi_muxer_select="riffenc"
  1892. avisynth_demuxer_deps="avisynth"
  1893. avisynth_demuxer_select="riffdec"
  1894. caf_demuxer_select="riffdec"
  1895. dash_muxer_select="mp4_muxer"
  1896. dirac_demuxer_select="dirac_parser"
  1897. dv_demuxer_select="dvprofile"
  1898. dv_muxer_select="dvprofile"
  1899. dxa_demuxer_select="riffdec"
  1900. eac3_demuxer_select="ac3_parser"
  1901. f4v_muxer_select="mov_muxer"
  1902. flac_demuxer_select="flac_parser"
  1903. hds_muxer_select="flv_muxer"
  1904. hls_muxer_select="mpegts_muxer"
  1905. ipod_muxer_select="mov_muxer"
  1906. ismv_muxer_select="mov_muxer"
  1907. matroska_audio_muxer_select="matroska_muxer"
  1908. matroska_demuxer_select="riffdec"
  1909. matroska_demuxer_suggest="bzlib lzo zlib"
  1910. matroska_muxer_select="riffenc"
  1911. mmf_muxer_select="riffenc"
  1912. mov_demuxer_select="riffdec"
  1913. mov_demuxer_suggest="zlib"
  1914. mov_muxer_select="riffenc rtpenc_chain"
  1915. mp3_demuxer_select="mpegaudio_parser"
  1916. mp4_muxer_select="mov_muxer"
  1917. mpegts_muxer_select="adts_muxer latm_muxer"
  1918. mpegtsraw_demuxer_select="mpegts_demuxer"
  1919. mxf_d10_muxer_select="mxf_muxer"
  1920. nut_muxer_select="riffenc"
  1921. nuv_demuxer_select="riffdec"
  1922. oga_muxer_select="ogg_muxer"
  1923. ogg_demuxer_select="golomb"
  1924. opus_muxer_select="ogg_muxer"
  1925. psp_muxer_select="mov_muxer"
  1926. rtp_demuxer_select="sdp_demuxer"
  1927. rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol"
  1928. rtsp_demuxer_select="http_protocol rtpdec"
  1929. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  1930. sap_demuxer_select="sdp_demuxer"
  1931. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  1932. sdp_demuxer_select="rtpdec"
  1933. smoothstreaming_muxer_select="ismv_muxer"
  1934. spdif_muxer_select="aac_parser"
  1935. spx_muxer_select="ogg_muxer"
  1936. tak_demuxer_select="tak_parser"
  1937. tg2_muxer_select="mov_muxer"
  1938. tgp_muxer_select="mov_muxer"
  1939. w64_demuxer_select="wav_demuxer"
  1940. wav_demuxer_select="riffdec"
  1941. wav_muxer_select="riffenc"
  1942. webm_muxer_select="riffenc"
  1943. wtv_demuxer_select="riffdec"
  1944. xmv_demuxer_select="riffdec"
  1945. xwma_demuxer_select="riffdec"
  1946. # indevs / outdevs
  1947. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1948. alsa_outdev_deps="alsa_asoundlib_h"
  1949. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1950. dv1394_indev_deps="dv1394"
  1951. dv1394_indev_select="dv_demuxer"
  1952. fbdev_indev_deps="linux_fb_h"
  1953. jack_indev_deps="jack_jack_h pthreads"
  1954. libcdio_indev_deps="libcdio"
  1955. libdc1394_indev_deps="libdc1394"
  1956. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1957. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1958. pulse_indev_deps="libpulse"
  1959. sndio_indev_deps="sndio_h"
  1960. sndio_outdev_deps="sndio_h"
  1961. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1962. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1963. vfwcap_indev_extralibs="-lavicap32"
  1964. x11grab_indev_deps="x11grab"
  1965. x11grab_xcb_indev_deps="libxcb"
  1966. # protocols
  1967. ffrtmpcrypt_protocol_deps="!librtmp_protocol"
  1968. ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
  1969. ffrtmpcrypt_protocol_select="tcp_protocol"
  1970. ffrtmphttp_protocol_deps="!librtmp_protocol"
  1971. ffrtmphttp_protocol_select="http_protocol"
  1972. gopher_protocol_select="network"
  1973. http_protocol_select="tcp_protocol"
  1974. httpproxy_protocol_select="tcp_protocol"
  1975. https_protocol_select="tls_protocol"
  1976. icecast_protocol_select="http_protocol"
  1977. librtmp_protocol_deps="librtmp"
  1978. librtmpe_protocol_deps="librtmp"
  1979. librtmps_protocol_deps="librtmp"
  1980. librtmpt_protocol_deps="librtmp"
  1981. librtmpte_protocol_deps="librtmp"
  1982. mmsh_protocol_select="http_protocol"
  1983. mmst_protocol_select="network"
  1984. rtmp_protocol_deps="!librtmp_protocol"
  1985. rtmp_protocol_select="tcp_protocol"
  1986. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  1987. rtmps_protocol_deps="!librtmp_protocol"
  1988. rtmps_protocol_select="tls_protocol"
  1989. rtmpt_protocol_select="ffrtmphttp_protocol"
  1990. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  1991. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  1992. rtp_protocol_select="udp_protocol"
  1993. sctp_protocol_deps="struct_sctp_event_subscribe"
  1994. sctp_protocol_select="network"
  1995. srtp_protocol_select="rtp_protocol"
  1996. tcp_protocol_select="network"
  1997. tls_protocol_deps_any="openssl gnutls"
  1998. tls_protocol_select="tcp_protocol"
  1999. udp_protocol_select="network"
  2000. unix_protocol_deps="sys_un_h"
  2001. unix_protocol_select="network"
  2002. # filters
  2003. blackframe_filter_deps="gpl"
  2004. boxblur_filter_deps="gpl"
  2005. bs2b_filter_deps="libbs2b"
  2006. cropdetect_filter_deps="gpl"
  2007. delogo_filter_deps="gpl"
  2008. drawtext_filter_deps="libfreetype"
  2009. frei0r_filter_deps="frei0r dlopen"
  2010. frei0r_filter_extralibs='$ldl'
  2011. frei0r_src_filter_deps="frei0r dlopen"
  2012. frei0r_src_filter_extralibs='$ldl'
  2013. hqdn3d_filter_deps="gpl"
  2014. interlace_filter_deps="gpl"
  2015. ocv_filter_deps="libopencv"
  2016. resample_filter_deps="avresample"
  2017. scale_filter_deps="swscale"
  2018. # examples
  2019. avcodec_example_deps="avcodec avutil"
  2020. filter_audio_example_deps="avfilter avutil"
  2021. metadata_example_deps="avformat avutil"
  2022. output_example_deps="avcodec avformat avutil swscale"
  2023. qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
  2024. transcode_aac_example_deps="avcodec avformat avresample"
  2025. # libraries, in linking order
  2026. avcodec_deps="avutil"
  2027. avdevice_deps="avformat avcodec avutil"
  2028. avfilter_deps="avutil"
  2029. avformat_deps="avcodec avutil"
  2030. avresample_deps="avutil"
  2031. swscale_deps="avutil"
  2032. # programs
  2033. avconv_deps="avcodec avfilter avformat avresample swscale"
  2034. avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter
  2035. fps_filter null_filter resample_filter scale_filter
  2036. setpts_filter trim_filter"
  2037. avplay_deps="avcodec avformat avresample swscale sdl"
  2038. avplay_libs='$sdl_libs'
  2039. avplay_select="rdft"
  2040. avprobe_deps="avcodec avformat"
  2041. # documentation
  2042. pod2man_deps="doc"
  2043. texi2html_deps="doc"
  2044. # default parameters
  2045. logfile="config.log"
  2046. # installation paths
  2047. prefix_default="/usr/local"
  2048. bindir_default='${prefix}/bin'
  2049. datadir_default='${prefix}/share/avconv'
  2050. docdir_default='${prefix}/share/doc/libav'
  2051. incdir_default='${prefix}/include'
  2052. libdir_default='${prefix}/lib'
  2053. mandir_default='${prefix}/share/man'
  2054. shlibdir_default="$libdir_default"
  2055. # toolchain
  2056. ar_default="ar"
  2057. cc_default="gcc"
  2058. host_cc_default="gcc"
  2059. cp_f="cp -f"
  2060. ln_s="ln -s -f"
  2061. nm_default="nm -g"
  2062. objformat="elf"
  2063. pkg_config_default=pkg-config
  2064. ranlib="ranlib"
  2065. strip="strip"
  2066. yasmexe="yasm"
  2067. # machine
  2068. arch_default=$(uname -m)
  2069. cpu="generic"
  2070. intrinsics="none"
  2071. # OS
  2072. target_os_default=$(tolower $(uname -s))
  2073. host_os=$target_os_default
  2074. # configurable options
  2075. enable $EXAMPLE_LIST $LIBRARY_LIST $PROGRAM_LIST
  2076. enable asm
  2077. enable debug
  2078. enable doc
  2079. enable faan faandct faanidct
  2080. enable optimizations
  2081. enable safe_bitstream_reader
  2082. enable static
  2083. enable swscale_alpha
  2084. enable valgrind_backtrace
  2085. # By default, enable only those hwaccels that have no external dependencies.
  2086. enable dxva2 vda vdpau
  2087. # build settings
  2088. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  2089. LIBPREF="lib"
  2090. LIBSUF=".a"
  2091. FULLNAME='$(NAME)$(BUILDSUF)'
  2092. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  2093. SLIBPREF="lib"
  2094. SLIBSUF=".so"
  2095. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  2096. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  2097. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  2098. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  2099. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  2100. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  2101. asflags_filter=echo
  2102. cflags_filter=echo
  2103. ldflags_filter=echo
  2104. AS_C='-c'
  2105. AS_O='-o $@'
  2106. CC_C='-c'
  2107. CC_E='-E -o $@'
  2108. CC_O='-o $@'
  2109. LD_O='-o $@'
  2110. LD_LIB='-l%'
  2111. LD_PATH='-L'
  2112. HOSTCC_C='-c'
  2113. HOSTCC_E='-E -o $@'
  2114. HOSTCC_O='-o $@'
  2115. HOSTLD_O='-o $@'
  2116. host_libs='-lm'
  2117. host_cflags_filter=echo
  2118. host_ldflags_filter=echo
  2119. target_path='$(CURDIR)'
  2120. # since the object filename is not given with the -MM flag, the compiler
  2121. # is only able to print the basename, and we must add the path ourselves
  2122. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  2123. DEPFLAGS='-MM'
  2124. # find source path
  2125. if test -f configure; then
  2126. source_path=.
  2127. else
  2128. source_path=$(cd $(dirname "$0"); pwd)
  2129. echo "$source_path" | grep -q '[[:blank:]]' &&
  2130. die "Out of tree builds are impossible with whitespace in source path."
  2131. test -e "$source_path/config.h" &&
  2132. die "Out of tree builds are impossible with config.h in source dir."
  2133. fi
  2134. for v in "$@"; do
  2135. r=${v#*=}
  2136. l=${v%"$r"}
  2137. r=$(sh_quote "$r")
  2138. LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
  2139. done
  2140. find_things(){
  2141. thing=$1
  2142. pattern=$2
  2143. file=$source_path/$3
  2144. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  2145. }
  2146. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  2147. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  2148. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  2149. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  2150. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  2151. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  2152. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  2153. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  2154. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  2155. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  2156. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  2157. ALL_COMPONENTS="
  2158. $BSF_LIST
  2159. $DECODER_LIST
  2160. $DEMUXER_LIST
  2161. $ENCODER_LIST
  2162. $FILTER_LIST
  2163. $HWACCEL_LIST
  2164. $INDEV_LIST
  2165. $MUXER_LIST
  2166. $OUTDEV_LIST
  2167. $PARSER_LIST
  2168. $PROTOCOL_LIST
  2169. "
  2170. for n in $COMPONENT_LIST; do
  2171. v=$(toupper ${n%s})_LIST
  2172. eval enable \$$v
  2173. eval ${n}_if_any="\$$v"
  2174. done
  2175. enable $ARCH_EXT_LIST
  2176. die_unknown(){
  2177. echo "Unknown option \"$1\"."
  2178. echo "See $0 --help for available options."
  2179. exit 1
  2180. }
  2181. print_3_columns() {
  2182. cat | tr ' ' '\n' | sort | pr -r -3 -t
  2183. }
  2184. show_list() {
  2185. suffix=_$1
  2186. shift
  2187. echo $* | sed s/$suffix//g | print_3_columns
  2188. exit 0
  2189. }
  2190. rand_list(){
  2191. IFS=', '
  2192. set -- $*
  2193. unset IFS
  2194. for thing; do
  2195. comp=${thing%:*}
  2196. prob=${thing#$comp}
  2197. prob=${prob#:}
  2198. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  2199. echo "prob ${prob:-0.5}"
  2200. printf '%s\n' $comp
  2201. done
  2202. }
  2203. do_random(){
  2204. action=$1
  2205. shift
  2206. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  2207. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  2208. }
  2209. for opt do
  2210. optval="${opt#*=}"
  2211. case "$opt" in
  2212. --extra-ldflags=*)
  2213. add_ldflags $optval
  2214. ;;
  2215. --extra-ldexeflags=*)
  2216. add_ldexeflags $optval
  2217. ;;
  2218. --extra-libs=*)
  2219. add_extralibs $optval
  2220. ;;
  2221. --disable-devices)
  2222. disable $INDEV_LIST $OUTDEV_LIST
  2223. ;;
  2224. --enable-debug=*)
  2225. debuglevel="$optval"
  2226. ;;
  2227. --disable-programs)
  2228. disable $PROGRAM_LIST
  2229. ;;
  2230. --disable-everything)
  2231. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2232. ;;
  2233. --disable-all)
  2234. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2235. disable $LIBRARY_LIST $PROGRAM_LIST doc
  2236. ;;
  2237. --enable-random|--disable-random)
  2238. action=${opt%%-random}
  2239. do_random ${action#--} $COMPONENT_LIST
  2240. ;;
  2241. --enable-random=*|--disable-random=*)
  2242. action=${opt%%-random=*}
  2243. do_random ${action#--} $optval
  2244. ;;
  2245. --enable-*=*|--disable-*=*)
  2246. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  2247. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  2248. eval list=\$$(toupper $thing)_LIST
  2249. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  2250. $action $(filter "$name" $list)
  2251. ;;
  2252. --enable-avserver|--disable-avserver*)
  2253. warn "avserver has been removed, the ${opt} option is only"\
  2254. "provided for compatibility and will be removed in the future"
  2255. ;;
  2256. --enable-?*|--disable-?*)
  2257. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  2258. if is_in $option $COMPONENT_LIST; then
  2259. test $action = disable && action=unset
  2260. eval $action \$$(toupper ${option%s})_LIST
  2261. elif is_in $option $CMDLINE_SELECT; then
  2262. $action $option
  2263. else
  2264. die_unknown $opt
  2265. fi
  2266. ;;
  2267. --list-*)
  2268. NAME="${opt#--list-}"
  2269. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  2270. NAME=${NAME%s}
  2271. eval show_list $NAME \$$(toupper $NAME)_LIST
  2272. ;;
  2273. --help|-h) show_help
  2274. ;;
  2275. *)
  2276. optname="${opt%%=*}"
  2277. optname="${optname#--}"
  2278. optname=$(echo "$optname" | sed 's/-/_/g')
  2279. if is_in $optname $CMDLINE_SET; then
  2280. eval $optname='$optval'
  2281. elif is_in $optname $CMDLINE_APPEND; then
  2282. append $optname "$optval"
  2283. else
  2284. die_unknown $opt
  2285. fi
  2286. ;;
  2287. esac
  2288. done
  2289. disabled logging && logfile=/dev/null
  2290. echo "# $0 $LIBAV_CONFIGURATION" > $logfile
  2291. set >> $logfile
  2292. case "$toolchain" in
  2293. clang-asan)
  2294. cc_default="clang"
  2295. add_cflags -fsanitize=address
  2296. add_ldflags -fsanitize=address
  2297. ;;
  2298. clang-tsan)
  2299. cc_default="clang"
  2300. add_cflags -fsanitize=thread -pie
  2301. add_ldflags -fsanitize=thread -pie
  2302. ;;
  2303. clang-usan)
  2304. cc_default="clang"
  2305. add_cflags -fsanitize=undefined -O1
  2306. add_ldflags -fsanitize=undefined
  2307. ;;
  2308. gcc-asan)
  2309. cc_default="gcc"
  2310. add_cflags -fsanitize=address
  2311. add_ldflags -fsanitize=address
  2312. ;;
  2313. gcc-tsan)
  2314. cc_default="gcc"
  2315. add_cflags -fsanitize=thread -pie -fPIC
  2316. add_ldflags -fsanitize=thread -pie -fPIC
  2317. ;;
  2318. gcc-usan)
  2319. cc_default="gcc"
  2320. add_cflags -fsanitize=undefined
  2321. add_ldflags -fsanitize=undefined
  2322. ;;
  2323. valgrind-massif)
  2324. target_exec_default="valgrind"
  2325. target_exec_args="--alloc-fn=av_malloc --alloc-fn=av_mallocz"
  2326. ;;
  2327. valgrind-memcheck)
  2328. target_exec_default="valgrind"
  2329. target_exec_args="--track-origins=yes --leak-check=full"
  2330. ;;
  2331. msvc)
  2332. # Check whether the current MSVC version needs the C99 converter.
  2333. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  2334. # support enough of C99 to build libav. Default to the new
  2335. # behaviour if the regexp was unable to match anything, since this
  2336. # successfully parses the version number of existing supported
  2337. # versions that require the converter (MSVC 2010 and 2012).
  2338. cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  2339. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  2340. cc_default="cl"
  2341. else
  2342. cc_default="c99wrap cl"
  2343. fi
  2344. ld_default="link"
  2345. nm_default="dumpbin -symbols"
  2346. ar_default="lib"
  2347. target_os_default="win32"
  2348. # Use a relative path for TMPDIR. This makes sure all the
  2349. # ffconf temp files are written with a relative path, avoiding
  2350. # issues with msys/win32 path conversion for MSVC parameters
  2351. # such as -Fo<file> or -out:<file>.
  2352. TMPDIR=.
  2353. ;;
  2354. icl)
  2355. cc_default="icl"
  2356. ld_default="xilink"
  2357. nm_default="dumpbin -symbols"
  2358. ar_default="xilib"
  2359. target_os_default="win32"
  2360. TMPDIR=.
  2361. ;;
  2362. gcov)
  2363. add_cflags -fprofile-arcs -ftest-coverage
  2364. add_ldflags -fprofile-arcs -ftest-coverage
  2365. ;;
  2366. hardened)
  2367. add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
  2368. add_cflags -fno-strict-overflow -fstack-protector-all
  2369. add_ldflags -Wl,-z,relro -Wl,-z,now
  2370. ;;
  2371. ?*)
  2372. die "Unknown toolchain $toolchain"
  2373. ;;
  2374. esac
  2375. test -n "$cross_prefix" && enable cross_compile
  2376. if enabled cross_compile; then
  2377. test -n "$arch" && test -n "$target_os" ||
  2378. die "Must specify target arch and OS when cross-compiling"
  2379. fi
  2380. ar_default="${cross_prefix}${ar_default}"
  2381. cc_default="${cross_prefix}${cc_default}"
  2382. nm_default="${cross_prefix}${nm_default}"
  2383. pkg_config_default="${cross_prefix}${pkg_config_default}"
  2384. ranlib="${cross_prefix}${ranlib}"
  2385. strip="${cross_prefix}${strip}"
  2386. sysinclude_default="${sysroot}/usr/include"
  2387. set_default arch cc pkg_config sysinclude target_exec target_os
  2388. enabled cross_compile || host_cc_default=$cc
  2389. set_default host_cc
  2390. if ! $pkg_config --version >/dev/null 2>&1; then
  2391. warn "$pkg_config not found, library detection may fail."
  2392. pkg_config=false
  2393. fi
  2394. exesuf() {
  2395. case $1 in
  2396. mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2397. esac
  2398. }
  2399. EXESUF=$(exesuf $target_os)
  2400. HOSTEXESUF=$(exesuf $host_os)
  2401. # set temporary file name
  2402. : ${TMPDIR:=$TEMPDIR}
  2403. : ${TMPDIR:=$TMP}
  2404. : ${TMPDIR:=/tmp}
  2405. if ! check_cmd mktemp -u XXXXXX; then
  2406. # simple replacement for missing mktemp
  2407. # NOT SAFE FOR GENERAL USE
  2408. mktemp(){
  2409. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2410. }
  2411. fi
  2412. tmpfile(){
  2413. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  2414. (set -C; exec > $tmp) 2>/dev/null ||
  2415. die "Unable to create temporary file in $TMPDIR."
  2416. append TMPFILES $tmp
  2417. eval $1=$tmp
  2418. }
  2419. trap 'rm -f -- $TMPFILES' EXIT
  2420. tmpfile TMPASM .asm
  2421. tmpfile TMPC .c
  2422. tmpfile TMPE $EXESUF
  2423. tmpfile TMPH .h
  2424. tmpfile TMPO .o
  2425. tmpfile TMPS .S
  2426. tmpfile TMPSH .sh
  2427. tmpfile TMPV .ver
  2428. unset -f mktemp
  2429. chmod +x $TMPE
  2430. # make sure we can execute files in $TMPDIR
  2431. cat > $TMPSH 2>> $logfile <<EOF
  2432. #! /bin/sh
  2433. EOF
  2434. chmod +x $TMPSH >> $logfile 2>&1
  2435. if ! $TMPSH >> $logfile 2>&1; then
  2436. cat <<EOF
  2437. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2438. variable to another directory and make sure that it is not mounted noexec.
  2439. EOF
  2440. die "Sanity test failed."
  2441. fi
  2442. armasm_flags(){
  2443. for flag; do
  2444. case $flag in
  2445. # Filter out MSVC cl.exe options from cflags that shouldn't
  2446. # be passed to gas-preprocessor
  2447. -M[TD]*) ;;
  2448. *) echo $flag ;;
  2449. esac
  2450. done
  2451. }
  2452. ccc_flags(){
  2453. for flag; do
  2454. case $flag in
  2455. -std=c99) echo -c99 ;;
  2456. -mcpu=*) echo -arch ${flag#*=} ;;
  2457. -mieee) echo -ieee ;;
  2458. -O*|-fast) echo $flag ;;
  2459. -fno-math-errno) echo -assume nomath_errno ;;
  2460. -g) echo -g3 ;;
  2461. -Wall) echo -msg_enable level2 ;;
  2462. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  2463. -Wl,*) echo $flag ;;
  2464. -f*|-W*) ;;
  2465. *) echo $flag ;;
  2466. esac
  2467. done
  2468. }
  2469. cparser_flags(){
  2470. for flag; do
  2471. case $flag in
  2472. -Wno-switch) echo -Wno-switch-enum ;;
  2473. -Wno-format-zero-length) ;;
  2474. -Wdisabled-optimization) ;;
  2475. -Wno-pointer-sign) echo -Wno-other ;;
  2476. *) echo $flag ;;
  2477. esac
  2478. done
  2479. }
  2480. msvc_common_flags(){
  2481. for flag; do
  2482. case $flag in
  2483. # In addition to specifying certain flags under the compiler
  2484. # specific filters, they must be specified here as well or else the
  2485. # generic catch all at the bottom will print the original flag.
  2486. -Wall) ;;
  2487. -std=c99) ;;
  2488. # Common flags
  2489. -fomit-frame-pointer) ;;
  2490. -g) echo -Z7 ;;
  2491. -fno-math-errno) ;;
  2492. -fno-common) ;;
  2493. -fno-signed-zeros) ;;
  2494. -fPIC) ;;
  2495. -mthumb) ;;
  2496. -march=*) ;;
  2497. -lz) echo zlib.lib ;;
  2498. -lavifil32) echo vfw32.lib ;;
  2499. -lavicap32) echo vfw32.lib user32.lib ;;
  2500. -l*) echo ${flag#-l}.lib ;;
  2501. -L*) echo -libpath:${flag#-L} ;;
  2502. *) echo $flag ;;
  2503. esac
  2504. done
  2505. }
  2506. msvc_flags(){
  2507. msvc_common_flags "$@"
  2508. for flag; do
  2509. case $flag in
  2510. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2511. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2512. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2513. -wd4273 -wd4554 -wd4701 ;;
  2514. esac
  2515. done
  2516. }
  2517. icl_flags(){
  2518. msvc_common_flags "$@"
  2519. for flag; do
  2520. case $flag in
  2521. # Despite what Intel's documentation says -Wall, which is supported
  2522. # on Windows, does enable remarks so disable them here.
  2523. -Wall) echo $flag -Qdiag-disable:remark ;;
  2524. -std=c99) echo -Qstd=c99 ;;
  2525. esac
  2526. done
  2527. }
  2528. pgi_flags(){
  2529. for flag; do
  2530. case $flag in
  2531. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2532. -fomit-frame-pointer) echo -Mnoframe ;;
  2533. -g) echo -gopt ;;
  2534. *) echo $flag ;;
  2535. esac
  2536. done
  2537. }
  2538. suncc_flags(){
  2539. for flag; do
  2540. case $flag in
  2541. -march=*|-mcpu=*)
  2542. case "${flag#*=}" in
  2543. native) echo -xtarget=native ;;
  2544. v9|niagara) echo -xarch=sparc ;;
  2545. ultrasparc) echo -xarch=sparcvis ;;
  2546. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2547. i586|pentium) echo -xchip=pentium ;;
  2548. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2549. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2550. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2551. pentium4*) echo -xtarget=pentium4 ;;
  2552. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2553. *-sse3) echo -xarch=sse3 ;;
  2554. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2555. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2556. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2557. amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
  2558. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2559. k8|opteron|athlon64|athlon-fx)
  2560. echo -xarch=sse2a ;;
  2561. athlon*) echo -xarch=pentium_proa ;;
  2562. esac
  2563. ;;
  2564. -std=c99) echo -xc99 ;;
  2565. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2566. -fPIC) echo -KPIC -xcode=pic32 ;;
  2567. -W*,*) echo $flag ;;
  2568. -f*-*|-W*|-mimpure-text) ;;
  2569. -shared) echo -G ;;
  2570. *) echo $flag ;;
  2571. esac
  2572. done
  2573. }
  2574. tms470_flags(){
  2575. for flag; do
  2576. case $flag in
  2577. -march=*|-mcpu=*)
  2578. case "${flag#*=}" in
  2579. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2580. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2581. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2582. armv6*|arm11*) echo -mv=6 ;;
  2583. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2584. echo -mv=5e ;;
  2585. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2586. esac
  2587. ;;
  2588. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2589. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2590. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2591. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2592. -msoft-float) echo --float_support=vfplib ;;
  2593. -O[0-3]|-mf=*) echo $flag ;;
  2594. -g) echo -g -mn ;;
  2595. -pds=*) echo $flag ;;
  2596. -D*|-I*) echo $flag ;;
  2597. --gcc|--abi=*) echo $flag ;;
  2598. -me) echo $flag ;;
  2599. esac
  2600. done
  2601. }
  2602. probe_cc(){
  2603. pfx=$1
  2604. _cc=$2
  2605. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2606. unset _ld_o _ldflags _ld_lib _ld_path
  2607. unset _depflags _DEPCMD _DEPFLAGS
  2608. _flags_filter=echo
  2609. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2610. _type=llvm_gcc
  2611. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  2612. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  2613. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2614. _cflags_speed='-O3'
  2615. _cflags_size='-Os'
  2616. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2617. _type=gcc
  2618. gcc_version=$($_cc --version | head -n1)
  2619. gcc_basever=$($_cc -dumpversion)
  2620. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2621. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2622. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2623. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2624. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2625. fi
  2626. _cflags_speed='-O3'
  2627. _cflags_size='-Os'
  2628. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  2629. _type=icc
  2630. _ident=$($_cc --version | head -n1)
  2631. _depflags='-MMD'
  2632. _cflags_speed='-O3'
  2633. _cflags_size='-Os'
  2634. _cflags_noopt='-O1'
  2635. elif $_cc -v 2>&1 | grep -q xlc; then
  2636. _type=xlc
  2637. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2638. _cflags_speed='-O5'
  2639. _cflags_size='-O5 -qcompact'
  2640. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2641. _type=ccc
  2642. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2643. _DEPFLAGS='-M'
  2644. _cflags_speed='-fast'
  2645. _cflags_size='-O1'
  2646. _flags_filter=ccc_flags
  2647. elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
  2648. test -d "$sysroot" || die "No valid sysroot specified."
  2649. _type=armcc
  2650. _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
  2651. armcc_conf="$PWD/armcc.conf"
  2652. $_cc --arm_linux_configure \
  2653. --arm_linux_config_file="$armcc_conf" \
  2654. --configure_sysroot="$sysroot" \
  2655. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2656. die "Error creating armcc configuration file."
  2657. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2658. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2659. as_default="${cross_prefix}gcc"
  2660. _depflags='-MMD'
  2661. _cflags_speed='-O3'
  2662. _cflags_size='-Os'
  2663. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2664. _type=tms470
  2665. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2666. _flags='--gcc --abi=eabi -me'
  2667. _cc_e='-ppl -fe=$@'
  2668. _cc_o='-fe=$@'
  2669. _depflags='-ppa -ppd=$(@:.o=.d)'
  2670. _cflags_speed='-O3 -mf=5'
  2671. _cflags_size='-O3 -mf=2'
  2672. _flags_filter=tms470_flags
  2673. elif $_cc -v 2>&1 | grep -q clang; then
  2674. _type=clang
  2675. _ident=$($_cc --version | head -n1)
  2676. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2677. _cflags_speed='-O3'
  2678. _cflags_size='-Os'
  2679. elif $_cc -V 2>&1 | grep -q Sun; then
  2680. _type=suncc
  2681. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2682. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2683. _DEPFLAGS='-xM1 -xc99'
  2684. _ldflags='-std=c99'
  2685. _cflags_speed='-O5'
  2686. _cflags_size='-O5 -xspace'
  2687. _flags_filter=suncc_flags
  2688. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2689. _type=pathscale
  2690. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2691. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2692. _cflags_speed='-O2'
  2693. _cflags_size='-Os'
  2694. _flags_filter='filter_out -Wdisabled-optimization'
  2695. elif $_cc -v 2>&1 | grep -q Open64; then
  2696. _type=open64
  2697. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2698. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2699. _cflags_speed='-O2'
  2700. _cflags_size='-Os'
  2701. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2702. elif $_cc -V 2>&1 | grep -q Portland; then
  2703. _type=pgi
  2704. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2705. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  2706. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2707. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2708. _cflags_noopt="-O1"
  2709. _flags_filter=pgi_flags
  2710. elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
  2711. _type=armasm
  2712. _ident=$($_cc | head -n1)
  2713. # 4509: "This form of conditional instruction is deprecated"
  2714. _flags="-nologo -ignore 4509"
  2715. _flags_filter=armasm_flags
  2716. elif $_cc 2>&1 | grep -q Microsoft; then
  2717. _type=msvc
  2718. _ident=$($cc 2>&1 | head -n1)
  2719. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  2720. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  2721. _cflags_speed="-O2"
  2722. _cflags_size="-O1"
  2723. if $_cc 2>&1 | grep -q Linker; then
  2724. _ld_o='-out:$@'
  2725. else
  2726. _ld_o='-Fe$@'
  2727. fi
  2728. _cc_o='-Fo$@'
  2729. _cc_e='-P -Fi$@'
  2730. _flags_filter=msvc_flags
  2731. _ld_lib='lib%.a'
  2732. _ld_path='-libpath:'
  2733. _flags='-nologo'
  2734. _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  2735. if [ $pfx = hostcc ]; then
  2736. append _cflags -Dsnprintf=_snprintf
  2737. fi
  2738. elif $_cc 2>&1 | grep -q Intel; then
  2739. _type=icl
  2740. _ident=$($cc 2>&1 | head -n1)
  2741. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  2742. # Not only is O3 broken on 13.x+ but it is slower on all previous
  2743. # versions (tested) as well.
  2744. _cflags_speed="-O2"
  2745. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  2746. if $_cc 2>&1 | grep -q Linker; then
  2747. _ld_o='-out:$@'
  2748. else
  2749. _ld_o='-Fe$@'
  2750. fi
  2751. _cc_o='-Fo$@'
  2752. _cc_e='-P'
  2753. _flags_filter=icl_flags
  2754. _ld_lib='lib%.a'
  2755. _ld_path='-libpath:'
  2756. # -Qdiag-error to make icl error when seeing certain unknown arguments
  2757. _flags='-nologo -Qdiag-error:4044,10157'
  2758. # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
  2759. # with MSVC which enables it by default.
  2760. _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
  2761. if [ $pfx = hostcc ]; then
  2762. append _cflags -Dsnprintf=_snprintf
  2763. fi
  2764. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  2765. _type=cparser
  2766. _ident=$($_cc --version | head -n1)
  2767. _depflags='-MMD'
  2768. _cflags_speed='-O4'
  2769. _cflags_size='-O2'
  2770. _flags_filter=cparser_flags
  2771. fi
  2772. eval ${pfx}_type=\$_type
  2773. eval ${pfx}_ident=\$_ident
  2774. }
  2775. set_ccvars(){
  2776. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2777. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2778. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2779. if [ -n "$_depflags" ]; then
  2780. eval ${1}_DEPFLAGS=\$_depflags
  2781. else
  2782. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2783. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2784. eval DEP${1}FLAGS=\$_flags
  2785. fi
  2786. }
  2787. probe_cc cc "$cc"
  2788. cflags_filter=$_flags_filter
  2789. cflags_speed=$_cflags_speed
  2790. cflags_size=$_cflags_size
  2791. cflags_noopt=$_cflags_noopt
  2792. add_cflags $_flags $_cflags
  2793. cc_ldflags=$_ldflags
  2794. set_ccvars CC
  2795. probe_cc hostcc "$host_cc"
  2796. host_cflags_filter=$_flags_filter
  2797. add_host_cflags $_flags $_cflags
  2798. set_ccvars HOSTCC
  2799. test -n "$cc_type" && enable $cc_type ||
  2800. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2801. : ${as_default:=$cc}
  2802. : ${dep_cc_default:=$cc}
  2803. : ${ld_default:=$cc}
  2804. : ${host_ld_default:=$host_cc}
  2805. set_default ar as dep_cc ld host_ld
  2806. probe_cc as "$as"
  2807. asflags_filter=$_flags_filter
  2808. add_asflags $_flags $_cflags
  2809. set_ccvars AS
  2810. probe_cc ld "$ld"
  2811. ldflags_filter=$_flags_filter
  2812. add_ldflags $_flags $_ldflags
  2813. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2814. LD_O=${_ld_o-$LD_O}
  2815. LD_LIB=${_ld_lib-$LD_LIB}
  2816. LD_PATH=${_ld_path-$LD_PATH}
  2817. probe_cc hostld "$host_ld"
  2818. host_ldflags_filter=$_flags_filter
  2819. add_host_ldflags $_flags $_ldflags
  2820. HOSTLD_O=${_ld_o-$HOSTLD_O}
  2821. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2822. probe_cc depcc "$dep_cc"
  2823. CCDEP=${_DEPCMD:-$DEPCMD}
  2824. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2825. DEPCCFLAGS=$_flags
  2826. fi
  2827. if $ar 2>&1 | grep -q Microsoft; then
  2828. arflags="-nologo"
  2829. ar_o='-out:$@'
  2830. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  2831. arflags="rq"
  2832. ar_o='$@'
  2833. elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
  2834. arflags='-Xany -r -c'
  2835. ar_o='$@'
  2836. else
  2837. arflags="rc"
  2838. ar_o='$@'
  2839. fi
  2840. add_cflags $extra_cflags
  2841. add_asflags $extra_cflags
  2842. if test -n "$sysroot"; then
  2843. case "$cc_type" in
  2844. gcc|llvm_gcc|clang)
  2845. add_cppflags --sysroot="$sysroot"
  2846. add_ldflags --sysroot="$sysroot"
  2847. ;;
  2848. tms470)
  2849. add_cppflags -I"$sysinclude"
  2850. add_ldflags --sysroot="$sysroot"
  2851. ;;
  2852. esac
  2853. fi
  2854. if test "$cpu" = host; then
  2855. enabled cross_compile &&
  2856. die "--cpu=host makes no sense when cross-compiling."
  2857. case "$cc_type" in
  2858. gcc|llvm_gcc)
  2859. check_native(){
  2860. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2861. sed -n "/cc1.*$1=/{
  2862. s/.*$1=\\([^ ]*\\).*/\\1/
  2863. p
  2864. q
  2865. }" $TMPE
  2866. }
  2867. cpu=$(check_native -march || check_native -mcpu)
  2868. ;;
  2869. esac
  2870. test "${cpu:-host}" = host &&
  2871. die "--cpu=host not supported with compiler $cc"
  2872. fi
  2873. # Deal with common $arch aliases
  2874. case "$arch" in
  2875. aarch64|arm64)
  2876. arch="aarch64"
  2877. ;;
  2878. arm*)
  2879. arch="arm"
  2880. ;;
  2881. mips*|IP*)
  2882. arch="mips"
  2883. ;;
  2884. parisc*|hppa*)
  2885. arch="parisc"
  2886. ;;
  2887. "Power Macintosh"|ppc*|powerpc*)
  2888. arch="ppc"
  2889. ;;
  2890. s390|s390x)
  2891. arch="s390"
  2892. ;;
  2893. sh4|sh)
  2894. arch="sh4"
  2895. ;;
  2896. sun4u|sparc*)
  2897. arch="sparc"
  2898. ;;
  2899. tilegx|tile-gx)
  2900. arch="tilegx"
  2901. ;;
  2902. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  2903. arch="x86"
  2904. ;;
  2905. esac
  2906. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2907. enable $arch
  2908. # Add processor-specific flags
  2909. if enabled aarch64; then
  2910. case $cpu in
  2911. armv*)
  2912. cpuflags="-march=$cpu"
  2913. ;;
  2914. *)
  2915. cpuflags="-mcpu=$cpu"
  2916. ;;
  2917. esac
  2918. elif enabled alpha; then
  2919. cpuflags="-mcpu=$cpu"
  2920. elif enabled arm; then
  2921. check_arm_arch() {
  2922. check_cpp_condition stddef.h \
  2923. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  2924. $cpuflags
  2925. }
  2926. probe_arm_arch() {
  2927. if check_arm_arch 4; then echo armv4;
  2928. elif check_arm_arch 4T; then echo armv4t;
  2929. elif check_arm_arch 5; then echo armv5;
  2930. elif check_arm_arch 5E; then echo armv5e;
  2931. elif check_arm_arch 5T; then echo armv5t;
  2932. elif check_arm_arch 5TE; then echo armv5te;
  2933. elif check_arm_arch 5TEJ; then echo armv5te;
  2934. elif check_arm_arch 6; then echo armv6;
  2935. elif check_arm_arch 6J; then echo armv6j;
  2936. elif check_arm_arch 6K; then echo armv6k;
  2937. elif check_arm_arch 6Z; then echo armv6z;
  2938. elif check_arm_arch 6ZK; then echo armv6zk;
  2939. elif check_arm_arch 6T2; then echo armv6t2;
  2940. elif check_arm_arch 7; then echo armv7;
  2941. elif check_arm_arch 7A 7_A; then echo armv7-a;
  2942. elif check_arm_arch 7S; then echo armv7-a;
  2943. elif check_arm_arch 7R 7_R; then echo armv7-r;
  2944. elif check_arm_arch 7M 7_M; then echo armv7-m;
  2945. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  2946. elif check_arm_arch 8A 8_A; then echo armv8-a;
  2947. fi
  2948. }
  2949. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  2950. case $cpu in
  2951. armv*)
  2952. cpuflags="-march=$cpu"
  2953. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2954. ;;
  2955. *)
  2956. cpuflags="-mcpu=$cpu"
  2957. case $cpu in
  2958. cortex-a*) subarch=armv7a ;;
  2959. cortex-r*) subarch=armv7r ;;
  2960. cortex-m*) enable thumb; subarch=armv7m ;;
  2961. arm11*) subarch=armv6 ;;
  2962. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2963. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2964. *) subarch=$(probe_arm_arch) ;;
  2965. esac
  2966. ;;
  2967. esac
  2968. case "$subarch" in
  2969. armv5t*) enable fast_clz ;;
  2970. armv[6-8]*) enable fast_clz fast_unaligned ;;
  2971. esac
  2972. elif enabled avr32; then
  2973. case $cpu in
  2974. ap7[02]0[0-2])
  2975. subarch="avr32_ap"
  2976. cpuflags="-mpart=$cpu"
  2977. ;;
  2978. ap)
  2979. subarch="avr32_ap"
  2980. cpuflags="-march=$cpu"
  2981. ;;
  2982. uc3[ab]*)
  2983. subarch="avr32_uc"
  2984. cpuflags="-mcpu=$cpu"
  2985. ;;
  2986. uc)
  2987. subarch="avr32_uc"
  2988. cpuflags="-march=$cpu"
  2989. ;;
  2990. esac
  2991. elif enabled bfin; then
  2992. cpuflags="-mcpu=$cpu"
  2993. elif enabled mips; then
  2994. cpuflags="-march=$cpu"
  2995. elif enabled ppc; then
  2996. disable ldbrx
  2997. case $(tolower $cpu) in
  2998. 601|ppc601|powerpc601)
  2999. cpuflags="-mcpu=601"
  3000. disable altivec
  3001. ;;
  3002. 603*|ppc603*|powerpc603*)
  3003. cpuflags="-mcpu=603"
  3004. disable altivec
  3005. ;;
  3006. 604*|ppc604*|powerpc604*)
  3007. cpuflags="-mcpu=604"
  3008. disable altivec
  3009. ;;
  3010. g3|75*|ppc75*|powerpc75*)
  3011. cpuflags="-mcpu=750"
  3012. disable altivec
  3013. ;;
  3014. g4|745*|ppc745*|powerpc745*)
  3015. cpuflags="-mcpu=7450"
  3016. ;;
  3017. 74*|ppc74*|powerpc74*)
  3018. cpuflags="-mcpu=7400"
  3019. ;;
  3020. g5|970|ppc970|powerpc970)
  3021. cpuflags="-mcpu=970"
  3022. ;;
  3023. power[3-7]*)
  3024. cpuflags="-mcpu=$cpu"
  3025. ;;
  3026. cell)
  3027. cpuflags="-mcpu=cell"
  3028. enable ldbrx
  3029. ;;
  3030. e500mc)
  3031. cpuflags="-mcpu=e500mc"
  3032. disable altivec
  3033. ;;
  3034. e500v2)
  3035. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  3036. disable altivec
  3037. disable dcbzl
  3038. ;;
  3039. e500)
  3040. cpuflags="-mcpu=8540 -mhard-float"
  3041. disable altivec
  3042. disable dcbzl
  3043. ;;
  3044. esac
  3045. elif enabled sparc; then
  3046. case $cpu in
  3047. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  3048. cpuflags="-mcpu=$cpu"
  3049. ;;
  3050. ultrasparc*|niagara[234])
  3051. cpuflags="-mcpu=$cpu"
  3052. ;;
  3053. esac
  3054. elif enabled x86; then
  3055. case $cpu in
  3056. i[345]86|pentium)
  3057. cpuflags="-march=$cpu"
  3058. disable i686
  3059. disable mmx
  3060. ;;
  3061. # targets that do NOT support nopl and conditional mov (cmov)
  3062. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  3063. cpuflags="-march=$cpu"
  3064. disable i686
  3065. ;;
  3066. # targets that do support nopl and conditional mov (cmov)
  3067. 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*)
  3068. cpuflags="-march=$cpu"
  3069. enable i686
  3070. enable fast_cmov
  3071. ;;
  3072. # targets that do support conditional mov but on which it's slow
  3073. pentium4|pentium4m|prescott|nocona)
  3074. cpuflags="-march=$cpu"
  3075. enable i686
  3076. disable fast_cmov
  3077. ;;
  3078. esac
  3079. fi
  3080. if [ "$cpu" != generic ]; then
  3081. add_cflags $cpuflags
  3082. add_asflags $cpuflags
  3083. fi
  3084. # compiler sanity check
  3085. check_exec <<EOF
  3086. int main(void){ return 0; }
  3087. EOF
  3088. if test "$?" != 0; then
  3089. echo "$cc is unable to create an executable file."
  3090. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  3091. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  3092. echo "Only do this if you know what cross compiling means."
  3093. fi
  3094. die "C compiler test failed."
  3095. fi
  3096. add_cppflags -D_ISOC99_SOURCE
  3097. check_cflags -std=c99
  3098. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  3099. #include <stdlib.h>
  3100. EOF
  3101. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  3102. #include <stdlib.h>
  3103. EOF
  3104. add_host_cppflags -D_ISOC99_SOURCE
  3105. check_host_cflags -std=c99
  3106. check_host_cflags -Wall
  3107. check_host_cflags -O3
  3108. check_64bit(){
  3109. arch32=$1
  3110. arch64=$2
  3111. expr=$3
  3112. check_code cc "" "int test[2*($expr) - 1]" &&
  3113. subarch=$arch64 || subarch=$arch32
  3114. }
  3115. case "$arch" in
  3116. aarch64|alpha|ia64)
  3117. spic=$shared
  3118. ;;
  3119. mips)
  3120. check_64bit mips mips64 '_MIPS_SIM > 1'
  3121. spic=$shared
  3122. ;;
  3123. parisc)
  3124. check_64bit parisc parisc64 'sizeof(void *) > 4'
  3125. spic=$shared
  3126. ;;
  3127. ppc)
  3128. check_64bit ppc ppc64 'sizeof(void *) > 4'
  3129. spic=$shared
  3130. ;;
  3131. s390)
  3132. check_64bit s390 s390x 'sizeof(void *) > 4'
  3133. spic=$shared
  3134. ;;
  3135. sparc)
  3136. check_64bit sparc sparc64 'sizeof(void *) > 4'
  3137. spic=$shared
  3138. ;;
  3139. x86)
  3140. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  3141. if test "$subarch" = "x86_64"; then
  3142. spic=$shared
  3143. fi
  3144. ;;
  3145. esac
  3146. enable $subarch
  3147. enabled spic && enable_weak pic
  3148. # OS specific
  3149. case $target_os in
  3150. aix)
  3151. SHFLAGS=-shared
  3152. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  3153. enabled shared && add_ldflags -Wl,-brtl
  3154. ;;
  3155. android)
  3156. disable symver
  3157. enable section_data_rel_ro
  3158. SLIB_INSTALL_NAME='$(SLIBNAME)'
  3159. SLIB_INSTALL_LINKS=
  3160. # soname not set on purpose
  3161. SHFLAGS=-shared
  3162. ;;
  3163. haiku)
  3164. prefix_default="/boot/common"
  3165. network_extralibs="-lnetwork"
  3166. host_libs=
  3167. ;;
  3168. sunos)
  3169. SHFLAGS='-shared -Wl,-h,$$(@F)'
  3170. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  3171. network_extralibs="-lsocket -lnsl"
  3172. # When using suncc to build, the Solaris linker will mark
  3173. # an executable with each instruction set encountered by
  3174. # the Solaris assembler. As our libraries contain their own
  3175. # guards for processor-specific code, instead suppress
  3176. # generation of the HWCAPS ELF section on Solaris x86 only.
  3177. enabled_all suncc x86 &&
  3178. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  3179. add_ldflags -Wl,-M,mapfile
  3180. nm_default='nm -P -g'
  3181. ;;
  3182. netbsd)
  3183. disable symver
  3184. oss_indev_extralibs="-lossaudio"
  3185. oss_outdev_extralibs="-lossaudio"
  3186. ;;
  3187. openbsd|bitrig)
  3188. disable symver
  3189. SHFLAGS='-shared'
  3190. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  3191. SLIB_INSTALL_LINKS=
  3192. oss_indev_extralibs="-lossaudio"
  3193. oss_outdev_extralibs="-lossaudio"
  3194. ;;
  3195. dragonfly)
  3196. disable symver
  3197. ;;
  3198. freebsd)
  3199. ;;
  3200. bsd/os)
  3201. add_extralibs -lpoll -lgnugetopt
  3202. ;;
  3203. darwin)
  3204. enabled ppc && add_asflags -force_cpusubtype_ALL
  3205. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  3206. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  3207. add_ldflags -Wl,-dynamic,-search_paths_first
  3208. SLIBSUF=".dylib"
  3209. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  3210. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  3211. objformat="macho"
  3212. enabled x86_64 && objformat="macho64"
  3213. enabled_any pic shared ||
  3214. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  3215. ;;
  3216. mingw32*)
  3217. if test $target_os = "mingw32ce"; then
  3218. disable network
  3219. else
  3220. target_os=mingw32
  3221. fi
  3222. LIBTARGET=i386
  3223. if enabled x86_64; then
  3224. LIBTARGET="i386:x86-64"
  3225. elif enabled arm; then
  3226. LIBTARGET=arm-wince
  3227. fi
  3228. check_ldflags -Wl,--nxcompat
  3229. check_ldflags -Wl,--dynamicbase
  3230. shlibdir_default="$bindir_default"
  3231. SLIBPREF=""
  3232. SLIBSUF=".dll"
  3233. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3234. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3235. 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)'
  3236. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3237. SLIB_INSTALL_LINKS=
  3238. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3239. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3240. 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'
  3241. objformat="win32"
  3242. dlltool="${cross_prefix}dlltool"
  3243. ranlib=:
  3244. enable dos_paths
  3245. ;;
  3246. win32|win64)
  3247. disable symver
  3248. if enabled shared; then
  3249. # Link to the import library instead of the normal static library
  3250. # for shared libs.
  3251. LD_LIB='%.lib'
  3252. # Cannot build both shared and static libs with MSVC or icl.
  3253. disable static
  3254. fi
  3255. shlibdir_default="$bindir_default"
  3256. SLIBPREF=""
  3257. SLIBSUF=".dll"
  3258. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3259. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3260. SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3261. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3262. SLIB_INSTALL_LINKS=
  3263. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3264. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3265. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3266. objformat="win32"
  3267. ranlib=:
  3268. enable dos_paths
  3269. ;;
  3270. cygwin*)
  3271. target_os=cygwin
  3272. shlibdir_default="$bindir_default"
  3273. SLIBPREF="cyg"
  3274. SLIBSUF=".dll"
  3275. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3276. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3277. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3278. SLIB_INSTALL_LINKS=
  3279. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  3280. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  3281. objformat="win32"
  3282. enable dos_paths
  3283. ;;
  3284. *-dos|freedos|opendos)
  3285. network_extralibs="-lsocket"
  3286. objformat="coff"
  3287. enable dos_paths
  3288. add_cppflags -U__STRICT_ANSI__
  3289. ;;
  3290. linux)
  3291. enable dv1394
  3292. enable section_data_rel_ro
  3293. ;;
  3294. irix*)
  3295. target_os=irix
  3296. ranlib="echo ignoring ranlib"
  3297. ;;
  3298. os/2*)
  3299. ln_s="cp -f"
  3300. objformat="aout"
  3301. add_cppflags -D_GNU_SOURCE
  3302. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  3303. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  3304. LIBSUF="_s.a"
  3305. SLIBPREF=""
  3306. SLIBSUF=".dll"
  3307. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3308. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  3309. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  3310. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  3311. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  3312. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  3313. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  3314. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  3315. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  3316. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  3317. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  3318. enable dos_paths
  3319. ;;
  3320. gnu/kfreebsd)
  3321. add_cppflags -D_BSD_SOURCE
  3322. ;;
  3323. gnu)
  3324. ;;
  3325. qnx)
  3326. add_cppflags -D_QNX_SOURCE
  3327. network_extralibs="-lsocket"
  3328. ;;
  3329. symbian)
  3330. SLIBSUF=".dll"
  3331. enable dos_paths
  3332. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  3333. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  3334. add_ldflags -Wl,--target1-abs,--no-undefined \
  3335. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  3336. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  3337. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  3338. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  3339. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  3340. ;;
  3341. osf1)
  3342. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  3343. ;;
  3344. minix)
  3345. ;;
  3346. plan9)
  3347. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  3348. -D_REENTRANT_SOURCE \
  3349. -D_RESEARCH_SOURCE \
  3350. -DFD_SETSIZE=96 \
  3351. -DHAVE_SOCK_OPTS
  3352. add_compat strtod.o strtod=avpriv_strtod
  3353. network_extralibs='-lbsd'
  3354. exeobjs=compat/plan9/main.o
  3355. cp_f='cp'
  3356. ;;
  3357. none)
  3358. ;;
  3359. *)
  3360. die "Unknown OS '$target_os'."
  3361. ;;
  3362. esac
  3363. # determine libc flavour
  3364. probe_libc(){
  3365. pfx=$1
  3366. pfx_no_=${pfx%_}
  3367. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  3368. if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
  3369. eval ${pfx}libc_type=uclibc
  3370. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3371. elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then
  3372. eval ${pfx}libc_type=glibc
  3373. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3374. # MinGW headers can be installed on Cygwin, so check for newlib first.
  3375. elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  3376. eval ${pfx}libc_type=newlib
  3377. add_${pfx}cppflags -U__STRICT_ANSI__
  3378. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  3379. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  3380. eval ${pfx}libc_type=mingw64
  3381. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3382. eval test \$${pfx_no_}cc_type = "gcc" &&
  3383. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3384. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  3385. check_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  3386. eval ${pfx}libc_type=mingw32
  3387. check_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  3388. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  3389. die "ERROR: MinGW32 runtime version must be >= 3.15."
  3390. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3391. eval test \$${pfx_no_}cc_type = "gcc" &&
  3392. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3393. elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  3394. eval ${pfx}libc_type=msvcrt
  3395. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  3396. # 0x601 by default unless something else is set by the user.
  3397. # This can easily lead to us detecting functions only present
  3398. # in such new versions and producing binaries requiring windows 7.0.
  3399. # Therefore explicitly set the default to XP unless the user has
  3400. # set something else on the command line.
  3401. check_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  3402. add_${pfx}cppflags -D_WIN32_WINNT=0x0502
  3403. elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  3404. eval ${pfx}libc_type=klibc
  3405. elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  3406. eval ${pfx}libc_type=bionic
  3407. elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  3408. eval ${pfx}libc_type=solaris
  3409. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  3410. else
  3411. eval ${pfx}libc_type=default
  3412. add_${pfx}cppflags -D_DEFAULT_SOURCE
  3413. fi
  3414. }
  3415. probe_libc
  3416. test -n "$libc_type" && enable libc_$libc_type
  3417. probe_libc host_
  3418. test -n "$host_libc_type" && enable host_libc_$host_libc_type
  3419. case $libc_type in
  3420. bionic)
  3421. add_compat strtod.o strtod=avpriv_strtod
  3422. ;;
  3423. msvcrt)
  3424. add_compat strtod.o strtod=avpriv_strtod
  3425. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  3426. _snprintf=avpriv_snprintf \
  3427. vsnprintf=avpriv_vsnprintf
  3428. ;;
  3429. esac
  3430. # hacks for compiler/libc/os combinations
  3431. if enabled_all tms470 libc_glibc; then
  3432. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  3433. add_cppflags -D__USER_LABEL_PREFIX__=
  3434. add_cppflags -D__builtin_memset=memset
  3435. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  3436. add_cflags -pds=48 # incompatible redefinition of macro
  3437. fi
  3438. if enabled_all ccc libc_glibc; then
  3439. add_ldflags -Wl,-z,now # calls to libots crash without this
  3440. fi
  3441. check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
  3442. add_cppflags '-I\$(SRC_PATH)/compat/float'
  3443. esc(){
  3444. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  3445. }
  3446. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate
  3447. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  3448. set_default $PATHS_LIST
  3449. set_default nm
  3450. # we need to build at least one lib type
  3451. if ! enabled_any static shared; then
  3452. cat <<EOF
  3453. At least one library type must be built.
  3454. Specify --enable-static to build the static libraries or --enable-shared to
  3455. build the shared libraries as well. To only build the shared libraries specify
  3456. --disable-static in addition to --enable-shared.
  3457. EOF
  3458. exit 1;
  3459. fi
  3460. die_license_disabled() {
  3461. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  3462. }
  3463. die_license_disabled gpl libcdio
  3464. die_license_disabled gpl libx264
  3465. die_license_disabled gpl libx265
  3466. die_license_disabled gpl libxavs
  3467. die_license_disabled gpl libxvid
  3468. die_license_disabled gpl x11grab
  3469. die_license_disabled nonfree libfaac
  3470. die_license_disabled nonfree libfdk_aac
  3471. die_license_disabled nonfree openssl
  3472. die_license_disabled version3 libopencore_amrnb
  3473. die_license_disabled version3 libopencore_amrwb
  3474. die_license_disabled version3 libvo_aacenc
  3475. die_license_disabled version3 libvo_amrwbenc
  3476. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3477. disabled optimizations || check_cflags -fomit-frame-pointer
  3478. enable_weak_pic() {
  3479. disabled pic && return
  3480. enable pic
  3481. add_cppflags -DPIC
  3482. case "$target_os" in
  3483. mingw*|cygwin*)
  3484. ;;
  3485. *)
  3486. add_cflags -fPIC
  3487. ;;
  3488. esac
  3489. add_asflags -fPIC
  3490. }
  3491. enabled pic && enable_weak_pic
  3492. check_cc <<EOF || die "Symbol mangling check failed."
  3493. int ff_extern;
  3494. EOF
  3495. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3496. extern_prefix=${sym%%ff_extern*}
  3497. check_cc <<EOF && enable_weak inline_asm
  3498. void foo(void) { __asm__ volatile ("" ::); }
  3499. EOF
  3500. _restrict=
  3501. for restrict_keyword in restrict __restrict__ __restrict; do
  3502. check_cc <<EOF && _restrict=$restrict_keyword && break
  3503. void foo(char * $restrict_keyword p);
  3504. EOF
  3505. done
  3506. check_cc <<EOF && enable pragma_deprecated
  3507. void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
  3508. EOF
  3509. check_cc <<EOF && enable attribute_packed
  3510. struct { int x; } __attribute__((packed)) x;
  3511. EOF
  3512. check_cc <<EOF && enable attribute_may_alias
  3513. union { int x; } __attribute__((may_alias)) x;
  3514. EOF
  3515. check_cc <<EOF || die "endian test failed"
  3516. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3517. EOF
  3518. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3519. check_gas() {
  3520. log "check_gas using '$as' as AS"
  3521. # :vararg is used on aarch64, arm and ppc altivec
  3522. check_as <<EOF || return 1
  3523. .macro m n, y:vararg=0
  3524. \n: .int \y
  3525. .endm
  3526. m x
  3527. EOF
  3528. # .altmacro is only used in arm asm
  3529. ! enabled arm || check_as <<EOF || return 1
  3530. .altmacro
  3531. EOF
  3532. enable gnu_as
  3533. return 0
  3534. }
  3535. if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
  3536. nogas=:
  3537. enabled_any arm aarch64 && nogas=die
  3538. enabled_all ppc altivec && nogas=warn
  3539. as_noop=-v
  3540. case $as_type in
  3541. arm*) gaspp_as_type=armasm; as_noop=-h ;;
  3542. gcc) gaspp_as_type=gas ;;
  3543. *) gaspp_as_type=$as_type ;;
  3544. esac
  3545. [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
  3546. check_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as $as_noop &&
  3547. gas="gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as"
  3548. if ! check_gas ; then
  3549. as=${gas:=$as}
  3550. check_gas || \
  3551. $nogas "GNU assembler not found, install/update gas-preprocessor"
  3552. fi
  3553. check_as <<EOF && enable as_func
  3554. .func test
  3555. .endfunc
  3556. EOF
  3557. fi
  3558. check_inline_asm inline_asm_labels '"1:\n"'
  3559. if enabled aarch64; then
  3560. enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
  3561. # internal assembler in clang 3.3 does not support this instruction
  3562. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  3563. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  3564. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  3565. elif enabled alpha; then
  3566. check_cflags -mieee
  3567. elif enabled arm; then
  3568. check_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
  3569. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3570. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  3571. enable vfp_args
  3572. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  3573. case "${cross_prefix:-$cc}" in
  3574. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3575. *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  3576. __asm__ (".eabi_attribute 28, 1");
  3577. int main(void) { return 0; }
  3578. EOF
  3579. esac
  3580. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3581. fi
  3582. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3583. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3584. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3585. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3586. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3587. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3588. [ $target_os = linux ] || [ $target_os = android ] ||
  3589. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3590. $ARCH_EXT_LIST_ARM
  3591. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3592. check_as <<EOF && enable as_dn_directive
  3593. ra .dn d0.i16
  3594. .unreq ra
  3595. EOF
  3596. # llvm's integrated assembler supports .object_arch from llvm 3.5
  3597. [ "$objformat" = elf ] && check_as <<EOF && enable as_object_arch
  3598. .object_arch armv4
  3599. EOF
  3600. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  3601. elif enabled mips; then
  3602. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3603. elif enabled parisc; then
  3604. if enabled gcc; then
  3605. case $($cc -dumpversion) in
  3606. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3607. esac
  3608. fi
  3609. elif enabled ppc; then
  3610. enable local_aligned_8 local_aligned_16
  3611. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3612. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3613. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3614. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3615. # AltiVec flags: The FSF version of GCC differs from the Apple version
  3616. if enabled altivec; then
  3617. check_cflags -maltivec -mabi=altivec &&
  3618. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  3619. check_cflags -faltivec
  3620. # check if our compiler supports Motorola AltiVec C API
  3621. check_cc <<EOF || disable altivec
  3622. $inc_altivec_h
  3623. int main(void) {
  3624. vector signed int v1 = (vector signed int) { 0 };
  3625. vector signed int v2 = (vector signed int) { 1 };
  3626. v1 = vec_add(v1, v2);
  3627. return 0;
  3628. }
  3629. EOF
  3630. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3631. fi
  3632. elif enabled x86; then
  3633. check_builtin rdtsc intrin.h "__rdtsc()"
  3634. check_builtin mm_empty mmintrin.h "_mm_empty()"
  3635. enable local_aligned_8 local_aligned_16
  3636. # check whether EBP is available on x86
  3637. # As 'i' is stored on the stack, this program will crash
  3638. # if the base pointer is used to access it because the
  3639. # base pointer is cleared in the inline assembly code.
  3640. check_exec_crash <<EOF && enable ebp_available
  3641. volatile int i=0;
  3642. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3643. return i;
  3644. EOF
  3645. # check whether EBX is available on x86
  3646. check_inline_asm ebx_available '""::"b"(0)' &&
  3647. check_inline_asm ebx_available '"":::"%ebx"'
  3648. # check whether xmm clobbers are supported
  3649. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3650. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3651. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3652. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3653. if ! disabled_any asm mmx yasm; then
  3654. if check_cmd $yasmexe --version; then
  3655. enabled x86_64 && yasm_extra="-m amd64"
  3656. yasm_debug="-g dwarf2"
  3657. elif check_cmd nasm -v; then
  3658. yasmexe=nasm
  3659. yasm_debug="-g -F dwarf"
  3660. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  3661. fi
  3662. YASMFLAGS="-f $objformat $yasm_extra"
  3663. enabled pic && append YASMFLAGS "-DPIC"
  3664. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  3665. case "$objformat" in
  3666. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  3667. esac
  3668. check_yasm "movbe ecx, [5]" && enable yasm ||
  3669. die "yasm/nasm not found or too old. Use --disable-yasm for a crippled build."
  3670. check_yasm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
  3671. check_yasm "vfmadd132ps ymm0, ymm1, ymm2" || disable fma3_external
  3672. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  3673. check_yasm "CPU amdnop" || disable cpunop
  3674. fi
  3675. case "$cpu" in
  3676. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  3677. disable fast_clz
  3678. ;;
  3679. esac
  3680. fi
  3681. check_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_neon
  3682. check_ldflags -Wl,--as-needed
  3683. if check_func dlopen; then
  3684. ldl=
  3685. elif check_func dlopen -ldl; then
  3686. ldl=-ldl
  3687. fi
  3688. if ! disabled network; then
  3689. check_func getaddrinfo $network_extralibs
  3690. check_func getservbyport $network_extralibs
  3691. check_func inet_aton $network_extralibs
  3692. check_type netdb.h "struct addrinfo"
  3693. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3694. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3695. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3696. check_type poll.h "struct pollfd"
  3697. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3698. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3699. check_type netinet/in.h "struct sockaddr_in6"
  3700. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3701. check_type "sys/types.h sys/socket.h" socklen_t
  3702. # Prefer arpa/inet.h over winsock2
  3703. if check_header arpa/inet.h ; then
  3704. check_func closesocket
  3705. elif check_header winsock2.h ; then
  3706. check_func_headers winsock2.h closesocket -lws2 &&
  3707. network_extralibs="-lws2" ||
  3708. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3709. network_extralibs="-lws2_32"; } || disable winsock2_h network
  3710. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3711. check_type ws2tcpip.h socklen_t
  3712. check_type ws2tcpip.h "struct addrinfo"
  3713. check_type ws2tcpip.h "struct group_source_req"
  3714. check_type ws2tcpip.h "struct ip_mreq_source"
  3715. check_type ws2tcpip.h "struct ipv6_mreq"
  3716. check_type winsock2.h "struct pollfd"
  3717. check_struct winsock2.h "struct sockaddr" sa_len
  3718. check_type ws2tcpip.h "struct sockaddr_in6"
  3719. check_type ws2tcpip.h "struct sockaddr_storage"
  3720. else
  3721. disable network
  3722. fi
  3723. fi
  3724. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  3725. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  3726. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  3727. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  3728. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3729. check_func ${malloc_prefix}memalign && enable memalign
  3730. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3731. check_cpp_condition unistd.h "defined(_POSIX_MONOTONIC_CLOCK)" &&
  3732. check_func_headers time.h clock_gettime || { check_func_headers time.h clock_gettime -lrt && add_extralibs -lrt && LIBRT="-lrt"; }
  3733. check_func fcntl
  3734. check_func fork
  3735. check_func gethrtime
  3736. check_func getopt
  3737. check_func getrusage
  3738. check_func gettimeofday
  3739. check_func gmtime_r
  3740. check_func isatty
  3741. check_func localtime_r
  3742. check_func mach_absolute_time
  3743. check_func mkstemp
  3744. check_func mmap
  3745. check_func mprotect
  3746. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3747. check_func_headers time.h nanosleep || { check_func_headers time.h nanosleep -lrt && add_extralibs -lrt; }
  3748. check_func sched_getaffinity
  3749. check_func setrlimit
  3750. check_func strerror_r
  3751. check_func sysconf
  3752. check_func sysctl
  3753. check_func usleep
  3754. check_func_headers io.h setmode
  3755. check_func_headers stdlib.h getenv
  3756. check_func_headers windows.h CoTaskMemFree -lole32
  3757. check_func_headers windows.h GetProcessAffinityMask
  3758. check_func_headers windows.h GetProcessTimes
  3759. check_func_headers windows.h GetSystemTimeAsFileTime
  3760. check_func_headers windows.h MapViewOfFile
  3761. check_func_headers windows.h SetConsoleTextAttribute
  3762. check_func_headers windows.h Sleep
  3763. check_func_headers windows.h VirtualAlloc
  3764. check_struct windows.h "CONDITION_VARIABLE" Ptr
  3765. check_header direct.h
  3766. check_header dlfcn.h
  3767. check_header dxva.h
  3768. check_header dxva2api.h
  3769. check_header io.h
  3770. check_header mach/mach_time.h
  3771. check_header malloc.h
  3772. check_header poll.h
  3773. check_header sys/mman.h
  3774. check_header sys/param.h
  3775. check_header sys/resource.h
  3776. check_header sys/select.h
  3777. check_header sys/time.h
  3778. check_header sys/un.h
  3779. check_header unistd.h
  3780. check_header valgrind/valgrind.h
  3781. check_header vdpau/vdpau.h
  3782. check_header vdpau/vdpau_x11.h
  3783. check_header VideoDecodeAcceleration/VDADecoder.h
  3784. check_header windows.h
  3785. check_header X11/extensions/XvMClib.h
  3786. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  3787. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  3788. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  3789. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  3790. check_type "windows.h dxva.h" "DXVA_PicParams_HEVC"
  3791. if ! disabled w32threads && ! enabled pthreads; then
  3792. check_func_headers "windows.h process.h" _beginthreadex &&
  3793. enable w32threads || disable w32threads
  3794. fi
  3795. # check for some common methods of building with pthread support
  3796. # do this before the optional library checks as some of them require pthreads
  3797. if ! disabled pthreads && ! enabled w32threads; then
  3798. enable pthreads
  3799. if check_func pthread_join -pthread; then
  3800. add_cflags -pthread
  3801. add_extralibs -pthread
  3802. elif check_func pthread_join -pthreads; then
  3803. add_cflags -pthreads
  3804. add_extralibs -pthreads
  3805. elif check_func pthread_join -lpthreadGC2; then
  3806. add_extralibs -lpthreadGC2
  3807. elif check_lib pthread.h pthread_join -lpthread; then
  3808. :
  3809. elif ! check_func pthread_join; then
  3810. disable pthreads
  3811. fi
  3812. fi
  3813. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  3814. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  3815. check_lib math.h sin -lm && LIBM="-lm"
  3816. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  3817. atan2f_args=2
  3818. ldexpf_args=2
  3819. powf_args=2
  3820. for func in $MATH_FUNCS; do
  3821. eval check_mathfunc $func \${${func}_args:-1}
  3822. done
  3823. # these are off by default, so fail if requested and not available
  3824. enabled avisynth && { check_lib2 "avisynth/avisynth_c.h windows.h" LoadLibrary ||
  3825. check_lib2 "avxsynth/avxsynth_c.h dlfcn.h" dlopen -ldl ||
  3826. die "ERROR: LoadLibrary/dlopen not found, or avisynth header not found"; }
  3827. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  3828. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  3829. enabled libbs2b && require_pkg_config libbs2b bs2b.h bs2b_open
  3830. enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec
  3831. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  3832. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  3833. enabled libfontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  3834. enabled libfreetype && require_pkg_config freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
  3835. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  3836. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  3837. done || die "ERROR: libgsm not found"; }
  3838. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  3839. enabled libmfx && require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit
  3840. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  3841. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  3842. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  3843. enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
  3844. enabled libopenh264 && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion
  3845. enabled libopenjpeg && { { check_header openjpeg.h && check_lib2 openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC; } ||
  3846. { require_pkg_config libopenjpeg1 openjpeg.h opj_version -DOPJ_STATIC; } }
  3847. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  3848. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  3849. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  3850. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  3851. enabled libspeex && require_pkg_config speex speex/speex.h speex_decoder_init -lspeex
  3852. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  3853. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame
  3854. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  3855. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  3856. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  3857. enabled libvpx && {
  3858. enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  3859. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  3860. enabled libvpx_vp8_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx ||
  3861. die "ERROR: libvpx encoder version must be >=0.9.6"; }
  3862. enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
  3863. enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx" -lvpx || disable libvpx_vp9_encoder; } }
  3864. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  3865. enabled libwebp && require_pkg_config libwebp webp/encode.h WebPGetEncoderVersion
  3866. enabled libx264 && require_pkg_config x264 "stdint.h x264.h" x264_encoder_encode &&
  3867. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  3868. die "ERROR: libx264 version must be >= 0.118."; }
  3869. enabled libx265 && require_pkg_config x265 x265.h x265_encoder_encode &&
  3870. { check_cpp_condition x265.h "X265_BUILD >= 17" ||
  3871. die "ERROR: libx265 version must be >= 17."; }
  3872. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  3873. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  3874. enabled mmal && { check_lib interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
  3875. { ! enabled cross_compile && {
  3876. add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline ;
  3877. add_extralibs -L/opt/vc/lib/ -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ;
  3878. check_lib interface/mmal/mmal.h mmal_port_connect ; }
  3879. check_lib interface/mmal/mmal.h mmal_port_connect ; } ||
  3880. die "ERROR: mmal not found"; }
  3881. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  3882. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  3883. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  3884. die "ERROR: openssl not found"; }
  3885. if enabled gnutls; then
  3886. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  3887. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  3888. fi
  3889. # libdc1394 check
  3890. if enabled libdc1394; then
  3891. { require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new &&
  3892. enable libdc1394_2; } ||
  3893. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  3894. enable libdc1394_1; } ||
  3895. die "ERROR: No version of libdc1394 found "
  3896. fi
  3897. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  3898. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3899. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  3900. enable sdl
  3901. fi
  3902. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  3903. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  3904. check_header linux/fb.h
  3905. check_header linux/videodev2.h
  3906. check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
  3907. check_header sys/videoio.h
  3908. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  3909. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  3910. # w32api 3.12 had it defined wrong
  3911. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  3912. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  3913. { check_header dev/bktr/ioctl_meteor.h &&
  3914. check_header dev/bktr/ioctl_bt848.h; } ||
  3915. { check_header machine/ioctl_meteor.h &&
  3916. check_header machine/ioctl_bt848.h; } ||
  3917. { check_header dev/video/meteor/ioctl_meteor.h &&
  3918. check_header dev/video/bktr/ioctl_bt848.h; } ||
  3919. check_header dev/ic/bt8xx.h
  3920. check_header sndio.h
  3921. check_header sys/soundcard.h
  3922. check_header soundcard.h
  3923. enabled_any alsa_indev alsa_outdev &&
  3924. check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  3925. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack &&
  3926. check_func jack_port_get_latency_range -ljack
  3927. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  3928. if enabled libcdio; then
  3929. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  3930. check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  3931. die "ERROR: No usable libcdio/cdparanoia found"
  3932. fi
  3933. check_lib X11/Xlib.h XOpenDisplay -lX11 && enable xlib
  3934. if enabled libxcb || enabled x11grab && ! disabled libxcb; then
  3935. check_pkg_config xcb-shape xcb/shape.h xcb_shape_rectangles || {
  3936. enabled libxcb && die "ERROR: libxcb not found";
  3937. } && disable x11grab && enable libxcb
  3938. disabled libxcb_shm ||
  3939. check_pkg_config xcb-shm xcb/shm.h xcb_shm_attach || {
  3940. enabled libxcb_shm && die "ERROR: libxcb_shm not found";
  3941. } && check_header sys/shm.h && enable libxcb_shm
  3942. disabled libxcb_xfixes ||
  3943. check_pkg_config xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image || {
  3944. enabled libxcb_xfixes && die "ERROR: libxcb_xfixes not found";
  3945. } && enable libxcb_xfixes
  3946. add_cflags "$xcb_event_cflags $xcb_shm_cflags $xcb_xfixes_cflags"
  3947. add_extralibs "$xcb_event_libs $xcb_shm_libs $xcb_xfixes_libs"
  3948. fi
  3949. if enabled x11grab; then
  3950. enabled xlib || die "ERROR: Xlib not found"
  3951. require Xext X11/extensions/XShm.h XShmCreateImage -lXext
  3952. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
  3953. fi
  3954. enabled vaapi && enabled xlib &&
  3955. check_lib2 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 &&
  3956. enable vaapi_x11
  3957. enabled vdpau &&
  3958. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  3959. disable vdpau
  3960. enabled vdpau && enabled xlib &&
  3961. check_func_headers "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau &&
  3962. prepend avconv_libs $($ldflags_filter "-lvdpau") &&
  3963. enable vdpau_x11
  3964. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  3965. # add some useful compiler flags if supported
  3966. check_cflags -Wdeclaration-after-statement
  3967. check_cflags -Wall
  3968. check_cflags -Wdisabled-optimization
  3969. check_cflags -Wpointer-arith
  3970. check_cflags -Wredundant-decls
  3971. check_cflags -Wcast-qual
  3972. check_cflags -Wwrite-strings
  3973. check_cflags -Wtype-limits
  3974. check_cflags -Wundef
  3975. check_cflags -Wmissing-prototypes
  3976. check_cflags -Wstrict-prototypes
  3977. enabled extra_warnings && check_cflags -Winline
  3978. check_disable_warning(){
  3979. warning_flag=-W${1#-Wno-}
  3980. test_cflags $warning_flag && add_cflags $1
  3981. }
  3982. check_disable_warning -Wno-parentheses
  3983. check_disable_warning -Wno-switch
  3984. check_disable_warning -Wno-format-zero-length
  3985. check_disable_warning -Wno-pointer-sign
  3986. # add some linker flags
  3987. check_ldflags -Wl,--warn-common
  3988. check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  3989. enabled rpath && add_ldexeflags -Wl,-rpath,$libdir
  3990. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  3991. # add some strip flags
  3992. # -wN '..@*' is more selective than -x, but not available everywhere.
  3993. check_stripflags -wN \'..@*\' || check_stripflags -x || strip='true'
  3994. enabled neon_clobber_test &&
  3995. check_ldflags -Wl,--wrap,avcodec_open2 \
  3996. -Wl,--wrap,avcodec_decode_audio4 \
  3997. -Wl,--wrap,avcodec_decode_video2 \
  3998. -Wl,--wrap,avcodec_decode_subtitle2 \
  3999. -Wl,--wrap,avcodec_encode_audio2 \
  4000. -Wl,--wrap,avcodec_encode_video2 \
  4001. -Wl,--wrap,avcodec_encode_subtitle \
  4002. -Wl,--wrap,avresample_convert ||
  4003. disable neon_clobber_test
  4004. enabled xmm_clobber_test &&
  4005. check_ldflags -Wl,--wrap,avcodec_open2 \
  4006. -Wl,--wrap,avcodec_decode_audio4 \
  4007. -Wl,--wrap,avcodec_decode_video2 \
  4008. -Wl,--wrap,avcodec_decode_subtitle2 \
  4009. -Wl,--wrap,avcodec_encode_audio2 \
  4010. -Wl,--wrap,avcodec_encode_video2 \
  4011. -Wl,--wrap,avcodec_encode_subtitle \
  4012. -Wl,--wrap,avresample_convert \
  4013. -Wl,--wrap,sws_scale ||
  4014. disable xmm_clobber_test
  4015. echo "X{};" > $TMPV
  4016. if test_ldflags -Wl,--version-script,$TMPV; then
  4017. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  4018. check_cc <<EOF && enable symver_asm_label
  4019. void ff_foo(void) __asm__ ("av_foo@VERSION");
  4020. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  4021. EOF
  4022. check_cc <<EOF && enable symver_gnu_asm
  4023. __asm__(".symver ff_foo,av_foo@VERSION");
  4024. void ff_foo(void) {}
  4025. EOF
  4026. fi
  4027. if [ -z "$optflags" ]; then
  4028. if enabled small; then
  4029. optflags=$cflags_size
  4030. elif enabled optimizations; then
  4031. optflags=$cflags_speed
  4032. else
  4033. optflags=$cflags_noopt
  4034. fi
  4035. fi
  4036. check_optflags(){
  4037. check_cflags "$@"
  4038. enabled lto && check_ldflags "$@"
  4039. }
  4040. if enabled lto; then
  4041. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  4042. check_cflags -flto
  4043. check_ldflags -flto $cpuflags
  4044. fi
  4045. check_optflags $optflags
  4046. check_optflags -fno-math-errno
  4047. check_optflags -fno-signed-zeros
  4048. if enabled icc; then
  4049. # Just warnings, no remarks
  4050. check_cflags -w1
  4051. # -wd: Disable following warnings
  4052. # 144, 167, 556: -Wno-pointer-sign
  4053. # 1292: attribute "foo" ignored
  4054. # 1419: external declaration in primary source file
  4055. # 10006: ignoring unknown option -fno-signed-zeros
  4056. # 10148: ignoring unknown option -Wno-parentheses
  4057. # 10156: ignoring option '-W'; no argument required
  4058. check_cflags -wd144,167,556,1292,1419,10006,10148,10156
  4059. # 11030: Warning unknown option --as-needed
  4060. # 10156: ignoring option '-export'; no argument required
  4061. check_ldflags -wd10156,11030
  4062. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  4063. enable ebp_available
  4064. if enabled x86_32; then
  4065. icc_version=$($cc -dumpversion)
  4066. test ${icc_version%%.*} -ge 11 &&
  4067. check_cflags -falign-stack=maintain-16-byte ||
  4068. disable aligned_stack
  4069. fi
  4070. elif enabled ccc; then
  4071. # disable some annoying warnings
  4072. add_cflags -msg_disable bitnotint
  4073. add_cflags -msg_disable mixfuncvoid
  4074. add_cflags -msg_disable nonstandcast
  4075. add_cflags -msg_disable unsupieee
  4076. elif enabled gcc; then
  4077. check_optflags -fno-tree-vectorize
  4078. check_cflags -Werror=implicit-function-declaration
  4079. check_cflags -Werror=missing-prototypes
  4080. check_cflags -Werror=return-type
  4081. check_cflags -Werror=declaration-after-statement
  4082. check_cflags -Werror=vla
  4083. check_cflags -Werror=format-security
  4084. check_cflags -fdiagnostics-color=auto
  4085. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  4086. elif enabled llvm_gcc; then
  4087. check_cflags -mllvm -stack-alignment=16
  4088. elif enabled clang; then
  4089. check_cflags -mllvm -stack-alignment=16
  4090. check_cflags -Qunused-arguments
  4091. check_cflags -Werror=implicit-function-declaration
  4092. check_cflags -Werror=missing-prototypes
  4093. check_cflags -Werror=return-type
  4094. elif enabled cparser; then
  4095. add_cflags -Wno-missing-variable-declarations
  4096. add_cflags -Wno-empty-statement
  4097. elif enabled armcc; then
  4098. add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
  4099. add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
  4100. # 2523: use of inline assembly is deprecated
  4101. add_cflags -W${armcc_opt},--diag_suppress=2523
  4102. add_cflags -W${armcc_opt},--diag_suppress=1207
  4103. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  4104. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  4105. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  4106. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  4107. elif enabled tms470; then
  4108. add_cflags -pds=824 -pds=837
  4109. disable inline_asm
  4110. elif enabled pathscale; then
  4111. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  4112. elif enabled_any msvc icl; then
  4113. enabled x86_32 && disable aligned_stack
  4114. enabled_all x86_32 debug && add_cflags -Oy-
  4115. enabled debug && add_ldflags -debug
  4116. enable pragma_deprecated
  4117. if enabled icl; then
  4118. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  4119. # (correctly) on icl 13.x.
  4120. check_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  4121. add_cflags -Qansi-alias
  4122. # icl will pass the inline asm tests but inline asm is currently
  4123. # not supported (build will fail)
  4124. disable inline_asm
  4125. fi
  4126. fi
  4127. case $as_type in
  4128. clang)
  4129. add_asflags -Qunused-arguments
  4130. ;;
  4131. esac
  4132. case $ld_type in
  4133. clang)
  4134. check_ldflags -Qunused-arguments
  4135. ;;
  4136. esac
  4137. case $target_os in
  4138. osf1)
  4139. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  4140. ;;
  4141. plan9)
  4142. add_cppflags -Dmain=plan9_main
  4143. ;;
  4144. esac
  4145. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  4146. check_deps $CONFIG_LIST \
  4147. $CONFIG_EXTRA \
  4148. $HAVE_LIST \
  4149. $ALL_COMPONENTS \
  4150. enabled_all dxva2 CoTaskMemFree &&
  4151. prepend avconv_libs $($ldflags_filter "-lole32") &&
  4152. enable dxva2_lib
  4153. ! enabled_any memalign posix_memalign aligned_malloc &&
  4154. enabled simd_align_16 && enable memalign_hack
  4155. map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
  4156. for thread in $THREADS_LIST; do
  4157. if enabled $thread; then
  4158. test -n "$thread_type" &&
  4159. die "ERROR: Only one thread type must be selected." ||
  4160. thread_type="$thread"
  4161. fi
  4162. done
  4163. enabled zlib && add_cppflags -DZLIB_CONST
  4164. # conditional library dependencies, in linking order
  4165. enabled movie_filter && prepend avfilter_deps "avformat avcodec"
  4166. enabled resample_filter && prepend avfilter_deps "avresample"
  4167. enabled scale_filter && prepend avfilter_deps "swscale"
  4168. enabled opus_decoder && prepend avcodec_deps "avresample"
  4169. expand_deps(){
  4170. lib_deps=${1}_deps
  4171. eval "deps=\$$lib_deps"
  4172. append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
  4173. unique $lib_deps
  4174. }
  4175. map 'expand_deps $v' $LIBRARY_LIST
  4176. echo "install prefix $prefix"
  4177. echo "source path $source_path"
  4178. echo "C compiler $cc"
  4179. echo "C library $libc_type"
  4180. if test "$host_cc" != "$cc"; then
  4181. echo "host C compiler $host_cc"
  4182. echo "host C library $host_libc_type"
  4183. fi
  4184. echo "ARCH $arch ($cpu)"
  4185. if test "$build_suffix" != ""; then
  4186. echo "build suffix $build_suffix"
  4187. fi
  4188. if test "$extra_version" != ""; then
  4189. echo "version string suffix $extra_version"
  4190. fi
  4191. echo "big-endian ${bigendian-no}"
  4192. echo "runtime cpu detection ${runtime_cpudetect-no}"
  4193. if enabled x86; then
  4194. echo "${yasmexe} ${yasm-no}"
  4195. echo "MMX enabled ${mmx-no}"
  4196. echo "MMXEXT enabled ${mmxext-no}"
  4197. echo "3DNow! enabled ${amd3dnow-no}"
  4198. echo "3DNow! extended enabled ${amd3dnowext-no}"
  4199. echo "SSE enabled ${sse-no}"
  4200. echo "SSSE3 enabled ${ssse3-no}"
  4201. echo "AVX enabled ${avx-no}"
  4202. echo "XOP enabled ${xop-no}"
  4203. echo "FMA3 enabled ${fma3-no}"
  4204. echo "FMA4 enabled ${fma4-no}"
  4205. echo "i686 features enabled ${i686-no}"
  4206. echo "CMOV is fast ${fast_cmov-no}"
  4207. echo "EBX available ${ebx_available-no}"
  4208. echo "EBP available ${ebp_available-no}"
  4209. fi
  4210. if enabled aarch64; then
  4211. echo "NEON enabled ${neon-no}"
  4212. echo "VFP enabled ${vfp-no}"
  4213. fi
  4214. if enabled arm; then
  4215. echo "ARMv5TE enabled ${armv5te-no}"
  4216. echo "ARMv6 enabled ${armv6-no}"
  4217. echo "ARMv6T2 enabled ${armv6t2-no}"
  4218. echo "VFP enabled ${vfp-no}"
  4219. echo "NEON enabled ${neon-no}"
  4220. fi
  4221. if enabled ppc; then
  4222. echo "AltiVec enabled ${altivec-no}"
  4223. echo "PPC 4xx optimizations ${ppc4xx-no}"
  4224. echo "dcbzl available ${dcbzl-no}"
  4225. fi
  4226. echo "debug symbols ${debug-no}"
  4227. echo "optimize for size ${small-no}"
  4228. echo "optimizations ${optimizations-no}"
  4229. echo "static ${static-no}"
  4230. echo "shared ${shared-no}"
  4231. echo "new filter support ${avfilter-no}"
  4232. echo "network support ${network-no}"
  4233. echo "threading support ${thread_type-no}"
  4234. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  4235. echo "SDL support ${sdl-no}"
  4236. test -n "$random_seed" &&
  4237. echo "random seed ${random_seed}"
  4238. echo
  4239. echo "External libraries:"
  4240. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  4241. echo
  4242. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  4243. echo "Enabled ${type}s:"
  4244. eval list=\$$(toupper $type)_LIST
  4245. print_enabled '_*' $list | print_3_columns
  4246. echo
  4247. done
  4248. license="LGPL version 2.1 or later"
  4249. if enabled nonfree; then
  4250. license="nonfree and unredistributable"
  4251. elif enabled gplv3; then
  4252. license="GPL version 3 or later"
  4253. elif enabled lgplv3; then
  4254. license="LGPL version 3 or later"
  4255. elif enabled gpl; then
  4256. license="GPL version 2 or later"
  4257. fi
  4258. echo "License: $license"
  4259. echo "Creating config.mak and config.h..."
  4260. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  4261. config_files="$TMPH config.mak"
  4262. cat > config.mak <<EOF
  4263. # Automatically generated by configure - do not modify!
  4264. LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
  4265. prefix=$prefix
  4266. LIBDIR=\$(DESTDIR)$libdir
  4267. SHLIBDIR=\$(DESTDIR)$shlibdir
  4268. INCDIR=\$(DESTDIR)$incdir
  4269. BINDIR=\$(DESTDIR)$bindir
  4270. DATADIR=\$(DESTDIR)$datadir
  4271. DOCDIR=\$(DESTDIR)$docdir
  4272. MANDIR=\$(DESTDIR)$mandir
  4273. SRC_PATH=$source_path
  4274. CC_IDENT=$cc_ident
  4275. ARCH=$arch
  4276. INTRINSICS=$intrinsics
  4277. CC=$cc
  4278. AS=$as
  4279. LD=$ld
  4280. DEPCC=$dep_cc
  4281. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  4282. DEPAS=$as
  4283. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  4284. YASM=$yasmexe
  4285. DEPYASM=$yasmexe
  4286. AR=$ar
  4287. ARFLAGS=$arflags
  4288. AR_O=$ar_o
  4289. RANLIB=$ranlib
  4290. STRIP=$strip
  4291. LN_S=$ln_s
  4292. CPPFLAGS=$CPPFLAGS
  4293. CFLAGS=$CFLAGS
  4294. ASFLAGS=$ASFLAGS
  4295. AS_C=$AS_C
  4296. AS_O=$AS_O
  4297. CC_C=$CC_C
  4298. CC_E=$CC_E
  4299. CC_O=$CC_O
  4300. LD_O=$LD_O
  4301. LD_LIB=$LD_LIB
  4302. LD_PATH=$LD_PATH
  4303. DLLTOOL=$dlltool
  4304. LDFLAGS=$LDFLAGS
  4305. LDEXEFLAGS=$LDEXEFLAGS
  4306. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  4307. STRIPFLAGS=$STRIPFLAGS
  4308. YASMFLAGS=$YASMFLAGS
  4309. BUILDSUF=$build_suffix
  4310. FULLNAME=$FULLNAME
  4311. LIBPREF=$LIBPREF
  4312. LIBSUF=$LIBSUF
  4313. LIBNAME=$LIBNAME
  4314. SLIBPREF=$SLIBPREF
  4315. SLIBSUF=$SLIBSUF
  4316. EXESUF=$EXESUF
  4317. EXTRA_VERSION=$extra_version
  4318. CCDEP=$CCDEP
  4319. CCDEP_FLAGS=$CCDEP_FLAGS
  4320. ASDEP=$ASDEP
  4321. ASDEP_FLAGS=$ASDEP_FLAGS
  4322. CC_DEPFLAGS=$CC_DEPFLAGS
  4323. AS_DEPFLAGS=$AS_DEPFLAGS
  4324. HOSTCC=$host_cc
  4325. HOSTLD=$host_ld
  4326. HOSTCFLAGS=$host_cflags
  4327. HOSTCPPFLAGS=$host_cppflags
  4328. HOSTEXESUF=$HOSTEXESUF
  4329. HOSTLDFLAGS=$host_ldflags
  4330. HOSTLIBS=$host_libs
  4331. DEPHOSTCC=$host_cc
  4332. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  4333. HOSTCCDEP=$HOSTCCDEP
  4334. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  4335. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  4336. HOSTCC_C=$HOSTCC_C
  4337. HOSTCC_O=$HOSTCC_O
  4338. HOSTLD_O=$HOSTLD_O
  4339. TARGET_EXEC=$target_exec $target_exec_args
  4340. TARGET_PATH=$target_path
  4341. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  4342. CFLAGS-avplay=$sdl_cflags
  4343. ZLIB=$($ldflags_filter -lz)
  4344. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  4345. EXTRALIBS=$extralibs
  4346. COMPAT_OBJS=$compat_objs
  4347. EXEOBJS=$exeobjs
  4348. INSTALL=install
  4349. LIBTARGET=${LIBTARGET}
  4350. SLIBNAME=${SLIBNAME}
  4351. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  4352. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  4353. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  4354. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  4355. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  4356. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  4357. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  4358. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  4359. SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
  4360. EOF
  4361. get_version(){
  4362. lcname=lib${1}
  4363. name=$(toupper $lcname)
  4364. file=$source_path/$lcname/version.h
  4365. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  4366. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  4367. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  4368. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  4369. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  4370. }
  4371. map 'get_version $v' $LIBRARY_LIST
  4372. map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> config.mak' $LIBRARY_LIST
  4373. print_program_libs(){
  4374. eval "program_libs=\$${1}_libs"
  4375. eval echo "LIBS-${1}=${program_libs}" >> config.mak
  4376. }
  4377. map 'print_program_libs $v' $PROGRAM_LIST
  4378. cat > $TMPH <<EOF
  4379. /* Automatically generated by configure - do not modify! */
  4380. #ifndef LIBAV_CONFIG_H
  4381. #define LIBAV_CONFIG_H
  4382. #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
  4383. #define LIBAV_LICENSE "$(c_escape $license)"
  4384. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  4385. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  4386. #define restrict $_restrict
  4387. #define EXTERN_PREFIX "${extern_prefix}"
  4388. #define EXTERN_ASM ${extern_prefix}
  4389. #define SLIBSUF "$SLIBSUF"
  4390. EOF
  4391. test -n "$malloc_prefix" &&
  4392. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  4393. if enabled yasm; then
  4394. append config_files $TMPASM
  4395. printf '' >$TMPASM
  4396. fi
  4397. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  4398. print_config ARCH_ "$config_files" $ARCH_LIST
  4399. print_config HAVE_ "$config_files" $HAVE_LIST
  4400. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  4401. $CONFIG_EXTRA \
  4402. $ALL_COMPONENTS \
  4403. echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
  4404. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  4405. cp_if_changed $TMPH config.h
  4406. touch .config
  4407. enabled yasm && cp_if_changed $TMPASM config.asm
  4408. cat > $TMPH <<EOF
  4409. /* Generated by ffconf */
  4410. #ifndef AVUTIL_AVCONFIG_H
  4411. #define AVUTIL_AVCONFIG_H
  4412. EOF
  4413. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  4414. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  4415. cp_if_changed $TMPH libavutil/avconfig.h
  4416. test -n "$WARNINGS" && printf "\n$WARNINGS"
  4417. # build pkg-config files
  4418. lib_version(){
  4419. eval printf "\"lib${1} >= \$LIB$(toupper ${1})_VERSION, \""
  4420. }
  4421. pkgconfig_generate(){
  4422. name=$1
  4423. shortname=${name#lib}${build_suffix}
  4424. comment=$2
  4425. version=$3
  4426. libs=$4
  4427. requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps))
  4428. requires=${requires%, }
  4429. enabled ${name#lib} || return 0
  4430. mkdir -p $name
  4431. cat <<EOF > $name/$name.pc
  4432. prefix=$prefix
  4433. exec_prefix=\${prefix}
  4434. libdir=$libdir
  4435. includedir=$incdir
  4436. Name: $name
  4437. Description: $comment
  4438. Version: $version
  4439. Requires: $(enabled shared || echo $requires)
  4440. Requires.private: $(enabled shared && echo $requires)
  4441. Conflicts:
  4442. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4443. Libs.private: $(enabled shared && echo $libs)
  4444. Cflags: -I\${includedir}
  4445. EOF
  4446. cat <<EOF > $name/$name-uninstalled.pc
  4447. prefix=
  4448. exec_prefix=
  4449. libdir=\${pcfiledir}
  4450. includedir=${source_path}
  4451. Name: $name
  4452. Description: $comment
  4453. Version: $version
  4454. Requires: $requires
  4455. Conflicts:
  4456. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  4457. Cflags: -I\${includedir}
  4458. EOF
  4459. }
  4460. pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBRT $LIBM"
  4461. pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs"
  4462. pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs"
  4463. pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs"
  4464. pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
  4465. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$LIBM"
  4466. pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM"