Add -lgtop_backend_sysdeps' and -lgtop_backend_common' if dynamic

2000-02-16  Martin Baulig  <martin@home-of-linux.org>

	* configure.in (LIBGTOP_LIBS): Add `-lgtop_backend_sysdeps' and
	`-lgtop_backend_common' if dynamic linking does not work.

	* libgtop-sysdeps.m4 (GNOME_LIBGTOP_DYNLINK): New macro to check
	whether dynamic linking works.
	(libgtop_use_gmodule): Set this to `yes' or `no' depending on
	whether dynamic linking of the backends work on the current system.
	(LIBGTOP_USE_GMODULE): New automake conditional.

	* acconfig.h (LIBGTOP_USE_GMOUDLE): Define this when dynamic
	linking of the backends work on the current system.
This commit is contained in:
Martin Baulig
2000-02-22 14:07:36 +00:00
committed by Martin Baulig
parent e577aa3d08
commit a9ed25e7fc
4 changed files with 120 additions and 2 deletions

View File

@@ -1,3 +1,17 @@
2000-02-16 Martin Baulig <martin@home-of-linux.org>
* configure.in (LIBGTOP_LIBS): Add `-lgtop_backend_sysdeps' and
`-lgtop_backend_common' if dynamic linking does not work.
* libgtop-sysdeps.m4 (GNOME_LIBGTOP_DYNLINK): New macro to check
whether dynamic linking works.
(libgtop_use_gmodule): Set this to `yes' or `no' depending on
whether dynamic linking of the backends work on the current system.
(LIBGTOP_USE_GMODULE): New automake conditional.
* acconfig.h (LIBGTOP_USE_GMOUDLE): Define this when dynamic
linking of the backends work on the current system.
2000-02-21 Martin Baulig <martin@home-of-linux.org>
* include/glibtop/interfaces.h (GLIBTOP_STRATEGY_FLAGS_MASK):

View File

@@ -180,3 +180,7 @@
* which takes the interface number as argument
* (default '/var/lock/LCK..ttyS%u'). */
#undef LIBGTOP_MODEM_LOCKFILE
/* Define to enable dynamic linking of the backends. */
#undef USE_GMODULE

View File

@@ -156,8 +156,12 @@ AM_CONDITIONAL(ENABLE_SHARED, test x$enable_static = xyes)
AM_PROG_LIBTOOL
AM_PATH_GLIB(1.2.0,,AC_MSG_ERROR(GLIB >= 1.2.0 is required for LibGTop),
[gmodule])
if test x$libgtop_use_gmodule = xyes ; then
AM_PATH_GLIB(1.2.0,,AC_MSG_ERROR(GLIB >= 1.2.0 is required for LibGTop),
[gmodule])
else
AM_PATH_GLIB(1.2.0,,AC_MSG_ERROR(GLIB >= 1.2.0 is required for LibGTop))
fi
dnl You need to uncomment the following line if you want to use
dnl libGTop without Gnome.
@@ -347,6 +351,10 @@ LIBGTOP_EXTRA_LIBS="$LIBGTOP_EXTRA_LIBS $GLIB_LIBS $LIBGTOP_XML_LIB"
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop_common -lgtop"
if test x$linux_use_gmodule != xyes ; then
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop_backend_sysdeps -lgtop_backend_common"
fi
LIBGTOP_NAMES_LIBS="$LIBGTOP_LIBS -lgtop_names"
LIBGTOP_LIBS="$LIBGTOP_LIBS"

View File

