maint: update almost all copyright ranges to include 2011
[gnulib.git] / m4 / readutmp.m4
1 # readutmp.m4 serial 17
2 dnl Copyright (C) 2002-2011 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 AC_DEFUN([gl_READUTMP],
8 [
9   dnl Persuade utmpx.h to declare utmpxname
10   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
11
12   AC_CHECK_HEADERS_ONCE([utmp.h utmpx.h])
13   if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
14     AC_LIBOBJ([readutmp])
15
16     dnl Prerequisites of lib/readutmp.h and lib/readutmp.c.
17     AC_REQUIRE([AC_C_INLINE])
18     AC_CHECK_FUNCS_ONCE([utmpname utmpxname])
19     AC_CHECK_DECLS([getutent],,,[
20 /* <sys/types.h> is a prerequisite of <utmp.h> on FreeBSD 8.0, OpenBSD 4.6.  */
21 #include <sys/types.h>
22 #ifdef HAVE_UTMP_H
23 # include <utmp.h>
24 #endif
25 ])
26     utmp_includes="\
27 AC_INCLUDES_DEFAULT
28 #ifdef HAVE_UTMPX_H
29 # include <utmpx.h>
30 #endif
31 #ifdef HAVE_UTMP_H
32 # if defined _THREAD_SAFE && defined UTMP_DATA_INIT
33    /* When including both utmp.h and utmpx.h on AIX 4.3, with _THREAD_SAFE
34       defined, work around the duplicate struct utmp_data declaration.  */
35 #  define utmp_data gl_aix_4_3_workaround_utmp_data
36 # endif
37 # include <utmp.h>
38 #endif
39 "
40     AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
41     AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
42     AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
43     AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
44     AC_CHECK_MEMBERS([struct utmpx.ut_type],,,[$utmp_includes])
45     AC_CHECK_MEMBERS([struct utmp.ut_type],,,[$utmp_includes])
46     AC_CHECK_MEMBERS([struct utmpx.ut_pid],,,[$utmp_includes])
47     AC_CHECK_MEMBERS([struct utmp.ut_pid],,,[$utmp_includes])
48     AC_CHECK_MEMBERS([struct utmpx.ut_id],,,[$utmp_includes])
49     AC_CHECK_MEMBERS([struct utmp.ut_id],,,[$utmp_includes])
50     AC_CHECK_MEMBERS([struct utmpx.ut_exit],,,[$utmp_includes])
51     AC_CHECK_MEMBERS([struct utmp.ut_exit],,,[$utmp_includes])
52
53     AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_exit],,,[$utmp_includes])
54     AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_exit],,,[$utmp_includes])
55     AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_exit],,,[$utmp_includes])
56     AC_CHECK_MEMBERS([struct utmp.ut_exit.e_exit],,,[$utmp_includes])
57
58     AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_termination],,,[$utmp_includes])
59     AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_termination],,,[$utmp_includes])
60     AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_termination],,,[$utmp_includes])
61     AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination],,,[$utmp_includes])
62   fi
63 ])