diff --git a/src/sbbs3/sockopts.c b/src/sbbs3/sockopts.c
index 7a749dd583155db1ff9451bd5f02f44887201361..e41191b48abb67d79012ffe6e65117b31d627459 100644
--- a/src/sbbs3/sockopts.c
+++ b/src/sbbs3/sockopts.c
@@ -60,8 +60,10 @@ int set_socket_options(scfg_t* cfg, SOCKET sock, const char* protocol, char* err
 	iniFileName(cfgfile,sizeof(cfgfile),cfg->ctrl_dir,"sockopts.ini");
 	if((fp=iniOpenFile(cfgfile,FALSE))==NULL) {
 		int optval = 1;
+#if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
 		// Set the only sane choice...
 		setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&optval, sizeof(optval));
+#endif
 		return(0);
 	}
 	list=iniReadFile(fp);