--- xrelayd.c
+++ xrelayd.c
@@ -51,6 +51,7 @@
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
+#include <sys/socket.h> // setsockopt
 
 #define SYSLOG_NAMES
 #include <syslog.h>
