This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Spelling - megapatch
[metaconfig.git] / U / compline / d_sanemcmp.U
CommitLineData
959f3c4c
JH
1?RCS: $Id: d_sanemcmp.U,v 3.0.1.1 1997/02/28 15:41:19 ram Exp $
2?RCS:
3?RCS: Copyright (c) 1991-1993, Raphael Manfredi
0065f4af 4?RCS:
65a32477 5?RCS: You may redistribute only under the terms of the Artistic License,
959f3c4c
JH
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
65a32477 8?RCS: that same Artistic License; a copy of which may be found at the root
959f3c4c
JH
9?RCS: of the source tree for dist 3.0.
10?RCS:
11?RCS: $Log: d_sanemcmp.U,v $
12?RCS: Revision 3.0.1.1 1997/02/28 15:41:19 ram
13?RCS: patch61: created
14?RCS:
15?RCS:
2cb64bf6 16?MAKE:d_sanemcmp: Compile cat d_memcmp rm_try run \
959f3c4c
JH
17 i_memory i_stdlib i_string i_unistd Oldconfig Setvar
18?MAKE: -pick add $@ %<
19?S:d_sanemcmp:
20?S: This variable conditionally defines the HAS_SANE_MEMCMP symbol if
21?S: the memcpy() routine is available and can be used to compare relative
22?S: magnitudes of chars with their high bits set.
23?S:.
24?C:HAS_SANE_MEMCMP:
25?C: This symbol, if defined, indicates that the memcmp routine is available
26?C: and can be used to compare relative magnitudes of chars with their high
27?C: bits set. If it is not defined, roll your own version.
28?C:.
29?H:#$d_sanemcmp HAS_SANE_MEMCMP /**/
30?H:.
0065f4af 31?F:!try
959f3c4c
JH
32?LINT: set d_sanemcmp
33: can memcmp be trusted to compare relative magnitude?
34?X: assume the worst
35val="$undef"
36case "$d_memcmp" in
37"$define")
38 echo " "
39 echo "Checking if your memcmp() can compare relative magnitude..." >&4
40 $cat >try.c <<EOCP
41#$i_memory I_MEMORY
42#$i_stdlib I_STDLIB
43#$i_string I_STRING
44#$i_unistd I_UNISTD
45EOCP
46 $cat >>try.c <<'EOCP'
47#include <stdio.h>
48#ifdef I_MEMORY
49# include <memory.h>
50#endif
51#ifdef I_STDLIB
52# include <stdlib.h>
53#endif
54#ifdef I_STRING
55# include <string.h>
56#else
57# include <strings.h>
58#endif
59#ifdef I_UNISTD
60# include <unistd.h> /* Needed for NetBSD */
61#endif
62int main()
63{
64char a = -1;
65char b = 0;
66if ((a < b) && memcmp(&a, &b, 1) < 0)
67 exit(1);
68exit(0);
69}
70EOCP
71 set try
72 if eval $compile_ok; then
0f00356b 73 if $run ./try 2>/dev/null; then
959f3c4c
JH
74 echo "Yes, it can."
75 val="$define"
76 else
77 echo "No, it can't (it uses signed chars)."
78 fi
79 else
80 echo "(I can't compile the test program, so we'll assume not...)"
81 fi
82 ;;
83esac
2cb64bf6 84$rm_try
959f3c4c
JH
85set d_sanemcmp
86eval $setvar
87