guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-12-5-gf32


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-12-5-gf328f86
Date: Tue, 07 Sep 2010 22:44:11 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=f328f862302c40771b6bc7d9febd43232771a083

The branch, master has been updated
       via  f328f862302c40771b6bc7d9febd43232771a083 (commit)
       via  2e65b52f8a2e5f82ddc8da471d989f14468f8b90 (commit)
       via  18f2d5aa4dfe66469d4b109e5b56b931a057a3e0 (commit)
       via  2ee073587a28161dfb6b95f250be2d8a5df26cae (commit)
      from  7884975a890a461fb62178eeb3dfbb8b30b28ba2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f328f862302c40771b6bc7d9febd43232771a083
Author: Ludovic Courtès <address@hidden>
Date:   Wed Sep 8 00:38:49 2010 +0200

    Clarify feature macro conditionals.
    
    * libguile/numbers.c (scm_log10): Check whether `HAVE_COMPLEX_DOUBLE'
      and `HAVE_CLOG10' are defined instead of checking whether they are
      non-zero.
      (scm_sqrt): Likewise for `HAVE_COMPLEX_DOUBLE' and
      `HAVE_USABLE_CSQRT'.

commit 2e65b52f8a2e5f82ddc8da471d989f14468f8b90
Author: Ludovic Courtès <address@hidden>
Date:   Wed Sep 8 00:34:27 2010 +0200

    Use Gnulib's `isnan' and `isinf' modules.
    
    This updates Gnulib to v0.0-4219-g84cdd8b.
    
    * m4/gnulib-cache.m4: Add `isinf' and `isnan'.
    
    * configure.ac: Remove checks for `floatingpoint.h', `ieeefp.h', and
      `nan.h'.
    
    * libguile/gen-scmconfig.c (main): Remove definitions of
      `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', and
      `SCM_HAVE_NAN_H'.
    
    * libguile/numbers.c (isnan)[SCO && !HAVE_ISNAN]: Remove.
      (isinf)[SCO && !HAVE_ISINF]: Remove.
      (xisinf, xisnan): Remove.  Change callers to use `isinf' and `isnan'.
      (guile_ieee_init): Remove the `defined HAVE_ISINF' and `define
      HAVE_ISNAN' conditions.
    
    * libguile/numbers.h: Remove code conditional on
      `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', or `SCM_HAVE_NAN_H'.

commit 18f2d5aa4dfe66469d4b109e5b56b931a057a3e0
Author: Ludovic Courtès <address@hidden>
Date:   Mon Sep 6 22:49:24 2010 +0200

    Use `have-lib' when checking for libltdl.
    
    Suggested by primus <address@hidden>.
    
    * configure.ac: Use `AC_LIB_HAVE_LINKFLAGS' when checking for libltdl.
    
    * libguile/Makefile.am (address@hidden@_la_LIBADD):
      Add $(LTLIBLTDL).
    
    * README: Update to make it clear that libgc and libffi don't have a
      `--with-XXX-prefix' option.

commit 2ee073587a28161dfb6b95f250be2d8a5df26cae
Author: Ludovic Courtès <address@hidden>
Date:   Mon Sep 6 22:24:44 2010 +0200

    Rename `make-foreign-function' to `pointer->procedure'.
    
    * libguile/foreign.c (scm_make_foreign_function): Rename to...
      (scm_pointer_to_procedure): ... this.
    * libguile/foreign.h: Adjust accordingly.
    * module/system/foreign.scm: Likewise.
    * test-suite/standalone/test-ffi: Likewise.
    * test-suite/tests/foreign.test: Likewise.
    * doc/ref/api-foreign.texi: Likewise.

-----------------------------------------------------------------------

Summary of changes:
 README                         |   12 +-
 configure.ac                   |   13 +-
 doc/ref/api-foreign.texi       |   28 +-
 lib/Makefile.am                |  144 ++++++++-
 lib/{asnprintf.c => isinf.c}   |   28 +-
 lib/isnan.c                    |  173 +++++++++
 lib/{safe-write.c => isnand.c} |    9 +-
 lib/{full-read.c => isnanf.c}  |   10 +-
 lib/{full-read.c => isnanl.c}  |   10 +-
 lib/math.in.h                  |  750 ++++++++++++++++++++++++++++++++++++++++
 libguile/Makefile.am           |    6 +-
 libguile/foreign.c             |    6 +-
 libguile/foreign.h             |    4 +-
 libguile/gen-scmconfig.c       |   18 -
 libguile/numbers.c             |  124 ++-----
 libguile/numbers.h             |   18 -
 m4/check-math-lib.m4           |   31 ++
 m4/exponentd.m4                |  115 ++++++
 m4/exponentf.m4                |   92 +++++
 m4/exponentl.m4                |   98 ++++++
 m4/gnulib-cache.m4             |    8 +-
 m4/gnulib-comp.m4              |   42 +++-
 m4/isinf.m4                    |   48 +++
 m4/isnan.m4                    |   47 +++
 m4/isnand.m4                   |   99 ++++++
 m4/isnanf.m4                   |  186 ++++++++++
 m4/isnanl.m4                   |  252 ++++++++++++++
 m4/math_h.m4                   |  140 ++++++++
 maint.mk                       |    2 +-
 module/system/foreign.scm      |    2 +-
 test-suite/standalone/test-ffi |   82 +++---
 test-suite/tests/foreign.test  |   13 +-
 32 files changed, 2374 insertions(+), 236 deletions(-)
 copy lib/{asnprintf.c => isinf.c} (65%)
 create mode 100644 lib/isnan.c
 copy lib/{safe-write.c => isnand.c} (78%)
 copy lib/{full-read.c => isnanf.c} (76%)
 copy lib/{full-read.c => isnanl.c} (76%)
 create mode 100644 lib/math.in.h
 create mode 100644 m4/check-math-lib.m4
 create mode 100644 m4/exponentd.m4
 create mode 100644 m4/exponentf.m4
 create mode 100644 m4/exponentl.m4
 create mode 100644 m4/isinf.m4
 create mode 100644 m4/isnan.m4
 create mode 100644 m4/isnand.m4
 create mode 100644 m4/isnanf.m4
 create mode 100644 m4/isnanl.m4
 create mode 100644 m4/math_h.m4

diff --git a/README b/README
index bc9f5df..256e954 100644
--- a/README
+++ b/README
@@ -35,11 +35,13 @@ Guile depends on the following external libraries.
 - libunistring
 - libgc
 - libffi
-It will also use the libreadline library if it is available.  For each
-of these there is a corresponding --with-XXX-prefix option that you
-can use when invoking ./configure, if you have these libraries
-installed in a location other than the standard places (/usr and
-/usr/local).
+It will also use the libreadline library if it is available.
+
+There is a corresponding `--with-XXX-prefix' option for each of these
+libraries (except for libgc and libffi which use `pkg-config', see
+below) that you can use when invoking ./configure, if you have these
+libraries installed in a location other than the standard places (/usr
+and /usr/local).
 
 These options are provided by the Gnulib `havelib' module, and details
 of how they work are documented in `Searching for Libraries' in the
diff --git a/configure.ac b/configure.ac
index 18691c2..915f01e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,10 +74,13 @@ AM_PROG_CC_C_O
 
 AC_LIBTOOL_DLOPEN
 AC_PROG_LIBTOOL
-AC_CHECK_LIB([ltdl], [lt_dlinit], ,
-  [AC_MSG_ERROR([libltdl not found.  See README.])])
-AC_CHECK_HEADER([ltdl.h], [],
-  [AC_MSG_ERROR([<ltdl.h> not found.  See README.])])
+
+dnl Check for libltdl.
+AC_LIB_HAVE_LINKFLAGS([ltdl], [], [#include <ltdl.h>],
+  [lt_dlopenext ("foo");])
+if text "x$HAVE_LIBLTDL" != "xyes"; then
+  AC_MSG_ERROR([GNU libltdl (Libtool) not found, see README.])
+fi
 
 AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no)
 AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes)
@@ -1112,8 +1115,6 @@ fi
 
 AC_REPLACE_FUNCS([strerror memmove mkstemp])
 
-AC_CHECK_HEADERS(floatingpoint.h ieeefp.h nan.h)
-
 # Reasons for testing:
 #   asinh, acosh, atanh, trunc - C99 standard, generally not available on
 #                                older systems
diff --git a/doc/ref/api-foreign.texi b/doc/ref/api-foreign.texi
index 88408ad..4f38711 100644
--- a/doc/ref/api-foreign.texi
+++ b/doc/ref/api-foreign.texi
@@ -493,7 +493,7 @@ numeric types. For example, @code{long} may be 
@code{equal?} to
 
 @defvr {Scheme Variable} void
 The @code{void} type.  It can be used as the first argument to
address@hidden to wrap a C function that returns nothing.
address@hidden>procedure} to wrap a C function that returns nothing.
 @end defvr
 
 @node Foreign Variables
@@ -703,8 +703,8 @@ tightly packed structs and unions by hand. See the code for
 Of course, the land of C is not all nouns and no verbs: there are
 functions too, and Guile allows you to call them.
 
address@hidden {Scheme Procedure} make-foreign-function return_type func_ptr 
arg_types
address@hidden {C Procedure} scm_make_foreign_function return_type func_ptr 
arg_types
address@hidden {Scheme Procedure} pointer->procedure return_type func_ptr 
arg_types
address@hidden {C Procedure} scm_pointer_to_procedure return_type func_ptr 
arg_types
 Make a foreign function.
 
 Given the foreign void pointer @var{func_ptr}, its argument and
@@ -727,9 +727,9 @@ Here is a better definition of @code{(math bessel)}:
 (define libm (dynamic-link "libm"))
 
 (define j0
-  (make-foreign-function double
-                         (dynamic-func "j0" libm)
-                         (list double)))
+  (pointer->procedure double
+                      (dynamic-func "j0" libm)
+                      (list double)))
 @end example
 
 That's it! No C at all.
@@ -747,9 +747,9 @@ code makes @code{memcpy} available to Scheme:
 @example
 (define memcpy
   (let ((this (dynamic-link)))
-    (make-foreign-function '*
-                           (dynamic-func "memcpy" this)
-                           (list '* '* size_t))))
+    (pointer->procedure '*
+                        (dynamic-func "memcpy" this)
+                        (list '* '* size_t))))
 @end example
 
 To invoke @code{memcpy}, one must pass it foreign pointers:
