Check if libbluetooth is present earlier in the build process. Fixes #1168.

See #1168.