File: configure.ac

package info (click to toggle)
ghc 9.10.3-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 169,076 kB
  • sloc: haskell: 713,554; ansic: 84,184; cpp: 30,255; javascript: 9,003; sh: 7,870; fortran: 3,527; python: 3,228; asm: 2,523; makefile: 2,324; yacc: 1,570; lisp: 532; xml: 196; perl: 111; csh: 2
file content (76 lines) | stat: -rw-r--r-- 2,264 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
AC_INIT([Haskell process package],[1.0],[libraries@haskell.org],[process])

# Safety check: Ensure that we are in the correct source directory.
AC_CONFIG_SRCDIR([include/runProcess.h])

AC_CONFIG_HEADERS([include/HsProcessConfig.h])

AC_PROG_CC

dnl ** Working fork?
AC_FUNC_FORK

# check for specific header (.h) files that we are interested in
AC_CHECK_HEADERS([signal.h sys/wait.h fcntl.h])

AC_CHECK_FUNCS([setitimer sysconf])
AC_CHECK_FUNCS([execvpe])
AC_CHECK_FUNCS([pipe2],[],[],[
  #define _GNU_SOURCE
  #include <unistd.h>
  #include <fcntl.h>
])

# posix_spawn checks
AC_CHECK_HEADERS([spawn.h])
AC_CHECK_FUNCS([posix_spawnp posix_spawn_file_actions_addchdir_np posix_spawn_file_actions_addchdir],[],[],[
  #define _GNU_SOURCE
  #include <spawn.h>
])
AC_CHECK_DECLS([POSIX_SPAWN_SETSID, POSIX_SPAWN_SETSID_NP],[],[],[
  #define _GNU_SOURCE
  #include <spawn.h>
])
AC_CHECK_DECLS([POSIX_SPAWN_SETPGROUP],[],[],[
  #define _GNU_SOURCE
  #include <spawn.h>
])

if test "$ac_cv_func_posix_spawnp" = "yes"; then
    dnl On OpenBSD posix_spawnp doesn't report ENOENT when
    dnl the user attempts to spawn a process with a non-existent
    dnl executable. Don't attempt to use such posix_spawn
    dnl implementations to ensure errors are reported correctly.
    dnl See #224.

    AC_MSG_CHECKING(whether posix_spawn reports errors sensibly)
    AC_RUN_IFELSE(
        [AC_LANG_PROGRAM([
             #include <stddef.h>
             #include <stdbool.h>
             #include <errno.h>
             #include <spawn.h>
           ], [[
                 pid_t pid;
                 char *prog = "__nonexistent_program__";
                 char *args[] = {prog, NULL};
                 char *env[] = {NULL};

                 // This should fail with ENOENT
                 int ret = posix_spawnp(&pid, prog, NULL, NULL, args, env);
                 bool okay = ret == ENOENT;
                 return !okay;
           ]]
         )],
         [AC_DEFINE([USE_POSIX_SPAWN], [], [posix_spawn should be used])
          AC_MSG_RESULT(yes)],
         [AC_MSG_RESULT([no, falling back to fork/exec])],
         [AC_DEFINE([USE_POSIX_SPAWN], [], [])
          AC_MSG_RESULT(cross-compiling - assuming yes)]
    )
fi


FP_CHECK_CONSTS([SIG_DFL SIG_IGN])

AC_OUTPUT