Conditionally include sys/sysctl.h

Part of issue #680