This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 444ba4caa4f352e97fd8be0de7bc77e0f99a5ec5
Author: jihandong <jihand...@xiaomi.com>
AuthorDate: Fri Jul 12 17:31:45 2024 +0800

    libcxx: optional localization.
    
    Signed-off-by: jihandong <jihand...@xiaomi.com>
    Signed-off-by: cuiziwei <cuizi...@xiaomi.com>
---
 boards/arm/imx6/sabre-6quad/configs/libcxx/defconfig        |  3 +++
 boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/defconfig |  3 +++
 boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/defconfig |  3 +++
 boards/arm/imxrt/imxrt1064-evk/configs/libcxxtest/defconfig |  3 +++
 boards/arm/imxrt/imxrt1170-evk/configs/libcxxtest/defconfig |  3 +++
 boards/arm/mx8mp/verdin-mx8mp/configs/nsh/defconfig         |  3 +++
 .../arm/stm32/stm32f4discovery/configs/testlibcxx/defconfig |  4 +++-
 boards/risc-v/bl602/bl602evb/configs/elf/defconfig          |  3 +++
 .../esp32c3-legacy/esp32c3-devkit/configs/cxx/defconfig     |  3 +++
 boards/risc-v/mpfs/icicle/configs/knsh/defconfig            |  3 +++
 boards/risc-v/qemu-rv/rv-virt/configs/citest/defconfig      |  3 +++
 boards/risc-v/qemu-rv/rv-virt/configs/libcxx/defconfig      |  3 +++
 boards/risc-v/qemu-rv/rv-virt/configs/libcxx64/defconfig    |  3 +++
 boards/sim/sim/sim/configs/citest/defconfig                 |  3 +++
 boards/sim/sim/sim/configs/libcxxtest/defconfig             |  3 +++
 boards/sim/sim/sim/configs/matter/defconfig                 |  3 +++
 boards/xtensa/esp32/esp32-devkitc/configs/cxx/defconfig     |  3 +++
 boards/xtensa/esp32s2/esp32s2-saola-1/configs/cxx/defconfig |  3 +++
 boards/xtensa/esp32s3/esp32s3-devkit/configs/cxx/defconfig  |  3 +++
 libs/libxx/Kconfig                                          |  5 ++++-
 libs/libxx/__config_site                                    |  6 ++++--
 libs/libxx/libcxx.cmake                                     | 13 +++++++++++++
 libs/libxx/libcxx.defs                                      | 11 +++++++++++
 23 files changed, 89 insertions(+), 4 deletions(-)

diff --git a/boards/arm/imx6/sabre-6quad/configs/libcxx/defconfig 
b/boards/arm/imx6/sabre-6quad/configs/libcxx/defconfig
index 771380aaa6..e2db6c0792 100644
--- a/boards/arm/imx6/sabre-6quad/configs/libcxx/defconfig
+++ b/boards/arm/imx6/sabre-6quad/configs/libcxx/defconfig
@@ -24,6 +24,8 @@ CONFIG_ARMV7A_WAYSIZE_64KB=y
 CONFIG_BOARD_LOOPSPERMSEC=99369
 CONFIG_BOOT_RUNFROMSDRAM=y
 CONFIG_BUILTIN=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_DEFAULT_TASK_STACKSIZE=4096
 CONFIG_DEV_ZERO=y
@@ -37,6 +39,7 @@ CONFIG_IMX_DDR_SIZE=1073741824
 CONFIG_INIT_ENTRYPOINT="nsh_main"
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_MAX_EXITFUNS=1
 CONFIG_NSH_ARCHINIT=y
 CONFIG_NSH_BUILTIN_APPS=y
diff --git a/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/defconfig 
b/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/defconfig
index c386b1de97..a59907c917 100644
--- a/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/defconfig
+++ b/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/defconfig
@@ -15,6 +15,8 @@ CONFIG_ARCH_STACKDUMP=y
 CONFIG_BOARD_LATE_INITIALIZE=y
 CONFIG_BOARD_LOOPSPERMSEC=20000
 CONFIG_BUILTIN=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_FS_PROCFS=y
 CONFIG_HAVE_CXX=y
 CONFIG_IDLETHREAD_STACKSIZE=2048
