source: trunk/third/libgtop/libgtop-sysdeps.m4 @ 18532

Revision 18532, 8.0 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18531, which included commits to RCS files with non-trunk default branches.
Line 
1dnl This file is intended for use both internally in libgtop and in every program
2dnl that wants to use it.
3dnl
4dnl It defines the following variables:
5dnl
6dnl * 'libgtop_sysdeps_dir'    - sysdeps dir for libgtop.
7dnl * 'libgtop_use_machine_h'  - some of system dependend parts of libgtop provide
8dnl                              their own header file. In this case we need to
9dnl                              define 'HAVE_GLIBTOP_MACHINE_H'.
10dnl * 'libgtop_need_server'    - is the server really needed? Defines 'NEED_LIBGTOP'
11dnl                              if true; defines conditional 'NEED_LIBGTOP'.
12
13AC_DEFUN([LIBGTOP_HACKER_TESTS],[
14        AC_REQUIRE([AC_CANONICAL_HOST])
15
16        case "$host_os" in
17        linux*)
18          AC_ARG_WITH(linux-table,
19          [  --with-linux-table      Use the table () function from Martin Baulig],[
20          linux_table="$withval"],[linux_table=auto])
21          if test $linux_table = yes ; then
22            AC_CHECK_HEADER(linux/table.h, linux_table=yes, linux_table=no)
23          elif test $linux_table = auto ; then
24            AC_MSG_CHECKING(for table function in Linux Kernel)
25            AC_TRY_RUN([
26#include <stdio.h>
27#include <stdlib.h>
28
29#include <unistd.h>
30#include <linux/unistd.h>
31#include <linux/table.h>
32
33#include <syscall.h>
34
35static inline _syscall3 (int, table, int, type, union table *, tbl, const void *, param);
36
37int
38main (void)
39{
40        union table tbl;
41        int ret;
42
43        ret = table (TABLE_VERSION, NULL, NULL);
44
45        if (ret == -1)
46                exit (-errno);
47
48        exit (ret < 1 ? ret : 0);
49}
50], linux_table=yes, linux_table=no, linux_table=no)
51            AC_MSG_RESULT($linux_table)
52          fi
53          if test $linux_table = yes ; then
54            AC_DEFINE(HAVE_LINUX_TABLE)
55          fi
56          AM_CONDITIONAL(LINUX_TABLE, test $linux_table = yes)
57          ;;
58        esac
59])
60
61AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
62        AC_REQUIRE([AC_CANONICAL_HOST])
63
64        AC_SUBST(libgtop_sysdeps_dir)
65        AC_SUBST(libgtop_use_machine_h)
66        AC_SUBST(libgtop_need_server)
67
68        AC_ARG_WITH(libgtop-examples,
69        [  --with-libgtop-examples Build the libgtop examples (default=no)],[
70        build_examples="$withval"], [build_examples=no])
71
72        AM_CONDITIONAL(EXAMPLES, test x"$build_examples" = xyes)
73
74        AC_ARG_ENABLE(hacker-mode,
75        [  --enable-hacker-mode    Enable building of unstable sysdeps],
76        [hacker_mode="$enableval"], [hacker_mode=no])
77
78        AM_CONDITIONAL(HACKER_MODE, test x"$hacker_mode" = xyes)
79
80        if test x$hacker_mode = xyes ; then
81          LIBGTOP_HACKER_TESTS
82        fi
83
84        AC_ARG_WITH(libgtop-smp,
85        [  --with-libgtop-smp      Enable SMP support (default-auto)],[
86        libgtop_smp="$withval"],[libgtop_smp=auto])
87
88        if test $libgtop_smp = auto ; then
89          AC_MSG_CHECKING(whether to enable SMP support)
90          case "$host_os" in
91          linux*)
92            libgtop_smp=yes
93            ;;
94          aix*)
95            libgtop_smp=yes
96            ;;
97          *)
98            libgtop_smp=no
99            ;;
100          esac
101          AC_MSG_RESULT($libgtop_smp)
102        fi
103
104        if test $libgtop_smp = yes ; then
105          AC_DEFINE(HAVE_LIBGTOP_SMP)
106        fi
107
108        AM_CONDITIONAL(LIBGTOP_SMP, test $libgtop_smp = yes)
109
110        AC_MSG_CHECKING(for libgtop sysdeps directory)
111
112        case "$host_os" in
113        linux*)
114          if test x$linux_table = xyes ; then
115            libgtop_sysdeps_dir=kernel
116            libgtop_use_machine_h=no
117          else
118            libgtop_sysdeps_dir=linux
119            libgtop_use_machine_h=no
120            libgtop_have_sysinfo=yes
121          fi
122          libgtop_need_server=no
123          ;;
124        freebsd*|netbsd*|openbsd*|bsdi*)
125          libgtop_sysdeps_dir=freebsd
126          libgtop_use_machine_h=yes
127          libgtop_need_server=yes
128          libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
129          ;;
130        solaris*)
131          libgtop_sysdeps_dir=solaris
132          libgtop_use_machine_h=yes
133          libgtop_need_server=yes
134          libgtop_postinstall='chgrp sys $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
135          ;;
136        aix*)
137          libgtop_sysdeps_dir=aix
138          libgtop_use_machine_h=yes
139          libgtop_need_server=yes
140          libgtop_have_sysinfo=yes
141          libgtop_postinstall='chgrp system $(bindir)/libgtop_server && chmod g+s $(bindir)/libgtop_server2'
142          ;;
143        *)
144          if test x$hacker_mode = xyes ; then
145            case "$host_os" in
146            sunos4*)
147              #Please note that this port is obsolete and not working at
148              #all. It is only useful for people who want to fix it ... :-)
149              libgtop_sysdeps_dir=sun4
150              libgtop_use_machine_h=yes
151              libgtop_need_server=yes
152              ;;
153            osf*)
154              libgtop_sysdeps_dir=osf1
155              libgtop_use_machine_h=yes
156              libgtop_need_server=yes
157              ;;
158            *)
159              libgtop_sysdeps_dir=stub
160              libgtop_use_machine_h=no
161              libgtop_need_server=no
162              ;;
163            esac
164          else
165            libgtop_sysdeps_dir=stub
166            libgtop_use_machine_h=no
167            libgtop_need_server=no
168          fi
169          ;;
170        esac
171
172        test -z "$libgtop_postinstall" && libgtop_postinstall=:
173
174        AC_MSG_RESULT($libgtop_sysdeps_dir)
175
176        AC_SUBST(libgtop_sysdeps_dir)
177        AC_SUBST(libgtop_postinstall)
178        AC_SUBST(libgtop_have_sysinfo)
179
180        case "$host_os" in
181        *bsd*)
182          AC_CHECK_HEADERS(net/if_var.h)
183          AC_MSG_CHECKING([for I4B])
184          AC_TRY_COMPILE([
185#include <sys/types.h>
186#include <sys/socket.h>
187
188#include <net/if.h>
189#include <net/if_types.h>
190
191#ifdef HAVE_NET_IF_VAR_H
192#include <net/if_var.h>
193#endif
194
195#include <net/netisr.h>
196#include <net/route.h>
197
198#if defined(__FreeBSD__) || defined(__NetBSD__)
199#include <net/if_sppp.h>
200#else
201#include <i4b/sppp/if_sppp.h>
202#endif
203],[
204        size_t size = sizeof (struct sppp);
205], have_i4b=yes, have_i4b=no)
206          AC_MSG_RESULT($have_i4b)
207          if test x$have_i4b = xyes; then
208            AC_DEFINE(HAVE_I4B)
209            AC_MSG_CHECKING([for I4B accounting])
210            AC_TRY_COMPILE([
211#include <sys/types.h>
212#include <sys/socket.h>
213
214#include <net/if.h>
215#include <net/if_types.h>
216
217#ifdef HAVE_NET_IF_VAR_H
218#include <net/if_var.h>
219#endif
220
221#include <net/netisr.h>
222#include <net/route.h>
223
224#if defined(__FreeBSD__) || defined(__NetBSD__)
225#include <net/if_sppp.h>
226#else
227#include <i4b/sppp/if_sppp.h>
228#endif
229
230#include <machine/i4b_acct.h>
231],[
232        size_t size = sizeof (struct i4bisppp_softc);
233], have_i4b_acct=yes, have_i4b_acct=no)
234            AC_MSG_RESULT($have_i4b_acct)
235            if test x$have_i4b_acct = xyes ; then
236              AC_DEFINE(HAVE_I4B_ACCT)
237            else
238              AC_WARN([
239*** I4B accounting disabled - you won't get any PPP statistics.
240*** Read "misc/i4b_acct.txt" in the LibGTop source directory
241*** to see how to enable it.])
242            fi
243          fi
244          ;;
245        linux*)
246          os_major_version=`uname -r | sed 's/-pre[[0-9]]*//' | \
247            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
248          os_minor_version=`uname -r | sed 's/-pre[[0-9]]*//' | \
249            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
250          os_micro_version=`uname -r | sed 's/-pre[[0-9]]*//' | \
251            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
252          os_version_expr="$os_major_version 65536 * $os_minor_version 256 * + $os_micro_version + p q"
253
254          AC_CHECK_HEADERS(linux/version.h, have_linux_version_h=yes,
255            have_linux_version_h=no)
256
257          if test x$have_linux_version_h = xyes ; then
258            version_code=`cat /usr/include/linux/version.h | \
259              grep \#define | grep LINUX_VERSION_CODE`
260            os_version_code=`echo $version_code | \
261              sed 's/^.*LINUX_VERSION_CODE[[ \t]]*\([[0-9]]*\).*$/\1/'`
262          else
263            os_version_code=`echo "$os_version_expr" | dc`
264          fi
265
266          AC_MSG_CHECKING(for Linux kernel version code)
267          AC_DEFINE_UNQUOTED(GLIBTOP_LINUX_VERSION_CODE, $os_version_code)
268          AC_MSG_RESULT($os_version_code)
269          ;;
270        solaris*)
271          os_major_version=`uname -r | sed 's/\([[0-9]]*\).\([[0-9]]\)\.*\([[0-9]]*\)/\1/'`
272          os_minor_version=`uname -r | sed 's/\([[0-9]]*\).\([[0-9]]\)\.*\([[0-9]]*\)/\2/'`
273          os_micro_version=`uname -r | sed 's/\([[0-9]]*\).\([[0-9]]\)\.*\([[0-9]]*\)/\3/'`
274          test -z "$os_micro_version" && os_micro_version=0
275          os_version_expr="$os_major_version 100 * $os_minor_version 10 * + $os_micro_version + p q"
276          os_version_code=`echo "$os_version_expr" | dc`
277
278          AC_MSG_CHECKING(for Solaris release code)
279          AC_DEFINE_UNQUOTED(GLIBTOP_SOLARIS_RELEASE, $os_version_code)
280          AC_MSG_RESULT($os_version_code)
281          ;;
282        esac
283
284        AC_MSG_CHECKING(for machine.h in libgtop sysdeps dir)
285        AC_MSG_RESULT($libgtop_use_machine_h)
286
287        AC_MSG_CHECKING(whether we need libgtop)
288        AC_MSG_RESULT($libgtop_need_server)
289
290        if test x$libgtop_need_server = xyes ; then
291          AC_DEFINE(NEED_LIBGTOP)
292        fi
293
294        if test x$libgtop_use_machine_h = xyes ; then
295          AC_DEFINE(HAVE_GLIBTOP_MACHINE_H)
296        fi
297
298        AM_CONDITIONAL(NEED_LIBGTOP, test x$libgtop_need_server = xyes)
299])
300
Note: See TracBrowser for help on using the repository browser.