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