summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-11-02 10:48:43 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2014-11-02 13:59:54 -0500
commitbade9271ee0e5b9c22d1e80ca4088af09f1bcf43 (patch)
tree239d66dfce205da2caccdb88df4f41c314655b47
parent5a4dabf87fafe1590c8794c98083fd6b5208630f (diff)
downloadperl-bade9271ee0e5b9c22d1e80ca4088af09f1bcf43.tar.gz
Configure: add doublekind for the format of double.
-rwxr-xr-xConfigure74
-rw-r--r--Cross/config.sh-arm-linux1
-rw-r--r--NetWare/config.wc1
-rw-r--r--Porting/Glossary10
-rw-r--r--Porting/config.sh1
-rwxr-xr-xconfig_h.SH19
-rw-r--r--configure.com1
-rw-r--r--metaconfig.h1
-rwxr-xr-xmyconfig.SH2
-rw-r--r--plan9/config_sh.sample1
-rw-r--r--symbian/config.sh1
-rw-r--r--uconfig.h23
-rw-r--r--uconfig.sh1
-rw-r--r--uconfig64.sh1
-rw-r--r--win32/config.ce1
-rw-r--r--win32/config.gc1
-rw-r--r--win32/config.vc1
17 files changed, 137 insertions, 3 deletions
diff --git a/Configure b/Configure
index 03c9a99a10..a12eba51eb 100755
--- a/Configure
+++ b/Configure
@@ -875,6 +875,7 @@ ld=''
ld_can_script=''
lddlflags=''
usedl=''
+doublekind=''
doublesize=''
ebcdic=''
fflushNULL=''
@@ -6788,6 +6789,78 @@ $rm_try
set float.h i_float
eval $inhdr
+$echo "Checking the kind of doubles you have..." >&4
+$cat <<EOP >try.c
+#$i_stdlib I_STDLIB
+#define DOUBLESIZE $doublesize
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+static const double d = -0.1;
+int main() {
+ unsigned const char* b = (unsigned const char*)(&d);
+#if DOUBLESIZE == 4
+ if (b[0] == 0xCD || b[3] == 0xBD) {
+ /* IEEE 754 32-bit little-endian */
+ printf("1\n");
+ exit(0);
+ }
+ if (b[0] == 0xBD || b[3] == 0xCD) {
+ /* IEEE 754 32-bit big-endian */
+ printf("2\n");
+ exit(0);
+ }
+#endif
+#if DOUBLESIZE == 8
+ if (b[0] == 0x9A || b[7] == 0xBD) {
+ /* IEEE 754 64-bit little-endian */
+ printf("3\n");
+ exit(0);
+ }
+ if (b[0] == 0x9A || b[7] == 0xCD) {
+ /* IEEE 754 64-bit big-endian */
+ printf("4\n");
+ exit(0);
+ }
+#endif
+#if DOUBLESIZE == 16
+ if (b[0] == 0x9A || b[15] == 0xBD) {
+ /* IEEE 754 128-bit little-endian */
+ printf("5\n");
+ exit(0);
+ }
+ if (b[0] == 0x9A || b[15] == 0xCD) {
+ /* IEEE 754 128-bit big-endian */
+ printf("6\n");
+ exit(0);
+ }
+#endif
+ /* Rumoredly some old ARM processors have 'mixed endian' doubles,
+ * two 32-bit little endians stored in big-endian order. */
+ /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
+ * Whether those environments can still build Perl is debatable. */
+ printf("-1\n"); /* unknown */
+ exit(0);
+}
+EOP
+set try
+if eval $compile; then
+ doublekind=`$run ./try`
+else
+ doublekind=-1
+fi
+case "$doublekind" in
+1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
+2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
+3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
+4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
+5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
+6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
+*) echo "Cannot figure out your double. You VAX, or something?" >&4 ;;
+esac
+$rm_try
+
: check for long doubles
echo " "
echo "Checking to see if you have long double..." >&4
@@ -23946,6 +24019,7 @@ db_version_patch='$db_version_patch'
direntrytype='$direntrytype'
dlext='$dlext'
dlsrc='$dlsrc'
+doublekind='$doublekind'
doublesize='$doublesize'
drand01='$drand01'
drand48_r_proto='$drand48_r_proto'
diff --git a/Cross/config.sh-arm-linux b/Cross/config.sh-arm-linux
index 1cd270be2a..9c565f8b88 100644
--- a/Cross/config.sh-arm-linux
+++ b/Cross/config.sh-arm-linux
@@ -570,6 +570,7 @@ db_version_patch=''
direntrytype='struct dirent'
dlext='so'
dlsrc='dl_dlopen.xs'
+doublekind='3'
doublesize='8'
drand01='Perl_drand48()'
drand48_r_proto='0'
diff --git a/NetWare/config.wc b/NetWare/config.wc
index 6e19e53e8c..171e71c36e 100644
--- a/NetWare/config.wc
+++ b/NetWare/config.wc
@@ -561,6 +561,7 @@ def_temp='sys:\perl\temp'
direntrytype='DIR'
dlext='nlm'
dlsrc='dl_netware.xs'
+doublekind='3'
doublesize='8'
drand01='Perl_drand48()'
drand48_r_proto='0'
diff --git a/Porting/Glossary b/Porting/Glossary
index e56c6e1dcb..1a9d7706b7 100644
--- a/Porting/Glossary
+++ b/Porting/Glossary
@@ -2639,6 +2639,16 @@ dlsrc (dlsrc.U):
This variable contains the name of the dynamic loading file that
will be used with the package.
+doublekind (doublekind.U):
+ This variable, if defined, encodes the type of a double:
+ 1 = IEEE 754 32-bit big little endian,
+ 2 = IEEE 754 32-bit big big endian,
+ 3 = IEEE 754 64-bit big little endian,
+ 4 = IEEE 754 64-bit big big endian,
+ 5 = IEEE 754 128-bit big little endian,
+ 6 = IEEE 754 128-bit big big endian,
+ -1 = unknown format.
+
doublesize (doublesize.U):
This variable contains the value of the DOUBLESIZE symbol, which
indicates to the C program how many bytes there are in a double.
diff --git a/Porting/config.sh b/Porting/config.sh
index 5323e3edec..4ecb289354 100644
--- a/Porting/config.sh
+++ b/Porting/config.sh
@@ -581,6 +581,7 @@ db_version_patch='30'
direntrytype='struct dirent'
dlext='so'
dlsrc='dl_dlopen.xs'
+doublekind='3'
doublesize='8'
drand01='Perl_drand48()'
drand48_r_proto='0'
diff --git a/config_h.SH b/config_h.SH
index b78c57fcdf..3e6e5d2857 100755
--- a/config_h.SH
+++ b/config_h.SH
@@ -2704,6 +2704,25 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
*/
#define DOUBLESIZE $doublesize /**/
+/* DOUBLEKIND:
+ * DOUBLEKIND will be one of
+ * DOUBLE_IS_IEEE_754_32_BIT_LITTLE_ENDIAN
+ * DOUBLE_IS_IEEE_754_32_BIT_BIG_ENDIAN
+ * DOUBLE_IS_IEEE_754_64_BIT_LITTLE_ENDIAN
+ * DOUBLE_IS_IEEE_754_64_BIT_BIG_ENDIAN
+ * DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN
+ * DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN
+ * DOUBLE_IS_UNKNOWN_FORMAT
+ */
+#define DOUBLEKIND $doublekind /**/
+#define DOUBLE_IS_IEEE_754_32_BIT_LITTLE_ENDIAN 1
+#define DOUBLE_IS_IEEE_754_32_BIT_BIG_ENDIAN 2
+#define DOUBLE_IS_IEEE_754_64_BIT_LITTLE_ENDIAN 3
+#define DOUBLE_IS_IEEE_754_64_BIT_BIG_ENDIAN 4
+#define DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN 5
+#define DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN 6
+#define DOUBLE_IS_UNKNOWN_FORMAT -1
+
/* EBCDIC:
* This symbol, if defined, indicates that this system uses
* EBCDIC encoding.
diff --git a/configure.com b/configure.com
index be93b10de4..b441816eee 100644
--- a/configure.com
+++ b/configure.com
@@ -6369,6 +6369,7 @@ $ WC "direntrytype='struct dirent'"
$ WC "dlext='" + dlext + "'"
$ WC "dlobj='" + dlobj + "'"
$ WC "dlsrc='dl_vms.xs'"
+$ WC "doublekind='3'"
$ WC "doublesize='" + doublesize + "'"
$ WC "drand01='" + drand01 + "'"
$ WC "dtrace='" + "'"
diff --git a/metaconfig.h b/metaconfig.h
index 8c32690f51..bf6ae7cc72 100644
--- a/metaconfig.h
+++ b/metaconfig.h
@@ -11,6 +11,7 @@
* in Configure, this is the way to force them into availability.
*
* BOOTSTRAP_CHARSET
+ * DOUBLEKIND
* HAS_ACOSH
* HAS_ASCTIME64
* HAS_CTIME64
diff --git a/myconfig.SH b/myconfig.SH
index 6233188acb..c5a9537617 100755
--- a/myconfig.SH
+++ b/myconfig.SH
@@ -44,7 +44,7 @@ Summary of my $package (revision $revision $version_patchlevel_string) configura
optimize='$optimize',
cppflags='$cppflags'
ccversion='$ccversion', gccversion='$gccversion', gccosandvers='$gccosandvers'
- intsize=$intsize, longsize=$longsize, ptrsize=$ptrsize, doublesize=$doublesize, byteorder=$byteorder
+ intsize=$intsize, longsize=$longsize, ptrsize=$ptrsize, doublesize=$doublesize, byteorder=$byteorder, doublekind=$doublekind
d_longlong=$d_longlong, longlongsize=$longlongsize, d_longdbl=$d_longdbl, longdblsize=$longdblsize, longdblkind=$longdblkind
ivtype='$ivtype', ivsize=$ivsize, nvtype='$nvtype', nvsize=$nvsize, Off_t='$lseektype', lseeksize=$lseeksize
alignbytes=$alignbytes, prototype=$prototype
diff --git a/plan9/config_sh.sample b/plan9/config_sh.sample
index 3583b5d6f6..fe933c261d 100644
--- a/plan9/config_sh.sample
+++ b/plan9/config_sh.sample
@@ -569,6 +569,7 @@ db_version_patch=''
direntrytype='struct dirent'
dlext='none'
dlsrc='dl_none.xs'
+doublekind='3'
doublesize='8'
drand01='(rand() / (double) ((unsigned long)1 << 15))'
drand48_r_proto='0'
diff --git a/symbian/config.sh b/symbian/config.sh
index 7496ae9f0c..cd9f454579 100644
--- a/symbian/config.sh
+++ b/symbian/config.sh
@@ -516,6 +516,7 @@ db_version_patch='0'
direntrytype='struct dirent'
dlext='dll'
dlsrc='dl_symbian.xs'
+doublekind='4'
doublesize='8'
drand01="((rand() & 0x7FFF) / (double) ((unsigned long)1 << 15))"
drand48_r_proto='0'
diff --git a/uconfig.h b/uconfig.h
index d2b10c927f..98fc7ea5ef 100644
--- a/uconfig.h
+++ b/uconfig.h
@@ -2669,6 +2669,25 @@
*/
#define DOUBLESIZE 8 /**/
+/* DOUBLEKIND:
+ * DOUBLEKIND will be one of
+ * DOUBLE_IS_IEEE_754_32_BIT_LITTLE_ENDIAN
+ * DOUBLE_IS_IEEE_754_32_BIT_BIG_ENDIAN
+ * DOUBLE_IS_IEEE_754_64_BIT_LITTLE_ENDIAN
+ * DOUBLE_IS_IEEE_754_64_BIT_BIG_ENDIAN
+ * DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN
+ * DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN
+ * DOUBLE_IS_UNKNOWN_FORMAT
+ */
+#define DOUBLEKIND 3 /**/
+#define DOUBLE_IS_IEEE_754_32_BIT_LITTLE_ENDIAN 1
+#define DOUBLE_IS_IEEE_754_32_BIT_BIG_ENDIAN 2
+#define DOUBLE_IS_IEEE_754_64_BIT_LITTLE_ENDIAN 3
+#define DOUBLE_IS_IEEE_754_64_BIT_BIG_ENDIAN 4
+#define DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN 5
+#define DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN 6
+#define DOUBLE_IS_UNKNOWN_FORMAT -1
+
/* EBCDIC:
* This symbol, if defined, indicates that this system uses
* EBCDIC encoding.
@@ -4873,6 +4892,6 @@
#endif
/* Generated from:
- * 60aff40735c73cdf11d3fbae8088eadf73c0b45413be5bd8480ec5ec481066da config_h.SH
- * 35023b2d9244ad2dc3abea4bb5174a7f66398b60266231cb9a2c3bfc8df867cf uconfig.sh
+ * 3d5c0424ad00f8e220ee942aac53a86c34751e4160f3c47b3771901f9ce87692 config_h.SH
+ * 141d5cd6c8f9074f7d171b61583becedadab81b8ef0b12a8fbda7eb14da72ed6 uconfig.sh
* ex: set ro: */
diff --git a/uconfig.sh b/uconfig.sh
index d4199cda74..b16ca206ba 100644
--- a/uconfig.sh
+++ b/uconfig.sh
@@ -505,6 +505,7 @@ db_version_major='0'
db_version_minor='0'
db_version_patch='0'
direntrytype='struct dirent'
+doublekind='3'
doublesize='8'
drand01="Perl_drand48()"
drand48_r_proto='0'
diff --git a/uconfig64.sh b/uconfig64.sh
index c575a4e064..8ae6326ac9 100644
--- a/uconfig64.sh
+++ b/uconfig64.sh
@@ -506,6 +506,7 @@ db_version_major='0'
db_version_minor='0'
db_version_patch='0'
direntrytype='struct dirent'
+doublekind='3'
doublesize='8'
drand01="((rand() & 0x7FFF) / (double) ((unsigned long)1 << 15))"
drand48_r_proto='0'
diff --git a/win32/config.ce b/win32/config.ce
index d63df392bc..8cae13b467 100644
--- a/win32/config.ce
+++ b/win32/config.ce
@@ -557,6 +557,7 @@ db_version_patch='0'
direntrytype='struct direct'
dlext='dll'
dlsrc='dl_win32.xs'
+doublekind='3'
doublesize='8'
drand01='Perl_drand48()'
drand48_r_proto='0'
diff --git a/win32/config.gc b/win32/config.gc
index 3451f1136f..b57a243b19 100644
--- a/win32/config.gc
+++ b/win32/config.gc
@@ -559,6 +559,7 @@ direntrytype='struct direct'
dlext='dll'
dlltool='~ARCHPREFIX~dlltool'
dlsrc='dl_win32.xs'
+doublekind='3'
doublesize='8'
drand01='Perl_drand48()'
drand48_r_proto='0'
diff --git a/win32/config.vc b/win32/config.vc
index 7819916fb5..4f8375c93f 100644
--- a/win32/config.vc
+++ b/win32/config.vc
@@ -558,6 +558,7 @@ db_version_patch='0'
direntrytype='struct direct'
dlext='dll'
dlsrc='dl_win32.xs'
+doublekind='3'
doublesize='8'
drand01='Perl_drand48()'
drand48_r_proto='0'