-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconfigure.ac
136 lines (120 loc) · 3.8 KB
/
configure.ac
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Copyright (C) 2008,2009,2014 by Davide Madrisan <davide.madrisan@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ(2.60)
AC_INIT([wtmpclean], [0.8.1], [davide.madrisan@gmail.com])
AC_COPYRIGHT([Copyright 2008,2009,2013.2014 by Davide Madrisan <davide.madrisan@gmail.com>])
AM_INIT_AUTOMAKE([
check-news
gnu
1.11
silent-rules
tar-pax
no-dist-gzip
dist-bzip2
dist-xz
subdir-objects])
AC_CONFIG_SRCDIR(src/wtmpclean.c)
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CANONICAL_BUILD
AC_PROG_CC_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS_ONCE([errno.h utmp.h utmpx.h])
if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
AC_CHECK_FUNC([utmpxname],
[AC_DEFINE(HAVE_UTMPXNAME, 1,
[Define to 1 to if you have the non-POSIX function utmpxname.])])
AC_CHECK_FUNC([utmpname],
[AC_DEFINE(HAVE_UTMPNAME, 1,
[Define to 1 to if you have the non-POSIX function utmpname.])])
AC_CHECK_DECLS([getutent],,,[[
/* <sys/types.h> is a prerequisite of <utmp.h> on FreeBSD 8.0, OpenBSD 4.6. */
#include <sys/types.h>
#ifdef HAVE_UTMP_H
# include <utmp.h>
#endif
]])
utmp_includes="\
AC_INCLUDES_DEFAULT
#ifdef HAVE_UTMPX_H
# include <utmpx.h>
#endif
#ifdef HAVE_UTMP_H
# if defined _THREAD_SAFE && defined UTMP_DATA_INIT
/* When including both utmp.h and utmpx.h on AIX 4.3, with _THREAD_SAFE
defined, work around the duplicate struct utmp_data declaration. */
# define utmp_data gl_aix_4_3_workaround_utmp_data
# endif
# include <utmp.h>
#endif
"
AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmpx.ut_type],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmp.ut_type],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmpx.ut_pid],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmp.ut_pid],,,[$utmp_includes])
fi
#AC_CHECK_FUNC([getutxent],[],
# [AC_MSG_ERROR([this system is not POSIX.1-2001 compliant])])
AC_CHECK_FUNC([getutxent],
[AC_DEFINE(HAVE_UTMPXPOSIX, 1,
[Define to 1 to if you have the POSIX function for managing utmpx databases.])])
AC_CHECK_FUNCS([\
__secure_getenv \
secure_getenv\
])
# note: utp.ut_addr_v6 is only available on Linux
AC_CACHE_CHECK(
[for ut_addr_v6 in struct utp],
[ac_cv_utp_ut_addr_v6],
[AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#ifdef HAVE_UTMPX_H
# include <utmpx.h>
#else
# ifdef HAVE_UTMP_H
# include <utmp.h>
# endif
#endif
int main(void)
{
struct utmpx utp;
utp.ut_addr_v6[0] = 0;
}
]])],
[ac_cv_utp_ut_addr_v6="yes"],
[ac_cv_utp_ut_addr_v6="no"],
[ac_cv_utp_ut_addr_v6="no"])])
if test "x$ac_cv_utp_ut_addr_v6" = "xyes"; then
AC_DEFINE(HAVE_UTP_UT_ADDR_V6, 1,
[Define to 1 to if you have ut_addr_v6 in struct utp.])
fi
AC_CHECK_DECLS([getopt])
AC_CHECK_TOOL(LD,ld,ld,$PATH)
AC_CHECK_TOOL(AR,ar,ar,$PATH)
AM_PROG_AR
AC_PROG_RANLIB
AC_CONFIG_HEADERS(src/config.h:src/config.hin)
AC_CONFIG_FILES([
Makefile
src/Makefile
src/missing/Makefile
])
AC_OUTPUT
cat <<_EOF
Good - your configure finished. Start make now.
_EOF