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.

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