From 1a60650c732bd5f717682054a100d4682ab9e626 Mon Sep 17 00:00:00 2001
From: Joe Hershberger <joe.hershberger@ni.com>
Date: Tue, 21 Apr 2015 17:02:42 -0500
Subject: [PATCH] kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
 configs/acadia_defconfig           | 1 +
 configs/bamboo_defconfig           | 1 +
 configs/bubinga_defconfig          | 1 +
 configs/canyonlands_defconfig      | 1 +
 configs/dlvision-10g_defconfig     | 1 +
 configs/dlvision_defconfig         | 1 +
 configs/ebony_defconfig            | 1 +
 configs/gdppc440etx_defconfig      | 1 +
 configs/icon_defconfig             | 1 +
 configs/intip_defconfig            | 1 +
 configs/io64_defconfig             | 1 +
 configs/io_defconfig               | 1 +
 configs/iocon_defconfig            | 1 +
 configs/katmai_defconfig           | 1 +
 configs/kilauea_defconfig          | 1 +
 configs/luan_defconfig             | 1 +
 configs/m28evk_defconfig           | 1 +
 configs/m53evk_defconfig           | 1 +
 configs/makalu_defconfig           | 1 +
 configs/neo_defconfig              | 1 +
 configs/novena_defconfig           | 1 +
 configs/ocotea_defconfig           | 1 +
 configs/redwood_defconfig          | 1 +
 configs/sequoia_defconfig          | 1 +
 configs/socfpga_arria5_defconfig   | 1 +
 configs/socfpga_cyclone5_defconfig | 1 +
 configs/t3corp_defconfig           | 1 +
 configs/taihu_defconfig            | 1 +
 configs/taishan_defconfig          | 1 +
 configs/walnut_defconfig           | 1 +
 configs/yosemite_defconfig         | 1 +
 configs/yucca_defconfig            | 1 +
 include/configs/amcc-common.h      | 1 -
 include/configs/m28evk.h           | 1 -
 include/configs/m53evk.h           | 1 -
 include/configs/novena.h           | 1 -
 include/configs/socfpga_arria5.h   | 1 -
 include/configs/socfpga_cyclone5.h | 1 -
 lib/Kconfig                        | 8 ++++++++
 39 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/configs/acadia_defconfig b/configs/acadia_defconfig
index 26221ce4e0..4e0d81c81e 100644
--- a/configs/acadia_defconfig
+++ b/configs/acadia_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_ACADIA=y
+CONFIG_REGEX=y
diff --git a/configs/bamboo_defconfig b/configs/bamboo_defconfig
index 1d66807df8..df4adb6962 100644
--- a/configs/bamboo_defconfig
+++ b/configs/bamboo_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_BAMBOO=y
+CONFIG_REGEX=y
diff --git a/configs/bubinga_defconfig b/configs/bubinga_defconfig
index 65ea4d1f7c..532448d09a 100644
--- a/configs/bubinga_defconfig
+++ b/configs/bubinga_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_BUBINGA=y
+CONFIG_REGEX=y
diff --git a/configs/canyonlands_defconfig b/configs/canyonlands_defconfig
index 44d4fbdb9d..e936d7b130 100644
--- a/configs/canyonlands_defconfig
+++ b/configs/canyonlands_defconfig
@@ -5,3 +5,4 @@ CONFIG_CANYONLANDS=y
 CONFIG_DEFAULT_DEVICE_TREE="canyonlands"
 CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
