Home | History | Annotate | Line # | Download | only in m4
      1  1.1.1.2  christos # serial 20
      2      1.1  christos # Configure fcntl.h.
      3  1.1.1.2  christos dnl Copyright (C) 2006-2007, 2009-2022 Free Software Foundation, Inc.
      4      1.1  christos dnl This file is free software; the Free Software Foundation
      5      1.1  christos dnl gives unlimited permission to copy and/or distribute it,
      6      1.1  christos dnl with or without modifications, as long as this notice is preserved.
      7      1.1  christos 
      8      1.1  christos dnl Written by Paul Eggert.
      9      1.1  christos 
     10  1.1.1.2  christos AC_DEFUN_ONCE([gl_FCNTL_H],
     11      1.1  christos [
     12      1.1  christos   AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
     13      1.1  christos   AC_REQUIRE([gl_FCNTL_O_FLAGS])
     14      1.1  christos   gl_NEXT_HEADERS([fcntl.h])
     15      1.1  christos 
     16      1.1  christos   dnl Ensure the type pid_t gets defined.
     17      1.1  christos   AC_REQUIRE([AC_TYPE_PID_T])
     18      1.1  christos 
     19      1.1  christos   dnl Ensure the type mode_t gets defined.
     20      1.1  christos   AC_REQUIRE([AC_TYPE_MODE_T])
     21      1.1  christos 
     22      1.1  christos   dnl Check for declarations of anything we want to poison if the
     23      1.1  christos   dnl corresponding gnulib module is not in use, if it is not common
     24      1.1  christos   dnl enough to be declared everywhere.
     25      1.1  christos   gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
     26      1.1  christos     ]], [fcntl openat])
     27      1.1  christos ])
     28      1.1  christos 
     29  1.1.1.2  christos # gl_FCNTL_MODULE_INDICATOR([modulename])
     30  1.1.1.2  christos # sets the shell variable that indicates the presence of the given module
     31  1.1.1.2  christos # to a C preprocessor expression that will evaluate to 1.
     32  1.1.1.2  christos # This macro invocation must not occur in macros that are AC_REQUIREd.
     33      1.1  christos AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
     34      1.1  christos [
     35  1.1.1.2  christos   dnl Ensure to expand the default settings once only.
     36  1.1.1.2  christos   gl_FCNTL_H_REQUIRE_DEFAULTS
     37      1.1  christos   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
     38      1.1  christos   dnl Define it also as a C macro, for the benefit of the unit tests.
     39      1.1  christos   gl_MODULE_INDICATOR_FOR_TESTS([$1])
     40      1.1  christos ])
     41      1.1  christos 
     42  1.1.1.2  christos # Initializes the default values for AC_SUBSTed shell variables.
     43  1.1.1.2  christos # This macro must not be AC_REQUIREd.  It must only be invoked, and only
     44  1.1.1.2  christos # outside of macros or in macros that are not AC_REQUIREd.
     45  1.1.1.2  christos AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
     46  1.1.1.2  christos [
     47  1.1.1.2  christos   m4_defun(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS], [
     48  1.1.1.2  christos     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CREAT])
     49  1.1.1.2  christos     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCNTL])
     50  1.1.1.2  christos     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING])
     51  1.1.1.2  christos     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN])
     52  1.1.1.2  christos     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT])
     53  1.1.1.2  christos     dnl Support Microsoft deprecated alias function names by default.
     54  1.1.1.2  christos     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1])
     55  1.1.1.2  christos     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1])
     56  1.1.1.2  christos   ])
     57  1.1.1.2  christos   m4_require(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS])
     58  1.1.1.2  christos   AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
     59  1.1.1.2  christos ])
     60  1.1.1.2  christos 
     61      1.1  christos AC_DEFUN([gl_FCNTL_H_DEFAULTS],
     62      1.1  christos [
     63      1.1  christos   dnl Assume proper GNU behavior unless another module says otherwise.
     64      1.1  christos   HAVE_FCNTL=1;          AC_SUBST([HAVE_FCNTL])
     65      1.1  christos   HAVE_OPENAT=1;         AC_SUBST([HAVE_OPENAT])
     66      1.1  christos   REPLACE_CREAT=0;       AC_SUBST([REPLACE_CREAT])
     67      1.1  christos   REPLACE_FCNTL=0;       AC_SUBST([REPLACE_FCNTL])
     68      1.1  christos   REPLACE_OPEN=0;        AC_SUBST([REPLACE_OPEN])
     69      1.1  christos   REPLACE_OPENAT=0;      AC_SUBST([REPLACE_OPENAT])
     70      1.1  christos ])
     71