Add fixes for building under musl

Includes patches from several commits:
* PowerDNS/pdns@1a61508c53512e9d28332d6e450314a515360737
* PowerDNS/pdns@2005fe2ed6c20bf221433cbaa68364154620e1dd
* rubenk/pdns@052ec81dc4f3b0f476c89d86597f6365c1072e38
Merge branch 'master' of github.com:James-TR/powerdns.overlay