Conditionally add boost dynamic link to test build.