Blame m4/fseeko.m4

Packit aea12f
# fseeko.m4 serial 19
Packit aea12f
dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
Packit aea12f
dnl This file is free software; the Free Software Foundation
Packit aea12f
dnl gives unlimited permission to copy and/or distribute it,
Packit aea12f
dnl with or without modifications, as long as this notice is preserved.
Packit aea12f
Packit aea12f
AC_DEFUN([gl_FUNC_FSEEKO],
Packit aea12f
[
Packit aea12f
  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
Packit aea12f
  AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
Packit aea12f
  AC_REQUIRE([gl_SYS_TYPES_H])
Packit aea12f
  AC_REQUIRE([AC_PROG_CC])
Packit aea12f
Packit aea12f
  dnl Persuade glibc <stdio.h> to declare fseeko().
Packit aea12f
  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
Packit aea12f
Packit aea12f
  AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
Packit aea12f
    [
Packit aea12f
      AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
Packit aea12f
]], [fseeko (stdin, 0, 0);])],
Packit aea12f
        [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
Packit aea12f
    ])
Packit aea12f
Packit aea12f
  AC_CHECK_DECLS_ONCE([fseeko])
Packit aea12f
  if test $ac_cv_have_decl_fseeko = no; then
Packit aea12f
    HAVE_DECL_FSEEKO=0
Packit aea12f
  fi
Packit aea12f
Packit aea12f
  if test $gl_cv_func_fseeko = no; then
Packit aea12f
    HAVE_FSEEKO=0
Packit aea12f
  else
Packit aea12f
    if test $WINDOWS_64_BIT_OFF_T = 1; then
Packit aea12f
      REPLACE_FSEEKO=1
Packit aea12f
    fi
Packit aea12f
    if test $gl_cv_var_stdin_large_offset = no; then
Packit aea12f
      REPLACE_FSEEKO=1
Packit aea12f
    fi
Packit aea12f
    m4_ifdef([gl_FUNC_FFLUSH_STDIN], [
Packit aea12f
      gl_FUNC_FFLUSH_STDIN
Packit aea12f
      case "$gl_cv_func_fflush_stdin" in
Packit aea12f
        *yes) ;;
Packit aea12f
        *) REPLACE_FSEEKO=1 ;;
Packit aea12f
      esac
Packit aea12f
    ])
Packit aea12f
  fi
Packit aea12f
])
Packit aea12f
Packit aea12f
dnl Code shared by fseeko and ftello.  Determine if large files are supported,
Packit aea12f
dnl but stdin does not start as a large file by default.
Packit aea12f
AC_DEFUN([gl_STDIN_LARGE_OFFSET],
Packit aea12f
  [
Packit aea12f
    AC_CACHE_CHECK([whether stdin defaults to large file offsets],
Packit aea12f
      [gl_cv_var_stdin_large_offset],
Packit aea12f
      [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
Packit aea12f
[[#if defined __SL64 && defined __SCLE /* cygwin */
Packit aea12f
  /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
Packit aea12f
     fseeko/ftello needlessly fail.  This bug was fixed in 1.5.25, and
Packit aea12f
     it is easier to do a version check than building a runtime test.  */
Packit aea12f
# include <cygwin/version.h>
Packit aea12f
# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
Packit aea12f
  choke me
Packit aea12f
# endif
Packit aea12f
#endif]])],
Packit aea12f
        [gl_cv_var_stdin_large_offset=yes],
Packit aea12f
        [gl_cv_var_stdin_large_offset=no])])
Packit aea12f
])
Packit aea12f
Packit aea12f
# Prerequisites of lib/fseeko.c.
Packit aea12f
AC_DEFUN([gl_PREREQ_FSEEKO],
Packit aea12f
[
Packit aea12f
  dnl Native Windows has the function _fseeki64. mingw hides it in some
Packit aea12f
  dnl circumstances, but mingw64 makes it usable again.
Packit aea12f
  AC_CHECK_FUNCS([_fseeki64])
Packit aea12f
  if test $ac_cv_func__fseeki64 = yes; then
Packit aea12f
    AC_CHECK_DECLS([_fseeki64])
Packit aea12f
  fi
Packit aea12f
])