1 |
# -*- Autoconf -*- |
2 |
# Process this file with autoconf to produce a configure script. |
3 |
# |
4 |
# configure.in for libstatgrab |
5 |
# $Id: configure.in,v 1.77 2004/11/01 18:30:16 tdb Exp $ |
6 |
# |
7 |
|
8 |
# Change these to change the package name and version |
9 |
AC_INIT(libstatgrab, 0.11, bugs@i-scream.org) |
10 |
AM_INIT_AUTOMAKE(libstatgrab, 0.11) |
11 |
|
12 |
# Revision number (automatically updated) |
13 |
AC_REVISION($Revision: 1.77 $) |
14 |
|
15 |
# 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 |
AC_PROG_CC |
23 |
AC_PROG_INSTALL |
24 |
AC_PROG_LIBTOOL |
25 |
|
26 |
# Checks for header files |
27 |
AC_HEADER_STDC |
28 |
|
29 |
# Checks for typedefs, structures, and compiler characteristics |
30 |
AC_C_CONST |
31 |
|
32 |
# Checks for library functions |
33 |
AC_FUNC_MALLOC |
34 |
AC_FUNC_REALLOC |
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 |
# Set things up for different OS's |
66 |
# We define the name of the OS so the code can act accordingly |
67 |
# We also need to add the right LDFLAGS |
68 |
case $host_os in |
69 |
solaris2.[[6-7]]) |
70 |
AC_CHECK_HEADERS([kstat.h],,[AC_MSG_ERROR([need kstat.h])]) |
71 |
AC_DEFINE(SOLARIS, , [Building on Solaris 2.x]) |
72 |
AC_DEFINE(SOL7, , [Building on Solaris 2.6 or 2.7]) |
73 |
AM_CONDITIONAL(SETUIDBINS, true) |
74 |
BIN_OWNER="root" |
75 |
BIN_PERM="4755" |
76 |
LINKFLAGS="-lkstat -lsocket -lnsl" |
77 |
AC_CHECK_LIB(devinfo, di_init, [LINKFLAGS="$LINKFLAGS -ldevinfo"]) |
78 |
;; |
79 |
solaris2.*) |
80 |
AC_CHECK_HEADERS([kstat.h],,[AC_MSG_ERROR([need kstat.h])]) |
81 |
AC_DEFINE(SOLARIS, , [Building on Solaris 2.x]) |
82 |
LINKFLAGS="-lkstat -ldevinfo -lsocket -lnsl" |
83 |
;; |
84 |
hpux11.11*) |
85 |
AC_DEFINE(HPUX, , [Building on HP-UX 11.11]) |
86 |
;; |
87 |
freebsd4.*) |
88 |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
89 |
AC_DEFINE(FREEBSD, , [Building on FreeBSD]) |
90 |
AM_CONDITIONAL(SETGIDBINS, true) |
91 |
BIN_GROUP="kmem" |
92 |
BIN_PERM="2755" |
93 |
LINKFLAGS="-lkvm -ldevstat" |
94 |
;; |
95 |
freebsd[[5-6]].*) |
96 |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
97 |
AC_DEFINE(FREEBSD, , [Building on FreeBSD]) |
98 |
AC_DEFINE(FREEBSD5, , [Building on FreeBSD 5.x or 6.x]) |
99 |
LINKFLAGS="-ldevstat" |
100 |
;; |
101 |
netbsdelf1*) |
102 |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
103 |
AC_DEFINE(NETBSD, , [Building on NetBSD]) |
104 |
;; |
105 |
netbsdelf2*) |
106 |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
107 |
AC_DEFINE(NETBSD, , [Building on NetBSD]) |
108 |
AC_DEFINE(NETBSD2, , [Building on NetBSD 2.x]) |
109 |
;; |
110 |
openbsd*) |
111 |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
112 |
AC_DEFINE(OPENBSD, , [Building on OpenBSD]) |
113 |
;; |
114 |
dragonfly*) |
115 |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
116 |
AC_DEFINE(DFBSD, , [Building on DragonFlyBSD]) |
117 |
AM_CONDITIONAL(SETGIDBINS, true) |
118 |
BIN_GROUP="kmem" |
119 |
BIN_PERM="2755" |
120 |
LINKFLAGS="-lkvm -ldevstat" |
121 |
;; |
122 |
linux-gnu) |
123 |
AC_DEFINE(LINUX, , [Building on GNU/Linux]) |
124 |
AM_CONDITIONAL(SETUIDBINS, true) |
125 |
BIN_OWNER="root" |
126 |
BIN_PERM="4755" |
127 |
;; |
128 |
cygwin) |
129 |
AC_DEFINE(CYGWIN, , [Building on Cygwin]) |
130 |
;; |
131 |
*) |
132 |
AC_MSG_ERROR([Cannot build on unknown OS: $host_os]) |
133 |
;; |
134 |
esac |
135 |
|
136 |
# User specified curses/ncurses prefix |
137 |
AC_ARG_WITH([curses-prefix], |
138 |
[ --with-curses-prefix=PATH curses (or ncurses) is in PATH], |
139 |
[ |
140 |
if test -d "$withval/lib"; then |
141 |
SAIDARLIBS="-L${withval}/lib ${SAIDARLIBS}" |
142 |
fi |
143 |
if test -d "$withval/include"; then |
144 |
SAIDARCPPFLAGS="-I${withval}/include -I${withval}/include/ncurses ${SAIRDARCPPFLAGS}" |
145 |
fi |
146 |
] |
147 |
) |
148 |
|
149 |
# Check if user wants to disable statgrab |
150 |
AM_CONDITIONAL(STATGRAB, true) |
151 |
AC_ARG_ENABLE(statgrab, |
152 |
[ --disable-statgrab disable building of statgrab], |
153 |
[ |
154 |
if test "x$enableval" = "xno" ; then |
155 |
AM_CONDITIONAL(STATGRAB, false) |
156 |
fi |
157 |
] |
158 |
) |
159 |
|
160 |
# Check if user wants to disable saidar |
161 |
AM_CONDITIONAL(SAIDAR, true) |
162 |
AC_ARG_ENABLE(saidar, |
163 |
[ --disable-saidar disable building of saidar], |
164 |
[ |
165 |
if test "x$enableval" = "xno" ; then |
166 |
AM_CONDITIONAL(SAIDAR, false) |
167 |
fi |
168 |
], |
169 |
[ |
170 |
# saidar needs curses |
171 |
# (if we don't find curses we disable saidar) |
172 |
MP_WITH_CURSES |
173 |
] |
174 |
) |
175 |
|
176 |
# Check if the user would prefer not to build examples |
177 |
AM_CONDITIONAL(EXAMPLES, true) |
178 |
AC_ARG_ENABLE(examples, |
179 |
[ --disable-examples disable building of examples], |
180 |
[ |
181 |
if test "x$enableval" = "xno" ; then |
182 |
AM_CONDITIONAL(EXAMPLES, false) |
183 |
fi |
184 |
] |
185 |
) |
186 |
|
187 |
# Check if user wants to install manpages |
188 |
AM_CONDITIONAL(MANPAGES, true) |
189 |
AC_ARG_ENABLE(manpages, |
190 |
[ --disable-manpages disable installation of manpages], |
191 |
[ |
192 |
if test "x$enableval" = "xno" ; then |
193 |
AM_CONDITIONAL(MANPAGES, false) |
194 |
fi |
195 |
] |
196 |
) |
197 |
|
198 |
# Check if the user wants to turn off setgid binaries |
199 |
AC_ARG_ENABLE(setgid-binaries, |
200 |
[ --disable-setgid-binaries disable binaries being setgid], |
201 |
[ |
202 |
if test "x$enableval" = "xno" ; then |
203 |
AM_CONDITIONAL(SETGIDBINS, false) |
204 |
fi |
205 |
] |
206 |
) |
207 |
|
208 |
# Check if the user wants to turn off setuid binaries |
209 |
AC_ARG_ENABLE(setuid-binaries, |
210 |
[ --disable-setuid-binaries disable binaries being setuid], |
211 |
[ |
212 |
if test "x$enableval" = "xno" ; then |
213 |
AM_CONDITIONAL(SETUIDBINS, false) |
214 |
fi |
215 |
] |
216 |
) |
217 |
|
218 |
# Check if the user would prefer not to include compatibility code |
219 |
AM_CONDITIONAL(DEPRECATED, true) |
220 |
AC_ARG_ENABLE(deprecated, |
221 |
[ --disable-deprecated disable inclusion of pre-0.10 compatibility code], |
222 |
[ |
223 |
if test "x$enableval" = "xno" ; then |
224 |
AM_CONDITIONAL(DEPRECATED, false) |
225 |
fi |
226 |
] |
227 |
) |
228 |
|
229 |
# The LIBS and CPPFLAGS that saidar needs |
230 |
AC_SUBST(SAIDARLIBS) |
231 |
AC_SUBST(SAIDARCPPFLAGS) |
232 |
|
233 |
# The flags needed to link to libstatgrab |
234 |
# (ie. our dependencies) |
235 |
AC_SUBST(LINKFLAGS) |
236 |
|
237 |
# Ownership and permissions possibly needed for binaries |
238 |
AC_SUBST(BIN_OWNER) |
239 |
AC_SUBST(BIN_GROUP) |
240 |
AC_SUBST(BIN_PERM) |
241 |
|
242 |
# And finish by changing these files |
243 |
AC_CONFIG_FILES([Makefile src/Makefile src/libstatgrab/Makefile src/statgrab/Makefile docs/Makefile examples/Makefile libstatgrab.pc src/statgrab/statgrab-make-mrtg-config src/statgrab/statgrab-make-mrtg-index src/saidar/Makefile]) |
244 |
|
245 |
AC_OUTPUT |