Commit | Line | Data |
---|---|---|
33a01fd2 | 1 | ?RCS: $Id$ |
d8875586 MBT |
2 | ?RCS: |
3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi | |
33a01fd2 MBT |
4 | ?RCS: |
5 | ?RCS: You may redistribute only under the terms of the Artistic License, | |
d8875586 MBT |
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 | |
33a01fd2 | 8 | ?RCS: that same Artistic License; a copy of which may be found at the root |
d8875586 MBT |
9 | ?RCS: of the source tree for dist 4.0. |
10 | ?RCS: | |
11 | ?RCS: $Log: d_htonl.U,v $ | |
12 | ?RCS: Revision 3.0.1.2 1994/08/29 16:09:25 ram | |
13 | ?RCS: patch32: now properly handles htonl() and friends when macros (ADO) | |
14 | ?RCS: | |
15 | ?RCS: Revision 3.0.1.1 1994/05/06 14:45:00 ram | |
16 | ?RCS: patch23: now also check for htonl() macro (ADO) | |
17 | ?RCS: | |
18 | ?RCS: Revision 3.0 1993/08/18 12:06:22 ram | |
19 | ?RCS: Baseline for dist 3.0 netwide release. | |
20 | ?RCS: | |
21 | ?MAKE:d_htonl: Inlibc Setvar i_niin i_sysin cat rm contains \ | |
22 | cppstdin cppflags cppminus | |
23 | ?MAKE: -pick add $@ %< | |
24 | ?S:d_htonl: | |
25 | ?S: This variable conditionally defines HAS_HTONL if htonl() and its | |
26 | ?S: friends are available to do network order byte swapping. | |
27 | ?S:. | |
28 | ?C:HAS_HTONL (HTONL): | |
29 | ?C: This symbol, if defined, indicates that the htonl() routine (and | |
30 | ?C: friends htons() ntohl() ntohs()) are available to do network | |
31 | ?C: order byte swapping. | |
32 | ?C:. | |
33 | ?C:HAS_HTONS (HTONS): | |
34 | ?C: This symbol, if defined, indicates that the htons() routine (and | |
35 | ?C: friends htonl() ntohl() ntohs()) are available to do network | |
36 | ?C: order byte swapping. | |
37 | ?C:. | |
38 | ?C:HAS_NTOHL (NTOHL): | |
39 | ?C: This symbol, if defined, indicates that the ntohl() routine (and | |
40 | ?C: friends htonl() htons() ntohs()) are available to do network | |
41 | ?C: order byte swapping. | |
42 | ?C:. | |
43 | ?C:HAS_NTOHS (NTOHS): | |
44 | ?C: This symbol, if defined, indicates that the ntohs() routine (and | |
45 | ?C: friends htonl() htons() ntohl()) are available to do network | |
46 | ?C: order byte swapping. | |
47 | ?C:. | |
48 | ?H:#$d_htonl HAS_HTONL /**/ | |
49 | ?H:#$d_htonl HAS_HTONS /**/ | |
50 | ?H:#$d_htonl HAS_NTOHL /**/ | |
51 | ?H:#$d_htonl HAS_NTOHS /**/ | |
52 | ?H:. | |
53 | ?F:!htonl.c | |
54 | ?LINT:set d_htonl | |
55 | : see if htonl --and friends-- exists | |
56 | val='' | |
57 | set htonl val | |
58 | eval $inlibc | |
59 | ||
60 | : Maybe they are macros. | |
61 | case "$val" in | |
62 | $undef) | |
63 | $cat >htonl.c <<EOM | |
64 | #include <stdio.h> | |
65 | #include <sys/types.h> | |
66 | #$i_niin I_NETINET_IN | |
67 | #$i_sysin I_SYS_IN | |
68 | #ifdef I_NETINET_IN | |
69 | #include <netinet/in.h> | |
70 | #endif | |
71 | #ifdef I_SYS_IN | |
72 | #include <sys/in.h> | |
73 | #endif | |
74 | #ifdef htonl | |
75 | printf("Defined as a macro."); | |
76 | #endif | |
77 | EOM | |
78 | $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null | |
79 | if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then | |
80 | val="$define" | |
81 | echo "But it seems to be defined as a macro." >&4 | |
82 | fi | |
83 | $rm -f htonl.? | |
84 | ;; | |
85 | esac | |
86 | set d_htonl | |
87 | eval $setvar | |
88 |