configure 23 KB

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