Adds a check for standalone_library when STATIC_LIBRARY is defined inside the global heap routines. For static DR in standalone mode, libc malloc and free are used instead of DR's allocator, for two reasons: better multi-threaded performance and better interoperability with tools like sanitizers.
Only global alloc needs this because standalone mode never creates thread contexts. This is limited to static DR because we can use a direct call and avoid pulling in libc dependencies into shared-library DR, which will not work. Most standalone uses should prefer static DR in any case.
Fixes #3316 (closed)