blob: dcb80f9c80303b0efe8bc5617b323d0ac7643ebf [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001From aa7c5fe86d04584a9aed4dc40ba856c65a1ef9c4 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 18 Mar 2015 00:45:18 +0000
4Subject: [PATCH 19/27] eglibc: Bring Eglibc option group infrastructure to
5 glibc
6
7Upstream-Status: Pending
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 EGLIBC.option-groups | 122 ++++++
12 Makefile | 1 +
13 config.make.in | 2 +
14 configure | 13 +
15 configure.ac | 10 +
16 option-groups.def | 868 ++++++++++++++++++++++++++++++++++++++
17 option-groups.defaults | 47 +++
18 option-groups.mak | 41 ++
19 options-config/Makefile | 55 +++
20 options-config/config-postproc.pl | 58 +++
21 options-config/config-preproc.pl | 8 +
22 scripts/option-groups.awk | 63 +++
23 12 files changed, 1288 insertions(+)
24 create mode 100644 EGLIBC.option-groups
25 create mode 100644 option-groups.def
26 create mode 100644 option-groups.defaults
27 create mode 100644 option-groups.mak
28 create mode 100644 options-config/Makefile
29 create mode 100644 options-config/config-postproc.pl
30 create mode 100644 options-config/config-preproc.pl
31 create mode 100644 scripts/option-groups.awk
32
33diff --git a/EGLIBC.option-groups b/EGLIBC.option-groups
34new file mode 100644
35index 0000000..6a50b8d
36--- /dev/null
37+++ b/EGLIBC.option-groups
38@@ -0,0 +1,122 @@
39+ -*- mode: text -*-
40+
41+ The EGLIBC Component Configuration System
42+ Jim Blandy <jimb@codesourcery.com>
43+
44+Introduction
45+
46+The GNU C library (GLIBC) provides a broad range of functionality,
47+ranging from internationalization support to transcendental
48+mathematical functions. Its website boasts that "nearly all known and
49+useful functions from any other C library are available." This
50+exhaustive approach has been one of GLIBC's strengths on desktop and
51+server systems, but it has also given GLIBC a large footprint, both in
52+memory and on disk, making it a challenge to use in embedded systems
53+with limited resources.
54+
55+The Embedded GNU C library (EGLIBC) is a variant of the GNU C library
56+designed to work well on embedded systems. In particular, EGLIBC's
57+component configuration system allows embedded developers to build
58+customized versions of the library that include only the features
59+their application uses, reducing its space requirements.
60+
61+EGLIBC's component configuration system categorizes the library's
62+functions into "option groups", and allows you to include or exclude
63+option groups individually. Some option groups depend on others;
64+EGLIBC tracks these relationships, and ensures that the selected
65+configuration yields a functioning library.
66+
67+
68+Consistent and Predictable Behavior
69+
70+A flexible configuration system is a mixed blessing: if the options
71+offered are poorly designed, it can be hard to see which choices will
72+have the desired effects, and choices with obscure consequences can
73+make debugging difficult. EGLIBC's configuration follows some general
74+principles to reduce these risks:
75+
76+- EGLIBC has a single default configuration for each target
77+ architecture.
78+
79+- In the default configuration, all option groups are enabled, and
80+ EGLIBC is upwardly API- and ABI-compatible with GLIBC.
81+
82+- As much as possible, configurations only affect what functions are
83+ present, not how they behave. If the system works with an option
84+ group disabled, it will still work with it enabled.
85+
86+- As much as possible, configurations only select option groups ---
87+ they do not describe characteristics of the target architecture.
88+
89+These rules mean that you have a simple debugging strategy available
90+if you suspect that your EGLIBC configuration might be the source of a
91+problem: fall back to the default configuration, re-test, and then
92+disable option groups one by one, until the problem reappears.
93+
94+
95+The Option Groups
96+
97+To see the current full list of implemented option groups, refer to the
98+file 'option-groups.def' at the top of the source tree, or run
99+'make menuconfig' from the top-level build directory.
100+
101+The POSIX.1-2001 specification includes a suggested partition of all
102+the functions in the POSIX C API into option groups: math functions
103+like 'sin' and 'cos'; networking functions like 'socket' and
104+'connect'; and so on. EGLIBC could use this partitioning as the basis
105+for future option groups.
106+
107+
108+Implementation
109+
110+The EGLIBC component configuration system resembles the approach used
111+by the Linux kernel to select device drivers, network protocols, and
112+other features. A file named 'option-groups.config' in the top-level
113+build directory contains assignments to Make variables, each of which
114+enables or disables a particular option group. If the variable's
115+value is set to 'y', then the option group is enabled; if it set to
116+anything else, the option group is omitted. The file
117+'option-groups.defaults', at the top of the source tree, establishes
118+default values for all variables; all option groups are enabled by
119+default.
120+
121+For example, the following 'option-groups.config' would omit locale
122+data, but include mathematical functions, and everything else:
123+
124+ OPTION_EGLIBC_LOCALES = n
125+ OPTION_EGLIBC_LIBM = y
126+
127+Like the Linux kernel, EGLIBC supports a similar set of '*config' make
128+targets to make it easier to create 'option-groups.config', with all
129+dependencies between option groups automatically satisfied. Run
130+'make help' to see the list of supported make config targets. For
131+example, 'make menuconfig' will update the current config utilising a
132+menu based program.
133+
134+The option group names and their type (boolean, int, hex, string), help
135+description, and dependencies with other option groups, are described by
136+'option-groups.def' at the top of the source tree, analogous to the
137+'Kconfig' files in the Linux kernel.
138+
139+In general, each option group variable controls whether a given set of
140+object files in EGLIBC is compiled and included in the final
141+libraries, or omitted from the build.
142+
143+Each subdirectory's Makefile categorizes its routines, libraries, and
144+executables by option group. For example, EGLIBC's 'math/Makefile'
145+places the 'libm' library in the OPTION_EGLIBC_LIBM group as follows:
146+
147+ extra-libs-$(OPTION_EGLIBC_LIBM) := libm
148+
149+Finally, common code in 'Makerules' cites the value of the variable
150+'extra-libs-y', selecting only those libraries that belong to enabled
151+option groups to be built.
152+
153+
154+Current Status and Future Directions
155+
156+The EGLIBC component configuration system described here is still
157+under development.
158+
159+We have used the system to subset some portions of EGLIBC's
160+Index: libc/configure.ac
161diff --git a/Makefile b/Makefile
162index 658ccfa..f906391 100644
163--- a/Makefile
164+++ b/Makefile
165@@ -24,6 +24,7 @@ endif
166
167 include Makeconfig
168
169+include options-config/Makefile
170
171 # This is the default target; it makes everything except the tests.
172 .PHONY: all
173diff --git a/config.make.in b/config.make.in
174index a9f5696..294f8d1 100644
175--- a/config.make.in
176+++ b/config.make.in
177@@ -47,6 +47,8 @@ c++-sysincludes = @CXX_SYSINCLUDES@
178 all-warnings = @all_warnings@
179 enable-werror = @enable_werror@
180
181+kconfig_tools = @KCONFIG_TOOLS@
182+
183 have-z-combreloc = @libc_cv_z_combreloc@
184 have-z-execstack = @libc_cv_z_execstack@
185 have-Bgroup = @libc_cv_Bgroup@
186diff --git a/configure b/configure
187index 7d7299a..4116404 100755
188--- a/configure
189+++ b/configure
190@@ -641,6 +641,7 @@ INSTALL_INFO
191 PERL
192 BASH_SHELL
193 libc_cv_gcc_static_libgcc
194+KCONFIG_TOOLS
195 CXX_SYSINCLUDES
196 SYSINCLUDES
197 AUTOCONF
198@@ -755,6 +756,7 @@ with_fp
199 with_binutils
200 with_selinux
201 with_headers
202+with_kconfig
203 with_default_link
204 enable_sanity_checks
205 enable_shared
206@@ -1459,6 +1461,9 @@ Optional Packages:
207 --with-selinux if building with SELinux support
208 --with-headers=PATH location of system headers to use (for example
209 /usr/src/linux/include) [default=compiler default]
210+ --with-kconfig=PATH location of kconfig tools to use (from Linux kernel
211+ builds) to re-use for configuring EGLIBC option
212+ groups
213 --with-default-link do not use explicit linker scripts
214 --with-cpu=CPU select code for CPU variant
215
216@@ -3517,6 +3522,14 @@ fi
217
218
219
220+# Check whether --with-kconfig was given.
221+if test "${with_kconfig+set}" = set; then
222+ withval=$with_kconfig; KCONFIG_TOOLS=$withval
223+else
224+ KCONFIG_TOOLS=''
225+fi
226+
227+
228
229 # Check whether --with-default-link was given.
230 if test "${with_default_link+set}" = set; then :
231diff --git a/configure.ac b/configure.ac
232index a467a69..fc0ed4d 100644
233--- a/configure.ac
234+++ b/configure.ac
235@@ -136,6 +136,16 @@ AC_ARG_WITH([headers],
236 [sysheaders=''])
237 AC_SUBST(sysheaders)
238
239+AC_ARG_WITH([kconfig],
240+ AC_HELP_STRING([--with-kconfig=PATH],
241+ [location of kconfig tools to use (from Linux
242+ kernel builds) to re-use for configuring EGLIBC
243+ option groups]),
244+ [KCONFIG_TOOLS=$withval],
245+ [KCONFIG_TOOLS=''])
246+AC_SUBST(KCONFIG_TOOLS)
247+
248+
249 AC_SUBST(use_default_link)
250 AC_ARG_WITH([default-link],
251 AC_HELP_STRING([--with-default-link],
252diff --git a/option-groups.def b/option-groups.def
253new file mode 100644
254index 0000000..6aebd94
255--- /dev/null
256+++ b/option-groups.def
257@@ -0,0 +1,868 @@
258+# This file documents the option groups EGLIBC currently supports, in
259+# a format akin to the Linux Kconfig system's. The syntax may change
260+# over time.
261+#
262+# An entry of the form:
263+#
264+# config GROUP_NAME
265+# bool "one-line explanation of what this option group controls"
266+# help
267+# Multi-line help explaining the option group's meaning in
268+# some detail, terminated by indentation level.
269+#
270+# defines an option group whose variable is GROUP_NAME, with
271+# meaningful values 'y' (enabled) and 'n' (disabled). The
272+# documentation is formatted to be consumed by some sort of
273+# interactive configuration interface, but EGLIBC doesn't have such an
274+# interface yet.
275+#
276+# An option may have a 'depends on' line, indicating which other options
277+# must also be enabled if this option is. At present, EGLIBC doesn't
278+# check that these dependencies are satisfied.
279+#
280+# Option group variables get their default values from the file
281+# 'option-groups.defaults', in the top directory of the EGLIBC source
282+# tree. By default, all EGLIBC option groups are enabled --- their
283+# variables are set to 'y'.
284+#
285+# After including 'option-groups.defaults', the EGLIBC make machinery
286+# includes the file 'option-groups.config' from the top of the build
287+# tree, if it is present. Developers can place assignments to option
288+# group variables in that file to override the defaults. For example,
289+# to disable an option group, place a line of the form:
290+#
291+# OPTION_GROUP_NAME = n
292+#
293+# in 'option-groups.config' at the top of your build tree. To
294+# explicitly enable an option group, you may also write:
295+#
296+# OPTION_GROUP_NAME = y
297+#
298+# although this simply reestablishes the value already set by
299+# 'option-groups.defaults'.
300+
301+config EGLIBC_ADVANCED_INET6
302+ bool "IPv6 Advanced Sockets API support (RFC3542)"
303+ depends on EGLIBC_INET
304+ help
305+ This option group includes the functions specified by RFC 3542,
306+ "Advanced Sockets Application Program Interface (API) for
307+ IPv6".
308+
309+ This option group includes the following functions:
310+
311+ inet6_opt_append
312+ inet6_opt_find
313+ inet6_opt_finish
314+ inet6_opt_get_val
315+ inet6_opt_init
316+ inet6_option_alloc
317+ inet6_option_append
318+ inet6_option_find
319+ inet6_option_init
320+ inet6_option_next
321+ inet6_option_space
322+ inet6_opt_next
323+ inet6_opt_set_val
324+ inet6_rth_add
325+ inet6_rth_getaddr
326+ inet6_rth_init
327+ inet6_rth_reverse
328+ inet6_rth_segments
329+ inet6_rth_space
330+
331+config EGLIBC_BACKTRACE
332+ bool "Functions for producing backtraces"
333+ help
334+ This option group includes functions for producing a list of
335+ the function calls that are currently active in a thread, from
336+ within the thread itself. These functions are often used
337+ within signal handlers, to produce diagnostic output.
338+
339+ This option group includes the following functions:
340+
341+ backtrace
342+ backtrace_symbols
343+ backtrace_symbols_fd
344+
345+config EGLIBC_BIG_MACROS
346+ bool "Use extensive inline code"
347+ help
348+ This option group specifies whether certain pieces of code
349+ should be inlined to achieve maximum speed. If this option
350+ group is not selected, function calls will be used instead,
351+ hence reducing the library footprint.
352+
353+config EGLIBC_BSD
354+ bool "BSD-specific functions, and their compatibility stubs"
355+ help
356+ This option group includes functions specific to BSD kernels.
357+ A number of these functions have stub versions that are also
358+ included in libraries built for non-BSD systems for
359+ compatibility.
360+
361+ This option group includes the following functions:
362+
363+ chflags
364+ fchflags
365+ lchmod
366+ revoke
367+ setlogin
368+
369+config EGLIBC_CXX_TESTS
370+ bool "Tests that link against the standard C++ library."
371+ depends on POSIX_WIDE_CHAR_DEVICE_IO && EGLIBC_LIBM
372+ help
373+ This option group does not include any C library functions;
374+ instead, it controls which EGLIBC tests an ordinary 'make
375+ tests' runs. With this group disabled, tests that would
376+ normally link against the standard C++ library are not
377+ run.
378+
379+ The standard C++ library depends on the math library 'libm' and
380+ the wide character I/O functions included in EGLIBC. So those
381+ option groups must be enabled if this test is enabled.
382+
383+config EGLIBC_CATGETS
384+ bool "Functions for accessing message catalogs"
385+ depends on EGLIBC_LOCALE_CODE
386+ help
387+ This option group includes functions for accessing message
388+ catalogs: catopen, catclose, and catgets.
389+
390+ This option group depends on the EGLIBC_LOCALE_CODE
391+ option group.
392+
393+config EGLIBC_CHARSETS
394+ bool "iconv/gconv character set conversion libraries"
395+ help
396+ This option group includes support for character sets other
397+ than ASCII (ANSI_X3.4-1968) and Unicode and ISO-10646 in their
398+ various encodings. This affects both the character sets
399+ supported by the wide and multibyte character functions, and
400+ those supported by the 'iconv' functions.
401+
402+ With this option group disabled, EGLIBC supports only the
403+ following character sets:
404+
405+ ANSI_X3.4 - ASCII
406+ ANSI_X3.4-1968
407+ ANSI_X3.4-1986
408+ ASCII
409+ CP367
410+ CSASCII
411+ IBM367
412+ ISO-IR-6
413+ ISO646-US
414+ ISO_646.IRV:1991
415+ OSF00010020
416+ US
417+ US-ASCII
418+
419+ 10646-1:1993 - ISO 10646, in big-endian UCS4 form
420+ 10646-1:1993/UCS4
421+ CSUCS4
422+ ISO-10646
423+ ISO-10646/UCS4
424+ OSF00010104
425+ OSF00010105
426+ OSF00010106
427+ UCS-4
428+ UCS-4BE
429+ UCS4
430+
431+ UCS-4LE - ISO 10646, in little-endian UCS4 form
432+
433+ ISO-10646/UTF-8 - ISO 10646, in UTF-8 form
434+ ISO-10646/UTF8
435+ ISO-IR-193
436+ OSF05010001
437+ UTF-8
438+ UTF8
439+
440+ ISO-10646/UCS2 - ISO 10646, in target-endian UCS2 form
441+ OSF00010100
442+ OSF00010101
443+ OSF00010102
444+ UCS-2
445+ UCS2
446+
447+ UCS-2BE - ISO 10646, in big-endian UCS2 form
448+ UNICODEBIG
449+
450+ UCS-2LE - ISO 10646, in little-endian UCS2 form
451+ UNICODELITTLE
452+
453+ WCHAR_T - EGLIBC's internal form (target-endian,
454+ 32-bit ISO 10646)
455+
456+config EGLIBC_CRYPT
457+ bool "Encryption library"
458+ help
459+ This option group includes the `libcrypt' library which
460+ provides functions for one-way encryption. Supported
461+ encryption algorithms include MD5, SHA-256, SHA-512 and DES.
462+
463+config EGLIBC_CRYPT_UFC
464+ bool "Ultra fast `crypt' implementation"
465+ depends on EGLIBC_CRYPT
466+ help
467+ This option group provides ultra fast DES-based implementation of
468+ the `crypt' function. When this option group is disabled,
469+ (a) the library will not provide the setkey[_r] and encrypt[_r]
470+ functions and (b) the crypt[_r] function will return NULL and set the
471+ errno to ENOSYS if /salt/ passed does not correspond to either MD5,
472+ SHA-256 or SHA-512 algorithm.
473+
474+config EGLIBC_DB_ALIASES
475+ bool "Functions for accessing the mail aliases database"
476+ help
477+ This option group includues functions for looking up mail
478+ aliases in '/etc/aliases' or using nsswitch. It includes the
479+ following functions:
480+
481+ endaliasent
482+ getaliasbyname
483+ getaliasbyname_r
484+ getaliasent
485+ getaliasent_r
486+ setaliasent
487+
488+ When this option group is disabled, the NSS service libraries
489+ also lack support for querying their mail alias tables.
490+
491+config EGLIBC_ENVZ
492+ bool "Functions for handling envz-style environment vectors."
493+ help
494+ This option group contains functions for creating and operating
495+ on envz vectors. An "envz vector" is a vector of strings in a
496+ contiguous block of memory, where each element is a name-value
497+ pair, and elements are separated from their neighbors by null
498+ characters.
499+
500+ This option group includes the following functions:
501+
502+ envz_add envz_merge
503+ envz_entry envz_remove
504+ envz_get envz_strip
505+
506+config EGLIBC_FCVT
507+ bool "Functions for converting floating-point numbers to strings"
508+ help
509+ This option group includes functions for converting
510+ floating-point numbers to strings.
511+
512+ This option group includes the following functions:
513+
514+ ecvt qecvt
515+ ecvt_r qecvt_r
516+ fcvt qfcvt
517+ fcvt_r qfcvt_r
518+ gcvt qgcvt
519+
520+config EGLIBC_FMTMSG
521+ bool "Functions for formatting messages"
522+ help
523+ This option group includes the following functions:
524+
525+ addseverity fmtmsg
526+
527+config EGLIBC_FSTAB
528+ bool "Access functions for 'fstab'"
529+ help
530+ This option group includes functions for reading the mount
531+ point specification table, '/etc/fstab'. These functions are
532+ not included in the POSIX standard, which provides the
533+ 'getmntent' family of functions instead.
534+
535+ This option group includes the following functions:
536+
537+ endfsent getfsspec
538+ getfsent setfsent
539+ getfsfile
540+
541+config EGLIBC_FTRAVERSE
542+ bool "Functions for traversing file hierarchies"
543+ help
544+ This option group includes functions for traversing file
545+ UNIX file hierachies.
546+
547+ This option group includes the following functions:
548+
549+ fts_open ftw
550+ fts_read nftw
551+ fts_children ftw64
552+ fts_set nftw64
553+ fts_close
554+
555+config EGLIBC_GETLOGIN
556+ bool "The getlogin function"
557+ depends on EGLIBC_UTMP
558+ help
559+ This function group includes the 'getlogin' and 'getlogin_r'
560+ functions, which return the user name associated by the login
561+ activity with the current process's controlling terminal.
562+
563+ With this option group disabled, the 'glob' function will not
564+ fall back on 'getlogin' to find the user's login name for tilde
565+ expansion when the 'HOME' environment variable is not set.
566+
567+config EGLIBC_IDN
568+ bool "International domain names support"
569+ help
570+ This option group includes the `libcidn' library which
571+ provides support for international domain names.
572+
573+config EGLIBC_INET
574+ bool "Networking support"
575+ help
576+ This option group includes networking-specific functions and
577+ data. With EGLIBC_INET disabled, the EGLIBC
578+ installation and API changes as follows:
579+
580+ - The following libraries are not installed:
581+
582+ libnsl
583+ libnss_compat
584+ libnss_dns
585+ libnss_hesiod
586+ libnss_nis
587+ libnss_nisplus
588+ libresolv
589+
590+ - The following functions and variables are omitted from libc:
591+
592+ authdes_create hstrerror svc_fdset
593+ authdes_getucred htonl svc_getreq
594+ authdes_pk_create htons svc_getreq_common
595+ authnone_create if_freenameindex svc_getreq_poll
596+ authunix_create if_indextoname svc_getreqset
597+ authunix_create_default if_nameindex svc_max_pollfd
598+ bindresvport if_nametoindex svc_pollfd
599+ callrpc in6addr_any svcraw_create
600+ cbc_crypt in6addr_loopback svc_register
601+ clnt_broadcast inet6_opt_append svc_run
602+ clnt_create inet6_opt_find svc_sendreply
603+ clnt_pcreateerror inet6_opt_finish svctcp_create
604+ clnt_perrno inet6_opt_get_val svcudp_bufcreate
605+ clnt_perror inet6_opt_init svcudp_create
606+ clntraw_create inet6_option_alloc svcudp_enablecache
607+ clnt_spcreateerror inet6_option_append svcunix_create
608+ clnt_sperrno inet6_option_find svcunixfd_create
609+ clnt_sperror inet6_option_init svc_unregister
610+ clnttcp_create inet6_option_next user2netname
611+ clntudp_bufcreate inet6_option_space xdecrypt
612+ clntudp_create inet6_opt_next xdr_accepted_reply
613+ clntunix_create inet6_opt_set_val xdr_array
614+ des_setparity inet6_rth_add xdr_authdes_cred
615+ ecb_crypt inet6_rth_getaddr xdr_authdes_verf
616+ endaliasent inet6_rth_init xdr_authunix_parms
617+ endhostent inet6_rth_reverse xdr_bool
618+ endnetent inet6_rth_segments xdr_bytes
619+ endnetgrent inet6_rth_space xdr_callhdr
620+ endprotoent inet_addr xdr_callmsg
621+ endrpcent inet_aton xdr_char
622+ endservent inet_lnaof xdr_cryptkeyarg
623+ ether_aton inet_makeaddr xdr_cryptkeyarg2
624+ ether_aton_r inet_netof xdr_cryptkeyres
625+ ether_hostton inet_network xdr_des_block
626+ ether_line inet_nsap_addr xdr_double
627+ ether_ntoa inet_nsap_ntoa xdr_enum
628+ ether_ntoa_r inet_ntoa xdr_float
629+ ether_ntohost inet_ntop xdr_free
630+ freeaddrinfo inet_pton xdr_getcredres
631+ freeifaddrs innetgr xdr_hyper
632+ gai_strerror iruserok xdr_int
633+ getaddrinfo iruserok_af xdr_int16_t
634+ getaliasbyname key_decryptsession xdr_int32_t
635+ getaliasbyname_r key_decryptsession_pk xdr_int64_t
636+ getaliasent key_encryptsession xdr_int8_t
637+ getaliasent_r key_encryptsession_pk xdr_keybuf
638+ gethostbyaddr key_gendes xdr_key_netstarg
639+ gethostbyaddr_r key_get_conv xdr_key_netstres
640+ gethostbyname key_secretkey_is_set xdr_keystatus
641+ gethostbyname2 key_setnet xdr_long
642+ gethostbyname2_r key_setsecret xdr_longlong_t
643+ gethostbyname_r netname2host xdrmem_create
644+ gethostent netname2user xdr_netnamestr
645+ gethostent_r ntohl xdr_netobj
646+ getifaddrs ntohs xdr_opaque
647+ getipv4sourcefilter passwd2des xdr_opaque_auth
648+ get_myaddress pmap_getmaps xdr_pmap
649+ getnameinfo pmap_getport xdr_pmaplist
650+ getnetbyaddr pmap_rmtcall xdr_pointer
651+ getnetbyaddr_r pmap_set xdr_quad_t
652+ getnetbyname pmap_unset xdrrec_create
653+ getnetbyname_r rcmd xdrrec_endofrecord
654+ getnetent rcmd_af xdrrec_eof
655+ getnetent_r registerrpc xdrrec_skiprecord
656+ getnetgrent res_init xdr_reference
657+ getnetgrent_r rexec xdr_rejected_reply
658+ getnetname rexec_af xdr_replymsg
659+ getprotobyname rexecoptions xdr_rmtcall_args
660+ getprotobyname_r rpc_createerr xdr_rmtcallres
661+ getprotobynumber rresvport xdr_short
662+ getprotobynumber_r rresvport_af xdr_sizeof
663+ getprotoent rtime xdrstdio_create
664+ getprotoent_r ruserok xdr_string
665+ getpublickey ruserok_af xdr_u_char
666+ getrpcbyname ruserpass xdr_u_hyper
667+ getrpcbyname_r setaliasent xdr_u_int
668+ getrpcbynumber sethostent xdr_uint16_t
669+ getrpcbynumber_r setipv4sourcefilter xdr_uint32_t
670+ getrpcent setnetent xdr_uint64_t
671+ getrpcent_r setnetgrent xdr_uint8_t
672+ getrpcport setprotoent xdr_u_long
673+ getsecretkey setrpcent xdr_u_longlong_t
674+ getservbyname setservent xdr_union
675+ getservbyname_r setsourcefilter xdr_unixcred
676+ getservbyport svcauthdes_stats xdr_u_quad_t
677+ getservbyport_r svcerr_auth xdr_u_short
678+ getservent svcerr_decode xdr_vector
679+ getservent_r svcerr_noproc xdr_void
680+ getsourcefilter svcerr_noprog xdr_wrapstring
681+ h_errlist svcerr_progvers xencrypt
682+ h_errno svcerr_systemerr xprt_register
683+ herror svcerr_weakauth xprt_unregister
684+ h_nerr svc_exit
685+ host2netname svcfd_create
686+
687+ - The rpcgen, nscd, and rpcinfo commands are not installed.
688+
689+ - The 'rpc' file (a text file listing RPC services) is not installed.
690+
691+ Socket-related system calls do not fall in this option group,
692+ because many are also used for other inter-process
693+ communication mechanisms. For example, the 'syslog' routines
694+ use Unix-domain sockets to communicate with the syslog daemon;
695+ syslog is valuable in non-networked contexts.
696+
697+config EGLIBC_INET_ANL
698+ bool "Asynchronous name lookup"
699+ depends on EGLIBC_INET
700+ help
701+ This option group includes the `libanl' library which
702+ provides support for asynchronous name lookup.
703+
704+config EGLIBC_LIBM
705+ bool "libm (math library)"
706+ help
707+ This option group includes the 'libm' library, containing
708+ mathematical functions. If this option group is omitted, then
709+ an EGLIBC installation does not include shared or unshared versions
710+ of the math library.
711+
712+ Note that this does not remove all floating-point related
713+ functionality from EGLIBC; for example, 'printf' and 'scanf'
714+ can still print and read floating-point values with this option
715+ group disabled.
716+
717+ Note that the ISO Standard C++ library 'libstdc++' depends on
718+ EGLIBC's math library 'libm'. If you disable this option
719+ group, you will not be able to build 'libstdc++' against the
720+ resulting EGLIBC installation.
721+
722+config EGLIBC_LOCALES
723+ bool "Locale definitions"
724+ help
725+ This option group includes all locale definitions other than
726+ that for the "C" locale. If this option group is omitted, then
727+ only the "C" locale is supported.
728+
729+
730+config EGLIBC_LOCALE_CODE
731+ bool "Locale functions"
732+ depends on POSIX_C_LANG_WIDE_CHAR
733+ help
734+ This option group includes locale support functions, programs,
735+ and libraries. With EGLIBC_LOCALE_CODE disabled,
736+ EGLIBC supports only the 'C' locale (also known as 'POSIX'),
737+ and ignores the settings of the 'LANG' and 'LC_*' environment
738+ variables.
739+
740+ With EGLIBC_LOCALE_CODE disabled, the following
741+ functions are omitted from libc:
742+
743+ duplocale localeconv nl_langinfo rpmatch strfmon_l
744+ freelocale newlocale nl_langinfo_l strfmon uselocale
745+
746+ Furthermore, only the LC_CTYPE and LC_TIME categories of the
747+ standard "C" locale are available.
748+
749+ The EGLIBC_CATGETS option group depends on this option group.
750+
751+
752+config EGLIBC_MEMUSAGE
753+ bool "Memory profiling library"
754+ help
755+ This option group includes the `libmemusage' library and
756+ the `memusage' and `memusagestat' utilities.
757+ These components provide memory profiling functions.
758+
759+config EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
760+ int "Memory profiling library buffer size"
761+ depends on EGLIBC_MEMUSAGE
762+ default "32768"
763+ help
764+ Libmemusage library buffers the profiling data in memory
765+ before writing it out to disk. By default, the library
766+ allocates 1.5M buffer, which can be substantial for some
767+ systems. EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE option
768+ allows to change the default buffer size. It specifies
769+ the number of entries the buffer should have.
770+ On most architectures one buffer entry amounts to 48 bytes,
771+ so setting this option to the value of 512 will reduce the size of
772+ the memory buffer to 24K.
773+
774+config EGLIBC_NIS
775+ bool "Support for NIS, NIS+, and the special 'compat' services."
776+ depends on EGLIBC_INET && EGLIBC_SUNRPC
777+ help
778+ This option group includes the NIS, NIS+, and 'compat' Name
779+ Service Switch service libraries. When it is disabled, those
780+ services libraries are not installed; you should remove any
781+ references to them from your 'nsswitch.conf' file.
782+
783+ This option group depends on the EGLIBC_INET option
784+ group; you must enable that to enable this option group.
785+
786+config EGLIBC_NSSWITCH
787+ bool "Name service switch (nsswitch) support"
788+ help
789+ This option group includes support for the 'nsswitch' facility.
790+ With this option group enabled, all EGLIBC functions for
791+ accessing various system databases (passwords and groups;
792+ networking; aliases; public keys; and so on) consult the
793+ '/etc/nsswitch.conf' configuration file to decide how to handle
794+ queries.
795+
796+ With this option group disabled, EGLIBC uses a fixed list of
797+ services to satisfy queries on each database, as requested by
798+ configuration files specified when EGLIBC is built. Your
799+ 'option-groups.config' file must set the following two
800+ variables:
801+
802+config EGLIBC_NSSWITCH_FIXED_CONFIG
803+ string "Nsswitch fixed config filename"
804+ depends on !EGLIBC_NSSWITCH
805+ default ""
806+ help
807+ Set this to the name of a file whose contents observe the
808+ same syntax as an ordinary '/etc/nsswitch.conf' file. The
809+ EGLIBC build process parses this file just as EGLIBC would
810+ at run time if EGLIBC_NSSWITCH were enabled, and
811+ produces a C library that uses the nsswitch service
812+ libraries to search for database entries as this file
813+ specifies, instead of consulting '/etc/nsswitch.conf' at run
814+ time.
815+
816+ This should be an absolute filename. The EGLIBC build
817+ process may use it from several different working
818+ directories. It may include references to Makefile
819+ variables like 'common-objpfx' (the top of the build tree,
820+ with a trailing slash), or '..' (the top of the source tree,
821+ with a trailing slash).
822+
823+ The EGLIBC source tree includes a sample configuration file
824+ named 'nss/fixed-nsswitch.conf'; for simple configurations,
825+ you will probably want to delete references to databases not
826+ needed on your system.
827+
828+config EGLIBC_NSSWITCH_FIXED_FUNCTIONS
829+ string "Nsswitch fixed functions filename"
830+ depends on !EGLIBC_NSSWITCH
831+ default ""
832+ help
833+ The EGLIBC build process uses this file to decide which
834+ functions to make available from which service libraries.
835+ The file 'nss/fixed-nsswitch.functions' serves as a sample
836+ configuration file for this setting, and explains its syntax
837+ and meaning in more detail.
838+
839+ This should be an absolute file name. The EGLIBC build
840+ process may use it from several different working
841+ directories. It may include references to Makefile
842+ variables like 'common-objpfx' (the top of the build tree,
843+ with a trailing slash), or '..' (the top of the source tree,
844+ with a trailing slash).
845+
846+ Be sure to mention each function in each service you wish to
847+ use. If you do not mention a service's function here, the
848+ EGLIBC database access functions will not find it, even if
849+ it is listed in the EGLIBC_NSSWITCH_FIXED_CONFIG
850+ file.
851+
852+ In this arrangement, EGLIBC will not use the 'dlopen' and
853+ 'dlsym' functions to find database access functions. Instead,
854+ libc hard-codes references to the service libraries' database
855+ access functions. You must explicitly link your program
856+ against the name service libraries (those whose names start
857+ with 'libnss_', in the sysroot's '/lib' directory) whose
858+ functions you intend to use. This arrangement helps
859+ system-wide static analysis tools decide which functions a
860+ system actually uses.
861+
862+ Note that some nsswitch service libraries require other option
863+ groups to be enabled; for example, the EGLIBC_INET
864+ option group must be enabled to use the 'libnss_dns.so.2'
865+ service library, which uses the Domain Name System network
866+ protocol to answer queries.
867+
868+config EGLIBC_RCMD
869+ bool "Support for 'rcmd' and related library functions"
870+ depends on EGLIBC_INET
871+ help
872+ This option group includes functions for running commands on
873+ remote machines via the 'rsh' protocol, and doing authentication
874+ related to those functions. This also includes functions that
875+ use the 'rexec' protocol.
876+
877+ This option group includes the following functions:
878+
879+ rcmd ruserok
880+ rcmd_af ruserok_af
881+ rexec iruserok
882+ rexec_af iruserok_af
883+ rresvport ruserpass
884+ rresvport_af
885+
886+config EGLIBC_RTLD_DEBUG
887+ bool "Runtime linker debug print outs"
888+ help
889+ This option group enables debug output of the runtime linker
890+ which is activated via LD_DEBUG and LD_TRACE_PRELINKING
891+ environment variables. Disabling this option group yields
892+ a smaller runtime linker binary.
893+ BEWARE: Disabling this option group is likely to break
894+ the `ldd' utility which may also be used by the prelinker.
895+ In particular, the `--unused' ldd option will not work correctly.
896+
897+config EGLIBC_SPAWN
898+ bool "Support for POSIX posix_spawn functions"
899+ help
900+ This option group includes the POSIX functions for executing
901+ programs in child processes without using 'fork' or 'vfork'.
902+
903+ This option group includes the following functions:
904+
905+ posix_spawn
906+ posix_spawnattr_destroy
907+ posix_spawnattr_getflags
908+ posix_spawnattr_getpgroup
909+ posix_spawnattr_getschedparam
910+ posix_spawnattr_getschedpolicy
911+ posix_spawnattr_getsigdefault
912+ posix_spawnattr_getsigmask
913+ posix_spawnattr_init
914+ posix_spawnattr_setflags
915+ posix_spawnattr_setpgroup
916+ posix_spawnattr_setschedparam
917+ posix_spawnattr_setschedpolicy
918+ posix_spawnattr_setsigdefault
919+ posix_spawnattr_setsigmask
920+ posix_spawn_file_actions_addclose
921+ posix_spawn_file_actions_adddup2
922+ posix_spawn_file_actions_addopen
923+ posix_spawn_file_actions_destroy
924+ posix_spawn_file_actions_init
925+ posix_spawnp
926+
927+ This option group also provides the ability for the iconv,
928+ localedef, and locale programs to operate transparently on
929+ compressed charset definitions. When this option group is
930+ disabled, those programs will only operate on uncompressed
931+ charmap files.
932+
933+config EGLIBC_STREAMS
934+ bool "Support for accessing STREAMS."
935+ help
936+ This option group includes functions for reading and writing
937+ messages to and from STREAMS. The STREAMS interface provides a
938+ uniform mechanism for implementing networking services and other
939+ character-based I/O. (STREAMS are not to be confused with
940+ <stdio.h> FILE objects, also called 'streams'.)
941+
942+ This option group includes the following functions:
943+
944+ getmsg putpmsg
945+ getpmsg fattach
946+ isastream fdetach
947+ putmsg
948+
949+config EGLIBC_SUNRPC
950+ bool "Support for the Sun 'RPC' protocol."
951+ depends on EGLIBC_INET
952+ help
953+ This option group includes support for the Sun RPC protocols,
954+ including the 'rpcgen' and 'rpcinfo' programs.
955+
956+config EGLIBC_UTMP
957+ bool "Older access functions for 'utmp' login records"
958+ help
959+ This option group includes the older 'utent' family of
960+ functions for accessing user login records in the 'utmp' file.
961+ POSIX omits these functions in favor of the 'utxent' family,
962+ and they are obsolete on systems other than Linux.
963+
964+ This option group includes the following functions:
965+
966+ endutent
967+ getutent
968+ getutent_r
969+ getutid
970+ getutid_r
971+ getutline
972+ getutline_r
973+ logwtmp
974+ pututline
975+ setutent
976+ updwtmp
977+ utmpname
978+
979+ This option group includes the following libraries:
980+
981+ libutil.so (and libutil.a)
982+
983+config EGLIBC_UTMPX
984+ bool "POSIX access functions for 'utmp' login records"
985+ depends on EGLIBC_UTMP
986+ help
987+ This option group includes the POSIX functions for reading and
988+ writing user login records in the 'utmp' file (usually
989+ '/var/run/utmp'). The POSIX functions operate on 'struct
990+ utmpx' structures, as opposed to the family of older 'utent'
991+ functions, which operate on 'struct utmp' structures.
992+
993+ This option group includes the following functions:
994+
995+ endutxent
996+ getutmp
997+ getutmpx
998+ getutxent
999+ getutxid
1000+ getutxline
1001+ pututxline
1002+ setutxent
1003+ updwtmpx
1004+ utmpxname
1005+
1006+config EGLIBC_WORDEXP
1007+ bool "Shell-style word expansion"
1008+ help
1009+ This option group includes the 'wordexp' function for
1010+ performing word expansion in the manner of the shell, and the
1011+ accompanying 'wordfree' function.
1012+
1013+config POSIX_C_LANG_WIDE_CHAR
1014+ bool "ISO C library wide character functions, excluding I/O"
1015+ help
1016+ This option group includes the functions defined by the ISO C
1017+ standard for working with wide and multibyte characters in
1018+ memory. Functions for reading and writing wide and multibyte
1019+ characters from and to files call in the
1020+ POSIX_WIDE_CHAR_DEVICE_IO option group.
1021+
1022+ This option group includes the following functions:
1023+
1024+ btowc mbsinit wcscspn wcstoll
1025+ iswalnum mbsrtowcs wcsftime wcstombs
1026+ iswalpha mbstowcs wcslen wcstoul
1027+ iswblank mbtowc wcsncat wcstoull
1028+ iswcntrl swprintf wcsncmp wcstoumax
1029+ iswctype swscanf wcsncpy wcsxfrm
1030+ iswdigit towctrans wcspbrk wctob
1031+ iswgraph towlower wcsrchr wctomb
1032+ iswlower towupper wcsrtombs wctrans
1033+ iswprint vswprintf wcsspn wctype
1034+ iswpunct vswscanf wcsstr wmemchr
1035+ iswspace wcrtomb wcstod wmemcmp
1036+ iswupper wcscat wcstof wmemcpy
1037+ iswxdigit wcschr wcstoimax wmemmove
1038+ mblen wcscmp wcstok wmemset
1039+ mbrlen wcscoll wcstol
1040+ mbrtowc wcscpy wcstold
1041+
1042+config POSIX_REGEXP
1043+ bool "Regular expressions"
1044+ help
1045+ This option group includes the POSIX regular expression
1046+ functions, and the associated non-POSIX extensions and
1047+ compatibility functions.
1048+
1049+ With POSIX_REGEXP disabled, the following functions are
1050+ omitted from libc:
1051+
1052+ re_comp re_max_failures regcomp
1053+ re_compile_fastmap re_search regerror
1054+ re_compile_pattern re_search_2 regexec
1055+ re_exec re_set_registers regfree
1056+ re_match re_set_syntax rpmatch
1057+ re_match_2 re_syntax_options
1058+
1059+ Furthermore, the compatibility regexp interface defined in the
1060+ <regexp.h> header file, 'compile', 'step', and 'advance', is
1061+ omitted.
1062+
1063+config POSIX_REGEXP_GLIBC
1064+ bool "Regular expressions from GLIBC"
1065+ depends on POSIX_REGEXP
1066+ help
1067+ This option group specifies which regular expression
1068+ library to use. The choice is between regex
1069+ implementation from GLIBC and regex implementation from
1070+ libiberty. The GLIBC variant is fully POSIX conformant and
1071+ optimized for speed; regex from libiberty is more than twice
1072+ as small while still is enough for most practical purposes.
1073+
1074+config POSIX_WIDE_CHAR_DEVICE_IO
1075+ bool "Input and output functions for wide characters"
1076+ depends on POSIX_C_LANG_WIDE_CHAR
1077+ help
1078+ This option group includes functions for reading and writing
1079+ wide characters to and from <stdio.h> streams.
1080+
1081+ This option group includes the following functions:
1082+
1083+ fgetwc fwprintf putwchar vwscanf
1084+ fgetws fwscanf ungetwc wprintf
1085+ fputwc getwc vfwprintf wscanf
1086+ fputws getwchar vfwscanf
1087+ fwide putwc vwprintf
1088+
1089+ This option group further includes the following unlocked
1090+ variants of the above functions:
1091+
1092+ fgetwc_unlocked getwc_unlocked
1093+ fgetws_unlocked getwchar_unlocked
1094+ fputwc_unlocked putwc_unlocked
1095+ fputws_unlocked putwchar_unlocked
1096+
1097+ Note that the GNU standard C++ library, 'libstdc++.so', uses
1098+ some of these functions; you will not be able to link or run
1099+ C++ programs if you disable this option group.
1100+
1101+ This option group also affects the behavior of the following
1102+ functions:
1103+
1104+ fdopen
1105+ fopen
1106+ fopen64
1107+ freopen
1108+ freopen64
1109+
1110+ These functions all take an OPENTYPE parameter which may
1111+ contain a string of the form ",ccs=CHARSET", indicating that
1112+ the underlying file uses the character set named CHARSET.
1113+ This produces a wide-oriented stream, which is only useful
1114+ when the functions included in this option group are present.
1115+ If the user attempts to open a file specifying a character set
1116+ in the OPENTYPE parameter, and EGLIBC was built with this
1117+ option group disabled, the function returns NULL, and sets
1118+ errno to EINVAL.
1119+
1120+
1121+# This helps Emacs users browse this file using the page motion commands
1122+# and commands like 'pages-directory'.
1123+# Local Variables:
1124+# page-delimiter: "^config\\s-"
1125+# End:
1126diff --git a/option-groups.defaults b/option-groups.defaults
1127new file mode 100644
1128index 0000000..8141201
1129--- /dev/null
1130+++ b/option-groups.defaults
1131@@ -0,0 +1,47 @@
1132+# This file sets default values for all option group variables
1133+# mentioned in option-groups.def; see that file for a description of
1134+# each option group.
1135+#
1136+# Subdirectory makefiles include this file before including the user's
1137+# settings from option-groups.config at the top of the build tree;
1138+# that file need only refer to those options whose default settings
1139+# are to be changed.
1140+#
1141+# By default, all option groups are enabled.
1142+OPTION_EGLIBC_ADVANCED_INET6 = y
1143+OPTION_EGLIBC_BACKTRACE = y
1144+OPTION_EGLIBC_BIG_MACROS = y
1145+OPTION_EGLIBC_BSD = y
1146+OPTION_EGLIBC_CXX_TESTS = y
1147+OPTION_EGLIBC_CATGETS = y
1148+OPTION_EGLIBC_CHARSETS = y
1149+OPTION_EGLIBC_CRYPT = y
1150+OPTION_EGLIBC_CRYPT_UFC = y
1151+OPTION_EGLIBC_DB_ALIASES = y
1152+OPTION_EGLIBC_ENVZ = y
1153+OPTION_EGLIBC_FCVT = y
1154+OPTION_EGLIBC_FMTMSG = y
1155+OPTION_EGLIBC_FSTAB = y
1156+OPTION_EGLIBC_FTRAVERSE = y
1157+OPTION_EGLIBC_GETLOGIN = y
1158+OPTION_EGLIBC_IDN = y
1159+OPTION_EGLIBC_INET = y
1160+OPTION_EGLIBC_INET_ANL = y
1161+OPTION_EGLIBC_LIBM = y
1162+OPTION_EGLIBC_LOCALES = y
1163+OPTION_EGLIBC_LOCALE_CODE = y
1164+OPTION_EGLIBC_MEMUSAGE = y
1165+OPTION_EGLIBC_NIS = y
1166+OPTION_EGLIBC_NSSWITCH = y
1167+OPTION_EGLIBC_RCMD = y
1168+OPTION_EGLIBC_RTLD_DEBUG = y
1169+OPTION_EGLIBC_SPAWN = y
1170+OPTION_EGLIBC_STREAMS = y
1171+OPTION_EGLIBC_SUNRPC = y
1172+OPTION_EGLIBC_UTMP = y
1173+OPTION_EGLIBC_UTMPX = y
1174+OPTION_EGLIBC_WORDEXP = y
1175+OPTION_POSIX_C_LANG_WIDE_CHAR = y
1176+OPTION_POSIX_REGEXP = y
1177+OPTION_POSIX_REGEXP_GLIBC = y
1178+OPTION_POSIX_WIDE_CHAR_DEVICE_IO = y
1179diff --git a/option-groups.mak b/option-groups.mak
1180new file mode 100644
1181index 0000000..f83e0c1
1182--- /dev/null
1183+++ b/option-groups.mak
1184@@ -0,0 +1,41 @@
1185+# Setup file for subdirectory Makefiles that define EGLIBC option groups.
1186+
1187+# EGLIBC shouldn't need to override this. However, the
1188+# cross-build-friendly localedef includes this makefile to get option
1189+# group variable definitions; it uses a single build tree for all the
1190+# multilibs, and needs to be able to specify a different option group
1191+# configuration file for each multilib.
1192+option_group_config_file ?= $(objdir)/option-groups.config
1193+
1194+# Read the default settings for all options.
1195+# We're included before ../Rules, so we can't assume $(..) is set.
1196+include $(firstword $(..) ../)option-groups.defaults
1197+
1198+# Read the developer's option group selections, overriding the
1199+# defaults from option-groups.defaults.
1200+-include $(option_group_config_file)
1201+
1202+# $(call option-disabled, VAR) is 'y' if VAR is not 'y', or 'n' otherwise.
1203+# VAR should be a variable name, not a variable reference; this is
1204+# less general, but more terse for the intended use.
1205+# You can use it to add a file to a list if an option group is
1206+# disabled, like this:
1207+# routines-$(call option-disabled, OPTION_POSIX_C_LANG_WIDE_CHAR) += ...
1208+define option-disabled
1209+$(firstword $(subst y,n,$(filter y,$($(strip $(1))))) y)
1210+endef
1211+
1212+# Establish 'routines-y', etc. as simply-expanded variables.
1213+aux-y :=
1214+extra-libs-others-y :=
1215+extra-libs-y :=
1216+extra-objs-y :=
1217+install-bin-y :=
1218+install-others-y :=
1219+install-sbin-y :=
1220+others-y :=
1221+others-pie-y :=
1222+routines-y :=
1223+test-srcs-y :=
1224+tests-y :=
1225+xtests-y :=
1226diff --git a/options-config/Makefile b/options-config/Makefile
1227new file mode 100644
1228index 0000000..db00708
1229--- /dev/null
1230+++ b/options-config/Makefile
1231@@ -0,0 +1,55 @@
1232+# ===========================================================================
1233+# EGLIBC option-groups configuration targets
1234+# These targets are included from top-level makefile
1235+
1236+ifneq ($(kconfig_tools),)
1237+ifneq (no,$(PERL))
1238+
1239+ocdir := options-config
1240+
1241+OconfigDefaults := option-groups.defaults
1242+OconfigDefaults_tmp := $(common-objpfx).tmp.defconfig
1243+OconfigDef := option-groups.def
1244+Oconfig := $(common-objpfx)option-groups.config
1245+Oconfig_tmp := $(common-objpfx).tmp.config
1246+
1247+conf := $(kconfig_tools)/conf
1248+mconf := $(kconfig_tools)/mconf
1249+
1250+preproc := $(PERL) $(ocdir)/config-preproc.pl
1251+postproc := $(PERL) $(ocdir)/config-postproc.pl
1252+
1253+PHONY += defconfig config menuconfig
1254+
1255+defconfig: $(conf) $(OconfigDefaults) $(OconfigDef)
1256+ rm -f $(OconfigDefaults_tmp)
1257+ rm -f $(Oconfig_tmp)
1258+ $(preproc) $(OconfigDefaults) > $(OconfigDefaults_tmp)
1259+ KCONFIG_CONFIG=$(Oconfig_tmp) $< --defconfig=$(OconfigDefaults_tmp) \
1260+ $(OconfigDef)
1261+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
1262+ rm $(Oconfig_tmp)
1263+ rm $(OconfigDefaults_tmp)
1264+
1265+config: $(conf) $(OconfigDefaults) $(OconfigDef)
1266+ rm -f $(Oconfig_tmp)
1267+ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp)
1268+ KCONFIG_CONFIG=$(Oconfig_tmp) $< --oldaskconfig $(OconfigDef)
1269+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
1270+ rm $(Oconfig_tmp)
1271+
1272+menuconfig: $(mconf) $(OconfigDefaults) $(OconfigDef)
1273+ rm -f $(Oconfig_tmp)
1274+ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp)
1275+ KCONFIG_CONFIG=$(Oconfig_tmp) $< $(OconfigDef)
1276+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
1277+ rm $(Oconfig_tmp)
1278+
1279+# Help text used by make help
1280+help:
1281+ @echo ' defconfig - New config with default from default config'
1282+ @echo ' config - Update current config utilising a line-oriented program'
1283+ @echo ' menuconfig - Update current config utilising a menu based program'
1284+
1285+endif
1286+endif
1287diff --git a/options-config/config-postproc.pl b/options-config/config-postproc.pl
1288new file mode 100644
1289index 0000000..4dd1c63
1290--- /dev/null
1291+++ b/options-config/config-postproc.pl
1292@@ -0,0 +1,58 @@
1293+#!/usr/bin/perl
1294+
1295+$usage = "usage: $0 <default config file> <config file>\n";
1296+
1297+die "$usage" unless @ARGV;
1298+$defaults = shift @ARGV;
1299+die "$usage" unless @ARGV;
1300+die "Could not open $ARGV[0]" unless -T $ARGV[0];
1301+
1302+sub yank {
1303+ @option = grep(!($_ =~ /$_[0]\s*=/), @option);
1304+}
1305+
1306+open(DEFAULTS, $defaults) || die "Could not open $defaults\n";
1307+
1308+# get the full list of available options using the default config file
1309+$i = 0;
1310+while (<DEFAULTS>) {
1311+ if (/^\s*OPTION_(\w+\s*=.*$)/) {
1312+ $option[$i++] = $1;
1313+ }
1314+}
1315+
1316+# now go through the config file, making the necessary changes
1317+while (<>) {
1318+ if (/Linux Kernel Configuration/) {
1319+ # change title
1320+ s/Linux Kernel/Option Groups/;
1321+ print;
1322+ } elsif (/^\s*CONFIG_(\w+)\s*=/) {
1323+ # this is an explicit option set line, change CONFIG_ to OPTION_
1324+ # before printing and remove this option from option list
1325+ $opt = $1;
1326+ yank($opt);
1327+ s/CONFIG_/OPTION_/g;
1328+ print;
1329+ } elsif (/^\s*#\s+CONFIG_(\w+) is not set/) {
1330+ # this is a comment line for an unset boolean option, change CONFIG_
1331+ # to OPTION_, remove this option from option list, and convert to
1332+ # explicit OPTION_FOO=n
1333+ $opt = $1;
1334+ yank($opt);
1335+ s/CONFIG_/OPTION_/g;
1336+ print "OPTION_$opt=n\n";
1337+ } else {
1338+ print;
1339+ }
1340+}
1341+
1342+# any boolean options left in @options, are options that were not mentioned in
1343+# the config file, and implicitly that means the option must be set =n,
1344+# so do that here.
1345+foreach $opt (@option) {
1346+ if ($opt =~ /=\s*[yn]/) {
1347+ $opt =~ s/=\s*[yn]/=n/;
1348+ print "OPTION_$opt\n";
1349+ }
1350+}
1351diff --git a/options-config/config-preproc.pl b/options-config/config-preproc.pl
1352new file mode 100644
1353index 0000000..b83bb85
1354--- /dev/null
1355+++ b/options-config/config-preproc.pl
1356@@ -0,0 +1,8 @@
1357+#!/usr/bin/perl
1358+
1359+if (@ARGV) {
1360+ while (<>) {
1361+ s/OPTION_/CONFIG_/g;
1362+ print;
1363+ }
1364+}
1365diff --git a/scripts/option-groups.awk b/scripts/option-groups.awk
1366new file mode 100644
1367index 0000000..533af0c
1368--- /dev/null
1369+++ b/scripts/option-groups.awk
1370@@ -0,0 +1,63 @@
1371+# option-groups.awk --- generate option group header file
1372+# Given input files containing makefile-style assignments to variables,
1373+# print out a header file that #defines an appropriate preprocessor
1374+# symbol for each variable left set to 'y'.
1375+
1376+BEGIN { FS="=" }
1377+
1378+# Trim spaces.
1379+{ gsub (/[[:blank:]]/, "") }
1380+
1381+# Skip comments.
1382+/^#/ { next }
1383+
1384+# Process assignments.
1385+NF == 2 {
1386+ vars[$1] = $2
1387+}
1388+
1389+# Print final values.
1390+END {
1391+ print "/* This file is automatically generated by scripts/option-groups.awk"
1392+ print " in the EGLIBC source tree."
1393+ print ""
1394+ print " It defines macros that indicate which EGLIBC option groups were"
1395+ print " configured in 'option-groups.config' when this C library was"
1396+ print " built. For each option group named OPTION_foo, it #defines"
1397+ print " __OPTION_foo to be 1 if the group is enabled, or #defines that"
1398+ print " symbol to be 0 if the group is disabled. */"
1399+ print ""
1400+ print "#ifndef __GNU_OPTION_GROUPS_H"
1401+ print "#define __GNU_OPTION_GROUPS_H"
1402+ print ""
1403+
1404+ # Produce a sorted list of variable names.
1405+ i=0
1406+ for (var in vars)
1407+ names[i++] = var
1408+ n = asort (names)
1409+
1410+ for (i = 1; i <= n; i++)
1411+ {
1412+ var = names[i]
1413+ if (var ~ /^OPTION_/)
1414+ {
1415+ if (vars[var] == "y")
1416+ print "#define __" var " 1"
1417+ else if (vars[var] == "n")
1418+ print "#define __" var " 0"
1419+ else if (vars[var] ~ /^[0-9]+/ ||
1420+ vars[var] ~ /^0x[0-9aAbBcCdDeEfF]+/ ||
1421+ vars[var] ~ /^\"/)
1422+ print "#define __" var " " vars[var]
1423+ else
1424+ print "/* #undef __" var " */"
1425+ # Ignore variables that don't have boolean, int, hex, or
1426+ # string values. Ideally, this would be driven by the types
1427+ # given in option-groups.def.
1428+ }
1429+ }
1430+
1431+ print ""
1432+ print "#endif /* __GNU_OPTION_GROUPS_H */"
1433+}
1434--
14352.1.4
1436