reduce optimisations in library builds

This fixes the crashing in issue #56.
add -Wcheck to test program compilation