From 441b51b7060b3a8da7ecfaf6ef214bb0cd76cc48 Mon Sep 17 00:00:00 2001 From: guoshichao Date: Thu, 1 Jun 2023 17:26:10 +0800 Subject: [PATCH] libc/regex: provide a separate kconfig for regex in the initial impl, the regex is depends on ALLOW_MIT_COMPONENTS, and if other modules want to use regex, also needs to depends on ALLOW_MIT_COMPONENTS, which is ambiguity, so we provide a seperate kconfig option for regex: LIBC_REGEX, which is depends on ALLOW_MIT_COMPONENTS, but is enabled by default. Thus if ALLOW_MIT_COMPONENTS is enabled, then the LIBC_REGEX is also enabled either automatically, and this is more clear than controlled by ALLOW_MIT_COMPONENTS option only. Signed-off-by: guoshichao --- libs/libc/Kconfig | 1 + libs/libc/regex/Kconfig | 11 +++++++++++ libs/libc/regex/Make.defs | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 libs/libc/regex/Kconfig diff --git a/libs/libc/Kconfig b/libs/libc/Kconfig index be6219caee..1e26b3ee38 100644 --- a/libs/libc/Kconfig +++ b/libs/libc/Kconfig @@ -29,3 +29,4 @@ source "libs/libc/userfs/Kconfig" source "libs/libc/builtin/Kconfig" source "libs/libc/symtab/Kconfig" source "libs/libc/stream/Kconfig" +source "libs/libc/regex/Kconfig" diff --git a/libs/libc/regex/Kconfig b/libs/libc/regex/Kconfig new file mode 100644 index 0000000000..c211c34be8 --- /dev/null +++ b/libs/libc/regex/Kconfig @@ -0,0 +1,11 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config LIBC_REGEX + bool "Enable regex" + depends on ALLOW_MIT_COMPONENTS + default y + ---help--- + provide the regex related func, include regcomp, regexec. \ No newline at end of file diff --git a/libs/libc/regex/Make.defs b/libs/libc/regex/Make.defs index 2e97724c1c..8f46954f57 100644 --- a/libs/libc/regex/Make.defs +++ b/libs/libc/regex/Make.defs @@ -18,7 +18,7 @@ # ############################################################################ -ifeq ($(CONFIG_ALLOW_MIT_COMPONENTS),y) +ifeq ($(CONFIG_LIBC_REGEX),y) # Add the regex C files to the build CSRCS += regcomp.c regexec.c regerror.c tre-mem.c