* lisp/dired-aux.el (shell-command-guess-xdg): Check nil xdg-mime (bug#71270).
[emacs.git] / m4 / nproc.m4
blob317741d9b8dc17cd1834f76b08da9dd431c89d6e
1 # nproc.m4
2 # serial 6
3 dnl Copyright (C) 2009-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 AC_DEFUN([gl_NPROC],
10   gl_PREREQ_NPROC
13 # Prerequisites of lib/nproc.c.
14 AC_DEFUN([gl_PREREQ_NPROC],
16   dnl Persuade glibc <sched.h> to declare CPU_SETSIZE, CPU_ISSET etc.
17   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
19   AC_CHECK_HEADERS([sys/pstat.h sys/sysmp.h sys/param.h],,,
20     [AC_INCLUDES_DEFAULT])
21   dnl <sys/sysctl.h> requires <sys/param.h> on OpenBSD 4.0.
22   AC_CHECK_HEADERS([sys/sysctl.h],,,
23     [AC_INCLUDES_DEFAULT
24      #if HAVE_SYS_PARAM_H
25      # include <sys/param.h>
26      #endif
27     ])
29   AC_CHECK_FUNCS([sched_getaffinity_np pstat_getdynamic sysmp sysctl])
30   gl_CHECK_FUNCS_ANDROID([sched_getaffinity], [[#include <sched.h>]])
32   dnl Test whether sched_getaffinity has the expected declaration.
33   dnl glibc 2.3.[0-2]:
34   dnl   int sched_getaffinity (pid_t, unsigned int, unsigned long int *);
35   dnl glibc 2.3.3:
36   dnl   int sched_getaffinity (pid_t, cpu_set_t *);
37   dnl glibc >= 2.3.4:
38   dnl   int sched_getaffinity (pid_t, size_t, cpu_set_t *);
39   if test $ac_cv_func_sched_getaffinity = yes; then
40     AC_CACHE_CHECK([for glibc compatible sched_getaffinity],
41       [gl_cv_func_sched_getaffinity3],
42       [AC_COMPILE_IFELSE(
43          [AC_LANG_PROGRAM(
44             [[#include <errno.h>
45               #include <sched.h>]],
46             [[sched_getaffinity (0, 0, (cpu_set_t *) 0);]])],
47          [gl_cv_func_sched_getaffinity3=yes],
48          [gl_cv_func_sched_getaffinity3=no])
49       ])
50     if test $gl_cv_func_sched_getaffinity3 = yes; then
51       AC_DEFINE([HAVE_SCHED_GETAFFINITY_LIKE_GLIBC], [1],
52         [Define to 1 if sched_getaffinity has a glibc compatible declaration.])
53     fi
54   fi