2 dnl Copyright (C) 2008-2021 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.
7 dnl Written by Bruno Haible.
9 AC_DEFUN_ONCE([gl_SCHED_H],
11 dnl Ensure to expand the default settings once only, before all statements
12 dnl that occur in other macros.
13 AC_REQUIRE([gl_SCHED_H_DEFAULTS])
15 AC_REQUIRE([AC_CANONICAL_HOST])
17 AC_CHECK_HEADERS_ONCE([sys/cdefs.h])
18 AC_CHECK_HEADERS([sched.h], [], [],
19 [[#if HAVE_SYS_CDEFS_H
20 #include <sys/cdefs.h>
23 gl_NEXT_HEADERS([sched.h])
25 if test "$ac_cv_header_sched_h" = yes; then
30 AC_SUBST([HAVE_SCHED_H])
32 if test "$HAVE_SCHED_H" = 1; then
33 AC_CHECK_TYPE([struct sched_param],
34 [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0],
35 [[#if HAVE_SYS_CDEFS_H
36 #include <sys/cdefs.h>
41 HAVE_STRUCT_SCHED_PARAM=0
44 dnl On OS/2 kLIBC, struct sched_param is in spawn.h.
45 AC_CHECK_TYPE([struct sched_param],
46 [HAVE_STRUCT_SCHED_PARAM=1], [],
50 dnl On OpenVMS 7.2 or newer, struct sched_param is in pthread.h.
51 AC_CHECK_TYPE([struct sched_param],
52 [HAVE_STRUCT_SCHED_PARAM=1], [],
53 [#include <pthread.h>])
57 AC_SUBST([HAVE_STRUCT_SCHED_PARAM])
59 if test "$ac_cv_header_sys_cdefs_h" = yes; then
64 AC_SUBST([HAVE_SYS_CDEFS_H])
66 dnl Ensure the type pid_t gets defined.
67 AC_REQUIRE([AC_TYPE_PID_T])
69 dnl Check for declarations of anything we want to poison if the
70 dnl corresponding gnulib module is not in use, if it is not common
71 dnl enough to be declared everywhere.
72 gl_WARN_ON_USE_PREPARE([[#include <sched.h>
76 # gl_SCHED_MODULE_INDICATOR([modulename])
77 # sets the shell variable that indicates the presence of the given module
78 # to a C preprocessor expression that will evaluate to 1.
79 # This macro invocation must not occur in macros that are AC_REQUIREd.
80 AC_DEFUN([gl_SCHED_MODULE_INDICATOR],
82 dnl Ensure to expand the default settings once only.
83 gl_SCHED_H_REQUIRE_DEFAULTS
84 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
85 dnl Define it also as a C macro, for the benefit of the unit tests.
86 gl_MODULE_INDICATOR_FOR_TESTS([$1])
89 # Initializes the default values for AC_SUBSTed shell variables.
90 # This macro must not be AC_REQUIREd. It must only be invoked, and only
91 # outside of macros or in macros that are not AC_REQUIREd.
92 AC_DEFUN([gl_SCHED_H_REQUIRE_DEFAULTS],
94 m4_defun(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS], [
95 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCHED_YIELD])
97 m4_require(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS])
98 AC_REQUIRE([gl_SCHED_H_DEFAULTS])
101 AC_DEFUN([gl_SCHED_H_DEFAULTS],
103 dnl Assume proper GNU behavior unless another module says otherwise.
104 HAVE_SCHED_YIELD=1; AC_SUBST([HAVE_SCHED_YIELD])
105 REPLACE_SCHED_YIELD=0; AC_SUBST([REPLACE_SCHED_YIELD])