2 dnl Copyright (C) 2008-2020 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.
11 dnl Use AC_REQUIRE here, so that the default behavior below is expanded
12 dnl once only, before all statements 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 AC_DEFUN([gl_SCHED_MODULE_INDICATOR],
78 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
79 AC_REQUIRE([gl_SCHED_H_DEFAULTS])
80 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
81 dnl Define it also as a C macro, for the benefit of the unit tests.
82 gl_MODULE_INDICATOR_FOR_TESTS([$1])
85 AC_DEFUN([gl_SCHED_H_DEFAULTS],
87 GNULIB_SCHED_YIELD=0; AC_SUBST([GNULIB_SCHED_YIELD])
88 dnl Assume proper GNU behavior unless another module says otherwise.
89 HAVE_SCHED_YIELD=1; AC_SUBST([HAVE_SCHED_YIELD])
90 REPLACE_SCHED_YIELD=0; AC_SUBST([REPLACE_SCHED_YIELD])