Index: configure.in
===================================================================
RCS file: /sources/emacs/emacs/configure.in,v
retrieving revision 1.415
diff -u -r1.415 configure.in
--- configure.in	29 Oct 2006 21:49:24 -0000	1.415
+++ configure.in	1 Nov 2006 11:25:28 -0000
@@ -2686,7 +2686,7 @@
 	    [Define to 1 if you have inet sockets.])
 fi
 
-AC_CHECK_HEADERS(sys/ioctl.h)
+AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
 
 if test -f /usr/lpp/X11/bin/smt.exp; then
   AC_DEFINE(HAVE_AIX_SMT_EXP, 1,
Index: emacsclient.c
===================================================================
RCS file: /sources/emacs/emacs/lib-src/emacsclient.c,v
retrieving revision 1.81
diff -u -r1.81 emacsclient.c
--- emacsclient.c	31 Oct 2006 16:39:15 -0000	1.81
+++ emacsclient.c	1 Nov 2006 11:24:54 -0000
@@ -32,6 +32,7 @@
 # include <stdlib.h>
 
 # define HAVE_SOCKETS
+# define HAVE_INET_SOCKETS
 # define NO_SOCKETS_IN_FILE_SYSTEM
 
 # define HSOCKET SOCKET
@@ -42,17 +43,25 @@
 
 #else /* !WINDOWSNT */
 
-#ifdef HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-# include <netinet/in.h>
-# include <sys/ioctl.h>
+# if HAVE_INET_SOCKETS
+#  include <netinet/in.h>
+# endif
+# if HAVE_FCNTL_H /* for F_SETFL, O_NONBLOCK, O_NDELAY */
+#  include <fcntl.h>
+# endif
+# if HAVE_SYS_IOCTL_H /* for FIONBIO */
+#  include <sys/ioctl.h>
+# endif
+# if HAVE_SYS_FILIO_H /* for FIONBIO (alternate) */
+#  include <sys/filio.h>
+# endif
 
 # define INVALID_SOCKET -1
 # define HSOCKET int
 # define CLOSE_SOCKET close
 # define IOCTL ioctl
 # define INITIALIZE()
+
 typedef int IOCTL_BOOL_ARG;
 
 #endif /* !WINDOWSNT */
@@ -268,7 +277,7 @@
 }
 
 
-#if !defined (HAVE_SOCKETS)
+#if !defined (HAVE_SOCKETS) || !defined(HAVE_INET_SOCKETS)
 
 int
 main (argc, argv)
@@ -282,7 +291,7 @@
   fail (argc, argv);
 }
 
-#else /* HAVE_SOCKETS */
+#else /* HAVE_SOCKETS && HAVE_INET_SOCKETS */
 
 #ifdef WINDOWSNT
 # include <winsock2.h>
@@ -496,10 +505,10 @@
     }
 
 #ifdef O_NONBLOCK
-  IOCTL (s, O_NONBLOCK, &c_arg);
+  fcntl (s, F_SETFL, O_NONBLOCK);
 #else
 #ifdef O_NDELAY
-  IOCTL (s, O_NDELAY, &c_arg);
+  fcntl (s, F_SETFL, O_NDELAY);
 #else
   IOCTL (s, FIONBIO, &c_arg);
 #endif
@@ -815,7 +824,7 @@
   return EXIT_SUCCESS;
 }
 
-#endif /* HAVE_SOCKETS */
+#endif /* HAVE_SOCKETS && HAVE_INET_SOCKETS */
 
 #ifndef HAVE_STRERROR
 char *
