Debian Codegraph @

m4/sched_h.m4

raw
1 # sched_h.m4 serial 12
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.
6
7 dnl Written by Bruno Haible.
8
9 AC_DEFUN([gl_SCHED_H],
10 [
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])
14
15 AC_REQUIRE([AC_CANONICAL_HOST])
16
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>
21 #endif
22 ]])
23 gl_NEXT_HEADERS([sched.h])
24
25 if test "$ac_cv_header_sched_h" = yes; then
26 HAVE_SCHED_H=1
27 else
28 HAVE_SCHED_H=0
29 fi
30 AC_SUBST([HAVE_SCHED_H])
31
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>
37 #endif
38 #include <sched.h>
39 ]])
40 else
41 HAVE_STRUCT_SCHED_PARAM=0
42 case "$host_os" in
43 os2*)
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], [],
47 [#include <spawn.h>])
48 ;;
49 vms)
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>])
54 ;;
55 esac
56 fi
57 AC_SUBST([HAVE_STRUCT_SCHED_PARAM])
58
59 if test "$ac_cv_header_sys_cdefs_h" = yes; then
60 HAVE_SYS_CDEFS_H=1
61 else
62 HAVE_SYS_CDEFS_H=0
63 fi
64 AC_SUBST([HAVE_SYS_CDEFS_H])
65
66 dnl Ensure the type pid_t gets defined.
67 AC_REQUIRE([AC_TYPE_PID_T])
68
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>
73 ]], [sched_yield])
74 ])
75
76 AC_DEFUN([gl_SCHED_MODULE_INDICATOR],
77 [
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])
83 ])
84
85 AC_DEFUN([gl_SCHED_H_DEFAULTS],
86 [
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])
91 ])