strip whitespace after -L
use dynamic lib for linux/gcc

This patch might be useful for clang and/or darwin too.