summaryrefslogtreecommitdiff
path: root/Configure
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-03-05 00:31:17 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-03-05 00:31:17 +0000
commit358a0a8409596a66da8fe9aba200efab9dbfb8ee (patch)
tree6facb170a75130727d62450be7e34293353f2646 /Configure
parenta0c524e9e6047aa20d11f260e92a043b3f3e5dc4 (diff)
downloadperl-358a0a8409596a66da8fe9aba200efab9dbfb8ee.tar.gz
Sanity check on the strtoll and strtoull.
p4raw-id: //depot/cfgperl@5529
Diffstat (limited to 'Configure')
-rwxr-xr-xConfigure93
1 files changed, 92 insertions, 1 deletions
diff --git a/Configure b/Configure
index 5842e8ad9c..7c3f569811 100755
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
#
-# Generated on Fri Mar 3 16:54:03 EET 2000 [metaconfig 3.0 PL70]
+# Generated on Sun Mar 5 01:56:20 EET 2000 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by perlbug@perl.com)
cat >/tmp/c1$$ <<EOF
@@ -11456,6 +11456,54 @@ eval $inlibc
set strtoll d_strtoll
eval $inlibc
+case "$d_longlong-$d_strtoll" in
+"$define-$define")
+ $cat <<EOM
+Checking whether your strtoll() works okay...
+EOM
+ $cat >try.c <<'EOCP'
+#include <errno.h>
+#ifdef __hpux
+#define strtoll __strtoll
+#endif
+#include <stdio.h>
+extern long long int strtoll(char *s, char **, int);
+static int bad = 0;
+int check(char *s, long long ell, int een) {
+ long long gll;
+ errno = 0;
+ gll = strtoll(s, 0, 10);
+ if (!((gll == ell) && (errno == een)))
+ bad++;
+}
+int main() {
+ check(" 1", 1LL, 0);
+ check(" 0", 0LL, 0);
+ check("-1", -1LL, 0);
+ check("-9223372036854775808", -9223372036854775808LL, 0);
+ check("-9223372036854775808", -9223372036854775808LL, 0);
+ check(" 9223372036854775807", 9223372036854775807LL, 0);
+ check("-9223372036854775808", -9223372036854775808LL, 0);
+ check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
+ check("-9223372036854775809", -9223372036854775808LL, ERANGE);
+ if (!bad)
+ printf("ok\n");
+}
+EOCP
+ set try
+ if eval $compile; then
+ case "`./try`" in
+ ok) echo "Your strtoll() seems to be working okay." ;;
+ *) cat <<EOM >&4
+Your strtoll() doesn't seem to be working okay.
+EOM
+ d_strtoll="$undef"
+ ;;
+ esac
+ fi
+ ;;
+esac
+
: see if strtoul exists
set strtoul d_strtoul
eval $inlibc
@@ -11464,6 +11512,49 @@ eval $inlibc
set strtoull d_strtoull
eval $inlibc
+case "$d_longlong-$d_strtoull" in
+"$define-$define")
+ $cat <<EOM
+Checking whether your strtoull() works okay...
+EOM
+ $cat >try.c <<'EOCP'
+#include <errno.h>
+#ifdef __hpux
+#define strtoull __strtoull
+#endif
+#include <stdio.h>
+extern unsigned long long int strtoull(char *s, char **, int);
+static int bad = 0;
+int check(char *s, long long eull, int een) {
+ long long gull;
+ errno = 0;
+ gull = strtoull(s, 0, 10);
+ if (!((gull == eull) && (errno == een)))
+ bad++;
+}
+int main() {
+ check(" 1", 1LL, 0);
+ check(" 0", 0LL, 0);
+ check("18446744073709551615", 18446744073709551615ULL, 0);
+ check("18446744073709551616", 18446744073709551615ULL, ERANGE);
+ if (!bad)
+ printf("ok\n");
+}
+EOCP
+ set try
+ if eval $compile; then
+ case "`./try`" in
+ ok) echo "Your strtoull() seems to be working okay." ;;
+ *) cat <<EOM >&4
+Your strtoull() doesn't seem to be working okay.
+EOM
+ d_strtoull="$undef"
+ ;;
+ esac
+ fi
+ ;;
+esac
+
: see if strtouq exists
set strtouq d_strtouq
eval $inlibc