+2010-04-03 Bruno Haible <bruno@clisp.org>
+
+ ftello: Fix C++ test error on mingw.
+ * lib/stdio.in.h (ftello): Use modern idiom.
+ * lib/ftello.c (ftello): Renamed from rpl_ftello.
+ * m4/ftello.m4 (gl_FUNC_FTELLO): Distinguish the case that the function
+ is missing and that it needs to be replaced.
+ (gl_REPLACE_FTELLO): Don't set REPLACE_FTELLO here.
+ * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Initialize HAVE_FTELLO.
+ * modules/stdio (Makefile.am): Substitute HAVE_FTELLO.
+
2010-04-03 Bruno Haible <bruno@clisp.org>
fseeko: Fix C++ test error on mingw.
/* An ftello() function that works around platform bugs.
- Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+ 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 General Public License as published by
/* Get lseek. */
#include <unistd.h>
+off_t
+ftello (FILE *fp)
#undef ftello
#if !HAVE_FTELLO
# undef ftell
# define ftello ftell
#endif
-
-off_t
-rpl_ftello (FILE *fp)
{
#if LSEEK_PIPE_BROKEN
/* mingw gives bogus answers rather than failure on non-seekable files. */
# define ftello rpl_ftello
# endif
_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
-# if !@GNULIB_FTELL@
- /* In order to avoid that ftell gets defined as a macro here, the
- developer can request the 'ftell' module. */
-# undef ftell
-# define ftell rpl_ftell
+_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
+# else
+# if ! @HAVE_FTELLO@
+_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
+# endif
+_GL_CXXALIASWARN (ftello);
+# if (@REPLACE_FTELLO@ || !@HAVE_FTELLO@) && !@GNULIB_FTELL@
+ /* Provide an ftell function that is consistent with ftello. */
+ /* In order to avoid that ftell gets defined as a macro here, the
+ developer can request the 'ftell' module. */
+# undef ftell
+# define ftell rpl_ftell
static inline long _GL_ARG_NONNULL ((1))
rpl_ftell (FILE *f)
{
+# if @REPLACE_FTELLO@
+ return rpl_ftello (f);
+# else
return ftello (f);
-}
# endif
-_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
-# else
-_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
+}
# endif
-_GL_CXXALIASWARN (ftello);
#elif defined GNULIB_POSIXCHECK
# define _GL_FTELL_WARN /* Category 1, above. */
# undef ftell
-# ftello.m4 serial 5
+# ftello.m4 serial 6
dnl Copyright (C) 2007, 2008, 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,
AC_TRY_LINK([#include <stdio.h>], [ftello (stdin);],
[gl_cv_func_ftello=yes], [gl_cv_func_ftello=no])
])
- if test $gl_cv_func_ftello = no \
- || test $gl_cv_var_stdin_large_offset = no; then
+ if test $gl_cv_func_ftello = no; then
+ HAVE_FTELLO=0
+ else
+ if test $gl_cv_var_stdin_large_offset = no; then
+ REPLACE_FTELLO=1
+ fi
+ fi
+ if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
gl_REPLACE_FTELLO
fi
])
AC_DEFUN([gl_REPLACE_FTELLO],
[
AC_LIBOBJ([ftello])
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
- REPLACE_FTELLO=1
])
-# stdio_h.m4 serial 28
+# stdio_h.m4 serial 29
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,
HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF])
HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF])
HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
+ HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT])
HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF])
-e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
-e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \
-e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \
+ -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \
-e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \
-e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
-e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \