2 dnl Copyright (C) 2009, 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 # Make sure that pty.h provides forkpty, or sets up a replacement header.
10 AC_DEFUN_ONCE([gl_PTY],
12 AC_REQUIRE([gl_PTY_H_DEFAULTS])
14 # Make sure that pty.h provides forkpty, or setup the replacement.
15 AC_CHECK_HEADERS_ONCE([pty.h])
16 if test $ac_cv_header_pty_h != yes; then
18 AC_CHECK_HEADERS([util.h libutil.h])
19 if test $ac_cv_header_util_h = yes; then
22 if test $ac_cv_header_libutil_h = yes; then
25 else # Have <pty.h>, assume forkpty is declared there.
28 AC_SUBST([HAVE_PTY_H])
29 dnl <pty.h> is always overridden, because of GNULIB_POSIXCHECK.
30 gl_CHECK_NEXT_HEADERS([pty.h])
32 dnl Check for declarations of anything we want to poison if the
33 dnl corresponding gnulib module is not in use.
34 gl_WARN_ON_USE_PREPARE([[
44 ]], [forkpty openpty])
47 AC_DEFUN([gl_PTY_MODULE_INDICATOR],
49 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
50 AC_REQUIRE([gl_PTY_H_DEFAULTS])
51 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
52 dnl Define it also as a C macro, for the benefit of the unit tests.
53 gl_MODULE_INDICATOR([$1])
56 AC_DEFUN([gl_PTY_H_DEFAULTS],
58 GNULIB_FORKPTY=0; AC_SUBST([GNULIB_FORKPTY])
59 GNULIB_OPENPTY=0; AC_SUBST([GNULIB_OPENPTY])
60 dnl Assume proper GNU behavior unless another module says otherwise.
61 HAVE_UTIL_H=0; AC_SUBST([HAVE_UTIL_H])
62 HAVE_LIBUTIL_H=0; AC_SUBST([HAVE_LIBUTIL_H])
63 HAVE_OPENPTY=1; AC_SUBST([HAVE_OPENPTY])
64 REPLACE_FORKPTY=0; AC_SUBST([REPLACE_FORKPTY])
65 REPLACE_OPENPTY=0; AC_SUBST([REPLACE_OPENPTY])