From d2c3d70a2793fb8276893bb3edad0f1cb5a0367b Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Thu, 3 Dec 1998 16:08:24 +0000 Subject: [PATCH] Define this to be the same as LINUX_VERSION_CODE either from 1998-12-03 Martin Baulig * gnome-libgtop-sysdeps.m4 (GLIBTOP_LINUX_VERSION_CODE): Define this to be the same as LINUX_VERSION_CODE either from or from the running kernel. svn path=/trunk/; revision=499 --- macros/ChangeLog | 6 ++++++ macros/gnome-libgtop-sysdeps.m4 | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/macros/ChangeLog b/macros/ChangeLog index dceba3a..ec8d3a4 100644 --- a/macros/ChangeLog +++ b/macros/ChangeLog @@ -1,3 +1,9 @@ +1998-12-03 Martin Baulig + + * gnome-libgtop-sysdeps.m4 (GLIBTOP_LINUX_VERSION_CODE): + Define this to be the same as LINUX_VERSION_CODE either from + or from the running kernel. + 1998-12-02 Raja R Harinath * autogen.sh: "Improve" indentation and messages somewhat. diff --git a/macros/gnome-libgtop-sysdeps.m4 b/macros/gnome-libgtop-sysdeps.m4 index 371ee43..82c50c0 100644 --- a/macros/gnome-libgtop-sysdeps.m4 +++ b/macros/gnome-libgtop-sysdeps.m4 @@ -203,6 +203,30 @@ main (void) AC_DEFINE(HAVE_LINUX_TABLE) fi AM_CONDITIONAL(LINUX_TABLE, test $linux_table = yes) + + os_major_version=`uname -r | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + os_minor_version=`uname -r | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + os_micro_version=`uname -r | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + os_version_expr="$os_major_version 65536 * $os_minor_version 256 * + $os_micro_version + p q" + + AC_CHECK_HEADERS(linux/version.h, have_linux_version_h=yes, + have_linux_version_h=no) + + if test x$have_linux_version_h = xyes ; then + version_code=`cat /usr/include/linux/version.h | \ + grep \#define | grep LINUX_VERSION_CODE` + os_version_code=`echo $version_code | \ + sed 's/^.*LINUX_VERSION_CODE[[ \t]]*\([[0-9]]*\).*$/\1/'` + else + os_version_code=`echo "$os_version_expr" | dc` + fi + + AC_MSG_CHECKING(for Linux kernel version code) + AC_DEFINE_UNQUOTED(GLIBTOP_LINUX_VERSION_CODE, $os_version_code) + AC_MSG_RESULT($os_version_code) ;; esac -- 2.7.4