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 <guoshichao@xiaomi.com>
This commit is contained in:
guoshichao 2023-06-01 17:26:10 +08:00 committed by Xiang Xiao
parent 7f551aa33f
commit 441b51b706
3 changed files with 13 additions and 1 deletions

View File

@ -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"

11
libs/libc/regex/Kconfig Normal file
View File

@ -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.

View File

@ -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