@@ -79,6 +79,7 @@ AC_DEFUN([LIBGTOP_CHECK_SYSDEPS_DIR],[
libgtop_have_sysinfo=yes
libgtop_need_server=no
libgtop_have_sysdeps=yes
libgtop_dynlink_ok=yes
;;
freebsd*|netbsd*|openbsd*)
libgtop_sysdeps_dir=freebsd
@@ -86,6 +87,7 @@ AC_DEFUN([LIBGTOP_CHECK_SYSDEPS_DIR],[
libgtop_need_server=yes
libgtop_have_sysdeps=no
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
libgtop_dynlink_ok=yes
;;
bsdi*)
libgtop_sysdeps_dir=freebsd
@@ -93,6 +95,7 @@ AC_DEFUN([LIBGTOP_CHECK_SYSDEPS_DIR],[
libgtop_need_server=yes
libgtop_have_sysdeps=no
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
libgtop_dynlink_ok=yes
;;
solaris*)
libgtop_sysdeps_dir=solaris
@@ -100,12 +103,14 @@ AC_DEFUN([LIBGTOP_CHECK_SYSDEPS_DIR],[
libgtop_need_server=yes
libgtop_have_sysdeps=yes
libgtop_postinstall='chgrp sys $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
libgtop_dynlink_ok=no
;;
osf*)
libgtop_sysdeps_dir=osf1
libgtop_use_machine_h=yes
libgtop_need_server=yes
libgtop_have_sysdeps=yes
libgtop_dynlink_ok=yes
;;
*)
if test x$hacker_mode = xyes ; then
@@ -117,12 +122,14 @@ AC_DEFUN([LIBGTOP_CHECK_SYSDEPS_DIR],[
libgtop_use_machine_h=yes
libgtop_need_server=yes
libgtop_have_sysdeps=no
libgtop_dynlink_ok=no
;;
*)
libgtop_sysdeps_dir=stub
libgtop_use_machine_h=no
libgtop_need_server=no
libgtop_have_sysdeps=yes
libgtop_dynlink_ok=yes
;;
esac
else
@@ -130,6 +137,7 @@ AC_DEFUN([LIBGTOP_CHECK_SYSDEPS_DIR],[
libgtop_use_machine_h=no
libgtop_need_server=no
libgtop_have_sysdeps=yes
libgtop_dynlink_ok=yes
fi
;;
esac
@@ -139,6 +147,72 @@ AC_DEFUN([LIBGTOP_CHECK_SYSDEPS_DIR],[
AC_MSG_RESULT($libgtop_sysdeps_dir)
])
AC_DEFUN([GNOME_LIBGTOP_DYNLINK],[
AC_MSG_CHECKING(whether to build gmodulized LibGTop)
AC_ARG_ENABLE(modules,
[ --disable-modules Disables dynamic module loading],[
if test x$withval = xyes; then
with_modules=yes
else
with_modules=no
fi
])
dynworks=false
deps=
if test x$with_modules = xno; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_MSG_CHECKING(whether dynamic modules work)
oLIBS="$LIBS"
oCFLAGS="$CFLAGS"
LIBS="`glib-config --libs gmodule`"
CFLAGS="`glib-config --cflags gmodule`"
AC_TRY_RUN([
#include <glib.h>
#include <gmodule.h>
main ()
{
if (g_module_supported ())
exit (0);
else
exit (1);
}
], dynworks=true, dynworks=false, dynworks=true)
LIBS="$oLIBS"
CFLAGS="$oCFLAGS"
fi
dnl Now we check to see if our libtool supports shared lib deps
dnl (in a rather ugly way even)
if $dynworks; then
libgtop_libtool_config="${CONFIG_SHELL-/bin/sh} libtool --config"
libgtop_deplibs_check=`$libgtop_libtool_config | \
grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''\"]]' | \
sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
if test "x$libgtop_deplibs_check" = "xnone" || \
test "x$libgtop_deplibs_check" = "xunknown" || \
test "x$libgtop_deplibs_check" = "x"; then
dynworks=false
fi
fi
if $dynworks; then
AC_DEFINE(USE_GMODULE)
GMODULE_LIBS="`glib-config --libs gmodule`"
GMODULE_FLAGS="`glib-config --cflags gmodule`"
AC_SUBST(GMODULE_LIBS)
AC_SUBST(GMODULE_FLAGS)
libgtop_use_gmodule=yes
else
libgtop_use_gmodule=no
fi
AC_MSG_RESULT($libgtop_use_gmodule)
])
AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
AC_REQUIRE([AC_CANONICAL_HOST])
@@ -195,6 +269,7 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
libgtop_have_sysinfo=no
libgtop_need_server=no
libgtop_have_sysdeps=yes
libgtop_dynlink_ok=yes
;;
stub_suid)
libgtop_sysdeps_dir=stub_suid
@@ -202,6 +277,7 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
libgtop_have_sysinfo=no
libgtop_need_server=yes
libgtop_have_sysdeps=no
libgtop_dynlink_ok=yes
;;
linux|kernel)
libgtop_sysdeps_dir=linux
@@ -209,6 +285,7 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
libgtop_have_sysinfo=yes
libgtop_need_server=no
libgtop_have_sysdeps=yes
libgtop_dynlink_ok=yes
;;
bsd)
libgtop_sysdeps_dir=freebsd
@@ -216,6 +293,7 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
libgtop_need_server=yes
libgtop_have_sysdeps=no
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
libgtop_dynlink_ok=yes
;;
solaris)
libgtop_sysdeps_dir=solaris
@@ -223,12 +301,14 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
libgtop_need_server=yes
libgtop_have_sysdeps=yes
libgtop_postinstall='chgrp sys $(bindir)/libgtop_server && chmod 2755 $(bindir)/libgtop_server'
libgtop_dynlink_ok=no
;;
osf)
libgtop_sysdeps_dir=osf1
libgtop_use_machine_h=yes
libgtop_need_server=yes
libgtop_have_sysdeps=yes
libgtop_dynlink_ok=yes
;;
*)
AC_MSG_ERROR(Invalid value for --with-sysdeps-dir)
@@ -240,6 +320,9 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
libgtop_sysdeps_name=`echo $libgtop_sysdeps_dir | sed -e 's/_/-/g'`
AC_MSG_RESULT($libgtop_sysdeps_name)
AC_MSG_CHECKING(whether to use dynamic linking in LibGtop)
AC_MSG_RESULT($libgtop_dynlink_ok)
AC_SUBST(libgtop_sysdeps_dir)
AC_SUBST(libgtop_postinstall)
AC_SUBST(libgtop_have_sysinfo)
@@ -373,7 +456,16 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
AC_DEFINE(HAVE_GLIBTOP_MACHINE_H)
fi
if test x$libgtop_dynlink_ok = xyes ; then
GNOME_LIBGTOP_DYNLINK
else
libgtop_use_gmodule=no
fi
AC_SUBST(libgtop_use_gmodule)
AM_CONDITIONAL(NEED_LIBGTOP, test x$libgtop_need_server = xyes)
AM_CONDITIONAL(HAVE_SYSDEPS, test x$libgtop_have_sysdeps = xyes)
AM_CONDITIONAL(LIBGTOP_USE_GMODULE, test x$libgtop_use_gmodule = xyes)
])