2 dnl Copyright (C) 2010 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.
9 # Define automake variable PTY_LIB to the library needed (if any).
10 AC_DEFUN([gl_PTY_LIB],
12 # Check for the library required for forkpty.
15 AC_SEARCH_LIBS([forkpty], [util],
16 [if test "$ac_cv_search_forkpty" != "none required"; then
17 PTY_LIB="$ac_cv_search_forkpty"
23 AC_DEFUN([gl_FORKPTY],
25 AC_REQUIRE([gl_PTY_LIB])
28 AC_CHECK_DECLS([forkpty],,, [[
39 if test $ac_cv_have_decl_forkpty = no; then
40 AC_MSG_WARN([[Cannot find forkpty, build will likely fail]])
43 dnl Prefer glibc's const-safe prototype, if available.
44 AC_CACHE_CHECK([for const-safe forkpty signature],
45 [gl_cv_func_forkpty_const],
58 int forkpty (int *, char *, struct termios const *,
59 struct winsize const *);
61 [gl_cv_func_forkpty_const=yes], [gl_cv_func_forkpty_const=no])])
62 if test $gl_cv_func_forkpty_const != yes; then
68 AC_DEFUN([gl_OPENPTY],
70 AC_REQUIRE([gl_PTY_LIB])
73 AC_CHECK_DECLS([openpty],,, [[
84 if test $ac_cv_have_decl_openpty = no; then
85 AC_MSG_WARN([[Cannot find openpty, build will likely fail]])
88 dnl Prefer glibc's const-safe prototype, if available.
89 AC_CACHE_CHECK([for const-safe openpty signature],
90 [gl_cv_func_openpty_const],
100 # include <libutil.h>
103 int openpty (int *, int *, char *, struct termios const *,
104 struct winsize const *);
106 [gl_cv_func_openpty_const=yes], [gl_cv_func_openpty_const=no])])
107 if test $gl_cv_func_openpty_const != yes; then