New module 'fseeko'.
authorBruno Haible <bruno@clisp.org>
Wed, 25 Apr 2007 07:39:55 +0000 (07:39 +0000)
committerBruno Haible <bruno@clisp.org>
Wed, 25 Apr 2007 07:39:55 +0000 (07:39 +0000)
ChangeLog
lib/stdio_.h
m4/fseeko.m4 [new file with mode: 0644]
m4/stdio_h.m4
modules/fseeko [new file with mode: 0644]
modules/stdio

index bf3901e..314aeb4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2007-04-25  Bruno Haible  <bruno@clisp.org>
 
+       * modules/fseeko: New file.
+       * m4/fseeko.m4: New file.
+       * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Set also GNULIB_FSEEKO,
+       HAVE_FSEEKO.
+       * lib/stdio_.h (fseeko): New declaration.
+       * modules/stdio (Makefile.am): Substitute also GNULIB_FSEEKO,
+       HAVE_FSEEKO.
+
+2007-04-25  Bruno Haible  <bruno@clisp.org>
+
        * lib/stdio_.h (fflush): Add support for GNULIB_POSIXCHECK.
 
 2007-04-25  Bruno Haible  <bruno@clisp.org>
index 2a5a253..54024d2 100644 (file)
@@ -207,6 +207,19 @@ extern int vsprintf (char *str, const char *format, va_list args)
 # endif
 #endif
 
+#if @GNULIB_FSEEKO@
+# if !@HAVE_FSEEKO@
+/* Assume 'off_t' is the same type as 'long'.  */
+#  define fseeko fseek
+# endif
+#else
+# undef fseeko
+# define fseeko(f,o,w) \
+   (GL_LINK_WARNING ("fseeko is unportable - " \
+                     "use gnulib module fseeko for portability"), \
+    fseeko (f, o, w))
+#endif
+
 #if @GNULIB_FFLUSH@
 # if @REPLACE_FFLUSH@
 #  define fflush rpl_fflush
diff --git a/m4/fseeko.m4 b/m4/fseeko.m4
new file mode 100644 (file)
index 0000000..86d42f4
--- /dev/null
@@ -0,0 +1,19 @@
+# fseeko.m4 serial 1
+dnl Copyright (C) 2007 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_FSEEKO],
+[
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_PROG_CC])
+  AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
+    [
+      AC_TRY_LINK([#include <stdio.h>], [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
+  fi
+])
index d53997f..06bbea0 100644 (file)
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 3
+# stdio_h.m4 serial 4
 dnl Copyright (C) 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -30,6 +30,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   GNULIB_VSNPRINTF=0;      AC_SUBST([GNULIB_VSNPRINTF])
   GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
   GNULIB_VASPRINTF=0;      AC_SUBST([GNULIB_VASPRINTF])
+  GNULIB_FSEEKO=0;         AC_SUBST([GNULIB_FSEEKO])
   GNULIB_FFLUSH=0;         AC_SUBST([GNULIB_FFLUSH])
   dnl Assume proper GNU behavior unless another module says otherwise.
   REPLACE_FPRINTF=0;       AC_SUBST([REPLACE_FPRINTF])
@@ -44,5 +45,6 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   REPLACE_VSPRINTF=0;      AC_SUBST([REPLACE_VSPRINTF])
   HAVE_VASPRINTF=1;        AC_SUBST([HAVE_VASPRINTF])
   REPLACE_VASPRINTF=0;     AC_SUBST([REPLACE_VASPRINTF])
+  HAVE_FSEEKO=1;           AC_SUBST([HAVE_FSEEKO])
   REPLACE_FFLUSH=0;        AC_SUBST([REPLACE_FFLUSH])
 ])
diff --git a/modules/fseeko b/modules/fseeko
new file mode 100644 (file)
index 0000000..ed72f14
--- /dev/null
@@ -0,0 +1,24 @@
+Description:
+fseeko() function: Reposition a FILE stream.
+
+Files:
+m4/fseeko.m4
+
+Depends-on:
+stdio
+
+configure.ac:
+gl_FUNC_FSEEKO
+gl_STDIO_MODULE_INDICATOR([fseeko])
+
+Makefile.am:
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
+
index 3ee2d0b..d1deea9 100644 (file)
@@ -30,6 +30,7 @@ stdio.h: stdio_.h
              -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
              -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
              -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
+             -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
              -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
              -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
              -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
@@ -43,6 +44,7 @@ stdio.h: stdio_.h
              -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
              -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
              -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
+             -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \
              -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              < $(srcdir)/stdio_.h; \