Debian Codegraph @

m4/ftruncate.m4

raw
1 # ftruncate.m4
2 # serial 24
3 dnl Copyright (C) 2000-2001, 2003-2007, 2009-2025 Free Software Foundation,
4 dnl Inc.
5 dnl This file is free software; the Free Software Foundation
6 dnl gives unlimited permission to copy and/or distribute it,
7 dnl with or without modifications, as long as this notice is preserved.
8 dnl This file is offered as-is, without any warranty.
9
10 # See if we need to emulate a missing ftruncate function using _chsize.
11
12 AC_DEFUN([gl_FUNC_FTRUNCATE],
13 [
14 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
15 gl_CHECK_FUNCS_ANDROID([ftruncate], [[#include <unistd.h>]])
16 if test $ac_cv_func_ftruncate = yes; then
17 m4_ifdef([gl_LARGEFILE], [
18 AC_REQUIRE([AC_CANONICAL_HOST])
19 case "$host_os" in
20 mingw* | windows*)
21 dnl Native Windows, and Large File Support is requested.
22 dnl The MSVCRT _chsize() function only accepts a 32-bit file size,
23 dnl and the mingw64 ftruncate64() function is unreliable (it may
24 dnl delete the file, see
25 dnl <https://web.archive.org/web/20160425005423/http://mingw-w64.sourcearchive.com/documentation/2.0-1/ftruncate64_8c_source.html>).
26 dnl Use gnulib's ftruncate() implementation instead.
27 REPLACE_FTRUNCATE=1
28 ;;
29 esac
30 ], [
31 :
32 ])
33 else
34 HAVE_FTRUNCATE=0
35 case "$gl_cv_onwards_func_ftruncate" in
36 future*) REPLACE_FTRUNCATE=1 ;;
37 esac
38 fi
39 ])
40
41 # Prerequisites of lib/ftruncate.c.
42 AC_DEFUN([gl_PREREQ_FTRUNCATE],
43 [
44 AC_CHECK_FUNCS([_chsize])
45 ])