@@ -22,6 +24,7 @@ CONFIG_IMXRT_LPUART1=y
 CONFIG_INIT_ENTRYPOINT="nsh_main"
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_LOCALTIME=y
 CONFIG_LIBM=y
 CONFIG_LPUART1_SERIAL_CONSOLE=y
diff --git a/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/defconfig 
b/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/defconfig
index b24a2fd4f5..7fcd21fbad 100644
--- a/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/defconfig
+++ b/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/defconfig
@@ -15,6 +15,8 @@ CONFIG_ARCH_STACKDUMP=y
 CONFIG_BOARD_LATE_INITIALIZE=y
 CONFIG_BOARD_LOOPSPERMSEC=20000
 CONFIG_BUILTIN=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_FS_PROCFS=y
 CONFIG_HAVE_CXX=y
 CONFIG_IDLETHREAD_STACKSIZE=2048
@@ -22,6 +24,7 @@ CONFIG_IMXRT_LPUART1=y
 CONFIG_INIT_ENTRYPOINT="nsh_main"
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_LOCALTIME=y
 CONFIG_LIBM=y
 CONFIG_LPUART1_SERIAL_CONSOLE=y
diff --git a/boards/arm/imxrt/imxrt1064-evk/configs/libcxxtest/defconfig 
b/boards/arm/imxrt/imxrt1064-evk/configs/libcxxtest/defconfig
index f55b3c7bfa..f32dd1ab9e 100644
--- a/boards/arm/imxrt/imxrt1064-evk/configs/libcxxtest/defconfig
+++ b/boards/arm/imxrt/imxrt1064-evk/configs/libcxxtest/defconfig
@@ -15,6 +15,8 @@ CONFIG_ARCH_STACKDUMP=y
 CONFIG_BOARD_LATE_INITIALIZE=y
 CONFIG_BOARD_LOOPSPERMSEC=20000
 CONFIG_BUILTIN=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_FS_PROCFS=y
 CONFIG_HAVE_CXX=y
 CONFIG_IDLETHREAD_STACKSIZE=2048
@@ -22,6 +24,7 @@ CONFIG_IMXRT_LPUART1=y
 CONFIG_INIT_ENTRYPOINT="nsh_main"
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_LOCALTIME=y
 CONFIG_LIBM=y
 CONFIG_LPUART1_SERIAL_CONSOLE=y
diff --git a/boards/arm/imxrt/imxrt1170-evk/configs/libcxxtest/defconfig 
b/boards/arm/imxrt/imxrt1170-evk/configs/libcxxtest/defconfig
index 05c623aa31..003ce90e3c 100644
--- a/boards/arm/imxrt/imxrt1170-evk/configs/libcxxtest/defconfig
+++ b/boards/arm/imxrt/imxrt1170-evk/configs/libcxxtest/defconfig
@@ -15,6 +15,8 @@ CONFIG_ARCH_STACKDUMP=y
 CONFIG_BOARD_LATE_INITIALIZE=y
 CONFIG_BOARD_LOOPSPERMSEC=20000
 CONFIG_BUILTIN=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_FS_PROCFS=y
 CONFIG_HAVE_CXX=y
 CONFIG_IDLETHREAD_STACKSIZE=2048
@@ -22,6 +24,7 @@ CONFIG_IMXRT_LPUART1=y
 CONFIG_INIT_ENTRYPOINT="nsh_main"
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_LOCALTIME=y
 CONFIG_LIBM=y
 CONFIG_LPUART1_SERIAL_CONSOLE=y
