Hi!
> +
> +AC_SUBST(KBUILD_RELEASE)
> +
> +AC_ARG_WITH([kbuild-dir],
> + [AC_HELP_STRING([--with-kbuild-dir=DIR],
> + [specify path to kernel-devel directory])],
> + [KBUILD_DIR="${withval}"],
> + [KBUILD_DIR="/lib/modules/$KBUILD_RELEASE/build"])
> +
> +AC_SUBST(KBUILD_DIR)
> +
> +WITH_MODULES="no"
> +
> +if test -f "$KBUILD_DIR/Makefile"; then
> +
> + KBUILD_VERSION=`grep -o '^VERSION = [[0-9]]*' -m 1 \
> +"${KBUILD_DIR}/Makefile" | grep -o '[[0-9]]*'`
Or it can be sed command as well:
KBUILD_VERSION=`sed -n '0,/^VERSION = [[0-9]]*/s,\
^VERSION = ,,p' ${KBUILD_DIR}/Makefile`
> +
> + KBUILD_PATCHLEVEL=`grep -o "^PATCHLEVEL = [[0-9]]*" -m 1 \
> +"${KBUILD_DIR}/Makefile" | grep -o "[[0-9]]*"`
> +
> + if [[ -n "$KBUILD_VERSION" ]]&& [[ -n "$KBUILD_PATCHLEVEL" ]]; then
> + WITH_MODULES="yes"
> + fi
May be it would be better to pull this structure out:
if test -f "$KBUILD_DIR/Makefile"; then
KBUILD_VERSION=`sed -n '0,/^VERSION = [[0-9]]*/s,\
^VERSION = ,,p' ${KBUILD_DIR}/Makefile`
KBUILD_PATCHLEVEL=`sed -n '0,/^PATCHLEVEL = [[0-9]]*/s,\
^PATCHLEVEL = ,,p' ${KBUILD_DIR}/Makefile`
fi
AC_SUBST(KBUILD_VERSION)
AC_SUBST(KBUILD_PATCHLEVEL)
if [[ -n "$KBUILD_VERSION" -a -n "$KBUILD_PATCHLEVEL" ]]; then
WITH_MODULES="yes"
else
WITH_MODULES="no"
fi
Would appreciate any comment.
Thanks,
Alexey
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list