+CONFIG_REGEX=y
diff --git a/configs/dlvision-10g_defconfig b/configs/dlvision-10g_defconfig
index 1d2a5718b0..2f508c37f5 100644
--- a/configs/dlvision-10g_defconfig
+++ b/configs/dlvision-10g_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_DLVISION_10G=y
+CONFIG_REGEX=y
diff --git a/configs/dlvision_defconfig b/configs/dlvision_defconfig
index c0317dcf09..3149cb1e3b 100644
--- a/configs/dlvision_defconfig
+++ b/configs/dlvision_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_DLVISION=y
+CONFIG_REGEX=y
diff --git a/configs/ebony_defconfig b/configs/ebony_defconfig
index db93555b9e..bf2dab65df 100644
--- a/configs/ebony_defconfig
+++ b/configs/ebony_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_EBONY=y
+CONFIG_REGEX=y
diff --git a/configs/gdppc440etx_defconfig b/configs/gdppc440etx_defconfig
index 1097b9c157..5aa579aa60 100644
--- a/configs/gdppc440etx_defconfig
+++ b/configs/gdppc440etx_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_GDPPC440ETX=y
+CONFIG_REGEX=y
diff --git a/configs/icon_defconfig b/configs/icon_defconfig
index 771a093250..caf7c23497 100644
--- a/configs/icon_defconfig
+++ b/configs/icon_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_ICON=y
+CONFIG_REGEX=y
diff --git a/configs/intip_defconfig b/configs/intip_defconfig
index d6af774363..79360af07a 100644
--- a/configs/intip_defconfig
+++ b/configs/intip_defconfig
@@ -2,3 +2,4 @@ CONFIG_SYS_EXTRA_OPTIONS="INTIB"
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_INTIP=y
+CONFIG_REGEX=y
diff --git a/configs/io64_defconfig b/configs/io64_defconfig
index 1111e54e9d..9c0566eb20 100644
--- a/configs/io64_defconfig
+++ b/configs/io64_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_IO64=y
+CONFIG_REGEX=y
diff --git a/configs/io_defconfig b/configs/io_defconfig
index 959af75a1e..5037ff3c6a 100644
--- a/configs/io_defconfig
+++ b/configs/io_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_IO=y
+CONFIG_REGEX=y
diff --git a/configs/iocon_defconfig b/configs/iocon_defconfig
index 6dc88874fa..72956d479c 100644
--- a/configs/iocon_defconfig
+++ b/configs/iocon_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_IOCON=y
+CONFIG_REGEX=y
diff --git a/configs/katmai_defconfig b/configs/katmai_defconfig
index 849231492b..02cff2f79a 100644
--- a/configs/katmai_defconfig
+++ b/configs/katmai_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_KATMAI=y
+CONFIG_REGEX=y
diff --git a/configs/kilauea_defconfig b/configs/kilauea_defconfig
index 28021d99c3..6285fdfa2d 100644
--- a/configs/kilauea_defconfig
+++ b/configs/kilauea_defconfig
@@ -2,3 +2,4 @@ CONFIG_SYS_EXTRA_OPTIONS="KILAUEA"
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_KILAUEA=y
+CONFIG_REGEX=y
diff --git a/configs/luan_defconfig b/configs/luan_defconfig
index d42b4a902f..3ca5ad1521 100644
--- a/configs/luan_defconfig
+++ b/configs/luan_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_LUAN=y
+CONFIG_REGEX=y
diff --git a/configs/m28evk_defconfig b/configs/m28evk_defconfig
index d902434f2e..85ede57e04 100644
--- a/configs/m28evk_defconfig
+++ b/configs/m28evk_defconfig
@@ -1,3 +1,4 @@
 CONFIG_SPL=y
 CONFIG_ARM=y
 CONFIG_TARGET_M28EVK=y
+CONFIG_REGEX=y
diff --git a/configs/m53evk_defconfig b/configs/m53evk_defconfig
index 1d7933bb8b..a61e2d1e05 100644
--- a/configs/m53evk_defconfig
+++ b/configs/m53evk_defconfig
@@ -2,3 +2,4 @@ CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/denx/m53evk/imximage.cfg"
 CONFIG_ARM=y
 CONFIG_TARGET_M53EVK=y