diff --git a/boards/arm/mx8mp/verdin-mx8mp/configs/nsh/defconfig 
b/boards/arm/mx8mp/verdin-mx8mp/configs/nsh/defconfig
index 17dd577692..7014defbc3 100644
--- a/boards/arm/mx8mp/verdin-mx8mp/configs/nsh/defconfig
+++ b/boards/arm/mx8mp/verdin-mx8mp/configs/nsh/defconfig
@@ -24,7 +24,9 @@ CONFIG_ARM_MPU=y
 CONFIG_BOARD_LOOPSPERMSEC=159972
 CONFIG_BUILTIN=y
 CONFIG_CXX_EXCEPTION=y
+CONFIG_CXX_LOCALIZATION=y
 CONFIG_CXX_RTTI=y
+CONFIG_CXX_WCHAR=y
 CONFIG_EXAMPLES_BUTTONS=y
 CONFIG_EXAMPLES_HELLOXX=y
 CONFIG_EXAMPLES_INA219=y
@@ -40,6 +42,7 @@ CONFIG_INPUT=y
 CONFIG_INPUT_BUTTONS_LOWER=y
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_MX8MP_I2C4=y
 CONFIG_MX8MP_I2C=y
 CONFIG_MX8MP_UART4=y
diff --git a/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/defconfig 
b/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/defconfig
index 53065c67b0..fd17d31583 100644
--- a/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/defconfig
+++ b/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/defconfig
@@ -15,14 +15,16 @@ CONFIG_ARCH_CHIP_STM32F407VG=y
 CONFIG_ARCH_STACKDUMP=y
 CONFIG_BOARD_LOOPSPERMSEC=16717
 CONFIG_BUILTIN=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_DISABLE_MOUNTPOINT=y
 CONFIG_EXAMPLES_HELLOXX=y
 CONFIG_HAVE_CXX=y
-CONFIG_HOST_WINDOWS=y
 CONFIG_INIT_ENTRYPOINT="nsh_main"
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
 CONFIG_LIBC_FLOATINGPOINT=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_LOCALTIME=y
 CONFIG_LIBC_MAX_EXITFUNS=4
 CONFIG_LIBM=y
diff --git a/boards/risc-v/bl602/bl602evb/configs/elf/defconfig 
b/boards/risc-v/bl602/bl602evb/configs/elf/defconfig
index b52566503b..099ef3edac 100644
--- a/boards/risc-v/bl602/bl602evb/configs/elf/defconfig
+++ b/boards/risc-v/bl602/bl602evb/configs/elf/defconfig
@@ -34,6 +34,8 @@ CONFIG_BL602_TIMER0=y
 CONFIG_BOARDCTL_ROMDISK=y
 CONFIG_BOARD_LOOPSPERMSEC=10000
 CONFIG_BUILTIN=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_DEBUG_FEATURES=y
 CONFIG_DEBUG_FULLOPT=y
 CONFIG_DEBUG_SYMBOLS=y
@@ -55,6 +57,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
 CONFIG_INIT_STACKSIZE=8192
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_PERROR_STDOUT=y
 CONFIG_LIBC_STRERROR=y
 CONFIG_LIBM=y
diff --git a/boards/risc-v/esp32c3-legacy/esp32c3-devkit/configs/cxx/defconfig 
b/boards/risc-v/esp32c3-legacy/esp32c3-devkit/configs/cxx/defconfig
index 9823954d4c..e975119136 100644
--- a/boards/risc-v/esp32c3-legacy/esp32c3-devkit/configs/cxx/defconfig
+++ b/boards/risc-v/esp32c3-legacy/esp32c3-devkit/configs/cxx/defconfig
@@ -19,6 +19,8 @@ CONFIG_ARCH_RISCV=y
 CONFIG_ARCH_STACKDUMP=y
 CONFIG_BOARD_LOOPSPERMSEC=15000
 CONFIG_BUILTIN=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_DEV_ZERO=y
 CONFIG_FS_PROCFS=y
 CONFIG_HAVE_CXX=y
@@ -26,6 +28,7 @@ CONFIG_IDLETHREAD_STACKSIZE=2048
 CONFIG_INIT_ENTRYPOINT="nsh_main"
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_MAX_EXITFUNS=1
 CONFIG_LIBC_PERROR_STDOUT=y
 CONFIG_LIBC_STRERROR=y
