[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r4026 - in /trunk/libc: ./ argp/ debug/ iconv/ intl/ libidn/ locale/ locale/programs/ misc/ nptl/ nss/ posix/ scripts/ stdio...



Author: jimb
Date: Tue Oct 30 03:27:35 2007
New Revision: 4026

Log:
* Makeconfig ($(common-objpfx)gnu/option-groups.h): New generated
header.
* scripts/option-groups.awk: New script, to generate it.
* debug/Makefile (CFLAGS-segfault.c): Don't define option group
symbols here.
* wcsmbs/Makefile (CFLAGS-wcsmbsload.c): Same.
* time/Makefile (CFLAGS-strftime_l.c, CFLAGS-strptime_l.c): Same.
* intl/Makefile (CFLAGS-dcigettext.c): Same.
* sysdeps/unix/sysv/linux/Makefile (CFLAGS-gethostid.c)
(CFLAGS-libc_fatal.c): Same.
* misc/Makefile (CFLAGS-error.c, CFLAGS-err.c): Same.
* nss/Makefile (CFLAGS-nsswitch.c, CFLAGS-getnssent_r.c)
(CFLAGS-getent.c): Same.
* string/Makefile (CFLAGS-strerror_l.c): Same.
* iconv/Makefile (CFLAGS-gconv_db.c, CFLAGS-gconv_trans.c)
(CFLAGS-iconv_prog.c): Same.
* locale/Makefile (CFLAGS-C-ctype.c, CFLAGS-xlocale.c)
(CFLAGS-ld-messages.c): Same.
* argp/Makefile (CFLAGS-argp-help.c, CFLAGS-argp-fmtstream.c): Same.
* nptl/Makefile (CFLAGS-pthread_create.c): Same.
* posix/Makefile (CFLAGS-glob.c, CFLAGS-bug-regex1.c): Same.
* stdio-common/Makefile (CFLAGS-printf_fp.c)
(CFLAGS-printf_fphex.c, CFLAGS-fxprintf.c, CFLAGS-tst-popen.c): Same.
* libidn/Makefile (CFLAGS-toutf8.c): Same.
* debug/segfault.c, wcsmbs/wcsmbsload.c, time/strftime_l.c: 
* time/strptime_l.c, intl/dcigettext.c:
* sysdeps/unix/sysv/linux/libc_fatal.c:
* sysdeps/unix/sysv/linux/gethostid.c, misc/err.c, misc/error.c:
* nss/getnssent_r.c, nss/nsswitch.c, nss/getent.c:
* string/strerror_l.c, iconv/gconv_db.c, iconv/iconv_prog.c:
* iconv/gconv_trans.c, locale/xlocale.c, locale/C-ctype.c:
* locale/programs/ld-messages.c, argp/argp-help.c:
* argp/argp-fmtstream.c, nptl/pthread_create.c, posix/glob.c:
* posix/bug-regex1.c, stdio-common/printf_fp.c:
* stdio-common/printf_fphex.c, stdio-common/tst-popen.c:
* stdio-common/fxprintf.c, libidn/toutf8.c: #include
<gnu/option-groups.h>, and test for the symbols that #defines,
instead.

Added:
    trunk/libc/scripts/option-groups.awk
Modified:
    trunk/libc/ChangeLog.eglibc
    trunk/libc/Makeconfig
    trunk/libc/argp/Makefile
    trunk/libc/argp/argp-fmtstream.c
    trunk/libc/argp/argp-help.c
    trunk/libc/debug/Makefile
    trunk/libc/debug/segfault.c
    trunk/libc/iconv/Makefile
    trunk/libc/iconv/gconv_db.c
    trunk/libc/iconv/gconv_trans.c
    trunk/libc/iconv/iconv_prog.c
    trunk/libc/intl/Makefile
    trunk/libc/intl/dcigettext.c
    trunk/libc/libidn/Makefile
    trunk/libc/libidn/toutf8.c
    trunk/libc/locale/C-ctype.c
    trunk/libc/locale/Makefile
    trunk/libc/locale/programs/ld-messages.c
    trunk/libc/locale/xlocale.c
    trunk/libc/misc/Makefile
    trunk/libc/misc/err.c
    trunk/libc/misc/error.c
    trunk/libc/nptl/Makefile
    trunk/libc/nptl/pthread_create.c
    trunk/libc/nss/Makefile
    trunk/libc/nss/getent.c
    trunk/libc/nss/getnssent_r.c
    trunk/libc/nss/nsswitch.c
    trunk/libc/posix/Makefile
    trunk/libc/posix/bug-regex1.c
    trunk/libc/posix/glob.c
    trunk/libc/stdio-common/Makefile
    trunk/libc/stdio-common/fxprintf.c
    trunk/libc/stdio-common/printf_fp.c
    trunk/libc/stdio-common/printf_fphex.c
    trunk/libc/stdio-common/tst-popen.c
    trunk/libc/string/Makefile
    trunk/libc/string/strerror_l.c
    trunk/libc/sysdeps/unix/sysv/linux/Makefile
    trunk/libc/sysdeps/unix/sysv/linux/gethostid.c
    trunk/libc/sysdeps/unix/sysv/linux/libc_fatal.c
    trunk/libc/time/Makefile
    trunk/libc/time/strftime_l.c
    trunk/libc/time/strptime_l.c
    trunk/libc/wcsmbs/Makefile
    trunk/libc/wcsmbs/wcsmbsload.c

Modified: trunk/libc/ChangeLog.eglibc
==============================================================================
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Tue Oct 30 03:27:35 2007
@@ -1,4 +1,43 @@
 2007-10-29  Jim Blandy  <jimb@xxxxxxxxxxxxxxxx>
+
+	* Makeconfig ($(common-objpfx)gnu/option-groups.h): New generated
+	header.
+	* scripts/option-groups.awk: New script, to generate it.
+	* debug/Makefile (CFLAGS-segfault.c): Don't define option group
+	symbols here.
+	* wcsmbs/Makefile (CFLAGS-wcsmbsload.c): Same.
+	* time/Makefile (CFLAGS-strftime_l.c, CFLAGS-strptime_l.c): Same.
+	* intl/Makefile (CFLAGS-dcigettext.c): Same.
+	* sysdeps/unix/sysv/linux/Makefile (CFLAGS-gethostid.c)
+	(CFLAGS-libc_fatal.c): Same.
+	* misc/Makefile (CFLAGS-error.c, CFLAGS-err.c): Same.
+	* nss/Makefile (CFLAGS-nsswitch.c, CFLAGS-getnssent_r.c)
+	(CFLAGS-getent.c): Same.
+	* string/Makefile (CFLAGS-strerror_l.c): Same.
+	* iconv/Makefile (CFLAGS-gconv_db.c, CFLAGS-gconv_trans.c)
+	(CFLAGS-iconv_prog.c): Same.
+	* locale/Makefile (CFLAGS-C-ctype.c, CFLAGS-xlocale.c)
+	(CFLAGS-ld-messages.c): Same.
+	* argp/Makefile (CFLAGS-argp-help.c, CFLAGS-argp-fmtstream.c): Same.
+	* nptl/Makefile (CFLAGS-pthread_create.c): Same.
+	* posix/Makefile (CFLAGS-glob.c, CFLAGS-bug-regex1.c): Same.
+	* stdio-common/Makefile (CFLAGS-printf_fp.c)
+	(CFLAGS-printf_fphex.c, CFLAGS-fxprintf.c, CFLAGS-tst-popen.c): Same.
+	* libidn/Makefile (CFLAGS-toutf8.c): Same.
+	* debug/segfault.c, wcsmbs/wcsmbsload.c, time/strftime_l.c: 
+	* time/strptime_l.c, intl/dcigettext.c:
+	* sysdeps/unix/sysv/linux/libc_fatal.c:
+	* sysdeps/unix/sysv/linux/gethostid.c, misc/err.c, misc/error.c:
+	* nss/getnssent_r.c, nss/nsswitch.c, nss/getent.c:
+	* string/strerror_l.c, iconv/gconv_db.c, iconv/iconv_prog.c:
+	* iconv/gconv_trans.c, locale/xlocale.c, locale/C-ctype.c:
+	* locale/programs/ld-messages.c, argp/argp-help.c:
+	* argp/argp-fmtstream.c, nptl/pthread_create.c, posix/glob.c:
+	* posix/bug-regex1.c, stdio-common/printf_fp.c:
+	* stdio-common/printf_fphex.c, stdio-common/tst-popen.c:
+	* stdio-common/fxprintf.c, libidn/toutf8.c: #include
+	<gnu/option-groups.h>, and test for the symbols that #defines,
+	instead.
 
 	* nss/gen-fixed-nsswitch.c: Don't #include "nsswitch.h".  Instead,
 	make our own copies of the datatype and enum definitions.  Do

Modified: trunk/libc/Makeconfig
==============================================================================
--- trunk/libc/Makeconfig (original)
+++ trunk/libc/Makeconfig Tue Oct 30 03:27:35 2007
@@ -913,6 +913,24 @@
 endif
 endif
 
+# Generate a header file that #defines preprocessor symbols indicating
+# which option groups are enabled.  Note that the option-groups.config file
+# may not exist at all.
+before-compile += $(common-objpfx)gnu/option-groups.h
+common-generated += gnu/option-groups.h gnu/option-groups.stmp
+headers += gnu/option-groups.h
+$(common-objpfx)gnu/option-groups.h: $(common-objpfx)gnu/option-groups.stmp; @:
+$(common-objpfx)gnu/option-groups.stmp:					\
+		$(..)scripts/option-groups.awk				\
+		$(..)option-groups.defaults				\
+		$(wildcard $(common-objpfx)option-groups.config)
+	$(make-target-directory)
+	@rm -f ${@:stmp=T} $@
+	LC_ALL=C $(AWK) -f $^ > ${@:stmp=T}
+	$(move-if-change) ${@:stmp=T} ${@:stmp=h}
+	touch $@
+
+
 # These are the subdirectories containing the library source.  The order
 # is more or less arbitrary.  The sorting step will take care of the
 # dependencies.

Modified: trunk/libc/argp/Makefile
==============================================================================
--- trunk/libc/argp/Makefile (original)
+++ trunk/libc/argp/Makefile Tue Oct 30 03:27:35 2007
@@ -30,13 +30,9 @@
 
 tests		= argp-test tst-argp1 bug-argp1 tst-argp2
 
-OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
-	= -DOPTION_POSIX_WIDE_CHAR_DEVICE_IO
-
-CFLAGS-argp-help.c = $(uses-callbacks) -fexceptions \
-	             $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
+CFLAGS-argp-help.c = $(uses-callbacks) -fexceptions
 CFLAGS-argp-parse.c = $(uses-callbacks)
-CFLAGS-argp-fmtstream.c = -fexceptions $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
+CFLAGS-argp-fmtstream.c = -fexceptions
 
 bug-argp1-ARGS = -- --help
 

Modified: trunk/libc/argp/argp-fmtstream.c
==============================================================================
--- trunk/libc/argp/argp-fmtstream.c (original)
+++ trunk/libc/argp/argp-fmtstream.c Tue Oct 30 03:27:35 2007
@@ -43,6 +43,7 @@
 #if defined _LIBC && defined USE_IN_LIBIO
 # include <wchar.h>
 # include <libio/libioP.h>
+# include <gnu/option-groups.h>
 # define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
 #endif
 
@@ -153,7 +154,7 @@
 #ifdef USE_IN_LIBIO
 		  if (_IO_fwide (fs->stream, 0) > 0)
                     {
-#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+#if ! _LIBC || __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
                       putwc_unlocked (L' ', fs->stream);
 #else
                       abort ();

Modified: trunk/libc/argp/argp-help.c
==============================================================================
--- trunk/libc/argp/argp-help.c (original)
+++ trunk/libc/argp/argp-help.c Tue Oct 30 03:27:35 2007
@@ -52,6 +52,7 @@
 #ifdef _LIBC
 # include <../libio/libioP.h>
 # include <wchar.h>
+# include <gnu/option-groups.h>
 #endif
 
 #ifndef _
@@ -1877,7 +1878,7 @@
 #ifdef USE_IN_LIBIO
 	  if (_IO_fwide (stream, 0) > 0)
             {
-#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+#if ! _LIBC || __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
               putwc_unlocked (L'\n', stream);
 #else
               abort ();

Modified: trunk/libc/debug/Makefile
==============================================================================
--- trunk/libc/debug/Makefile (original)
+++ trunk/libc/debug/Makefile Tue Oct 30 03:27:35 2007
@@ -125,9 +125,6 @@
 
 libSegFault-routines = segfault
 libSegFault-inhibit-o = $(filter-out .os,$(object-suffixes))
-OPTION_EGLIBC_BACKTRACE-CFLAGS-$(OPTION_EGLIBC_BACKTRACE) \
-	= -DOPTION_EGLIBC_BACKTRACE
-CFLAGS-segfault.c = $(OPTION_EGLIBC_BACKTRACE-CFLAGS-y)
 
 libpcprofile-routines = pcprofile
 libpcprofile-inhibit-o = $(filter-out .os,$(object-suffixes))

Modified: trunk/libc/debug/segfault.c
==============================================================================
--- trunk/libc/debug/segfault.c (original)
+++ trunk/libc/debug/segfault.c Tue Oct 30 03:27:35 2007
@@ -32,6 +32,7 @@
 #include <unistd.h>
 #include <stdio-common/_itoa.h>
 #include <ldsodefs.h>
+#include <gnu/option-groups.h>
 
 #include <bp-checks.h>
 
@@ -95,7 +96,7 @@
   REGISTER_DUMP;
 #endif
 
-#ifdef OPTION_EGLIBC_BACKTRACE
+#if __OPTION_EGLIBC_BACKTRACE
   WRITE_STRING ("\nBacktrace:\n");
 
   /* Get the backtrace.  */

Modified: trunk/libc/iconv/Makefile
==============================================================================
--- trunk/libc/iconv/Makefile (original)
+++ trunk/libc/iconv/Makefile Tue Oct 30 03:27:35 2007
@@ -38,20 +38,13 @@
 CFLAGS-gconv_simple.c = -DSTATIC_GCONV
 endif
 
-OPTION_EGLIBC_LOCALE_CODE-CFLAGS-$(OPTION_EGLIBC_LOCALE_CODE) \
-	= -DOPTION_EGLIBC_LOCALE_CODE
-
-CFLAGS-gconv_db.c += $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
-CFLAGS-gconv_trans.c += $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
-
 vpath %.c ../locale/programs ../intl
 
 iconv_prog-modules = iconv_charmap charmap charmap-dir linereader \
 		     dummy-repertoire simple-hash xstrdup xmalloc
 iconvconfig-modules = strtab xmalloc hash-string
 extra-objs	   = $(iconv_prog-modules:=.o) $(iconvconfig-modules:=.o)
-CFLAGS-iconv_prog.c = -I../locale/programs \
-		      $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
+CFLAGS-iconv_prog.c = -I../locale/programs
 CFLAGS-iconv_charmap.c = -I../locale/programs
 CFLAGS-dummy-repertoire.c = -I../locale/programs
 CFLAGS-charmap.c = -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \

Modified: trunk/libc/iconv/gconv_db.c
==============================================================================
--- trunk/libc/iconv/gconv_db.c (original)
+++ trunk/libc/iconv/gconv_db.c Tue Oct 30 03:27:35 2007
@@ -27,6 +27,7 @@
 #include <sys/param.h>
 #include <bits/libc-lock.h>
 #include <locale/localeinfo.h>
+#include <gnu/option-groups.h>
 
 #include <dlfcn.h>
 #include <gconv_int.h>
@@ -827,7 +828,7 @@
 /* Free all resources if necessary.  */
 libc_freeres_fn (free_mem)
 {
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#if __OPTION_EGLIBC_LOCALE_CODE
   /* First free locale memory.  This needs to be done before freeing derivations,
      as ctype cleanup functions dereference steps arrays which we free below.  */
   _nl_locale_subfreeres ();

Modified: trunk/libc/iconv/gconv_trans.c
==============================================================================
--- trunk/libc/iconv/gconv_trans.c (original)
+++ trunk/libc/iconv/gconv_trans.c Tue Oct 30 03:27:35 2007
@@ -24,6 +24,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
+#include <gnu/option-groups.h>
 
 #include <bits/libc-lock.h>
 #include "gconv_int.h"
@@ -60,7 +61,7 @@
     PTR_DEMANGLE (fct);
 #endif
 
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#if __OPTION_EGLIBC_LOCALE_CODE
   /* If there is no transliteration information in the locale don't do
      anything and return the error.  */
   size = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_TRANSLIT_TAB_SIZE);

Modified: trunk/libc/iconv/iconv_prog.c
==============================================================================
--- trunk/libc/iconv/iconv_prog.c (original)
+++ trunk/libc/iconv/iconv_prog.c Tue Oct 30 03:27:35 2007
@@ -36,6 +36,7 @@
 #ifdef _POSIX_MAPPED_FILES
 # include <sys/mman.h>
 #endif
+#include <gnu/option-groups.h>
 #include <charmap.h>
 #include <gconv_int.h>
 #include "iconv_prog.h"
@@ -230,7 +231,7 @@
 	      bool to_wrong =
 		(iconv_open (to_code, "UTF-8") == (iconv_t) -1
 		 && errno == EINVAL);
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#if __OPTION_EGLIBC_LOCALE_CODE
 	      const char *from_pretty =
 		(from_code[0] ? from_code : nl_langinfo (CODESET));
 	      const char *to_pretty =

Modified: trunk/libc/intl/Makefile
==============================================================================
--- trunk/libc/intl/Makefile (original)
+++ trunk/libc/intl/Makefile Tue Oct 30 03:27:35 2007
@@ -102,11 +102,6 @@
 	$(make-target-directory)
 	LC_ALL=C sed -f $^ > $@
 
-OPTION_EGLIBC_LOCALE_CODE-CFLAGS-$(OPTION_EGLIBC_LOCALE_CODE) \
-	= -DOPTION_EGLIBC_LOCALE_CODE
-
-CFLAGS-dcigettext.c = $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
-
 CFLAGS-tst-gettext.c = -DTESTSTRS_H=\"$(objpfx)msgs.h\"
 CFLAGS-tst-translit.c = -DOBJPFX=\"$(objpfx)\"
 CFLAGS-tst-gettext2.c = -DOBJPFX=\"$(objpfx)\"

Modified: trunk/libc/intl/dcigettext.c
==============================================================================
--- trunk/libc/intl/dcigettext.c (original)
+++ trunk/libc/intl/dcigettext.c Tue Oct 30 03:27:35 2007
@@ -77,6 +77,10 @@
 # include "libgnuintl.h"
 #endif
 #include "hash-string.h"
+
+#ifdef _LIBC
+# include <gnu/option-groups.h>
+#endif
 
 /* Thread safetyness.  */
 #ifdef _LIBC
@@ -464,7 +468,7 @@
   search->category = category;
 # ifdef HAVE_PER_THREAD_LOCALE
 #  ifdef _LIBC
-#   ifdef OPTION_EGLIBC_LOCALE_CODE
+#   if __OPTION_EGLIBC_LOCALE_CODE
   localename = __current_locale_name (category);
 #   else
   localename = "C";
@@ -1337,7 +1341,7 @@
      `LC_xxx', and `LANG'.  On some systems this can be done by the
      `setlocale' function itself.  */
 #ifdef _LIBC
-# ifdef OPTION_EGLIBC_LOCALE_CODE
+# if __OPTION_EGLIBC_LOCALE_CODE
   retval = __current_locale_name (category);
 # else
   retval = "C";

Modified: trunk/libc/libidn/Makefile
==============================================================================
--- trunk/libc/libidn/Makefile (original)
+++ trunk/libc/libidn/Makefile Tue Oct 30 03:27:35 2007
@@ -39,8 +39,3 @@
 include $(..)Rules
 
 $(objpfx)libcidn.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
-
-OPTION_EGLIBC_LOCALE_CODE-CFLAGS-$(OPTION_EGLIBC_LOCALE_CODE) \
-	= -DOPTION_EGLIBC_LOCALE_CODE
-
-CFLAGS-toutf8.c = $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)

Modified: trunk/libc/libidn/toutf8.c
==============================================================================
--- trunk/libc/libidn/toutf8.c (original)
+++ trunk/libc/libidn/toutf8.c Tue Oct 30 03:27:35 2007
@@ -35,6 +35,11 @@
 /* Get strlen. */
 #include <string.h>
 
+/* Get __OPTION_EGLIBC_LOCALE_CODE.  */
+#ifdef _LIBC
+# include <gnu/option-groups.h>
+#endif
+
 /* Get iconv_string. */
 #include "iconvme.h"
 
@@ -49,7 +54,7 @@
 #endif
 
 #ifdef _LIBC
-# ifdef OPTION_EGLIBC_LOCALE_CODE
+# if __OPTION_EGLIBC_LOCALE_CODE
 #  define stringprep_locale_charset() nl_langinfo (CODESET)
 # else
 #  define stringprep_locale_charset() "ANSI_X3.4-1968"

Modified: trunk/libc/locale/C-ctype.c
==============================================================================
--- trunk/libc/locale/C-ctype.c (original)
+++ trunk/libc/locale/C-ctype.c Tue Oct 30 03:27:35 2007
@@ -19,8 +19,9 @@
 
 #include "localeinfo.h"
 #include <endian.h>
-
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#include <gnu/option-groups.h>
+
+#if __OPTION_EGLIBC_LOCALE_CODE
 #include "C-translit.h"
 #endif
 
@@ -649,7 +650,7 @@
     { .word = L'7' },
     { .word = L'8' },
     { .word = L'9' },
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#if __OPTION_EGLIBC_LOCALE_CODE
     /* _NL_CTYPE_TRANSLIT_TAB_SIZE */
     { .word = NTRANSLIT },
     /* _NL_CTYPE_TRANSLIT_FROM_IDX */

Modified: trunk/libc/locale/Makefile
==============================================================================
--- trunk/libc/locale/Makefile (original)
+++ trunk/libc/locale/Makefile Tue Oct 30 03:27:35 2007
@@ -114,20 +114,12 @@
 		   -DLOCSRCDIR='"$(i18ndir)/locales"' -DHAVE_CONFIG_H \
 		   -Iprograms
 
-OPTION_EGLIBC_LOCALE_CODE-CFLAGS-$(OPTION_EGLIBC_LOCALE_CODE) \
-	= -DOPTION_EGLIBC_LOCALE_CODE
-OPTION_POSIX_REGEXP-CFLAGS-$(OPTION_POSIX_REGEXP) \
-	= -DOPTION_POSIX_REGEXP
-
-CFLAGS-C-ctype.c = $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
-CFLAGS-xlocale.c = $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
 CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
 CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
 CFLAGS-charmap-dir.c = -Wno-write-strings
 ifneq (y,$(OPTION_EGLIBC_SPAWN))
 CFLAGS-charmap-dir.c += -DNO_UNCOMPRESS
 endif
-CFLAGS-ld-messages.c = $(OPTION_POSIX_REGEXP-CFLAGS-y)
 
 # This makes sure -DNOT_IN_libc is passed for all these modules.
 cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \

Modified: trunk/libc/locale/programs/ld-messages.c
==============================================================================
--- trunk/libc/locale/programs/ld-messages.c (original)
+++ trunk/libc/locale/programs/ld-messages.c Tue Oct 30 03:27:35 2007
@@ -25,6 +25,7 @@
 #include <regex.h>
 #include <string.h>
 #include <sys/uio.h>
+#include <gnu/option-groups.h>
 
 #include <assert.h>
 
@@ -124,7 +125,7 @@
     }
   else
     {
-#ifdef OPTION_POSIX_REGEXP
+#if __OPTION_POSIX_REGEXP
       int result;
       regex_t re;
 
@@ -160,7 +161,7 @@
     }
   else
     {
-#ifdef OPTION_POSIX_REGEXP
+#if __OPTION_POSIX_REGEXP
       int result;
       regex_t re;
 

Modified: trunk/libc/locale/xlocale.c
==============================================================================
--- trunk/libc/locale/xlocale.c (original)
+++ trunk/libc/locale/xlocale.c Tue Oct 30 03:27:35 2007
@@ -19,6 +19,7 @@
    02111-1307 USA.  */
 
 #include <locale.h>
+#include <gnu/option-groups.h>
 #include "localeinfo.h"
 
 #define DEFINE_CATEGORY(category, category_name, items, a) \
@@ -32,7 +33,7 @@
    strong reference to the 'class', 'toupper', and 'tolower' tables
    will cause C-ctype.o to be brought in, as it should be, even when
    the reference to _nl_C_LC_CTYPE will be weak.)  */
-#ifndef OPTION_EGLIBC_LOCALE_CODE
+#if ! __OPTION_EGLIBC_LOCALE_CODE
 # define DEFINE_CATEGORY(category, category_name, items, a) \
   weak_extern (_nl_C_##category)
 # include "categories.def"
@@ -68,7 +69,7 @@
   };
 
 
-#ifndef OPTION_EGLIBC_LOCALE_CODE
+#if ! __OPTION_EGLIBC_LOCALE_CODE
 /* When locale code is enabled, these are each defined in the
    appropriate lc-CATEGORY.c file, so that static links (when __thread
    is supported) bring in only those lc-CATEGORY.o files for
@@ -77,7 +78,7 @@
 
    When locale code is disabled, the _nl_C_CATEGORY objects are the
    only possible referents.  At the moment, there isn't a way to get
-   OPTION_EGLIBC_LOCALE_CODE defined in every compilation unit that
+   __OPTION_EGLIBC_LOCALE_CODE defined in every compilation unit that
    #includes localeinfo.h, so we can't just turn off
    NL_CURRENT_INDIRECT.  So we'll define the _nl_current_CATEGORY
    pointers here.  */
@@ -88,4 +89,4 @@
 #include "categories.def"
 #undef DEFINE_CATEGORY
 #endif
-#endif /* OPTION_EGLIBC_LOCALE_CODE */
+#endif /* __OPTION_EGLIBC_LOCALE_CODE */

Modified: trunk/libc/misc/Makefile
==============================================================================
--- trunk/libc/misc/Makefile (original)
+++ trunk/libc/misc/Makefile Tue Oct 30 03:27:35 2007
@@ -94,9 +94,6 @@
 endif
 # eglibc: endif
 
-OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
-	= -DOPTION_POSIX_WIDE_CHAR_DEVICE_IO
-
 CFLAGS-tsearch.c = $(uses-callbacks)
 CFLAGS-lsearch.c = $(uses-callbacks)
 CFLAGS-pselect.c = -fexceptions
@@ -104,13 +101,13 @@
 CFLAGS-writev.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-usleep.c = -fexceptions
 CFLAGS-syslog.c = -fexceptions
-CFLAGS-error.c = -fexceptions $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
+CFLAGS-error.c = -fexceptions
 CFLAGS-getpass.c = -fexceptions
 CFLAGS-mkstemp.c = -fexceptions
 CFLAGS-mkstemp64.c = -fexceptions
 CFLAGS-getsysstats.c = -fexceptions
 CFLAGS-getusershell.c = -fexceptions
-CFLAGS-err.c = -fexceptions $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
+CFLAGS-err.c = -fexceptions
 CFLAGS-tst-tsearch.c = $(stack-align-test-flags)
 CFLAGS-mntent_r.c = -D_IO_MTSAFE_IO
 

Modified: trunk/libc/misc/err.c
==============================================================================
--- trunk/libc/misc/err.c (original)
+++ trunk/libc/misc/err.c Tue Oct 30 03:27:35 2007
@@ -23,6 +23,7 @@
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
+#include <gnu/option-groups.h>
 
 #ifdef USE_IN_LIBIO
 # include <wchar.h>
@@ -41,7 +42,7 @@
 }
 
 #ifdef USE_IN_LIBIO
-#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 static void
 convert_and_print (const char *format, __gnuc_va_list ap)
 {
@@ -96,7 +97,7 @@
 #ifdef USE_IN_LIBIO
   if (_IO_fwide (stderr, 0) > 0)
     {
-#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
       __fwprintf (stderr, L"%s: ", __progname);
       convert_and_print (format, ap);
       putwc_unlocked (L'\n', stderr);
@@ -125,7 +126,7 @@
 #ifdef USE_IN_LIBIO
   if (_IO_fwide (stderr, 0) > 0)
     {
-#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
       __fwprintf (stderr, L"%s: ", __progname);
       if (format)
 	{

Modified: trunk/libc/misc/error.c
==============================================================================
--- trunk/libc/misc/error.c (original)
+++ trunk/libc/misc/error.c Tue Oct 30 03:27:35 2007
@@ -29,6 +29,7 @@
 #include <string.h>
 
 #ifdef _LIBC
+# include <gnu/option-groups.h>
 # include <libintl.h>
 # include <stdbool.h>
 # include <stdint.h>
@@ -131,7 +132,7 @@
 #if _LIBC
   if (_IO_fwide (stderr, 0) > 0)
     {
-#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 # define ALLOCA_LIMIT 2000
       size_t len = strlen (message) + 1;
       wchar_t *wmessage = NULL;

Modified: trunk/libc/nptl/Makefile
==============================================================================
--- trunk/libc/nptl/Makefile (original)
+++ trunk/libc/nptl/Makefile Tue Oct 30 03:27:35 2007
@@ -158,9 +158,6 @@
 CFLAGS-cancellation.c = -fasynchronous-unwind-tables
 CFLAGS-libc-cancellation.c = -fasynchronous-unwind-tables
 
-OPTION_EGLIBC_INET-CFLAGS-$(OPTION_EGLIBC_INET) := -DOPTION_EGLIBC_INET
-CFLAGS-pthread_create.c := $(OPTION_EGLIBC_INET-CFLAGS-y)
-
 # Calling pthread_exit() must cause the registered cancel handlers to
 # be executed.  Therefore exceptions have to be thrown through this
 # function.

Modified: trunk/libc/nptl/pthread_create.c
==============================================================================
--- trunk/libc/nptl/pthread_create.c (original)
+++ trunk/libc/nptl/pthread_create.c Tue Oct 30 03:27:35 2007
@@ -28,6 +28,7 @@
 #include <libc-internal.h>
 #include <resolv.h>
 #include <kernel-features.h>
+#include <gnu/option-groups.h>
 
 #include <shlib-compat.h>
 
@@ -236,7 +237,7 @@
   THREAD_SETMEM (pd, cpuclock_offset, now);
 #endif
 
-#ifdef OPTION_EGLIBC_INET
+#if __OPTION_EGLIBC_INET
   /* Initialize resolver state pointer.  */
   __resp = &pd->res;
 #endif
@@ -305,7 +306,7 @@
   /* Run the destructor for the thread-local data.  */
   __nptl_deallocate_tsd ();
 
-#ifdef OPTION_EGLIBC_INET
+#if __OPTION_EGLIBC_INET
   /* Clean up any state libc stored in thread-local variables.  */
   __libc_thread_freeres ();
 #endif

Modified: trunk/libc/nss/Makefile
==============================================================================
--- trunk/libc/nss/Makefile (original)
+++ trunk/libc/nss/Makefile Tue Oct 30 03:27:35 2007
@@ -130,15 +130,3 @@
 # a statically-linked program that hasn't already loaded it.
 $(services:%=$(objpfx)libnss_%.so): $(common-objpfx)libc.so \
 				    $(common-objpfx)libc_nonshared.a
-
-OPTION_EGLIBC_INET-CFLAGS-$(OPTION_EGLIBC_INET) = -DOPTION_EGLIBC_INET=1
-OPTION_EGLIBC_NSSWITCH-CFLAGS-$(OPTION_EGLIBC_NSSWITCH) \
-	= -DOPTION_EGLIBC_NSSWITCH=1
-OPTION_EGLIBC_DB_ALIASES-CFLAGS-$(OPTION_EGLIBC_DB_ALIASES) \
-	= -DOPTION_EGLIBC_DB_ALIASES=1
-
-CFLAGS-nsswitch.c    = $(OPTION_EGLIBC_INET-CFLAGS-y) \
-		       $(OPTION_EGLIBC_NSSWITCH-CFLAGS-y)
-CFLAGS-getnssent_r.c = $(OPTION_EGLIBC_INET-CFLAGS-y)
-CFLAGS-getent.c      = $(OPTION_EGLIBC_INET-CFLAGS-y) \
-		       $(OPTION_EGLIBC_DB_ALIASES-y)

Modified: trunk/libc/nss/getent.c
==============================================================================
--- trunk/libc/nss/getent.c (original)
+++ trunk/libc/nss/getent.c Tue Oct 30 03:27:35 2007
@@ -38,6 +38,7 @@
 #include <netinet/ether.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
+#include <gnu/option-groups.h>
 
 /* Get libc version number.  */
 #include <version.h>
@@ -88,7 +89,7 @@
   fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk");
 }
 
-#ifdef OPTION_EGLIBC_DB_ALIASES
+#if __OPTION_EGLIBC_DB_ALIASES
 /* This is for aliases */
 static inline void
 print_aliases (struct aliasent *alias)
@@ -133,9 +134,9 @@
 
   return result;
 }
-#endif /* OPTION_EGLIBC_DB_ALIASES */
-
-#ifdef OPTION_EGLIBC_INET
+#endif /* __OPTION_EGLIBC_DB_ALIASES */
+
+#if __OPTION_EGLIBC_INET
 /* This is for ethers */
 static int
 ethers_keys (int number, char *key[])
@@ -179,7 +180,7 @@
 
   return result;
 }
-#endif /* OPTION_EGLIBC_INET */
+#endif /* __OPTION_EGLIBC_INET */
 
 /* This is for group */
 static inline void
@@ -238,7 +239,7 @@
   return result;
 }
 
-#ifdef OPTION_EGLIBC_INET
+#if __OPTION_EGLIBC_INET
 /* This is for hosts */
 static void
 print_hosts (struct hostent *host)
@@ -474,7 +475,7 @@
 
   return result;
 }
-#endif /* OPTION_EGLIBC_INET */
+#endif /* __OPTION_EGLIBC_INET */
 
 /* Now is all for passwd */
 static inline void
@@ -527,7 +528,7 @@
   return result;
 }
 
-#ifdef OPTION_EGLIBC_INET
+#if __OPTION_EGLIBC_INET
 /* This is for protocols */
 static inline void
 print_protocols (struct protoent *proto)
@@ -679,7 +680,7 @@
 
   return result;
 }
-#endif /* OPTION_EGLIBC_INET */
+#endif /* __OPTION_EGLIBC_INET */
 
 /* This is for shadow */
 static void
@@ -747,13 +748,13 @@
   {
 #define D(name) { #name, name ## _keys },
 
-#ifdef OPTION_EGLIBC_INET
+#if __OPTION_EGLIBC_INET
 #define DN(name) D(name)
 #else
 #define DN(name)
 #endif
 
-#ifdef OPTION_EGLIBC_DB_ALIASES
+#if __OPTION_EGLIBC_DB_ALIASES
 #define DA(name) D(name)
 #else
 #define DA(name)

Modified: trunk/libc/nss/getnssent_r.c
==============================================================================
--- trunk/libc/nss/getnssent_r.c (original)
+++ trunk/libc/nss/getnssent_r.c Tue Oct 30 03:27:35 2007
@@ -17,6 +17,7 @@
    02111-1307 USA.  */
 
 #include <errno.h>
+#include <gnu/option-groups.h>
 #include <netdb.h>
 #include "nsswitch.h"
 
@@ -60,13 +61,13 @@
   } fct;
   int no_more;
 
-#if OPTION_EGLIBC_INET
+#if __OPTION_EGLIBC_INET
   if (res && __res_maybe_init (&_res, 0) == -1)
     {
       __set_h_errno (NETDB_INTERNAL);
       return;
     }
-#endif /* OPTION_EGLIBC_INET */
+#endif /* __OPTION_EGLIBC_INET */
 
   /* Cycle through the services and run their `setXXent' functions until
      we find an available service.  */
@@ -105,13 +106,13 @@
   } fct;
   int no_more;
 
-#ifdef OPTION_EGLIBC_INET
+#if __OPTION_EGLIBC_INET
   if (res && __res_maybe_init (&_res, 0) == -1)
     {
       __set_h_errno (NETDB_INTERNAL);
       return;
     }
-#endif /* OPTION_EGLIBC_INET */
+#endif /* __OPTION_EGLIBC_INET */
 
   /* Cycle through all the services and run their endXXent functions.  */
   no_more = setup (func_name, lookup_fct, &fct.ptr, nip, startp, 1);
@@ -147,14 +148,14 @@
   int no_more;
   enum nss_status status;
 
-#ifdef OPTION_EGLIBC_INET
+#if __OPTION_EGLIBC_INET
   if (res && __res_maybe_init (&_res, 0) == -1)
     {
       *h_errnop = NETDB_INTERNAL;
       *result = NULL;
       return errno;
     }
-#endif /* OPTION_EGLIBC_INET */
+#endif /* __OPTION_EGLIBC_INET */
 
   /* Initialize status to return if no more functions are found.  */
   status = NSS_STATUS_NOTFOUND;

Modified: trunk/libc/nss/nsswitch.c
==============================================================================
--- trunk/libc/nss/nsswitch.c (original)
+++ trunk/libc/nss/nsswitch.c Tue Oct 30 03:27:35 2007
@@ -27,6 +27,7 @@
 #include <stdio_ext.h>
 #include <stdlib.h>
 #include <string.h>
+#include <gnu/option-groups.h>
 
 #include <aliases.h>
 #include <grp.h>
@@ -48,7 +49,7 @@
    - We never add databases or service libraries, or look up functions
      at runtime, so there's no need for a lock to protect our tables.
    See ../option-groups.def for the details.  */
-#ifdef OPTION_EGLIBC_NSSWITCH
+#if __OPTION_EGLIBC_NSSWITCH
 
 /* Prototypes for the local functions.  */
 static name_database *nss_parse_file (const char *fname) internal_function;
@@ -94,7 +95,7 @@
 /* The root of the whole data base.  */
 static name_database *service_table;
 
-#else /* OPTION_EGLIBC_NSSWITCH */
+#else /* __OPTION_EGLIBC_NSSWITCH */
 
 /* Bring in the statically initialized service table we generated at
    build time.  */
@@ -106,7 +107,7 @@
 #define lock_nsswitch (0)
 #define unlock_nsswitch (0)
 
-#endif /* OPTION_EGLIBC_NSSWITCH */
+#endif /* __OPTION_EGLIBC_NSSWITCH */
 
 
 /* -1 == database not found
@@ -126,7 +127,7 @@
       return 0;
     }
 
-#ifdef OPTION_EGLIBC_NSSWITCH
+#if __OPTION_EGLIBC_NSSWITCH
   /* Are we initialized yet?  */
   if (service_table == NULL)
     /* Read config file.  */
@@ -153,7 +154,7 @@
 	    *ni = entry->service;
     }
 
-#ifdef OPTION_EGLIBC_NSSWITCH
+#if __OPTION_EGLIBC_NSSWITCH
   /* No configuration data is available, either because nsswitch.conf
      doesn't exist or because it doesn't has a line for this database.
 
@@ -244,7 +245,7 @@
 libc_hidden_def (__nss_next)
 
 
-#ifdef OPTION_EGLIBC_NSSWITCH
+#if __OPTION_EGLIBC_NSSWITCH
 int
 __nss_configure_lookup (const char *dbname, const char *service_line)
 {
@@ -458,7 +459,7 @@
 libc_hidden_def (__nss_lookup_function)
 
 
-#else /* below if ! defined (OPTION_EGLIBC_NSSWITCH) */
+#else /* below if ! __OPTION_EGLIBC_NSSWITCH */
 
 
 int
@@ -487,7 +488,7 @@
 #endif
 
 
-#ifdef OPTION_EGLIBC_NSSWITCH
+#if __OPTION_EGLIBC_NSSWITCH
 static name_database *
 internal_function
 nss_parse_file (const char *fname)
@@ -770,10 +771,10 @@
 
   return *currentp;
 }
