New module 'posix_spawn-internal'.
[gnulib.git] / m4 / posix_spawn.m4
1 # posix_spawn.m4 serial 1
2 dnl Copyright (C) 2008 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 Tests whether the entire posix_spawn facility is available.
8 AC_DEFUN([gl_POSIX_SPAWN],
9 [
10   AC_REQUIRE([gl_POSIX_SPAWN_BODY])
11 ])
12
13 AC_DEFUN([gl_POSIX_SPAWN_BODY],
14 [
15   AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
16   AC_CHECK_FUNCS_ONCE([posix_spawn])
17   dnl Assume that when the main function exists, all the others are
18   dnl available as well.
19   dnl AC_CHECK_FUNCS_ONCE([posix_spawnp])
20   dnl AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_init])
21   dnl AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_addclose])
22   dnl AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_adddup2])
23   dnl AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_addopen])
24   dnl AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_destroy])
25   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_init])
26   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_getflags])
27   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_setflags])
28   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_getpgroup])
29   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_setpgroup])
30   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_getschedparam])
31   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_setschedparam])
32   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_getschedpolicy])
33   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_setschedpolicy])
34   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_getsigdefault])
35   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_setsigdefault])
36   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_getsigmask])
37   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_setsigmask])
38   dnl AC_CHECK_FUNCS_ONCE([posix_spawnattr_destroy])
39   if test $ac_cv_func_posix_spawn != yes; then
40     HAVE_POSIX_SPAWN=0
41     dnl For now, assume that if posix_spawn exists, it also works.
42     if false; then
43       REPLACE_POSIX_SPAWN=1
44     fi
45   fi
46 ])
47
48 AC_DEFUN([gl_POSIX_SPAWN_INTERNAL],
49 [
50   AC_LIBOBJ([spawni])
51   dnl Prerequisites of lib/spawni.c.
52   AC_CHECK_HEADERS([paths.h])
53   AC_CHECK_FUNCS([confstr sched_setparam sched_setscheduler setegid seteuid vfork])
54 ])