ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/configure.in
Revision: 1.102
Committed: Wed Jun 9 15:16:41 2010 UTC (14 years, 4 months ago) by tdb
Branch: MAIN
Changes since 1.101: +8 -2 lines
Log Message:
Add support for preliminary support for Debian GNU/kFreeBSD.

Currently process statistics are broken, but everything else works.

The following packages are needed: libkvm-dev libdevstat-dev
(plus the usual build stuff required on Debian)

File Contents

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