build: fix openssl detection for cross builds

Make sure that the detected openssl successfully links before enabling support.