sys_file_h.m4 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Configure a replacement for <sys/file.h>.
  2. # serial 9
  3. # Copyright (C) 2008-2022 Free Software Foundation, Inc.
  4. # This file is free software; the Free Software Foundation
  5. # gives unlimited permission to copy and/or distribute it,
  6. # with or without modifications, as long as this notice is preserved.
  7. # Written by Richard W.M. Jones.
  8. AC_DEFUN_ONCE([gl_SYS_FILE_H],
  9. [
  10. AC_REQUIRE([gl_SYS_FILE_H_DEFAULTS])
  11. dnl <sys/file.h> is always overridden, because of GNULIB_POSIXCHECK.
  12. gl_CHECK_NEXT_HEADERS([sys/file.h])
  13. if test $ac_cv_header_sys_file_h = yes; then
  14. HAVE_SYS_FILE_H=1
  15. else
  16. HAVE_SYS_FILE_H=0
  17. fi
  18. AC_SUBST([HAVE_SYS_FILE_H])
  19. dnl Check for declarations of anything we want to poison if the
  20. dnl corresponding gnulib module is not in use.
  21. gl_WARN_ON_USE_PREPARE([[#include <sys/file.h>
  22. ]], [flock])
  23. ])
  24. # gl_SYS_FILE_MODULE_INDICATOR([modulename])
  25. # sets the shell variable that indicates the presence of the given module
  26. # to a C preprocessor expression that will evaluate to 1.
  27. # This macro invocation must not occur in macros that are AC_REQUIREd.
  28. AC_DEFUN([gl_SYS_FILE_MODULE_INDICATOR],
  29. [
  30. gl_SYS_FILE_H_REQUIRE_DEFAULTS
  31. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  32. ])
  33. # Initializes the default values for AC_SUBSTed shell variables.
  34. # This macro must not be AC_REQUIREd. It must only be invoked, and only
  35. # outside of macros or in macros that are not AC_REQUIREd.
  36. AC_DEFUN([gl_SYS_FILE_H_REQUIRE_DEFAULTS],
  37. [
  38. m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_FILE_H_MODULE_INDICATOR_DEFAULTS], [
  39. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOCK])
  40. ])
  41. m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_FILE_H_MODULE_INDICATOR_DEFAULTS])
  42. AC_REQUIRE([gl_SYS_FILE_H_DEFAULTS])
  43. ])
  44. AC_DEFUN([gl_SYS_FILE_H_DEFAULTS],
  45. [
  46. HAVE_FLOCK=1; AC_SUBST([HAVE_FLOCK])
  47. ])