Check for libc++ before using it.

Fixes #731.