Optionally dynamically link Impala executables

This patch adds two new flags to make_impala.sh:

-build_shared_libs: Impala libraries (excluding thirdparty ones) will be
 built as shared objects (.so), and linked dynamically.

-build_static_libs: Impala libraries will be built as archive
 files (.a), and linked statically. This was the behaviour before this
 patch, and is still the default for make_impala.sh.

The speedup from dynamic linking for a clean build is significant:

make_impala.sh -clean -build_static_libs: 11m48.676s
make_impala.sh -clean -build_shared_libs:  5m46.943s

make_debug.sh now passes -build_shared_libs by
default. make_[asan|release].sh still builds with statically linked libraries. All
automated builds will be statically linked for now; we can move them to
dynamic linking on a case-by-case basis.

Change-Id: Icfd8101bf8e85cadd61d8995ae8864f8730297ea
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3828
Reviewed-by: Henry Robinson <henry@cloudera.com>
Tested-by: jenkins