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.

4695 lines
138KB

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