summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-04-20 04:02:24 +0000
committerTavian Barnes <tavianator@gmail.com>2009-04-20 04:02:24 +0000
commitd23c8d6cefea2228ee4d5193a0d25b2cab575353 (patch)
treed1a5c3fcc925ab3f208aa246bf774a96806c6adb
parent4e2f7c8e8fdcdb1dbf6f2346e13f46f8ce3eca48 (diff)
downloaddimension-d23c8d6cefea2228ee4d5193a0d25b2cab575353.tar.xz
Update cookie-fopencookie.cpp to the new FILE_Cookie interface.
-rw-r--r--configure.ac12
-rw-r--r--libdimensionxx/cookie-fopencookie.cpp8
2 files changed, 17 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index ad52306..8599feb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,7 +29,17 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
-AM_CONDITIONAL([FOPENCOOKIE], false)
+AC_MSG_CHECKING([for fopencookie()])
+AC_LINK_IFELSE(AC_LANG_PROGRAM(
+ [[ #define _GNU_SOURCE
+ #include <stdio.h> ]],
+ [[ cookie_io_functions_t io_funcs;
+ FILE* file = fopencookie(NULL, "r", io_funcs); ]]),
+ [fopencookie=yes
+ AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])])
+
+AM_CONDITIONAL([FOPENCOOKIE], [test "$fopencookie" = "yes"])
dnl Generate Makefiles
AC_CONFIG_MACRO_DIR([m4])
diff --git a/libdimensionxx/cookie-fopencookie.cpp b/libdimensionxx/cookie-fopencookie.cpp
index 9fd4e07..78b6e8b 100644
--- a/libdimensionxx/cookie-fopencookie.cpp
+++ b/libdimensionxx/cookie-fopencookie.cpp
@@ -19,6 +19,10 @@
*************************************************************************/
#include "dimensionxx.hpp"
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
#include <stdio.h>
// The conundrum: libdimension and libdimension-* use C I/O, with FILE*'s.
@@ -145,8 +149,8 @@ namespace Dimension
}
// Make an I/O FILE_Cookie
- FILE_Cookie::FILE_Cookie(std::istream& istr, std::ostream& ostr)
- : m_istr(&istr), m_ostr(&ostr)
+ FILE_Cookie::FILE_Cookie(std::iostream& iostr)
+ : m_istr(&iostr), m_ostr(&iostr)
{
cookie_io_functions_t io_funcs;
io_funcs.read = &cookie_read;