aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaud Lacombe <lacombar@gmail.com>2010-08-14 23:57:43 -0400
committerArnaud Lacombe <lacombar@gmail.com>2010-09-19 18:19:26 -0400
commitffb5957bc48f64f0773fd3fbc43cb9bb9b38e270 (patch)
tree968f267b45d124519d681c086c5bba826b0824b6
parent59dfa24da7cb02b3ccc39f5e74b74fe26ea9626a (diff)
kconfig: allow build-time definition of the internal config prefix
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Michal Marek <mmarek@suse.cz>
-rw-r--r--scripts/kconfig/conf.c2
-rw-r--r--scripts/kconfig/confdata.c48
-rw-r--r--scripts/kconfig/lkc.h3
-rw-r--r--scripts/kconfig/mconf.c10
-rw-r--r--scripts/kconfig/menu.c2
-rw-r--r--scripts/kconfig/nconf.c12
6 files changed, 43 insertions, 34 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index d56131c0b3c5..d6cfa0ffbaf0 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -425,7 +425,7 @@ static void check_conf(struct menu *menu)
425 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { 425 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
426 if (input_mode == listnewconfig) { 426 if (input_mode == listnewconfig) {
427 if (sym->name && !sym_is_choice_value(sym)) { 427 if (sym->name && !sym_is_choice_value(sym)) {
428 printf("CONFIG_%s\n", sym->name); 428 printf("%s%s\n", CONFIG_, sym->name);
429 } 429 }
430 } else if (input_mode != oldnoconfig) { 430 } else if (input_mode != oldnoconfig) {
431 if (!conf_cnt++) 431 if (!conf_cnt++)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index d9181de78927..9f3c8899da5a 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -222,22 +222,22 @@ load:
222 conf_lineno++; 222 conf_lineno++;
223 sym = NULL; 223 sym = NULL;
224 if (line[0] == '#') { 224 if (line[0] == '#') {
225 if (memcmp(line + 2, "CONFIG_", 7)) 225 if (memcmp(line + 2, CONFIG_, strlen(CONFIG_)))
226 continue; 226 continue;
227 p = strchr(line + 9, ' '); 227 p = strchr(line + 2 + strlen(CONFIG_), ' ');
228 if (!p) 228 if (!p)
229 continue; 229 continue;
230 *p++ = 0; 230 *p++ = 0;
231 if (strncmp(p, "is not set", 10)) 231 if (strncmp(p, "is not set", 10))
232 continue; 232 continue;
233 if (def == S_DEF_USER) { 233 if (def == S_DEF_USER) {
234 sym = sym_find(line + 9); 234 sym = sym_find(line + 2 + strlen(CONFIG_));
235 if (!sym) { 235 if (!sym) {
236 sym_add_change_count(1); 236 sym_add_change_count(1);
237 break; 237 break;
238 } 238 }
239 } else { 239 } else {
240 sym = sym_lookup(line + 9, 0); 240 sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
241 if (sym->type == S_UNKNOWN) 241 if (sym->type == S_UNKNOWN)
242 sym->type = S_BOOLEAN; 242 sym->type = S_BOOLEAN;
243 } 243 }
@@ -253,8 +253,8 @@ load:
253 default: 253 default:
254 ; 254 ;
255 } 255 }
256 } else if (memcmp(line, "CONFIG_", 7) == 0) { 256 } else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) {
257 p = strchr(line + 7, '='); 257 p = strchr(line + strlen(CONFIG_), '=');
258 if (!p) 258 if (!p)
259 continue; 259 continue;
260 *p++ = 0; 260 *p++ = 0;
@@ -265,13 +265,13 @@ load:
265 *p2 = 0; 265 *p2 = 0;
266 } 266 }
267 if (def == S_DEF_USER) { 267 if (def == S_DEF_USER) {
268 sym = sym_find(line + 7); 268 sym = sym_find(line + strlen(CONFIG_));
269 if (!sym) { 269 if (!sym) {
270 sym_add_change_count(1); 270 sym_add_change_count(1);
271 break; 271 break;
272 } 272 }
273 } else { 273 } else {
274 sym = sym_lookup(line + 7, 0); 274 sym = sym_lookup(line + strlen(CONFIG_), 0);
275 if (sym->type == S_UNKNOWN) 275 if (sym->type == S_UNKNOWN)
276 sym->type = S_OTHER; 276 sym->type = S_OTHER;
277 } 277 }
@@ -397,9 +397,9 @@ static void conf_write_string(bool headerfile, const char *name,
397{ 397{
398 int l; 398 int l;
399 if (headerfile) 399 if (headerfile)
400 fprintf(out, "#define CONFIG_%s \"", name); 400 fprintf(out, "#define %s%s \"", CONFIG_, name);
401 else 401 else
402 fprintf(out, "CONFIG_%s=\"", name); 402 fprintf(out, "%s%s=\"", CONFIG_, name);
403 403
404 while (1) { 404 while (1) {
405 l = strcspn(str, "\"\\"); 405 l = strcspn(str, "\"\\");
@@ -425,13 +425,14 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
425 switch (sym_get_tristate_value(sym)) { 425 switch (sym_get_tristate_value(sym)) {
426 case no: 426 case no:
427 if (write_no) 427 if (write_no)
428 fprintf(out, "# CONFIG_%s is not set\n", sym->name); 428 fprintf(out, "# %s%s is not set\n",
429 CONFIG_, sym->name);
429 break; 430 break;
430 case mod: 431 case mod:
431 fprintf(out, "CONFIG_%s=m\n", sym->name); 432 fprintf(out, "%s%s=m\n", CONFIG_, sym->name);
432 break; 433 break;
433 case yes: 434 case yes:
434 fprintf(out, "CONFIG_%s=y\n", sym->name); 435 fprintf(out, "%s%s=y\n", CONFIG_, sym->name);
435 break; 436 break;
436 } 437 }
437 break; 438 break;
@@ -441,7 +442,7 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
441 case S_HEX: 442 case S_HEX:
442 case S_INT: 443 case S_INT:
443 str = sym_get_string_value(sym); 444 str = sym_get_string_value(sym);
444 fprintf(out, "CONFIG_%s=%s\n", sym->name, str); 445 fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str);
445 break; 446 break;
446 case S_OTHER: 447 case S_OTHER:
447 case S_UNKNOWN: 448 case S_UNKNOWN:
@@ -832,14 +833,17 @@ int conf_write_autoconf(void)
832 case no: 833 case no:
833 break; 834 break;
834 case mod: 835 case mod:
835 fprintf(tristate, "CONFIG_%s=M\n", sym->name); 836 fprintf(tristate, "%s%s=M\n",
836 fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); 837 CONFIG_, sym->name);
838 fprintf(out_h, "#define %s%s_MODULE 1\n",
839 CONFIG_, sym->name);
837 break; 840 break;
838 case yes: 841 case yes:
839 if (sym->type == S_TRISTATE) 842 if (sym->type == S_TRISTATE)
840 fprintf(tristate, "CONFIG_%s=Y\n", 843 fprintf(tristate,"%s%s=Y\n",
841 sym->name); 844 CONFIG_, sym->name);
842 fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); 845 fprintf(out_h, "#define %s%s 1\n",
846 CONFIG_, sym->name);
843 break; 847 break;
844 } 848 }
845 break; 849 break;
@@ -849,12 +853,14 @@ int conf_write_autoconf(void)
849 case S_HEX: 853 case S_HEX:
850 str = sym_get_string_value(sym); 854 str = sym_get_string_value(sym);
851 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { 855 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
852 fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str); 856 fprintf(out_h, "#define %s%s 0x%s\n",
857 CONFIG_, sym->name, str);
853 break; 858 break;
854 } 859 }
855 case S_INT: 860 case S_INT:
856 str = sym_get_string_value(sym); 861 str = sym_get_string_value(sym);
857 fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str); 862 fprintf(out_h, "#define %s%s %s\n",
863 CONFIG_, sym->name, str);
858 break; 864 break;
859 default: 865 default:
860 break; 866 break;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index bdf71bd31412..1b966bf02b12 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -37,6 +37,9 @@ extern "C" {
37#define _(text) gettext(text) 37#define _(text) gettext(text)
38#define N_(text) (text) 38#define N_(text) (text)
39 39
40#ifndef CONFIG_
41#define CONFIG_ "CONFIG_"
42#endif
40 43
41#define TF_COMMAND 0x0001 44#define TF_COMMAND 0x0001
42#define TF_PARAM 0x0002 45#define TF_PARAM 0x0002
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 5c3d0c4b810f..17ba2227932d 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -316,8 +316,8 @@ static void search_conf(void)
316again: 316again:
317 dialog_clear(); 317 dialog_clear();
318 dres = dialog_inputbox(_("Search Configuration Parameter"), 318 dres = dialog_inputbox(_("Search Configuration Parameter"),
319 _("Enter CONFIG_ (sub)string to search for " 319 _("Enter " CONFIG_ " (sub)string to search for "
320 "(with or without \"CONFIG\")"), 320 "(with or without \"" CONFIG_ "\")"),
321 10, 75, ""); 321 10, 75, "");
322 switch (dres) { 322 switch (dres) {
323 case 0: 323 case 0:
@@ -329,10 +329,10 @@ again:
329 return; 329 return;
330 } 330 }
331 331
332 /* strip CONFIG_ if necessary */ 332 /* strip the prefix if necessary */
333 dialog_input = dialog_input_result; 333 dialog_input = dialog_input_result;
334 if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0) 334 if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
335 dialog_input += 7; 335 dialog_input += strlen(CONFIG_);
336 336
337 sym_arr = sym_re_search(dialog_input); 337 sym_arr = sym_re_search(dialog_input);
338 res = get_relations_str(sym_arr); 338 res = get_relations_str(sym_arr);
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 4fb590247f33..64da30c76894 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -566,7 +566,7 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help)
566 566
567 if (menu_has_help(menu)) { 567 if (menu_has_help(menu)) {
568 if (sym->name) { 568 if (sym->name) {
569 str_printf(help, "CONFIG_%s:\n\n", sym->name); 569 str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
570 str_append(help, _(menu_get_help(menu))); 570 str_append(help, _(menu_get_help(menu)));
571 str_append(help, "\n"); 571 str_append(help, "\n");
572 } 572 }
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index b8a9f37b036b..da5e45d43f15 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -744,8 +744,8 @@ static void search_conf(void)
744again: 744again:
745 dres = dialog_inputbox(main_window, 745 dres = dialog_inputbox(main_window,
746 _("Search Configuration Parameter"), 746 _("Search Configuration Parameter"),
747 _("Enter CONFIG_ (sub)string to search for " 747 _("Enter " CONFIG_ " (sub)string to search for "
748 "(with or without \"CONFIG\")"), 748 "(with or without \"" CONFIG_ "\")"),
749 "", dialog_input_result, 99); 749 "", dialog_input_result, 99);
750 switch (dres) { 750 switch (dres) {
751 case 0: 751 case 0:
@@ -758,10 +758,10 @@ again:
758 return; 758 return;
759 } 759 }
760 760
761 /* strip CONFIG_ if necessary */ 761 /* strip the prefix if necessary */
762 dialog_input = dialog_input_result; 762 dialog_input = dialog_input_result;
763 if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0) 763 if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
764 dialog_input += 7; 764 dialog_input += strlen(CONFIG_);
765 765
766 sym_arr = sym_re_search(dialog_input); 766 sym_arr = sym_re_search(dialog_input);
767 res = get_relations_str(sym_arr); 767 res = get_relations_str(sym_arr);
@@ -1261,7 +1261,7 @@ static void show_help(struct menu *menu)
1261 1261
1262 if (menu && menu->sym && menu_has_help(menu)) { 1262 if (menu && menu->sym && menu_has_help(menu)) {
1263 if (menu->sym->name) { 1263 if (menu->sym->name) {
1264 str_printf(&help, "CONFIG_%s:\n\n", menu->sym->name); 1264 str_printf(&help, "%s%s:\n\n", CONFIG_, menu->sym->name);
1265 str_append(&help, _(menu_get_help(menu))); 1265 str_append(&help, _(menu_get_help(menu)));
1266 str_append(&help, "\n"); 1266 str_append(&help, "\n");
1267 get_symbol_str(&help, menu->sym); 1267 get_symbol_str(&help, menu->sym);