document mingw linker fix and close associated bug
[debian/gzip] / m4 / utime_h.m4
1 # utime_h.m4 serial 3
2 dnl Copyright (C) 2017-2018 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 dnl From Bruno Haible.
8
9 AC_DEFUN([gl_UTIME_H],
10 [
11   AC_REQUIRE([AC_CANONICAL_HOST])
12   AC_REQUIRE([gl_UTIME_H_DEFAULTS])
13   m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
14   AC_CHECK_HEADERS_ONCE([utime.h])
15   gl_CHECK_NEXT_HEADERS([utime.h])
16
17   if test $ac_cv_header_utime_h = yes; then
18     HAVE_UTIME_H=1
19   else
20     HAVE_UTIME_H=0
21   fi
22   AC_SUBST([HAVE_UTIME_H])
23
24   m4_ifdef([gl_POSIXCHECK],
25     [UTIME_H=utime.h],
26     [UTIME_H=''
27      if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then
28        dnl Override <utime.h> always, to support the C++ GNULIB_NAMESPACE.
29        UTIME_H=utime.h
30      else
31        if test $ac_cv_header_utime_h != yes; then
32          dnl Provide a substitute <utime.h> file.
33          UTIME_H=utime.h
34        else
35          case "$host_os" in
36            mingw*) dnl Need special handling of 'struct utimbuf'.
37              UTIME_H=utime.h
38              ;;
39          esac
40        fi
41      fi
42     ])
43   AC_SUBST([UTIME_H])
44   AM_CONDITIONAL([GL_GENERATE_UTIME_H], [test -n "$UTIME_H"])
45
46   dnl Check for declarations of anything we want to poison if the
47   dnl corresponding gnulib module is not in use.
48   gl_WARN_ON_USE_PREPARE([[#include <utime.h>
49     ]],
50     [utime])
51 ])
52
53 AC_DEFUN([gl_UTIME_MODULE_INDICATOR],
54 [
55   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
56   AC_REQUIRE([gl_UTIME_H_DEFAULTS])
57   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
58   dnl Define it also as a C macro, for the benefit of the unit tests.
59   gl_MODULE_INDICATOR_FOR_TESTS([$1])
60 ])
61
62 AC_DEFUN([gl_UTIME_H_DEFAULTS],
63 [
64   GNULIB_UTIME=0;            AC_SUBST([GNULIB_UTIME])
65   dnl Assume POSIX behavior unless another module says otherwise.
66   HAVE_UTIME=1;              AC_SUBST([HAVE_UTIME])
67   REPLACE_UTIME=0;           AC_SUBST([REPLACE_UTIME])
68 ])