Merge from coreutils.
[gnulib.git] / m4 / ftruncate.m4
1 #serial 9
2
3 # See if we need to emulate a missing ftruncate function using fcntl or chsize.
4
5 # Copyright (C) 2000, 2001, 2003-2006 Free Software Foundation, Inc.
6 # This file is free software; the Free Software Foundation
7 # gives unlimited permission to copy and/or distribute it,
8 # with or without modifications, as long as this notice is preserved.
9
10 # FIXME: remove this macro, along with all uses of HAVE_FTRUNCATE in 2007,
11 # if the check below provokes no reports.
12
13 AC_DEFUN([gl_FUNC_FTRUNCATE],
14 [
15   AC_REPLACE_FUNCS(ftruncate)
16   if test $ac_cv_func_ftruncate = no; then
17     gl_PREREQ_FTRUNCATE
18     # If someone lacks ftruncate, make configure fail, and request
19     # a bug report to inform us about it.
20     if test x"$SKIP_FTRUNCATE_CHECK" != xyes; then
21       AC_MSG_FAILURE([Your system lacks the ftruncate function.
22           Please report this, along with the output of "uname -a", to the
23           bug-coreutils@gnu.org mailing list.  To continue past this point,
24           rerun configure with SKIP_FTRUNCATE_CHECK=yes set in the environment.
25           E.g., env SKIP_FTRUNCATE_CHECK=yes ./configure])
26     fi
27   fi
28 ])
29
30 # Prerequisites of lib/ftruncate.c.
31 AC_DEFUN([gl_PREREQ_FTRUNCATE],
32 [
33   AC_CHECK_FUNCS(chsize)
34 ])