Fix build on SunOS.  Based on a patch by MAINTAINER.