]> granicus.if.org Git - libvpx/blob - configure
Merge "Renaming COMPPREDMODE_TYPE enum and its members."
[libvpx] / configure
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
15 #source_path="`dirname \"$0\"`"
16 source_path=${0%/*}
17 . "${source_path}/build/make/configure.sh"
18
19 show_help(){
20     show_help_pre
21     cat << EOF
22 Advanced options:
23   ${toggle_libs}                  libraries
24   ${toggle_examples}              examples
25   ${toggle_docs}                  documentation
26   ${toggle_unit_tests}            unit tests
27   ${toggle_decode_perf_tests}     build decoder perf tests with unit tests
28   --libc=PATH                     path to alternate libc
29   --as={yasm|nasm|auto}           use specified assembler [auto, yasm preferred]
30   --sdk-path=PATH                 path to root of sdk (android builds only)
31   ${toggle_fast_unaligned}        don't use unaligned accesses, even when
32                                   supported by hardware [auto]
33   ${toggle_codec_srcs}            in/exclude codec library source code
34   ${toggle_debug_libs}            in/exclude debug version of libraries
35   ${toggle_md5}                   support for output of checksum data
36   ${toggle_static_msvcrt}         use static MSVCRT (VS builds only)
37   ${toggle_vp8}                   VP8 codec support
38   ${toggle_vp9}                   VP9 codec support
39   ${toggle_internal_stats}        output of encoder internal stats for debug, if supported (encoders)
40   ${toggle_mem_tracker}           track memory usage
41   ${toggle_postproc}              postprocessing
42   ${toggle_vp9_postproc}          vp9 specific postprocessing
43   ${toggle_multithread}           multithreaded encoding and decoding
44   ${toggle_spatial_resampling}    spatial sampling (scaling) support
45   ${toggle_realtime_only}         enable this option while building for real-time encoding
46   ${toggle_onthefly_bitpacking}   enable on-the-fly bitpacking in real-time encoding
47   ${toggle_error_concealment}     enable this option to get a decoder which is able to conceal losses
48   ${toggle_runtime_cpu_detect}    runtime cpu detection
49   ${toggle_shared}                shared library support
50   ${toggle_static}                static library support
51   ${toggle_small}                 favor smaller size over speed
52   ${toggle_postproc_visualizer}   macro block / block level visualizers
53   ${toggle_multi_res_encoding}    enable multiple-resolution encoding
54   ${toggle_temporal_denoising}    enable temporal denoising and disable the spatial denoiser
55
56 Codecs:
57   Codecs can be selectively enabled or disabled individually, or by family:
58       --disable-<codec>
59   is equivalent to:
60       --disable-<codec>-encoder
61       --disable-<codec>-decoder
62
63   Codecs available in this distribution:
64 EOF
65 #restore editor state '
66
67     local family;
68     local last_family;
69     local c;
70     local str;
71     for c in ${CODECS}; do
72         family=${c%_*}
73         if [ "${family}" != "${last_family}" ]; then
74             [ -z "${str}" ] || echo "${str}"
75             str="$(printf '    %10s:' ${family})"
76         fi
77         str="${str} $(printf '%10s' ${c#*_})"
78         last_family=${family}
79     done
80     echo "${str}"
81     show_help_post
82 }
83
84 ##
85 ## BEGIN APPLICATION SPECIFIC CONFIGURATION
86 ##
87
88 # all_platforms is a list of all supported target platforms. Maintain
89 # alphabetically by architecture, generic-gnu last.
90 all_platforms="${all_platforms} armv5te-android-gcc"
91 all_platforms="${all_platforms} armv5te-linux-rvct"
92 all_platforms="${all_platforms} armv5te-linux-gcc"
93 all_platforms="${all_platforms} armv5te-none-rvct"
94 all_platforms="${all_platforms} armv6-darwin-gcc"
95 all_platforms="${all_platforms} armv6-linux-rvct"
96 all_platforms="${all_platforms} armv6-linux-gcc"
97 all_platforms="${all_platforms} armv6-none-rvct"
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-vs11"
104 all_platforms="${all_platforms} armv7-win32-vs12"
105 all_platforms="${all_platforms} mips32-linux-gcc"
106 all_platforms="${all_platforms} ppc32-darwin8-gcc"
107 all_platforms="${all_platforms} ppc32-darwin9-gcc"
108 all_platforms="${all_platforms} ppc32-linux-gcc"
109 all_platforms="${all_platforms} ppc64-darwin8-gcc"
110 all_platforms="${all_platforms} ppc64-darwin9-gcc"
111 all_platforms="${all_platforms} ppc64-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-linux-gcc"
123 all_platforms="${all_platforms} x86-linux-icc"
124 all_platforms="${all_platforms} x86-os2-gcc"
125 all_platforms="${all_platforms} x86-solaris-gcc"
126 all_platforms="${all_platforms} x86-win32-gcc"
127 all_platforms="${all_platforms} x86-win32-vs7"
128 all_platforms="${all_platforms} x86-win32-vs8"
129 all_platforms="${all_platforms} x86-win32-vs9"
130 all_platforms="${all_platforms} x86-win32-vs10"
131 all_platforms="${all_platforms} x86-win32-vs11"
132 all_platforms="${all_platforms} x86-win32-vs12"
133 all_platforms="${all_platforms} x86_64-darwin9-gcc"
134 all_platforms="${all_platforms} x86_64-darwin10-gcc"
135 all_platforms="${all_platforms} x86_64-darwin11-gcc"
136 all_platforms="${all_platforms} x86_64-darwin12-gcc"
137 all_platforms="${all_platforms} x86_64-darwin13-gcc"
138 all_platforms="${all_platforms} x86_64-linux-gcc"
139 all_platforms="${all_platforms} x86_64-linux-icc"
140 all_platforms="${all_platforms} x86_64-solaris-gcc"
141 all_platforms="${all_platforms} x86_64-win64-gcc"
142 all_platforms="${all_platforms} x86_64-win64-vs8"
143 all_platforms="${all_platforms} x86_64-win64-vs9"
144 all_platforms="${all_platforms} x86_64-win64-vs10"
145 all_platforms="${all_platforms} x86_64-win64-vs11"
146 all_platforms="${all_platforms} x86_64-win64-vs12"
147 all_platforms="${all_platforms} universal-darwin8-gcc"
148 all_platforms="${all_platforms} universal-darwin9-gcc"
149 all_platforms="${all_platforms} universal-darwin10-gcc"
150 all_platforms="${all_platforms} universal-darwin11-gcc"
151 all_platforms="${all_platforms} universal-darwin12-gcc"
152 all_platforms="${all_platforms} universal-darwin13-gcc"
153 all_platforms="${all_platforms} generic-gnu"
154
155 # all_targets is a list of all targets that can be configured
156 # note that these should be in dependency order for now.
157 all_targets="libs examples docs"
158
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
164 # check installed doxygen version
165 doxy_version=$(doxygen --version 2>/dev/null)
166 doxy_major=${doxy_version%%.*}
167 if [ ${doxy_major:-0} -ge 1 ]; then
168     doxy_version=${doxy_version#*.}
169     doxy_minor=${doxy_version%%.*}
170     doxy_patch=${doxy_version##*.}
171
172     [ $doxy_major -gt 1 ] && enable_feature doxygen
173     [ $doxy_minor -gt 5 ] && enable_feature doxygen
174     [ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable_feature doxygen
175 fi
176
177 # install everything except the sources, by default. sources will have
178 # to be enabled when doing dist builds, since that's no longer a common
179 # case.
180 enabled doxygen && php -v >/dev/null 2>&1 && enable_feature install_docs
181 enable_feature install_bins
182 enable_feature install_libs
183
184 enable_feature static
185 enable_feature optimizations
186 enable_feature fast_unaligned #allow unaligned accesses, if supported by hw
187 enable_feature md5
188 enable_feature spatial_resampling
189 enable_feature multithread
190 enable_feature os_support
191 enable_feature temporal_denoising
192
193 [ -d ${source_path}/../include ] && enable_feature alt_tree_layout
194 for d in vp8 vp9; do
195     [ -d ${source_path}/${d} ] && disable_feature alt_tree_layout;
196 done
197
198 if ! enabled alt_tree_layout; then
199 # development environment
200 [ -d ${source_path}/vp8 ] && CODECS="${CODECS} vp8_encoder vp8_decoder"
201 [ -d ${source_path}/vp9 ] && CODECS="${CODECS} vp9_encoder vp9_decoder"
202 else
203 # customer environment
204 [ -f ${source_path}/../include/vpx/vp8cx.h ] && CODECS="${CODECS} vp8_encoder"
205 [ -f ${source_path}/../include/vpx/vp8dx.h ] && CODECS="${CODECS} vp8_decoder"
206 [ -f ${source_path}/../include/vpx/vp9cx.h ] && CODECS="${CODECS} vp9_encoder"
207 [ -f ${source_path}/../include/vpx/vp9dx.h ] && CODECS="${CODECS} vp9_decoder"
208 [ -f ${source_path}/../include/vpx/vp8cx.h ] || disable_feature vp8_encoder
209 [ -f ${source_path}/../include/vpx/vp8dx.h ] || disable_feature vp8_decoder
210 [ -f ${source_path}/../include/vpx/vp9cx.h ] || disable_feature vp9_encoder
211 [ -f ${source_path}/../include/vpx/vp9dx.h ] || disable_feature vp9_decoder
212
213 [ -f ${source_path}/../lib/*/*mt.lib ] && soft_enable static_msvcrt
214 fi
215
216 CODECS="$(echo ${CODECS} | tr ' ' '\n')"
217 CODEC_FAMILIES="$(for c in ${CODECS}; do echo ${c%_*}; done | sort | uniq)"
218
219 ARCH_LIST="
220     arm
221     mips
222     x86
223     x86_64
224     ppc32
225     ppc64
226 "
227 ARCH_EXT_LIST="
228     edsp
229     media
230     neon
231
232     mips32
233     dspr2
234
235     mmx
236     sse
237     sse2
238     sse3
239     ssse3
240     sse4_1
241     avx
242     avx2
243
244     altivec
245 "
246 HAVE_LIST="
247     ${ARCH_EXT_LIST}
248     vpx_ports
249     stdint_h
250     alt_tree_layout
251     pthread_h
252     sys_mman_h
253     unistd_h
254 "
255 EXPERIMENT_LIST="
256     multiple_arf
257     non420
258     alpha
259 "
260 CONFIG_LIST="
261     external_build
262     install_docs
263     install_bins
264     install_libs
265     install_srcs
266     use_x86inc
267     debug
268     gprof
269     gcov
270     rvct
271     gcc
272     msvs
273     pic
274     big_endian
275
276     codec_srcs
277     debug_libs
278     fast_unaligned
279     mem_manager
280     mem_tracker
281     mem_checks
282     md5
283
284     dequant_tokens
285     dc_recon
286     runtime_cpu_detect
287     postproc
288     vp9_postproc
289     multithread
290     internal_stats
291     ${CODECS}
292     ${CODEC_FAMILIES}
293     encoders
294     decoders
295     static_msvcrt
296     spatial_resampling
297     realtime_only
298     onthefly_bitpacking
299     error_concealment
300     shared
301     static
302     small
303     postproc_visualizer
304     os_support
305     unit_tests
306     decode_perf_tests
307     multi_res_encoding
308     temporal_denoising
309     experimental
310     decrypt
311     ${EXPERIMENT_LIST}
312 "
313 CMDLINE_SELECT="
314     external_build
315     extra_warnings
316     werror
317     install_docs
318     install_bins
319     install_libs
320     install_srcs
321     debug
322     gprof
323     gcov
324     pic
325     use_x86inc
326     optimizations
327     ccache
328     runtime_cpu_detect
329     thumb
330
331     libs
332     examples
333     docs
334     libc
335     as
336     fast_unaligned
337     codec_srcs
338     debug_libs
339     md5
340
341     dequant_tokens
342     dc_recon
343     postproc
344     vp9_postproc
345     multithread
346     internal_stats
347     ${CODECS}
348     ${CODEC_FAMILIES}
349     static_msvcrt
350     mem_tracker
351     spatial_resampling
352     realtime_only
353     onthefly_bitpacking
354     error_concealment
355     shared
356     static
357     small
358     postproc_visualizer
359     unit_tests
360     decode_perf_tests
361     multi_res_encoding
362     temporal_denoising
363     experimental
364     decrypt
365 "
366
367 process_cmdline() {
368     for opt do
369         optval="${opt#*=}"
370         case "$opt" in
371         --disable-codecs) for c in ${CODECS}; do disable_feature $c; done ;;
372         --enable-?*|--disable-?*)
373         eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
374         if echo "${EXPERIMENT_LIST}" | grep "^ *$option\$" >/dev/null; then
375             if enabled experimental; then
376                 ${action}_feature $option
377             else
378                 log_echo "Ignoring $opt -- not in experimental mode."
379             fi
380         else
381             process_common_cmdline $opt
382         fi
383         ;;
384         *) process_common_cmdline "$opt"
385         ;;
386         esac
387     done
388 }
389
390 post_process_cmdline() {
391     local c
392
393     # If the codec family is disabled, disable all components of that family.
394     # If the codec family is enabled, enable all components of that family.
395     log_echo "Configuring selected codecs"
396     for c in ${CODECS}; do
397         disabled ${c%%_*} && disable_feature ${c}
398         enabled ${c%%_*} && enable_feature ${c}
399     done
400
401     # Enable all detected codecs, if they haven't been disabled
402     for c in ${CODECS}; do soft_enable $c; done
403
404     # Enable the codec family if any component of that family is enabled
405     for c in ${CODECS}; do
406         enabled $c && enable_feature ${c%_*}
407     done
408
409     # Set the {en,de}coders variable if any algorithm in that class is enabled
410     for c in ${CODECS}; do
411         enabled ${c} && enable_feature ${c##*_}s
412     done
413 }
414
415
416 process_targets() {
417     enabled child || write_common_config_banner
418     enabled universal || write_common_target_config_h  ${BUILD_PFX}vpx_config.h
419
420     # TODO: add host tools target (obj_int_extract, etc)
421
422     # For fat binaries, call configure recursively to configure for each
423     # binary architecture to be included.
424     if enabled universal; then
425         # Call configure (ourselves) for each subarchitecture
426         for arch in $fat_bin_archs; do
427             BUILD_PFX=${arch}/ toolchain=${arch} $self --child $cmdline_args || exit $?
428         done
429     fi
430
431     # The write_common_config (config.mk) logic is deferred until after the
432     # recursive calls to configure complete, because we want our universal
433     # targets to be executed last.
434     write_common_config_targets
435     enabled universal && echo "FAT_ARCHS=${fat_bin_archs}" >> config.mk
436
437     # Calculate the default distribution name, based on the enabled features
438     local cf
439     local DIST_DIR=vpx
440     for cf in $CODEC_FAMILIES; do
441         if enabled ${cf}_encoder && enabled ${cf}_decoder; then
442             DIST_DIR="${DIST_DIR}-${cf}"
443         elif enabled ${cf}_encoder; then
444             DIST_DIR="${DIST_DIR}-${cf}cx"
445         elif enabled ${cf}_decoder; then
446             DIST_DIR="${DIST_DIR}-${cf}dx"
447         fi
448     done
449     enabled debug_libs && DIST_DIR="${DIST_DIR}-debug"
450     enabled codec_srcs && DIST_DIR="${DIST_DIR}-src"
451     ! enabled postproc && ! enabled vp9_postproc && DIST_DIR="${DIST_DIR}-nopost"
452     ! enabled multithread && DIST_DIR="${DIST_DIR}-nomt"
453     ! enabled install_docs && DIST_DIR="${DIST_DIR}-nodocs"
454     DIST_DIR="${DIST_DIR}-${tgt_isa}-${tgt_os}"
455     case "${tgt_os}" in
456     win*) enabled static_msvcrt && DIST_DIR="${DIST_DIR}mt" || DIST_DIR="${DIST_DIR}md"
457           DIST_DIR="${DIST_DIR}-${tgt_cc}"
458           ;;
459     esac
460     if [ -f "${source_path}/build/make/version.sh" ]; then
461         local ver=`"$source_path/build/make/version.sh" --bare $source_path`
462         DIST_DIR="${DIST_DIR}-${ver}"
463         VERSION_STRING=${ver}
464         ver=${ver%%-*}
465         VERSION_PATCH=${ver##*.}
466         ver=${ver%.*}
467         VERSION_MINOR=${ver##*.}
468         ver=${ver#v}
469         VERSION_MAJOR=${ver%.*}
470     fi
471     enabled child || cat <<EOF >> config.mk
472
473 PREFIX=${prefix}
474 ifeq (\$(MAKECMDGOALS),dist)
475 DIST_DIR?=${DIST_DIR}
476 else
477 DIST_DIR?=\$(DESTDIR)${prefix}
478 endif
479 LIBSUBDIR=${libdir##${prefix}/}
480
481 VERSION_STRING=${VERSION_STRING}
482
483 VERSION_MAJOR=${VERSION_MAJOR}
484 VERSION_MINOR=${VERSION_MINOR}
485 VERSION_PATCH=${VERSION_PATCH}
486
487 CONFIGURE_ARGS=${CONFIGURE_ARGS}
488 EOF
489     enabled child || echo "CONFIGURE_ARGS?=${CONFIGURE_ARGS}" >> config.mk
490
491     #
492     # Write makefiles for all enabled targets
493     #
494     for tgt in libs examples docs solution; do
495         local tgt_fn="$tgt-$toolchain.mk"
496
497         if enabled $tgt; then
498             echo "Creating makefiles for ${toolchain} ${tgt}"
499             write_common_target_config_mk $tgt_fn ${BUILD_PFX}vpx_config.h
500             #write_${tgt}_config
501         fi
502     done
503
504 }
505
506 process_detect() {
507     if enabled shared; then
508         # Can only build shared libs on a subset of platforms. Doing this check
509         # here rather than at option parse time because the target auto-detect
510         # magic happens after the command line has been parsed.
511         if ! enabled linux; then
512             if enabled gnu; then
513                 echo "--enable-shared is only supported on ELF; assuming this is OK"
514             else
515                 die "--enable-shared only supported on ELF for now"
516             fi
517         fi
518     fi
519     if [ -z "$CC" ] || enabled external_build; then
520         echo "Bypassing toolchain for environment detection."
521         enable_feature external_build
522         check_header() {
523             log fake_check_header "$@"
524             header=$1
525             shift
526             var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
527             disable_feature $var
528             # Headers common to all environments
529             case $header in
530                 stdio.h)
531                     true;
532                 ;;
533                 *)
534                     local result=false
535                     for d in "$@"; do
536                         [ -f "${d##-I}/$header" ] && result=true && break
537                     done
538                     ${result:-true}
539             esac && enable_feature $var
540
541             # Specialize windows and POSIX environments.
542             case $toolchain in
543                 *-win*-*)
544                     case $header-$toolchain in
545                         stdint*-gcc) true;;
546                         *) false;;
547                     esac && enable_feature $var
548                     ;;
549                 *)
550                     case $header in
551                         stdint.h) true;;
552                         pthread.h) true;;
553                         sys/mman.h) true;;
554                         unistd.h) true;;
555                         *) false;;
556                     esac && enable_feature $var
557             esac
558             enabled $var
559         }
560         check_ld() {
561             true
562         }
563     fi
564     check_header stdio.h || die "Unable to invoke compiler: ${CC} ${CFLAGS}"
565     check_ld <<EOF || die "Toolchain is unable to link executables"
566 int main(void) {return 0;}
567 EOF
568     # check system headers
569     check_header stdint.h
570     check_header pthread.h
571     check_header sys/mman.h
572     check_header unistd.h # for sysconf(3) and friends.
573
574     check_header vpx/vpx_integer.h -I${source_path} && enable_feature vpx_ports
575 }
576
577 process_toolchain() {
578     process_common_toolchain
579
580     # Handle universal binaries for this architecture
581     case $toolchain in
582         universal-darwin*)
583             local darwin_ver=${tgt_os##darwin}
584
585             # Snow Leopard (10.6/darwin10) dropped support for PPC
586             # Include PPC support for all prior versions
587             if [ $darwin_ver -lt 10 ]; then
588                 fat_bin_archs="$fat_bin_archs ppc32-${tgt_os}-gcc"
589             fi
590
591             # Tiger (10.4/darwin8) brought support for x86
592             if [ $darwin_ver -ge 8 ]; then
593                 fat_bin_archs="$fat_bin_archs x86-${tgt_os}-${tgt_cc}"
594             fi
595
596             # Leopard (10.5/darwin9) brought 64 bit support
597             if [ $darwin_ver -ge 9 ]; then
598                 fat_bin_archs="$fat_bin_archs x86_64-${tgt_os}-${tgt_cc}"
599             fi
600             ;;
601     esac
602
603
604     # Enable some useful compiler flags
605     if enabled gcc; then
606         enabled werror && check_add_cflags -Werror
607         check_add_cflags -Wall
608         check_add_cflags -Wdeclaration-after-statement
609         check_add_cflags -Wdisabled-optimization
610         check_add_cflags -Wpointer-arith
611         check_add_cflags -Wtype-limits
612         check_add_cflags -Wcast-qual
613         check_add_cflags -Wvla
614         check_add_cflags -Wimplicit-function-declaration
615         check_add_cflags -Wuninitialized
616         check_add_cflags -Wunused-variable
617         case ${CC} in
618           *clang*)
619               # libvpx and/or clang have issues with aliasing:
620               # https://code.google.com/p/webm/issues/detail?id=603
621               # work around them until they are fixed
622               check_add_cflags -fno-strict-aliasing
623           ;;
624           *) check_add_cflags -Wunused-but-set-variable ;;
625         esac
626         enabled extra_warnings || check_add_cflags -Wno-unused-function
627     fi
628
629     if enabled icc; then
630         enabled werror && check_add_cflags -Werror
631         check_add_cflags -Wall
632         check_add_cflags -Wpointer-arith
633
634         # ICC has a number of floating point optimizations that we disable
635         # in favor of deterministic output WRT to other compilers
636         add_cflags -fp-model precise
637     fi
638
639     # Enable extra, harmless warnings. These might provide additional insight
640     # to what the compiler is doing and why, but in general, but they shouldn't
641     # be treated as fatal, even if we're treating warnings as errors.
642     GCC_EXTRA_WARNINGS="
643         -Wdisabled-optimization
644         -Winline
645     "
646     enabled gcc && EXTRA_WARNINGS="${GCC_EXTRA_WARNINGS}"
647     RVCT_EXTRA_WARNINGS="
648         --remarks
649     "
650     enabled rvct && EXTRA_WARNINGS="${RVCT_EXTRA_WARNINGS}"
651     if enabled extra_warnings; then
652         for w in ${EXTRA_WARNINGS}; do
653             check_add_cflags ${w}
654             enabled gcc && enabled werror && check_add_cflags -Wno-error=${w}
655         done
656     fi
657
658     # ccache only really works on gcc toolchains
659     enabled gcc || soft_disable ccache
660     if enabled mips; then
661         enable_feature dequant_tokens
662         enable_feature dc_recon
663     fi
664
665     if enabled internal_stats; then
666         enable_feature vp9_postproc
667     fi
668
669     # Enable the postbuild target if building for visual studio.
670     case "$tgt_cc" in
671         vs*) enable_feature msvs
672              enable_feature solution
673              vs_version=${tgt_cc##vs}
674              case $vs_version in
675              [789])
676                  VCPROJ_SFX=vcproj
677                  gen_vcproj_cmd=${source_path}/build/make/gen_msvs_proj.sh
678                  ;;
679              10|11|12)
680                  VCPROJ_SFX=vcxproj
681                  gen_vcproj_cmd=${source_path}/build/make/gen_msvs_vcxproj.sh
682                  ;;
683              esac
684              all_targets="${all_targets} solution"
685              INLINE="__forceinline"
686         ;;
687     esac
688
689     # Other toolchain specific defaults
690     case $toolchain in x86*|ppc*|universal*) soft_enable postproc;; esac
691
692     if enabled postproc_visualizer; then
693         enabled postproc || die "postproc_visualizer requires postproc to be enabled"
694     fi
695
696     # Enable unit tests by default if we have a working C++ compiler.
697     case "$toolchain" in
698         *-vs*)
699             soft_enable unit_tests
700         ;;
701         *-android-*)
702             # GTestLog must be modified to use Android logging utilities.
703         ;;
704         *-darwin-*)
705             # iOS/ARM builds do not work with gtest. This does not match
706             # x86 targets.
707         ;;
708         *-win*)
709             # Some mingw toolchains don't have pthread available by default.
710             # Treat these more like visual studio where threading in gtest
711             # would be disabled for the same reason.
712             check_cxx "$@" <<EOF && soft_enable unit_tests
713 int z;
714 EOF
715         ;;
716         *)
717             enabled pthread_h && check_cxx "$@" <<EOF && soft_enable unit_tests
718 int z;
719 EOF
720         ;;
721     esac
722 }
723
724
725 ##
726 ## END APPLICATION SPECIFIC CONFIGURATION
727 ##
728 CONFIGURE_ARGS="$@"
729 process "$@"
730 print_webm_license ${BUILD_PFX}vpx_config.c "/*" " */"
731 cat <<EOF >> ${BUILD_PFX}vpx_config.c
732 static const char* const cfg = "$CONFIGURE_ARGS";
733 const char *vpx_codec_build_config(void) {return cfg;}
734 EOF