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.

4750 lines
139KB

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