-#endif /* OPTION_EGLIBC_NSSWITCH */
-
-
-#ifdef OPTION_EGLIBC_INET
+#endif /* __OPTION_EGLIBC_NSSWITCH */
+
+
+#if __OPTION_EGLIBC_INET
 /* Called by nscd and nscd alone.  */
 void
 __nss_disable_nscd (void)
@@ -784,10 +785,10 @@
   __nss_not_use_nscd_hosts = -1;
   __nss_not_use_nscd_services = -1;
 }
-#endif /* OPTION_EGLIBC_INET */
-
-
-#ifdef OPTION_EGLIBC_NSSWITCH
+#endif /* __OPTION_EGLIBC_INET */
+
+
+#if __OPTION_EGLIBC_NSSWITCH
 /* Free all resources if necessary.  */
 libc_freeres_fn (free_mem)
 {
@@ -837,4 +838,4 @@
 
   free (top);
 }
-#endif /* OPTION_EGLIBC_NSSWITCH */
+#endif /* __OPTION_EGLIBC_NSSWITCH */

Modified: trunk/libc/posix/Makefile
==============================================================================
--- trunk/libc/posix/Makefile (original)
+++ trunk/libc/posix/Makefile Tue Oct 30 03:27:35 2007
@@ -155,10 +155,6 @@
 # eglibc: endif
 
 OPTION_EGLIBC_INET-CFLAGS-$(OPTION_EGLIBC_INET) = -DUSE_NSCD=1