+CONFIG_REGEX=y
diff --git a/configs/makalu_defconfig b/configs/makalu_defconfig
index ed9b82d503..18c7a20eda 100644
--- a/configs/makalu_defconfig
+++ b/configs/makalu_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_MAKALU=y
+CONFIG_REGEX=y
diff --git a/configs/neo_defconfig b/configs/neo_defconfig
index 2a19247731..bc2835362c 100644
--- a/configs/neo_defconfig
+++ b/configs/neo_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_NEO=y
+CONFIG_REGEX=y
diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index ba120753f0..e05c4dcee0 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -2,3 +2,4 @@ CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,MX6Q"
 CONFIG_ARM=y
 CONFIG_TARGET_KOSAGI_NOVENA=y
+CONFIG_REGEX=y
diff --git a/configs/ocotea_defconfig b/configs/ocotea_defconfig
index 34518cd457..c0fa6ce102 100644
--- a/configs/ocotea_defconfig
+++ b/configs/ocotea_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_OCOTEA=y
+CONFIG_REGEX=y
diff --git a/configs/redwood_defconfig b/configs/redwood_defconfig
index ad87d0eb4a..36840dd944 100644
--- a/configs/redwood_defconfig
+++ b/configs/redwood_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_REDWOOD=y
+CONFIG_REGEX=y
diff --git a/configs/sequoia_defconfig b/configs/sequoia_defconfig
index 678c2bb5d1..19ac985a85 100644
--- a/configs/sequoia_defconfig
+++ b/configs/sequoia_defconfig
@@ -2,3 +2,4 @@ CONFIG_SYS_EXTRA_OPTIONS="SEQUOIA"
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_SEQUOIA=y
+CONFIG_REGEX=y
diff --git a/configs/socfpga_arria5_defconfig b/configs/socfpga_arria5_defconfig
index d658a503c9..3ef6b88635 100644
--- a/configs/socfpga_arria5_defconfig
+++ b/configs/socfpga_arria5_defconfig
@@ -4,3 +4,4 @@ CONFIG_ARCH_SOCFPGA=y
 CONFIG_TARGET_SOCFPGA_ARRIA5=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria5_socdk"
+CONFIG_REGEX=y
diff --git a/configs/socfpga_cyclone5_defconfig b/configs/socfpga_cyclone5_defconfig
index a67b0c150d..d68e1c0fec 100644
--- a/configs/socfpga_cyclone5_defconfig
+++ b/configs/socfpga_cyclone5_defconfig
@@ -7,3 +7,4 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_socdk"
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_NETDEVICES=y
 CONFIG_NET=y
+CONFIG_REGEX=y
diff --git a/configs/t3corp_defconfig b/configs/t3corp_defconfig
index c61508af34..beac623931 100644
--- a/configs/t3corp_defconfig
+++ b/configs/t3corp_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_T3CORP=y
+CONFIG_REGEX=y
diff --git a/configs/taihu_defconfig b/configs/taihu_defconfig
index ac83725130..42126f5fa3 100644
--- a/configs/taihu_defconfig
+++ b/configs/taihu_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_TAIHU=y
+CONFIG_REGEX=y
diff --git a/configs/taishan_defconfig b/configs/taishan_defconfig
index e956c6f856..81fe19d9a1 100644
--- a/configs/taishan_defconfig
+++ b/configs/taishan_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_TAISHAN=y
+CONFIG_REGEX=y
diff --git a/configs/walnut_defconfig b/configs/walnut_defconfig
index 844e67fe3a..c5b302e32e 100644
--- a/configs/walnut_defconfig
+++ b/configs/walnut_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_WALNUT=y
+CONFIG_REGEX=y
diff --git a/configs/yosemite_defconfig b/configs/yosemite_defconfig
index d5eea68c04..554b8dc6db 100644
--- a/configs/yosemite_defconfig
+++ b/configs/yosemite_defconfig
@@ -2,3 +2,4 @@ CONFIG_SYS_EXTRA_OPTIONS="YOSEMITE"
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_YOSEMITE=y
+CONFIG_REGEX=y
diff --git a/configs/yucca_defconfig b/configs/yucca_defconfig
index 6c8e20a36e..ed42523db2 100644
--- a/configs/yucca_defconfig
+++ b/configs/yucca_defconfig
@@ -1,3 +1,4 @@
 CONFIG_PPC=y
 CONFIG_4xx=y
 CONFIG_TARGET_YUCCA=y
