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