Blame m4/ftruncate.m4

Packit Service fdd496
# serial 20
Packit Service fdd496
Packit Service fdd496
# See if we need to emulate a missing ftruncate function using chsize.
Packit Service fdd496
Packit Service fdd496
# Copyright (C) 2000-2001, 2003-2007, 2009-2017 Free Software Foundation, Inc.
Packit Service fdd496
# This file is free software; the Free Software Foundation
Packit Service fdd496
# gives unlimited permission to copy and/or distribute it,
Packit Service fdd496
# with or without modifications, as long as this notice is preserved.
Packit Service fdd496
Packit Service fdd496
AC_DEFUN([gl_FUNC_FTRUNCATE],
Packit Service fdd496
[
Packit Service fdd496
  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
Packit Service fdd496
  AC_CHECK_FUNCS_ONCE([ftruncate])
Packit Service fdd496
  if test $ac_cv_func_ftruncate = yes; then
Packit Service fdd496
    m4_ifdef([gl_LARGEFILE], [
Packit Service fdd496
      AC_REQUIRE([AC_CANONICAL_HOST])
Packit Service fdd496
      case "$host_os" in
Packit Service fdd496
        mingw*)
Packit Service fdd496
          dnl Native Windows, and Large File Support is requested.
Packit Service fdd496
          dnl The MSVCRT _chsize() function only accepts a 32-bit file size,
Packit Service fdd496
          dnl and the mingw64 ftruncate64() function is unreliable (it may
Packit Service fdd496
          dnl delete the file, see
Packit Service fdd496
          dnl <http://mingw-w64.sourcearchive.com/documentation/2.0-1/ftruncate64_8c_source.html>).
Packit Service fdd496
          dnl Use gnulib's ftruncate() implementation instead.
Packit Service fdd496
          REPLACE_FTRUNCATE=1
Packit Service fdd496
          ;;
Packit Service fdd496
      esac
Packit Service fdd496
    ], [
Packit Service fdd496
      :
Packit Service fdd496
    ])
Packit Service fdd496
  else
Packit Service fdd496
    HAVE_FTRUNCATE=0
Packit Service fdd496
  fi
Packit Service fdd496
])
Packit Service fdd496
Packit Service fdd496
# Prerequisites of lib/ftruncate.c.
Packit Service fdd496
AC_DEFUN([gl_PREREQ_FTRUNCATE],
Packit Service fdd496
[
Packit Service fdd496
  AC_CHECK_FUNCS([chsize])
Packit Service fdd496
])