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