summaryrefslogtreecommitdiff
path: root/mcon/U/d_htonl.U
diff options
context:
space:
mode:
Diffstat (limited to 'mcon/U/d_htonl.U')
-rw-r--r--mcon/U/d_htonl.U50
1 files changed, 21 insertions, 29 deletions
diff --git a/mcon/U/d_htonl.U b/mcon/U/d_htonl.U
index 7a08b7b..9e82b91 100644
--- a/mcon/U/d_htonl.U
+++ b/mcon/U/d_htonl.U
@@ -1,11 +1,11 @@
-?RCS: $Id: d_htonl.U 1 2006-08-24 12:32:52Z rmanfredi $
+?RCS: $Id: d_htonl.U 167 2013-05-08 17:58:00Z rmanfredi $
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS:
-?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
-?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: $Log: d_htonl.U,v $
@@ -18,8 +18,7 @@
?RCS: Revision 3.0 1993/08/18 12:06:22 ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
-?MAKE:d_htonl: Inlibc Setvar i_niin i_sysin cat rm contains \
- cppstdin cppflags cppminus
+?MAKE:d_htonl: Trylink cat i_niin i_sysin
?MAKE: -pick add $@ %<
?S:d_htonl:
?S: This variable conditionally defines HAS_HTONL if htonl() and its
@@ -50,39 +49,32 @@
?H:#$d_htonl HAS_NTOHL /**/
?H:#$d_htonl HAS_NTOHS /**/
?H:.
-?F:!htonl.c
?LINT:set d_htonl
-: see if htonl --and friends-- exists
-val=''
-set htonl val
-eval $inlibc
-
-: Maybe they are macros.
-case "$val" in
-$undef)
- $cat >htonl.c <<EOM
+: see if htonl --and friends-- exist
+$cat >try.c <<EOC
#include <stdio.h>
#include <sys/types.h>
#$i_niin I_NETINET_IN
-#$i_sysin I_SYS_IN
#ifdef I_NETINET_IN
#include <netinet/in.h>
#endif
+#$i_sysin I_SYS_IN
#ifdef I_SYS_IN
#include <sys/in.h>
#endif
-#ifdef htonl
-printf("Defined as a macro.");
-#endif
-EOM
- $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
- if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
- val="$define"
- echo "But it seems to be defined as a macro." >&4
- fi
- $rm -f htonl.?
- ;;
-esac
+int main(int argc, char *argv[])
+{
+ static unsigned long ret;
+ unsigned char val = argc;
+ (void) argv;
+ ret |= htonl(val);
+ ret |= htons(val);
+ ret |= ntohl(val);
+ ret |= ntohs(val);
+ return ret ? 0 : 1;
+}
+EOC
+cyn="whether htonl() and friends exist"
set d_htonl
-eval $setvar
+eval $trylink