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