toolchain: Improve C library option selection

Turn BR2_LARGEFILE, BR2_INET_IPV6, BR2_INET_RPC, BR2_USE_WCHAR,
BR2_ENABLE_LOCALE and BR2_PROGRAM_INVOCATION into hidden options.

Then, for Buildroot toolchains, external toolchains and Crosstool-NG
toolchains, provide visible options that selects the hidden options.

This allows :

 * To show a different label and help text in the case of Buildroot
   toolchain (do you want to enable feature X ?) and in the case of
   external toolchain (is feature X available in your toolchain ?)

 * To not show any option when a glibc external toolchain is selected
   (since glibc is assumed to support all of largefile, IPv6, RPC,
   WCHAR, locale and program invocation) and have them all selected in
   that case.

There is some amount of duplication between Buildroot toolchain config
options and Crosstool-NG toolchain config options, because kconfig
doesn't allow to source the same Config.in file twice (even if under
mutually exclusive conditions). This duplication is more readable that
the hack that consists in splitting files in multiple pieces.

However, this commit changes the name of the options visible in the
configuration interface, so existing .config files will have to be
updated accordingly.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
index a340de6..f0268a7 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -10,9 +10,68 @@
 
 config BR2_TOOLCHAIN_EXTERNAL_GLIBC
 	bool "glibc"
+	select BR2_LARGEFILE
+	select BR2_INET_IPV6
+	select BR2_INET_RPC
+	select BR2_USE_WCHAR
+	select BR2_ENABLE_LOCALE
+	select BR2_PROGRAM_INVOCATION
 
 endchoice
 
+if BR2_TOOLCHAIN_EXTERNAL_UCLIBC
+
+config BR2_TOOLCHAIN_EXTERNAL_LARGEFILE
+	bool "Toolchain has large file support?"
+	select BR2_LARGEFILE
+	help
+	  Select this option if your external toolchain supports
+	  largefile. If you don't know, leave the default value,
+	  Buildroot will tell you if it's correct or not.
+
+config BR2_TOOLCHAIN_EXTERNAL_INET_IPV6
+	bool "Toolchain has IPv6 support?"
+	select BR2_INET_IPV6
+	help
+	  Select this option if your external toolchain supports
+	  IPv6. If you don't know, leave the default value, Buildroot
+	  will tell you if it's correct or not.
+
+config BR2_TOOLCHAIN_EXTERNAL_INET_RPC
+	bool "Toolchain has RPC support ?"
+	select BR2_INET_RPC
+	help
+	  Select this option if your external toolchain supports
+	  RPC. If you don't know, leave the default value, Buildroot
+	  will tell you if it's correct or not.
+
+config BR2_TOOLCHAIN_EXTERNAL_WCHAR
+	bool "Toolchain has WCHAR support?"
+	select BR2_USE_WCHAR
+	help
+	  Select this option if your external toolchain supports
+	  WCHAR. If you don't know, leave the default value, Buildroot
+	  will tell you if it's correct or not.
+
+config BR2_TOOLCHAIN_EXTERNAL_LOCALE
+	bool "Toolchain has locale support?"
+	select BR2_TOOLCHAIN_EXTERNAL_WCHAR
+	select BR2_ENABLE_LOCALE
+	help
+	  Select this option if your external toolchain has locale
+	  support. If you don't know, leave the default value,
+	  Buildroot will tell you if it's correct or not.
+
+config BR2_TOOLCHAIN_EXTERNAL_PROGRAM_INVOCATION
+	bool "Toolchain has program invocation support?"
+	select BR2_PROGRAM_INVOCATION
+	help
+	  Select this option if your external toolchain has program
+	  invocation support. If you don't know, leave the default
+	  value, Buildroot will tell you if it's correct or not.
+
+endif
+
 config BR2_TOOLCHAIN_EXTERNAL_STRIP
 	bool
 	default y