Re: fseeko on mingw

2010-04-05 Thread Bruno Haible
   ../gllib/stdio.h:632: error: `fseeko' was not declared in this scope
 
 This should fix it.

This did not fix it completely, because m4/fflush.m4 also fiddles with
REPLACE_FSEEKO. This fixes it, now.


2010-04-05  Bruno Haible  br...@clisp.org

fseeko: Fix C++ test error on mingw.
* m4/fseeko.m4 (gl_HAVE_FSEEKO): New macro, extracted from
gl_FUNC_FSEEKO.
(gl_REPLACE_FSEEKO): Also set REPLACE_FSEEKO if appropriate.
(gl_FUNC_FSEEKO): Require gl_HAVE_FSEEKO. Update.
* m4/fflush.m4 (gl_REPLACE_FFLUSH): Don't fiddle with internals of the
fseeko module. Instead, invoke gl_REPLACE_FSEEKO.

*** m4/fseeko.m4.orig   Mon Apr  5 18:11:02 2010
--- m4/fseeko.m4Mon Apr  5 18:06:00 2010
***
*** 1,4 
! # fseeko.m4 serial 8
  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,
--- 1,4 
! # fseeko.m4 serial 9
  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,
***
*** 7,15 
  AC_DEFUN([gl_FUNC_FSEEKO],
  [
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
!   AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
  
dnl Persuade glibc stdio.h to declare fseeko().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
  
--- 7,31 
  AC_DEFUN([gl_FUNC_FSEEKO],
  [
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
!   AC_REQUIRE([gl_HAVE_FSEEKO])
AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
  
+   if test $gl_cv_func_fseeko = no; then
+ HAVE_FSEEKO=0
+ gl_REPLACE_FSEEKO
+   else
+ if test $gl_cv_var_stdin_large_offset = no; then
+   gl_REPLACE_FSEEKO
+ fi
+   fi
+ ])
+ 
+ dnl Tests whether fseeko is available.
+ dnl Result is gl_cv_func_fseeko.
+ AC_DEFUN([gl_HAVE_FSEEKO],
+ [
+   AC_REQUIRE([AC_PROG_CC])
+ 
dnl Persuade glibc stdio.h to declare fseeko().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
  
***
*** 19,38 
  ]], [fseeko (stdin, 0, 0);])],
  [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
  ])
-   if test $gl_cv_func_fseeko = no; then
- HAVE_FSEEKO=0
-   else
- if test $gl_cv_var_stdin_large_offset = no; then
-   REPLACE_FSEEKO=1
- fi
-   fi
-   if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
- gl_REPLACE_FSEEKO
-   fi
  ])
  
  AC_DEFUN([gl_REPLACE_FSEEKO],
  [
AC_LIBOBJ([fseeko])
dnl If we are also using the fseek module, then fseek needs replacing, too.
m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK])
--- 35,49 
  ]], [fseeko (stdin, 0, 0);])],
  [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
  ])
  ])
  
  AC_DEFUN([gl_REPLACE_FSEEKO],
  [
+   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+   AC_REQUIRE([gl_HAVE_FSEEKO])
+   if test $gl_cv_func_fseeko = yes; then
+ REPLACE_FSEEKO=1
+   fi
AC_LIBOBJ([fseeko])
dnl If we are also using the fseek module, then fseek needs replacing, too.
m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK])
*** m4/fflush.m4.orig   Mon Apr  5 18:11:01 2010
--- m4/fflush.m4Mon Apr  5 18:06:00 2010
***
*** 1,4 
! # fflush.m4 serial 7
  
  # Copyright (C) 2007-2010 Free Software Foundation, Inc.
  # This file is free software; the Free Software Foundation
--- 1,4 
! # fflush.m4 serial 8
  
  # Copyright (C) 2007-2010 Free Software Foundation, Inc.
  # This file is free software; the Free Software Foundation
***
*** 67,77 
  AC_DEFUN([gl_REPLACE_FFLUSH],
  [
AC_LIBOBJ([fflush])
-   AC_LIBOBJ([fseeko])
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
REPLACE_FFLUSH=1
-   REPLACE_FSEEKO=1
gl_PREREQ_FFLUSH
  ])
  
  # Prerequisites of lib/fflush.c.
--- 67,76 
  AC_DEFUN([gl_REPLACE_FFLUSH],
  [
AC_LIBOBJ([fflush])
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
REPLACE_FFLUSH=1
gl_PREREQ_FFLUSH
+   gl_REPLACE_FSEEKO
  ])
  
  # Prerequisites of lib/fflush.c.




fseeko on mingw

2010-04-03 Thread Bruno Haible
Similarly for the fseeko function on mingw. I'm seeing this error:

  ../gllib/stdio.h:632: error: `fseeko' was not declared in this scope