@@ -785,7 +785,7 @@ by the foreign pointer is mutated in place.
 ;; assuming fields are of type "long"
 
 (define gettimeofday
-  (let ((f (make-foreign-function
+  (let ((f (pointer->procedure
             int
             (dynamic-func "gettimeofday" (dynamic-link))
             (list '* '*)))
@@ -826,10 +826,10 @@ function can be made accessible to Scheme (@pxref{Array 
Sort Function,
 
 @example
 (define qsort!
-  (let ((qsort (make-foreign-function void
-                                      (dynamic-func "qsort"
-                                                    (dynamic-link))
-                                      (list '* size_t size_t '*))))
+  (let ((qsort (pointer->procedure void
+                                   (dynamic-func "qsort"
+                                                 (dynamic-link))
+                                   (list '* size_t size_t '*))))
     (lambda (bv compare)
       ;; Sort bytevector BV in-place according to comparison
       ;; procedure COMPARE.
diff --git a/lib/Makefile.am b/lib/Makefile.am
index dded76e..417f956 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 
--libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen 
autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee 
full-read full-write func gendocs getaddrinfo git-version-gen 
gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf 
inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring 
locale maintainer-makefile putenv stat-time stdlib strcase strftime striconveh 
string sys_stat verify version-etc-fsf vsnprintf warnings
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 
--libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen 
autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee 
full-read full-write func gendocs getaddrinfo git-version-gen 
gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf 
inet_ntop inet_pton isinf isnan lib-symbol-versions lib-symbol-visibility 
libunistring locale maintainer-makefile putenv stat-time stdlib strcase 
strftime striconveh string sys_stat verify version-etc-fsf vsnprintf warnings
 
 AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
 
@@ -488,6 +488,42 @@ EXTRA_libgnu_la_SOURCES += inet_pton.c
 
 ## end   gnulib module inet_pton
 
+## begin gnulib module isinf
+
+
+EXTRA_DIST += isinf.c
+
+EXTRA_libgnu_la_SOURCES += isinf.c
+
+## end   gnulib module isinf
+
+## begin gnulib module isnand
+
+
+EXTRA_DIST += float+.h isnan.c isnand.c
+
+EXTRA_libgnu_la_SOURCES += isnan.c isnand.c
+
+## end   gnulib module isnand
+
+## begin gnulib module isnanf
+
+
+EXTRA_DIST += float+.h isnan.c isnanf.c
+
+EXTRA_libgnu_la_SOURCES += isnan.c isnanf.c
+
+## end   gnulib module isnanf
+
+## begin gnulib module isnanl
+
+
+EXTRA_DIST += float+.h isnan.c isnanl.c
+
+EXTRA_libgnu_la_SOURCES += isnan.c isnanl.c
+
+## end   gnulib module isnanl
+
 ## begin gnulib module lib-symbol-visibility
 
 # The value of $(CFLAG_VISIBILITY) needs to be added to the CFLAGS for the
@@ -639,6 +675,112 @@ EXTRA_DIST += malloca.h malloca.valgrind
 
 ## end   gnulib module malloca
 
+## begin gnulib module math
+
+BUILT_SOURCES += math.h
+
+# We need the following in order to create <math.h> when the system
+# doesn't have one that works with the given compiler.
+math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+         sed -e 
's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 
's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \
+             -e 's|@''GNULIB_ACOSL''@|$(GNULIB_ACOSL)|g' \
+             -e 's|@''GNULIB_ASINL''@|$(GNULIB_ASINL)|g' \
+             -e 's|@''GNULIB_ATANL''@|$(GNULIB_ATANL)|g' \
+             -e 's|@''GNULIB_CEILF''@|$(GNULIB_CEILF)|g' \
+             -e 's|@''GNULIB_CEILL''@|$(GNULIB_CEILL)|g' \
+             -e 's|@''GNULIB_COSL''@|$(GNULIB_COSL)|g' \
+             -e 's|@''GNULIB_EXPL''@|$(GNULIB_EXPL)|g' \
+             -e 's|@''GNULIB_FLOORF''@|$(GNULIB_FLOORF)|g' \
+             -e 's|@''GNULIB_FLOORL''@|$(GNULIB_FLOORL)|g' \
+             -e 's|@''GNULIB_FREXP''@|$(GNULIB_FREXP)|g' \
+             -e 's|@''GNULIB_FREXPL''@|$(GNULIB_FREXPL)|g' \
+             -e 's|@''GNULIB_ISFINITE''@|$(GNULIB_ISFINITE)|g' \
+             -e 's|@''GNULIB_ISINF''@|$(GNULIB_ISINF)|g' \
+             -e 's|@''GNULIB_ISNAN''@|$(GNULIB_ISNAN)|g' \
+             -e 's|@''GNULIB_ISNANF''@|$(GNULIB_ISNANF)|g' \
+             -e 's|@''GNULIB_ISNAND''@|$(GNULIB_ISNAND)|g' \
+             -e 's|@''GNULIB_ISNANL''@|$(GNULIB_ISNANL)|g' \
+             -e 's|@''GNULIB_LDEXPL''@|$(GNULIB_LDEXPL)|g' \
+             -e 's|@''GNULIB_LOGB''@|$(GNULIB_LOGB)|g' \
+             -e 's|@''GNULIB_LOGL''@|$(GNULIB_LOGL)|g' \
+             -e 's|@''GNULIB_ROUND''@|$(GNULIB_ROUND)|g' \
+             -e 's|@''GNULIB_ROUNDF''@|$(GNULIB_ROUNDF)|g' \
+             -e 's|@''GNULIB_ROUNDL''@|$(GNULIB_ROUNDL)|g' \
+             -e 's|@''GNULIB_SIGNBIT''@|$(GNULIB_SIGNBIT)|g' \
+             -e 's|@''GNULIB_SINL''@|$(GNULIB_SINL)|g' \
+             -e 's|@''GNULIB_SQRTL''@|$(GNULIB_SQRTL)|g' \
+             -e 's|@''GNULIB_TANL''@|$(GNULIB_TANL)|g' \
+             -e 's|@''GNULIB_TRUNC''@|$(GNULIB_TRUNC)|g' \
+             -e 's|@''GNULIB_TRUNCF''@|$(GNULIB_TRUNCF)|g' \
+             -e 's|@''GNULIB_TRUNCL''@|$(GNULIB_TRUNCL)|g' \
+             -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
+             -e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \
+             -e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \
+             -e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \
+             -e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \
+             -e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \
+             -e 's|@''HAVE_ISNAND''@|$(HAVE_ISNAND)|g' \
+             -e 's|@''HAVE_ISNANL''@|$(HAVE_ISNANL)|g' \
+             -e 's|@''HAVE_LOGL''@|$(HAVE_LOGL)|g' \
+             -e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \
+             -e 's|@''HAVE_SQRTL''@|$(HAVE_SQRTL)|g' \
+             -e 's|@''HAVE_TANL''@|$(HAVE_TANL)|g' \
+             -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \
+             -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \
+             -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \
+             -e 's|@''HAVE_DECL_CEILF''@|$(HAVE_DECL_CEILF)|g' \
+             -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \
+             -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \
+             -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \
+             -e 's|@''HAVE_DECL_FLOORF''@|$(HAVE_DECL_FLOORF)|g' \
+             -e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \
+             -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \
+             -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \
+             -e 's|@''HAVE_DECL_LOGB''@|$(HAVE_DECL_LOGB)|g' \
+             -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \
+             -e 's|@''HAVE_DECL_ROUND''@|$(HAVE_DECL_ROUND)|g' \
+             -e 's|@''HAVE_DECL_ROUNDF''@|$(HAVE_DECL_ROUNDF)|g' \
+             -e 's|@''HAVE_DECL_ROUNDL''@|$(HAVE_DECL_ROUNDL)|g' \
+             -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \
+             -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \
+             -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \
+             -e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \
+             -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \
+             -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \
+             -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \
+             -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \
+             -e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \
+             -e 's|@''REPLACE_FLOORL''@|$(REPLACE_FLOORL)|g' \
+             -e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \
+             -e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \
+             -e 's|@''REPLACE_HUGE_VAL''@|$(REPLACE_HUGE_VAL)|g' \
+             -e 's|@''REPLACE_ISFINITE''@|$(REPLACE_ISFINITE)|g' \
+             -e 's|@''REPLACE_ISINF''@|$(REPLACE_ISINF)|g' \
+             -e 's|@''REPLACE_ISNAN''@|$(REPLACE_ISNAN)|g' \
+             -e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \
+             -e 's|@''REPLACE_NAN''@|$(REPLACE_NAN)|g' \
+             -e 's|@''REPLACE_ROUND''@|$(REPLACE_ROUND)|g' \
+             -e 's|@''REPLACE_ROUNDF''@|$(REPLACE_ROUNDF)|g' \
+             -e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \
+             -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \
+             -e 
's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \
+             -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+             < $(srcdir)/math.in.h; \
+       } > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += math.h math.h-t
+
+EXTRA_DIST += math.in.h
+
+## end   gnulib module math
+
 ## begin gnulib module mbrlen
 
 
diff --git a/lib/asnprintf.c b/lib/isinf.c
similarity index 65%
copy from lib/asnprintf.c
copy to lib/isinf.c
index bc5a8af..a2d6d10 100644
--- a/lib/asnprintf.c
+++ b/lib/isinf.c
@@ -1,5 +1,5 @@
-/* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006, 2009, 2010 Free Software Foundation, Inc.
+/* Test for positive or negative infinity.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -15,21 +15,23 @@
    with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
+/* Written by Ben Pfaff <address@hidden>, 2008. */
+
 #include <config.h>
 
-/* Specification.  */
-#include "vasnprintf.h"
+#include <float.h>
 
-#include <stdarg.h>
+int gl_isinff (float x)
+{
+  return x < -FLT_MAX || x > FLT_MAX;
+}
 
-char *
-asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
+int gl_isinfd (double x)
 {
-  va_list args;
-  char *result;
+  return x < -DBL_MAX || x > DBL_MAX;
+}
 
-  va_start (args, format);
-  result = vasnprintf (resultbuf, lengthp, format, args);
-  va_end (args);
-  return result;
+int gl_isinfl (long double x)
+{
+  return x < -LDBL_MAX || x > LDBL_MAX;
 }
diff --git a/lib/isnan.c b/lib/isnan.c
new file mode 100644
index 0000000..a59dea7
--- /dev/null
+++ b/lib/isnan.c
@@ -0,0 +1,173 @@
+/* Test for NaN that does not need libm.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <address@hidden>, 2007.  */
+
+#include <config.h>
+
+/* Specification.  */
+#ifdef USE_LONG_DOUBLE
+/* Specification found in math.h or isnanl-nolibm.h.  */
+extern int rpl_isnanl (long double x);
+#elif ! defined USE_FLOAT
+/* Specification found in math.h or isnand-nolibm.h.  */
+extern int rpl_isnand (double x);
+#else /* defined USE_FLOAT */
+/* Specification found in math.h or isnanf-nolibm.h.  */
+extern int rpl_isnanf (float x);
+#endif
+
+#include <float.h>
+#include <string.h>
+
+#include "float+.h"
+
+#ifdef USE_LONG_DOUBLE
+# define FUNC rpl_isnanl
+# define DOUBLE long double
+# define MAX_EXP LDBL_MAX_EXP
+# define MIN_EXP LDBL_MIN_EXP
+# if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
+#  define KNOWN_EXPBIT0_LOCATION
+#  define EXPBIT0_WORD LDBL_EXPBIT0_WORD
+#  define EXPBIT0_BIT LDBL_EXPBIT0_BIT
+# endif
+# define SIZE SIZEOF_LDBL
+# define L_(literal) literal##L
+#elif ! defined USE_FLOAT
+# define FUNC rpl_isnand
+# define DOUBLE double
+# define MAX_EXP DBL_MAX_EXP
+# define MIN_EXP DBL_MIN_EXP
+# if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
+#  define KNOWN_EXPBIT0_LOCATION
+#  define EXPBIT0_WORD DBL_EXPBIT0_WORD
+#  define EXPBIT0_BIT DBL_EXPBIT0_BIT
+# endif
+# define SIZE SIZEOF_DBL
+# define L_(literal) literal
+#else /* defined USE_FLOAT */
+# define FUNC rpl_isnanf
+# define DOUBLE float
+# define MAX_EXP FLT_MAX_EXP
+# define MIN_EXP FLT_MIN_EXP
+# if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
+#  define KNOWN_EXPBIT0_LOCATION
+#  define EXPBIT0_WORD FLT_EXPBIT0_WORD
+#  define EXPBIT0_BIT FLT_EXPBIT0_BIT
+# endif
+# define SIZE SIZEOF_FLT
+# define L_(literal) literal##f
+#endif
+
+#define EXP_MASK ((MAX_EXP - MIN_EXP) | 7)
+
+#define NWORDS \
+  ((sizeof (DOUBLE) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { DOUBLE value; unsigned int word[NWORDS]; } memory_double;
+
+int
+FUNC (DOUBLE x)
+{
+#ifdef KNOWN_EXPBIT0_LOCATION
+# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || 
(defined __x86_64__ || defined __amd64__) || (defined __i386 || defined 
__i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
+  /* Special CPU dependent code is needed to treat bit patterns outside the
+     IEEE 754 specification (such as Pseudo-NaNs, Pseudo-Infinities,
+     Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals) as NaNs.
+     These bit patterns are:
+       - exponent = 0x0001..0x7FFF, mantissa bit 63 = 0,
+       - exponent = 0x0000, mantissa bit 63 = 1.
+     The NaN bit pattern is:
+       - exponent = 0x7FFF, mantissa >= 0x8000000000000001.  */
+  memory_double m;
+  unsigned int exponent;
+
+  m.value = x;
+  exponent = (m.word[EXPBIT0_WORD] >> EXPBIT0_BIT) & EXP_MASK;
+#  ifdef WORDS_BIGENDIAN
+  /* Big endian: EXPBIT0_WORD = 0, EXPBIT0_BIT = 16.  */
+  if (exponent == 0)
+    return 1 & (m.word[0] >> 15);
+  else if (exponent == EXP_MASK)
+    return (((m.word[0] ^ 0x8000U) << 16) | m.word[1] | (m.word[2] >> 16)) != 
0;
+  else
+    return 1 & ~(m.word[0] >> 15);
+#  else
+  /* Little endian: EXPBIT0_WORD = 2, EXPBIT0_BIT = 0.  */
+  if (exponent == 0)
+    return (m.word[1] >> 31);
+  else if (exponent == EXP_MASK)
+    return ((m.word[1] ^ 0x80000000U) | m.word[0]) != 0;
+  else
+    return (m.word[1] >> 31) ^ 1;
+#  endif
+# else
+  /* Be careful to not do any floating-point operation on x, such as x == x,
+     because x may be a signaling NaN.  */
+#  if defined __SUNPRO_C || defined __DECC || (defined __sgi && !defined 
__GNUC__)
+  /* The Sun C 5.0 compilers and the Compaq (ex-DEC) 6.4 compilers don't
+     recognize the initializers as constant expressions.  The latter compiler
+     also fails when constant-folding 0.0 / 0.0 even when constant-folding is
+     not required.  The SGI MIPSpro C compiler complains about "floating-point
+     operation result is out of range".  */
+  static DOUBLE zero = L_(0.0);
+  memory_double nan;
+  DOUBLE plus_inf = L_(1.0) / L_(0.0);
+  DOUBLE minus_inf = -L_(1.0) / L_(0.0);
+  nan.value = zero / zero;
+#  else
+  static memory_double nan = { L_(0.0) / L_(0.0) };
+  static DOUBLE plus_inf = L_(1.0) / L_(0.0);
+  static DOUBLE minus_inf = -L_(1.0) / L_(0.0);
+#  endif
+  {
+    memory_double m;
+
+    /* A NaN can be recognized through its exponent.  But exclude +Infinity and
+       -Infinity, which have the same exponent.  */
+    m.value = x;
+    if (((m.word[EXPBIT0_WORD] ^ nan.word[EXPBIT0_WORD])
+         & (EXP_MASK << EXPBIT0_BIT))
+        == 0)
+      return (memcmp (&m.value, &plus_inf, SIZE) != 0
+              && memcmp (&m.value, &minus_inf, SIZE) != 0);
+    else
+      return 0;
+  }
+# endif
+#else
+  /* The configuration did not find sufficient information.  Give up about
+     the signaling NaNs, handle only the quiet NaNs.  */
+  if (x == x)
+    {
+# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || 
(defined __x86_64__ || defined __amd64__) || (defined __i386 || defined 
__i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
+      /* Detect any special bit patterns that pass ==; see comment above.  */
+      memory_double m1;
+      memory_double m2;
+
+      memset (&m1.value, 0, SIZE);
+      memset (&m2.value, 0, SIZE);
+      m1.value = x;
+      m2.value = x + (x ? 0.0L : -0.0L);
+      if (memcmp (&m1.value, &m2.value, SIZE) != 0)
+        return 1;
+# endif
+      return 0;
+    }
+  else
+    return 1;
+#endif
+}
diff --git a/lib/safe-write.c b/lib/isnand.c
similarity index 78%
copy from lib/safe-write.c
copy to lib/isnand.c
index 6e8c8d7..f7a1565 100644
--- a/lib/safe-write.c
+++ b/lib/isnand.c
@@ -1,5 +1,5 @@
-/* An interface to write that retries after interrupts.
-   Copyright (C) 2002, 2009-2010 Free Software Foundation, Inc.
+/* Test for NaN that does not need libm.
+   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -14,5 +14,6 @@
    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#define SAFE_WRITE
-#include "safe-read.c"
+/* Written by Bruno Haible <address@hidden>, 2008.  */
+
+#include "isnan.c"
diff --git a/lib/full-read.c b/lib/isnanf.c
similarity index 76%
copy from lib/full-read.c
copy to lib/isnanf.c
index 93d378d..a352fdb 100644
--- a/lib/full-read.c
+++ b/lib/isnanf.c
@@ -1,5 +1,5 @@
-/* An interface to read that retries after partial reads and interrupts.
-   Copyright (C) 2002-2003, 2009-2010 Free Software Foundation, Inc.
+/* Test for NaN that does not need libm.
+   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -14,5 +14,7 @@
    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#define FULL_READ
-#include "full-write.c"
+/* Written by Bruno Haible <address@hidden>, 2007.  */
+
+#define USE_FLOAT
+#include "isnan.c"
diff --git a/lib/full-read.c b/lib/isnanl.c
similarity index 76%
copy from lib/full-read.c
copy to lib/isnanl.c
index 93d378d..b45fef0 100644
--- a/lib/full-read.c
+++ b/lib/isnanl.c
@@ -1,5 +1,5 @@
-/* An interface to read that retries after partial reads and interrupts.
-   Copyright (C) 2002-2003, 2009-2010 Free Software Foundation, Inc.
+/* Test for NaN that does not need libm.
+   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -14,5 +14,7 @@
    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#define FULL_READ
-#include "full-write.c"
+/* Written by Bruno Haible <address@hidden>, 2007.  */
+
+#define USE_LONG_DOUBLE
+#include "isnan.c"
diff --git a/lib/math.in.h b/lib/math.in.h
new file mode 100644
index 0000000..c0b2f34
--- /dev/null
+++ b/lib/math.in.h
@@ -0,0 +1,750 @@
+/* A GNU-like <math.h>.
+
+   Copyright (C) 2002-2003, 2007-2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_MATH_H
+
+#if __GNUC__ >= 3
address@hidden@
+#endif
+
+/* The include_next requires a split double-inclusion guard.  */
address@hidden@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
+
+#ifndef _GL_MATH_H
+#define _GL_MATH_H
+
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+/* Helper macros to define a portability warning for the
+   classification macro FUNC called with VALUE.  POSIX declares the
+   classification macros with an argument of real-floating (that is,
+   one of float, double, or long double).  */
+#define _GL_WARN_REAL_FLOATING_DECL(func) \
+static inline int                                                   \
+rpl_ ## func ## f (float f)                                         \
+{                                                                   \
+  return func (f);                                                  \
+}                                                                   \
+static inline int                                                   \
+rpl_ ## func ## d (double d)                                        \
+{                                                                   \
+  return func (d);                                                  \
+}                                                                   \
+static inline int                                                   \
+rpl_ ## func ## l (long double l)                                   \
+{                                                                   \
+  return func (l);                                                  \
+}                                                                   \
+_GL_WARN_ON_USE (rpl_ ## func ## f, #func " is unportable - "       \
+                 "use gnulib module " #func " for portability");    \
+_GL_WARN_ON_USE (rpl_ ## func ## d, #func " is unportable - "       \
+                 "use gnulib module " #func " for portability");    \
+_GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - "       \
+                 "use gnulib module " #func " for portability")
+#define _GL_WARN_REAL_FLOATING_IMPL(func, value) \
+  (sizeof (value) == sizeof (float) ? rpl_ ## func ## f (value)     \
+   : sizeof (value) == sizeof (double) ? rpl_ ## func ## d (value)  \
+   : rpl_ ## func ## l (value))
+
+
+/* POSIX allows platforms that don't support NAN.  But all major
+   machines in the past 15 years have supported something close to
+   IEEE NaN, so we define this unconditionally.  We also must define
+   it on platforms like Solaris 10, where NAN is present but defined
+   as a function pointer rather than a floating point constant.  */
+#if !defined NAN || @REPLACE_NAN@
+# undef NAN
+  /* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0.  */
+# ifdef __DECC
+static float
+_NaN ()
+{
+  static float zero = 0.0f;
+  return zero / zero;
+}
+#  define NAN (_NaN())
+# else
+#  define NAN (0.0f / 0.0f)
+# endif
+#endif
+
+/* Solaris 10 defines HUGE_VAL, but as a function pointer rather
+   than a floating point constant.  */
+#if @REPLACE_HUGE_VAL@
+# undef HUGE_VAL
+# define HUGE_VAL (1.0 / 0.0)
+#endif
+
+
+/* Write x as
+     x = mantissa * 2^exp
+   where
+     If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
+     If x is zero: mantissa = x, exp = 0.
+     If x is infinite or NaN: mantissa = x, exp unspecified.
+   Store exp in *EXPPTR and return mantissa.  */
+#if @GNULIB_FREXP@
+# if @REPLACE_FREXP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define frexp rpl_frexp
+#  endif
+_GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL 
((2)));
+_GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
+# else
+_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
+# endif
+_GL_CXXALIASWARN (frexp);
+#elif defined GNULIB_POSIXCHECK
+# undef frexp
+/* Assume frexp is always declared.  */
+_GL_WARN_ON_USE (frexp, "frexp is unportable - "
+                 "use gnulib module frexp for portability");
+#endif
+
+
+#if @GNULIB_LOGB@
+# if address@hidden@
+_GL_EXTERN_C double logb (double x);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef logb
+# if HAVE_RAW_DECL_LOGB
+_GL_WARN_ON_USE (logb, "logb is unportable - "
+                 "use gnulib module logb for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ACOSL@
+# if address@hidden@ || address@hidden@
+_GL_FUNCDECL_SYS (acosl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (acosl, long double, (long double x));
+_GL_CXXALIASWARN (acosl);
+#elif defined GNULIB_POSIXCHECK
+# undef acosl
+# if HAVE_RAW_DECL_ACOSL
+_GL_WARN_ON_USE (acosl, "acosl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ASINL@
+# if address@hidden@ || address@hidden@
+_GL_FUNCDECL_SYS (asinl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (asinl, long double, (long double x));
+_GL_CXXALIASWARN (asinl);
+#elif defined GNULIB_POSIXCHECK
+# undef asinl
+# if HAVE_RAW_DECL_ASINL
+_GL_WARN_ON_USE (asinl, "asinl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ATANL@
+# if address@hidden@ || address@hidden@
+_GL_FUNCDECL_SYS (atanl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (atanl, long double, (long double x));
+_GL_CXXALIASWARN (atanl);
+#elif defined GNULIB_POSIXCHECK
+# undef atanl
+# if HAVE_RAW_DECL_ATANL
+_GL_WARN_ON_USE (atanl, "atanl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_CEILF@
+# if @REPLACE_CEILF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define ceilf rpl_ceilf
+#  endif
+_GL_FUNCDECL_RPL (ceilf, float, (float x));
+_GL_CXXALIAS_RPL (ceilf, float, (float x));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (ceilf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (ceilf, float, (float x));
+# endif
+_GL_CXXALIASWARN (ceilf);
+#elif defined GNULIB_POSIXCHECK
+# undef ceilf
+# if HAVE_RAW_DECL_CEILF
+_GL_WARN_ON_USE (ceilf, "ceilf is unportable - "
+                 "use gnulib module ceilf for portability");
+# endif
+#endif
+
+#if @GNULIB_CEILL@
+# if @REPLACE_CEILL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define ceill rpl_ceill
+#  endif
+_GL_FUNCDECL_RPL (ceill, long double, (long double x));
+_GL_CXXALIAS_RPL (ceill, long double, (long double x));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (ceill, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (ceill, long double, (long double x));
+# endif
+_GL_CXXALIASWARN (ceill);
+#elif defined GNULIB_POSIXCHECK
+# undef ceill
+# if HAVE_RAW_DECL_CEILL
+_GL_WARN_ON_USE (ceill, "ceill is unportable - "
+                 "use gnulib module ceill for portability");
+# endif
+#endif
+
+
+#if @GNULIB_COSL@
+# if address@hidden@ || address@hidden@
+_GL_FUNCDECL_SYS (cosl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (cosl, long double, (long double x));
+_GL_CXXALIASWARN (cosl);
+#elif defined GNULIB_POSIXCHECK
+# undef cosl
+# if HAVE_RAW_DECL_COSL
+_GL_WARN_ON_USE (cosl, "cosl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_EXPL@
+# if address@hidden@ || address@hidden@
+_GL_FUNCDECL_SYS (expl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (expl, long double, (long double x));
+_GL_CXXALIASWARN (expl);
+#elif defined GNULIB_POSIXCHECK
+# undef expl
+# if HAVE_RAW_DECL_EXPL
+_GL_WARN_ON_USE (expl, "expl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_FLOORF@
+# if @REPLACE_FLOORF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define floorf rpl_floorf
+#  endif
+_GL_FUNCDECL_RPL (floorf, float, (float x));
+_GL_CXXALIAS_RPL (floorf, float, (float x));
+#else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (floorf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (floorf, float, (float x));
+# endif
+_GL_CXXALIASWARN (floorf);
+#elif defined GNULIB_POSIXCHECK
+# undef floorf
+# if HAVE_RAW_DECL_FLOORF
+_GL_WARN_ON_USE (floorf, "floorf is unportable - "
+                 "use gnulib module floorf for portability");
+# endif
+#endif
+
+#if @GNULIB_FLOORL@
+# if @REPLACE_FLOORL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define floorl rpl_floorl
+#  endif
+_GL_FUNCDECL_RPL (floorl, long double, (long double x));
+_GL_CXXALIAS_RPL (floorl, long double, (long double x));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (floorl, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (floorl, long double, (long double x));
+# endif
+_GL_CXXALIASWARN (floorl);
+#elif defined GNULIB_POSIXCHECK
+# undef floorl
+# if HAVE_RAW_DECL_FLOORL
+_GL_WARN_ON_USE (floorl, "floorl is unportable - "
+                 "use gnulib module floorl for portability");
+# endif
+#endif
+
+
+/* Write x as
+     x = mantissa * 2^exp
+   where
+     If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
+     If x is zero: mantissa = x, exp = 0.
+     If x is infinite or NaN: mantissa = x, exp unspecified.
+   Store exp in *EXPPTR and return mantissa.  */
+#if @GNULIB_FREXPL@ && @REPLACE_FREXPL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  define frexpl rpl_frexpl
+# endif
+_GL_FUNCDECL_RPL (frexpl, long double,
+                  (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr));
+#else
+# if address@hidden@
+_GL_FUNCDECL_SYS (frexpl, long double,
+                  (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
+# endif
+# if @GNULIB_FREXPL@
+_GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr));
+# endif
+#endif
+#if @GNULIB_FREXPL@ && !(@REPLACE_FREXPL@ && address@hidden@)
+_GL_CXXALIASWARN (frexpl);
+#endif
+#if address@hidden@ && defined GNULIB_POSIXCHECK
+# undef frexpl
+# if HAVE_RAW_DECL_FREXPL
+_GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
+                 "use gnulib module frexpl for portability");
+# endif
+#endif
+
+
+/* Return x * 2^exp.  */
+#if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  define ldexpl rpl_ldexpl
+# endif
+_GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp));
+_GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp));
+#else
+# if address@hidden@
+_GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp));
+# endif
+# if @GNULIB_LDEXPL@
+_GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp));
+# endif
+#endif
+#if @GNULIB_LDEXPL@
+_GL_CXXALIASWARN (ldexpl);
+#endif
+#if address@hidden@ && defined GNULIB_POSIXCHECK
+# undef ldexpl
+# if HAVE_RAW_DECL_LDEXPL
+_GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
+                 "use gnulib module ldexpl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LOGL@
+# if address@hidden@ || address@hidden@
+_GL_FUNCDECL_SYS (logl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (logl, long double, (long double x));
+_GL_CXXALIASWARN (logl);
+#elif defined GNULIB_POSIXCHECK
+# undef logl
+# if HAVE_RAW_DECL_LOGL
+_GL_WARN_ON_USE (logl, "logl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ROUNDF@
+# if @REPLACE_ROUNDF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef roundf
+#   define roundf rpl_roundf
+#  endif
+_GL_FUNCDECL_RPL (roundf, float, (float x));
+_GL_CXXALIAS_RPL (roundf, float, (float x));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (roundf, float, (float x));
+#  endif
+_GL_CXXALIAS_SYS (roundf, float, (float x));
+# endif
+_GL_CXXALIASWARN (roundf);
+#elif defined GNULIB_POSIXCHECK
+# undef roundf
+# if HAVE_RAW_DECL_ROUNDF
+_GL_WARN_ON_USE (roundf, "roundf is unportable - "
+                 "use gnulib module roundf for portability");
+# endif
+#endif
+
+#if @GNULIB_ROUND@
+# if @REPLACE_ROUND@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef round
+#   define round rpl_round
+#  endif
+_GL_FUNCDECL_RPL (round, double, (double x));
+_GL_CXXALIAS_RPL (round, double, (double x));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (round, double, (double x));
+#  endif
+_GL_CXXALIAS_SYS (round, double, (double x));
+# endif
+_GL_CXXALIASWARN (round);
+#elif defined GNULIB_POSIXCHECK
+# undef round
+# if HAVE_RAW_DECL_ROUND
+_GL_WARN_ON_USE (round, "round is unportable - "
+                 "use gnulib module round for portability");
+# endif
+#endif
+
+#if @GNULIB_ROUNDL@
+# if @REPLACE_ROUNDL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef roundl
+#   define roundl rpl_roundl
+#  endif
+_GL_FUNCDECL_RPL (roundl, long double, (long double x));
+_GL_CXXALIAS_RPL (roundl, long double, (long double x));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (roundl, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (roundl, long double, (long double x));
+# endif
+_GL_CXXALIASWARN (roundl);
+#elif defined GNULIB_POSIXCHECK
+# undef roundl
+# if HAVE_RAW_DECL_ROUNDL
+_GL_WARN_ON_USE (roundl, "roundl is unportable - "
+                 "use gnulib module roundl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_SINL@
+# if address@hidden@ || address@hidden@
+_GL_FUNCDECL_SYS (sinl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (sinl, long double, (long double x));
+_GL_CXXALIASWARN (sinl);
+#elif defined GNULIB_POSIXCHECK
+# undef sinl
+# if HAVE_RAW_DECL_SINL
+_GL_WARN_ON_USE (sinl, "sinl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_SQRTL@
+# if address@hidden@ || address@hidden@
+_GL_FUNCDECL_SYS (sqrtl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
+_GL_CXXALIASWARN (sqrtl);
+#elif defined GNULIB_POSIXCHECK
+# undef sqrtl
+# if HAVE_RAW_DECL_SQRTL
+_GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_TANL@
+# if address@hidden@ || address@hidden@
+_GL_FUNCDECL_SYS (tanl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (tanl, long double, (long double x));
+_GL_CXXALIASWARN (tanl);
+#elif defined GNULIB_POSIXCHECK
+# undef tanl
+# if HAVE_RAW_DECL_TANL
+_GL_WARN_ON_USE (tanl, "tanl is unportable - "
+                 "use gnulib module mathl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_TRUNCF@
+# if address@hidden@
+_GL_FUNCDECL_SYS (truncf, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (truncf, float, (float x));
+_GL_CXXALIASWARN (truncf);
+#elif defined GNULIB_POSIXCHECK
+# undef truncf
+# if HAVE_RAW_DECL_TRUNCF
+_GL_WARN_ON_USE (truncf, "truncf is unportable - "
+                 "use gnulib module truncf for portability");
+# endif
+#endif
+
+#if @GNULIB_TRUNC@
+# if address@hidden@
+_GL_FUNCDECL_SYS (trunc, double, (double x));
+# endif
+_GL_CXXALIAS_SYS (trunc, double, (double x));
+_GL_CXXALIASWARN (trunc);
+#elif defined GNULIB_POSIXCHECK
+# undef trunc
+# if HAVE_RAW_DECL_TRUNC
+_GL_WARN_ON_USE (trunc, "trunc is unportable - "
+                 "use gnulib module trunc for portability");
+# endif
+#endif
+
+#if @GNULIB_TRUNCL@
+# if @REPLACE_TRUNCL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef truncl
+#   define truncl rpl_truncl
+#  endif
+_GL_FUNCDECL_RPL (truncl, long double, (long double x));
+_GL_CXXALIAS_RPL (truncl, long double, (long double x));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (truncl, long double, (long double x));
+#  endif
+_GL_CXXALIAS_SYS (truncl, long double, (long double x));
+# endif
+_GL_CXXALIASWARN (truncl);
+#elif defined GNULIB_POSIXCHECK
+# undef truncl
+# if HAVE_RAW_DECL_TRUNCL
+_GL_WARN_ON_USE (truncl, "truncl is unportable - "
+                 "use gnulib module truncl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ISFINITE@
+# if @REPLACE_ISFINITE@
+_GL_EXTERN_C int gl_isfinitef (float x);
+_GL_EXTERN_C int gl_isfinited (double x);
+_GL_EXTERN_C int gl_isfinitel (long double x);
+#  undef isfinite
+#  define isfinite(x) \
+   (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \
+    sizeof (x) == sizeof (double) ? gl_isfinited (x) : \
+    gl_isfinitef (x))
+# endif
+#elif defined GNULIB_POSIXCHECK
+# if defined isfinite
+_GL_WARN_REAL_FLOATING_DECL (isfinite);
+#  undef isfinite
+#  define isfinite(x) _GL_WARN_REAL_FLOATING_IMPL (isfinite, x)
+# endif
+#endif
+
+
+#if @GNULIB_ISINF@
+# if @REPLACE_ISINF@
+_GL_EXTERN_C int gl_isinff (float x);
+_GL_EXTERN_C int gl_isinfd (double x);
+_GL_EXTERN_C int gl_isinfl (long double x);
+#  undef isinf
+#  define isinf(x) \
+   (sizeof (x) == sizeof (long double) ? gl_isinfl (x) : \
+    sizeof (x) == sizeof (double) ? gl_isinfd (x) : \
+    gl_isinff (x))
+# endif
+#elif defined GNULIB_POSIXCHECK
+# if defined isinf
+_GL_WARN_REAL_FLOATING_DECL (isinf);
+#  undef isinf
+#  define isinf(x) _GL_WARN_REAL_FLOATING_IMPL (isinf, x)
+# endif
+#endif
+
+
+#if @GNULIB_ISNANF@
+/* Test for NaN for 'float' numbers.  */
+# if @HAVE_ISNANF@
+/* The original <math.h> included above provides a declaration of isnan macro
+   or (older) isnanf function.  */
+#  if __GNUC__ >= 4
+    /* GCC 4.0 and newer provides three built-ins for isnan.  */
+#   undef isnanf
+#   define isnanf(x) __builtin_isnanf ((float)(x))
+#  elif defined isnan
+#   undef isnanf
+#   define isnanf(x) isnan ((float)(x))
+#  endif
+# else
+/* Test whether X is a NaN.  */
+#  undef isnanf
+#  define isnanf rpl_isnanf
+_GL_EXTERN_C int isnanf (float x);
+# endif
+#endif
+
+#if @GNULIB_ISNAND@
+/* Test for NaN for 'double' numbers.
+   This function is a gnulib extension, unlike isnan() which applied only
+   to 'double' numbers earlier but now is a type-generic macro.  */
+# if @HAVE_ISNAND@
+/* The original <math.h> included above provides a declaration of isnan macro. 
 */
+#  if __GNUC__ >= 4
+    /* GCC 4.0 and newer provides three built-ins for isnan.  */
+#   undef isnand
+#   define isnand(x) __builtin_isnan ((double)(x))
+#  else
+#   undef isnand
+#   define isnand(x) isnan ((double)(x))
+#  endif
+# else
+/* Test whether X is a NaN.  */
+#  undef isnand
+#  define isnand rpl_isnand
+_GL_EXTERN_C int isnand (double x);
+# endif
+#endif
+
+#if @GNULIB_ISNANL@
+/* Test for NaN for 'long double' numbers.  */
+# if @HAVE_ISNANL@
+/* The original <math.h> included above provides a declaration of isnan macro 
or (older) isnanl function.  */
+#  if __GNUC__ >= 4
+    /* GCC 4.0 and newer provides three built-ins for isnan.  */
+#   undef isnanl
+#   define isnanl(x) __builtin_isnanl ((long double)(x))
+#  elif defined isnan
+#   undef isnanl
+#   define isnanl(x) isnan ((long double)(x))
+#  endif
+# else
+/* Test whether X is a NaN.  */
+#  undef isnanl
+#  define isnanl rpl_isnanl
+_GL_EXTERN_C int isnanl (long double x);
+# endif
+#endif
+
+/* This must come *after* the snippets for GNULIB_ISNANF and GNULIB_ISNANL!  */
+#if @GNULIB_ISNAN@
+# if @REPLACE_ISNAN@
+/* We can't just use the isnanf macro (e.g.) as exposed by
+   isnanf.h (e.g.) here, because those may end up being macros
+   that recursively expand back to isnan.  So use the gnulib
+   replacements for them directly. */
+#  if @HAVE_ISNANF@ && __GNUC__ >= 4
+#   define gl_isnan_f(x) __builtin_isnan ((float)(x))
+#  else
+_GL_EXTERN_C int rpl_isnanf (float x);
+#   define gl_isnan_f(x) rpl_isnanf (x)
+#  endif
+#  if @HAVE_ISNAND@ && __GNUC__ >= 4
+#   define gl_isnan_d(x) __builtin_isnan ((double)(x))
+#  else
+_GL_EXTERN_C int rpl_isnand (double x);
+#   define gl_isnan_d(x) rpl_isnand (x)
+#  endif
+#  if @HAVE_ISNANL@ && __GNUC__ >= 4
+#   define gl_isnan_l(x) __builtin_isnan ((long double)(x))
+#  else
+_GL_EXTERN_C int rpl_isnanl (long double x);
+#   define gl_isnan_l(x) rpl_isnanl (x)
+#  endif
+#  undef isnan
+#  define isnan(x) \
+   (sizeof (x) == sizeof (long double) ? gl_isnan_l (x) : \
+    sizeof (x) == sizeof (double) ? gl_isnan_d (x) : \
+    gl_isnan_f (x))
+# endif
+#elif defined GNULIB_POSIXCHECK
+# if defined isnan
+_GL_WARN_REAL_FLOATING_DECL (isnan);
+#  undef isnan
+#  define isnan(x) _GL_WARN_REAL_FLOATING_IMPL (isnan, x)
+# endif
+#endif
+
+
+#if @GNULIB_SIGNBIT@
+# if @REPLACE_SIGNBIT_USING_GCC@
+#  undef signbit
+   /* GCC 4.0 and newer provides three built-ins for signbit.  */
+#  define signbit(x) \
+   (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
+    sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
+    __builtin_signbitf (x))
+# endif
+# if @REPLACE_SIGNBIT@
+#  undef signbit
+_GL_EXTERN_C int gl_signbitf (float arg);
+_GL_EXTERN_C int gl_signbitd (double arg);
+_GL_EXTERN_C int gl_signbitl (long double arg);
+#  if __GNUC__ >= 2 && !__STRICT_ANSI__
+#   if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined 
gl_signbitf
+#    define gl_signbitf_OPTIMIZED_MACRO
+#    define gl_signbitf(arg) \
+       ({ union { float _value;                                         \
+                  unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 
1) / sizeof (unsigned int)]; \
+                } _m;                                                   \
+          _m._value = (arg);                                            \
+          (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1;          \
+        })
+#   endif
+#   if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined 
gl_signbitd
+#    define gl_signbitd_OPTIMIZED_MACRO
+#    define gl_signbitd(arg) \
+       ({ union { double _value;                                               
 \
+                  unsigned int _word[(sizeof (double) + sizeof (unsigned int) 
- 1) / sizeof (unsigned int)]; \
+                } _m;                                                   \
+          _m._value = (arg);                                            \
+          (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1;          \
+        })
+#   endif
+#   if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined 
gl_signbitl
+#    define gl_signbitl_OPTIMIZED_MACRO
+#    define gl_signbitl(arg) \
+       ({ union { long double _value;                                   \
+                  unsigned int _word[(sizeof (long double) + sizeof (unsigned 
int) - 1) / sizeof (unsigned int)]; \
+                } _m;                                                   \
+          _m._value = (arg);                                            \
+          (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1;               
 \
+        })
+#   endif
+#  endif
+#  define signbit(x) \
+   (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \
+    sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
+    gl_signbitf (x))
+# endif
+#elif defined GNULIB_POSIXCHECK
+# if defined signbit
+_GL_WARN_REAL_FLOATING_DECL (signbit);
+#  undef signbit
+#  define signbit(x) _GL_WARN_REAL_FLOATING_IMPL (signbit, x)
+# endif
+#endif
+
+
+#endif /* _GL_MATH_H */
+#endif /* _GL_MATH_H */
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index d2f349b..b8c4e6b 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -445,10 +445,10 @@ noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c       
        \
 noinst_HEADERS += vm-engine.c vm-i-system.c vm-i-scheme.c vm-i-loader.c
 
 address@hidden@_la_DEPENDENCIES = @LIBLOBJS@
address@hidden@_la_LIBADD =                             \
-  @LIBLOBJS@ $(gnulib_library) $(LTLIBGMP)     \
address@hidden@_la_LIBADD =             \
+  @LIBLOBJS@ $(gnulib_library) $(LTLIBGMP) $(LTLIBLTDL)        \
   $(LTLIBUNISTRING) $(LTLIBICONV) $(LTLIBINTL)
address@hidden@_la_LDFLAGS =                                                    
                                \
address@hidden@_la_LDFLAGS =                                                    
        \
   @LTLIBINTL@ $(LIBFFI_LIBS) $(INET_NTOP_LIB) $(INET_PTON_LIB)                 
                        \
   $(GETADDRINFO_LIB) $(HOSTENT_LIB) $(SERVENT_LIB)                             
                        \
   -version-info 
@LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@
    \
diff --git a/libguile/foreign.c b/libguile/foreign.c
index c36972b..1e91661 100644
--- a/libguile/foreign.c
+++ b/libguile/foreign.c
@@ -530,7 +530,7 @@ fill_ffi_type (SCM type, ffi_type *ftype, ffi_type 
***type_ptrs,
           *ftype = ffi_type_void;
           return;
         default:
-          scm_wrong_type_arg_msg ("make-foreign-function", 0, type,
+          scm_wrong_type_arg_msg ("pointer->procedure", 0, type,
                                   "foreign type");
         }
     }
@@ -641,7 +641,7 @@ make_cif (SCM return_type, SCM arg_types, const char 
*caller)
 }
 #undef FUNC_NAME
 
-SCM_DEFINE (scm_make_foreign_function, "make-foreign-function", 3, 0, 0,
+SCM_DEFINE (scm_pointer_to_procedure, "pointer->procedure", 3, 0, 0,
             (SCM return_type, SCM func_ptr, SCM arg_types),
             "Make a foreign function.\n\n"
             "Given the foreign void pointer @var{func_ptr}, its argument and\n"
@@ -650,7 +650,7 @@ SCM_DEFINE (scm_make_foreign_function, 
"make-foreign-function", 3, 0, 0,
             "and return appropriate values.\n\n"
             "@var{arg_types} should be a list of foreign types.\n"
             "@code{return_type} should be a foreign type.")
-#define FUNC_NAME s_scm_make_foreign_function
+#define FUNC_NAME s_scm_pointer_to_procedure
 {
   ffi_cif *cif;
 
diff --git a/libguile/foreign.h b/libguile/foreign.h
index 1c57621..e534d48 100644
--- a/libguile/foreign.h
+++ b/libguile/foreign.h
@@ -93,8 +93,8 @@ SCM_INTERNAL SCM scm_pointer_to_string (SCM pointer);
    arguments.
  */
 
-SCM_API SCM scm_make_foreign_function (SCM return_type, SCM func_ptr,
-                                       SCM arg_types);
+SCM_API SCM scm_pointer_to_procedure (SCM return_type, SCM func_ptr,
+                                     SCM arg_types);
 SCM_API SCM scm_procedure_to_pointer (SCM return_type, SCM func_ptr,
                                      SCM arg_types);
 SCM_INTERNAL SCM scm_i_foreign_call (SCM foreign, const SCM *argv);
diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c
index 73f847f..0263356 100644
--- a/libguile/gen-scmconfig.c
+++ b/libguile/gen-scmconfig.c
@@ -185,24 +185,6 @@ main (int argc, char *argv[])
   pf ("#define SCM_HAVE_SYS_SELECT_H 0 /* 0 or 1 */\n");
 #endif
 
-#ifdef HAVE_FLOATINGPOINT_H
-  pf ("#define SCM_HAVE_FLOATINGPOINT_H 1 /* 0 or 1 */\n");
-#else
-  pf ("#define SCM_HAVE_FLOATINGPOINT_H 0 /* 0 or 1 */\n");
-#endif
-
-#ifdef HAVE_IEEEFP_H
-  pf ("#define SCM_HAVE_IEEEFP_H 1 /* 0 or 1 */\n");
-#else
-  pf ("#define SCM_HAVE_IEEEFP_H 0 /* 0 or 1 */\n");
-#endif
-
-#ifdef HAVE_NAN_H
-  pf ("#define SCM_HAVE_NAN_H 1 /* 0 or 1 */\n");
-#else
-  pf ("#define SCM_HAVE_NAN_H 0 /* 0 or 1 */\n");
-#endif
-
 #ifdef HAVE_WINSOCK2_H
   pf ("#define SCM_HAVE_WINSOCK2_H 1 /* 0 or 1 */\n");
 #else
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 6f04ea5..840b100 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -105,26 +105,6 @@ static SCM flo0;
  */
 #define FLOBUFLEN (40+2*(sizeof(double)/sizeof(char)*SCM_CHAR_BIT*3+9)/10)
 
-#if defined (SCO)
-#if ! defined (HAVE_ISNAN)
-#define HAVE_ISNAN
-static int
-isnan (double x)
-{
-  return (IsNANorINF (x) && NaN (x) && ! IsINF (x)) ? 1 : 0;
-}
-#endif
-#if ! defined (HAVE_ISINF)
-#define HAVE_ISINF
-static int
-isinf (double x)
-{
-  return (IsNANorINF (x) && IsINF (x)) ? 1 : 0;
-}
-
-#endif
-#endif
-
 
 #if !defined (HAVE_ASINH)
 static double asinh (double x) { return log (x + sqrt (x * x + 1)); }
@@ -141,35 +121,11 @@ static double atanh (double x) { return 0.5 * log ((1 + 
x) / (1 - x)); }
    mpz_cmp_d is supposed to do this itself.  */
 #if 1
 #define xmpz_cmp_d(z, d)                                \
-  (xisinf (d) ? (d < 0.0 ? 1 : -1) : mpz_cmp_d (z, d))
+  (isinf (d) ? (d < 0.0 ? 1 : -1) : mpz_cmp_d (z, d))
 #else
 #define xmpz_cmp_d(z, d)  mpz_cmp_d (z, d)
 #endif
 
-/* For reference, sparc solaris 7 has infinities (IEEE) but doesn't have
-   isinf.  It does have finite and isnan though, hence the use of those.
-   fpclass would be a possibility on that system too.  */
-static int
-xisinf (double x)
-{
-#if defined (HAVE_ISINF)
-  return isinf (x);
-#elif defined (HAVE_FINITE) && defined (HAVE_ISNAN)
-  return (! (finite (x) || isnan (x)));
-#else
-  return 0;
-#endif
-}
-
-static int
-xisnan (double x)
-{
-#if defined (HAVE_ISNAN)
-  return isnan (x);
-#else
-  return 0;
-#endif
-}
 
 #if defined (GUILE_I)
 #if HAVE_COMPLEX_DOUBLE
@@ -583,10 +539,10 @@ SCM_DEFINE (scm_inf_p, "inf?", 1, 0, 0,
 #define FUNC_NAME s_scm_inf_p
 {
   if (SCM_REALP (x))
-    return scm_from_bool (xisinf (SCM_REAL_VALUE (x)));
+    return scm_from_bool (isinf (SCM_REAL_VALUE (x)));
   else if (SCM_COMPLEXP (x))
-    return scm_from_bool (xisinf (SCM_COMPLEX_REAL (x))
-                         || xisinf (SCM_COMPLEX_IMAG (x)));
+    return scm_from_bool (isinf (SCM_COMPLEX_REAL (x))
+                         || isinf (SCM_COMPLEX_IMAG (x)));
   else
     return SCM_BOOL_F;
 }
@@ -599,10 +555,10 @@ SCM_DEFINE (scm_nan_p, "nan?", 1, 0, 0,
 #define FUNC_NAME s_scm_nan_p
 {
   if (SCM_REALP (n))
-    return scm_from_bool (xisnan (SCM_REAL_VALUE (n)));
+    return scm_from_bool (isnan (SCM_REAL_VALUE (n)));
   else if (SCM_COMPLEXP (n))
-    return scm_from_bool (xisnan (SCM_COMPLEX_REAL (n))
-                    || xisnan (SCM_COMPLEX_IMAG (n)));
+    return scm_from_bool (isnan (SCM_COMPLEX_REAL (n))
+                    || isnan (SCM_COMPLEX_IMAG (n)));
   else
     return SCM_BOOL_F;
 }
@@ -617,8 +573,6 @@ static double guile_NaN;
 static void
 guile_ieee_init (void)
 {
-#if defined (HAVE_ISINF) || defined (HAVE_FINITE)
-
 /* Some version of gcc on some old version of Linux used to crash when
    trying to make Inf and NaN.  */
 
@@ -645,10 +599,6 @@ guile_ieee_init (void)
     }
 #endif
 
-#endif
-
-#if defined (HAVE_ISNAN)
-
 #ifdef NAN
   /* C99 NAN, when available */
   guile_NaN = NAN;
@@ -661,8 +611,6 @@ guile_ieee_init (void)
 #else
   guile_NaN = guile_Inf / guile_Inf;
 #endif
-
-#endif
 }
 
 SCM_DEFINE (scm_inf, "inf", 0, 0, 0, 
@@ -2216,7 +2164,7 @@ idbl2str (double f, char *a, int radix)
       goto zero;       /*{a[0]='0'; a[1]='.'; a[2]='0'; return 3;} */
     }
 
-  if (xisinf (f))
+  if (isinf (f))
     {
       if (f < 0)
        strcpy (a, "-inf.0");
@@ -2224,7 +2172,7 @@ idbl2str (double f, char *a, int radix)
        strcpy (a, "+inf.0");
       return ch+6;
     }
-  else if (xisnan (f))
+  else if (isnan (f))
     {
       strcpy (a, "+nan.0");
       return ch+6;
@@ -2376,7 +2324,7 @@ icmplx2str (double real, double imag, char *str, int 
radix)
     {
       /* Don't output a '+' for negative numbers or for Inf and
         NaN.  They will provide their own sign. */
-      if (0 <= imag && !xisinf (imag) && !xisnan (imag))
+      if (0 <= imag && !isinf (imag) && !isnan (imag))
        str[i++] = '+';
       i += idbl2str (imag, &str[i], radix);
       str[i++] = 'i';
@@ -3409,7 +3357,7 @@ scm_num_eq_p (SCM x, SCM y)
       else if (SCM_REALP (y))
        {
          int cmp;
-         if (xisnan (SCM_REAL_VALUE (y)))
+         if (isnan (SCM_REAL_VALUE (y)))
            return SCM_BOOL_F;
          cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_REAL_VALUE (y));
          scm_remember_upto_here_1 (x);
@@ -3420,7 +3368,7 @@ scm_num_eq_p (SCM x, SCM y)
          int cmp;
          if (0.0 != SCM_COMPLEX_IMAG (y))
            return SCM_BOOL_F;
-         if (xisnan (SCM_COMPLEX_REAL (y)))
+         if (isnan (SCM_COMPLEX_REAL (y)))
            return SCM_BOOL_F;
          cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_COMPLEX_REAL (y));
          scm_remember_upto_here_1 (x);
@@ -3445,7 +3393,7 @@ scm_num_eq_p (SCM x, SCM y)
       else if (SCM_BIGP (y))
        {
          int cmp;
-         if (xisnan (SCM_REAL_VALUE (x)))
+         if (isnan (SCM_REAL_VALUE (x)))
            return SCM_BOOL_F;
          cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_REAL_VALUE (x));
          scm_remember_upto_here_1 (y);
@@ -3459,9 +3407,9 @@ scm_num_eq_p (SCM x, SCM y)
       else if (SCM_FRACTIONP (y))
         {
           double  xx = SCM_REAL_VALUE (x);
-          if (xisnan (xx))
+          if (isnan (xx))
             return SCM_BOOL_F;
-          if (xisinf (xx))
+          if (isinf (xx))
             return scm_from_bool (xx < 0.0);
           x = scm_inexact_to_exact (x);  /* with x as frac or int */
           goto again;
@@ -3479,7 +3427,7 @@ scm_num_eq_p (SCM x, SCM y)
          int cmp;
          if (0.0 != SCM_COMPLEX_IMAG (x))
            return SCM_BOOL_F;
-         if (xisnan (SCM_COMPLEX_REAL (x)))
+         if (isnan (SCM_COMPLEX_REAL (x)))
            return SCM_BOOL_F;
          cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_COMPLEX_REAL (x));
          scm_remember_upto_here_1 (y);
@@ -3497,9 +3445,9 @@ scm_num_eq_p (SCM x, SCM y)
           if (SCM_COMPLEX_IMAG (x) != 0.0)
             return SCM_BOOL_F;
           xx = SCM_COMPLEX_REAL (x);
-          if (xisnan (xx))
+          if (isnan (xx))
             return SCM_BOOL_F;
-          if (xisinf (xx))
+          if (isinf (xx))
             return scm_from_bool (xx < 0.0);
           x = scm_inexact_to_exact (x);  /* with x as frac or int */
           goto again;
@@ -3516,9 +3464,9 @@ scm_num_eq_p (SCM x, SCM y)
       else if (SCM_REALP (y))
         {
           double yy = SCM_REAL_VALUE (y);
-          if (xisnan (yy))
+          if (isnan (yy))
             return SCM_BOOL_F;
-          if (xisinf (yy))
+          if (isinf (yy))
             return scm_from_bool (0.0 < yy);
           y = scm_inexact_to_exact (y);  /* with y as frac or int */
           goto again;
@@ -3529,9 +3477,9 @@ scm_num_eq_p (SCM x, SCM y)
           if (SCM_COMPLEX_IMAG (y) != 0.0)
             return SCM_BOOL_F;
           yy = SCM_COMPLEX_REAL (y);
-          if (xisnan (yy))
+          if (isnan (yy))
             return SCM_BOOL_F;
-          if (xisinf (yy))
+          if (isinf (yy))
             return scm_from_bool (0.0 < yy);
           y = scm_inexact_to_exact (y);  /* with y as frac or int */
           goto again;
@@ -3620,7 +3568,7 @@ scm_less_p (SCM x, SCM y)
       else if (SCM_REALP (y))
        {
          int cmp;
-         if (xisnan (SCM_REAL_VALUE (y)))
+         if (isnan (SCM_REAL_VALUE (y)))
            return SCM_BOOL_F;
          cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_REAL_VALUE (y));
          scm_remember_upto_here_1 (x);
@@ -3638,7 +3586,7 @@ scm_less_p (SCM x, SCM y)
       else if (SCM_BIGP (y))
        {
          int cmp;
-         if (xisnan (SCM_REAL_VALUE (x)))
+         if (isnan (SCM_REAL_VALUE (x)))
            return SCM_BOOL_F;
          cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_REAL_VALUE (x));
          scm_remember_upto_here_1 (y);
@@ -3649,9 +3597,9 @@ scm_less_p (SCM x, SCM y)
       else if (SCM_FRACTIONP (y))
         {
           double  xx = SCM_REAL_VALUE (x);
-         if (xisnan (xx))
+         if (isnan (xx))
            return SCM_BOOL_F;
-          if (xisinf (xx))
+          if (isinf (xx))
             return scm_from_bool (xx < 0.0);
           x = scm_inexact_to_exact (x);  /* with x as frac or int */
           goto again;
@@ -3671,9 +3619,9 @@ scm_less_p (SCM x, SCM y)
       else if (SCM_REALP (y))
         {
           double yy = SCM_REAL_VALUE (y);
-          if (xisnan (yy))
+          if (isnan (yy))
             return SCM_BOOL_F;
-          if (xisinf (yy))
+          if (isinf (yy))
             return scm_from_bool (0.0 < yy);
           y = scm_inexact_to_exact (y);  /* with y as frac or int */
           goto again;
@@ -3988,7 +3936,7 @@ scm_max (SCM x, SCM y)
             calling isnan is unavoidable, since it's the only way to know
             which of x or y causes any compares to be false */
          double xx = SCM_REAL_VALUE (x);
-         return (xisnan (xx) || xx > SCM_REAL_VALUE (y)) ? x : y;
+         return (isnan (xx) || xx > SCM_REAL_VALUE (y)) ? x : y;
        }
       else if (SCM_FRACTIONP (y))
        {
@@ -4134,7 +4082,7 @@ scm_min (SCM x, SCM y)
             calling isnan is unavoidable, since it's the only way to know
             which of x or y causes any compares to be false */
          double xx = SCM_REAL_VALUE (x);
-         return (xisnan (xx) || xx < SCM_REAL_VALUE (y)) ? x : y;
+         return (isnan (xx) || xx < SCM_REAL_VALUE (y)) ? x : y;
        }
       else if (SCM_FRACTIONP (y))
        {
@@ -5994,7 +5942,7 @@ SCM_DEFINE (scm_inexact_to_exact, "inexact->exact", 1, 0, 
0,
     return z;
   else if (SCM_REALP (z))
     {
-      if (xisinf (SCM_REAL_VALUE (z)) || xisnan (SCM_REAL_VALUE (z)))
+      if (isinf (SCM_REAL_VALUE (z)) || isnan (SCM_REAL_VALUE (z)))
        SCM_OUT_OF_RANGE (1, z);
       else
        {
@@ -6362,7 +6310,7 @@ scm_num2float (SCM num, unsigned long int pos, const char 
*s_caller)
   if (SCM_BIGP (num))
     {
       float res = mpz_get_d (SCM_I_BIG_MPZ (num));
-      if (!xisinf (res))
+      if (!isinf (res))
        return res;
       else
        scm_out_of_range (NULL, num);
@@ -6380,7 +6328,7 @@ scm_num2double (SCM num, unsigned long int pos, const 
char *s_caller)
   if (SCM_BIGP (num))
     {
       double res = mpz_get_d (SCM_I_BIG_MPZ (num));
-      if (!xisinf (res))
+      if (!isinf (res))
        return res;
       else
        scm_out_of_range (NULL, num);
@@ -6492,7 +6440,8 @@ SCM_DEFINE (scm_log10, "log10", 1, 0, 0,
       /* Mingw has clog() but not clog10().  (Maybe it'd be worth using
          clog() and a multiply by M_LOG10E, rather than the fallback
          log10+hypot+atan2.)  */
-#if HAVE_COMPLEX_DOUBLE && HAVE_CLOG10 && defined (SCM_COMPLEX_VALUE)
+#if defined HAVE_COMPLEX_DOUBLE && defined HAVE_CLOG10 \
+      && defined SCM_COMPLEX_VALUE
       return scm_from_complex_double (clog10 (SCM_COMPLEX_VALUE (z)));
 #else
       double re = SCM_COMPLEX_REAL (z);
@@ -6558,7 +6507,8 @@ SCM_DEFINE (scm_sqrt, "sqrt", 1, 0, 0,
 {
   if (SCM_COMPLEXP (x))
     {
-#if HAVE_COMPLEX_DOUBLE && HAVE_USABLE_CSQRT && defined (SCM_COMPLEX_VALUE)
+#if defined HAVE_COMPLEX_DOUBLE && defined HAVE_USABLE_CSQRT   \
+      && defined SCM_COMPLEX_VALUE
       return scm_from_complex_double (csqrt (SCM_COMPLEX_VALUE (x)));
 #else
       double re = SCM_COMPLEX_REAL (x);
diff --git a/libguile/numbers.h b/libguile/numbers.h
index abb08f0..a69f5af 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -33,24 +33,6 @@ typedef scm_t_int32 scm_t_wchar;
 #define SCM_T_WCHAR_DEFINED
 #endif /* SCM_T_WCHAR_DEFINED */
 
-#if SCM_HAVE_FLOATINGPOINT_H
-# include <floatingpoint.h>
-#endif
-
-#if SCM_HAVE_IEEEFP_H
-# include <ieeefp.h>
-#endif
-
-#if SCM_HAVE_NAN_H
-# if defined (SCO)
-#   define _IEEE 1
-# endif
-# include <nan.h>
-# if defined (SCO)
-#   undef _IEEE
-# endif
-#endif /* SCM_HAVE_NAN_H */
-
 
 
 /* Immediate Numbers, also known as fixnums
diff --git a/m4/check-math-lib.m4 b/m4/check-math-lib.m4
new file mode 100644
index 0000000..e23b3d3
--- /dev/null
+++ b/m4/check-math-lib.m4
@@ -0,0 +1,31 @@
+# check-math-lib.m4 serial 3
+dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl gl_CHECK_MATH_LIB (VARIABLE, EXPRESSION)
+dnl
+dnl Sets the shell VARIABLE according to the libraries needed by EXPRESSION
+dnl to compile and link: to the empty string if no extra libraries are needed,
+dnl to "-lm" if -lm is needed, or to "missing" if it does not compile and
+dnl link either way.
+dnl
+dnl Example: gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);])
+AC_DEFUN([gl_CHECK_MATH_LIB], [
+  save_LIBS=$LIBS
+  $1=missing
+  for libm in "" "-lm"; do
+    LIBS="$save_LIBS $libm"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+         #ifndef __NO_MATH_INLINES
+         # define __NO_MATH_INLINES 1 /* for glibc */
+         #endif
+         #include <math.h>
+         double x;]],
+      [$2])],
+      [$1=$libm
+break])
+  done
+  LIBS=$save_LIBS
+])
diff --git a/m4/exponentd.m4 b/m4/exponentd.m4
new file mode 100644
index 0000000..ad26ddf
--- /dev/null
+++ b/m4/exponentd.m4
@@ -0,0 +1,115 @@
+# exponentd.m4 serial 2
+dnl Copyright (C) 2007-2008, 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION],
+[
+  AC_CACHE_CHECK([where to find the exponent in a 'double'],
+    [gl_cv_cc_double_expbit0],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <float.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#define NWORDS \
+  ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { double value; unsigned int word[NWORDS]; } memory_double;
+static unsigned int ored_words[NWORDS];
+static unsigned int anded_words[NWORDS];
+static void add_to_ored_words (double x)
+{
+  memory_double m;
+  size_t i;
+  /* Clear it first, in case sizeof (double) < sizeof (memory_double).  */
+  memset (&m, 0, sizeof (memory_double));
+  m.value = x;
+  for (i = 0; i < NWORDS; i++)
+    {
+      ored_words[i] |= m.word[i];
+      anded_words[i] &= m.word[i];
+    }
+}
+int main ()
+{
+  size_t j;
+  FILE *fp = fopen ("conftest.out", "w");
+  if (fp == NULL)
+    return 1;
+  for (j = 0; j < NWORDS; j++)
+    anded_words[j] = ~ (unsigned int) 0;
+  add_to_ored_words (0.25);
+  add_to_ored_words (0.5);
+  add_to_ored_words (1.0);
+  add_to_ored_words (2.0);
+  add_to_ored_words (4.0);
+  /* Remove bits that are common (e.g. if representation of the first mantissa
+     bit is explicit).  */
+  for (j = 0; j < NWORDS; j++)
+    ored_words[j] &= ~anded_words[j];
+  /* Now find the nonzero word.  */
+  for (j = 0; j < NWORDS; j++)
+    if (ored_words[j] != 0)
+      break;
+  if (j < NWORDS)
+    {
+      size_t i;
+      for (i = j + 1; i < NWORDS; i++)
+        if (ored_words[i] != 0)
+          {
+            fprintf (fp, "unknown");
+            return (fclose (fp) != 0);
+          }
+      for (i = 0; ; i++)
+        if ((ored_words[j] >> i) & 1)
+          {
+            fprintf (fp, "word %d bit %d", (int) j, (int) i);
+            return (fclose (fp) != 0);
+          }
+    }
+  fprintf (fp, "unknown");
+  return (fclose (fp) != 0);
+}
+        ]])],
+        [gl_cv_cc_double_expbit0=`cat conftest.out`],
+        [gl_cv_cc_double_expbit0="unknown"],
+        [
+          dnl On ARM, there are two 'double' floating-point formats, used by
+          dnl different sets of instructions: The older FPA instructions assume
+          dnl that they are stored in big-endian word order, while the words
+          dnl (like integer types) are stored in little-endian byte order.
+          dnl The newer VFP instructions assume little-endian order 
consistenly.
+          AC_EGREP_CPP([mixed_endianness], [
+#if defined arm || defined __arm || defined __arm__
+  mixed_endianness
+#endif
+            ],
+            [gl_cv_cc_double_expbit0="unknown"],
+            [
+              pushdef([AC_MSG_CHECKING],[:])dnl
+              pushdef([AC_MSG_RESULT],[:])dnl
+              pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl
+              AC_C_BIGENDIAN(
+                [gl_cv_cc_double_expbit0="word 0 bit 20"],
+                [gl_cv_cc_double_expbit0="word 1 bit 20"],
+                [gl_cv_cc_double_expbit0="unknown"])
+              popdef([AC_MSG_RESULT_UNQUOTED])dnl
+              popdef([AC_MSG_RESULT])dnl
+              popdef([AC_MSG_CHECKING])dnl
+            ])
+        ])
+      rm -f conftest.out
+    ])
+  case "$gl_cv_cc_double_expbit0" in
+    word*bit*)
+      word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ 
bit.*//'`
+      bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'`
+      AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word],
+        [Define as the word index where to find the exponent of 'double'.])
+      AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit],
+        [Define as the bit index in the word where to find bit 0 of the 
exponent of 'double'.])
+      ;;
+  esac
+])
diff --git a/m4/exponentf.m4 b/m4/exponentf.m4
new file mode 100644
index 0000000..34cf197
--- /dev/null
+++ b/m4/exponentf.m4
@@ -0,0 +1,92 @@
+# exponentf.m4 serial 2
+dnl Copyright (C) 2007-2008, 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+AC_DEFUN([gl_FLOAT_EXPONENT_LOCATION],
+[
+  AC_CACHE_CHECK([where to find the exponent in a 'float'],
+    [gl_cv_cc_float_expbit0],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <float.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#define NWORDS \
+  ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { float value; unsigned int word[NWORDS]; } memory_float;
+static unsigned int ored_words[NWORDS];
+static unsigned int anded_words[NWORDS];
+static void add_to_ored_words (float x)
+{
+  memory_float m;
+  size_t i;
+  /* Clear it first, in case
+     sizeof (float) < sizeof (memory_float).  */
+  memset (&m, 0, sizeof (memory_float));
+  m.value = x;
+  for (i = 0; i < NWORDS; i++)
+    {
+      ored_words[i] |= m.word[i];
+      anded_words[i] &= m.word[i];
+    }
+}
+int main ()
+{
+  size_t j;
+  FILE *fp = fopen ("conftest.out", "w");
+  if (fp == NULL)
+    return 1;
+  for (j = 0; j < NWORDS; j++)
+    anded_words[j] = ~ (unsigned int) 0;
+  add_to_ored_words (0.25f);
+  add_to_ored_words (0.5f);
+  add_to_ored_words (1.0f);
+  add_to_ored_words (2.0f);
+  add_to_ored_words (4.0f);
+  /* Remove bits that are common (e.g. if representation of the first mantissa
+     bit is explicit).  */
+  for (j = 0; j < NWORDS; j++)
+    ored_words[j] &= ~anded_words[j];
+  /* Now find the nonzero word.  */
+  for (j = 0; j < NWORDS; j++)
+    if (ored_words[j] != 0)
+      break;
+  if (j < NWORDS)
+    {
+      size_t i;
+      for (i = j + 1; i < NWORDS; i++)
+        if (ored_words[i] != 0)
+          {
+            fprintf (fp, "unknown");
+            return (fclose (fp) != 0);
+          }
+      for (i = 0; ; i++)
+        if ((ored_words[j] >> i) & 1)
+          {
+            fprintf (fp, "word %d bit %d", (int) j, (int) i);
+            return (fclose (fp) != 0);
+          }
+    }
+  fprintf (fp, "unknown");
+  return (fclose (fp) != 0);
+}
+        ]])],
+        [gl_cv_cc_float_expbit0=`cat conftest.out`],
+        [gl_cv_cc_float_expbit0="unknown"],
+        [gl_cv_cc_float_expbit0="word 0 bit 23"])
+      rm -f conftest.out
+    ])
+  case "$gl_cv_cc_float_expbit0" in
+    word*bit*)
+      word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ 
bit.*//'`
+      bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'`
+      AC_DEFINE_UNQUOTED([FLT_EXPBIT0_WORD], [$word],
+        [Define as the word index where to find the exponent of 'float'.])
+      AC_DEFINE_UNQUOTED([FLT_EXPBIT0_BIT], [$bit],
+        [Define as the bit index in the word where to find bit 0 of the 
exponent of 'float'.])
+      ;;
+  esac
+])
diff --git a/m4/exponentl.m4 b/m4/exponentl.m4
new file mode 100644
index 0000000..b625fea
--- /dev/null
+++ b/m4/exponentl.m4
@@ -0,0 +1,98 @@
+# exponentl.m4 serial 3
+dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+AC_DEFUN([gl_LONG_DOUBLE_EXPONENT_LOCATION],
+[
+  AC_REQUIRE([gl_BIGENDIAN])
+  AC_CACHE_CHECK([where to find the exponent in a 'long double'],
+    [gl_cv_cc_long_double_expbit0],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <float.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#define NWORDS \
+  ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { long double value; unsigned int word[NWORDS]; }
+        memory_long_double;
+static unsigned int ored_words[NWORDS];
+static unsigned int anded_words[NWORDS];
+static void add_to_ored_words (long double x)
+{
+  memory_long_double m;
+  size_t i;
+  /* Clear it first, in case
+     sizeof (long double) < sizeof (memory_long_double).  */
+  memset (&m, 0, sizeof (memory_long_double));
+  m.value = x;
+  for (i = 0; i < NWORDS; i++)
+    {
+      ored_words[i] |= m.word[i];
+      anded_words[i] &= m.word[i];
+    }
+}
+int main ()
+{
+  size_t j;
+  FILE *fp = fopen ("conftest.out", "w");
+  if (fp == NULL)
+    return 1;
+  for (j = 0; j < NWORDS; j++)
+    anded_words[j] = ~ (unsigned int) 0;
+  add_to_ored_words (0.25L);
+  add_to_ored_words (0.5L);
+  add_to_ored_words (1.0L);
+  add_to_ored_words (2.0L);
+  add_to_ored_words (4.0L);
+  /* Remove bits that are common (e.g. if representation of the first mantissa
+     bit is explicit).  */
+  for (j = 0; j < NWORDS; j++)
+    ored_words[j] &= ~anded_words[j];
+  /* Now find the nonzero word.  */
+  for (j = 0; j < NWORDS; j++)
+    if (ored_words[j] != 0)
+      break;
+  if (j < NWORDS)
+    {
+      size_t i;
+      for (i = j + 1; i < NWORDS; i++)
+        if (ored_words[i] != 0)
+          {
+            fprintf (fp, "unknown");
+            return (fclose (fp) != 0);
+          }
+      for (i = 0; ; i++)
+        if ((ored_words[j] >> i) & 1)
+          {
+            fprintf (fp, "word %d bit %d", (int) j, (int) i);
+            return (fclose (fp) != 0);
+          }
+    }
+  fprintf (fp, "unknown");
+  return (fclose (fp) != 0);
+}
+        ]])],
+        [gl_cv_cc_long_double_expbit0=`cat conftest.out`],
+        [gl_cv_cc_long_double_expbit0="unknown"],
+        [
+          dnl When cross-compiling, we don't know. It depends on the
+          dnl ABI and compiler version. There are too many cases.
+          gl_cv_cc_long_double_expbit0="unknown"
+        ])
+      rm -f conftest.out
+    ])
+  case "$gl_cv_cc_long_double_expbit0" in
+    word*bit*)
+      word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ 
bit.*//'`
+      bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'`
+      AC_DEFINE_UNQUOTED([LDBL_EXPBIT0_WORD], [$word],
+        [Define as the word index where to find the exponent of 'long 
double'.])
+      AC_DEFINE_UNQUOTED([LDBL_EXPBIT0_BIT], [$bit],
+        [Define as the bit index in the word where to find bit 0 of the 
exponent of 'long double'.])
+      ;;
+  esac
+])
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index 9c59c62..accf0c3 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -10,12 +10,12 @@
 #
 # This file represents the specification of how gnulib-tool is used.
 # It acts as a cache: It is written and read by gnulib-tool.
-# In projects using CVS, this file is meant to be stored in CVS,
-# like the configure.ac and various Makefile.am files.
+# In projects that use version control, this file is meant to be put under
+# version control, like the configure.ac and various Makefile.am files.
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 
--doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool 
--macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild 
byteswap canonicalize-lgpl duplocale environ extensions flock fpieee full-read 
full-write func gendocs getaddrinfo git-version-gen gitlog-to-changelog 
gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton 
lib-symbol-versions lib-symbol-visibility libunistring locale 
maintainer-makefile putenv stat-time stdlib strcase strftime striconveh string 
sys_stat verify version-etc-fsf vsnprintf warnings
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 
--doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool 
--macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild 
byteswap canonicalize-lgpl duplocale environ extensions flock fpieee full-read 
full-write func gendocs getaddrinfo git-version-gen gitlog-to-changelog 
gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf 
isnan lib-symbol-versions lib-symbol-visibility libunistring locale 
maintainer-makefile putenv stat-time stdlib strcase strftime striconveh string 
sys_stat verify version-etc-fsf vsnprintf warnings
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
@@ -44,6 +44,8 @@ gl_MODULES([
   iconv_open-utf
   inet_ntop
   inet_pton
+  isinf
+  isnan
   lib-symbol-versions
   lib-symbol-visibility
   libunistring
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 37f95ce..10b34fc 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -12,7 +12,8 @@
 # This file represents the compiled summary of the specification in
 # gnulib-cache.m4. It lists the computed macro invocations that need
 # to be invoked from configure.ac.
-# In projects using CVS, this file can be treated like other built files.
+# In projects that use version control, this file can be treated like
+# other built files.
 
 
 # This macro should be invoked from ./configure.ac, in the section
@@ -71,6 +72,11 @@ AC_DEFUN([gl_EARLY],
   # Code from module inet_ntop:
   # Code from module inet_pton:
   # Code from module inline:
+  # Code from module isinf:
+  # Code from module isnan:
+  # Code from module isnand:
+  # Code from module isnanf:
+  # Code from module isnanl:
   # Code from module lib-symbol-versions:
   # Code from module lib-symbol-visibility:
   # Code from module libunistring:
@@ -80,6 +86,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module maintainer-makefile:
   # Code from module malloc-posix:
   # Code from module malloca:
+  # Code from module math:
   # Code from module mbrlen:
   # Code from module mbrtowc:
   # Code from module mbsinit:
@@ -241,6 +248,21 @@ AC_DEFUN([gl_INIT],
   gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
   # Code from module inline:
   gl_INLINE
+  # Code from module isinf:
+  gl_ISINF
+  gl_MATH_MODULE_INDICATOR([isinf])
+  # Code from module isnan:
+  gl_ISNAN
+  gl_MATH_MODULE_INDICATOR([isnan])
+  # Code from module isnand:
+  gl_FUNC_ISNAND
+  gl_MATH_MODULE_INDICATOR([isnand])
+  # Code from module isnanf:
+  gl_FUNC_ISNANF
+  gl_MATH_MODULE_INDICATOR([isnanf])
+  # Code from module isnanl:
+  gl_FUNC_ISNANL
+  gl_MATH_MODULE_INDICATOR([isnanl])
   # Code from module lib-symbol-versions:
   gl_LD_VERSION_SCRIPT
   # Code from module lib-symbol-visibility:
@@ -264,6 +286,8 @@ AC_DEFUN([gl_INIT],
   gl_STDLIB_MODULE_INDICATOR([malloc-posix])
   # Code from module malloca:
   gl_MALLOCA
+  # Code from module math:
+  gl_MATH_H
   # Code from module mbrlen:
   gl_FUNC_MBRLEN
   gl_WCHAR_MODULE_INDICATOR([mbrlen])
@@ -581,6 +605,11 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/iconveh.h
   lib/inet_ntop.c
   lib/inet_pton.c
+  lib/isinf.c
+  lib/isnan.c
+  lib/isnand.c
+  lib/isnanf.c
+  lib/isnanl.c
   lib/libunistring.valgrind
   lib/localcharset.c
   lib/localcharset.h
@@ -590,6 +619,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/malloca.c
   lib/malloca.h
   lib/malloca.valgrind
+  lib/math.in.h
   lib/mbrlen.c
   lib/mbrtowc.c
   lib/mbsinit.c
@@ -664,6 +694,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/autobuild.m4
   m4/byteswap.m4
   m4/canonicalize.m4
+  m4/check-math-lib.m4
   m4/codeset.m4
   m4/dos.m4
   m4/double-slash-root.m4
@@ -671,6 +702,9 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/eealloc.m4
   m4/environ.m4
   m4/errno_h.m4
+  m4/exponentd.m4
+  m4/exponentf.m4
+  m4/exponentl.m4
   m4/extensions.m4
   m4/fcntl-o.m4
   m4/float_h.m4
@@ -690,6 +724,11 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/inline.m4
   m4/intmax_t.m4
   m4/inttypes_h.m4
+  m4/isinf.m4
+  m4/isnan.m4
+  m4/isnand.m4
+  m4/isnanf.m4
+  m4/isnanl.m4
   m4/ld-version-script.m4
   m4/lib-ld.m4
   m4/lib-link.m4
@@ -705,6 +744,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/lstat.m4
   m4/malloc.m4
   m4/malloca.m4
+  m4/math_h.m4
   m4/mbrlen.m4
   m4/mbrtowc.m4
   m4/mbsinit.m4
diff --git a/m4/isinf.m4 b/m4/isinf.m4
new file mode 100644
index 0000000..6a24123
--- /dev/null
+++ b/m4/isinf.m4
@@ -0,0 +1,48 @@
+# isinf.m4 serial 3
+dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_ISINF],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare isinf.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_DECLS([isinf], , , [#include <math.h>])
+  if test "$ac_cv_have_decl_isinf" = yes; then
+    gl_CHECK_MATH_LIB([ISINF_LIBM], [x = isinf (x);])
+    if test "$ISINF_LIBM" != missing; then
+      dnl Test whether isinf() on 'long double' works.
+      gl_ISINFL_WORKS
+      case "$gl_cv_func_isinfl_works" in
+        *yes) ;;
+        *)    ISINF_LIBM=missing;;
+      esac
+    fi
+  fi
+  if test "$ac_cv_have_decl_isinf" != yes ||
+     test "$ISINF_LIBM" = missing; then
+    REPLACE_ISINF=1
+    AC_LIBOBJ([isinf])
+    ISINF_LIBM=
+  fi
+  AC_SUBST([ISINF_LIBM])
+])
+
+dnl Test whether isinf() correctly returns false for LDBL_MAX.
+AC_DEFUN([gl_ISINFL_WORKS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gl_BIGENDIAN])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether isinf(long double) works], [gl_cv_func_isinfl_works],
+    [
+      AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <float.h>
+                                       #include <math.h>]],
+                                     [[return !!isinf(LDBL_MAX);]])],
+                    [gl_cv_func_isinfl_works=yes],
+                    [gl_cv_func_isinfl_works=no],
+                    [gl_cv_func_isinfl_works="guessing no"])
+    ])
+])
diff --git a/m4/isnan.m4 b/m4/isnan.m4
new file mode 100644
index 0000000..eb61d56
--- /dev/null
+++ b/m4/isnan.m4
@@ -0,0 +1,47 @@
+# isnan.m4 serial 3
+dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_ISNAN],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_ISNANF])
+  AC_REQUIRE([gl_FUNC_ISNAND])
+  AC_REQUIRE([gl_FUNC_ISNANL])
+
+  # If we replaced any of the underlying isnan* functions, replace
+  # the isnan macro; it undoubtedly suffers from the same flaws.
+  AC_MSG_CHECKING([whether isnan macro works])
+  if test $gl_func_isnanf = yes \
+     && test $gl_func_isnand = yes \
+     && test $gl_func_isnanl = yes; then
+    AC_MSG_RESULT([yes])
+    ISNAN_LIBM=
+    dnl Append $ISNANF_LIBM to ISNAN_LIBM, avoiding gratuitous duplicates.
+    case " $ISNAN_LIBM " in
+      *" $ISNANF_LIBM "*) ;;
+      *) ISNAN_LIBM="$ISNAN_LIBM $ISNANF_LIBM" ;;
+    esac
+    dnl Append $ISNAND_LIBM to ISNAN_LIBM, avoiding gratuitous duplicates.
+    case " $ISNAN_LIBM " in
+      *" $ISNAND_LIBM "*) ;;
+      *) ISNAN_LIBM="$ISNAN_LIBM $ISNAND_LIBM" ;;
+    esac
+    dnl Append $ISNANL_LIBM to ISNAN_LIBM, avoiding gratuitous duplicates.
+    case " $ISNAN_LIBM " in
+      *" $ISNANL_LIBM "*) ;;
+      *) ISNAN_LIBM="$ISNAN_LIBM $ISNANL_LIBM" ;;
+    esac
+  else
+    AC_MSG_RESULT([no])
+    REPLACE_ISNAN=1
+    # Make sure the rpl_isnan[fdl] functions get built.
+    gl_BUILD_ISNANF
+    gl_BUILD_ISNAND
+    gl_BUILD_ISNANL
+    ISNAN_LIBM=
+  fi
+  AC_SUBST([ISNAN_LIBM])
+])
diff --git a/m4/isnand.m4 b/m4/isnand.m4
new file mode 100644
index 0000000..31764f7
--- /dev/null
+++ b/m4/isnand.m4
@@ -0,0 +1,99 @@
+# isnand.m4 serial 7
+dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Check how to get or define isnand().
+
+AC_DEFUN([gl_FUNC_ISNAND],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  ISNAND_LIBM=
+  gl_HAVE_ISNAND_NO_LIBM
+  if test $gl_cv_func_isnand_no_libm = no; then
+    gl_HAVE_ISNAND_IN_LIBM
+    if test $gl_cv_func_isnand_in_libm = yes; then
+      ISNAND_LIBM=-lm
+    fi
+  fi
+  dnl The variable gl_func_isnand set here is used by isnan.m4.
+  if test $gl_cv_func_isnand_no_libm = yes \
+     || test $gl_cv_func_isnand_in_libm = yes; then
+    gl_func_isnand=yes
+  else
+    gl_func_isnand=no
+    HAVE_ISNAND=0
+    gl_BUILD_ISNAND
+  fi
+  AC_SUBST([ISNAND_LIBM])
+])
+
+dnl Check how to get or define isnand() without linking with libm.
+
+AC_DEFUN([gl_FUNC_ISNAND_NO_LIBM],
+[
+  gl_HAVE_ISNAND_NO_LIBM
+  if test $gl_cv_func_isnand_no_libm = yes; then
+    AC_DEFINE([HAVE_ISNAND_IN_LIBC], [1],
+      [Define if the isnan(double) function is available in libc.])
+  else
+    gl_BUILD_ISNAND
+  fi
+])
+
+dnl Pull in replacement isnand definition. It does not need -lm.
+AC_DEFUN([gl_BUILD_ISNAND],
+[
+  AC_LIBOBJ([isnand])
+  gl_DOUBLE_EXPONENT_LOCATION
+])
+
+dnl Test whether isnand() can be used with libm.
+
+AC_DEFUN([gl_HAVE_ISNAND_IN_LIBM],
+[
+  AC_CACHE_CHECK([whether isnan(double) can be used with libm],
+    [gl_cv_func_isnand_in_libm],
+    [
+      save_LIBS="$LIBS"
+      LIBS="$LIBS -lm"
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             #if __GNUC__ >= 4
+             # undef isnand
+             # define isnand(x) __builtin_isnand ((double)(x))
+             #elif defined isnan
+             # undef isnand
+             # define isnand(x) isnan ((double)(x))
+             #endif
+             double x;]],
+           [[return isnand (x);]])],
+        [gl_cv_func_isnand_in_libm=yes],
+        [gl_cv_func_isnand_in_libm=no])
+      LIBS="$save_LIBS"
+    ])
+])
+
+AC_DEFUN([gl_HAVE_ISNAND_NO_LIBM],
+[
+  AC_CACHE_CHECK([whether isnan(double) can be used without linking with libm],
+    [gl_cv_func_isnand_no_libm],
+    [
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             #if __GNUC__ >= 4
+             # undef isnand
+             # define isnand(x) __builtin_isnan ((double)(x))
+             #else
+             # undef isnand
+             # define isnand(x) isnan ((double)(x))
+             #endif
+             double x;]],
+           [[return isnand (x);]])],
+        [gl_cv_func_isnand_no_libm=yes],
+        [gl_cv_func_isnand_no_libm=no])
+    ])
+])
diff --git a/m4/isnanf.m4 b/m4/isnanf.m4
new file mode 100644
index 0000000..c040090
--- /dev/null
+++ b/m4/isnanf.m4
@@ -0,0 +1,186 @@
+# isnanf.m4 serial 11
+dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Check how to get or define isnanf().
+
+AC_DEFUN([gl_FUNC_ISNANF],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  ISNANF_LIBM=
+  gl_HAVE_ISNANF_NO_LIBM
+  if test $gl_cv_func_isnanf_no_libm = no; then
+    gl_HAVE_ISNANF_IN_LIBM
+    if test $gl_cv_func_isnanf_in_libm = yes; then
+      ISNANF_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_isnanf_no_libm = yes \
+     || test $gl_cv_func_isnanf_in_libm = yes; then
+    save_LIBS="$LIBS"
+    LIBS="$LIBS $ISNANF_LIBM"
+    gl_ISNANF_WORKS
+    LIBS="$save_LIBS"
+    case "$gl_cv_func_isnanf_works" in
+      *yes) gl_func_isnanf=yes ;;
+      *)    gl_func_isnanf=no; ISNANF_LIBM= ;;
+    esac
+  else
+    gl_func_isnanf=no
+  fi
+  if test $gl_func_isnanf != yes; then
+    HAVE_ISNANF=0
+    gl_BUILD_ISNANF
+  fi
+  AC_SUBST([ISNANF_LIBM])
+])
+
+dnl Check how to get or define isnanf() without linking with libm.
+
+AC_DEFUN([gl_FUNC_ISNANF_NO_LIBM],
+[
+  gl_HAVE_ISNANF_NO_LIBM
+  if test $gl_cv_func_isnanf_no_libm = yes; then
+    gl_ISNANF_WORKS
+  fi
+  if test $gl_cv_func_isnanf_no_libm = yes \
+     && { case "$gl_cv_func_isnanf_works" in
+            *yes) true;;
+            *) false;;
+          esac
+        }; then
+    AC_DEFINE([HAVE_ISNANF_IN_LIBC], [1],
+      [Define if the isnan(float) function is available in libc.])
+  else
+    gl_BUILD_ISNANF
+  fi
+])
+
+dnl Pull in replacement isnanf definition. It does not need -lm.
+AC_DEFUN([gl_BUILD_ISNANF],
+[
+  AC_LIBOBJ([isnanf])
+  gl_FLOAT_EXPONENT_LOCATION
+])
+
+dnl Test whether isnanf() can be used without libm.
+AC_DEFUN([gl_HAVE_ISNANF_NO_LIBM],
+[
+  AC_CACHE_CHECK([whether isnan(float) can be used without linking with libm],
+    [gl_cv_func_isnanf_no_libm],
+    [
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             #if __GNUC__ >= 4
+             # undef isnanf
+             # define isnanf(x) __builtin_isnanf ((float)(x))
+             #elif defined isnan
+             # undef isnanf
+             # define isnanf(x) isnan ((float)(x))
+             #endif
+             float x;]],
+           [[return isnanf (x);]])],
+        [gl_cv_func_isnanf_no_libm=yes],
+        [gl_cv_func_isnanf_no_libm=no])
+    ])
+])
+
+dnl Test whether isnanf() can be used with libm.
+AC_DEFUN([gl_HAVE_ISNANF_IN_LIBM],
+[
+  AC_CACHE_CHECK([whether isnan(float) can be used with libm],
+    [gl_cv_func_isnanf_in_libm],
+    [
+      save_LIBS="$LIBS"
+      LIBS="$LIBS -lm"
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             #if __GNUC__ >= 4
+             # undef isnanf
+             # define isnanf(x) __builtin_isnanf ((float)(x))
+             #elif defined isnan
+             # undef isnanf
+             # define isnanf(x) isnan ((float)(x))
+             #endif
+             float x;]],
+           [[return isnanf (x);]])],
+        [gl_cv_func_isnanf_in_libm=yes],
+        [gl_cv_func_isnanf_in_libm=no])
+      LIBS="$save_LIBS"
+    ])
+])
+
+dnl Test whether isnanf() rejects Infinity (this fails on Solaris 2.5.1),
+dnl recognizes a NaN (this fails on IRIX 6.5 with cc), and recognizes a NaN
+dnl with in-memory representation 0x7fbfffff (this fails on IRIX 6.5).
+AC_DEFUN([gl_ISNANF_WORKS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_REQUIRE([gl_FLOAT_EXPONENT_LOCATION])
+  AC_CACHE_CHECK([whether isnan(float) works], [gl_cv_func_isnanf_works],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <math.h>
+#if __GNUC__ >= 4
+# undef isnanf
+# define isnanf(x) __builtin_isnanf ((float)(x))
+#elif defined isnan
+# undef isnanf
+# define isnanf(x) isnan ((float)(x))
+#endif
+/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0.  */
+#ifdef __DECC
+static float
+NaN ()
+{
+  static float zero = 0.0f;
+  return zero / zero;
+}
+#else
+# define NaN() (0.0f / 0.0f)
+#endif
+#define NWORDS \
+  ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { unsigned int word[NWORDS]; float value; } memory_float;
+int main()
+{
+  memory_float m;
+
+  if (isnanf (1.0f / 0.0f))
+    return 1;
+
+  if (!isnanf (NaN ()))
+    return 1;
+
+#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT
+  /* The isnanf function should be immune against changes in the sign bit and
+     in the mantissa bits.  The xor operation twiddles a bit that can only be
+     a sign bit or a mantissa bit.  */
+  if (FLT_EXPBIT0_WORD == 0 && FLT_EXPBIT0_BIT > 0)
+    {
+      m.value = NaN ();
+      /* Set the bits below the exponent to 01111...111.  */
+      m.word[0] &= -1U << FLT_EXPBIT0_BIT;
+      m.word[0] |= 1U << (FLT_EXPBIT0_BIT - 1) - 1;
+      if (!isnanf (m.value))
+        return 1;
+    }
+#endif
+
+  return 0;
+}]])],
+        [gl_cv_func_isnanf_works=yes],
+        [gl_cv_func_isnanf_works=no],
+        [case "$host_os" in
+           irix* | solaris*) gl_cv_func_isnanf_works="guessing no";;
+           *)                gl_cv_func_isnanf_works="guessing yes";;
+         esac
+        ])
+    ])
+])
diff --git a/m4/isnanl.m4 b/m4/isnanl.m4
new file mode 100644
index 0000000..de7eafb
--- /dev/null
+++ b/m4/isnanl.m4
@@ -0,0 +1,252 @@
+# isnanl.m4 serial 13
+dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_ISNANL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  ISNANL_LIBM=
+  gl_HAVE_ISNANL_NO_LIBM
+  if test $gl_cv_func_isnanl_no_libm = no; then
+    gl_HAVE_ISNANL_IN_LIBM
+    if test $gl_cv_func_isnanl_in_libm = yes; then
+      ISNANL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_isnanl_no_libm = yes \
+     || test $gl_cv_func_isnanl_in_libm = yes; then
+    save_LIBS="$LIBS"
+    LIBS="$LIBS $ISNANL_LIBM"
+    gl_FUNC_ISNANL_WORKS
+    LIBS="$save_LIBS"
+    case "$gl_cv_func_isnanl_works" in
+      *yes) gl_func_isnanl=yes ;;
+      *)    gl_func_isnanl=no; ISNANL_LIBM= ;;
+    esac
+  else
+    gl_func_isnanl=no
+  fi
+  if test $gl_func_isnanl != yes; then
+    HAVE_ISNANL=0
+    gl_BUILD_ISNANL
+  fi
+  AC_SUBST([ISNANL_LIBM])
+])
+
+AC_DEFUN([gl_FUNC_ISNANL_NO_LIBM],
+[
+  gl_HAVE_ISNANL_NO_LIBM
+  gl_func_isnanl_no_libm=$gl_cv_func_isnanl_no_libm
+  if test $gl_func_isnanl_no_libm = yes; then
+    gl_FUNC_ISNANL_WORKS
+    case "$gl_cv_func_isnanl_works" in
+      *yes) ;;
+      *)    gl_func_isnanl_no_libm=no ;;
+    esac
+  fi
+  if test $gl_func_isnanl_no_libm = yes; then
+    AC_DEFINE([HAVE_ISNANL_IN_LIBC], [1],
+      [Define if the isnan(long double) function is available in libc.])
+  else
+    gl_BUILD_ISNANL
+  fi
+])
+
+dnl Pull in replacement isnanl definition. It does not need -lm.
+AC_DEFUN([gl_BUILD_ISNANL],
+[
+  AC_LIBOBJ([isnanl])
+  gl_LONG_DOUBLE_EXPONENT_LOCATION
+])
+
+dnl Test whether isnanl() can be used without libm.
+AC_DEFUN([gl_HAVE_ISNANL_NO_LIBM],
+[
+  AC_CACHE_CHECK([whether isnan(long double) can be used without linking with 
libm],
+    [gl_cv_func_isnanl_no_libm],
+    [
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             #if __GNUC__ >= 4
+             # undef isnanl
+             # define isnanl(x) __builtin_isnanl ((long double)(x))
+             #elif defined isnan
+             # undef isnanl
+             # define isnanl(x) isnan ((long double)(x))
+             #endif
+             long double x;]],
+           [[return isnanl (x);]])],
+        [gl_cv_func_isnanl_no_libm=yes],
+        [gl_cv_func_isnanl_no_libm=no])
+    ])
+])
+
+dnl Test whether isnanl() can be used with libm.
+AC_DEFUN([gl_HAVE_ISNANL_IN_LIBM],
+[
+  AC_CACHE_CHECK([whether isnan(long double) can be used with libm],
+    [gl_cv_func_isnanl_in_libm],
+    [
+      save_LIBS="$LIBS"
+      LIBS="$LIBS -lm"
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[#include <math.h>
+             #if __GNUC__ >= 4
+             # undef isnanl
+             # define isnanl(x) __builtin_isnanl ((long double)(x))
+             #elif defined isnan
+             # undef isnanl
+             # define isnanl(x) isnan ((long double)(x))
+             #endif
+             long double x;]],
+           [[return isnanl (x);]])],
+        [gl_cv_func_isnanl_in_libm=yes],
+        [gl_cv_func_isnanl_in_libm=no])
+      LIBS="$save_LIBS"
+    ])
+])
+
+dnl Test whether isnanl() recognizes all numbers which are neither finite nor
+dnl infinite. This test fails e.g. on NetBSD/i386 and on glibc/ia64.
+dnl Also, the GCC >= 4.0 built-in __builtin_isnanl does not pass the tests
+dnl - for pseudo-denormals on i686 and x86_64,
+dnl - for pseudo-zeroes, unnormalized numbers, and pseudo-denormals on ia64.
+AC_DEFUN([gl_FUNC_ISNANL_WORKS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([gl_BIGENDIAN])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether isnanl works], [gl_cv_func_isnanl_works],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <float.h>
+#include <limits.h>
+#include <math.h>
+#if __GNUC__ >= 4
+# undef isnanl
+# define isnanl(x) __builtin_isnanl ((long double)(x))
+#elif defined isnan
+# undef isnanl
+# define isnanl(x) isnan ((long double)(x))
+#endif
+#define NWORDS \
+  ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+typedef union { unsigned int word[NWORDS]; long double value; }
+        memory_long_double;
+/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the
+   runtime type conversion.  */
+#ifdef __sgi
+static long double NaNl ()
+{
+  double zero = 0.0;
+  return zero / zero;
+}
+#else
+# define NaNl() (0.0L / 0.0L)
+#endif
+int main ()
+{
+  memory_long_double m;
+  unsigned int i;
+
+  if (!isnanl (NaNl ()))
+    return 1;
+
+  /* The isnanl function should be immune against changes in the sign bit and
+     in the mantissa bits.  The xor operation twiddles a bit that can only be
+     a sign bit or a mantissa bit (since the exponent never extends to
+     bit 31).  */
+  m.value = NaNl ();
+  m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT 
- 1);
+  for (i = 0; i < NWORDS; i++)
+    m.word[i] |= 1;
+  if (!isnanl (m.value))
+    return 1;
+
+#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined 
__amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined 
_M_IX86 || defined _X86_))
+/* Representation of an 80-bit 'long double' as an initializer for a sequence
+   of 'unsigned int' words.  */
+# ifdef WORDS_BIGENDIAN
+#  define LDBL80_WORDS(exponent,manthi,mantlo) \
+     { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \
+       ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16),    \
+       (unsigned int) (mantlo) << 16                                        \
+     }
+# else
+#  define LDBL80_WORDS(exponent,manthi,mantlo) \
+     { mantlo, manthi, exponent }
+# endif
+  { /* Quiet NaN.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
+    if (!isnanl (x.value))
+      return 1;
+  }
+  {
+    /* Signalling NaN.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
+    if (!isnanl (x.value))
+      return 1;
+  }
+  /* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities,
+     Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in
+       Intel IA-64 Architecture Software Developer's Manual, Volume 1:
+       Application Architecture.
+       Table 5-2 "Floating-Point Register Encodings"
+       Figure 5-6 "Memory to Floating-Point Register Data Translation"
+   */
+  { /* Pseudo-NaN.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
+    if (!isnanl (x.value))
+      return 1;
+  }
+  { /* Pseudo-Infinity.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
+    if (!isnanl (x.value))
+      return 1;
+  }
+  { /* Pseudo-Zero.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
+    if (!isnanl (x.value))
+      return 1;
+  }
+  { /* Unnormalized number.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
+    if (!isnanl (x.value))
+      return 1;
+  }
+  { /* Pseudo-Denormal.  */
+    static memory_long_double x =
+      { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
+    if (!isnanl (x.value))
+      return 1;
+  }
+#endif
+
+  return 0;
+}]])],
+        [gl_cv_func_isnanl_works=yes],
+        [gl_cv_func_isnanl_works=no],
+        [case "$host_cpu" in
+                                 # Guess no on ia64, x86_64, i386.
+           ia64 | x86_64 | i*86) gl_cv_func_isnanl_works="guessing no";;
+           *)
+             case "$host_os" in
+               netbsd*) gl_cv_func_isnanl_works="guessing no";;
+               *)       gl_cv_func_isnanl_works="guessing yes";;
+             esac
+             ;;
+         esac
+        ])
+    ])
+])
diff --git a/m4/math_h.m4 b/m4/math_h.m4
new file mode 100644
index 0000000..2d89ca3
--- /dev/null
+++ b/m4/math_h.m4
@@ -0,0 +1,140 @@
+# math_h.m4 serial 21
+dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_MATH_H],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  gl_CHECK_NEXT_HEADERS([math.h])
+  AC_REQUIRE([AC_C_INLINE])
+
+  AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(address@hidden:@include <math.h>]],
+      [[/* Solaris 10 has a broken definition of NAN.  Other platforms
+        fail to provide NAN, or provide it only in C99 mode; this
+        test only needs to fail when NAN is provided but wrong.  */
+         float f = 1.0f;
+#ifdef NAN
+         f = NAN;
+#endif
+         return f == 0;]])],
+      [gl_cv_header_math_nan_works=yes],
+      [gl_cv_header_math_nan_works=no])])
+  if test $gl_cv_header_math_nan_works = no; then
+    REPLACE_NAN=1
+  fi
+  AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(address@hidden:@include <math.h>]],
+      [[/* Solaris 10 has a broken definition of HUGE_VAL.  */
+         double d = HUGE_VAL;
+         return d == 0;]])],
+      [gl_cv_header_math_huge_val_works=yes],
+      [gl_cv_header_math_huge_val_works=no])])
+  if test $gl_cv_header_math_huge_val_works = no; then
+    REPLACE_HUGE_VAL=1
+  fi
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <math.h>
+    ]], [acosl asinl atanl ceilf ceill cosl expl floorf floorl frexpl
+    ldexpl logb logl round roundf roundl sinl sqrtl tanl trunc truncf truncl])
+])
+
+AC_DEFUN([gl_MATH_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+AC_DEFUN([gl_MATH_H_DEFAULTS],
+[
+  GNULIB_ACOSL=0;    AC_SUBST([GNULIB_ACOSL])
+  GNULIB_ASINL=0;    AC_SUBST([GNULIB_ASINL])
+  GNULIB_ATANL=0;    AC_SUBST([GNULIB_ATANL])
+  GNULIB_CEILF=0;    AC_SUBST([GNULIB_CEILF])
+  GNULIB_CEILL=0;    AC_SUBST([GNULIB_CEILL])
+  GNULIB_COSL=0;     AC_SUBST([GNULIB_COSL])
+  GNULIB_EXPL=0;     AC_SUBST([GNULIB_EXPL])
+  GNULIB_FLOORF=0;   AC_SUBST([GNULIB_FLOORF])
+  GNULIB_FLOORL=0;   AC_SUBST([GNULIB_FLOORL])
+  GNULIB_FREXP=0;    AC_SUBST([GNULIB_FREXP])
+  GNULIB_FREXPL=0;   AC_SUBST([GNULIB_FREXPL])
+  GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE])
+  GNULIB_ISINF=0;    AC_SUBST([GNULIB_ISINF])
+  GNULIB_ISNAN=0;    AC_SUBST([GNULIB_ISNAN])
+  GNULIB_ISNANF=0;   AC_SUBST([GNULIB_ISNANF])
+  GNULIB_ISNAND=0;   AC_SUBST([GNULIB_ISNAND])
+  GNULIB_ISNANL=0;   AC_SUBST([GNULIB_ISNANL])
+  GNULIB_LDEXPL=0;   AC_SUBST([GNULIB_LDEXPL])
+  GNULIB_LOGB=0;     AC_SUBST([GNULIB_LOGB])
+  GNULIB_LOGL=0;     AC_SUBST([GNULIB_LOGL])
+  GNULIB_ROUND=0;    AC_SUBST([GNULIB_ROUND])
+  GNULIB_ROUNDF=0;   AC_SUBST([GNULIB_ROUNDF])
+  GNULIB_ROUNDL=0;   AC_SUBST([GNULIB_ROUNDL])
+  GNULIB_SIGNBIT=0;  AC_SUBST([GNULIB_SIGNBIT])
+  GNULIB_SINL=0;     AC_SUBST([GNULIB_SINL])
+  GNULIB_SQRTL=0;    AC_SUBST([GNULIB_SQRTL])
+  GNULIB_TANL=0;     AC_SUBST([GNULIB_TANL])
+  GNULIB_TRUNC=0;    AC_SUBST([GNULIB_TRUNC])
+  GNULIB_TRUNCF=0;   AC_SUBST([GNULIB_TRUNCF])
+  GNULIB_TRUNCL=0;   AC_SUBST([GNULIB_TRUNCL])
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_ACOSL=1;                AC_SUBST([HAVE_ACOSL])
+  HAVE_ASINL=1;                AC_SUBST([HAVE_ASINL])
+  HAVE_ATANL=1;                AC_SUBST([HAVE_ATANL])
+  HAVE_COSL=1;                 AC_SUBST([HAVE_COSL])
+  HAVE_EXPL=1;                 AC_SUBST([HAVE_EXPL])
+  HAVE_ISNANF=1;               AC_SUBST([HAVE_ISNANF])
+  HAVE_ISNAND=1;               AC_SUBST([HAVE_ISNAND])
+  HAVE_ISNANL=1;               AC_SUBST([HAVE_ISNANL])
+  HAVE_LOGL=1;                 AC_SUBST([HAVE_LOGL])
+  HAVE_SINL=1;                 AC_SUBST([HAVE_SINL])
+  HAVE_SQRTL=1;                AC_SUBST([HAVE_SQRTL])
+  HAVE_TANL=1;                 AC_SUBST([HAVE_TANL])
+  HAVE_DECL_ACOSL=1;           AC_SUBST([HAVE_DECL_ACOSL])
+  HAVE_DECL_ASINL=1;           AC_SUBST([HAVE_DECL_ASINL])
+  HAVE_DECL_ATANL=1;           AC_SUBST([HAVE_DECL_ATANL])
+  HAVE_DECL_CEILF=1;           AC_SUBST([HAVE_DECL_CEILF])
+  HAVE_DECL_CEILL=1;           AC_SUBST([HAVE_DECL_CEILL])
+  HAVE_DECL_COSL=1;            AC_SUBST([HAVE_DECL_COSL])
+  HAVE_DECL_EXPL=1;            AC_SUBST([HAVE_DECL_EXPL])
+  HAVE_DECL_FLOORF=1;          AC_SUBST([HAVE_DECL_FLOORF])
+  HAVE_DECL_FLOORL=1;          AC_SUBST([HAVE_DECL_FLOORL])
+  HAVE_DECL_FREXPL=1;          AC_SUBST([HAVE_DECL_FREXPL])
+  HAVE_DECL_LDEXPL=1;          AC_SUBST([HAVE_DECL_LDEXPL])
+  HAVE_DECL_LOGB=1;            AC_SUBST([HAVE_DECL_LOGB])
+  HAVE_DECL_LOGL=1;            AC_SUBST([HAVE_DECL_LOGL])
+  HAVE_DECL_ROUND=1;           AC_SUBST([HAVE_DECL_ROUND])
+  HAVE_DECL_ROUNDF=1;          AC_SUBST([HAVE_DECL_ROUNDF])
+  HAVE_DECL_ROUNDL=1;          AC_SUBST([HAVE_DECL_ROUNDL])
+  HAVE_DECL_SINL=1;            AC_SUBST([HAVE_DECL_SINL])
+  HAVE_DECL_SQRTL=1;           AC_SUBST([HAVE_DECL_SQRTL])
+  HAVE_DECL_TANL=1;            AC_SUBST([HAVE_DECL_TANL])
+  HAVE_DECL_TRUNC=1;           AC_SUBST([HAVE_DECL_TRUNC])
+  HAVE_DECL_TRUNCF=1;          AC_SUBST([HAVE_DECL_TRUNCF])
+  HAVE_DECL_TRUNCL=1;          AC_SUBST([HAVE_DECL_TRUNCL])
+  REPLACE_CEILF=0;             AC_SUBST([REPLACE_CEILF])
+  REPLACE_CEILL=0;             AC_SUBST([REPLACE_CEILL])
+  REPLACE_FLOORF=0;            AC_SUBST([REPLACE_FLOORF])
+  REPLACE_FLOORL=0;            AC_SUBST([REPLACE_FLOORL])
+  REPLACE_FREXP=0;             AC_SUBST([REPLACE_FREXP])
+  REPLACE_FREXPL=0;            AC_SUBST([REPLACE_FREXPL])
+  REPLACE_HUGE_VAL=0;          AC_SUBST([REPLACE_HUGE_VAL])
+  REPLACE_ISFINITE=0;          AC_SUBST([REPLACE_ISFINITE])
+  REPLACE_ISINF=0;             AC_SUBST([REPLACE_ISINF])
+  REPLACE_ISNAN=0;             AC_SUBST([REPLACE_ISNAN])
+  REPLACE_LDEXPL=0;            AC_SUBST([REPLACE_LDEXPL])
+  REPLACE_NAN=0;               AC_SUBST([REPLACE_NAN])
+  REPLACE_ROUND=0;             AC_SUBST([REPLACE_ROUND])
+  REPLACE_ROUNDF=0;            AC_SUBST([REPLACE_ROUNDF])
+  REPLACE_ROUNDL=0;            AC_SUBST([REPLACE_ROUNDL])
+  REPLACE_SIGNBIT=0;           AC_SUBST([REPLACE_SIGNBIT])
+  REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC])
+  REPLACE_TRUNCL=0;            AC_SUBST([REPLACE_TRUNCL])
+])
diff --git a/maint.mk b/maint.mk
index 59e9cb5..32320f8 100644
--- a/maint.mk
+++ b/maint.mk
@@ -954,7 +954,7 @@ writable-files:
          test "$$fail" && exit 1 || : ;                                \
        fi
 
