2 dnl Copyright (C) 2009-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.
12 # Prerequisites of lib/nproc.c.
13 AC_DEFUN([gl_PREREQ_NPROC],
15 dnl Persuade glibc <sched.h> to declare CPU_SETSIZE, CPU_ISSET etc.
16 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
18 AC_CHECK_HEADERS([sys/pstat.h sys/sysmp.h sys/param.h],,,
19 [AC_INCLUDES_DEFAULT])
20 dnl <sys/sysctl.h> requires <sys/param.h> on OpenBSD 4.0.
21 AC_CHECK_HEADERS([sys/sysctl.h],,,
24 # include <sys/param.h>
28 AC_CHECK_FUNCS([sched_getaffinity sched_getaffinity_np \
29 pstat_getdynamic sysmp sysctl])
31 dnl Test whether sched_getaffinity has the expected declaration.
33 dnl int sched_getaffinity (pid_t, unsigned int, unsigned long int *);
35 dnl int sched_getaffinity (pid_t, cpu_set_t *);
37 dnl int sched_getaffinity (pid_t, size_t, cpu_set_t *);
38 if test $ac_cv_func_sched_getaffinity = yes; then
39 AC_CACHE_CHECK([for glibc compatible sched_getaffinity],
40 [gl_cv_func_sched_getaffinity3],
45 [[sched_getaffinity (0, 0, (cpu_set_t *) 0);]])],
46 [gl_cv_func_sched_getaffinity3=yes],
47 [gl_cv_func_sched_getaffinity3=no])
49 if test $gl_cv_func_sched_getaffinity3 = yes; then
50 AC_DEFINE([HAVE_SCHED_GETAFFINITY_LIKE_GLIBC], [1],
51 [Define to 1 if sched_getaffinity has a glibc compatible declaration.])