Add .config parsing functions
authorDaniel Drake <dsd@gentoo.org>
Wed, 6 Oct 2004 21:25:11 +0000 (21:25 +0000)
committerDaniel Drake <dsd@gentoo.org>
Wed, 6 Oct 2004 21:25:11 +0000 (21:25 +0000)
eclass/kernel-mod.eclass

index a0c47b335d1dba14fd62f34658e2fb48b4d74ca4..67145ae9d36e5bb625938b2ad82659739f3cf028 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-mod.eclass,v 1.8 2004/06/25 00:39:48 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-mod.eclass,v 1.9 2004/10/06 21:25:11 dsd Exp $
 
 # This eclass provides help for compiling external kernel modules from
 # source.
@@ -85,6 +85,47 @@ kernel-mod_getversion ()
        einfo "Building for Linux ${KV_VERSION_FULL} found in ${KERNEL_DIR}"
 }
 
+kernel-mod_configoption_present ()
+{
+        [ -e "${KERNEL_DIR}/.config" ] || die "kernel has not been configured yet"
+
+       if egrep "^CONFIG_${1}=[ym]" ${ROOT}/usr/src/linux/.config >/dev/null
+       then
+               return 0
+       else
+               return -1
+       fi
+}
+
+kernel-mod_configoption_module ()
+{
+       [ -e "${KERNEL_DIR}/.config" ] || die "kernel has not been configured yet"
+
+       if egrep "^CONFIG_${1}=[m]" ${ROOT}/usr/src/linux/.config >/dev/null
+       then
+               return 0
+       else
+               return -1
+       fi
+}
+
+kernel-mod_configoption_builtin ()
+{
+       [ -e "${KERNEL_DIR}/.config" ] || die "kernel has not been configured yet"
+
+       if egrep "^CONFIG_${1}=[y]" ${ROOT}/usr/src/linux/.config >/dev/null
+       then
+               return 0
+       else
+               return -1
+       fi
+}
+
+kernel-mod_modules_supported ()
+{
+       kernel-mod_configoption_builtin "MODULES"
+}
+
 kernel-mod_checkzlibinflate_configured ()
 {
        einfo "Checking for status of CONFIG_ZLIB_INFLATE support in your kernel"