Fix compilation error on OSF/1 4.0.
[gnulib.git] / lib / sys_select.in.h
1 /* Substitute for <sys/select.h>.
2    Copyright (C) 2007-2008 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2, or (at your option)
7    any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software Foundation,
16    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
17
18 # if __GNUC__ >= 3
19 @PRAGMA_SYSTEM_HEADER@
20 # endif
21
22 /* On OSF/1, <sys/types.h> and <sys/time.h> include <sys/select.h>.
23    Simply delegate to the system's header in this case.  */
24 #if @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TYPES_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H) && defined _OSF_SOURCE
25
26 # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H
27 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
28
29 #elif @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TIME_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H) && defined _OSF_SOURCE
30
31 # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
32 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
33
34 #else
35
36 #ifndef _GL_SYS_SELECT_H
37
38 #if @HAVE_SYS_SELECT_H@
39
40 /* On many platforms, <sys/select.h> assumes prior inclusion of
41    <sys/types.h>.  */
42 # include <sys/types.h>
43
44 /* On OSF/1 4.0, <sys/select.h> provides only a forward declaration
45    of 'struct timeval', and no definition of this type..  */
46 # include <sys/time.h>
47
48 /* The include_next requires a split double-inclusion guard.  */
49 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
50
51 #endif
52
53 #ifndef _GL_SYS_SELECT_H
54 #define _GL_SYS_SELECT_H
55
56 #if !@HAVE_SYS_SELECT_H@
57
58 /* A platform that lacks <sys/select.h>.  */
59
60 # include <sys/socket.h>
61
62 /* The definition of GL_LINK_WARNING is copied here.  */
63
64 # ifdef __cplusplus
65 extern "C" {
66 # endif
67
68 # if @GNULIB_SELECT@
69 #  if @HAVE_WINSOCK2_H@
70 #   undef select
71 #   define select rpl_select
72 extern int rpl_select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
73 #  endif
74 # elif @HAVE_WINSOCK2_H@
75 #  undef select
76 #  define select select_used_without_requesting_gnulib_module_select
77 # elif defined GNULIB_POSIXCHECK
78 #  undef select
79 #  define select(n,r,w,e,t) \
80      (GL_LINK_WARNING ("select is not always POSIX compliant - " \
81                        "use gnulib module select for portability"), \
82       select (n, r, w, e, t))
83 # endif
84
85 # ifdef __cplusplus
86 }
87 # endif
88
89 #endif
90
91 #endif /* _GL_SYS_SELECT_H */
92 #endif /* _GL_SYS_SELECT_H */
93 #endif /* OSF/1 */