From: chrubis@suse.cz
To: Alexey Kodanev <alexey.kodanev@oracle.com>
Cc: vasily.isaenko@oracle.com, ltp-list@lists.sourceforge.net,
Mike Frysinger <vapier@gentoo.org>
Subject: Re: [LTP] [PATCH v2] configure: add configure checks to compile kernel modules
Date: Mon, 17 Jun 2013 19:11:22 +0200 [thread overview]
Message-ID: <20130617171122.GA3387@rei> (raw)
In-Reply-To: <1371130083-5923-1-git-send-email-alexey.kodanev@oracle.com>
Hi!
> --- /dev/null
> +++ b/m4/ltp-kernel_devel.m4
> @@ -0,0 +1,82 @@
> +dnl Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
> +dnl
> +dnl This program is free software; you can redistribute it and/or
> +dnl modify it under the terms of the GNU General Public License as
> +dnl published by the Free Software Foundation; either version 2 of
> +dnl the License, or (at your option) any later version.
> +dnl
> +dnl This program is distributed in the hope that it would be useful,
> +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
> +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +dnl GNU General Public License for more details.
> +dnl
> +dnl You should have received a copy of the GNU General Public License
> +dnl along with this program; if not, write the Free Software Foundation,
> +dnl Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> +dnl
> +dnl Author: Alexey Kodanev <alexey.kodanev@oracle.com>
> +dnl
> +
> +dnl
> +dnl LTP_CHECK_KERNEL_DEVEL
> +dnl ----------------------------
> +dnl Building kernel modules
> +dnl requires kernel-devel installed
> +dnl
> +
> +AC_DEFUN([LTP_CHECK_KERNEL_DEVEL],[dnl
> +
> +AC_MSG_CHECKING([for kernel-devel])
> +AC_ARG_WITH(
> + [linux-version],
> + [AC_HELP_STRING([--with-linux-version=VERSION],
> + [specify the Linux version to build modules for])],
> + [LINUX_VERSION="${withval}"],
> + AS_IF([test "$cross_compiling" = "no"],
> + [LINUX_VERSION=`uname -r`]))
So either we get linux version as parameter or we try to use uname, this
is ok.
> +AC_SUBST(LINUX_VERSION)
> +
> +AC_ARG_WITH([linux-dir],
> + [AC_HELP_STRING([--with-linux-dir=DIR],
> + [specify path to kernel-devel directory])],
> + [LINUX_DIR="${withval}"],
> + AS_IF([test -n "$LINUX_VERSION"],
> + [LINUX_DIR="/lib/modules/$LINUX_VERSION/build"]))
> +
> +AC_SUBST(LINUX_DIR)
The same with path, ok.
> +if test -f "$LINUX_DIR/Makefile"; then
> + LINUX_VERSION_MAJOR=`sed -n '0,/^VERSION = [[0-9]]*/s,\
> +^VERSION = ,,p' ${LINUX_DIR}/Makefile`
> +
> + LINUX_PATCHLEVEL=`sed -n '0,/^PATCHLEVEL = [[0-9]]*/s,\
> +^PATCHLEVEL = ,,p' ${LINUX_DIR}/Makefile`
> +fi
Now we check if the dir exists and parse the Makefile for MAJOR and
PATCHLEVEL, ok.
> +if [[ -n "$LINUX_VERSION_MAJOR" -a -n "$LINUX_PATCHLEVEL" ]]; then
> + WITH_MODULES="yes"
If there is Makefile and it contains reasonable content, proceed
with module build, ok.
> +else
> + WITH_MODULES="no"
> + if test -n "$LINUX_VERSION"; then
> + LINUX_VERSION_MAJOR=`echo "$LINUX_VERSION" | \
> +sed -n 's/\([[0-9]]\).*$/\1/p'`
> + LINUX_PATCHLEVEL=`echo "$LINUX_VERSION" | \
> +sed -n 's/^[[0-9]]*.\([[0-9]]\).*$/\1/p'`
> + fi
Here we set the MAJOR and PATCHLEVEL even if WITH_MODULES is set to no.
Is this useful? (Maybe I overlooked something but when WITH_MODULES is
set to no, the kernel version is not needed. Or is this here just in
case we will need that someday?)
> +fi
> +
> +AC_SUBST(LINUX_VERSION_MAJOR)
> +AC_SUBST(LINUX_PATCHLEVEL)
> +
> +AC_MSG_RESULT([$WITH_MODULES])
> +
> +AC_ARG_WITH(
> + [modules],
> + [AC_HELP_STRING([--without-modules],
> + [disable auto-building kernel modules])],
> + [WITH_MODULES="no"],
> + [])
> +
> +AC_SUBST(WITH_MODULES)
> +])
But generally it looks fine to me. Mike are you fine with this version
as well?
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2013-06-17 17:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-13 13:28 [LTP] [PATCH v2] configure: add configure checks to compile kernel modules Alexey Kodanev
2013-06-17 17:11 ` chrubis [this message]
[not found] ` <51C01086.1020207@oracle.com>
[not found] ` <51C177A3.4020301@oracle.com>
2013-06-19 10:53 ` chrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130617171122.GA3387@rei \
--to=chrubis@suse.cz \
--cc=alexey.kodanev@oracle.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=vapier@gentoo.org \
--cc=vasily.isaenko@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.