diff --git a/boards/risc-v/mpfs/icicle/configs/knsh/defconfig 
b/boards/risc-v/mpfs/icicle/configs/knsh/defconfig
index bbf78360c4..27d8b6949a 100644
--- a/boards/risc-v/mpfs/icicle/configs/knsh/defconfig
+++ b/boards/risc-v/mpfs/icicle/configs/knsh/defconfig
@@ -40,6 +40,8 @@ CONFIG_ARCH_USE_S_MODE=y
 CONFIG_BOARD_LATE_INITIALIZE=y
 CONFIG_BOARD_LOOPSPERMSEC=54000
 CONFIG_BUILD_KERNEL=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_DEBUG_ASSERTIONS=y
 CONFIG_DEBUG_FEATURES=y
 CONFIG_DEBUG_FULLOPT=y
@@ -60,6 +62,7 @@ CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
 CONFIG_LIBC_EXECFUNCS=y
 CONFIG_LIBC_HOSTNAME="icicle"
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_MAX_EXITFUNS=16
 CONFIG_LIBC_PERROR_STDOUT=y
 CONFIG_LIBC_STRERROR=y
diff --git a/boards/risc-v/qemu-rv/rv-virt/configs/citest/defconfig 
b/boards/risc-v/qemu-rv/rv-virt/configs/citest/defconfig
index 59aa56f5fd..5a067f6ef6 100644
--- a/boards/risc-v/qemu-rv/rv-virt/configs/citest/defconfig
+++ b/boards/risc-v/qemu-rv/rv-virt/configs/citest/defconfig
@@ -39,6 +39,8 @@ CONFIG_CM_MM_TEST=y
 CONFIG_CM_PTHREAD_TEST=y
 CONFIG_CM_SCHED_TEST=y
 CONFIG_CM_TIME_TEST=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_DEBUG_ASSERTIONS=y
 CONFIG_DEBUG_FEATURES=y
 CONFIG_DEBUG_FULLOPT=y
@@ -74,6 +76,7 @@ CONFIG_IOB_NCHAINS=4
 CONFIG_LIBCXX=y
 CONFIG_LIBC_ENVPATH=y
 CONFIG_LIBC_EXECFUNCS=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_LOCALE_CATALOG=y
 CONFIG_LIBC_LOCALTIME=y
 CONFIG_LIBC_MAX_EXITFUNS=32
diff --git a/boards/risc-v/qemu-rv/rv-virt/configs/libcxx/defconfig 
b/boards/risc-v/qemu-rv/rv-virt/configs/libcxx/defconfig
index dab07e3fbb..22a8defb5e 100644
--- a/boards/risc-v/qemu-rv/rv-virt/configs/libcxx/defconfig
+++ b/boards/risc-v/qemu-rv/rv-virt/configs/libcxx/defconfig
@@ -28,6 +28,8 @@ CONFIG_ARCH_RISCV=y
 CONFIG_ARCH_STACKDUMP=y
 CONFIG_BOARD_LOOPSPERMSEC=6366
 CONFIG_BUILTIN=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_DEBUG_FULLOPT=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_DEV_ZERO=y
@@ -42,6 +44,7 @@ CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
 CONFIG_LIBC_ENVPATH=y
 CONFIG_LIBC_EXECFUNCS=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_PERROR_STDOUT=y
 CONFIG_LIBC_STRERROR=y
 CONFIG_LIBM=y
diff --git a/boards/risc-v/qemu-rv/rv-virt/configs/libcxx64/defconfig 
b/boards/risc-v/qemu-rv/rv-virt/configs/libcxx64/defconfig
index f3b6647a86..ddd40f710c 100644
--- a/boards/risc-v/qemu-rv/rv-virt/configs/libcxx64/defconfig
+++ b/boards/risc-v/qemu-rv/rv-virt/configs/libcxx64/defconfig
@@ -28,6 +28,8 @@ CONFIG_ARCH_RISCV=y
 CONFIG_ARCH_STACKDUMP=y
 CONFIG_BOARD_LOOPSPERMSEC=6366
 CONFIG_BUILTIN=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_DEBUG_FULLOPT=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_DEV_ZERO=y