-OPTION_EGLIBC_GETLOGIN-CFLAGS-$(OPTION_EGLIBC_GETLOGIN) \
-	= -DOPTION_EGLIBC_GETLOGIN
-OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
-	= -DOPTION_POSIX_WIDE_CHAR_DEVICE_IO
 
 CFLAGS-regex.c = -Wno-strict-prototypes
 CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions $(OPTION_EGLIBC_INET-CFLAGS-y)
@@ -183,8 +179,7 @@
 CFLAGS-spawni.c = -fexceptions
 CFLAGS-spawni.os = -fomit-frame-pointer
 CFLAGS-pause.c = -fexceptions
-CFLAGS-glob.c = $(uses-callbacks) -fexceptions \
-		$(OPTION_EGLIBC_GETLOGIN-CFLAGS-y)
+CFLAGS-glob.c = $(uses-callbacks) -fexceptions
 CFLAGS-glob64.c = $(uses-callbacks) -fexceptions
 CFLAGS-getconf.c = -DGETCONF_DIR='"$(libexecdir)/getconf"'
 CFLAGS-execve.os = -fomit-frame-pointer
@@ -194,7 +189,6 @@
 CFLAGS-execl.os = -fomit-frame-pointer
 CFLAGS-execvp.os = -fomit-frame-pointer
 CFLAGS-execlp.os = -fomit-frame-pointer
