configure 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  1. #!/bin/sh
  2. ##
  3. ## configure
  4. ##
  5. ## This script is the front-end to the build system. It provides a similar
  6. ## interface to standard configure scripts with some extra bits for dealing
  7. ## with toolchains that differ from the standard POSIX interface and
  8. ## for extracting subsets of the source tree. In theory, reusable parts
  9. ## of this script were intended to live in build/make/configure.sh,
  10. ## but in practice, the line is pretty blurry.
  11. ##
  12. ## This build system is based in part on the FFmpeg configure script.
  13. ##
  14. #source_path="`dirname \"$0\"`"
  15. source_path=${0%/*}
  16. . "${source_path}/build/make/configure.sh"
  17. show_help(){
  18. show_help_pre
  19. cat << EOF
  20. Advanced options:
  21. ${toggle_libs} libraries
  22. ${toggle_examples} examples
  23. ${toggle_tools} tools
  24. ${toggle_docs} documentation
  25. ${toggle_unit_tests} unit tests
  26. ${toggle_decode_perf_tests} build decoder perf tests with unit tests
  27. ${toggle_encode_perf_tests} build encoder perf tests with unit tests
  28. --cpu=CPU tune for the specified CPU (ARM: cortex-a8, X86: sse3)
  29. --libc=PATH path to alternate libc
  30. --size-limit=WxH max size to allow in the decoder
  31. --as={yasm|nasm|auto} use specified assembler [auto, yasm preferred]
  32. --sdk-path=PATH path to root of sdk (android builds only)
  33. ${toggle_codec_srcs} in/exclude codec library source code
  34. ${toggle_debug_libs} in/exclude debug version of libraries
  35. ${toggle_static_msvcrt} use static MSVCRT (VS builds only)
  36. ${toggle_vp9_highbitdepth} use VP9 high bit depth (10/12) profiles
  37. ${toggle_better_hw_compatibility}
  38. enable encoder to produce streams with better
  39. hardware decoder compatibility
  40. ${toggle_vp8} VP8 codec support
  41. ${toggle_vp9} VP9 codec support
  42. ${toggle_internal_stats} output of encoder internal stats for debug, if supported (encoders)
  43. ${toggle_postproc} postprocessing
  44. ${toggle_vp9_postproc} vp9 specific postprocessing
  45. ${toggle_multithread} multithreaded encoding and decoding
  46. ${toggle_spatial_resampling} spatial sampling (scaling) support
  47. ${toggle_realtime_only} enable this option while building for real-time encoding
  48. ${toggle_onthefly_bitpacking} enable on-the-fly bitpacking in real-time encoding
  49. ${toggle_error_concealment} enable this option to get a decoder which is able to conceal losses
  50. ${toggle_coefficient_range_checking}
  51. enable decoder to check if intermediate
  52. transform coefficients are in valid range
  53. ${toggle_runtime_cpu_detect} runtime cpu detection
  54. ${toggle_shared} shared library support
  55. ${toggle_static} static library support
  56. ${toggle_small} favor smaller size over speed
  57. ${toggle_postproc_visualizer} macro block / block level visualizers
  58. ${toggle_multi_res_encoding} enable multiple-resolution encoding
  59. ${toggle_temporal_denoising} enable temporal denoising and disable the spatial denoiser
  60. ${toggle_vp9_temporal_denoising}
  61. enable vp9 temporal denoising
  62. ${toggle_webm_io} enable input from and output to WebM container
  63. ${toggle_libyuv} enable libyuv
  64. Codecs:
  65. Codecs can be selectively enabled or disabled individually, or by family:
  66. --disable-<codec>
  67. is equivalent to:
  68. --disable-<codec>-encoder
  69. --disable-<codec>-decoder
  70. Codecs available in this distribution:
  71. EOF
  72. #restore editor state '
  73. family="";
  74. last_family="";
  75. c="";
  76. str="";
  77. for c in ${CODECS}; do
  78. family=${c%_*}
  79. if [ "${family}" != "${last_family}" ]; then
  80. [ -z "${str}" ] || echo "${str}"
  81. str="$(printf ' %10s:' ${family})"
  82. fi
  83. str="${str} $(printf '%10s' ${c#*_})"
  84. last_family=${family}
  85. done
  86. echo "${str}"
  87. show_help_post
  88. }
  89. ##
  90. ## BEGIN APPLICATION SPECIFIC CONFIGURATION
  91. ##
  92. # all_platforms is a list of all supported target platforms. Maintain
  93. # alphabetically by architecture, generic-gnu last.
  94. all_platforms="${all_platforms} arm64-android-gcc"
  95. all_platforms="${all_platforms} arm64-darwin-gcc"
  96. all_platforms="${all_platforms} arm64-linux-gcc"
  97. all_platforms="${all_platforms} armv7-android-gcc" #neon Cortex-A8
  98. all_platforms="${all_platforms} armv7-darwin-gcc" #neon Cortex-A8
  99. all_platforms="${all_platforms} armv7-linux-rvct" #neon Cortex-A8
  100. all_platforms="${all_platforms} armv7-linux-gcc" #neon Cortex-A8
  101. all_platforms="${all_platforms} armv7-none-rvct" #neon Cortex-A8
  102. all_platforms="${all_platforms} armv7-win32-vs11"
  103. all_platforms="${all_platforms} armv7-win32-vs12"
  104. all_platforms="${all_platforms} armv7-win32-vs14"
  105. all_platforms="${all_platforms} armv7-win32-vs15"
  106. all_platforms="${all_platforms} armv7s-darwin-gcc"
  107. all_platforms="${all_platforms} armv8-linux-gcc"
  108. all_platforms="${all_platforms} mips32-linux-gcc"
  109. all_platforms="${all_platforms} mips64-linux-gcc"
  110. all_platforms="${all_platforms} ppc64-linux-gcc"
  111. all_platforms="${all_platforms} ppc64le-linux-gcc"
  112. all_platforms="${all_platforms} sparc-solaris-gcc"
  113. all_platforms="${all_platforms} x86-android-gcc"
  114. all_platforms="${all_platforms} x86-darwin8-gcc"
  115. all_platforms="${all_platforms} x86-darwin8-icc"
  116. all_platforms="${all_platforms} x86-darwin9-gcc"
  117. all_platforms="${all_platforms} x86-darwin9-icc"
  118. all_platforms="${all_platforms} x86-darwin10-gcc"
  119. all_platforms="${all_platforms} x86-darwin11-gcc"
  120. all_platforms="${all_platforms} x86-darwin12-gcc"
  121. all_platforms="${all_platforms} x86-darwin13-gcc"
  122. all_platforms="${all_platforms} x86-darwin14-gcc"
  123. all_platforms="${all_platforms} x86-darwin15-gcc"
  124. all_platforms="${all_platforms} x86-darwin16-gcc"
  125. all_platforms="${all_platforms} x86-iphonesimulator-gcc"
  126. all_platforms="${all_platforms} x86-linux-gcc"
  127. all_platforms="${all_platforms} x86-linux-icc"
  128. all_platforms="${all_platforms} x86-os2-gcc"
  129. all_platforms="${all_platforms} x86-solaris-gcc"
  130. all_platforms="${all_platforms} x86-win32-gcc"
  131. all_platforms="${all_platforms} x86-win32-vs10"
  132. all_platforms="${all_platforms} x86-win32-vs11"
  133. all_platforms="${all_platforms} x86-win32-vs12"
  134. all_platforms="${all_platforms} x86-win32-vs14"
  135. all_platforms="${all_platforms} x86-win32-vs15"
  136. all_platforms="${all_platforms} x86_64-android-gcc"
  137. all_platforms="${all_platforms} x86_64-darwin9-gcc"
  138. all_platforms="${all_platforms} x86_64-darwin10-gcc"
  139. all_platforms="${all_platforms} x86_64-darwin11-gcc"
  140. all_platforms="${all_platforms} x86_64-darwin12-gcc"
  141. all_platforms="${all_platforms} x86_64-darwin13-gcc"
  142. all_platforms="${all_platforms} x86_64-darwin14-gcc"
  143. all_platforms="${all_platforms} x86_64-darwin15-gcc"
  144. all_platforms="${all_platforms} x86_64-darwin16-gcc"
  145. all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
  146. all_platforms="${all_platforms} x86_64-linux-gcc"
  147. all_platforms="${all_platforms} x86_64-linux-icc"
  148. all_platforms="${all_platforms} x86_64-solaris-gcc"
  149. all_platforms="${all_platforms} x86_64-win64-gcc"
  150. all_platforms="${all_platforms} x86_64-win64-vs10"
  151. all_platforms="${all_platforms} x86_64-win64-vs11"
  152. all_platforms="${all_platforms} x86_64-win64-vs12"
  153. all_platforms="${all_platforms} x86_64-win64-vs14"
  154. all_platforms="${all_platforms} x86_64-win64-vs15"
  155. all_platforms="${all_platforms} generic-gnu"
  156. # all_targets is a list of all targets that can be configured
  157. # note that these should be in dependency order for now.
  158. all_targets="libs examples tools docs"
  159. # all targets available are enabled, by default.
  160. for t in ${all_targets}; do
  161. [ -f "${source_path}/${t}.mk" ] && enable_feature ${t}
  162. done
  163. if ! diff --version >/dev/null; then
  164. die "diff missing: Try installing diffutils via your package manager."
  165. fi
  166. if ! perl --version >/dev/null; then
  167. die "Perl is required to build"
  168. fi
  169. if [ "`cd \"${source_path}\" && pwd`" != "`pwd`" ]; then
  170. # test to see if source_path already configured
  171. if [ -f "${source_path}/vpx_config.h" ]; then
  172. die "source directory already configured; run 'make distclean' there first"
  173. fi
  174. fi
  175. # check installed doxygen version
  176. doxy_version=$(doxygen --version 2>/dev/null)
  177. doxy_major=${doxy_version%%.*}
  178. if [ ${doxy_major:-0} -ge 1 ]; then
  179. doxy_version=${doxy_version#*.}
  180. doxy_minor=${doxy_version%%.*}
  181. doxy_patch=${doxy_version##*.}
  182. [ $doxy_major -gt 1 ] && enable_feature doxygen
  183. [ $doxy_minor -gt 5 ] && enable_feature doxygen
  184. [ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable_feature doxygen
  185. fi
  186. # disable codecs when their source directory does not exist
  187. [ -d "${source_path}/vp8" ] || disable_codec vp8
  188. [ -d "${source_path}/vp9" ] || disable_codec vp9
  189. # install everything except the sources, by default. sources will have
  190. # to be enabled when doing dist builds, since that's no longer a common
  191. # case.
  192. enabled doxygen && enable_feature install_docs
  193. enable_feature install_bins
  194. enable_feature install_libs
  195. enable_feature static
  196. enable_feature optimizations
  197. enable_feature dependency_tracking
  198. enable_feature spatial_resampling
  199. enable_feature multithread
  200. enable_feature os_support
  201. enable_feature temporal_denoising
  202. CODECS="
  203. vp8_encoder
  204. vp8_decoder
  205. vp9_encoder
  206. vp9_decoder
  207. "
  208. CODEC_FAMILIES="
  209. vp8
  210. vp9
  211. "
  212. ARCH_LIST="
  213. arm
  214. mips
  215. x86
  216. x86_64
  217. ppc
  218. "
  219. ARCH_EXT_LIST_X86="
  220. mmx
  221. sse
  222. sse2
  223. sse3
  224. ssse3
  225. sse4_1
  226. avx
  227. avx2
  228. "
  229. ARCH_EXT_LIST_LOONGSON="
  230. mmi
  231. "
  232. ARCH_EXT_LIST="
  233. neon
  234. neon_asm
  235. mips32
  236. dspr2
  237. msa
  238. mips64
  239. ${ARCH_EXT_LIST_X86}
  240. vsx
  241. ${ARCH_EXT_LIST_LOONGSON}
  242. "
  243. HAVE_LIST="
  244. ${ARCH_EXT_LIST}
  245. vpx_ports
  246. pthread_h
  247. unistd_h
  248. "
  249. EXPERIMENT_LIST="
  250. spatial_svc
  251. fp_mb_stats
  252. emulate_hardware
  253. "
  254. CONFIG_LIST="
  255. dependency_tracking
  256. external_build
  257. install_docs
  258. install_bins
  259. install_libs
  260. install_srcs
  261. debug
  262. gprof
  263. gcov
  264. rvct
  265. gcc
  266. msvs
  267. pic
  268. big_endian
  269. codec_srcs
  270. debug_libs
  271. dequant_tokens
  272. dc_recon
  273. runtime_cpu_detect
  274. postproc
  275. vp9_postproc
  276. multithread
  277. internal_stats
  278. ${CODECS}
  279. ${CODEC_FAMILIES}
  280. encoders
  281. decoders
  282. static_msvcrt
  283. spatial_resampling
  284. realtime_only
  285. onthefly_bitpacking
  286. error_concealment
  287. shared
  288. static
  289. small
  290. postproc_visualizer
  291. os_support
  292. unit_tests
  293. webm_io
  294. libyuv
  295. decode_perf_tests
  296. encode_perf_tests
  297. multi_res_encoding
  298. temporal_denoising
  299. vp9_temporal_denoising
  300. coefficient_range_checking
  301. vp9_highbitdepth
  302. better_hw_compatibility
  303. experimental
  304. size_limit
  305. always_adjust_bpm
  306. ${EXPERIMENT_LIST}
  307. "
  308. CMDLINE_SELECT="
  309. dependency_tracking
  310. external_build
  311. extra_warnings
  312. werror
  313. install_docs
  314. install_bins
  315. install_libs
  316. install_srcs
  317. debug
  318. gprof
  319. gcov
  320. pic
  321. optimizations
  322. ccache
  323. runtime_cpu_detect
  324. thumb
  325. libs
  326. examples
  327. tools
  328. docs
  329. libc
  330. as
  331. size_limit
  332. codec_srcs
  333. debug_libs
  334. dequant_tokens
  335. dc_recon
  336. postproc
  337. vp9_postproc
  338. multithread
  339. internal_stats
  340. ${CODECS}
  341. ${CODEC_FAMILIES}
  342. static_msvcrt
  343. spatial_resampling
  344. realtime_only
  345. onthefly_bitpacking
  346. error_concealment
  347. shared
  348. static
  349. small
  350. postproc_visualizer
  351. unit_tests
  352. webm_io
  353. libyuv
  354. decode_perf_tests
  355. encode_perf_tests
  356. multi_res_encoding
  357. temporal_denoising
  358. vp9_temporal_denoising
  359. coefficient_range_checking
  360. better_hw_compatibility
  361. vp9_highbitdepth
  362. experimental
  363. always_adjust_bpm
  364. "
  365. process_cmdline() {
  366. for opt do
  367. optval="${opt#*=}"
  368. case "$opt" in
  369. --disable-codecs)
  370. for c in ${CODEC_FAMILIES}; do disable_codec $c; done
  371. ;;
  372. --enable-?*|--disable-?*)
  373. eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
  374. if is_in ${option} ${EXPERIMENT_LIST}; then
  375. if enabled experimental; then
  376. ${action}_feature $option
  377. else
  378. log_echo "Ignoring $opt -- not in experimental mode."
  379. fi
  380. elif is_in ${option} "${CODECS} ${CODEC_FAMILIES}"; then
  381. ${action}_codec ${option}
  382. else
  383. process_common_cmdline $opt
  384. fi
  385. ;;
  386. *) process_common_cmdline "$opt"
  387. ;;
  388. esac
  389. done
  390. }
  391. post_process_cmdline() {
  392. c=""
  393. # Enable all detected codecs, if they haven't been disabled
  394. for c in ${CODECS}; do soft_enable $c; done
  395. # Enable the codec family if any component of that family is enabled
  396. for c in ${CODECS}; do
  397. enabled $c && enable_feature ${c%_*}
  398. done
  399. # Set the {en,de}coders variable if any algorithm in that class is enabled
  400. for c in ${CODECS}; do
  401. enabled ${c} && enable_feature ${c##*_}s
  402. done
  403. }
  404. process_targets() {
  405. enabled child || write_common_config_banner
  406. write_common_target_config_h ${BUILD_PFX}vpx_config.h
  407. write_common_config_targets
  408. # Calculate the default distribution name, based on the enabled features
  409. cf=""
  410. DIST_DIR=vpx
  411. for cf in $CODEC_FAMILIES; do
  412. if enabled ${cf}_encoder && enabled ${cf}_decoder; then
  413. DIST_DIR="${DIST_DIR}-${cf}"
  414. elif enabled ${cf}_encoder; then
  415. DIST_DIR="${DIST_DIR}-${cf}cx"
  416. elif enabled ${cf}_decoder; then
  417. DIST_DIR="${DIST_DIR}-${cf}dx"
  418. fi
  419. done
  420. enabled debug_libs && DIST_DIR="${DIST_DIR}-debug"
  421. enabled codec_srcs && DIST_DIR="${DIST_DIR}-src"
  422. ! enabled postproc && ! enabled vp9_postproc && DIST_DIR="${DIST_DIR}-nopost"
  423. ! enabled multithread && DIST_DIR="${DIST_DIR}-nomt"
  424. ! enabled install_docs && DIST_DIR="${DIST_DIR}-nodocs"
  425. DIST_DIR="${DIST_DIR}-${tgt_isa}-${tgt_os}"
  426. case "${tgt_os}" in
  427. win*) enabled static_msvcrt && DIST_DIR="${DIST_DIR}mt" || DIST_DIR="${DIST_DIR}md"
  428. DIST_DIR="${DIST_DIR}-${tgt_cc}"
  429. ;;
  430. esac
  431. if [ -f "${source_path}/build/make/version.sh" ]; then
  432. ver=`"$source_path/build/make/version.sh" --bare "$source_path"`
  433. DIST_DIR="${DIST_DIR}-${ver}"
  434. VERSION_STRING=${ver}
  435. ver=${ver%%-*}
  436. VERSION_PATCH=${ver##*.}
  437. ver=${ver%.*}
  438. VERSION_MINOR=${ver##*.}
  439. ver=${ver#v}
  440. VERSION_MAJOR=${ver%.*}
  441. fi
  442. enabled child || cat <<EOF >> config.mk
  443. PREFIX=${prefix}
  444. ifeq (\$(MAKECMDGOALS),dist)
  445. DIST_DIR?=${DIST_DIR}
  446. else
  447. DIST_DIR?=\$(DESTDIR)${prefix}
  448. endif
  449. LIBSUBDIR=${libdir##${prefix}/}
  450. VERSION_STRING=${VERSION_STRING}
  451. VERSION_MAJOR=${VERSION_MAJOR}
  452. VERSION_MINOR=${VERSION_MINOR}
  453. VERSION_PATCH=${VERSION_PATCH}
  454. CONFIGURE_ARGS=${CONFIGURE_ARGS}
  455. EOF
  456. enabled child || echo "CONFIGURE_ARGS?=${CONFIGURE_ARGS}" >> config.mk
  457. #
  458. # Write makefiles for all enabled targets
  459. #
  460. for tgt in libs examples tools docs solution; do
  461. tgt_fn="$tgt-$toolchain.mk"
  462. if enabled $tgt; then
  463. echo "Creating makefiles for ${toolchain} ${tgt}"
  464. write_common_target_config_mk $tgt_fn ${BUILD_PFX}vpx_config.h
  465. #write_${tgt}_config
  466. fi
  467. done
  468. }
  469. process_detect() {
  470. if enabled shared; then
  471. # Can only build shared libs on a subset of platforms. Doing this check
  472. # here rather than at option parse time because the target auto-detect
  473. # magic happens after the command line has been parsed.
  474. case "${tgt_os}" in
  475. linux|os2|darwin*|iphonesimulator*)
  476. # Supported platforms
  477. ;;
  478. *)
  479. if enabled gnu; then
  480. echo "--enable-shared is only supported on ELF; assuming this is OK"
  481. else
  482. die "--enable-shared only supported on ELF, OS/2, and Darwin for now"
  483. fi
  484. ;;
  485. esac
  486. fi
  487. if [ -z "$CC" ] || enabled external_build; then
  488. echo "Bypassing toolchain for environment detection."
  489. enable_feature external_build
  490. check_header() {
  491. log fake_check_header "$@"
  492. header=$1
  493. shift
  494. var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
  495. disable_feature $var
  496. # Headers common to all environments
  497. case $header in
  498. stdio.h)
  499. true;
  500. ;;
  501. *)
  502. result=false
  503. for d in "$@"; do
  504. [ -f "${d##-I}/$header" ] && result=true && break
  505. done
  506. ${result:-true}
  507. esac && enable_feature $var
  508. # Specialize windows and POSIX environments.
  509. case $toolchain in
  510. *-win*-*)
  511. # Don't check for any headers in Windows builds.
  512. false
  513. ;;
  514. *)
  515. case $header in
  516. pthread.h) true;;
  517. unistd.h) true;;
  518. *) false;;
  519. esac && enable_feature $var
  520. esac
  521. enabled $var
  522. }
  523. check_ld() {
  524. true
  525. }
  526. fi
  527. check_header stdio.h || die "Unable to invoke compiler: ${CC} ${CFLAGS}"
  528. check_ld <<EOF || die "Toolchain is unable to link executables"
  529. int main(void) {return 0;}
  530. EOF
  531. # check system headers
  532. check_header pthread.h
  533. check_header unistd.h # for sysconf(3) and friends.
  534. check_header vpx/vpx_integer.h -I${source_path} && enable_feature vpx_ports
  535. }
  536. process_toolchain() {
  537. process_common_toolchain
  538. # Enable some useful compiler flags
  539. if enabled gcc; then
  540. enabled werror && check_add_cflags -Werror
  541. check_add_cflags -Wall
  542. check_add_cflags -Wdeclaration-after-statement
  543. check_add_cflags -Wdisabled-optimization
  544. check_add_cflags -Wfloat-conversion
  545. check_add_cflags -Wparentheses-equality
  546. check_add_cflags -Wpointer-arith
  547. check_add_cflags -Wtype-limits
  548. check_add_cflags -Wcast-qual
  549. check_add_cflags -Wvla
  550. check_add_cflags -Wimplicit-function-declaration
  551. check_add_cflags -Wuninitialized
  552. check_add_cflags -Wunused
  553. # -Wextra has some tricky cases. Rather than fix them all now, get the
  554. # flag for as many files as possible and fix the remaining issues
  555. # piecemeal.
  556. # https://bugs.chromium.org/p/webm/issues/detail?id=1069
  557. check_add_cflags -Wextra
  558. # check_add_cflags also adds to cxxflags. gtest does not do well with
  559. # -Wundef so add it explicitly to CFLAGS only.
  560. check_cflags -Wundef && add_cflags_only -Wundef
  561. if enabled mips || [ -z "${INLINE}" ]; then
  562. enabled extra_warnings || check_add_cflags -Wno-unused-function
  563. fi
  564. # Avoid this warning for third_party C++ sources. Some reorganization
  565. # would be needed to apply this only to test/*.cc.
  566. check_cflags -Wshorten-64-to-32 && add_cflags_only -Wshorten-64-to-32
  567. fi
  568. if enabled icc; then
  569. enabled werror && check_add_cflags -Werror
  570. check_add_cflags -Wall
  571. check_add_cflags -Wpointer-arith
  572. # ICC has a number of floating point optimizations that we disable
  573. # in favor of deterministic output WRT to other compilers
  574. add_cflags -fp-model precise
  575. fi
  576. # Enable extra, harmless warnings. These might provide additional insight
  577. # to what the compiler is doing and why, but in general, but they shouldn't
  578. # be treated as fatal, even if we're treating warnings as errors.
  579. GCC_EXTRA_WARNINGS="
  580. -Wdisabled-optimization
  581. -Winline
  582. "
  583. enabled gcc && EXTRA_WARNINGS="${GCC_EXTRA_WARNINGS}"
  584. RVCT_EXTRA_WARNINGS="
  585. --remarks
  586. "
  587. enabled rvct && EXTRA_WARNINGS="${RVCT_EXTRA_WARNINGS}"
  588. if enabled extra_warnings; then
  589. for w in ${EXTRA_WARNINGS}; do
  590. check_add_cflags ${w}
  591. enabled gcc && enabled werror && check_add_cflags -Wno-error=${w}
  592. done
  593. fi
  594. # ccache only really works on gcc toolchains
  595. enabled gcc || soft_disable ccache
  596. if enabled mips; then
  597. enable_feature dequant_tokens
  598. enable_feature dc_recon
  599. fi
  600. if enabled internal_stats; then
  601. enable_feature vp9_postproc
  602. fi
  603. # Enable the postbuild target if building for visual studio.
  604. case "$tgt_cc" in
  605. vs*) enable_feature msvs
  606. enable_feature solution
  607. vs_version=${tgt_cc##vs}
  608. VCPROJ_SFX=vcxproj
  609. gen_vcproj_cmd=${source_path}/build/make/gen_msvs_vcxproj.sh
  610. enabled werror && gen_vcproj_cmd="${gen_vcproj_cmd} --enable-werror"
  611. all_targets="${all_targets} solution"
  612. INLINE="__forceinline"
  613. ;;
  614. esac
  615. # Other toolchain specific defaults
  616. case $toolchain in x86*) soft_enable postproc;; esac
  617. if enabled postproc_visualizer; then
  618. enabled postproc || die "postproc_visualizer requires postproc to be enabled"
  619. fi
  620. # Enable unit tests by default if we have a working C++ compiler.
  621. case "$toolchain" in
  622. *-vs*)
  623. soft_enable unit_tests
  624. soft_enable webm_io
  625. soft_enable libyuv
  626. ;;
  627. *-android-*)
  628. soft_enable webm_io
  629. soft_enable libyuv
  630. # GTestLog must be modified to use Android logging utilities.
  631. ;;
  632. *-darwin-*)
  633. # iOS/ARM builds do not work with gtest. This does not match
  634. # x86 targets.
  635. ;;
  636. *-iphonesimulator-*)
  637. soft_enable webm_io
  638. soft_enable libyuv
  639. ;;
  640. *-win*)
  641. # Some mingw toolchains don't have pthread available by default.
  642. # Treat these more like visual studio where threading in gtest
  643. # would be disabled for the same reason.
  644. check_cxx "$@" <<EOF && soft_enable unit_tests
  645. int z;
  646. EOF
  647. check_cxx "$@" <<EOF && soft_enable webm_io
  648. int z;
  649. EOF
  650. check_cxx "$@" <<EOF && soft_enable libyuv
  651. int z;
  652. EOF
  653. ;;
  654. *)
  655. enabled pthread_h && check_cxx "$@" <<EOF && soft_enable unit_tests
  656. int z;
  657. EOF
  658. check_cxx "$@" <<EOF && soft_enable webm_io
  659. int z;
  660. EOF
  661. check_cxx "$@" <<EOF && soft_enable libyuv
  662. int z;
  663. EOF
  664. ;;
  665. esac
  666. # libwebm needs to be linked with C++ standard library
  667. enabled webm_io && LD=${CXX}
  668. # append any user defined extra cflags
  669. if [ -n "${extra_cflags}" ] ; then
  670. check_add_cflags ${extra_cflags} || \
  671. die "Requested extra CFLAGS '${extra_cflags}' not supported by compiler"
  672. fi
  673. if [ -n "${extra_cxxflags}" ]; then
  674. check_add_cxxflags ${extra_cxxflags} || \
  675. die "Requested extra CXXFLAGS '${extra_cxxflags}' not supported by compiler"
  676. fi
  677. }
  678. ##
  679. ## END APPLICATION SPECIFIC CONFIGURATION
  680. ##
  681. CONFIGURE_ARGS="$@"
  682. process "$@"
  683. print_webm_license ${BUILD_PFX}vpx_config.c "/*" " */"
  684. cat <<EOF >> ${BUILD_PFX}vpx_config.c
  685. #include "vpx/vpx_codec.h"
  686. static const char* const cfg = "$CONFIGURE_ARGS";
  687. const char *vpx_codec_build_config(void) {return cfg;}
  688. EOF