@@ -42,6 +44,7 @@ CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
 CONFIG_LIBC_ENVPATH=y
 CONFIG_LIBC_EXECFUNCS=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_PERROR_STDOUT=y
 CONFIG_LIBC_STRERROR=y
 CONFIG_LIBM=y
diff --git a/boards/sim/sim/sim/configs/citest/defconfig 
b/boards/sim/sim/sim/configs/citest/defconfig
index b11a76b7e8..d3041e790e 100644
--- a/boards/sim/sim/sim/configs/citest/defconfig
+++ b/boards/sim/sim/sim/configs/citest/defconfig
@@ -28,6 +28,8 @@ CONFIG_CM_MM_TEST=y
 CONFIG_CM_PTHREAD_TEST=y
 CONFIG_CM_SCHED_TEST=y
 CONFIG_CM_TIME_TEST=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_DEBUG_ASSERTIONS=y
 CONFIG_DEBUG_FEATURES=y
 CONFIG_DEBUG_SYMBOLS=y
@@ -72,6 +74,7 @@ CONFIG_LIBC_DLFCN=y
 CONFIG_LIBC_ENVPATH=y
 CONFIG_LIBC_EXECFUNCS=y
 CONFIG_LIBC_FLOATINGPOINT=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_LOCALE_CATALOG=y
 CONFIG_LIBC_LOCALE_GETTEXT=y
 CONFIG_LIBC_LOCALTIME=y
diff --git a/boards/sim/sim/sim/configs/libcxxtest/defconfig 
b/boards/sim/sim/sim/configs/libcxxtest/defconfig
index 3929289c0a..98735fa986 100644
--- a/boards/sim/sim/sim/configs/libcxxtest/defconfig
+++ b/boards/sim/sim/sim/configs/libcxxtest/defconfig
@@ -18,7 +18,9 @@ CONFIG_BOARD_LOOPSPERMSEC=0
 CONFIG_BOOT_RUNFROMEXTSRAM=y
 CONFIG_BUILTIN=y
 CONFIG_CXX_EXCEPTION=y
+CONFIG_CXX_LOCALIZATION=y
 CONFIG_CXX_RTTI=y
+CONFIG_CXX_WCHAR=y
 CONFIG_DEBUG_ASSERTIONS=y
 CONFIG_DEBUG_BINFMT=y
 CONFIG_DEBUG_BINFMT_ERROR=y
@@ -46,6 +48,7 @@ CONFIG_IOB_NOTIFIER=y
 CONFIG_LIBCXX=y
 CONFIG_LIBC_ENVPATH=y
 CONFIG_LIBC_EXECFUNCS=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_MAX_EXITFUNS=1
 CONFIG_MM_FILL_ALLOCATIONS=y
 CONFIG_NET=y
diff --git a/boards/sim/sim/sim/configs/matter/defconfig 
b/boards/sim/sim/sim/configs/matter/defconfig
index 63a2557185..1492a92319 100644
--- a/boards/sim/sim/sim/configs/matter/defconfig
+++ b/boards/sim/sim/sim/configs/matter/defconfig
@@ -18,6 +18,8 @@ CONFIG_BOARD_LOOPSPERMSEC=0
 CONFIG_BOOT_RUNFROMEXTSRAM=y
 CONFIG_BUILTIN=y
 CONFIG_CRYPTO_MBEDTLS=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_DEV_GPIO=y
 CONFIG_DEV_LOOP=y
@@ -51,6 +53,7 @@ CONFIG_LIBC_ENVPATH=y
 CONFIG_LIBC_EXECFUNCS=y
 CONFIG_LIBC_GAISTRERROR=y
 CONFIG_LIBC_GAISTRERROR_ERRNUM=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_MAX_EXITFUNS=1
 CONFIG_LIBC_NUMBERED_ARGS=y
 CONFIG_LIBM=y
