ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/configure.in
Revision: 1.103
Committed: Sun Oct 3 18:35:56 2010 UTC (14 years, 1 month ago) by tdb
Branch: MAIN
Changes since 1.102: +14 -4 lines
Log Message:
Add support for AIX 5.x - 9.x.

Many thanks to Jens Rehsack <rehsack@googlemail.com> for providing the
patch for this work. Thanks!

File Contents

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