Browse code

tcp: fix compilation problem on solaris (FIONREAD)

- on solaris include <sys/filio.h> if present, else define BSD_COMP before
including ioctl.h.

Reported-by: Vance Shipley vances at motivity ca.

Andrei Pelinescu-Onciul authored on 16/02/2009 17:20:17
Showing 2 changed files
... ...
@@ -1440,6 +1440,16 @@ ifeq  ($(OS), solaris)
1440 1440
 	ifeq ($(NO_SELECT),)
1441 1441
 		DEFS+=-DHAVE_SELECT
1442 1442
 	endif
1443
+	# check for filio.h
1444
+	filio_h_locations= /usr/include/sys/filio.h \
1445
+						$(LOCALBASE)/include/sys/filio.h
1446
+	has_filio_h=$(shell for r in $(filio_h_locations); do \
1447
+						if  [ -r "$$r" ] ; then echo yes; exit; fi \
1448
+						done;\
1449
+				)
1450
+	ifeq ($(has_filio_h), yes)
1451
+		DEFS+=-DHAVE_FILIO_H
1452
+	endif
1443 1453
 	ifeq ($(mode), release)
1444 1454
 		#use these only if you're using gcc with Solaris ld
1445 1455
 		#LDFLAGS=-O2 $(PROFILE)
... ...
@@ -115,6 +115,11 @@
115 115
 #include <sys/types.h>
116 116
 #include <sys/select.h>
117 117
 #include <sys/socket.h>
118
+#ifdef HAVE_FILIO_H
119
+#include <sys/filio.h> /* needed on solaris 2.x for FIONREAD */
120
+#elif defined __OS_solaris
121
+#define BSD_COMP  /* needed on older solaris for FIONREAD */
122
+#endif /* HAVE_FILIO_H / __OS_solaris */
118 123
 #include <sys/ioctl.h>  /* ioctl() used on write error */
119 124
 #include <netinet/in.h>
120 125
 #include <netinet/in_systm.h>