diff --git a/boards/xtensa/esp32/esp32-devkitc/configs/cxx/defconfig 
b/boards/xtensa/esp32/esp32-devkitc/configs/cxx/defconfig
index de8b68ae55..081899e81c 100644
--- a/boards/xtensa/esp32/esp32-devkitc/configs/cxx/defconfig
+++ b/boards/xtensa/esp32/esp32-devkitc/configs/cxx/defconfig
@@ -19,6 +19,8 @@ CONFIG_ARCH_STACKDUMP=y
 CONFIG_ARCH_XTENSA=y
 CONFIG_BOARD_LOOPSPERMSEC=16717
 CONFIG_BUILTIN=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_ESP32_UART0=y
 CONFIG_FS_PROCFS=y
 CONFIG_HAVE_CXX=y
@@ -27,6 +29,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
 CONFIG_INIT_STACKSIZE=3072
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_MAX_EXITFUNS=1
 CONFIG_LIBM=y
 CONFIG_MM_REGIONS=3
diff --git a/boards/xtensa/esp32s2/esp32s2-saola-1/configs/cxx/defconfig 
b/boards/xtensa/esp32s2/esp32s2-saola-1/configs/cxx/defconfig
index b3ff9a2224..c08e834e6e 100644
--- a/boards/xtensa/esp32s2/esp32s2-saola-1/configs/cxx/defconfig
+++ b/boards/xtensa/esp32s2/esp32s2-saola-1/configs/cxx/defconfig
@@ -19,6 +19,8 @@ CONFIG_ARCH_STACKDUMP=y
 CONFIG_ARCH_XTENSA=y
 CONFIG_BOARD_LOOPSPERMSEC=16717
 CONFIG_BUILTIN=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_ESP32S2_UART0=y
 CONFIG_FS_PROCFS=y
 CONFIG_HAVE_CXX=y
@@ -27,6 +29,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
 CONFIG_INIT_STACKSIZE=3072
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_MAX_EXITFUNS=1
 CONFIG_LIBM=y
 CONFIG_NSH_ARCHINIT=y
diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/cxx/defconfig 
b/boards/xtensa/esp32s3/esp32s3-devkit/configs/cxx/defconfig
index f94785079a..cf1d592057 100644
--- a/boards/xtensa/esp32s3/esp32s3-devkit/configs/cxx/defconfig
+++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/cxx/defconfig
@@ -20,6 +20,8 @@ CONFIG_ARCH_STACKDUMP=y
 CONFIG_ARCH_XTENSA=y
 CONFIG_BOARD_LOOPSPERMSEC=16717
 CONFIG_BUILTIN=y
+CONFIG_CXX_LOCALIZATION=y
+CONFIG_CXX_WCHAR=y
 CONFIG_DEBUG_FULLOPT=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_ESP32S3_UART0=y
@@ -29,6 +31,7 @@ CONFIG_IDLETHREAD_STACKSIZE=3072
 CONFIG_INIT_ENTRYPOINT="nsh_main"
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBCXX=y
+CONFIG_LIBC_LOCALE=y
 CONFIG_LIBC_MAX_EXITFUNS=1
 CONFIG_LIBM=y
 CONFIG_NSH_ARCHINIT=y
diff --git a/libs/libxx/Kconfig b/libs/libxx/Kconfig
index 8bbd396a04..27e41cad4f 100644
--- a/libs/libxx/Kconfig
+++ b/libs/libxx/Kconfig
@@ -43,7 +43,6 @@ config LIBCXXMINI
 config LIBCXX
        bool "LLVM libc++ C++ Standard Library"
        select HAVE_CXXINITIALIZE
-       select LIBC_LOCALE
        select PTHREAD_MUTEX_TYPES
        depends on TLS_NELEM > 0
        ---help---
@@ -115,6 +114,10 @@ config CXX_RTTI
 config CXX_WCHAR
        bool "Enable Wide Character Support"
 
