blob: 44f7c238b90db80bbd64a635314d02005430b345 [file] [log] [blame]
Guillaume Martres3526f1c2013-08-13 18:46:58 -07001#!/bin/sh
John Koleszar0ea50ce2010-05-18 11:58:33 -04002##
John Koleszar0d719652010-05-28 10:11:58 -04003## configure
John Koleszar0ea50ce2010-05-18 11:58:33 -04004##
John Koleszar0d719652010-05-28 10:11:58 -04005## 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.
John Koleszar0ea50ce2010-05-18 11:58:33 -040013##
14
John Koleszar0ea50ce2010-05-18 11:58:33 -040015#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:
Johannec658122012-10-10 09:16:37 -070023 ${toggle_libs} libraries
24 ${toggle_examples} examples
25 ${toggle_docs} documentation
26 ${toggle_unit_tests} unit tests
Joshua Litta782d632013-11-15 12:29:26 -080027 ${toggle_decode_perf_tests} build decoder perf tests with unit tests
Joshua Litt83b843f2014-07-21 10:57:16 -070028 ${toggle_encode_perf_tests} build encoder perf tests with unit tests
Johann661802b2014-12-01 11:06:49 -080029 --cpu=CPU tune for the specified CPU (ARM: cortex-a8, X86: sse3)
John Koleszar0ea50ce2010-05-18 11:58:33 -040030 --libc=PATH path to alternate libc
Jim Bankoski943e4322014-07-17 06:31:50 -070031 --size-limit=WxH max size to allow in the decoder
Jan Kratochvil7be093e2010-10-05 19:15:08 +020032 --as={yasm|nasm|auto} use specified assembler [auto, yasm preferred]
Johann5d0c33b2013-11-13 14:05:27 -080033 --sdk-path=PATH path to root of sdk (android builds only)
John Koleszar0ea50ce2010-05-18 11:58:33 -040034 ${toggle_codec_srcs} in/exclude codec library source code
35 ${toggle_debug_libs} in/exclude debug version of libraries
John Koleszar0ea50ce2010-05-18 11:58:33 -040036 ${toggle_static_msvcrt} use static MSVCRT (VS builds only)
Yaowu Xua3cff082016-08-03 11:33:39 -070037 ${toggle_vp9_highbitdepth} use high bit depth (10/12) profiles
Yaowu Xu03a021a2015-12-02 17:00:26 -080038 ${toggle_better_hw_compatibility}
39 enable encoder to produce streams with better
40 hardware decoder compatibility
Jingning Han3ee6db62015-08-05 19:00:31 -070041 ${toggle_vp10} VP10 codec support
Yaowu Xu57ad1892011-04-29 09:37:59 -070042 ${toggle_internal_stats} output of encoder internal stats for debug, if supported (encoders)
John Koleszar0ea50ce2010-05-18 11:58:33 -040043 ${toggle_postproc} postprocessing
Jim Bankoski79401542013-09-04 10:02:08 -070044 ${toggle_vp9_postproc} vp9 specific postprocessing
Yunqing Wangaa7335e2011-10-25 15:14:16 -040045 ${toggle_multithread} multithreaded encoding and decoding
John Koleszar0ea50ce2010-05-18 11:58:33 -040046 ${toggle_spatial_resampling} spatial sampling (scaling) support
47 ${toggle_realtime_only} enable this option while building for real-time encoding
Attila Nagy52cf4dc2012-02-09 12:37:03 +020048 ${toggle_onthefly_bitpacking} enable on-the-fly bitpacking in real-time encoding
Stefan Holmerd04f8522011-05-02 15:30:51 +020049 ${toggle_error_concealment} enable this option to get a decoder which is able to conceal losses
Yaowu Xu0a2b25d2014-07-29 13:40:55 -070050 ${toggle_coefficient_range_checking}
51 enable decoder to check if intermediate
52 transform coefficients are in valid range
John Koleszar0ea50ce2010-05-18 11:58:33 -040053 ${toggle_runtime_cpu_detect} runtime cpu detection
John Koleszar7aa97a32010-06-03 10:29:04 -040054 ${toggle_shared} shared library support
James Zern495b2412011-07-25 15:40:36 -070055 ${toggle_static} static library support
John Koleszarf9b2ca52010-09-21 10:06:41 -040056 ${toggle_small} favor smaller size over speed
Fritz Koenig647df002010-11-04 16:03:36 -070057 ${toggle_postproc_visualizer} macro block / block level visualizers
Yunqing Wangaa7335e2011-10-25 15:14:16 -040058 ${toggle_multi_res_encoding} enable multiple-resolution encoding
Stefan Holmer9c411432012-03-06 10:48:18 +010059 ${toggle_temporal_denoising} enable temporal denoising and disable the spatial denoiser
Marcoc7d26cc2014-11-12 17:34:54 -080060 ${toggle_vp9_temporal_denoising}
61 enable vp9 temporal denoising
Vignesh Venkatasubramanian0ffa3832014-03-14 08:10:35 -070062 ${toggle_webm_io} enable input from and output to WebM container
Deb Mukherjee47031c02014-05-16 18:52:01 -070063 ${toggle_libyuv} enable libyuv
John Koleszar0ea50ce2010-05-18 11:58:33 -040064
65Codecs:
66 Codecs can be selectively enabled or disabled individually, or by family:
67 --disable-<codec>
68 is equivalent to:
69 --disable-<codec>-encoder
70 --disable-<codec>-decoder
71
72 Codecs available in this distribution:
73EOF
74#restore editor state '
75
KO Myung-Hun07fa6ad2014-07-22 11:09:27 +090076 family="";
77 last_family="";
78 c="";
79 str="";
John Koleszar0ea50ce2010-05-18 11:58:33 -040080 for c in ${CODECS}; do
81 family=${c%_*}
82 if [ "${family}" != "${last_family}" ]; then
83 [ -z "${str}" ] || echo "${str}"
84 str="$(printf ' %10s:' ${family})"
85 fi
86 str="${str} $(printf '%10s' ${c#*_})"
87 last_family=${family}
88 done
89 echo "${str}"
90 show_help_post
91}
92
93##
94## BEGIN APPLICATION SPECIFIC CONFIGURATION
95##
96
97# all_platforms is a list of all supported target platforms. Maintain
98# alphabetically by architecture, generic-gnu last.
Johann2967bf32016-06-22 16:08:10 -070099all_platforms="${all_platforms} arm64-darwin-gcc"
100all_platforms="${all_platforms} arm64-linux-gcc"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400101all_platforms="${all_platforms} armv6-linux-rvct"
102all_platforms="${all_platforms} armv6-linux-gcc"
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200103all_platforms="${all_platforms} armv6-none-rvct"
Fritz Koenigd8305732012-01-06 11:50:05 -0800104all_platforms="${all_platforms} armv7-android-gcc" #neon Cortex-A8
John Koleszar0ea50ce2010-05-18 11:58:33 -0400105all_platforms="${all_platforms} armv7-darwin-gcc" #neon Cortex-A8
106all_platforms="${all_platforms} armv7-linux-rvct" #neon Cortex-A8
107all_platforms="${all_platforms} armv7-linux-gcc" #neon Cortex-A8
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200108all_platforms="${all_platforms} armv7-none-rvct" #neon Cortex-A8
Martin Storsjoad484fc2013-05-18 23:32:49 +0300109all_platforms="${all_platforms} armv7-win32-vs11"
Yaowu Xua638bdf2013-11-13 11:36:32 -0800110all_platforms="${all_platforms} armv7-win32-vs12"
Ghislain MARY3067c342015-07-28 16:37:09 +0200111all_platforms="${all_platforms} armv7-win32-vs14"
Tom Finegancd2088b2014-06-10 18:52:58 -0700112all_platforms="${all_platforms} armv7s-darwin-gcc"
Johann2967bf32016-06-22 16:08:10 -0700113all_platforms="${all_platforms} armv8-linux-gcc"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400114all_platforms="${all_platforms} mips32-linux-gcc"
Gordana Cmiljanovic1c31e3e2014-08-07 19:09:47 +0200115all_platforms="${all_platforms} mips64-linux-gcc"
Aaron Watry53f61ce2010-09-30 15:36:00 -0400116all_platforms="${all_platforms} sparc-solaris-gcc"
Andoni Morales Alastruey652589d2013-01-14 12:25:52 +0100117all_platforms="${all_platforms} x86-android-gcc"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400118all_platforms="${all_platforms} x86-darwin8-gcc"
119all_platforms="${all_platforms} x86-darwin8-icc"
120all_platforms="${all_platforms} x86-darwin9-gcc"
121all_platforms="${all_platforms} x86-darwin9-icc"
Johann4341e5a2011-10-14 12:06:24 -0700122all_platforms="${all_platforms} x86-darwin10-gcc"
Johann101c2bd2012-04-27 11:40:04 -0700123all_platforms="${all_platforms} x86-darwin11-gcc"
124all_platforms="${all_platforms} x86-darwin12-gcc"
Morton Jonuschatfe4a5202013-07-19 21:09:23 +0200125all_platforms="${all_platforms} x86-darwin13-gcc"
Lawrence Velázquez4fe4c282015-01-22 16:46:02 -0500126all_platforms="${all_platforms} x86-darwin14-gcc"
Alex Converse080ad912015-11-02 14:05:37 -0800127all_platforms="${all_platforms} x86-darwin15-gcc"
Tom Finegan4e6c5552014-06-04 18:57:25 -0700128all_platforms="${all_platforms} x86-iphonesimulator-gcc"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400129all_platforms="${all_platforms} x86-linux-gcc"
130all_platforms="${all_platforms} x86-linux-icc"
KO Myung-Hun2dad8d62012-02-03 13:31:11 +0900131all_platforms="${all_platforms} x86-os2-gcc"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400132all_platforms="${all_platforms} x86-solaris-gcc"
133all_platforms="${all_platforms} x86-win32-gcc"
Martin Storsjobd91beb2013-05-17 00:57:57 +0300134all_platforms="${all_platforms} x86-win32-vs10"
135all_platforms="${all_platforms} x86-win32-vs11"
Yaowu Xua638bdf2013-11-13 11:36:32 -0800136all_platforms="${all_platforms} x86-win32-vs12"
Ghislain MARY3067c342015-07-28 16:37:09 +0200137all_platforms="${all_platforms} x86-win32-vs14"
James Zern5da87e82015-07-24 14:24:20 -0700138all_platforms="${all_platforms} x86_64-android-gcc"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400139all_platforms="${all_platforms} x86_64-darwin9-gcc"
tomfineganfaaa57b2010-11-16 14:52:05 -0500140all_platforms="${all_platforms} x86_64-darwin10-gcc"
Christian Duvivier82edabc2012-08-06 15:05:24 -0700141all_platforms="${all_platforms} x86_64-darwin11-gcc"
Johann101c2bd2012-04-27 11:40:04 -0700142all_platforms="${all_platforms} x86_64-darwin12-gcc"
Morton Jonuschatfe4a5202013-07-19 21:09:23 +0200143all_platforms="${all_platforms} x86_64-darwin13-gcc"
Lawrence Velázquez4fe4c282015-01-22 16:46:02 -0500144all_platforms="${all_platforms} x86_64-darwin14-gcc"
Alex Converse080ad912015-11-02 14:05:37 -0800145all_platforms="${all_platforms} x86_64-darwin15-gcc"
Tom Finegan9b259762014-06-06 16:54:16 -0700146all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400147all_platforms="${all_platforms} x86_64-linux-gcc"
Yunqing Wang7630e362010-06-17 13:34:19 -0400148all_platforms="${all_platforms} x86_64-linux-icc"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400149all_platforms="${all_platforms} x86_64-solaris-gcc"
Rafaël Carré3cad6942011-11-11 22:45:44 -0500150all_platforms="${all_platforms} x86_64-win64-gcc"
Martin Storsjobd91beb2013-05-17 00:57:57 +0300151all_platforms="${all_platforms} x86_64-win64-vs10"
152all_platforms="${all_platforms} x86_64-win64-vs11"
Yaowu Xua638bdf2013-11-13 11:36:32 -0800153all_platforms="${all_platforms} x86_64-win64-vs12"
Ghislain MARY3067c342015-07-28 16:37:09 +0200154all_platforms="${all_platforms} x86_64-win64-vs14"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400155all_platforms="${all_platforms} generic-gnu"
156
157# all_targets is a list of all targets that can be configured
158# note that these should be in dependency order for now.
159all_targets="libs examples docs"
160
161# all targets available are enabled, by default.
162for t in ${all_targets}; do
James Zern95735c32014-04-23 14:51:45 -0700163 [ -f "${source_path}/${t}.mk" ] && enable_feature ${t}
John Koleszar0ea50ce2010-05-18 11:58:33 -0400164done
165
James Zern4b418002014-03-18 18:19:16 -0700166if ! perl --version >/dev/null; then
167 die "Perl is required to build"
168fi
James Zern14be7ba2014-02-28 12:24:46 -0800169
James Zern9402e252014-03-05 14:13:01 -0800170
James Zern95735c32014-04-23 14:51:45 -0700171if [ "`cd \"${source_path}\" && pwd`" != "`pwd`" ]; then
James Zern9402e252014-03-05 14:13:01 -0800172 # test to see if source_path already configured
James Zern95735c32014-04-23 14:51:45 -0700173 if [ -f "${source_path}/vpx_config.h" ]; then
James Zern9402e252014-03-05 14:13:01 -0800174 die "source directory already configured; run 'make distclean' there first"
175 fi
176fi
177
John Koleszar0ea50ce2010-05-18 11:58:33 -0400178# check installed doxygen version
179doxy_version=$(doxygen --version 2>/dev/null)
180doxy_major=${doxy_version%%.*}
181if [ ${doxy_major:-0} -ge 1 ]; then
182 doxy_version=${doxy_version#*.}
183 doxy_minor=${doxy_version%%.*}
184 doxy_patch=${doxy_version##*.}
185
James Zern42ab4012013-08-21 18:11:45 -0700186 [ $doxy_major -gt 1 ] && enable_feature doxygen
187 [ $doxy_minor -gt 5 ] && enable_feature doxygen
188 [ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable_feature doxygen
John Koleszar0ea50ce2010-05-18 11:58:33 -0400189fi
190
Johann7875e1d2015-05-22 06:52:59 -0700191# disable codecs when their source directory does not exist
Johann0146fa92016-06-10 14:59:26 -0700192[ -d "${source_path}/vp10" ] || disable_codec vp10
Johann7875e1d2015-05-22 06:52:59 -0700193
John Koleszaree8bcb12010-05-24 10:16:44 -0400194# install everything except the sources, by default. sources will have
195# to be enabled when doing dist builds, since that's no longer a common
196# case.
James Zernf8630c72014-05-10 11:15:11 -0700197enabled doxygen && enable_feature install_docs
James Zern42ab4012013-08-21 18:11:45 -0700198enable_feature install_bins
199enable_feature install_libs
John Koleszar0ea50ce2010-05-18 11:58:33 -0400200
James Zern42ab4012013-08-21 18:11:45 -0700201enable_feature static
202enable_feature optimizations
James Zernaaccf652015-02-05 19:31:38 -0800203enable_feature dependency_tracking
James Zern42ab4012013-08-21 18:11:45 -0700204enable_feature spatial_resampling
205enable_feature multithread
206enable_feature os_support
207enable_feature temporal_denoising
John Koleszar0ea50ce2010-05-18 11:58:33 -0400208
Johann7875e1d2015-05-22 06:52:59 -0700209CODECS="
Jingning Han3ee6db62015-08-05 19:00:31 -0700210 vp10_encoder
211 vp10_decoder
Johann7875e1d2015-05-22 06:52:59 -0700212"
213CODEC_FAMILIES="
Jingning Han3ee6db62015-08-05 19:00:31 -0700214 vp10
Johann7875e1d2015-05-22 06:52:59 -0700215"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400216
217ARCH_LIST="
218 arm
219 mips
220 x86
221 x86_64
John Koleszar0ea50ce2010-05-18 11:58:33 -0400222"
James Zern6e6dbbc2015-11-17 16:14:05 -0800223ARCH_EXT_LIST_X86="
224 mmx
225 sse
226 sse2
227 sse3
228 ssse3
229 sse4_1
230 avx
231 avx2
232"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400233ARCH_EXT_LIST="
Fritz Koenig89210282012-01-19 15:18:31 -0800234 edsp
235 media
236 neon
Johannce239312014-05-07 11:01:31 -0700237 neon_asm
John Koleszar0ea50ce2010-05-18 11:58:33 -0400238
239 mips32
Dragan Mrdjan07ff7fa2012-04-11 09:53:15 -0700240 dspr2
Parag Salasakar84ec68d2015-03-16 12:36:59 +0530241 msa
Gordana Cmiljanovic1c31e3e2014-08-07 19:09:47 +0200242 mips64
243
James Zern6e6dbbc2015-11-17 16:14:05 -0800244 ${ARCH_EXT_LIST_X86}
John Koleszar0ea50ce2010-05-18 11:58:33 -0400245"
246HAVE_LIST="
247 ${ARCH_EXT_LIST}
248 vpx_ports
John Koleszar0ea50ce2010-05-18 11:58:33 -0400249 pthread_h
Attila Nagy297b2762011-03-25 12:53:03 +0200250 unistd_h
John Koleszar0ea50ce2010-05-18 11:58:33 -0400251"
John Koleszar0952acb2010-06-01 11:14:25 -0400252EXPERIMENT_LIST="
Pengchong Jinaaabbd62014-06-30 09:52:27 -0700253 fp_mb_stats
Deb Mukherjeed50716f2014-10-02 15:43:27 -0700254 emulate_hardware
Yaowu Xu0818a7c2016-08-11 09:39:47 -0700255 clpf
Yaowu Xu253c0012016-08-15 10:27:19 -0700256 dering
Jingning Hancffcfdb2015-10-06 14:23:12 -0700257 var_tx
Debargha Mukherjeee5848de2016-07-01 12:57:14 -0700258 rect_tx
Jingning Hanfe8ecc82015-11-19 11:40:56 -0800259 ref_mv
Jingning Han39775e12016-05-02 08:55:40 -0700260 dual_filter
hui sub3cc3a02015-08-24 14:37:54 -0700261 ext_tx
Yaowu Xu5a27b3b2015-10-22 12:18:52 -0700262 ext_intra
Debargha Mukherjee73e06f32015-11-02 09:58:58 -0800263 ext_inter
264 ext_interp
265 ext_refs
Sarah Parker091f0802016-03-23 15:24:44 -0700266 global_motion
Sarah Parker867f6642016-05-05 13:41:24 -0700267 new_quant
Debargha Mukherjee5bbacd92015-11-13 11:32:17 -0800268 supertx
Alex Converse9ffcb462015-12-16 11:16:32 -0800269 ans
Debargha Mukherjee6a5a08e2016-01-15 12:55:03 -0800270 loop_restoration
271 ext_partition
Julia Robson8bc8f272016-03-18 15:22:42 +0000272 ext_partition_types
Debargha Mukherjee86088512016-03-08 07:17:29 -0800273 ext_tile
Yue Chene25ccff2016-02-10 15:53:08 -0800274 obmc
Debargha Mukherjeebcf4e0a2016-06-09 02:22:48 -0700275 warped_motion
hui su08d7f442016-03-15 11:44:01 -0700276 entropy
Zoe Liu9e974b82016-05-05 14:32:48 -0700277 bidir_pred
Angie Chiang4de81ee2016-07-26 14:14:20 -0700278 bitstream_debug
John Koleszar0952acb2010-06-01 11:14:25 -0400279"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400280CONFIG_LIST="
James Zernaaccf652015-02-05 19:31:38 -0800281 dependency_tracking
John Koleszar0ea50ce2010-05-18 11:58:33 -0400282 external_build
283 install_docs
284 install_bins
285 install_libs
286 install_srcs
287 debug
288 gprof
289 gcov
290 rvct
291 gcc
292 msvs
293 pic
294 big_endian
295
296 codec_srcs
297 debug_libs
John Koleszar0ea50ce2010-05-18 11:58:33 -0400298
299 dequant_tokens
300 dc_recon
John Koleszar0ea50ce2010-05-18 11:58:33 -0400301 runtime_cpu_detect
302 postproc
Jim Bankoski79401542013-09-04 10:02:08 -0700303 vp9_postproc
John Koleszar0ea50ce2010-05-18 11:58:33 -0400304 multithread
Yaowu Xu57ad1892011-04-29 09:37:59 -0700305 internal_stats
John Koleszar0ea50ce2010-05-18 11:58:33 -0400306 ${CODECS}
307 ${CODEC_FAMILIES}
308 encoders
309 decoders
310 static_msvcrt
311 spatial_resampling
312 realtime_only
Attila Nagy52cf4dc2012-02-09 12:37:03 +0200313 onthefly_bitpacking
Stefan Holmerd04f8522011-05-02 15:30:51 +0200314 error_concealment
John Koleszar7aa97a32010-06-03 10:29:04 -0400315 shared
James Zern495b2412011-07-25 15:40:36 -0700316 static
John Koleszarf9b2ca52010-09-21 10:06:41 -0400317 small
Fritz Koenig647df002010-11-04 16:03:36 -0700318 postproc_visualizer
Tero Rintaluoma11a222f2011-01-24 11:21:40 +0200319 os_support
James Berrya0769f72012-05-02 17:25:58 -0400320 unit_tests
Vignesh Venkatasubramanian0ffa3832014-03-14 08:10:35 -0700321 webm_io
Deb Mukherjee47031c02014-05-16 18:52:01 -0700322 libyuv
Joshua Litta782d632013-11-15 12:29:26 -0800323 decode_perf_tests
Joshua Litt83b843f2014-07-21 10:57:16 -0700324 encode_perf_tests
Yunqing Wangaa7335e2011-10-25 15:14:16 -0400325 multi_res_encoding
Stefan Holmer9c411432012-03-06 10:48:18 +0100326 temporal_denoising
Marcoc7d26cc2014-11-12 17:34:54 -0800327 vp9_temporal_denoising
Yaowu Xu0a2b25d2014-07-29 13:40:55 -0700328 coefficient_range_checking
Deb Mukherjee5acfafb2014-08-26 12:35:15 -0700329 vp9_highbitdepth
Yaowu Xu03a021a2015-12-02 17:00:26 -0800330 better_hw_compatibility
John Koleszar0952acb2010-06-01 11:14:25 -0400331 experimental
Jim Bankoski943e4322014-07-17 06:31:50 -0700332 size_limit
Yaowu Xu0818a7c2016-08-11 09:39:47 -0700333 aom_qm
John Koleszar0952acb2010-06-01 11:14:25 -0400334 ${EXPERIMENT_LIST}
John Koleszar0ea50ce2010-05-18 11:58:33 -0400335"
336CMDLINE_SELECT="
James Zernaaccf652015-02-05 19:31:38 -0800337 dependency_tracking
John Koleszard9847632012-12-10 12:07:59 -0800338 external_build
John Koleszar0ea50ce2010-05-18 11:58:33 -0400339 extra_warnings
340 werror
341 install_docs
342 install_bins
343 install_libs
344 install_srcs
345 debug
346 gprof
347 gcov
348 pic
349 optimizations
350 ccache
351 runtime_cpu_detect
Martin Storsjo132422d2013-05-13 01:16:09 +0300352 thumb
John Koleszar0ea50ce2010-05-18 11:58:33 -0400353
354 libs
355 examples
Johannec658122012-10-10 09:16:37 -0700356 docs
John Koleszar0ea50ce2010-05-18 11:58:33 -0400357 libc
Jan Kratochvil7be093e2010-10-05 19:15:08 +0200358 as
Jim Bankoski943e4322014-07-17 06:31:50 -0700359 size_limit
John Koleszar0ea50ce2010-05-18 11:58:33 -0400360 codec_srcs
361 debug_libs
John Koleszar0ea50ce2010-05-18 11:58:33 -0400362
363 dequant_tokens
364 dc_recon
John Koleszar0ea50ce2010-05-18 11:58:33 -0400365 postproc
Jim Bankoski79401542013-09-04 10:02:08 -0700366 vp9_postproc
John Koleszar0ea50ce2010-05-18 11:58:33 -0400367 multithread
Yaowu Xu57ad1892011-04-29 09:37:59 -0700368 internal_stats
John Koleszar0ea50ce2010-05-18 11:58:33 -0400369 ${CODECS}
370 ${CODEC_FAMILIES}
371 static_msvcrt
John Koleszar0ea50ce2010-05-18 11:58:33 -0400372 spatial_resampling
373 realtime_only
Attila Nagy52cf4dc2012-02-09 12:37:03 +0200374 onthefly_bitpacking
Stefan Holmerd04f8522011-05-02 15:30:51 +0200375 error_concealment
John Koleszar7aa97a32010-06-03 10:29:04 -0400376 shared
James Zern495b2412011-07-25 15:40:36 -0700377 static
John Koleszarf9b2ca52010-09-21 10:06:41 -0400378 small
Fritz Koenig647df002010-11-04 16:03:36 -0700379 postproc_visualizer
James Berrya0769f72012-05-02 17:25:58 -0400380 unit_tests
Vignesh Venkatasubramanian0ffa3832014-03-14 08:10:35 -0700381 webm_io
Deb Mukherjee47031c02014-05-16 18:52:01 -0700382 libyuv
Joshua Litta782d632013-11-15 12:29:26 -0800383 decode_perf_tests
Joshua Litt83b843f2014-07-21 10:57:16 -0700384 encode_perf_tests
Yunqing Wangaa7335e2011-10-25 15:14:16 -0400385 multi_res_encoding
Stefan Holmer9c411432012-03-06 10:48:18 +0100386 temporal_denoising
Marcoc7d26cc2014-11-12 17:34:54 -0800387 vp9_temporal_denoising
Yaowu Xu0a2b25d2014-07-29 13:40:55 -0700388 coefficient_range_checking
Yaowu Xu03a021a2015-12-02 17:00:26 -0800389 better_hw_compatibility
Deb Mukherjee5acfafb2014-08-26 12:35:15 -0700390 vp9_highbitdepth
Jim Bankoskia5d11f22012-05-11 08:08:12 -0700391 experimental
Yaowu Xu0818a7c2016-08-11 09:39:47 -0700392 aom_qm
John Koleszar0ea50ce2010-05-18 11:58:33 -0400393"
394
395process_cmdline() {
396 for opt do
397 optval="${opt#*=}"
398 case "$opt" in
Johann0146fa92016-06-10 14:59:26 -0700399 --disable-codecs)
400 for c in ${CODEC_FAMILIES}; do disable_codec $c; done
401 ;;
John Koleszar0952acb2010-06-01 11:14:25 -0400402 --enable-?*|--disable-?*)
403 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
Johann1de5ba72016-06-17 14:25:23 -0700404 if is_in ${option} ${EXPERIMENT_LIST}; then
John Koleszar0952acb2010-06-01 11:14:25 -0400405 if enabled experimental; then
James Zernccb6bdc2013-08-21 19:00:08 -0700406 ${action}_feature $option
John Koleszar0952acb2010-06-01 11:14:25 -0400407 else
408 log_echo "Ignoring $opt -- not in experimental mode."
409 fi
Johann0146fa92016-06-10 14:59:26 -0700410 elif is_in ${option} "${CODECS} ${CODEC_FAMILIES}"; then
411 ${action}_codec ${option}
John Koleszar0952acb2010-06-01 11:14:25 -0400412 else
Yaowu Xu7793b382011-06-22 15:07:04 -0700413 process_common_cmdline $opt
John Koleszar0952acb2010-06-01 11:14:25 -0400414 fi
415 ;;
James Berrya0769f72012-05-02 17:25:58 -0400416 *) process_common_cmdline "$opt"
Yaowu Xu7793b382011-06-22 15:07:04 -0700417 ;;
John Koleszar0ea50ce2010-05-18 11:58:33 -0400418 esac
419 done
420}
421
422post_process_cmdline() {
KO Myung-Hun07fa6ad2014-07-22 11:09:27 +0900423 c=""
John Koleszar0ea50ce2010-05-18 11:58:33 -0400424
John Koleszar0ea50ce2010-05-18 11:58:33 -0400425 # Enable all detected codecs, if they haven't been disabled
426 for c in ${CODECS}; do soft_enable $c; done
427
428 # Enable the codec family if any component of that family is enabled
429 for c in ${CODECS}; do
James Zern42ab4012013-08-21 18:11:45 -0700430 enabled $c && enable_feature ${c%_*}
John Koleszar0ea50ce2010-05-18 11:58:33 -0400431 done
432
433 # Set the {en,de}coders variable if any algorithm in that class is enabled
434 for c in ${CODECS}; do
James Zern42ab4012013-08-21 18:11:45 -0700435 enabled ${c} && enable_feature ${c##*_}s
John Koleszar0ea50ce2010-05-18 11:58:33 -0400436 done
Sarah Parkerdaa4ba82016-08-18 13:03:35 -0700437
438 if enabled global_motion && (enabled ext_inter || enabled dual_filter); then
439 log_echo "global_motion currently not compatible with ext_inter"
440 log_echo "and dual_filter. Disabling global_motion."
441 disable_feature global_motion
442 fi
John Koleszar0ea50ce2010-05-18 11:58:33 -0400443}
444
445
446process_targets() {
447 enabled child || write_common_config_banner
Tom Finegan3d7063d2015-05-12 15:33:40 -0700448 write_common_target_config_h ${BUILD_PFX}vpx_config.h
John Koleszar0ea50ce2010-05-18 11:58:33 -0400449 write_common_config_targets
John Koleszar0ea50ce2010-05-18 11:58:33 -0400450
451 # Calculate the default distribution name, based on the enabled features
KO Myung-Hun07fa6ad2014-07-22 11:09:27 +0900452 cf=""
453 DIST_DIR=vpx
John Koleszar0ea50ce2010-05-18 11:58:33 -0400454 for cf in $CODEC_FAMILIES; do
455 if enabled ${cf}_encoder && enabled ${cf}_decoder; then
456 DIST_DIR="${DIST_DIR}-${cf}"
457 elif enabled ${cf}_encoder; then
458 DIST_DIR="${DIST_DIR}-${cf}cx"
459 elif enabled ${cf}_decoder; then
460 DIST_DIR="${DIST_DIR}-${cf}dx"
461 fi
462 done
463 enabled debug_libs && DIST_DIR="${DIST_DIR}-debug"
464 enabled codec_srcs && DIST_DIR="${DIST_DIR}-src"
Jim Bankoski79401542013-09-04 10:02:08 -0700465 ! enabled postproc && ! enabled vp9_postproc && DIST_DIR="${DIST_DIR}-nopost"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400466 ! enabled multithread && DIST_DIR="${DIST_DIR}-nomt"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400467 ! enabled install_docs && DIST_DIR="${DIST_DIR}-nodocs"
468 DIST_DIR="${DIST_DIR}-${tgt_isa}-${tgt_os}"
469 case "${tgt_os}" in
470 win*) enabled static_msvcrt && DIST_DIR="${DIST_DIR}mt" || DIST_DIR="${DIST_DIR}md"
471 DIST_DIR="${DIST_DIR}-${tgt_cc}"
472 ;;
473 esac
474 if [ -f "${source_path}/build/make/version.sh" ]; then
KO Myung-Hun07fa6ad2014-07-22 11:09:27 +0900475 ver=`"$source_path/build/make/version.sh" --bare "$source_path"`
John Koleszar0ea50ce2010-05-18 11:58:33 -0400476 DIST_DIR="${DIST_DIR}-${ver}"
Ralph Giles53e99872011-03-28 11:36:53 -0700477 VERSION_STRING=${ver}
John Koleszar7aa97a32010-06-03 10:29:04 -0400478 ver=${ver%%-*}
479 VERSION_PATCH=${ver##*.}
480 ver=${ver%.*}
481 VERSION_MINOR=${ver##*.}
482 ver=${ver#v}
483 VERSION_MAJOR=${ver%.*}
John Koleszar0ea50ce2010-05-18 11:58:33 -0400484 fi
John Koleszaree8bcb12010-05-24 10:16:44 -0400485 enabled child || cat <<EOF >> config.mk
Ralph Giles607f8422011-03-28 12:04:51 -0700486
487PREFIX=${prefix}
John Koleszaree8bcb12010-05-24 10:16:44 -0400488ifeq (\$(MAKECMDGOALS),dist)
John Koleszar670af3a2010-05-26 15:57:42 -0400489DIST_DIR?=${DIST_DIR}
John Koleszaree8bcb12010-05-24 10:16:44 -0400490else
John Koleszar670af3a2010-05-26 15:57:42 -0400491DIST_DIR?=\$(DESTDIR)${prefix}
John Koleszaree8bcb12010-05-24 10:16:44 -0400492endif
John Koleszar670af3a2010-05-26 15:57:42 -0400493LIBSUBDIR=${libdir##${prefix}/}
John Koleszar7aa97a32010-06-03 10:29:04 -0400494
Ralph Giles53e99872011-03-28 11:36:53 -0700495VERSION_STRING=${VERSION_STRING}
496
John Koleszar7aa97a32010-06-03 10:29:04 -0400497VERSION_MAJOR=${VERSION_MAJOR}
498VERSION_MINOR=${VERSION_MINOR}
499VERSION_PATCH=${VERSION_PATCH}
500
John Koleszar23d68a52010-06-22 09:53:23 -0400501CONFIGURE_ARGS=${CONFIGURE_ARGS}
John Koleszaree8bcb12010-05-24 10:16:44 -0400502EOF
John Koleszar0ea50ce2010-05-18 11:58:33 -0400503 enabled child || echo "CONFIGURE_ARGS?=${CONFIGURE_ARGS}" >> config.mk
504
505 #
506 # Write makefiles for all enabled targets
507 #
508 for tgt in libs examples docs solution; do
KO Myung-Hun07fa6ad2014-07-22 11:09:27 +0900509 tgt_fn="$tgt-$toolchain.mk"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400510
511 if enabled $tgt; then
512 echo "Creating makefiles for ${toolchain} ${tgt}"
513 write_common_target_config_mk $tgt_fn ${BUILD_PFX}vpx_config.h
514 #write_${tgt}_config
515 fi
516 done
517
518}
519
520process_detect() {
John Koleszar7aa97a32010-06-03 10:29:04 -0400521 if enabled shared; then
522 # Can only build shared libs on a subset of platforms. Doing this check
523 # here rather than at option parse time because the target auto-detect
524 # magic happens after the command line has been parsed.
Brion Vibber992e4b72016-05-02 12:41:59 -0400525 case "${tgt_os}" in
526 linux|os2|darwin*|iphonesimulator*)
527 # Supported platforms
528 ;;
529 *)
Mike Frysingerb4ab43f2012-08-14 14:24:28 -0400530 if enabled gnu; then
531 echo "--enable-shared is only supported on ELF; assuming this is OK"
532 else
Brion Vibber992e4b72016-05-02 12:41:59 -0400533 die "--enable-shared only supported on ELF, OS/2, and Darwin for now"
Mike Frysingerb4ab43f2012-08-14 14:24:28 -0400534 fi
Brion Vibber992e4b72016-05-02 12:41:59 -0400535 ;;
536 esac
John Koleszar7aa97a32010-06-03 10:29:04 -0400537 fi
John Koleszard9847632012-12-10 12:07:59 -0800538 if [ -z "$CC" ] || enabled external_build; then
John Koleszar0ea50ce2010-05-18 11:58:33 -0400539 echo "Bypassing toolchain for environment detection."
James Zern42ab4012013-08-21 18:11:45 -0700540 enable_feature external_build
John Koleszar0ea50ce2010-05-18 11:58:33 -0400541 check_header() {
542 log fake_check_header "$@"
543 header=$1
544 shift
545 var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
James Zern42ab4012013-08-21 18:11:45 -0700546 disable_feature $var
John Koleszard9847632012-12-10 12:07:59 -0800547 # Headers common to all environments
John Koleszar0ea50ce2010-05-18 11:58:33 -0400548 case $header in
549 stdio.h)
550 true;
551 ;;
552 *)
KO Myung-Hun07fa6ad2014-07-22 11:09:27 +0900553 result=false
John Koleszar0ea50ce2010-05-18 11:58:33 -0400554 for d in "$@"; do
555 [ -f "${d##-I}/$header" ] && result=true && break
556 done
557 ${result:-true}
James Zern42ab4012013-08-21 18:11:45 -0700558 esac && enable_feature $var
John Koleszard9847632012-12-10 12:07:59 -0800559
560 # Specialize windows and POSIX environments.
561 case $toolchain in
562 *-win*-*)
Johann3c921442015-12-17 16:51:59 -0800563 # Don't check for any headers in Windows builds.
564 false
565 ;;
John Koleszard9847632012-12-10 12:07:59 -0800566 *)
567 case $header in
John Koleszard9847632012-12-10 12:07:59 -0800568 pthread.h) true;;
John Koleszard9847632012-12-10 12:07:59 -0800569 unistd.h) true;;
570 *) false;;
James Zern42ab4012013-08-21 18:11:45 -0700571 esac && enable_feature $var
John Koleszard9847632012-12-10 12:07:59 -0800572 esac
573 enabled $var
John Koleszar0ea50ce2010-05-18 11:58:33 -0400574 }
575 check_ld() {
576 true
577 }
578 fi
579 check_header stdio.h || die "Unable to invoke compiler: ${CC} ${CFLAGS}"
580 check_ld <<EOF || die "Toolchain is unable to link executables"
581int main(void) {return 0;}
582EOF
583 # check system headers
John Koleszar0ea50ce2010-05-18 11:58:33 -0400584 check_header pthread.h
John Koleszard9847632012-12-10 12:07:59 -0800585 check_header unistd.h # for sysconf(3) and friends.
John Koleszar0ea50ce2010-05-18 11:58:33 -0400586
James Zern42ab4012013-08-21 18:11:45 -0700587 check_header vpx/vpx_integer.h -I${source_path} && enable_feature vpx_ports
John Koleszar0ea50ce2010-05-18 11:58:33 -0400588}
589
590process_toolchain() {
591 process_common_toolchain
592
John Koleszar0ea50ce2010-05-18 11:58:33 -0400593 # Enable some useful compiler flags
594 if enabled gcc; then
595 enabled werror && check_add_cflags -Werror
596 check_add_cflags -Wall
597 check_add_cflags -Wdeclaration-after-statement
598 check_add_cflags -Wdisabled-optimization
James Zerna9d98482016-07-22 13:13:56 -0700599 check_add_cflags -Wfloat-conversion
John Koleszar0ea50ce2010-05-18 11:58:33 -0400600 check_add_cflags -Wpointer-arith
601 check_add_cflags -Wtype-limits
602 check_add_cflags -Wcast-qual
Daniel Kang2f963912012-08-13 14:18:09 -0700603 check_add_cflags -Wvla
Attila Nagy14c9fce2012-04-27 13:41:58 +0300604 check_add_cflags -Wimplicit-function-declaration
605 check_add_cflags -Wuninitialized
606 check_add_cflags -Wunused-variable
James Zerndfa2fb52013-05-03 14:00:33 -0700607 case ${CC} in
Johann8b47e1c2013-10-28 15:44:41 -0700608 *clang*)
609 # libvpx and/or clang have issues with aliasing:
610 # https://code.google.com/p/webm/issues/detail?id=603
611 # work around them until they are fixed
612 check_add_cflags -fno-strict-aliasing
613 ;;
James Zerndfa2fb52013-05-03 14:00:33 -0700614 *) check_add_cflags -Wunused-but-set-variable ;;
615 esac
Yaowu Xu4d90ae42016-02-05 09:35:34 -0800616 if enabled mips || [ -z "${INLINE}" ]; then
James Zern771d2762016-02-01 20:52:16 -0800617 enabled extra_warnings || check_add_cflags -Wno-unused-function
618 else
619 check_add_cflags -Wunused-function
620 fi
John Koleszar0ea50ce2010-05-18 11:58:33 -0400621 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
James Zern42ab4012013-08-21 18:11:45 -0700655 enable_feature dequant_tokens
656 enable_feature dc_recon
John Koleszar0ea50ce2010-05-18 11:58:33 -0400657 fi
658
Yaowu Xu132ef422013-09-06 15:05:05 -0700659 if enabled internal_stats; then
660 enable_feature vp9_postproc
661 fi
662
John Koleszar0ea50ce2010-05-18 11:58:33 -0400663 # Enable the postbuild target if building for visual studio.
664 case "$tgt_cc" in
James Zern42ab4012013-08-21 18:11:45 -0700665 vs*) enable_feature msvs
666 enable_feature solution
John Koleszar0ea50ce2010-05-18 11:58:33 -0400667 vs_version=${tgt_cc##vs}
James Zernf8876a22016-06-27 20:08:12 -0700668 VCPROJ_SFX=vcxproj
669 gen_vcproj_cmd=${source_path}/build/make/gen_msvs_vcxproj.sh
670 enabled werror && gen_vcproj_cmd="${gen_vcproj_cmd} --enable-werror"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400671 all_targets="${all_targets} solution"
Ronald S. Bultjeaac73df2013-02-06 12:45:28 -0800672 INLINE="__forceinline"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400673 ;;
674 esac
675
676 # Other toolchain specific defaults
Tom Finegan3d7063d2015-05-12 15:33:40 -0700677 case $toolchain in x86*) soft_enable postproc;; esac
Fritz Koenig647df002010-11-04 16:03:36 -0700678
Fritz Koenig692b1082010-11-10 14:51:49 -0800679 if enabled postproc_visualizer; then
680 enabled postproc || die "postproc_visualizer requires postproc to be enabled"
681 fi
John Koleszar2bf62c12012-05-22 11:51:14 -0700682
Johannb46d58a2013-01-18 11:31:22 -0800683 # Enable unit tests by default if we have a working C++ compiler.
Johannd6e80de2012-06-12 08:58:11 -0700684 case "$toolchain" in
685 *-vs*)
686 soft_enable unit_tests
Vignesh Venkatasubramanian2dcbf8c2014-03-19 11:56:02 -0700687 soft_enable webm_io
Deb Mukherjee47031c02014-05-16 18:52:01 -0700688 soft_enable libyuv
Johannd6e80de2012-06-12 08:58:11 -0700689 ;;
690 *-android-*)
Vignesh Venkatasubramanian4721f9e2014-04-29 00:03:01 -0700691 soft_enable webm_io
Deb Mukherjee47031c02014-05-16 18:52:01 -0700692 soft_enable libyuv
Johannd6e80de2012-06-12 08:58:11 -0700693 # GTestLog must be modified to use Android logging utilities.
694 ;;
Johanna1d929e2012-12-13 11:35:59 -0800695 *-darwin-*)
696 # iOS/ARM builds do not work with gtest. This does not match
697 # x86 targets.
698 ;;
Tom Finegan4e6c5552014-06-04 18:57:25 -0700699 *-iphonesimulator-*)
700 soft_enable webm_io
701 soft_enable libyuv
702 ;;
James Zerne4d2c252013-06-26 18:35:11 -0700703 *-win*)
704 # Some mingw toolchains don't have pthread available by default.
705 # Treat these more like visual studio where threading in gtest
706 # would be disabled for the same reason.
707 check_cxx "$@" <<EOF && soft_enable unit_tests
708int z;
709EOF
Vignesh Venkatasubramanian2dcbf8c2014-03-19 11:56:02 -0700710 check_cxx "$@" <<EOF && soft_enable webm_io
711int z;
712EOF
Deb Mukherjee47031c02014-05-16 18:52:01 -0700713 check_cxx "$@" <<EOF && soft_enable libyuv
714int z;
715EOF
James Zerne4d2c252013-06-26 18:35:11 -0700716 ;;
John Koleszar2bf62c12012-05-22 11:51:14 -0700717 *)
James Zernf2dc3822013-06-20 12:49:15 -0700718 enabled pthread_h && check_cxx "$@" <<EOF && soft_enable unit_tests
John Koleszar2bf62c12012-05-22 11:51:14 -0700719int z;
720EOF
Vignesh Venkatasubramanian2dcbf8c2014-03-19 11:56:02 -0700721 check_cxx "$@" <<EOF && soft_enable webm_io
722int z;
723EOF
Deb Mukherjee47031c02014-05-16 18:52:01 -0700724 check_cxx "$@" <<EOF && soft_enable libyuv
725int z;
726EOF
Johannd6e80de2012-06-12 08:58:11 -0700727 ;;
John Koleszar2bf62c12012-05-22 11:51:14 -0700728 esac
Vignesh Venkatasubramanian2dcbf8c2014-03-19 11:56:02 -0700729 # libwebm needs to be linked with C++ standard library
730 enabled webm_io && LD=${CXX}
James Zern43a34552015-08-26 20:28:26 -0700731
732 # append any user defined extra cflags
733 if [ -n "${extra_cflags}" ] ; then
734 check_add_cflags ${extra_cflags} || \
735 die "Requested extra CFLAGS '${extra_cflags}' not supported by compiler"
736 fi
Yaowu Xu7c514e22015-09-28 15:55:46 -0700737 if [ -n "${extra_cxxflags}" ]; then
738 check_add_cxxflags ${extra_cxxflags} || \
739 die "Requested extra CXXFLAGS '${extra_cxxflags}' not supported by compiler"
740 fi
John Koleszar0ea50ce2010-05-18 11:58:33 -0400741}
742
743
744##
745## END APPLICATION SPECIFIC CONFIGURATION
746##
747CONFIGURE_ARGS="$@"
748process "$@"
Tom Finegan3d9c3f42011-10-19 22:47:02 -0400749print_webm_license ${BUILD_PFX}vpx_config.c "/*" " */"
750cat <<EOF >> ${BUILD_PFX}vpx_config.c
James Zerndb4afa62015-05-14 19:34:53 -0700751#include "vpx/vpx_codec.h"
John Koleszar0ea50ce2010-05-18 11:58:33 -0400752static const char* const cfg = "$CONFIGURE_ARGS";
753const char *vpx_codec_build_config(void) {return cfg;}
754EOF