1 dnl This file is intended for use both internally in libgtop and in every program
2 dnl that wants to use it.
4 dnl It defines the following variables:
6 dnl * 'libgtop_sysdeps_dir' - sysdeps dir for libgtop.
7 dnl * 'libgtop_use_machine_h' - some of system dependend parts of libgtop provide
8 dnl their own header file. In this case we need to
9 dnl define 'HAVE_GLIBTOP_MACHINE_H'.
10 dnl * 'libgtop_need_server' - is the server really needed? Defines 'NEED_LIBGTOP'
11 dnl if true; defines conditional 'NEED_LIBGTOP'.
13 AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
14 AC_REQUIRE([AC_CANONICAL_HOST])
16 AC_SUBST(libgtop_sysdeps_dir)
17 AC_SUBST(libgtop_use_machine_h)
18 AC_SUBST(libgtop_need_server)
20 AC_ARG_WITH(libgtop-examples,
21 [ --with-libgtop-examples Build the libgtop examples (default=no)],[
22 build_examples="$withval"], [build_examples=no])
24 AM_CONDITIONAL(EXAMPLES, test x"$build_examples" = xyes)
26 AC_ARG_WITH(linux-table,
27 [ --with-linux-table Use the table () function from Martin Baulig],[
28 linux_table="$withval"],[linux_table=auto])
30 if test $linux_table = yes ; then
31 AC_CHECK_HEADER(linux/table.h, linux_table=yes, linux_table=no)
32 elif test $linux_table = auto ; then
33 AC_MSG_CHECKING(for table function in Linux Kernel)
39 #include <linux/unistd.h>
40 #include <linux/table.h>
44 static inline _syscall3 (int, table, int, type, union table *, tbl, const void *, param);
52 ret = table (TABLE_VERSION, NULL, NULL);
57 exit (ret < 1 ? ret : 0);
59 ], linux_table=yes, linux_table=no, linux_table=no)
60 AC_MSG_RESULT($linux_table)
63 if test $linux_table = yes ; then
64 AC_DEFINE(HAVE_LINUX_TABLE)
67 AM_CONDITIONAL(LINUX_TABLE, test $linux_table = yes)
69 AC_ARG_WITH(libgtop-smp,
70 [ --with-libgtop-smp Enable SMP support (default-auto)],[
71 libgtop_smp="$withval"],[libgtop_smp=auto])
73 if test $libgtop_smp = auto ; then
74 AC_MSG_CHECKING(whether to enable SMP support)
76 #include <sys/utsname.h>
84 if (uname (&name)) exit (1);
86 exit (strstr (name.version, "SMP") ? 0 : 1);
88 ], libgtop_smp=yes, libgtop_smp=no, libgtop_smp=no)
89 AC_MSG_RESULT($libgtop_smp)
92 if test $libgtop_smp = yes ; then
93 AC_DEFINE(HAVE_LIBGTOP_SMP)
96 AM_CONDITIONAL(LIBGTOP_SMP, test $libgtop_smp = yes)
98 AC_MSG_CHECKING(for libgtop sysdeps directory)
102 if test x$linux_table = xyes ; then
103 libgtop_sysdeps_dir=kernel
104 libgtop_use_machine_h=no
106 libgtop_sysdeps_dir=linux
107 libgtop_use_machine_h=no
108 libgtop_have_sysinfo=yes
110 libgtop_need_server=no
113 libgtop_sysdeps_dir=sun4
114 libgtop_use_machine_h=yes
115 libgtop_need_server=yes
118 libgtop_sysdeps_dir=osf1
119 libgtop_use_machine_h=yes
120 libgtop_need_server=yes
123 libgtop_sysdeps_dir=freebsd
124 libgtop_use_machine_h=yes
125 libgtop_need_server=yes
126 libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
129 libgtop_sysdeps_dir=stub
130 libgtop_use_machine_h=no
131 libgtop_need_server=no
135 test -z "$libgtop_postinstall" && libgtop_postinstall=:
137 AC_MSG_RESULT($libgtop_sysdeps_dir)
139 AC_SUBST(libgtop_sysdeps_dir)
140 AC_SUBST(libgtop_postinstall)
141 AC_SUBST(libgtop_have_sysinfo)
145 AC_CHECK_HEADERS(net/if_var.h)
146 AC_MSG_CHECKING([for I4B])
148 #include <sys/types.h>
149 #include <sys/socket.h>
152 #include <net/if_types.h>
154 #ifdef HAVE_NET_IF_VAR_H
155 #include <net/if_var.h>
158 #include <net/netisr.h>
159 #include <net/route.h>
162 #include <net/if_sppp.h>
164 #include <i4b/sppp/if_sppp.h>
167 size_t size = sizeof (struct sppp);
168 ], have_i4b=yes, have_i4b=no)
169 AC_MSG_RESULT($have_i4b)
170 if test x$have_i4b = xyes; then
172 AC_MSG_CHECKING([for I4B accounting])
174 #include <sys/types.h>
175 #include <sys/socket.h>
178 #include <net/if_types.h>
180 #ifdef HAVE_NET_IF_VAR_H
181 #include <net/if_var.h>
184 #include <net/netisr.h>
185 #include <net/route.h>
188 #include <net/if_sppp.h>
190 #include <i4b/sppp/if_sppp.h>
193 #include <machine/i4b_acct.h>
195 size_t size = sizeof (struct i4bisppp_softc);
196 ], have_i4b_acct=yes, have_i4b_acct=no)
197 AC_MSG_RESULT($have_i4b_acct)
198 if test x$have_i4b_acct = xyes ; then
199 AC_DEFINE(HAVE_I4B_ACCT)
202 *** I4B accounting disabled - you won't get any PPP statistics.
203 *** Read "misc/i4b_acct.txt" in the LibGTop source directory
204 *** to see how to enable it.])
210 AC_MSG_CHECKING(for machine.h in libgtop sysdeps dir)
211 AC_MSG_RESULT($libgtop_use_machine_h)
213 AC_MSG_CHECKING(whether we need libgtop)
214 AC_MSG_RESULT($libgtop_need_server)
216 if test x$libgtop_need_server = xyes ; then
217 AC_DEFINE(NEED_LIBGTOP)
220 if test x$libgtop_use_machine_h = xyes ; then
221 AC_DEFINE(HAVE_GLIBTOP_MACHINE_H)
224 AM_CONDITIONAL(NEED_LIBGTOP, test x$libgtop_need_server = xyes)