(init_subshell): use openpty() to open master/slave devices for subshell.
[midnight-commander.git] / m4.include / mc-subshell.m4
blob6c17be6f9efd970a602c66877176e8f124998a87
1 dnl
2 dnl Subshell support.
3 dnl
4 AC_DEFUN([mc_SUBSHELL], [
6     AC_MSG_CHECKING([for subshell support])
7     AC_ARG_WITH(subshell,
8             [  --with-subshell          Compile in concurrent subshell @<:@yes@:>@
9   --with-subshell=optional Don't run concurrent shell by default @<:@no@:>@],
10             [
11                 result=no
12                 if test x$withval = xoptional; then
13                     AC_DEFINE(SUBSHELL_OPTIONAL, 1,  [Define to make subshell support optional])
14                     result="optional"
15                 fi
16                 if test x$withval = xyes; then
17                     result="yes"
18                 fi
19             ],
20             [
21                 dnl Default: enable the subshell support
22                 result="yes"
23             ])
25     if test "x$result" != xno; then
26         AC_DEFINE(ENABLE_SUBSHELL, 1, [Define to enable subshell support])
28         dnl openpty() can simplify opening of master/slave devices for subshell
29         AC_CHECK_HEADERS([pty.h libutil.h util.h])
30         AC_CHECK_FUNCS(openpty,,
31             AC_CHECK_LIB(util,openpty,
32                 [AC_DEFINE(HAVE_OPENPTY)
33                     LIBS="$LIBS -lutil"]
34             )
35         )
36     fi
38     AC_MSG_RESULT([$result])
39     subshell="$result"
41     AM_CONDITIONAL(ENABLE_SUBSHELL, [test "x$result" != xno])