+CONFIG_REGEX=y
diff --git a/include/configs/amcc-common.h b/include/configs/amcc-common.h
index d5b6e37a38..9e7f37dda9 100644
--- a/include/configs/amcc-common.h
+++ b/include/configs/amcc-common.h
@@ -106,7 +106,6 @@
 #define CONFIG_LOADS_ECHO		/* echo on for serial download	*/
 #define CONFIG_SYS_LOADS_BAUD_CHANGE	/* allow baudrate change	*/
 
-#define CONFIG_REGEX			/* Enable regular expression support */
 /*
  * BOOTP options
  */
diff --git a/include/configs/m28evk.h b/include/configs/m28evk.h
index 5c209913e5..dbc00ce713 100644
--- a/include/configs/m28evk.h
+++ b/include/configs/m28evk.h
@@ -49,7 +49,6 @@
 #define CONFIG_CMD_USB
 #define	CONFIG_VIDEO
 
-#define CONFIG_REGEX			/* Enable regular expression support */
 
 /* Memory configuration */
 #define CONFIG_NR_DRAM_BANKS		1		/* 1 bank of DRAM */
diff --git a/include/configs/m53evk.h b/include/configs/m53evk.h
index c348d38c32..0cc1282281 100644
--- a/include/configs/m53evk.h
+++ b/include/configs/m53evk.h
@@ -51,7 +51,6 @@
 #define CONFIG_CMD_USB
 #define CONFIG_VIDEO
 
-#define CONFIG_REGEX			/* Enable regular expression support */
 
 /*
  * Memory configurations
diff --git a/include/configs/novena.h b/include/configs/novena.h
index 5f834690f3..425db8adee 100644
--- a/include/configs/novena.h
+++ b/include/configs/novena.h
@@ -22,7 +22,6 @@
 #define CONFIG_KEYBOARD
 #define CONFIG_MXC_GPIO
 #define CONFIG_OF_LIBFDT
-#define CONFIG_REGEX
 #define CONFIG_SYS_GENERIC_BOARD
 #define CONFIG_SYS_NO_FLASH
 
diff --git a/include/configs/socfpga_arria5.h b/include/configs/socfpga_arria5.h
index 668a91e116..b8e1c47651 100644
--- a/include/configs/socfpga_arria5.h
+++ b/include/configs/socfpga_arria5.h
@@ -37,7 +37,6 @@
 #define CONFIG_CMD_USB
 #define CONFIG_CMD_USB_MASS_STORAGE
 
-#define CONFIG_REGEX			/* Enable regular expression support */
 
 /* Memory configurations */
 #define PHYS_SDRAM_1_SIZE		0x40000000	/* 1GiB on SoCDK */
diff --git a/include/configs/socfpga_cyclone5.h b/include/configs/socfpga_cyclone5.h
index 676144a668..1227711f32 100644
--- a/include/configs/socfpga_cyclone5.h
+++ b/include/configs/socfpga_cyclone5.h
@@ -37,7 +37,6 @@
 #define CONFIG_CMD_USB
 #define CONFIG_CMD_USB_MASS_STORAGE
 
-#define CONFIG_REGEX			/* Enable regular expression support */
 
 /* Memory configurations */
 #define PHYS_SDRAM_1_SIZE		0x40000000	/* 1GiB on SoCDK */
diff --git a/lib/Kconfig b/lib/Kconfig
index d7fd21928d..0454a86a02 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -36,6 +36,14 @@ config SYS_VSNPRINTF
 	  Thumb-2, about 420 bytes). Enable this option for safety when
 	  using sprintf() with data you do not control.
 
+config REGEX
+	bool "Enable regular expression support"
+	help
+	  If this variable is defined, U-Boot is linked against the
+	  SLRE (Super Light Regular Expression) library, which adds
+	  regex support to some commands, for example "env grep" and
+	  "setexpr".
+
 source lib/rsa/Kconfig
 
 menu "Hashing Support"
-- 
2.39.5