]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
kconfig: add CC_IS_GCC and GCC_VERSION
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 28 May 2018 09:22:01 +0000 (18:22 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 8 Jun 2018 09:56:01 +0000 (18:56 +0900)
This will be useful to specify the required compiler version,
like this:

config FOO
        bool "Use Foo"
        depends on GCC_VERSION >= 40800
        help
          This feature requires GCC 4.8 or newer.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
init/Kconfig

index 22ca30f6a6bdceda57d94bd81f2ca07647d8773a..66c8fd1f1d8e380bbd39682f5bed72e5a9d5b1aa 100644 (file)
@@ -8,6 +8,14 @@ config DEFCONFIG_LIST
        default ARCH_DEFCONFIG
        default "arch/$(ARCH)/defconfig"
 
+config CC_IS_GCC
+       def_bool $(success,$(CC) --version | head -n 1 | grep -q gcc)
+
+config GCC_VERSION
+       int
+       default $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//') if CC_IS_GCC
+       default 0
+
 config CONSTRUCTORS
        bool
        depends on !UML