-CFLAGS-bug-regex1.c = $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
 
 tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
 		--none random --col --color --colour

Modified: trunk/libc/posix/bug-regex1.c
==============================================================================
--- trunk/libc/posix/bug-regex1.c (original)
+++ trunk/libc/posix/bug-regex1.c Tue Oct 30 03:27:35 2007
@@ -4,6 +4,7 @@
 #include <string.h>
 #include <regex.h>
 #include <wchar.h>
+#include <gnu/option-groups.h>
 
 int
 main (void)
@@ -17,7 +18,7 @@
   memset (&regex, '\0', sizeof (regex));
 
   setlocale (LC_ALL, "de_DE.ISO-8859-1");
-#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
   fwide (stdout, -1);
 #endif
 

Modified: trunk/libc/posix/glob.c
==============================================================================
--- trunk/libc/posix/glob.c (original)
+++ trunk/libc/posix/glob.c Tue Oct 30 03:27:35 2007
@@ -27,6 +27,9 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stddef.h>
+#ifdef _LIBC
+# include <gnu/option-groups.h>
+#endif
 
 /* Outcomment the following line for production quality code.  */
 /* #define NDEBUG 1 */
@@ -566,7 +569,7 @@
 	  if (home_dir == NULL || home_dir[0] == '\0')
             home_dir = "c:/users/default"; /* poor default */
 #  else
