Use AC_LIBSOURCES and AC_LIBOBJ to indicate source and object files.
[gnulib.git] / m4 / readutmp.m4
1 # readutmp.m4 serial 7
2 dnl Copyright (C) 2002, 2003, 2004, 2005 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   AC_LIBSOURCES([readutmp.c, readutmp.h])
10   AC_LIBOBJ([readutmp])
11
12   dnl Prerequisites of lib/readutmp.h.
13   AC_CHECK_HEADERS(utmp.h utmpx.h)
14   AC_CHECK_FUNCS(utmpname utmpxname)
15   AC_CHECK_DECLS(getutent,,,[
16 #ifdef HAVE_UTMP_H
17 # include <utmp.h>
18 #endif
19 ])
20   if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
21     utmp_includes="\
22 $ac_includes_default
23 #ifdef HAVE_UTMPX_H
24 # include <utmpx.h>
25 #endif
26 #ifdef HAVE_UTMP_H
27 # include <utmp.h>
28 #endif
29 "
30     AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
31     AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
32     AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
33     AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
34     AC_CHECK_MEMBERS([struct utmpx.ut_type],,,[$utmp_includes])
35     AC_CHECK_MEMBERS([struct utmp.ut_type],,,[$utmp_includes])
36     AC_CHECK_MEMBERS([struct utmpx.ut_pid],,,[$utmp_includes])
37     AC_CHECK_MEMBERS([struct utmp.ut_pid],,,[$utmp_includes])
38     AC_CHECK_MEMBERS([struct utmpx.ut_id],,,[$utmp_includes])
39     AC_CHECK_MEMBERS([struct utmp.ut_id],,,[$utmp_includes])
40     AC_CHECK_MEMBERS([struct utmpx.ut_exit],,,[$utmp_includes])
41     AC_CHECK_MEMBERS([struct utmp.ut_exit],,,[$utmp_includes])
42
43     AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_exit],,,[$utmp_includes])
44     AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_exit],,,[$utmp_includes])
45     AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_exit],,,[$utmp_includes])
46     AC_CHECK_MEMBERS([struct utmp.ut_exit.e_exit],,,[$utmp_includes])
47
48     AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_termination],,,[$utmp_includes])
49     AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_termination],,,[$utmp_includes])
50     AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_termination],,,[$utmp_includes])
51     AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination],,,[$utmp_includes])
52
53     AC_LIBOBJ(readutmp)
54     gl_PREREQ_READUTMP
55   fi
56 ])
57
58 # Prerequisites of lib/readutmp.c.
59 AC_DEFUN([gl_PREREQ_READUTMP],
60 [
61   AC_REQUIRE([gl_FUNC_FREE])
62 ])