Improve DragonFlyBSD support

Patches taken from
https://github.com/DragonFlyBSD/DPorts/tree/master/sysutils/consolekit