-v_etc_file = lib/version-etc.c
+v_etc_file = $(gnulib_dir)/lib/version-etc.c
 sample-test = tests/sample-test
 texi = doc/$(PACKAGE).texi
 # Make sure that the copyright date in $(v_etc_file) is up to date.
diff --git a/module/system/foreign.scm b/module/system/foreign.scm
index 0ca7fbf..84d1a03 100644
--- a/module/system/foreign.scm
+++ b/module/system/foreign.scm
@@ -42,7 +42,7 @@
             string->pointer
             pointer->string
 
-            make-foreign-function
+            pointer->procedure
             ;; procedure->pointer (see below)
             make-c-struct parse-c-struct))
 
diff --git a/test-suite/standalone/test-ffi b/test-suite/standalone/test-ffi
index 960c9d1..ad68660 100755
--- a/test-suite/standalone/test-ffi
+++ b/test-suite/standalone/test-ffi
@@ -45,78 +45,78 @@ exec guile -q -s "$0" "$@"
 ;;; No args
 ;;;
 (define f-v-
-  (make-foreign-function void (dynamic-func "test_ffi_v_" lib) '()))
+  (pointer->procedure void (dynamic-func "test_ffi_v_" lib) '()))
 (test (f-v-) *unspecified*)
 
 (define f-s8-
-  (make-foreign-function int8 (dynamic-func "test_ffi_s8_" lib) '()))
+  (pointer->procedure int8 (dynamic-func "test_ffi_s8_" lib) '()))
 (test (f-s8-) -100)
 
 (define f-u8-
-  (make-foreign-function uint8 (dynamic-func "test_ffi_u8_" lib) '()))
+  (pointer->procedure uint8 (dynamic-func "test_ffi_u8_" lib) '()))
 (test (f-u8-) 200)
 
 (define f-s16-
-  (make-foreign-function int16 (dynamic-func "test_ffi_s16_" lib) '()))
+  (pointer->procedure int16 (dynamic-func "test_ffi_s16_" lib) '()))
 (test (f-s16-) -20000)
 
 (define f-u16-
-  (make-foreign-function uint16 (dynamic-func "test_ffi_u16_" lib) '()))
+  (pointer->procedure uint16 (dynamic-func "test_ffi_u16_" lib) '()))
 (test (f-u16-) 40000)
 
 (define f-s32-
-  (make-foreign-function int32 (dynamic-func "test_ffi_s32_" lib) '()))
+  (pointer->procedure int32 (dynamic-func "test_ffi_s32_" lib) '()))
 (test (f-s32-) -2000000000)
 
 (define f-u32-
-  (make-foreign-function uint32 (dynamic-func "test_ffi_u32_" lib) '()))
+  (pointer->procedure uint32 (dynamic-func "test_ffi_u32_" lib) '()))
 (test (f-u32-) 4000000000)
 
 (define f-s64-
-  (make-foreign-function int64 (dynamic-func "test_ffi_s64_" lib) '()))
+  (pointer->procedure int64 (dynamic-func "test_ffi_s64_" lib) '()))
 (test (f-s64-) -2000000000)
 
 (define f-u64-
-  (make-foreign-function uint64 (dynamic-func "test_ffi_u64_" lib) '()))
+  (pointer->procedure uint64 (dynamic-func "test_ffi_u64_" lib) '()))
 (test (f-u64-) 4000000000)
 
 ;;;
 ;;; One u8 arg
 ;;;
 (define f-v-u8
-  (make-foreign-function void (dynamic-func "test_ffi_v_u8" lib) (list uint8)))
+  (pointer->procedure void (dynamic-func "test_ffi_v_u8" lib) (list uint8)))
 (test (f-v-u8 10) *unspecified*)
 
 (define f-s8-u8
-  (make-foreign-function int8 (dynamic-func "test_ffi_s8_u8" lib) (list 
uint8)))
+  (pointer->procedure int8 (dynamic-func "test_ffi_s8_u8" lib) (list uint8)))
 (test (f-s8-u8 10) -90)
 
 (define f-u8-u8
-  (make-foreign-function uint8 (dynamic-func "test_ffi_u8_u8" lib) (list 
uint8)))
+  (pointer->procedure uint8 (dynamic-func "test_ffi_u8_u8" lib) (list uint8)))
 (test (f-u8-u8 10) 210)
 
 (define f-s16-u8
-  (make-foreign-function int16 (dynamic-func "test_ffi_s16_u8" lib) (list 
uint8)))
+  (pointer->procedure int16 (dynamic-func "test_ffi_s16_u8" lib) (list uint8)))
 (test (f-s16-u8 10) -19990)
 
 (define f-u16-u8
-  (make-foreign-function uint16 (dynamic-func "test_ffi_u16_u8" lib) (list 
uint8)))
+  (pointer->procedure uint16 (dynamic-func "test_ffi_u16_u8" lib) (list 
uint8)))
 (test (f-u16-u8 10) 40010)
 
 (define f-s32-u8
-  (make-foreign-function int32 (dynamic-func "test_ffi_s32_u8" lib) (list 
uint8)))
+  (pointer->procedure int32 (dynamic-func "test_ffi_s32_u8" lib) (list uint8)))
 (test (f-s32-u8 10) -1999999990)
 
 (define f-u32-u8
-  (make-foreign-function uint32 (dynamic-func "test_ffi_u32_u8" lib) (list 
uint8)))
+  (pointer->procedure uint32 (dynamic-func "test_ffi_u32_u8" lib) (list 
uint8)))
 (test (f-u32-u8 10) 4000000010)
 
 (define f-s64-u8
-  (make-foreign-function int64 (dynamic-func "test_ffi_s64_u8" lib) (list 
uint8)))
+  (pointer->procedure int64 (dynamic-func "test_ffi_s64_u8" lib) (list uint8)))
 (test (f-s64-u8 10) -1999999990)
 
 (define f-u64-u8
-  (make-foreign-function uint64 (dynamic-func "test_ffi_u64_u8" lib) (list 
uint8)))
+  (pointer->procedure uint64 (dynamic-func "test_ffi_u64_u8" lib) (list 
uint8)))
 (test (f-u64-u8 10) 4000000010)
 
 
@@ -124,39 +124,39 @@ exec guile -q -s "$0" "$@"
 ;;; One s64 arg
 ;;;
 (define f-v-s64
-  (make-foreign-function void (dynamic-func "test_ffi_v_s64" lib) (list 
int64)))
+  (pointer->procedure void (dynamic-func "test_ffi_v_s64" lib) (list int64)))
 (test (f-v-s64 10) *unspecified*)
 
 (define f-s8-s64
-  (make-foreign-function int8 (dynamic-func "test_ffi_s8_s64" lib) (list 
int64)))
+  (pointer->procedure int8 (dynamic-func "test_ffi_s8_s64" lib) (list int64)))
 (test (f-s8-s64 10) -90)
 
 (define f-u8-s64
-  (make-foreign-function uint8 (dynamic-func "test_ffi_u8_s64" lib) (list 
int64)))
+  (pointer->procedure uint8 (dynamic-func "test_ffi_u8_s64" lib) (list int64)))
 (test (f-u8-s64 10) 210)
 
 (define f-s16-s64
-  (make-foreign-function int16 (dynamic-func "test_ffi_s16_s64" lib) (list 
int64)))
+  (pointer->procedure int16 (dynamic-func "test_ffi_s16_s64" lib) (list 
int64)))
 (test (f-s16-s64 10) -19990)
 
 (define f-u16-s64
-  (make-foreign-function uint16 (dynamic-func "test_ffi_u16_s64" lib) (list 
int64)))
+  (pointer->procedure uint16 (dynamic-func "test_ffi_u16_s64" lib) (list 
int64)))
 (test (f-u16-s64 10) 40010)
 
 (define f-s32-s64
-  (make-foreign-function int32 (dynamic-func "test_ffi_s32_s64" lib) (list 
int64)))
+  (pointer->procedure int32 (dynamic-func "test_ffi_s32_s64" lib) (list 
int64)))
 (test (f-s32-s64 10) -1999999990)
 
 (define f-u32-s64
-  (make-foreign-function uint32 (dynamic-func "test_ffi_u32_s64" lib) (list 
int64)))
+  (pointer->procedure uint32 (dynamic-func "test_ffi_u32_s64" lib) (list 
int64)))
 (test (f-u32-s64 10) 4000000010)
 
 (define f-s64-s64
-  (make-foreign-function int64 (dynamic-func "test_ffi_s64_s64" lib) (list 
int64)))
+  (pointer->procedure int64 (dynamic-func "test_ffi_s64_s64" lib) (list 
int64)))
 (test (f-s64-s64 10) -1999999990)
 
 (define f-u64-s64
-  (make-foreign-function uint64 (dynamic-func "test_ffi_u64_s64" lib) (list 
int64)))
+  (pointer->procedure uint64 (dynamic-func "test_ffi_u64_s64" lib) (list 
int64)))
 (test (f-u64-s64 10) 4000000010)
 
 
@@ -164,8 +164,8 @@ exec guile -q -s "$0" "$@"
 ;; Multiple int args of differing types
 ;;
 (define f-sum
-  (make-foreign-function int64 (dynamic-func "test_ffi_sum" lib)
-                         (list int8 int16 int32 int64)))
+  (pointer->procedure int64 (dynamic-func "test_ffi_sum" lib)
+                      (list int8 int16 int32 int64)))
 (test (f-sum -1 2000 -30000 40000000000)
       (+ -1 2000 -30000 40000000000))
 
@@ -173,8 +173,8 @@ exec guile -q -s "$0" "$@"
 ;; Structs
 ;;
 (define f-sum-struct
-  (make-foreign-function int64 (dynamic-func "test_ffi_sum_struct" lib)
-                         (list (list int8 int16 int32 int64))))
+  (pointer->procedure int64 (dynamic-func "test_ffi_sum_struct" lib)
+                      (list (list int8 int16 int32 int64))))
 (test (f-sum-struct (make-c-struct (list int8 int16 int32 int64)
                                    (list -1 2000 -30000 40000000000)))
       (+ -1 2000 -30000 40000000000))
@@ -182,8 +182,8 @@ exec guile -q -s "$0" "$@"
 ;; Structs
 ;;
 (define f-memcpy
-  (make-foreign-function '* (dynamic-func "test_ffi_memcpy" lib)
-                         (list '* '* int32)))
+  (pointer->procedure '* (dynamic-func "test_ffi_memcpy" lib)
+                      (list '* '* int32)))
 (let* ((src* '(0 1 2 3 4 5 6 7))
        (src  (bytevector->pointer (u8-list->bytevector src*)))
        (dest (bytevector->pointer (make-bytevector 16 0)))
@@ -199,8 +199,8 @@ exec guile -q -s "$0" "$@"
 ;;
 
 (define f-callback-1
-  (make-foreign-function int (dynamic-func "test_ffi_callback_1" lib)
-                         (list '* int)))
+  (pointer->procedure int (dynamic-func "test_ffi_callback_1" lib)
+                      (list '* int)))
 
 (if (defined? 'procedure->pointer)
     (let* ((calls 0)
@@ -220,8 +220,8 @@ exec guile -q -s "$0" "$@"
                  (error "incorrect result" result))))))
 
 (define f-callback-2
-  (make-foreign-function double (dynamic-func "test_ffi_callback_2" lib)
-                         (list '* float int double)))
+  (pointer->procedure double (dynamic-func "test_ffi_callback_2" lib)
+                      (list '* float int double)))
 
 (if (defined? 'procedure->pointer)
     (let* ((proc  (lambda (x y z)
@@ -251,12 +251,12 @@ exec guile -q -s "$0" "$@"
 (define global (dynamic-link))
 
 (define strerror
-  (make-foreign-function '* (dynamic-func "strerror" global)
-                         (list int)))
+  (pointer->procedure '* (dynamic-func "strerror" global)
+                      (list int)))
 
 (define strlen
-  (make-foreign-function size_t (dynamic-func "strlen" global)
-                         (list '*)))
+  (pointer->procedure size_t (dynamic-func "strlen" global)
+                      (list '*)))
 
 (let* ((ptr (strerror ENOENT))
        (len (strlen ptr))
diff --git a/test-suite/tests/foreign.test b/test-suite/tests/foreign.test
index a791602..274a06d 100644
--- a/test-suite/tests/foreign.test
+++ b/test-suite/tests/foreign.test
@@ -96,9 +96,9 @@
 
   (define qsort
     ;; Bindings for libc's `qsort' function.
-    (make-foreign-function void
-                           (dynamic-func "qsort" (dynamic-link))
-                           (list '* size_t size_t '*)))
+    (pointer->procedure void
+                        (dynamic-func "qsort" (dynamic-link))
+                        (list '* size_t size_t '*)))
 
   (define (dereference-pointer-to-byte ptr)
     (let ((b (pointer->bytevector ptr 1)))
@@ -153,10 +153,9 @@
                         (+ x y z 0.0)))
                (ret   double)
                (args  (list float int16 double))
-               (proc* (make-foreign-function
-                       ret
-                       (procedure->pointer ret proc args)
-                       args))
+               (proc* (pointer->procedure ret
+                                          (procedure->pointer ret proc args)
+                                          args))
                (arg1  (map (cut / <> 2.0) (iota 123)))
                (arg2  (iota 123 32000))
                (arg3  (map (cut / <> 4.0) (iota 123 100 4))))


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]