This should fix it.


2010-04-03  Bruno Haible  br...@clisp.org

fseeko: Fix C++ test error on mingw.
* lib/stdio.in.h (fseeko): Use modern idiom.
* m4/fseeko.m4 (gl_FUNC_FSEEKO): Distinguish the case that the function
is missing and that it needs to be replaced.
(gl_REPLACE_FSEEKO): Don't set REPLACE_FSEEKO here.
* m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Initialize HAVE_FSEEKO.
* modules/stdio (Makefile.am): Substitute HAVE_FSEEKO.

--- lib/stdio.in.h.orig Sat Apr  3 14:03:46 2010
+++ lib/stdio.in.h  Sat Apr  3 14:02:20 2010
@@ -322,30 +322,35 @@
 #  undef fseek
 # endif
 # if @REPLACE_FSEEKO@
-/* Provide fseek, fseeko functions that are aware of a preceding
-   fflush(), and which detect pipes.  */
+/* Provide an fseeko function that is aware of a preceding fflush(), and which
+   detects pipes.  */
 #  if !(defined __cplusplus  defined GNULIB_NAMESPACE)
 #   undef fseeko
 #   define fseeko rpl_fseeko
 #  endif
 _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
_GL_ARG_NONNULL ((1)));
-#  if !...@gnulib_fseek@
-/* In order to avoid that fseek gets defined as a macro here, the
-   developer can request the 'fseek' module.  */
-#   undef fseek
-#   define fseek rpl_fseek
+_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
+# else
+#  if ! @HAVE_FSEEKO@
+_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
+   _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
+# endif
+_GL_CXXALIASWARN (fseeko);
+# if (@REPLACE_FSEEKO@ || !...@have_fseeko@)  !...@gnulib_fseek@
+   /* Provide an fseek function that is consistent with fseeko.  */
+   /* In order to avoid that fseek gets defined as a macro here, the
+  developer can request the 'fseek' module.  */
+#  undef fseek
+#  define fseek rpl_fseek
 static inline int _GL_ARG_NONNULL ((1))
 rpl_fseek (FILE *fp, long offset, int whence)
 {
   return fseeko (fp, offset, whence);
 }
-#  endif
-_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
-# else
-_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
 # endif
-_GL_CXXALIASWARN (fseeko);
 #elif defined GNULIB_POSIXCHECK
 # define _GL_FSEEK_WARN /* Category 1, above.  */
 # undef fseek
--- m4/fseeko.m4.orig   Sat Apr  3 14:03:46 2010
+++ m4/fseeko.m4Sat Apr  3 13:55:55 2010
@@ -1,4 +1,4 @@
-# fseeko.m4 serial 7
+# fseeko.m4 serial 8
 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,
@@ -19,8 +19,14 @@
 ]], [fseeko (stdin, 0, 0);])],
 [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
 ])
-  if test $gl_cv_func_fseeko = no \
-  || test $gl_cv_var_stdin_large_offset = no; then
+  if test $gl_cv_func_fseeko = no; then
+HAVE_FSEEKO=0
+  else
+if test $gl_cv_var_stdin_large_offset = no; then
+  REPLACE_FSEEKO=1
+fi
+  fi
+  if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
 gl_REPLACE_FSEEKO
   fi
 ])
@@ -28,8 +34,6 @@
 AC_DEFUN([gl_REPLACE_FSEEKO],
 [
   AC_LIBOBJ([fseeko])
-  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
-  REPLACE_FSEEKO=1
   dnl If we are also using the fseek module, then fseek needs replacing, too.
   m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK])
 ])
--- m4/stdio_h.m4.orig  Sat Apr  3 14:03:46 2010
+++ m4/stdio_h.m4   Sat Apr  3 14:03:10 2010
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 27
+# stdio_h.m4 serial 28
 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,
@@ -99,6 +99,7 @@
   HAVE_DECL_SNPRINTF=1;  AC_SUBST([HAVE_DECL_SNPRINTF])
   HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF])
   HAVE_DPRINTF=1;AC_SUBST([HAVE_DPRINTF])
+  HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
   HAVE_RENAMEAT=1;   AC_SUBST([HAVE_RENAMEAT])
   HAVE_VASPRINTF=1;  AC_SUBST([HAVE_VASPRINTF])
   HAVE_VDPRINTF=1;   AC_SUBST([HAVE_VDPRINTF])
--- modules/stdio.orig  Sat Apr  3 14:03:46 2010
+++ modules/stdio   Sat Apr  3 14:02:46 2010
@@ -76,6 +76,7 @@
  -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
  -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_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \
  -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
  -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \