From ca1e86d127224617de04715b6e7080560f921158 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 12 May 2018 20:37:47 +0200 Subject: [PATCH] fseeko: On mingw, don't use the hidden function _fseeki64. Reported by Eli Zaretskii . * m4/fseeko.m4 (gl_PREREQ_FSEEKO): Test whether _fseeki64 is declared. * lib/fseeko.c (fseeko): Use _fseeki64 only if it is declared. --- ChangeLog | 7 +++++++ lib/fseeko.c | 4 ++-- m4/fseeko.m4 | 9 ++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 88630dd23a..6085d38f1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-05-12 Bruno Haible + + fseeko: On mingw, don't use the hidden function _fseeki64. + Reported by Eli Zaretskii . + * m4/fseeko.m4 (gl_PREREQ_FSEEKO): Test whether _fseeki64 is declared. + * lib/fseeko.c (fseeko): Use _fseeki64 only if it is declared. + 2018-05-12 Bruno Haible glob: Choose 'dirent_type' in a way that works better on mingw. diff --git a/lib/fseeko.c b/lib/fseeko.c index e5c5172e78..d47481d8ff 100644 --- a/lib/fseeko.c +++ b/lib/fseeko.c @@ -33,9 +33,9 @@ fseeko (FILE *fp, off_t offset, int whence) #endif #if _GL_WINDOWS_64_BIT_OFF_T # undef fseeko -# if HAVE__FSEEKI64 /* msvc, mingw64 */ +# if HAVE__FSEEKI64 && HAVE_DECL__FSEEKI64 /* msvc, mingw since msvcrt8.0, mingw64 */ # define fseeko _fseeki64 -# else /* mingw */ +# else /* mingw before msvcrt8.0 */ # define fseeko fseeko64 # endif #endif diff --git a/m4/fseeko.m4 b/m4/fseeko.m4 index 8967cf1539..86c246e899 100644 --- a/m4/fseeko.m4 +++ b/m4/fseeko.m4 @@ -1,4 +1,4 @@ -# fseeko.m4 serial 18 +# fseeko.m4 serial 19 dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -68,7 +68,10 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET], # Prerequisites of lib/fseeko.c. AC_DEFUN([gl_PREREQ_FSEEKO], [ - dnl Native Windows has the function _fseeki64. mingw hides it, but mingw64 - dnl makes it usable again. + dnl Native Windows has the function _fseeki64. mingw hides it in some + dnl circumstances, but mingw64 makes it usable again. AC_CHECK_FUNCS([_fseeki64]) + if test $ac_cv_func__fseeki64 = yes; then + AC_CHECK_DECLS([_fseeki64]) + fi ]) -- 2.39.5