+config CXX_LOCALIZATION
+       bool "Enable Locale and Stream Support"
+       depends on LIBC_LOCALE
+
 if UCLIBCXX
 
 config UCLIBCXX_BUFSIZE
diff --git a/libs/libxx/__config_site b/libs/libxx/__config_site
index c099b5b66c..e7d5116ceb 100644
--- a/libs/libxx/__config_site
+++ b/libs/libxx/__config_site
@@ -27,9 +27,11 @@
 /* #undef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION */
 /* #undef _LIBCPP_HAS_NO_FILESYSTEM */
 /* #undef _LIBCPP_HAS_NO_RANDOM_DEVICE */
-/* #undef _LIBCPP_HAS_NO_LOCALIZATION */
+#ifndef CONFIG_CXX_LOCALIZATION
+#  define _LIBCPP_HAS_NO_LOCALIZATION
+#endif
 #ifndef CONFIG_CXX_WCHAR
-#define _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#  define _LIBCPP_HAS_NO_WIDE_CHARACTERS
 #endif
 #define _LIBCPP_ENABLE_ASSERTIONS_DEFAULT 0
 
diff --git a/libs/libxx/libcxx.cmake b/libs/libxx/libcxx.cmake
index 2bea3136ca..e504e7535c 100644
--- a/libs/libxx/libcxx.cmake
+++ b/libs/libxx/libcxx.cmake
@@ -92,6 +92,19 @@ list(APPEND SRCS ${SRCSTMP})
 file(GLOB SRCSTMP ${CMAKE_CURRENT_LIST_DIR}/libcxx/src/ryu/*.cpp)
 list(APPEND SRCS ${SRCSTMP})
 
+if(NOT CONFIG_CXX_LOCALIZATION)
+  file(
+    GLOB
+    SRCSTMP
+    ${CMAKE_CURRENT_LIST_DIR}/libcxx/src/ios.cpp
+    ${CMAKE_CURRENT_LIST_DIR}/libcxx/src/ios.instantiations.cpp
+    ${CMAKE_CURRENT_LIST_DIR}/libcxx/src/iostream.cpp
+    ${CMAKE_CURRENT_LIST_DIR}/libcxx/src/locale.cpp
+    ${CMAKE_CURRENT_LIST_DIR}/libcxx/src/regex.cpp
+    ${CMAKE_CURRENT_LIST_DIR}/libcxx/src/strstream.cpp)
+  list(REMOVE_ITEM SRCS ${SRCSTMP})
+endif()
+
 set(FLAGS -Wno-attributes -Wno-deprecated-declarations -Wno-shadow
           -Wno-sign-compare)
 
diff --git a/libs/libxx/libcxx.defs b/libs/libxx/libcxx.defs
index d84e9419de..7f39b00a6f 100644
--- a/libs/libxx/libcxx.defs
+++ b/libs/libxx/libcxx.defs
@@ -69,3 +69,14 @@ CPPSRCS += $(wildcard libcxx/src/*.cpp)
 CPPSRCS += $(wildcard libcxx/src/experimental/*.cpp)
 CPPSRCS += $(wildcard libcxx/src/filesystem/*.cpp)
 CPPSRCS += $(wildcard libcxx/src/ryu/*.cpp)
+
+ifeq ($(CONFIG_CXX_LOCALIZATION),)
+  LOCALE_CPPSRCS := libcxx/src/ios.cpp
+  LOCALE_CPPSRCS += libcxx/src/ios.instantiations.cpp
+  LOCALE_CPPSRCS += libcxx/src/iostream.cpp
+  LOCALE_CPPSRCS += libcxx/src/locale.cpp
+  LOCALE_CPPSRCS += libcxx/src/regex.cpp
+  LOCALE_CPPSRCS += libcxx/src/strstream.cpp
+  CPPSRCS := $(filter-out $(LOCALE_CPPSRCS), $(CPPSRCS))
+endif
+

Reply via email to