Add flag 'has-sha' to Configure.

Enables use of a system sha-1 library. Also tweaks the 3rdparty code
we ship to have a matching API.