This repository has been archived by the owner on Sep 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.in
261 lines (231 loc) · 7.56 KB
/
configure.in
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#
# configure.in for libstatgrab
# $Id: configure.in,v 1.100 2010/02/20 18:15:51 tdb Exp $
#
# Change these to change the package name and version
AC_INIT(libstatgrab, 0.17, [email protected])
AM_INIT_AUTOMAKE(libstatgrab, 0.17)
# Revision number (automatically updated)
AC_REVISION($Revision: 1.100 $)
# Might work with older autoconfs... but tested on 2.57
AC_PREREQ(2.57)
# The file we use to pass #define's to the source
AM_CONFIG_HEADER([config.h])
# Checks for programs
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
# Checks for header files
AC_HEADER_STDC
# Checks for typedefs, structures, and compiler characteristics
AC_C_CONST
# Checks for library functions
AC_FUNC_MALLOC
AC_CHECK_FUNCS(atoll seteuid setegid setresuid setresgid)
# Disk IO read and write statistics are only present on recent NetBSD.
AC_CHECK_MEMBER(struct disk_sysctl.dk_rbytes,
[AC_DEFINE(HAVE_DK_RBYTES, , [New-style NetBSD disk stats])],
[],
[#include <sys/disk.h>])
# Disk IO read and write statistics are only present on recent OpenBSD.
AC_CHECK_MEMBER(struct diskstats.ds_rbytes,
[AC_DEFINE(HAVE_DS_RBYTES, , [New-style OpenBSD disk stats])],
[],
[#include <sys/disk.h>])
# NetBSD 2.0 uses statvfs rather than statfs
AC_CHECK_MEMBER(struct statvfs.f_fstypename,
[AC_DEFINE(HAVE_STATVFS, , [NetBSD 2.0 statvfs])],
[],
[#include <sys/statvfs.h>])
# FreeBSD 9 (and others) uses utmpx rather than utmp
AC_CHECK_MEMBER(struct utmpx.ut_type,
[AC_DEFINE(HAVE_UTMPX, , [utmpx])],
[],
[#include <utmpx.h>])
# Check for sys/loadavg.h
AC_CHECK_HEADERS([sys/loadavg.h])
# Check for libdevinfo.h
AC_CHECK_HEADERS([libdevinfo.h])
# Default needing setgid/setuid to false
AM_CONDITIONAL(SETGIDBINS, false)
AM_CONDITIONAL(SETUIDBINS, false)
# Default MINGW setting
AM_CONDITIONAL(MINGW, false)
# Set things up for different OS's
# We define the name of the OS so the code can act accordingly
# We also need to add the right LDFLAGS
case $host_os in
solaris2.[[6-7]])
AC_CHECK_HEADERS([kstat.h],,[AC_MSG_ERROR([need kstat.h])])
AC_DEFINE(SOLARIS, , [Building on Solaris 2.x])
AC_DEFINE(SOL7, , [Building on Solaris 2.6 or 2.7])
AM_CONDITIONAL(SETUIDBINS, true)
BIN_OWNER="root"
BIN_PERM="4755"
LINKFLAGS="-lkstat -lsocket -lnsl"
AC_CHECK_LIB(devinfo, di_init, [LINKFLAGS="$LINKFLAGS -ldevinfo"])
AC_CHECK_LIB(m, fabs, [SAIDARLIBS="$SAIDARLIBS -lm"])
;;
solaris2.*)
AC_CHECK_HEADERS([kstat.h],,[AC_MSG_ERROR([need kstat.h])])
AC_DEFINE(SOLARIS, , [Building on Solaris 2.x])
LINKFLAGS="-lkstat -ldevinfo -lsocket -lnsl"
AC_CHECK_LIB(m, fabs, [SAIDARLIBS="$SAIDARLIBS -lm"])
;;
hpux11.11*)
AC_DEFINE(HPUX, , [Building on HP-UX 11.11])
;;
freebsd4.*)
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system])
AC_DEFINE(FREEBSD, , [Building on FreeBSD])
AM_CONDITIONAL(SETGIDBINS, true)
BIN_GROUP="kmem"
BIN_PERM="2755"
LINKFLAGS="-lkvm -ldevstat"
;;
freebsd[[5-9]].*)
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system])
AC_DEFINE(FREEBSD, , [Building on FreeBSD])
AC_DEFINE(FREEBSD5, , [Building on FreeBSD 5.x - 9.x])
LINKFLAGS="-ldevstat"
;;
netbsdelf1*)
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system])
AC_DEFINE(NETBSD, , [Building on NetBSD])
;;
netbsdelf[[2-3]]*)
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system])
AC_DEFINE(NETBSD, , [Building on NetBSD])
AC_DEFINE(NETBSD2, , [Building on NetBSD 2.x])
;;
openbsd*)
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system])
AC_DEFINE(OPENBSD, , [Building on OpenBSD])
;;
dragonfly*)
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system])
AC_DEFINE(DFBSD, , [Building on DragonFlyBSD])
AM_CONDITIONAL(SETGIDBINS, true)
BIN_GROUP="kmem"
BIN_PERM="2755"
LINKFLAGS="-lkvm -ldevstat"
;;
linux-gnu*)
AC_DEFINE(LINUX, , [Building on GNU/Linux])
AM_CONDITIONAL(SETUIDBINS, true)
BIN_OWNER="root"
BIN_PERM="4755"
;;
cygwin)
AC_DEFINE(CYGWIN, , [Building on Cygwin])
;;
mingw32)
AC_DEFINE(MINGW, , [Building on MinGW])
AC_DEFINE(WINVER, 0x0500, [Building for Windows 2000])
AM_CONDITIONAL(MINGW, true)
LINKFLAGS="-lpdh -lIphlpapi -lpsapi -lnetapi32"
;;
*)
AC_MSG_ERROR([Cannot build on unknown OS: $host_os])
;;
esac
# User specified curses/ncurses prefix
AC_ARG_WITH([curses-prefix],
[ --with-curses-prefix=PATH curses (or ncurses) is in PATH],
[
if test -d "$withval/lib"; then
SAIDARLIBS="-L${withval}/lib ${SAIDARLIBS}"
fi
if test -d "$withval/include"; then
SAIDARCPPFLAGS="-I${withval}/include ${SAIRDARCPPFLAGS}"
fi
]
)
# Check if user wants to disable statgrab
AM_CONDITIONAL(STATGRAB, true)
AC_ARG_ENABLE(statgrab,
[ --disable-statgrab disable building of statgrab],
[
if test "x$enableval" = "xno" ; then
AM_CONDITIONAL(STATGRAB, false)
fi
]
)
# Check if user wants to disable saidar
AM_CONDITIONAL(SAIDAR, true)
AC_ARG_ENABLE(saidar,
[ --disable-saidar disable building of saidar],
[
if test "x$enableval" = "xno" ; then
AM_CONDITIONAL(SAIDAR, false)
fi
],
[
# saidar needs curses
# (if we don't find curses we disable saidar)
MP_WITH_CURSES
]
)
# Check if the user would prefer not to build examples
AM_CONDITIONAL(EXAMPLES, true)
AC_ARG_ENABLE(examples,
[ --disable-examples disable building of examples],
[
if test "x$enableval" = "xno" ; then
AM_CONDITIONAL(EXAMPLES, false)
fi
]
)
# Check if user wants to install manpages
AM_CONDITIONAL(MANPAGES, true)
AC_ARG_ENABLE(manpages,
[ --disable-manpages disable installation of manpages],
[
if test "x$enableval" = "xno" ; then
AM_CONDITIONAL(MANPAGES, false)
fi
]
)
# Check if the user wants to turn off setgid binaries
AC_ARG_ENABLE(setgid-binaries,
[ --disable-setgid-binaries disable binaries being setgid],
[
if test "x$enableval" = "xno" ; then
AM_CONDITIONAL(SETGIDBINS, false)
fi
]
)
# Check if the user wants to turn off setuid binaries
AC_ARG_ENABLE(setuid-binaries,
[ --disable-setuid-binaries disable binaries being setuid],
[
if test "x$enableval" = "xno" ; then
AM_CONDITIONAL(SETUIDBINS, false)
fi
]
)
# Check if the user would prefer not to include compatibility code
AM_CONDITIONAL(DEPRECATED, true)
AC_ARG_ENABLE(deprecated,
[ --disable-deprecated disable inclusion of pre-0.10 compatibility code],
[
if test "x$enableval" = "xno" ; then
AM_CONDITIONAL(DEPRECATED, false)
fi
]
)
# The LIBS and CPPFLAGS that saidar needs
AC_SUBST(SAIDARLIBS)
AC_SUBST(SAIDARCPPFLAGS)
# The flags needed to link to libstatgrab
# (ie. our dependencies)
AC_SUBST(LINKFLAGS)
# Ownership and permissions possibly needed for binaries
AC_SUBST(BIN_OWNER)
AC_SUBST(BIN_GROUP)
AC_SUBST(BIN_PERM)
# And finish by changing these files
AC_CONFIG_FILES([Makefile src/Makefile src/libstatgrab/Makefile src/statgrab/Makefile docs/Makefile docs/libstatgrab/Makefile docs/statgrab/Makefile docs/saidar/Makefile examples/Makefile libstatgrab.pc src/statgrab/statgrab-make-mrtg-config src/statgrab/statgrab-make-mrtg-index src/saidar/Makefile])
AC_OUTPUT