This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Populate metaconfig branch.
[metaconfig.git] / U / compline / d_fd_set.U
1 ?RCS: $Id: d_fd_set.U,v 3.0.1.3 1997/02/28 15:33:16 ram Exp $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
4 ?RCS: 
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
10 ?RCS:
11 ?RCS: $Log: d_fd_set.U,v $
12 ?RCS: Revision 3.0.1.3  1997/02/28  15:33:16  ram
13 ?RCS: patch61: added ?F: metalint hint
14 ?RCS:
15 ?RCS: Revision 3.0.1.2  1994/06/20  06:57:23  ram
16 ?RCS: patch30: extended scope for fd_set checks (ADO)
17 ?RCS:
18 ?RCS: Revision 3.0.1.1  1994/01/24  14:06:27  ram
19 ?RCS: patch16: comments for HAS_FD_* symbols were not consistent
20 ?RCS:
21 ?RCS: Revision 3.0  1993/08/18  12:06:02  ram
22 ?RCS: Baseline for dist 3.0 netwide release.
23 ?RCS:
24 ?MAKE:d_fd_set d_fd_macros d_fds_bits: Compile cat rm Oldconfig \
25         d_socket i_systime i_sysselct
26 ?MAKE:  -pick add $@ %<
27 ?S:d_fd_set:
28 ?S:     This variable contains the eventual value of the HAS_FD_SET symbol,
29 ?S:     which indicates if your C compiler knows about the fd_set typedef.
30 ?S:.
31 ?S:d_fd_macros:
32 ?S:     This variable contains the eventual value of the HAS_FD_MACROS symbol,
33 ?S:     which indicates if your C compiler knows about the macros which
34 ?S:     manipulate an fd_set.
35 ?S:.
36 ?S:d_fds_bits:
37 ?S:     This variable contains the eventual value of the HAS_FDS_BITS symbol,
38 ?S:     which indicates if your fd_set typedef contains the fds_bits member.
39 ?S:     If you have an fd_set typedef, but the dweebs who installed it did
40 ?S:     a half-fast job and neglected to provide the macros to manipulate
41 ?S:     an fd_set, HAS_FDS_BITS will let us know how to fix the gaffe.
42 ?S:.
43 ?C:HAS_FD_SET:
44 ?C:     This symbol, when defined, indicates presence of the fd_set typedef
45 ?C:     in <sys/types.h>
46 ?C:.
47 ?C:HAS_FD_MACROS:
48 ?C:     This symbol, when defined,  indicates presence of the macros used to
49 ?C:     manipulate an fd_set.
50 ?C:.
51 ?C:HAS_FDS_BITS:
52 ?C:     This symbol, when defined, indicates presence of the fds_bits member in
53 ?C:     fd_set.  This knowledge is useful if fd_set is available but the macros
54 ?C:     aren't.
55 ?C:.
56 ?H:#$d_fd_set HAS_FD_SET        /**/
57 ?H:#$d_fd_macros HAS_FD_MACROS  /**/
58 ?H:#$d_fds_bits HAS_FDS_BITS    /**/
59 ?H:.
60 ?F:!fd_set
61 : check for fd_set items
62 $cat <<EOM
63
64 Checking to see how well your C compiler handles fd_set and friends ...
65 EOM
66 ?X: The FD_SET macros can be in strange places.  On some SysV-based
67 ?X: systems, they are in <sys/bsdtypes.h>, which is included (perhaps)
68 ?X: by <sys/socket.h>.  We won't force people to include
69 ?X: <sys/bsdtypes.h> because it might introduce other
70 ?X: incompatibilities.
71 $cat >fd_set.c <<EOCP
72 #$i_systime I_SYS_TIME
73 #$i_sysselct I_SYS_SELECT
74 #$d_socket HAS_SOCKET
75 #include <sys/types.h>
76 #ifdef HAS_SOCKET
77 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
78 #endif
79 #ifdef I_SYS_TIME
80 #include <sys/time.h>
81 #endif
82 #ifdef I_SYS_SELECT
83 #include <sys/select.h>
84 #endif
85 int main() {
86         fd_set fds;
87
88 #ifdef TRYBITS
89         if(fds.fds_bits);
90 #endif
91
92 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
93         exit(0);
94 #else
95         exit(1);
96 #endif
97 }
98 EOCP
99 set fd_set -DTRYBITS
100 if eval $compile; then
101         d_fds_bits="$define"
102         d_fd_set="$define"
103         echo "Well, your system knows about the normal fd_set typedef..." >&4
104         if ./fd_set; then
105                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
106                 d_fd_macros="$define"
107         else
108                 $cat >&4 <<'EOM'
109 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
110 EOM
111                 d_fd_macros="$undef"
112         fi
113 else
114         $cat <<'EOM'
115 Hmm, your compiler has some difficulty with fd_set.  Checking further...
116 EOM
117         set fd_set
118         if eval $compile; then
119                 d_fds_bits="$undef"
120                 d_fd_set="$define"
121                 echo "Well, your system has some sort of fd_set available..." >&4
122                 if ./fd_set; then
123                         echo "and you have the normal fd_set macros." >&4
124                         d_fd_macros="$define"
125                 else
126                         $cat <<'EOM'
127 but not the normal fd_set macros!  Gross!  More work for me...
128 EOM
129                         d_fd_macros="$undef"
130                 fi
131         else
132         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
133                 d_fd_set="$undef"
134                 d_fds_bits="$undef"
135                 d_fd_macros="$undef"
136         fi
137 fi
138 $rm -f fd_set*
139