summaryrefslogtreecommitdiff
path: root/m4/login_tty.m4
blob: ca15e6aabb29244f113f6583d55453c05e198425 (plain)
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
# login_tty.m4 serial 2
dnl Copyright (C) 2010-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

AC_DEFUN([gl_FUNC_LOGIN_TTY],
[
  AC_REQUIRE([gl_PTY_LIB])

  AC_CHECK_HEADERS_ONCE([utmp.h util.h libutil.h])
  gl_saved_libs="$LIBS"
  LIBS="$LIBS $PTY_LIB"
  gl_CHECK_FUNCS_ANDROID([login_tty], [[
    #include <sys/types.h>
    #if HAVE_UTMP_H
    # include <utmp.h>
    #endif
    #if HAVE_UTIL_H
    # include <util.h>
    #elif HAVE_LIBUTIL_H
    # include <libutil.h>
    #endif
  ]])
  LIBS="$gl_saved_LIBS"

  if test $ac_cv_func_login_tty = no; then
    HAVE_LOGIN_TTY=0
    case "$gl_cv_onwards_func_login_tty" in
      future*) REPLACE_LOGIN_TTY=1 ;;
    esac
  fi
])