Solaris 11/OpenIndiana building patch

This patch makes core compile on Solaris 11/OpenIndiana, it's not the best way as it detects the platform by using __sun macro definition which is obviously present only on Solaris-based operating systems. However this can further be improved. I hope you'll find it useful and will take steps to implement support for this less popular platform