update nearly all FSF copyright year lists to include 2010
[gnulib.git] / m4 / pty.m4
1 # pty.m4 serial 1
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.
6
7 # gl_PTY
8 # ------
9 # Make sure that pty.h provides forkpty, or sets up a replacement header.
10 # Also define automake variable PTY_LIB to the library needed (if any).
11 AC_DEFUN([gl_PTY],
12 [
13   PTY_H=''
14   PTY_LIB=''
15   # First make sure that pty.h provides forkpty, or setup the replacement.
16   AC_CHECK_HEADERS_ONCE([pty.h])
17   if test $ac_cv_header_pty_h != yes; then
18     AC_CHECK_DECL([forkpty],,, [[#include <util.h>]])
19     if test $ac_cv_have_decl_forkpty = no; then
20       AC_CHECK_DECL([forkpty],,, [[#include <libutil.h>]])
21       if test $ac_cv_have_decl_forkpty = no; then
22         AC_MSG_WARN([[Cannot find forkpty, build will likely fail]])
23       else
24         PTY_H='pty.h'
25         PTY_HEADER='libutil.h'
26       fi
27     else
28       PTY_H='pty.h'
29       PTY_HEADER='util.h'
30     fi
31   fi
32   # Second check for the library required for forkpty.
33   save_LIBS="$LIBS"
34   AC_SEARCH_LIBS([forkpty], [util],
35     [if test "$ac_cv_search_forkpty" != "none required"; then
36        PTY_LIB="$ac_cv_search_forkpty"
37      fi])
38   LIBS="$save_LIBS"
39   AC_SUBST([PTY_H])
40   AC_SUBST([PTY_LIB])
41   AC_SUBST([PTY_HEADER])
42 ])