From 4ff2664acb75aea214b37cbe6cedeb75ff48cc59 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 20 Dec 2007 15:12:22 +0000 Subject: [PATCH] Once the linux build directory has been determined ($LINUX_DIR), try and override the previous setting of the LINUX_KERNEL_RELEASE variable using the release info from the Linux build directory. Information comes from the UTS_RELEASE C macro. For kernel versions 2.6.18 and later this is defined in include/linux/utsrelease.h. For earlier kernel versions it is defined in include/linux/version.h. --- m4/as-linux.m4 | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/m4/as-linux.m4 b/m4/as-linux.m4 index 86902ec8..468b5596 100644 --- a/m4/as-linux.m4 +++ b/m4/as-linux.m4 @@ -78,6 +78,8 @@ AC_DEFUN([AS_LINUX], dnl find the kernel build tree for the given uname -r AS_LINUX_DIR() + dnl override kernel release uname -r value with info from build tree + AS_LINUX_OVERRIDE_KERNEL_RELEASE($LINUX_DIR) dnl find the kernel source tree from the build tree or --with-linuxsrcdir AS_LINUX_SRC_DIR($LINUX_DIR) dnl check if user supplied an EXTRAVERSION, and if not get from uname -r @@ -226,8 +228,30 @@ AC_DEFUN([AS_LINUX_KERNEL_RELEASE], AC_MSG_NOTICE([Using $LINUX_KERNEL_RELEASE as the uname -r value]) ]) +dnl replaces LINUX_KERNEL_RELEASE once the Linux build directory is known +dnl first argument is the Linux build directory +AC_DEFUN([AS_LINUX_OVERRIDE_KERNEL_RELEASE], +[ + INCDIR="$1/include" + UTSINC="${INCDIR}/linux/utsrelease.h" + if ! test -f "${UTSINC}"; then + UTSINC="${INCDIR}/linux/version.h" + fi + if test -f "${UTSINC}"; then + RELEASE=`echo UTS_RELEASE | cat "${UTSINC}" - | + /lib/cpp -I "${INCDIR}" | tail -n 1 | + sed 's/^"\(.*\)"$/\1/'` + if test "${RELEASE}" != "UTS_RELEASE" -a "${RELEASE}" != "" \ + -a "${RELEASE}" != "${LINUX_KERNEL_RELEASE}"; then + AC_MSG_NOTICE([Overriding uname -r value with ${RELEASE}]) + LINUX_KERNEL_RELEASE="${RELEASE}" + fi + + fi +]) + dnl allow for specifying a machine (uname -m) to build for -dnl use uname -, of running one if not specified +dnl use uname -m, of running one if not specified dnl store result in LINUX_MACHINE AC_DEFUN([AS_LINUX_MACHINE], [ -- 2.26.2