[BUILD] fix build for systems without SOL_TCP

Andrew Azarov reported that haproxy-1.4-dev1 does not build
under FreeBSD 7.2 because SOL_TCP is not defined. So add a
check for its definition before using it. This only impacts
network optimisations anyway.
diff --git a/src/backend.c b/src/backend.c
index a67d648..baa301a 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1968,7 +1968,7 @@
 		}
 	}
 
-#ifdef TCP_QUICKACK
+#if defined(TCP_QUICKACK) && defined(SOL_TCP)
 	/* disabling tcp quick ack now allows the first request to leave the
 	 * machine with the first ACK. We only do this if there are pending
 	 * data in the buffer.
diff --git a/src/checks.c b/src/checks.c
index 40fb698..211a2ec 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -678,7 +678,7 @@
 				}
 
 				if (s->result == SRV_CHK_UNKNOWN) {
-#ifdef TCP_QUICKACK
+#if defined(TCP_QUICKACK) && defined(SOL_TCP)
 					/* disabling tcp quick ack now allows
 					 * the request to leave the machine with
 					 * the first ACK.
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 99900e4..0091464 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -251,7 +251,7 @@
 		}
 	}
 #endif
-#ifdef TCP_MAXSEG
+#if defined(TCP_MAXSEG) && defined(SOL_TCP)
 	if (listener->maxseg) {
 		if (setsockopt(fd, SOL_TCP, TCP_MAXSEG,
 			       &listener->maxseg, sizeof(listener->maxseg)) == -1) {
@@ -272,7 +272,7 @@
 		goto tcp_close_return;
 	}
 
-#ifdef TCP_QUICKACK
+#if defined(TCP_QUICKACK) && defined(SOL_TCP)
 	if (listener->options & LI_O_NOQUICKACK)
 		setsockopt(fd, SOL_TCP, TCP_QUICKACK, (char *) &zero, sizeof(zero));
 #endif
diff --git a/src/stream_sock.c b/src/stream_sock.c
index 00cb9e8..f20bb3f 100644
--- a/src/stream_sock.c
+++ b/src/stream_sock.c
@@ -587,7 +587,7 @@
 			max = b->send_max;
 
 
-#ifdef TCP_CORK
+#if defined(TCP_CORK) && defined(SOL_TCP)
 		/*
 		 * Check if we want to cork output before sending. This typically occurs
 		 * when there are data left in the buffer, or when we reached the end of
@@ -670,7 +670,7 @@
 	 */
 	if (unlikely((fdtab[si->fd].flags & (FD_FL_TCP|FD_FL_TCP_NODELAY)) == FD_FL_TCP && (b->flags & BF_EMPTY))) {
 		if ((b->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_HIJACK|BF_WRITE_ENA|BF_SHUTR)) != (BF_WRITE_ENA|BF_SHUTR)) {
-#ifdef TCP_CORK
+#if defined(TCP_CORK) && defined(SOL_TCP)
 			if (fdtab[si->fd].flags & FD_FL_TCP_CORK)
 				setsockopt(si->fd, SOL_TCP, TCP_CORK, (char *) &zero, sizeof(zero));
 #endif