-#   if OPTION_EGLIBC_GETLOGIN
+#   if ! _LIBC || __OPTION_EGLIBC_GETLOGIN
 	  if (home_dir == NULL || home_dir[0] == '\0')
 	    {
 	      int success;
@@ -621,7 +624,7 @@
 		    home_dir = p->pw_dir;
 		}
 	    }
-#   endif /* OPTION_EGLIBC_GETLOGIN */
+#   endif /* ! _LIBC || __OPTION_EGLIBC_GETLOGIN */
 	  if (home_dir == NULL || home_dir[0] == '\0')
 	    {
 	      if (flags & GLOB_TILDE_CHECK)

Added: trunk/libc/scripts/option-groups.awk
==============================================================================
--- trunk/libc/scripts/option-groups.awk (added)
+++ trunk/libc/scripts/option-groups.awk Tue Oct 30 03:27:35 2007
@@ -1,0 +1,52 @@
+# option-groups.awk --- generate option group header file
+# Given input files containing makefile-style assignments to variables, 
+# print out a header file that #defines an appropriate preprocessor
+# symbol for each variable left set to 'y'.
+
+BEGIN { FS="=" }
+
+# Trim spaces.
+{ gsub (/[[:blank:]]/, "") }
+
+# Skip comments.
+/^#/ { next }
+
+# Process assignments.
+NF == 2 {
+    vars[$1] = $2
+}
+
+# Print final values.
+END {
+    print "/* This file is automatically generated."
+    print "   It defines macros that indicate which EGLIBC option groups were"
+    print "   configured in 'option-groups.config' when this C library was"
+    print "   built.  For each option group named OPTION_foo, it #defines"
+    print "   __OPTION_foo to be 1 if the group is enabled, or leaves that"
+    print "   symbol undefined if the group is disabled."
+    print ""
+    print "   It is generated by scripts/option-groups.awk in the EGLIBC"
+    print "   source tree.  */"
+    print ""
+
+    # Sort the variables by name.
+    i=0
+    for (var in vars)
+        names[i++] = var
+    n = asort (names)
+
+    for (i = 1; i <= n; i++)
+    {
+        var = names[i]
+        if (var ~ /^OPTION_/)
+        {
+            if (vars[var] == "y")
+                print "#define __" var " 1"
+            else if (vars[var] == "n")
+                print "/* #undef __" var " */"
+            # Ignore variables that don't have boolean values.
+            # Ideally, this would be driven by the types given in
+            # option-groups.def.
+        }
+    }
+}

Modified: trunk/libc/stdio-common/Makefile
==============================================================================
--- trunk/libc/stdio-common/Makefile (original)
+++ trunk/libc/stdio-common/Makefile Tue Oct 30 03:27:35 2007
@@ -85,11 +85,6 @@
 	$(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
 # eglibc: endif
 
-OPTION_EGLIBC_LOCALE_CODE-CFLAGS-$(OPTION_EGLIBC_LOCALE_CODE) \
-	= -DOPTION_EGLIBC_LOCALE_CODE
-OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
-	= -DOPTION_POSIX_WIDE_CHAR_DEVICE_IO
-
 CFLAGS-vfprintf.c = -Wno-uninitialized
 CFLAGS-vfwprintf.c = -Wno-uninitialized
 CFLAGS-tst-printf.c = -Wno-format
@@ -97,9 +92,6 @@
 CFLAGS-scanf4.c = -Wno-format
 CFLAGS-scanf7.c = -Wno-format
 CFLAGS-tst-printfsz.c = -Wno-format
-CFLAGS-printf_fp.c = $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
-CFLAGS-printf_fphex.c = $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
-CFLAGS-fxprintf.c = $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
 
 CFLAGS-tmpfile.c = -fexceptions
 CFLAGS-tmpfile64.c = -fexceptions
@@ -122,7 +114,6 @@
 CFLAGS-isoc99_scanf.c += $(exceptions)
 CFLAGS-errlist.c = $(fno-unit-at-a-time)
 CFLAGS-siglist.c = $(fno-unit-at-a-time)
-CFLAGS-tst-popen.c = $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
 
 # The following is a hack since we must compile scanf15.c without any
 # GNU extension.  The latter are needed, though, when internal headers

Modified: trunk/libc/stdio-common/fxprintf.c
==============================================================================
--- trunk/libc/stdio-common/fxprintf.c (original)
+++ trunk/libc/stdio-common/fxprintf.c Tue Oct 30 03:27:35 2007
@@ -24,6 +24,7 @@
 #include <wchar.h>
 #include <string.h>
 #include <libioP.h>
+#include <gnu/option-groups.h>
 
 
 int
@@ -38,7 +39,7 @@
   int res;
   if (_IO_fwide (fp, 0) > 0)
     {
-#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
       size_t len = strlen (fmt) + 1;
       wchar_t wfmt[len];
       for (size_t i = 0; i < len; ++i)

Modified: trunk/libc/stdio-common/printf_fp.c
==============================================================================
--- trunk/libc/stdio-common/printf_fp.c (original)
+++ trunk/libc/stdio-common/printf_fp.c Tue Oct 30 03:27:35 2007
@@ -39,6 +39,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <wchar.h>
+#include <gnu/option-groups.h>
 
 #ifdef COMPILE_WPRINTF
 # define CHAR_T        wchar_t
@@ -262,7 +263,7 @@
 
 
   /* Figure out the decimal point character.  */
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#if __OPTION_EGLIBC_LOCALE_CODE
   if (info->extra == 0)
     {
       decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
@@ -288,7 +289,7 @@
   decimalwc = L'.';
 #endif
 
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#if __OPTION_EGLIBC_LOCALE_CODE
   if (info->group)
     {
       if (info->extra == 0)

Modified: trunk/libc/stdio-common/printf_fphex.c
==============================================================================
--- trunk/libc/stdio-common/printf_fphex.c (original)
+++ trunk/libc/stdio-common/printf_fphex.c Tue Oct 30 03:27:35 2007
@@ -29,6 +29,7 @@
 #include "_itoa.h"
 #include "_itowa.h"
 #include <locale/localeinfo.h>
+#include <gnu/option-groups.h>
 
 /* #define NDEBUG 1*/		/* Undefine this for debugging assertions.  */
 #include <assert.h>
@@ -148,7 +149,7 @@
 
 
   /* Figure out the decimal point character.  */
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#if __OPTION_EGLIBC_LOCALE_CODE
   if (info->extra == 0)
     {
       decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);

Modified: trunk/libc/stdio-common/tst-popen.c
==============================================================================
--- trunk/libc/stdio-common/tst-popen.c (original)
+++ trunk/libc/stdio-common/tst-popen.c Tue Oct 30 03:27:35 2007
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <wchar.h>
+#include <gnu/option-groups.h>
 
 static int
 do_test (void)
@@ -35,7 +36,7 @@
       return 1;
     }
 
-#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
   /* POSIX says that pipe streams are byte-oriented.  */
   if (fwide (f, 0) >= 0)
     {

Modified: trunk/libc/string/Makefile
==============================================================================
--- trunk/libc/string/Makefile (original)
+++ trunk/libc/string/Makefile Tue Oct 30 03:27:35 2007
@@ -67,10 +67,6 @@
 
 include ../Rules
 
-OPTION_EGLIBC_LOCALE_CODE-CFLAGS-$(OPTION_EGLIBC_LOCALE_CODE) \
-	= -DOPTION_EGLIBC_LOCALE_CODE
-
-CFLAGS-strerror_l.c = $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
 
 tester-ENV = LANGUAGE=C
 inl-tester-ENV = LANGUAGE=C

Modified: trunk/libc/string/strerror_l.c
==============================================================================
--- trunk/libc/string/strerror_l.c (original)
+++ trunk/libc/string/strerror_l.c Tue Oct 30 03:27:35 2007
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/param.h>
+#include <gnu/option-groups.h>
 
 
 static __thread char *last_value;
@@ -30,7 +31,7 @@
 static const char *
 translate (const char *str, locale_t loc)
 {
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#if __OPTION_EGLIBC_LOCALE_CODE
   locale_t oldloc = __uselocale (loc);
   const char *res = _(str);
   __uselocale (oldloc);

Modified: trunk/libc/sysdeps/unix/sysv/linux/Makefile
==============================================================================
--- trunk/libc/sysdeps/unix/sysv/linux/Makefile (original)
+++ trunk/libc/sysdeps/unix/sysv/linux/Makefile Tue Oct 30 03:27:35 2007
@@ -17,13 +17,7 @@
 		   eventfd eventfd_read eventfd_write
 
 
-inet-CFLAGS-$(OPTION_EGLIBC_INET) = -DOPTION_EGLIBC_INET
-
-CFLAGS-gethostid.c = -fexceptions $(inet-CFLAGS-y)
-
-OPTION_EGLIBC_BACKTRACE-CFLAGS-$(OPTION_EGLIBC_BACKTRACE) \
-	= -DOPTION_EGLIBC_BACKTRACE
-CFLAGS-libc_fatal.c += $(OPTION_EGLIBC_BACKTRACE-CFLAGS-y)
+CFLAGS-gethostid.c = -fexceptions
 
 sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
 		  sys/klog.h sys/kdaemon.h \

Modified: trunk/libc/sysdeps/unix/sysv/linux/gethostid.c
==============================================================================
--- trunk/libc/sysdeps/unix/sysv/linux/gethostid.c (original)
+++ trunk/libc/sysdeps/unix/sysv/linux/gethostid.c Tue Oct 30 03:27:35 2007
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <netdb.h>
 #include <not-cancel.h>
+#include <gnu/option-groups.h>
 
 #define HOSTIDFILE "/etc/hostid"
 
@@ -91,7 +92,7 @@
 	return id;
     }
 
-#ifdef OPTION_EGLIBC_INET
+#if __OPTION_EGLIBC_INET
   /* Getting from the file was not successful.  An intelligent guess for
      a unique number of a host is its IP address.  Return this.  */
   if (__gethostname (hostname, MAXHOSTNAMELEN) < 0 || hostname[0] == '\0')

Modified: trunk/libc/sysdeps/unix/sysv/linux/libc_fatal.c
==============================================================================
--- trunk/libc/sysdeps/unix/sysv/linux/libc_fatal.c (original)
+++ trunk/libc/sysdeps/unix/sysv/linux/libc_fatal.c Tue Oct 30 03:27:35 2007
@@ -28,6 +28,7 @@
 #include <unistd.h>
 #include <sys/syslog.h>
 #include <execinfo.h>
+#include <gnu/option-groups.h>
 
 /* Abort with an error message.  */
 #include <not-cancel.h>
@@ -143,7 +144,7 @@
 
   if (do_abort)
     {
-#ifdef OPTION_EGLIBC_BACKTRACE
+#if __OPTION_EGLIBC_BACKTRACE
       if (do_abort > 1 && written)
 	{
 	  void *addrs[64];
@@ -166,7 +167,7 @@
 	      close_not_cancel_no_status (fd2);
 	    }
 	}
-#endif /* OPTION_EGLIBC_BACKTRACE */
+#endif /* __OPTION_EGLIBC_BACKTRACE */
 
       /* Terminate the process.  */
       abort ();

Modified: trunk/libc/time/Makefile
==============================================================================
--- trunk/libc/time/Makefile (original)
+++ trunk/libc/time/Makefile Tue Oct 30 03:27:35 2007
@@ -54,12 +54,6 @@
 CFLAGS-tzset.c = $(tz-cflags)
 CFLAGS-getdate.c = -fexceptions
 
-OPTION_EGLIBC_LOCALE_CODE-CFLAGS-$(OPTION_EGLIBC_LOCALE_CODE) \
-	= -DOPTION_EGLIBC_LOCALE_CODE
-
-CFLAGS-strftime_l.c = $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
-CFLAGS-strptime_l.c = $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
-
 # Don't warn about Y2k problem in strftime format string.
 CFLAGS-test_time.c = -Wno-format
 

Modified: trunk/libc/time/strftime_l.c
==============================================================================
--- trunk/libc/time/strftime_l.c (original)
+++ trunk/libc/time/strftime_l.c Tue Oct 30 03:27:35 2007
@@ -33,6 +33,10 @@
 # define MULTIBYTE_IS_FORMAT_SAFE 1
 # define STDC_HEADERS 1
 # include "../locale/localeinfo.h"
+#endif
+
+#ifdef _LIBC
+# include <gnu/option-groups.h>
 #endif
 
 #if defined emacs && !defined HAVE_BCOPY
@@ -896,7 +900,7 @@
 	    goto bad_format;
 	  if (modifier == L_('E'))
 	    {
-#if defined (OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
 	      struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
 	      if (era)
 		{
@@ -969,7 +973,7 @@
 
 	  if (modifier == L_('O') && 0 <= number_value)
 	    {
-#if defined (OPTION_EGLIBC_LOCALE_CODE) && defined (_NL_CURRENT)
+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && defined (_NL_CURRENT)
 	      /* Get the locale specific alternate representation of
 		 the number NUMBER_VALUE.  If none exist NULL is returned.  */
 	      const CHAR_T *cp = nl_get_alt_digit (number_value
@@ -1274,7 +1278,7 @@
 	case L_('Y'):
 	  if (modifier == 'E')
 	    {
-#if defined (OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
 	      struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
 	      if (era)
 		{
@@ -1299,7 +1303,7 @@
 	case L_('y'):
 	  if (modifier == L_('E'))
 	    {
-#if defined (OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
 	      struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
 	      if (era)
 		{

Modified: trunk/libc/time/strptime_l.c
==============================================================================
--- trunk/libc/time/strptime_l.c (original)
+++ trunk/libc/time/strptime_l.c Tue Oct 30 03:27:35 2007
@@ -29,6 +29,7 @@
 #include <stdbool.h>
 
 #ifdef _LIBC
+# include <gnu/option-groups.h>
 # include "../locale/localeinfo.h"
 #endif
 
@@ -93,7 +94,7 @@
     if (val < from || val > to)						      \
       return NULL;							      \
   } while (0)
-#if defined (OPTION_EGLIBC_LOCALE_CODE) && defined (_NL_CURRENT)
+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && defined (_NL_CURRENT)
 # define get_alt_number(from, to, n) \
   ({									      \
      __label__ do_normal;						      \
@@ -828,7 +829,7 @@
 	      s.want_xday = 1;
 	      break;
 	    case 'C':
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
 	      if (s.decided != raw)
 		{
 		  if (s.era_cnt >= 0)
@@ -870,7 +871,7 @@
 		 normal representation.  */
 	      goto match_century;
  	    case 'y':
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
 	      if (s.decided != raw)
 		{
 		  get_number(0, 9999, 4);
@@ -932,7 +933,7 @@
 #endif
 	      goto match_year_in_century;
 	    case 'Y':
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
 	      if (s.decided != raw)
 		{
 		  num_eras = _NL_CURRENT_WORD (LC_TIME,
@@ -1132,7 +1133,7 @@
 	tm->tm_year = (s.century - 19) * 100;
     }
 
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
   if (s.era_cnt != -1)
     {
       era = _nl_select_era_entry (s.era_cnt HELPER_LOCALE_ARG);

Modified: trunk/libc/wcsmbs/Makefile
==============================================================================
--- trunk/libc/wcsmbs/Makefile (original)
+++ trunk/libc/wcsmbs/Makefile Tue Oct 30 03:27:35 2007
@@ -72,10 +72,6 @@
 CFLAGS-wcstof_l.c = $(strtox-CFLAGS)
 CFLAGS-tst-wchar-h.c = -D_FORTIFY_SOURCE=2
 
-OPTION_EGLIBC_LOCALE_CODE-CFLAGS-$(OPTION_EGLIBC_LOCALE_CODE) \
-	= -DOPTION_EGLIBC_LOCALE_CODE
-CFLAGS-wcsmbsload.c = $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
-
 CFLAGS-isoc99_wscanf.c += $(exceptions)
 CFLAGS-isoc99_fwscanf.c += $(exceptions)
 CFLAGS-isoc99_vwscanf.c += $(exceptions)

Modified: trunk/libc/wcsmbs/wcsmbsload.c
==============================================================================
--- trunk/libc/wcsmbs/wcsmbsload.c (original)
+++ trunk/libc/wcsmbs/wcsmbsload.c Tue Oct 30 03:27:35 2007
@@ -22,6 +22,7 @@
 #include <limits.h>
 #include <stdlib.h>
 #include <string.h>
+#include <gnu/option-groups.h>
 
 #include <locale/localeinfo.h>
 #include <wcsmbsload.h>
@@ -144,7 +145,7 @@
   })
 
 
-#ifdef OPTION_EGLIBC_LOCALE_CODE
+#if __OPTION_EGLIBC_LOCALE_CODE
 /* Some of the functions here must not be used while setlocale is called.  */
 __libc_lock_define (extern, __libc_setlocale_lock attribute_hidden)