Update to latest kconfig from linux-2.6.20.7.
I'm not sure of the improvements, but at least we're up-to-date, and updating in the future will be easier.
1.1 --- a/kconfig/conf.c Sun Apr 15 16:35:14 2007 +0000
1.2 +++ b/kconfig/conf.c Sun Apr 15 16:45:11 2007 +0000
1.3 @@ -557,7 +557,7 @@
1.4 case ask_silent:
1.5 if (stat(".config", &tmpstat)) {
1.6 printf(_("***\n"
1.7 - "*** You have not yet configured your "PROJECT_NAME"!\n"
1.8 + "*** You have not yet configured "PROJECT_NAME"!\n"
1.9 "***\n"
1.10 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
1.11 "*** \"make menuconfig\" or \"make xconfig\").\n"
1.12 @@ -600,7 +600,7 @@
1.13 input_mode = ask_silent;
1.14 valid_stdin = 1;
1.15 }
1.16 - } else if (sym_change_count) {
1.17 + } else if (conf_get_changed()) {
1.18 name = getenv("KCONFIG_NOSILENTUPDATE");
1.19 if (name && *name) {
1.20 fprintf(stderr, _("\n*** "PROJECT_NAME" configuration requires explicit update.\n\n"));
1.21 @@ -613,11 +613,11 @@
1.22 conf_cnt = 0;
1.23 check_conf(&rootmenu);
1.24 } while (conf_cnt);
1.25 + if (conf_write(NULL)) {
1.26 + fprintf(stderr, _("\n*** Error during writing of "PROJECT_NAME" configuration.\n\n"));
1.27 + return 1;
1.28 + }
1.29 +skip_check:
1.30
1.31 - if (!conf_write(NULL)) {
1.32 -skip_check:
1.33 - return 0;
1.34 - }
1.35 - fprintf(stderr, _("\n*** Error writing "PROJECT_NAME" configuration.\n\n"));
1.36 - return 1;
1.37 + return 0;
1.38 }
2.1 --- a/kconfig/confdata.c Sun Apr 15 16:35:14 2007 +0000
2.2 +++ b/kconfig/confdata.c Sun Apr 15 16:45:11 2007 +0000
2.3 @@ -5,9 +5,7 @@
2.4
2.5 #include <sys/stat.h>
2.6 #include <ctype.h>
2.7 -#include <errno.h>
2.8 #include <fcntl.h>
2.9 -#include <limits.h>
2.10 #include <stdio.h>
2.11 #include <stdlib.h>
2.12 #include <string.h>
2.13 @@ -23,9 +21,7 @@
2.14 static const char *conf_filename;
2.15 static int conf_lineno, conf_warnings, conf_unsaved;
2.16
2.17 -#ifndef conf_defname
2.18 const char conf_defname[] = "arch/$ARCH/defconfig";
2.19 -#endif
2.20
2.21 static void conf_warning(const char *fmt, ...)
2.22 {
2.23 @@ -104,7 +100,7 @@
2.24 in = zconf_fopen(name);
2.25 if (in)
2.26 goto load;
2.27 - sym_change_count++;
2.28 + sym_add_change_count(1);
2.29 if (!sym_defconfig_list)
2.30 return 1;
2.31
2.32 @@ -316,7 +312,7 @@
2.33 struct expr *e;
2.34 int i, flags;
2.35
2.36 - sym_change_count = 0;
2.37 + sym_set_change_count(0);
2.38
2.39 if (conf_read_simple(name, S_DEF_USER))
2.40 return 1;
2.41 @@ -368,26 +364,11 @@
2.42 sym->flags &= flags | ~SYMBOL_DEF_USER;
2.43 }
2.44
2.45 - sym_change_count += conf_warnings || conf_unsaved;
2.46 + sym_add_change_count(conf_warnings || conf_unsaved);
2.47
2.48 return 0;
2.49 }
2.50
2.51 -struct menu *next_menu(struct menu *menu)
2.52 -{
2.53 - if (menu->list) return menu->list;
2.54 - do {
2.55 - if (menu->next) {
2.56 - menu = menu->next;
2.57 - break;
2.58 - }
2.59 - } while ((menu = menu->parent));
2.60 -
2.61 - return menu;
2.62 -}
2.63 -
2.64 -#define SYMBOL_FORCEWRITE (1<<31)
2.65 -
2.66 int conf_write(const char *name)
2.67 {
2.68 FILE *out;
2.69 @@ -395,7 +376,7 @@
2.70 struct menu *menu;
2.71 const char *basename;
2.72 char dirname[128], tmpname[128], newname[128];
2.73 - int type, l, writetype;
2.74 + int type, l;
2.75 const char *str;
2.76 time_t now;
2.77 int use_timestamp = 1;
2.78 @@ -451,20 +432,9 @@
2.79 use_timestamp ? "# " : "",
2.80 use_timestamp ? ctime(&now) : "");
2.81
2.82 - if (!sym_change_count)
2.83 + if (!conf_get_changed())
2.84 sym_clear_all_valid();
2.85
2.86 - // Write out all symbols (even in closed sub-menus).
2.87 - if (1) {
2.88 - for (menu = rootmenu.list; menu; menu = next_menu(menu))
2.89 - if (menu->sym) menu->sym->flags |= SYMBOL_FORCEWRITE;
2.90 - writetype = SYMBOL_FORCEWRITE;
2.91 -
2.92 - // Don't write out symbols in closed menus.
2.93 -
2.94 - } else writetype = SYMBOL_WRITE;
2.95 -
2.96 -
2.97 menu = rootmenu.list;
2.98 while (menu) {
2.99 sym = menu->sym;
2.100 @@ -478,9 +448,9 @@
2.101 "#\n", str);
2.102 } else if (!(sym->flags & SYMBOL_CHOICE)) {
2.103 sym_calc_value(sym);
2.104 - if (!(sym->flags & writetype))
2.105 + if (!(sym->flags & SYMBOL_WRITE))
2.106 goto next;
2.107 - sym->flags &= ~writetype;
2.108 + sym->flags &= ~SYMBOL_WRITE;
2.109 type = sym->type;
2.110 if (type == S_TRISTATE) {
2.111 sym_calc_value(modules_sym);
2.112 @@ -520,32 +490,29 @@
2.113 case S_HEX:
2.114 str = sym_get_string_value(sym);
2.115 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
2.116 - fprintf(out, "CT_%s=%s\n", sym->name, *str ? str : "0");
2.117 + fprintf(out, "CT_%s=%s\n", sym->name, str);
2.118 break;
2.119 }
2.120 case S_INT:
2.121 str = sym_get_string_value(sym);
2.122 - fprintf(out, "CT_%s=%s\n", sym->name, *str ? str : "0");
2.123 + fprintf(out, "CT_%s=%s\n", sym->name, str);
2.124 break;
2.125 }
2.126 }
2.127
2.128 next:
2.129 - if (writetype == SYMBOL_WRITE) {
2.130 - if (menu->list) {
2.131 - menu = menu->list;
2.132 - continue;
2.133 + if (menu->list) {
2.134 + menu = menu->list;
2.135 + continue;
2.136 + }
2.137 + if (menu->next)
2.138 + menu = menu->next;
2.139 + else while ((menu = menu->parent)) {
2.140 + if (menu->next) {
2.141 + menu = menu->next;
2.142 + break;
2.143 }
2.144 - if (menu->next)
2.145 - menu = menu->next;
2.146 - else while ((menu = menu->parent)) {
2.147 - if (menu->next) {
2.148 - menu = menu->next;
2.149 - break;
2.150 - }
2.151 - }
2.152 - } else
2.153 - menu = next_menu(menu);
2.154 + }
2.155 }
2.156 fclose(out);
2.157
2.158 @@ -561,7 +528,7 @@
2.159 "# configuration written to %s\n"
2.160 "#\n"), newname);
2.161
2.162 - sym_change_count = 0;
2.163 + sym_set_change_count(0);
2.164
2.165 return 0;
2.166 }
2.167 @@ -798,3 +765,30 @@
2.168
2.169 return 0;
2.170 }
2.171 +
2.172 +static int sym_change_count;
2.173 +static void (*conf_changed_callback)(void);
2.174 +
2.175 +void sym_set_change_count(int count)
2.176 +{
2.177 + int _sym_change_count = sym_change_count;
2.178 + sym_change_count = count;
2.179 + if (conf_changed_callback &&
2.180 + (bool)_sym_change_count != (bool)count)
2.181 + conf_changed_callback();
2.182 +}
2.183 +
2.184 +void sym_add_change_count(int count)
2.185 +{
2.186 + sym_set_change_count(count + sym_change_count);
2.187 +}
2.188 +
2.189 +bool conf_get_changed(void)
2.190 +{
2.191 + return sym_change_count;
2.192 +}
2.193 +
2.194 +void conf_set_changed_callback(void (*fn)(void))
2.195 +{
2.196 + conf_changed_callback = fn;
2.197 +}
3.1 --- a/kconfig/lkc.h Sun Apr 15 16:35:14 2007 +0000
3.2 +++ b/kconfig/lkc.h Sun Apr 15 16:45:11 2007 +0000
3.3 @@ -6,12 +6,6 @@
3.4 #ifndef LKC_H
3.5 #define LKC_H
3.6
3.7 -#define PROJECT_NAME "crosstool-NG"
3.8 -
3.9 -// Make some warnings go away
3.10 -#define YYENABLE_NLS 0
3.11 -#define YYLTYPE_IS_TRIVIAL 0
3.12 -
3.13 #include "expr.h"
3.14
3.15 #ifndef KBUILD_NO_NLS
3.16 @@ -37,6 +31,7 @@
3.17
3.18 #define SRCTREE "srctree"
3.19
3.20 +#define PROJECT_NAME "crosstool-NG"
3.21 #define PACKAGE "crosstool-NG"
3.22 #define LOCALEDIR "/usr/share/locale"
3.23
3.24 @@ -71,6 +66,8 @@
3.25
3.26 /* confdata.c */
3.27 char *conf_get_default_confname(void);
3.28 +void sym_set_change_count(int count);
3.29 +void sym_add_change_count(int count);
3.30
3.31 /* kconfig_load.c */
3.32 void kconfig_load(void);
4.1 --- a/kconfig/lkc_proto.h Sun Apr 15 16:35:14 2007 +0000
4.2 +++ b/kconfig/lkc_proto.h Sun Apr 15 16:45:11 2007 +0000
4.3 @@ -5,6 +5,8 @@
4.4 P(conf_read_simple,int,(const char *name, int));
4.5 P(conf_write,int,(const char *name));
4.6 P(conf_write_autoconf,int,(void));
4.7 +P(conf_get_changed,bool,(void));
4.8 +P(conf_set_changed_callback, void,(void (*fn)(void)));
4.9
4.10 /* menu.c */
4.11 P(rootmenu,struct menu,);
4.12 @@ -16,7 +18,6 @@
4.13
4.14 /* symbol.c */
4.15 P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
4.16 -P(sym_change_count,int,);
4.17
4.18 P(sym_lookup,struct symbol *,(const char *name, int isconst));
4.19 P(sym_find,struct symbol *,(const char *name));
5.1 --- a/kconfig/mconf.c Sun Apr 15 16:35:14 2007 +0000
5.2 +++ b/kconfig/mconf.c Sun Apr 15 16:45:11 2007 +0000
5.3 @@ -868,7 +868,7 @@
5.4 bindtextdomain(PACKAGE, LOCALEDIR);
5.5 textdomain(PACKAGE);
5.6
5.7 - conf_parse(av[1] ? av[1] : "");
5.8 + conf_parse(av[1]);
5.9 conf_read(NULL);
5.10
5.11 sym = sym_lookup("PROJECTVERSION", 0);
5.12 @@ -890,26 +890,33 @@
5.13 do {
5.14 conf(&rootmenu);
5.15 dialog_clear();
5.16 - res = dialog_yesno(NULL,
5.17 - _("Do you wish to save your "
5.18 - "new "PROJECT_NAME" configuration?\n"
5.19 - "<ESC><ESC> to continue."),
5.20 - 6, 60);
5.21 + if (conf_get_changed())
5.22 + res = dialog_yesno(NULL,
5.23 + _("Do you wish to save your "
5.24 + "new "PROJECT_NAME" configuration?\n"
5.25 + "<ESC><ESC> to continue."),
5.26 + 6, 60);
5.27 + else
5.28 + res = -1;
5.29 } while (res == KEY_ESC);
5.30 end_dialog();
5.31 - if (res == 0) {
5.32 +
5.33 + switch (res) {
5.34 + case 0:
5.35 if (conf_write(NULL)) {
5.36 fprintf(stderr, _("\n\n"
5.37 - "Error writing "PROJECT_NAME" configuration.\n"
5.38 - "Your configuration changes were NOT saved."
5.39 + "Error during writing of "PROJECT_NAME" configuration.\n"
5.40 + "Your kernel configuration changes were NOT saved."
5.41 "\n\n"));
5.42 return 1;
5.43 }
5.44 + case -1:
5.45 printf(_("\n\n"
5.46 "*** End of "PROJECT_NAME" configuration.\n"
5.47 - "*** Execute 'make' to build, or try 'make help'."
5.48 + "*** Execute 'make' to build the kernel or try 'make help'."
5.49 "\n\n"));
5.50 - } else {
5.51 + break;
5.52 + default:
5.53 fprintf(stderr, _("\n\n"
5.54 "Your configuration changes were NOT saved."
5.55 "\n\n"));
6.1 --- a/kconfig/symbol.c Sun Apr 15 16:35:14 2007 +0000
6.2 +++ b/kconfig/symbol.c Sun Apr 15 16:45:11 2007 +0000
6.3 @@ -30,7 +30,6 @@
6.4 .flags = SYMBOL_VALID,
6.5 };
6.6
6.7 -int sym_change_count;
6.8 struct symbol *sym_defconfig_list;
6.9 struct symbol *modules_sym;
6.10 tristate modules_val;
6.11 @@ -379,7 +378,7 @@
6.12
6.13 for_all_symbols(i, sym)
6.14 sym->flags &= ~SYMBOL_VALID;
6.15 - sym_change_count++;
6.16 + sym_add_change_count(1);
6.17 if (modules_sym)
6.18 sym_calc_value(modules_sym);
6.19 }
7.1 --- a/kconfig/zconf.tab.c_shipped Sun Apr 15 16:35:14 2007 +0000
7.2 +++ b/kconfig/zconf.tab.c_shipped Sun Apr 15 16:45:11 2007 +0000
7.3 @@ -2135,7 +2135,7 @@
7.4 sym_check_deps(sym);
7.5 }
7.6
7.7 - sym_change_count = 1;
7.8 + sym_set_change_count(1);
7.9 }
7.10
7.11 const char *zconf_tokenname(int token)