diff --git a/Data/Floating.hs b/Data/Floating.hs
--- a/Data/Floating.hs
+++ b/Data/Floating.hs
@@ -1,5 +1,5 @@
 {-
- - Copyright (C) 2009 Nick Bowler.
+ - Copyright (C) 2009-2010 Nick Bowler.
  -
  - License BSD2:  2-clause BSD license.  See LICENSE for full terms.
  - This is free software: you are free to change and redistribute it.
diff --git a/Data/Floating/CMath.hs b/Data/Floating/CMath.hs
--- a/Data/Floating/CMath.hs
+++ b/Data/Floating/CMath.hs
@@ -1,5 +1,5 @@
 {-
- - Copyright (C) 2009 Nick Bowler.
+ - Copyright (C) 2009-2010 Nick Bowler.
  -
  - License BSD2:  2-clause BSD license.  See LICENSE for full terms.
  - This is free software: you are free to change and redistribute it.
diff --git a/Data/Floating/Classes.hs b/Data/Floating/Classes.hs
--- a/Data/Floating/Classes.hs
+++ b/Data/Floating/Classes.hs
@@ -1,5 +1,5 @@
 {-
- - Copyright (C) 2009 Nick Bowler.
+ - Copyright (C) 2009-2010 Nick Bowler.
  -
  - License BSD2:  2-clause BSD license.  See LICENSE for full terms.
  - This is free software: you are free to change and redistribute it.
diff --git a/Data/Floating/Double.hs b/Data/Floating/Double.hs
--- a/Data/Floating/Double.hs
+++ b/Data/Floating/Double.hs
@@ -1,5 +1,5 @@
 {-
- - Copyright (C) 2009 Nick Bowler.
+ - Copyright (C) 2009-2010 Nick Bowler.
  -
  - License BSD2:  2-clause BSD license.  See LICENSE for full terms.
  - This is free software: you are free to change and redistribute it.
diff --git a/Data/Floating/Types.hs b/Data/Floating/Types.hs
--- a/Data/Floating/Types.hs
+++ b/Data/Floating/Types.hs
@@ -1,5 +1,5 @@
 {-
- - Copyright (C) 2009 Nick Bowler.
+ - Copyright (C) 2009-2010 Nick Bowler.
  -
  - License BSD2:  2-clause BSD license.  See LICENSE for full terms.
  - This is free software: you are free to change and redistribute it.
diff --git a/Data/Poset/Instances.hs b/Data/Poset/Instances.hs
--- a/Data/Poset/Instances.hs
+++ b/Data/Poset/Instances.hs
@@ -1,5 +1,5 @@
 {-
- - Copyright (C) 2009 Nick Bowler.
+ - Copyright (C) 2009-2010 Nick Bowler.
  -
  - License BSD2:  2-clause BSD license.  See LICENSE for full terms.
  - This is free software: you are free to change and redistribute it.
diff --git a/Data/Poset/Internal.hs b/Data/Poset/Internal.hs
--- a/Data/Poset/Internal.hs
+++ b/Data/Poset/Internal.hs
@@ -1,5 +1,5 @@
 {-
- - Copyright (C) 2009 Nick Bowler.
+ - Copyright (C) 2009-2010 Nick Bowler.
  -
  - License BSD2:  2-clause BSD license.  See LICENSE for full terms.
  - This is free software: you are free to change and redistribute it.
diff --git a/altfloat.cabal b/altfloat.cabal
--- a/altfloat.cabal
+++ b/altfloat.cabal
@@ -1,8 +1,8 @@
 Name:               altfloat
-Version:            0.2.1
+Version:            0.2.2
 License:            OtherLicense
 License-File:       LICENSE
-Cabal-Version:      >= 1.2
+Cabal-Version:      >= 1.6
 Author:             Nick Bowler
 Maintainer:         nbowler@draconx.ca
 Homepage:           http://repo.or.cz/w/altfloat.git
@@ -10,7 +10,9 @@
 Category:           Numerical
 Build-Type:         Simple
 Extra-Source-Files: configure.ac, configure, altfloat.buildinfo.in, cfloat.h
+                    config.h.in
 Extra-Tmp-Files:    altfloat.buildinfo, config.status config.log, config.cache
+                    config.h
 Synopsis:           Alternative floating point support for GHC.
 Description:
     A replacement for the standard Haskell floating point types and supporting
@@ -50,6 +52,10 @@
     which includes features from this library and the non-overlapping parts of
     the standard Prelude.
 
+Source-Repository head
+    Type:     git
+    Location: git://repo.or.cz/altfloat.git
+
 Flag SplitInteger
     Description: Use the new split integer packages that come with GHC 6.12.
 
@@ -67,7 +73,8 @@
     else
         Build-Depends: integer
 
-    C-Sources: cfloat.c
+    Include-Dirs: .
+    C-Sources: cfloat.c c99-compat.c
     Exposed-Modules:
         Data.Floating.CMath,
         Data.Floating.Classes,
diff --git a/c99-compat.c b/c99-compat.c
new file mode 100644
--- /dev/null
+++ b/c99-compat.c
@@ -0,0 +1,54 @@
+/*
+ * Simple implementations of some C99 library functions.
+ * Note that the goal of altfloat is not to create a C99 math library: these
+ * functions are intended to just be "good enough" on platforms where they are
+ * missing.
+ *
+ * Copyright (C) 2010 Nick Bowler.
+ *
+ * License BSD2:  2-clause BSD license.  See LICENSE for full terms.
+ * This is free software: you are free to change and redistribute it.
+ * There is NO WARRANTY, to the extent permitted by law.
+ */
+#include <config.h>
+#include <limits.h>
+#include <math.h>
+
+#if NEED_LIBM_NAN
+double nan(const char *tagp)
+{
+	return NAN;
+}
+#endif
+
+#if NEED_LIBM_LOG2
+double log2(double x)
+{
+	return log(x) / log(2);
+}
+#endif
+
+#if NEED_LIBM_EXP2
+double exp2(double x)
+{
+	return pow(2, x);
+}
+#endif
+
+#if NEED_LIBM_FMA
+double fma(double x, double y, double z)
+{
+	return x*y + z;
+}
+#endif
+
+#if NEED_LIBM_REMQUO
+double remquo(double x, double y, int *quo)
+{
+	unsigned tmp = fabs(round(x/y));
+	int sign     = signbit(x/y) ? -1 : 1;
+
+	*quo = sign * (int)(tmp % (INT_MAX + 1u));
+	return remainder(x, y);
+}
+#endif
diff --git a/cfloat.c b/cfloat.c
--- a/cfloat.c
+++ b/cfloat.c
@@ -2,7 +2,7 @@
  * Floating point functions that are difficult or impossible to implement
  * in pure Haskell.
  *
- * Copyright (C) 2009 Nick Bowler.
+ * Copyright (C) 2009-2010 Nick Bowler.
  *
  * License BSD2:  2-clause BSD license.  See LICENSE for full terms.
  * This is free software: you are free to change and redistribute it.
diff --git a/config.h.in b/config.h.in
new file mode 100644
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,34 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you do not have a working exp2 function. */
+#undef NEED_LIBM_EXP2
+
+/* Define to 1 if you do not have a working fma function. */
+#undef NEED_LIBM_FMA
+
+/* Define to 1 if you do not have a working log2 function. */
+#undef NEED_LIBM_LOG2
+
+/* Define to 1 if you do not have a working nan function. */
+#undef NEED_LIBM_NAN
+
+/* Define to 1 if you do not have a working remquo function. */
+#undef NEED_LIBM_REMQUO
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for altfloat 0.1.
+# Generated by GNU Autoconf 2.65 for altfloat 0.2.2.
 #
 # Report bugs to <nbowler@draconx.ca>.
 #
@@ -551,8 +551,8 @@
 # Identity of this package.
 PACKAGE_NAME='altfloat'
 PACKAGE_TARNAME='altfloat'
-PACKAGE_VERSION='0.1'
-PACKAGE_STRING='altfloat 0.1'
+PACKAGE_VERSION='0.2.2'
+PACKAGE_STRING='altfloat 0.2.2'
 PACKAGE_BUGREPORT='nbowler@draconx.ca'
 PACKAGE_URL=''
 
@@ -1159,7 +1159,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures altfloat 0.1 to adapt to many kinds of systems.
+\`configure' configures altfloat 0.2.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1220,7 +1220,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of altfloat 0.1:";;
+     short | recursive ) echo "Configuration of altfloat 0.2.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1304,7 +1304,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-altfloat configure 0.1
+altfloat configure 0.2.2
 generated by GNU Autoconf 2.65
 
 Copyright (C) 2009 Free Software Foundation, Inc.
@@ -1355,11 +1355,57 @@
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by altfloat $as_me 0.1, which was
+It was created by altfloat $as_me 0.2.2, which was
 generated by GNU Autoconf 2.65.  Invocation command line was
 
   $ $0 $@
@@ -1707,8 +1753,10 @@
 
 
 
+ac_config_headers="$ac_config_headers config.h"
 
 
+
 # Check whether --with-compiler was given.
 if test "${with_compiler+set}" = set; then :
   withval=$with_compiler;
@@ -2687,6 +2735,315 @@
 CC_OPTS=`echo $CC | sed 's/[^[:space:]]*//'`
 
 
+replaced_libm=no
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nan" >&5
+$as_echo_n "checking for library containing nan... " >&6; }
+if test "${ac_cv_search_nan+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char nan ();
+int
+main ()
+{
+return nan ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' m; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_nan=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_nan+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_nan+set}" = set; then :
+
+else
+  ac_cv_search_nan=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nan" >&5
+$as_echo "$ac_cv_search_nan" >&6; }
+ac_res=$ac_cv_search_nan
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+else
+  	replaced_libm=yes
+
+$as_echo "#define NEED_LIBM_NAN 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing log2" >&5
+$as_echo_n "checking for library containing log2... " >&6; }
+if test "${ac_cv_search_log2+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' m; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_log2=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_log2+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_log2+set}" = set; then :
+
+else
+  ac_cv_search_log2=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_log2" >&5
+$as_echo "$ac_cv_search_log2" >&6; }
+ac_res=$ac_cv_search_log2
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+else
+  	replaced_libm=yes
+
+$as_echo "#define NEED_LIBM_LOG2 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing exp2" >&5
+$as_echo_n "checking for library containing exp2... " >&6; }
+if test "${ac_cv_search_exp2+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exp2 ();
+int
+main ()
+{
+return exp2 ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' m; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_exp2=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_exp2+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_exp2+set}" = set; then :
+
+else
+  ac_cv_search_exp2=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_exp2" >&5
+$as_echo "$ac_cv_search_exp2" >&6; }
+ac_res=$ac_cv_search_exp2
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+else
+  	replaced_libm=yes
+
+$as_echo "#define NEED_LIBM_EXP2 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing fma" >&5
+$as_echo_n "checking for library containing fma... " >&6; }
+if test "${ac_cv_search_fma+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char fma ();
+int
+main ()
+{
+return fma ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' m; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_fma=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_fma+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_fma+set}" = set; then :
+
+else
+  ac_cv_search_fma=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_fma" >&5
+$as_echo "$ac_cv_search_fma" >&6; }
+ac_res=$ac_cv_search_fma
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+else
+  	replaced_libm=yes
+
+$as_echo "#define NEED_LIBM_FMA 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing remquo" >&5
+$as_echo_n "checking for library containing remquo... " >&6; }
+if test "${ac_cv_search_remquo+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char remquo ();
+int
+main ()
+{
+return remquo ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' m; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_remquo=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_remquo+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_remquo+set}" = set; then :
+
+else
+  ac_cv_search_remquo=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_remquo" >&5
+$as_echo "$ac_cv_search_remquo" >&6; }
+ac_res=$ac_cv_search_remquo
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+else
+  	replaced_libm=yes
+
+$as_echo "#define NEED_LIBM_REMQUO 1" >>confdefs.h
+
+fi
+
+
 ac_config_files="$ac_config_files altfloat.buildinfo"
 
 cat >confcache <<\_ACEOF
@@ -2768,43 +3125,7 @@
 # Let make expand exec_prefix.
 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-#
-# If the first sed substitution is executed (which looks for macros that
-# take arguments), then branch to the quote section.  Otherwise,
-# look for a macro that doesn't take arguments.
-ac_script='
-:mline
-/\\$/{
- N
- s,\\\n,,
- b mline
-}
-t clear
-:clear
-s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*([^)]*)\)[	 ]*\(.*\)/-D\1=\2/g
-t quote
-s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)/-D\1=\2/g
-t quote
-b any
-:quote
-s/[	 `~#$^&*(){}\\|;'\''"<>?]/\\&/g
-s/\[/\\&/g
-s/\]/\\&/g
-s/\$/$$/g
-H
-:any
-${
-	g
-	s/^\n//
-	s/\n/ /g
-	p
-}
-'
-DEFS=`sed -n "$ac_script" confdefs.h`
-
+DEFS=-DHAVE_CONFIG_H
 
 ac_libobjs=
 ac_ltlibobjs=
@@ -3230,7 +3551,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by altfloat $as_me 0.1, which was
+This file was extended by altfloat $as_me 0.2.2, which was
 generated by GNU Autoconf 2.65.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -3248,11 +3569,15 @@
 "*) set x $ac_config_files; shift; ac_config_files=$*;;
 esac
 
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
 
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # Files that config.status was made for.
 config_files="$ac_config_files"
+config_headers="$ac_config_headers"
 
 _ACEOF
 
@@ -3273,17 +3598,22 @@
       --recheck    update $as_me by reconfiguring in the same conditions
       --file=FILE[:TEMPLATE]
                    instantiate the configuration file FILE
+      --header=FILE[:TEMPLATE]
+                   instantiate the configuration header FILE
 
 Configuration files:
 $config_files
 
+Configuration headers:
+$config_headers
+
 Report bugs to <nbowler@draconx.ca>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-altfloat config.status 0.1
+altfloat config.status 0.2.2
 configured by $0, generated by GNU Autoconf 2.65,
   with options \\"\$ac_cs_config\\"
 
@@ -3331,7 +3661,18 @@
     esac
     as_fn_append CONFIG_FILES " '$ac_optarg'"
     ac_need_defaults=false;;
-  --he | --h |  --help | --hel | -h )
+  --header | --heade | --head | --hea )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    as_fn_error "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+  --help | --hel | -h )
     $as_echo "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil | --si | --s)
@@ -3387,6 +3728,7 @@
 for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
     "altfloat.buildinfo") CONFIG_FILES="$CONFIG_FILES altfloat.buildinfo" ;;
 
   *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -3400,6 +3742,7 @@
 # bizarre bug on SunOS 4.1.3.
 if $ac_need_defaults; then
   test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
 fi
 
 # Have a temporary directory for convenience.  Make it in the build tree
@@ -3577,8 +3920,116 @@
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 fi # test -n "$CONFIG_FILES"
 
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
 
-eval set X "  :F $CONFIG_FILES      "
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_t"; then
+    break
+  elif $ac_last_try; then
+    as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any.  Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[	 ]*#[	 ]*define[	 ][	 ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  for (key in D) D_is_set[key] = 1
+  FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+  line = \$ 0
+  split(line, arg, " ")
+  if (arg[1] == "#") {
+    defundef = arg[2]
+    mac1 = arg[3]
+  } else {
+    defundef = substr(arg[1], 2)
+    mac1 = arg[2]
+  }
+  split(mac1, mac2, "(") #)
+  macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
+  if (D_is_set[macro]) {
+    # Preserve the white space surrounding the "#".
+    print prefix "define", macro P[macro] D[macro]
+    next
+  } else {
+    # Replace #undef with comments.  This is necessary, for example,
+    # in the case of _POSIX_SOURCE, which is predefined and required
+    # on some systems where configure will not decide to define it.
+    if (defundef == "undef") {
+      print "/*", prefix defundef, macro, "*/"
+      next
+    }
+  }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+  as_fn_error "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    "
 shift
 for ac_tag
 do
@@ -3785,7 +4236,30 @@
   esac \
   || as_fn_error "could not create $ac_file" "$LINENO" 5
  ;;
-
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+  if test x"$ac_file" != x-; then
+    {
+      $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+    } >"$tmp/config.h" \
+      || as_fn_error "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f "$ac_file"
+      mv "$tmp/config.h" "$ac_file" \
+	|| as_fn_error "could not create $ac_file" "$LINENO" 5
+    fi
+  else
+    $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error "could not create -" "$LINENO" 5
+  fi
+ ;;
 
 
   esac
@@ -3826,3 +4300,15 @@
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
+
+if test x"$replaced_libm" = x"yes"; then
+echo
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
+Your C library appears to not provide all C99 math functions.
+Replacements will be built, but note that they may raise spurious
+exceptions or their accuracy may deviate from applicable standards." >&5
+$as_echo "$as_me: WARNING:
+Your C library appears to not provide all C99 math functions.
+Replacements will be built, but note that they may raise spurious
+exceptions or their accuracy may deviate from applicable standards." >&2;}
+fi
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1,12 +1,13 @@
-dnl Copyright (C) 2009 Nick Bowler
+dnl Copyright (C) 2009-2010 Nick Bowler
 dnl Copying and distribution of this file, with or without modification,
 dnl are permitted in any medium without royalty provided the copyright
 dnl notice and this notice are preserved.  This file is offered as-is,
 dnl without any warranty.
 
 AC_PREREQ(2.62)
-AC_INIT([altfloat],[0.1],[nbowler@draconx.ca])
+AC_INIT([altfloat],[0.2.2],[nbowler@draconx.ca])
 AC_CONFIG_SRCDIR([altfloat.cabal])
+AC_CONFIG_HEADER([config.h])
 
 dnl We don't actually care, but this shuts up the warning.
 AC_ARG_WITH([compiler], [AS_HELP_STRING([--with-compiler],
@@ -18,7 +19,27 @@
 CC_OPTS=`echo $CC | sed 's/@<:@^@<:@:space:@:>@@:>@*//'`
 AC_SUBST([CC_OPTS])
 
+dnl Check for some C library functions.
+replaced_libm=no
+AC_DEFUN([CHECK_LIBM], [AC_SEARCH_LIBS([$1], [m], [], [dnl
+	replaced_libm=yes
+	AC_DEFINE([NEED_LIBM_]m4_toupper([$1]), [1],
+		[Define to 1 if you do not have a working $1 function.])])])
+CHECK_LIBM([nan])
+CHECK_LIBM([log2])
+CHECK_LIBM([exp2])
+CHECK_LIBM([fma])
+CHECK_LIBM([remquo])
+
 AC_CONFIG_FILES([
 	altfloat.buildinfo
 ])
 AC_OUTPUT
+
+if test x"$replaced_libm" = x"yes"; then
+echo
+AC_MSG_WARN([
+Your C library appears to not provide all C99 math functions.
+Replacements will be built, but note that they may raise spurious
+exceptions or their accuracy may deviate from applicable standards.])
+fi
