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.

4772 lines
140KB

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