summaryrefslogtreecommitdiff
path: root/Build/source/libs/mpfr/m4
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-18 11:12:01 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-18 11:12:01 +0000
commit0c2f0333a4e539325da80cdf3fb182cd17134665 (patch)
treede5daa66b5595292a33c25110aa58ff8bff75543 /Build/source/libs/mpfr/m4
parentdb612d5045ef55da386a2c3350d4811d1da1a858 (diff)
Add libs/gmp and libs/mpfr in preparation for MetaPost 2.0
git-svn-id: svn://tug.org/texlive/trunk@34274 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/mpfr/m4')
-rw-r--r--Build/source/libs/mpfr/m4/mpfr-check-printf-spec.m472
-rw-r--r--Build/source/libs/mpfr/m4/mpfr-configs.m4270
-rw-r--r--Build/source/libs/mpfr/m4/mpfr-long-double-format.m4355
3 files changed, 697 insertions, 0 deletions
diff --git a/Build/source/libs/mpfr/m4/mpfr-check-printf-spec.m4 b/Build/source/libs/mpfr/m4/mpfr-check-printf-spec.m4
new file mode 100644
index 00000000000..ab76ffbeeee
--- /dev/null
+++ b/Build/source/libs/mpfr/m4/mpfr-check-printf-spec.m4
@@ -0,0 +1,72 @@
+# Autoconf macros for the GNU MPFR Library.
+# Copyright (C) 2000-2013 Free Software Foundation, Inc.
+# Contributed by the AriC and Caramel projects, INRIA.
+#
+# Copyright (C) 2014 Peter Breitenlohner <tex-live@tug.org>
+# Extracted from mpfr-3.1.2/acinclude.m4 and adapted for TeX Live.
+#
+# This file is free software; the copyright holders
+# give unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# MPFR_CHECK_PRINTF_SPEC
+# ----------------------
+# Check if gmp_printf supports some optional length modifiers.
+# Defined symbols are negative to shorten the gcc command line.
+AC_DEFUN([MPFR_CHECK_PRINTF_SPEC], [
+AC_REQUIRE([MPFR_CONFIGS])dnl
+if test "x$ac_cv_type_intmax_t" = xyes; then
+ MPFR_FUNC_GMP_PRINTF_SPEC([jd], [intmax_t], [
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+ ], ,
+ [AC_DEFINE([NPRINTF_J], 1, [gmp_printf cannot read intmax_t])])
+fi
+
+MPFR_FUNC_GMP_PRINTF_SPEC([hhd], [char], , ,
+ [AC_DEFINE([NPRINTF_HH], 1, [gmp_printf cannot use `hh' length modifier])])
+
+MPFR_FUNC_GMP_PRINTF_SPEC([lld], [long long int], , ,
+ [AC_DEFINE([NPRINTF_LL], 1, [gmp_printf cannot read long long int])])
+
+MPFR_FUNC_GMP_PRINTF_SPEC([Lf], [long double], , ,
+ [AC_DEFINE([NPRINTF_L], 1, [gmp_printf cannot read long double])])
+
+MPFR_FUNC_GMP_PRINTF_SPEC([td], [ptrdiff_t], [
+#if defined (__cplusplus)
+#include <cstddef>
+#else
+#include <stddef.h>
+#endif
+ ], ,
+ [AC_DEFINE([NPRINTF_T], 1, [gmp_printf cannot read ptrdiff_t])])
+]) # MPFR_CHECK_PRINTF_SPEC
+
+
+# MPFR_FUNC_GMP_PRINTF_SPEC(SPEC, TYPE, [INCLUDES], [IF-TRUE], [IF-FALSE])
+# ------------------------------------------------------------------------
+# Check if gmp_sprintf supports the conversion specification 'spec'
+# with type 'type'.
+# Expand 'if-true' if printf supports 'spec', 'if-false' otherwise.
+m4_define([MPFR_FUNC_GMP_PRINTF_SPEC], [
+AC_MSG_CHECKING([if gmp_printf supports "%$1"])
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <stdio.h>
+$3
+#include <gmp.h>
+]], [[
+ char s[256];
+ $2 a = 17;
+
+ if (gmp_sprintf (s, "(%0.0$1)(%d)", a, 42) == -1) return 1;
+ return (strcmp (s, "(17)(42)") != 0);
+]])],
+ [AC_MSG_RESULT([yes])
+ $4],
+ [AC_MSG_RESULT([no])
+ $5])
+]) # MPFR_FUNC_GMP_PRINTF_SPEC
diff --git a/Build/source/libs/mpfr/m4/mpfr-configs.m4 b/Build/source/libs/mpfr/m4/mpfr-configs.m4
new file mode 100644
index 00000000000..680cf953c4f
--- /dev/null
+++ b/Build/source/libs/mpfr/m4/mpfr-configs.m4
@@ -0,0 +1,270 @@
+# Autoconf macros for the GNU MPFR Library.
+# Copyright (C) 2000-2013 Free Software Foundation, Inc.
+# Contributed by the AriC and Caramel projects, INRIA.
+#
+# Copyright (C) 2014 Peter Breitenlohner <tex-live@tug.org>
+# Extracted from mpfr-3.1.2/acinclude.m4 and adapted for TeX Live.
+#
+# This file is free software; the copyright holders
+# give unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+dnl ------------------------------------------------------------
+dnl You must put in MPFR_CONFIGS everything which configure MPFR
+dnl except:
+dnl -everything dealing with CC and CFLAGS in particular the ABI
+dnl but the IEEE-754 specific flags must be set here.
+dnl -GMP's linkage.
+dnl -Libtool stuff.
+dnl -Handling of special arguments of MPFR's configure.
+AC_DEFUN([MPFR_CONFIGS], [dnl
+AC_REQUIRE([AC_HEADER_TIME])
+AC_REQUIRE([AC_CANONICAL_HOST])
+
+dnl Check for wide characters (wchar_t and wint_t)
+AC_CHECK_HEADERS([wchar.h])
+
+dnl We have stdarg.h
+AC_DEFINE([HAVE_STDARG], 1, [Define if stdarg])
+
+AC_CHECK_HEADERS([sys/time.h])
+
+dnl Check how to get `alloca'
+AC_FUNC_ALLOCA
+
+KPSE_CHECK_SIZE_MAX
+
+dnl va_copy macro
+AC_MSG_CHECKING([how to copy va_list])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <stdarg.h>
+]], [[
+ va_list ap1, ap2;
+ va_copy(ap1, ap2);
+]])], [
+ AC_MSG_RESULT([va_copy])
+ AC_DEFINE([HAVE_VA_COPY], 1, [Define to 1 if you have the `va_copy' function.])
+], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <stdarg.h>
+]], [[
+ va_list ap1, ap2;
+ __va_copy(ap1, ap2);
+]])], [AC_DEFINE([HAVE___VA_COPY], 1, [Define to 1 if you have the `__va_copy' function.])
+ AC_MSG_RESULT([__va_copy])],
+ [AC_MSG_RESULT([memcpy])])])
+
+dnl FIXME: The functions memmove, memset and strtol are really needed by
+dnl MPFR, but if they are implemented as macros, this is also OK (in our
+dnl case). So, we do not return an error, but their tests are currently
+dnl useless.
+AC_CHECK_FUNCS([memmove memset strtol])
+
+dnl Check for IEEE-754 switches on Alpha
+AS_CASE([$host],
+ [alpha*-*-*], [
+ AC_CACHE_CHECK([for IEEE-754 switches], [mpfr_cv_ieee_switches], [
+ saved_CFLAGS=$CFLAGS
+ if test -n "$GCC"; then
+ mpfr_cv_ieee_switches="-mfp-rounding-mode=d -mieee-with-inexact"
+ else
+ mpfr_cv_ieee_switches="-fprm d -ieee_with_inexact"
+ fi
+ CFLAGS="$CFLAGS $mpfr_cv_ieee_switches"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+ [], [mpfr_cv_ieee_switches=none])
+ CFLAGS=$saved_CFLAGS
+ ])
+ test "x$mpfr_cv_ieee_switches" = xnone || CFLAGS="$CFLAGS $mpfr_cv_ieee_switches"
+])
+
+dnl check for long long
+AC_CHECK_TYPE([long long int],
+ [AC_DEFINE([HAVE_LONG_LONG], 1, [Define if compiler supports long long])])
+
+dnl intmax_t is C99
+AC_CHECK_TYPES([intmax_t])
+if test "x$ac_cv_type_intmax_t" = xyes; then
+ AC_CACHE_CHECK([for working INTMAX_MAX], [mpfr_cv_have_intmax_max], [
+ saved_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS -I$srcdir/mpfr-]mpfr_version[/src"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "mpfr-intmax.h"]],
+ [[intmax_t x = INTMAX_MAX;]])],
+ [mpfr_cv_have_intmax_max=yes], [mpfr_cv_have_intmax_max=no])
+ CPPFLAGS=$saved_CPPFLAGS
+ ])
+ if test "x$mpfr_cv_have_intmax_max" = xyes; then
+ AC_DEFINE([MPFR_HAVE_INTMAX_MAX], 1, [Define if you have a working INTMAX_MAX.])
+ fi
+fi
+
+KPSE_SEARCH_LIBS([MPFR_LIBM], [pow], [m])
+
+dnl Check for fesetround
+AC_CACHE_CHECK([for fesetround], [mpfr_cv_have_fesetround], [
+saved_LIBS=$LIBS
+LIBS="$LIBS $MPFR_LIBM"
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <fenv.h>]], [[fesetround(FE_TONEAREST);]])],
+ [mpfr_cv_have_fesetround=yes], [mpfr_cv_have_fesetround=no])
+LIBS=$saved_LIBS
+])
+if test "x$mpfr_cv_have_fesetround" = xyes; then
+ AC_DEFINE([MPFR_HAVE_FESETROUND], 1,
+ [Define if you have the `fesetround' function via the <fenv.h> header file.])
+fi
+
+dnl Check for gcc float-conversion bug; if need be, -ffloat-store is used to
+dnl force the conversion to the destination type when a value is stored to
+dnl a variable (see ISO C99 standard 5.1.2.3#13, 6.3.1.5#2, 6.3.1.8#2). This
+dnl is important concerning the exponent range. Note that this doesn't solve
+dnl the double-rounding problem.
+if test -n "$GCC"; then
+ AC_CACHE_CHECK([for gcc float-conversion bug], [mpfr_cv_gcc_floatconv_bug], [
+ saved_LIBS=$LIBS
+ LIBS="$LIBS $MPFR_LIBM"
+ AC_TRY_RUN([
+#include <float.h>
+#ifdef MPFR_HAVE_FESETROUND
+#include <fenv.h>
+#endif
+static double get_max (void);
+int main() {
+ double x = 0.5;
+ double y;
+ int i;
+ for (i = 1; i <= 11; i++)
+ x *= x;
+ if (x != 0)
+ return 1;
+#ifdef MPFR_HAVE_FESETROUND
+ /* Useful test for the G4 PowerPC */
+ fesetround(FE_TOWARDZERO);
+ x = y = get_max ();
+ x *= 2.0;
+ if (x != y)
+ return 1;
+#endif
+ return 0;
+}
+static double get_max (void) { static volatile double d = DBL_MAX; return d; }
+ ], [mpfr_cv_gcc_floatconv_bug="no"],
+ [mpfr_cv_gcc_floatconv_bug="yes, use -ffloat-store"],
+ [mpfr_cv_gcc_floatconv_bug="cannot test, use -ffloat-store"])
+ LIBS=$saved_LIBS
+ ])
+ test "x$mpfr_cv_gcc_floatconv_bug" = xno || CFLAGS="$CFLAGS -ffloat-store"
+fi
+
+dnl Check if denormalized numbers are supported
+AC_CACHE_CHECK([for denormalized numbers], [mpfr_cv_have_denorms], [
+AC_TRY_RUN([
+#include <math.h>
+#include <stdio.h>
+int main() {
+ double x = 2.22507385850720138309e-308;
+ fprintf (stderr, "%e\n", x / 2.0);
+ return 2.0 * (x / 2.0) != x;
+}
+], [mpfr_cv_have_denorms=yes], [mpfr_cv_have_denorms=no], [mpfr_cv_have_denorms=no])
+])
+if test "x$mpfr_cv_have_denorms" = xyes; then
+ AC_DEFINE([HAVE_DENORMS], 1, [Define if denormalized floats work.])
+fi
+
+dnl Check the FP division by 0 fails (e.g. on a non-IEEE-754 platform).
+dnl In such a case, MPFR_ERRDIVZERO is defined to disable the tests
+dnl involving a FP division by 0.
+dnl For the developers: to check whether all these tests are disabled,
+dnl configure MPFR with "-DMPFR_TEST_DIVBYZERO=1 -DMPFR_ERRDIVZERO=1".
+AC_CACHE_CHECK([if the FP division by 0 fails], [mpfr_cv_errdivzero], [
+AC_TRY_RUN([
+int main() {
+ volatile double d = 0.0, x;
+ x = 0.0 / d;
+ x = 1.0 / d;
+ return 0;
+}
+], [mpfr_cv_errdivzero="no"],
+ [mpfr_cv_errdivzero="yes"],
+ [mpfr_cv_errdivzero="cannot test, assume no"])
+])
+if test "x$mpfr_cv_errdivzero" = xyes; then
+ AC_DEFINE([MPFR_ERRDIVZERO], 1, [Define if the FP division by 0 fails.])
+ AC_MSG_WARN([The floating-point division by 0 fails instead of])
+ AC_MSG_WARN([returning a special value: NaN or infinity. Tests])
+ AC_MSG_WARN([involving a FP division by 0 will be disabled.])
+fi
+
+dnl Check whether NAN != NAN (as required by the IEEE-754 standard,
+dnl but not by the ISO C standard). For instance, this is false with
+dnl MIPSpro 7.3.1.3m under IRIX64. By default, assume this is true.
+AC_CACHE_CHECK([if NAN == NAN], [mpfr_cv_nanisnan], [
+AC_TRY_RUN([
+#include <stdio.h>
+#include <math.h>
+#ifndef NAN
+# define NAN (0.0/0.0)
+#endif
+int main() {
+ double d;
+ d = NAN;
+ return d != d;
+}
+], [mpfr_cv_nanisnan="yes"],
+ [mpfr_cv_nanisnan="no"],
+ [mpfr_cv_nanisnan="cannot test, assume no"])
+])
+if test "x$mpfr_cv_nanisnan" = xyes; then
+ AC_DEFINE([MPFR_NANISNAN], 1, [Define if NAN == NAN.])
+ AC_MSG_WARN([The test NAN != NAN is false. The probable reason is that])
+ AC_MSG_WARN([your compiler optimizes floating-point expressions in an])
+ AC_MSG_WARN([unsafe way because some option, such as -ffast-math or])
+ AC_MSG_WARN([-fast (depending on the compiler), has been used. You])
+ AC_MSG_WARN([should NOT use such an option, otherwise MPFR functions])
+ AC_MSG_WARN([such as mpfr_get_d and mpfr_set_d may return incorrect])
+ AC_MSG_WARN([results on special FP numbers (e.g. NaN or signed zeros).])
+ AC_MSG_WARN([If you did not use such an option, please send us a bug])
+ AC_MSG_WARN([report so that we can try to find a workaround for your])
+ AC_MSG_WARN([platform and/or document the behavior.])
+fi
+
+dnl Check if the chars '0' to '9' are consecutive values
+AC_MSG_CHECKING([if charset has consecutive values])
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+char *number = "0123456789";
+char *lower = "abcdefghijklmnopqrstuvwxyz";
+char *upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+]],[[
+ int i;
+ unsigned char *p;
+ for (p = (unsigned char*) number, i = 0; i < 9; i++)
+ if ( (*p)+1 != *(p+1) ) return 1;
+ for (p = (unsigned char*) lower, i = 0; i < 25; i++)
+ if ( (*p)+1 != *(p+1) ) return 1;
+ for (p = (unsigned char*) upper, i = 0; i < 25; i++)
+ if ( (*p)+1 != *(p+1) ) return 1;
+]])], [AC_MSG_RESULT([yes])],[
+ AC_MSG_RESULT([no])
+ AC_DEFINE([MPFR_NO_CONSECUTIVE_CHARSET], 1, [Charset is not consecutive])
+], [AC_MSG_RESULT([cannot test])])
+
+dnl Now try to check the long double format
+MPFR_C_LONG_DOUBLE_FORMAT
+
+])
+dnl end of MPFR_CONFIGS
+
+
+dnl MPFR_LD_SEARCH_PATHS_FIRST
+dnl --------------------------
+
+AC_DEFUN([MPFR_LD_SEARCH_PATHS_FIRST],
+[AS_CASE([$LDFLAGS],
+ [*-Wl,-search_paths_first*], [],
+ [AC_MSG_CHECKING([if the compiler understands -Wl,-search_paths_first])
+ saved_LDFLAGS=$LDFLAGS
+ LDFLAGS="-Wl,-search_paths_first $LDFLAGS"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ LDFLAGS=$saved_LDFLAGS])])
+])
diff --git a/Build/source/libs/mpfr/m4/mpfr-long-double-format.m4 b/Build/source/libs/mpfr/m4/mpfr-long-double-format.m4
new file mode 100644
index 00000000000..67c271a45aa
--- /dev/null
+++ b/Build/source/libs/mpfr/m4/mpfr-long-double-format.m4
@@ -0,0 +1,355 @@
+# Autoconf macros for the GNU MPFR Library.
+# Copyright (C) 2000-2013 Free Software Foundation, Inc.
+# Contributed by the AriC and Caramel projects, INRIA.
+#
+# Copyright (C) 2014 Peter Breitenlohner <tex-live@tug.org>
+# Extracted from mpfr-3.1.2/acinclude.m4 and adapted for TeX Live.
+#
+# This file is free software; the copyright holders
+# give unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# MPFR_C_LONG_DOUBLE_FORMAT
+# -------------------------
+# Determine the format of a long double.
+#
+# The object file is grepped, so as to work when cross compiling. A
+# start and end sequence is included to avoid false matches, and
+# allowance is made for the desired data crossing an "od -b" line
+# boundary. The test number is a small integer so it should appear
+# exactly, no rounding or truncation etc.
+#
+# "od -b" is supported even by Unix V7, and the awk script used doesn't
+# have functions or anything, so even an "old" awk should suffice.
+#
+# The 10-byte IEEE extended format is generally padded to either 12 or 16
+# bytes for alignment purposes. The SVR4 i386 ABI is 12 bytes, or i386
+# gcc -m128bit-long-double selects 16 bytes. IA-64 is 16 bytes in LP64
+# mode, or 12 bytes in ILP32 mode. The first 10 bytes is the relevant
+# part in all cases (big and little endian).
+#
+# Enhancements:
+#
+# Could match more formats, but no need to worry until there's code
+# wanting to use them.
+#
+# Don't want to duplicate the double matching from GMP_C_DOUBLE_FORMAT,
+# perhaps we should merge with that macro, to match data formats
+# irrespective of the C type in question. Or perhaps just let the code
+# use DOUBLE macros when sizeof(double)==sizeof(long double).
+
+AC_DEFUN([MPFR_C_LONG_DOUBLE_FORMAT], [dnl
+AC_REQUIRE([AC_PROG_CC])
+AC_REQUIRE([AC_PROG_AWK])
+AC_CACHE_CHECK([format of `long double' floating point],
+ [mpfr_cv_c_long_double_format],
+[mpfr_cv_c_long_double_format=unknown
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+/* "before" is 16 bytes to ensure there's no padding between it and "x".
+ We're not expecting any "long double" bigger than 16 bytes or with
+ alignment requirements stricter than 16 bytes. */
+struct {
+ char before[16];
+ long double x;
+ char after[8];
+} foo = {
+ { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
+ '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' },
+ -123456789.0,
+ { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' }
+};
+]])],
+ [cat >conftest.awk <<\EOF
+_mpfr_long_double_awk
+EOF
+ mpfr_cv_c_long_double_format=`od -b conftest.$ac_objext | $AWK -f conftest.awk`
+ AS_CASE([$mpfr_cv_c_long_double_format],
+ [unknown*],
+ [echo "cannot match anything, conftest.$ac_objext contains" >&AS_MESSAGE_LOG_FD
+ od -b conftest.$ac_objext >&AS_MESSAGE_LOG_FD])],
+ [AC_MSG_WARN([oops, cannot compile test program])])
+rm -f conftest.awk])
+
+AH_VERBATIM([HAVE_LDOUBLE],
+[/* Define one of the following to 1 for the format of a `long double'.
+ If your format is not among these choices, or you don't know what it is,
+ then leave all undefined.
+ IEEE_EXT is the 10-byte IEEE extended precision format.
+ IEEE_QUAD is the 16-byte IEEE quadruple precision format.
+ LITTLE or BIG is the endianness. */
+#undef HAVE_LDOUBLE_IEEE_EXT_LITTLE
+#undef HAVE_LDOUBLE_IEEE_QUAD_LITTLE
+#undef HAVE_LDOUBLE_IEEE_QUAD_BIG])
+
+AS_CASE([$mpfr_cv_c_long_double_format],
+ ["IEEE extended, little endian"],
+ [AC_DEFINE([HAVE_LDOUBLE_IEEE_EXT_LITTLE], 1)],
+ ["IEEE quad, big endian"],
+ [AC_DEFINE([HAVE_LDOUBLE_IEEE_QUAD_BIG], 1)],
+ ["IEEE quad, little endian"],
+ [AC_DEFINE([HAVE_LDOUBLE_IEEE_QUAD_LITTLE], 1)],
+ ["possibly double-double, big endian"],
+ [# Since we are not sure, we do not want to define a macro.
+ AC_MSG_WARN([This format is known on GCC/PowerPC platforms,])
+ AC_MSG_WARN([but due to GCC PR26374, we can't test further.])
+ AC_MSG_WARN([You can safely ignore this warning, though.])],
+ [unknown* | "not available"], [],
+ [AC_MSG_WARN([oops, unrecognised float format: $mpfr_cv_c_long_double_format])])
+]) # MPFR_C_LONG_DOUBLE_FORMAT
+
+# _mpfr_long_double_awk
+# ---------------------
+# Internal subroutine defining contents of conftest.awk.
+m4_define([_mpfr_long_double_awk], [[
+BEGIN {
+ found = 0
+}
+
+# got[] holds a sliding window of bytes read the input. got[0] is the most
+# recent byte read, and got[31] the oldest byte read, so when looking to
+# match some data the indices are "reversed".
+#
+{
+ for (f = 2; f <= NF; f++)
+ {
+ # new byte, shift others up
+ for (i = 31; i >= 0; i--)
+ got[i+1] = got[i];
+ got[0] = $f;
+
+ # end sequence
+ if (got[7] != "376") continue
+ if (got[6] != "334") continue
+ if (got[5] != "272") continue
+ if (got[4] != "230") continue
+ if (got[3] != "166") continue
+ if (got[2] != "124") continue
+ if (got[1] != "062") continue
+ if (got[0] != "020") continue
+
+ # start sequence, with 8-byte body
+ if (got[23] == "001" && \
+ got[22] == "043" && \
+ got[21] == "105" && \
+ got[20] == "147" && \
+ got[19] == "211" && \
+ got[18] == "253" && \
+ got[17] == "315" && \
+ got[16] == "357")
+ {
+ saw = " (" got[15] \
+ " " got[14] \
+ " " got[13] \
+ " " got[12] \
+ " " got[11] \
+ " " got[10] \
+ " " got[9] \
+ " " got[8] ")"
+
+ if (got[15] == "301" && \
+ got[14] == "235" && \
+ got[13] == "157" && \
+ got[12] == "064" && \
+ got[11] == "124" && \
+ got[10] == "000" && \
+ got[9] == "000" && \
+ got[8] == "000")
+ {
+ print "IEEE double, big endian"
+ found = 1
+ exit
+ }
+
+ if (got[15] == "000" && \
+ got[14] == "000" && \
+ got[13] == "000" && \
+ got[12] == "124" && \
+ got[11] == "064" && \
+ got[10] == "157" && \
+ got[9] == "235" && \
+ got[8] == "301")
+ {
+ print "IEEE double, little endian"
+ found = 1
+ exit
+ }
+ }
+
+ # start sequence, with 12-byte body
+ if (got[27] == "001" && \
+ got[26] == "043" && \
+ got[25] == "105" && \
+ got[24] == "147" && \
+ got[23] == "211" && \
+ got[22] == "253" && \
+ got[21] == "315" && \
+ got[20] == "357")
+ {
+ saw = " (" got[19] \
+ " " got[18] \
+ " " got[17] \
+ " " got[16] \
+ " " got[15] \
+ " " got[14] \
+ " " got[13] \
+ " " got[12] \
+ " " got[11] \
+ " " got[10] \
+ " " got[9] \
+ " " got[8] ")"
+
+ if (got[19] == "000" && \
+ got[18] == "000" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "240" && \
+ got[14] == "242" && \
+ got[13] == "171" && \
+ got[12] == "353" && \
+ got[11] == "031" && \
+ got[10] == "300")
+ {
+ print "IEEE extended, little endian"
+ found = 1
+ exit
+ }
+
+ if (got[19] == "300" && \
+ got[18] == "031" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "353" && \
+ got[14] == "171" && \
+ got[13] == "242" && \
+ got[12] == "240" && \
+ got[11] == "000" && \
+ got[10] == "000" && \
+ got[09] == "000" && \
+ got[08] == "000")
+ {
+ # format found on m68k
+ print "IEEE extended, big endian"
+ found = 1
+ exit
+ }
+ }
+
+ # start sequence, with 16-byte body
+ if (got[31] == "001" && \
+ got[30] == "043" && \
+ got[29] == "105" && \
+ got[28] == "147" && \
+ got[27] == "211" && \
+ got[26] == "253" && \
+ got[25] == "315" && \
+ got[24] == "357")
+ {
+ saw = " (" got[23] \
+ " " got[22] \
+ " " got[21] \
+ " " got[20] \
+ " " got[19] \
+ " " got[18] \
+ " " got[17] \
+ " " got[16] \
+ " " got[15] \
+ " " got[14] \
+ " " got[13] \
+ " " got[12] \
+ " " got[11] \
+ " " got[10] \
+ " " got[9] \
+ " " got[8] ")"
+
+ if (got[23] == "000" && \
+ got[22] == "000" && \
+ got[21] == "000" && \
+ got[20] == "000" && \
+ got[19] == "240" && \
+ got[18] == "242" && \
+ got[17] == "171" && \
+ got[16] == "353" && \
+ got[15] == "031" && \
+ got[14] == "300")
+ {
+ print "IEEE extended, little endian"
+ found = 1
+ exit
+ }
+
+ if (got[23] == "300" && \
+ got[22] == "031" && \
+ got[21] == "326" && \
+ got[20] == "363" && \
+ got[19] == "105" && \
+ got[18] == "100" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "000" && \
+ got[14] == "000" && \
+ got[13] == "000" && \
+ got[12] == "000" && \
+ got[11] == "000" && \
+ got[10] == "000" && \
+ got[9] == "000" && \
+ got[8] == "000")
+ {
+ # format used on HP 9000/785 under HP-UX
+ print "IEEE quad, big endian"
+ found = 1
+ exit
+ }
+
+ if (got[23] == "000" && \
+ got[22] == "000" && \
+ got[21] == "000" && \
+ got[20] == "000" && \
+ got[19] == "000" && \
+ got[18] == "000" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "000" && \
+ got[14] == "000" && \
+ got[13] == "100" && \
+ got[12] == "105" && \
+ got[11] == "363" && \
+ got[10] == "326" && \
+ got[9] == "031" && \
+ got[8] == "300")
+ {
+ print "IEEE quad, little endian"
+ found = 1
+ exit
+ }
+
+ if (got[23] == "301" && \
+ got[22] == "235" && \
+ got[21] == "157" && \
+ got[20] == "064" && \
+ got[19] == "124" && \
+ got[18] == "000" && \
+ got[17] == "000" && \
+ got[16] == "000" && \
+ got[15] == "000" && \
+ got[14] == "000" && \
+ got[13] == "000" && \
+ got[12] == "000" && \
+ got[11] == "000" && \
+ got[10] == "000" && \
+ got[9] == "000" && \
+ got[8] == "000")
+ {
+ # format used on 32-bit PowerPC (Mac OS X and Debian GNU/Linux)
+ print "possibly double-double, big endian"
+ found = 1
+ exit
+ }
+ }
+ }
+}
+
+END {
+ if (! found)
+ print "unknown", saw
+}
+]])