Replace asprintf and __builtin_bswap64 with portable versions

This introduces a CDDL licenced file from Illumos, but since the CDDL is
non-viral and per-file this is OK.
Wild win32 hacks
More windows hacking
Build dynamic libs on windows, static+dynamic on others
Attempt to integrate a portable snprintf implementation
Moar hacks
Add inttypes.h for windows
Try to make intyypes work portably
Explicitly import CHECK_FUNCTION_EXISTS().
Set CMAKE_C_FLAGS after checking for vsnprintf.

If this doesn't happen, we seem to hit undesirable behavior when
compiling with -Wall, -Werror, and clang, at least on non-Apple versions
of clang, when calling out to CHECK_FUNCTION_EXISTS().

This deserves its own bug report to the Cmake folks.
Let Cmake decide between static/shared libs.
Resurrect heliumStatic
Make sure we install libhelium.a as well
Fix logging on windows

Variadic macros and DLL exported globals are awesome
Merge remote-tracking branch 'origin/adt-windows-logging' into adt-portability-fixes
Fix non-c90 'z' printf modifier for size_t
Remove reference to heliumStatic on win32
Fix config.h.in header indenting
Statically link sample apps, fix cmake indenting
Change linker order for sample libraries

We want libhelium statically linked, and the rest of the libraries
dynamically linked. With the previous order, this fails to link on
Ubuntu 14.04. It works Ok on other distros, so not sure what
specifically about Ubuntu was causing the issue.