6 |
|
# |
7 |
|
|
8 |
|
# Change these to change the package name and version |
9 |
< |
AC_INIT(libstatgrab, 0.5, bugs@i-scream.org) |
10 |
< |
AM_INIT_AUTOMAKE(libstatgrab, 0.5) |
9 |
> |
AC_INIT(libstatgrab, 0.16, bugs@i-scream.org) |
10 |
> |
AM_INIT_AUTOMAKE(libstatgrab, 0.16) |
11 |
> |
AM_MAINTAINER_MODE |
12 |
|
|
13 |
|
# Revision number (automatically updated) |
14 |
|
AC_REVISION($Revision$) |
32 |
|
|
33 |
|
# Checks for library functions |
34 |
|
AC_FUNC_MALLOC |
35 |
< |
AC_FUNC_REALLOC |
35 |
< |
AC_CHECK_FUNCS(atoll) |
35 |
> |
AC_CHECK_FUNCS(atoll seteuid setegid setresuid setresgid) |
36 |
|
|
37 |
+ |
# Disk IO read and write statistics are only present on recent NetBSD. |
38 |
+ |
AC_CHECK_MEMBER(struct disk_sysctl.dk_rbytes, |
39 |
+ |
[AC_DEFINE(HAVE_DK_RBYTES, , [New-style NetBSD disk stats])], |
40 |
+ |
[], |
41 |
+ |
[#include <sys/disk.h>]) |
42 |
+ |
|
43 |
+ |
# Disk IO read and write statistics are only present on recent OpenBSD. |
44 |
+ |
AC_CHECK_MEMBER(struct diskstats.ds_rbytes, |
45 |
+ |
[AC_DEFINE(HAVE_DS_RBYTES, , [New-style OpenBSD disk stats])], |
46 |
+ |
[], |
47 |
+ |
[#include <sys/disk.h>]) |
48 |
+ |
|
49 |
+ |
# NetBSD 2.0 uses statvfs rather than statfs |
50 |
+ |
AC_CHECK_MEMBER(struct statvfs.f_fstypename, |
51 |
+ |
[AC_DEFINE(HAVE_STATVFS, , [NetBSD 2.0 statvfs])], |
52 |
+ |
[], |
53 |
+ |
[#include <sys/statvfs.h>]) |
54 |
+ |
|
55 |
+ |
# Check for sys/loadavg.h |
56 |
+ |
AC_CHECK_HEADERS([sys/loadavg.h]) |
57 |
+ |
|
58 |
+ |
# Check for libdevinfo.h |
59 |
+ |
AC_CHECK_HEADERS([libdevinfo.h]) |
60 |
+ |
|
61 |
+ |
# Default needing setgid/setuid to false |
62 |
+ |
AM_CONDITIONAL(SETGIDBINS, false) |
63 |
+ |
AM_CONDITIONAL(SETUIDBINS, false) |
64 |
+ |
|
65 |
+ |
# Default MINGW setting |
66 |
+ |
AM_CONDITIONAL(MINGW, false) |
67 |
+ |
|
68 |
|
# Set things up for different OS's |
69 |
|
# We define the name of the OS so the code can act accordingly |
70 |
|
# We also need to add the right LDFLAGS |
72 |
|
solaris2.[[6-7]]) |
73 |
|
AC_CHECK_HEADERS([kstat.h],,[AC_MSG_ERROR([need kstat.h])]) |
74 |
|
AC_DEFINE(SOLARIS, , [Building on Solaris 2.x]) |
75 |
< |
AC_DEFINE(SOL7, , [Building on Solaris 2.7]) |
76 |
< |
LDFLAGS="$LDFLAGS -lkstat" |
75 |
> |
AC_DEFINE(SOL7, , [Building on Solaris 2.6 or 2.7]) |
76 |
> |
AM_CONDITIONAL(SETUIDBINS, true) |
77 |
> |
BIN_OWNER="root" |
78 |
> |
BIN_PERM="4755" |
79 |
> |
LINKFLAGS="-lkstat -lsocket -lnsl" |
80 |
> |
AC_CHECK_LIB(devinfo, di_init, [LINKFLAGS="$LINKFLAGS -ldevinfo"]) |
81 |
> |
AC_CHECK_LIB(m, fabs, [SAIDARLIBS="$SAIDARLIBS -lm"]) |
82 |
|
;; |
83 |
|
solaris2.*) |
84 |
|
AC_CHECK_HEADERS([kstat.h],,[AC_MSG_ERROR([need kstat.h])]) |
85 |
|
AC_DEFINE(SOLARIS, , [Building on Solaris 2.x]) |
86 |
< |
LDFLAGS="$LDFLAGS -lkstat" |
86 |
> |
LINKFLAGS="-lkstat -ldevinfo -lsocket -lnsl" |
87 |
> |
AC_CHECK_LIB(m, fabs, [SAIDARLIBS="$SAIDARLIBS -lm"]) |
88 |
|
;; |
89 |
+ |
hpux11.11*) |
90 |
+ |
AC_DEFINE(HPUX, , [Building on HP-UX 11.11]) |
91 |
+ |
;; |
92 |
|
freebsd4.*) |
93 |
< |
AC_DEFINE(FREEBSD, , [Building on FreeBSD 4.x]) |
94 |
< |
LDFLAGS="$LDFLAGS -lkvm -ldevstat" |
93 |
> |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
94 |
> |
AC_DEFINE(FREEBSD, , [Building on FreeBSD]) |
95 |
> |
AM_CONDITIONAL(SETGIDBINS, true) |
96 |
> |
BIN_GROUP="kmem" |
97 |
> |
BIN_PERM="2755" |
98 |
> |
LINKFLAGS="-lkvm -ldevstat" |
99 |
|
;; |
100 |
< |
linux-gnu) |
100 |
> |
freebsd[[5-8]].*) |
101 |
> |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
102 |
> |
AC_DEFINE(FREEBSD, , [Building on FreeBSD]) |
103 |
> |
AC_DEFINE(FREEBSD5, , [Building on FreeBSD 5.x - 8.x]) |
104 |
> |
LINKFLAGS="-ldevstat" |
105 |
> |
;; |
106 |
> |
netbsdelf1*) |
107 |
> |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
108 |
> |
AC_DEFINE(NETBSD, , [Building on NetBSD]) |
109 |
> |
;; |
110 |
> |
netbsdelf[[2-3]]*) |
111 |
> |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
112 |
> |
AC_DEFINE(NETBSD, , [Building on NetBSD]) |
113 |
> |
AC_DEFINE(NETBSD2, , [Building on NetBSD 2.x]) |
114 |
> |
;; |
115 |
> |
openbsd*) |
116 |
> |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
117 |
> |
AC_DEFINE(OPENBSD, , [Building on OpenBSD]) |
118 |
> |
;; |
119 |
> |
dragonfly*) |
120 |
> |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
121 |
> |
AC_DEFINE(DFBSD, , [Building on DragonFlyBSD]) |
122 |
> |
AM_CONDITIONAL(SETGIDBINS, true) |
123 |
> |
BIN_GROUP="kmem" |
124 |
> |
BIN_PERM="2755" |
125 |
> |
LINKFLAGS="-lkvm -ldevstat" |
126 |
> |
;; |
127 |
> |
linux-gnu*) |
128 |
|
AC_DEFINE(LINUX, , [Building on GNU/Linux]) |
129 |
+ |
AM_CONDITIONAL(SETUIDBINS, true) |
130 |
+ |
BIN_OWNER="root" |
131 |
+ |
BIN_PERM="4755" |
132 |
|
;; |
133 |
+ |
cygwin) |
134 |
+ |
AC_DEFINE(CYGWIN, , [Building on Cygwin]) |
135 |
+ |
;; |
136 |
+ |
mingw32) |
137 |
+ |
AC_DEFINE(MINGW, , [Building on MinGW]) |
138 |
+ |
AC_DEFINE(WINVER, 0x0500, [Building for Windows 2000]) |
139 |
+ |
AM_CONDITIONAL(MINGW, true) |
140 |
+ |
LINKFLAGS="-lpdh -lIphlpapi -lpsapi -lnetapi32" |
141 |
+ |
;; |
142 |
|
*) |
143 |
|
AC_MSG_ERROR([Cannot build on unknown OS: $host_os]) |
144 |
|
;; |
145 |
|
esac |
146 |
|
|
147 |
+ |
# User specified curses/ncurses prefix |
148 |
+ |
AC_ARG_WITH([curses-prefix], |
149 |
+ |
[ --with-curses-prefix=PATH curses (or ncurses) is in PATH], |
150 |
+ |
[ |
151 |
+ |
if test -d "$withval/lib"; then |
152 |
+ |
SAIDARLIBS="-L${withval}/lib ${SAIDARLIBS}" |
153 |
+ |
fi |
154 |
+ |
if test -d "$withval/include"; then |
155 |
+ |
SAIDARCPPFLAGS="-I${withval}/include ${SAIRDARCPPFLAGS}" |
156 |
+ |
fi |
157 |
+ |
] |
158 |
+ |
) |
159 |
+ |
|
160 |
+ |
# Check if user wants to disable statgrab |
161 |
+ |
AM_CONDITIONAL(STATGRAB, true) |
162 |
+ |
AC_ARG_ENABLE(statgrab, |
163 |
+ |
[ --disable-statgrab disable building of statgrab], |
164 |
+ |
[ |
165 |
+ |
if test "x$enableval" = "xno" ; then |
166 |
+ |
AM_CONDITIONAL(STATGRAB, false) |
167 |
+ |
fi |
168 |
+ |
] |
169 |
+ |
) |
170 |
+ |
|
171 |
+ |
# Check if user wants to disable saidar |
172 |
+ |
AM_CONDITIONAL(SAIDAR, true) |
173 |
+ |
AC_ARG_ENABLE(saidar, |
174 |
+ |
[ --disable-saidar disable building of saidar], |
175 |
+ |
[ |
176 |
+ |
if test "x$enableval" = "xno" ; then |
177 |
+ |
AM_CONDITIONAL(SAIDAR, false) |
178 |
+ |
fi |
179 |
+ |
], |
180 |
+ |
[ |
181 |
+ |
# saidar needs curses |
182 |
+ |
# (if we don't find curses we disable saidar) |
183 |
+ |
MP_WITH_CURSES |
184 |
+ |
] |
185 |
+ |
) |
186 |
+ |
|
187 |
+ |
# Check if the user would prefer not to build examples |
188 |
+ |
AM_CONDITIONAL(EXAMPLES, true) |
189 |
+ |
AC_ARG_ENABLE(examples, |
190 |
+ |
[ --disable-examples disable building of examples], |
191 |
+ |
[ |
192 |
+ |
if test "x$enableval" = "xno" ; then |
193 |
+ |
AM_CONDITIONAL(EXAMPLES, false) |
194 |
+ |
fi |
195 |
+ |
] |
196 |
+ |
) |
197 |
+ |
|
198 |
+ |
# Check if user wants to install manpages |
199 |
+ |
AM_CONDITIONAL(MANPAGES, true) |
200 |
+ |
AC_ARG_ENABLE(manpages, |
201 |
+ |
[ --disable-manpages disable installation of manpages], |
202 |
+ |
[ |
203 |
+ |
if test "x$enableval" = "xno" ; then |
204 |
+ |
AM_CONDITIONAL(MANPAGES, false) |
205 |
+ |
fi |
206 |
+ |
] |
207 |
+ |
) |
208 |
+ |
|
209 |
+ |
# Check if the user wants to turn off setgid binaries |
210 |
+ |
AC_ARG_ENABLE(setgid-binaries, |
211 |
+ |
[ --disable-setgid-binaries disable binaries being setgid], |
212 |
+ |
[ |
213 |
+ |
if test "x$enableval" = "xno" ; then |
214 |
+ |
AM_CONDITIONAL(SETGIDBINS, false) |
215 |
+ |
fi |
216 |
+ |
] |
217 |
+ |
) |
218 |
+ |
|
219 |
+ |
# Check if the user wants to turn off setuid binaries |
220 |
+ |
AC_ARG_ENABLE(setuid-binaries, |
221 |
+ |
[ --disable-setuid-binaries disable binaries being setuid], |
222 |
+ |
[ |
223 |
+ |
if test "x$enableval" = "xno" ; then |
224 |
+ |
AM_CONDITIONAL(SETUIDBINS, false) |
225 |
+ |
fi |
226 |
+ |
] |
227 |
+ |
) |
228 |
+ |
|
229 |
+ |
# Check if the user would prefer not to include compatibility code |
230 |
+ |
AM_CONDITIONAL(DEPRECATED, true) |
231 |
+ |
AC_ARG_ENABLE(deprecated, |
232 |
+ |
[ --disable-deprecated disable inclusion of pre-0.10 compatibility code], |
233 |
+ |
[ |
234 |
+ |
if test "x$enableval" = "xno" ; then |
235 |
+ |
AM_CONDITIONAL(DEPRECATED, false) |
236 |
+ |
fi |
237 |
+ |
] |
238 |
+ |
) |
239 |
+ |
|
240 |
+ |
# The LIBS and CPPFLAGS that saidar needs |
241 |
+ |
AC_SUBST(SAIDARLIBS) |
242 |
+ |
AC_SUBST(SAIDARCPPFLAGS) |
243 |
+ |
|
244 |
+ |
# The flags needed to link to libstatgrab |
245 |
+ |
# (ie. our dependencies) |
246 |
+ |
AC_SUBST(LINKFLAGS) |
247 |
+ |
|
248 |
+ |
# Ownership and permissions possibly needed for binaries |
249 |
+ |
AC_SUBST(BIN_OWNER) |
250 |
+ |
AC_SUBST(BIN_GROUP) |
251 |
+ |
AC_SUBST(BIN_PERM) |
252 |
+ |
|
253 |
|
# And finish by changing these files |
254 |
< |
AC_CONFIG_FILES([Makefile src/Makefile docs/Makefile examples/Makefile]) |
254 |
> |
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]) |
255 |
|
|
256 |
|
AC_OUTPUT |