1 |
< |
dnl configure.in for libstatgrab |
2 |
< |
dnl $Id$ |
1 |
> |
# -*- Autoconf -*- |
2 |
> |
# Process this file with autoconf to produce a configure script. |
3 |
> |
# |
4 |
> |
# configure.in for libstatgrab |
5 |
> |
# $Id$ |
6 |
> |
# |
7 |
|
|
8 |
< |
dnl Change these to change the package name and version |
9 |
< |
AC_INIT(libstatgrab, 0.1, dev@i-scream.org.uk) |
10 |
< |
AM_INIT_AUTOMAKE(libstatgrab, 0.1) |
8 |
> |
# Change these to change the package name and version |
9 |
> |
AC_INIT(libstatgrab, 0.7.1, bugs@i-scream.org) |
10 |
> |
AM_INIT_AUTOMAKE(libstatgrab, 0.7.1) |
11 |
|
|
12 |
< |
dnl The file we use to pass #define's to the source |
13 |
< |
AM_CONFIG_HEADER(config.h) |
12 |
> |
# Revision number (automatically updated) |
13 |
> |
AC_REVISION($Revision$) |
14 |
|
|
15 |
< |
dnl We need a CC, install, and ranlib |
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_RANLIB |
24 |
> |
AC_PROG_LIBTOOL |
25 |
|
|
26 |
< |
dnl And we probably need the standard C bits |
26 |
> |
# Checks for header files |
27 |
|
AC_HEADER_STDC |
28 |
|
|
29 |
< |
dnl The program needs to know whether it can use getloadavg |
30 |
< |
AC_CHECK_FUNCS(getloadavg) |
29 |
> |
# Checks for typedefs, structures, and compiler characteristics |
30 |
> |
AC_C_CONST |
31 |
|
|
32 |
< |
dnl Figure out details about the host - we need the OS |
33 |
< |
AC_CANONICAL_HOST |
32 |
> |
# Checks for library functions |
33 |
> |
AC_FUNC_MALLOC |
34 |
> |
AC_FUNC_REALLOC |
35 |
> |
AC_CHECK_FUNCS(atoll) |
36 |
|
|
37 |
< |
dnl Set things up for different OS's |
38 |
< |
dnl We define the name of the OS so the code can act accordingly |
39 |
< |
dnl We also need to add the right LDFLAGS |
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 stats])], |
40 |
> |
[], |
41 |
> |
[#include <sys/disk.h>]) |
42 |
> |
|
43 |
> |
# Default needing setgid/setuid to false |
44 |
> |
AM_CONDITIONAL(SETGIDBINS, false) |
45 |
> |
AM_CONDITIONAL(SETUIDBINS, false) |
46 |
> |
|
47 |
> |
# Set things up for different OS's |
48 |
> |
# We define the name of the OS so the code can act accordingly |
49 |
> |
# We also need to add the right LDFLAGS |
50 |
|
case $host_os in |
51 |
+ |
solaris2.[[6-7]]) |
52 |
+ |
AC_CHECK_HEADERS([kstat.h],,[AC_MSG_ERROR([need kstat.h])]) |
53 |
+ |
AC_DEFINE(SOLARIS, , [Building on Solaris 2.x]) |
54 |
+ |
AC_DEFINE(SOL7, , [Building on Solaris 2.7]) |
55 |
+ |
AM_CONDITIONAL(SETUIDBINS, true) |
56 |
+ |
LINKFLAGS="-lkstat -ldevinfo" |
57 |
+ |
;; |
58 |
|
solaris2.*) |
59 |
+ |
AC_CHECK_HEADERS([kstat.h],,[AC_MSG_ERROR([need kstat.h])]) |
60 |
|
AC_DEFINE(SOLARIS, , [Building on Solaris 2.x]) |
61 |
< |
LDFLAGS="$LDFLAGS -lkstat" |
61 |
> |
AM_CONDITIONAL(SETUIDBINS, true) |
62 |
> |
LINKFLAGS="-lkstat -ldevinfo" |
63 |
|
;; |
64 |
|
freebsd4.*) |
65 |
< |
AC_DEFINE(FREEBSD, , [Building on FreeBSD 4.x]) |
66 |
< |
LDFLAGS="$LDFLAGS -lkvm" |
65 |
> |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
66 |
> |
AC_DEFINE(FREEBSD, , [Building on FreeBSD]) |
67 |
> |
AM_CONDITIONAL(SETGIDBINS, true) |
68 |
> |
LINKFLAGS="-lkvm -ldevstat" |
69 |
|
;; |
70 |
+ |
freebsd5.*) |
71 |
+ |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
72 |
+ |
AC_DEFINE(FREEBSD, , [Building on FreeBSD]) |
73 |
+ |
AC_DEFINE(FREEBSD5, , [Building on FreeBSD 5.x]) |
74 |
+ |
AM_CONDITIONAL(SETGIDBINS, true) |
75 |
+ |
LINKFLAGS="-lkvm -ldevstat" |
76 |
+ |
;; |
77 |
+ |
netbsdelf*) |
78 |
+ |
AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) |
79 |
+ |
AC_DEFINE(NETBSD, , [Building on NetBSD]) |
80 |
+ |
AM_CONDITIONAL(SETGIDBINS, true) |
81 |
+ |
LINKFLAGS="-lkvm" |
82 |
+ |
;; |
83 |
|
linux-gnu) |
84 |
|
AC_DEFINE(LINUX, , [Building on GNU/Linux]) |
85 |
|
;; |
86 |
+ |
cygwin) |
87 |
+ |
AC_DEFINE(CYGWIN, , [Building on Cygwin]) |
88 |
+ |
;; |
89 |
|
*) |
90 |
|
AC_MSG_ERROR([Cannot build on unknown OS: $host_os]) |
91 |
|
;; |
92 |
|
esac |
93 |
|
|
94 |
< |
dnl And finish by changing these files |
95 |
< |
AC_OUTPUT([Makefile]) |
94 |
> |
# User specified curses/ncurses prefix |
95 |
> |
AC_ARG_WITH([curses-prefix], |
96 |
> |
[ --with-curses-prefix=PATH curses (or ncurses) is in PATH], |
97 |
> |
[ |
98 |
> |
if test -d "$withval/lib"; then |
99 |
> |
SAIDARLIBS="-L${withval}/lib ${SAIDARLIBS}" |
100 |
> |
fi |
101 |
> |
if test -d "$withval/include"; then |
102 |
> |
SAIDARCPPFLAGS="-I${withval}/include -I${withval}/include/ncurses ${SAIRDARCPPFLAGS}" |
103 |
> |
fi |
104 |
> |
] |
105 |
> |
) |
106 |
> |
|
107 |
> |
# Check if user wants to disable statgrab |
108 |
> |
AM_CONDITIONAL(STATGRAB, true) |
109 |
> |
AC_ARG_ENABLE(statgrab, |
110 |
> |
[ --disable-statgrab disable building of statgrab], |
111 |
> |
[ |
112 |
> |
if test "x$enableval" = "xno" ; then |
113 |
> |
AM_CONDITIONAL(STATGRAB, false) |
114 |
> |
fi |
115 |
> |
] |
116 |
> |
) |
117 |
> |
|
118 |
> |
# Check if user wants to disable saidar |
119 |
> |
AM_CONDITIONAL(SAIDAR, true) |
120 |
> |
AC_ARG_ENABLE(saidar, |
121 |
> |
[ --disable-saidar disable building of saidar], |
122 |
> |
[ |
123 |
> |
if test "x$enableval" = "xno" ; then |
124 |
> |
AM_CONDITIONAL(SAIDAR, false) |
125 |
> |
fi |
126 |
> |
], |
127 |
> |
[ |
128 |
> |
# saidar needs curses |
129 |
> |
# (if we don't find curses we disable saidar) |
130 |
> |
MP_WITH_CURSES |
131 |
> |
] |
132 |
> |
) |
133 |
> |
|
134 |
> |
# Check if the user would prefer not to build examples |
135 |
> |
AM_CONDITIONAL(EXAMPLES, true) |
136 |
> |
AC_ARG_ENABLE(examples, |
137 |
> |
[ --disable-examples disable building of examples], |
138 |
> |
[ |
139 |
> |
if test "x$enableval" = "xno" ; then |
140 |
> |
AM_CONDITIONAL(EXAMPLES, false) |
141 |
> |
fi |
142 |
> |
] |
143 |
> |
) |
144 |
> |
|
145 |
> |
# Check if user wants to install manpages |
146 |
> |
AM_CONDITIONAL(MANPAGES, true) |
147 |
> |
AC_ARG_ENABLE(manpages, |
148 |
> |
[ --disable-manpages disable installation of manpages], |
149 |
> |
[ |
150 |
> |
if test "x$enableval" = "xno" ; then |
151 |
> |
AM_CONDITIONAL(MANPAGES, false) |
152 |
> |
fi |
153 |
> |
] |
154 |
> |
) |
155 |
> |
|
156 |
> |
# Check if the user wants to turn off setgid binaries |
157 |
> |
AC_ARG_ENABLE(setgid-binaries, |
158 |
> |
[ --disable-setgid-binaries disable binaries being setgid], |
159 |
> |
[ |
160 |
> |
if test "x$enableval" = "xno" ; then |
161 |
> |
AM_CONDITIONAL(SETGIDBINS, false) |
162 |
> |
fi |
163 |
> |
] |
164 |
> |
) |
165 |
> |
|
166 |
> |
# Check if the user wants to turn off setuid binaries |
167 |
> |
AC_ARG_ENABLE(setuid-binaries, |
168 |
> |
[ --disable-setuid-binaries disable binaries being setuid], |
169 |
> |
[ |
170 |
> |
if test "x$enableval" = "xno" ; then |
171 |
> |
AM_CONDITIONAL(SETUIDBINS, false) |
172 |
> |
fi |
173 |
> |
] |
174 |
> |
) |
175 |
> |
|
176 |
> |
# The LIBS and CPPFLAGS that saidar needs |
177 |
> |
AC_SUBST(SAIDARLIBS) |
178 |
> |
AC_SUBST(SAIDARCPPFLAGS) |
179 |
> |
|
180 |
> |
# The flags needed to link to libstatgrab |
181 |
> |
# (ie. our dependencies) |
182 |
> |
AC_SUBST(LINKFLAGS) |
183 |
> |
|
184 |
> |
# And finish by changing these files |
185 |
> |
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]) |
186 |
> |
|
187 |
> |
AC_OUTPUT |