Don't rely on availability of open_memstream

- configure now checks for availability of either of open_memstream
  and tmpfile.
- new module memstream uses either of these to create a portable
  memory stream
diff --git a/configure.ac b/configure.ac
index e357cc2..8f7f5fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -258,6 +258,13 @@
 	strtoul \
 ])
 
+#
+# Define HAVE_OPEN_MEMSTREAM if that is available.  If not, require
+# that tmpfile be present.
+#
+AC_CHECK_FUNCS([open_memstream], [],
+	[AC_CHECK_FUNC([tmpfile], [],
+		[AC_MSG_ERROR([Either open_memstream or tmpfile required.])])])
 
 #
 # Debugging