History

kconfig: allow build-time definition of the internal config prefix

Arnaud Lacombe committed 16 years ago

Commit ffb59571 parent 59dfa246 files · +43 −34Browse files

Showing the changes to scripts (6 of 6 files). Show all

Unified · Split

6 files
  1. scripts/kconfig/conf.c +1 −1
  2. scripts/kconfig/confdata.c +27 −21
  3. scripts/kconfig/lkc.h +3 −0
  4. scripts/kconfig/mconf.c +5 −5
  5. scripts/kconfig/menu.c +1 −1
  6. scripts/kconfig/nconf.c +6 −6
scripts/kconfig/conf.c+1−1
@@ -425,7 +425,7 @@ static void check_conf(struct menu *menu) · 424 unmodified lines
425425 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
426426 if (input_mode == listnewconfig) {
427427 if (sym->name && !sym_is_choice_value(sym)) {
428− printf("CONFIG_%s\n", sym->name);
428+ printf("%s%s\n", CONFIG_, sym->name);
429429 }
430430 } else if (input_mode != oldnoconfig) {
431431 if (!conf_cnt++)
scripts/kconfig/confdata.c+27−21
@@ -222,22 +222,22 @@ load: · 221 unmodified lines
222222 conf_lineno++;
223223 sym = NULL;
224224 if (line[0] == '#') {
225− if (memcmp(line + 2, "CONFIG_", 7))
225+ if (memcmp(line + 2, CONFIG_, strlen(CONFIG_)))
226226 continue;
227− p = strchr(line + 9, ' ');
227+ p = strchr(line + 2 + strlen(CONFIG_), ' ');
228228 if (!p)
229229 continue;
230230 *p++ = 0;
231231 if (strncmp(p, "is not set", 10))
232232 continue;
233233 if (def == S_DEF_USER) {
234− sym = sym_find(line + 9);
234+ sym = sym_find(line + 2 + strlen(CONFIG_));
235235 if (!sym) {
236236 sym_add_change_count(1);
237237 break;
238238 }
239239 } else {
240− sym = sym_lookup(line + 9, 0);
240+ sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
241241 if (sym->type == S_UNKNOWN)
242242 sym->type = S_BOOLEAN;
243243 }
@@ -253,8 +253,8 @@ load: · 9 unmodified lines
253253 default:
254254 ;
255255 }
256− } else if (memcmp(line, "CONFIG_", 7) == 0) {
257− p = strchr(line + 7, '=');
256+ } else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) {
257+ p = strchr(line + strlen(CONFIG_), '=');
258258 if (!p)
259259 continue;
260260 *p++ = 0;
@@ -265,13 +265,13 @@ load: · 4 unmodified lines
265265 *p2 = 0;
266266 }
267267 if (def == S_DEF_USER) {
268− sym = sym_find(line + 7);
268+ sym = sym_find(line + strlen(CONFIG_));
269269 if (!sym) {
270270 sym_add_change_count(1);
271271 break;
272272 }
273273 } else {
274− sym = sym_lookup(line + 7, 0);
274+ sym = sym_lookup(line + strlen(CONFIG_), 0);
275275 if (sym->type == S_UNKNOWN)
276276 sym->type = S_OTHER;
277277 }
@@ -397,9 +397,9 @@ static void conf_write_string(bool headerfile, const char *name, · 119 unmodified lines
397397 {
398398 int l;
399399 if (headerfile)
400− fprintf(out, "#define CONFIG_%s \"", name);
400+ fprintf(out, "#define %s%s \"", CONFIG_, name);
401401 else
402− fprintf(out, "CONFIG_%s=\"", name);
402+ fprintf(out, "%s%s=\"", CONFIG_, name);
403403
404404 while (1) {
405405 l = strcspn(str, "\"\\");
@@ -425,13 +425,14 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type, · 19 unmodified lines
425425 switch (sym_get_tristate_value(sym)) {
426426 case no:
427427 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);
429430 break;
430431 case mod:
431− fprintf(out, "CONFIG_%s=m\n", sym->name);
432+ fprintf(out, "%s%s=m\n", CONFIG_, sym->name);
432433 break;
433434 case yes:
434− fprintf(out, "CONFIG_%s=y\n", sym->name);
435+ fprintf(out, "%s%s=y\n", CONFIG_, sym->name);
435436 break;
436437 }
437438 break;
@@ -441,7 +442,7 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type, · 3 unmodified lines
441442 case S_HEX:
442443 case S_INT:
443444 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);
445446 break;
446447 case S_OTHER:
447448 case S_UNKNOWN:
@@ -832,14 +833,17 @@ int conf_write_autoconf(void) · 384 unmodified lines
832833 case no:
833834 break;
834835 case mod:
835− fprintf(tristate, "CONFIG_%s=M\n", sym->name);
836− fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name);
836+ fprintf(tristate, "%s%s=M\n",
837+ CONFIG_, sym->name);
838+ fprintf(out_h, "#define %s%s_MODULE 1\n",
839+ CONFIG_, sym->name);
837840 break;
838841 case yes:
839842 if (sym->type == S_TRISTATE)
840− fprintf(tristate, "CONFIG_%s=Y\n",
841− sym->name);
842− fprintf(out_h, "#define CONFIG_%s 1\n", sym->name);
843+ fprintf(tristate,"%s%s=Y\n",
844+ CONFIG_, sym->name);
845+ fprintf(out_h, "#define %s%s 1\n",
846+ CONFIG_, sym->name);
843847 break;
844848 }
845849 break;
@@ -849,12 +853,14 @@ int conf_write_autoconf(void) · 3 unmodified lines
849853 case S_HEX:
850854 str = sym_get_string_value(sym);
851855 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);
853858 break;
854859 }
855860 case S_INT:
856861 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);
858864 break;
859865 default:
860866 break;
scripts/kconfig/lkc.h+3−0
@@ -37,6 +37,9 @@ extern "C" { · 36 unmodified lines
3737 #define _(text) gettext(text)
3838 #define N_(text) (text)
3939
40+#ifndef CONFIG_
41+#define CONFIG_ "CONFIG_"
42+#endif
4043
4144 #define TF_COMMAND 0x0001
4245 #define TF_PARAM 0x0002
scripts/kconfig/mconf.c+5−5
@@ -316,8 +316,8 @@ static void search_conf(void) · 315 unmodified lines
316316 again:
317317 dialog_clear();
318318 dres = dialog_inputbox(_("Search Configuration Parameter"),
319− _("Enter CONFIG_ (sub)string to search for "
320− "(with or without \"CONFIG\")"),
319+ _("Enter " CONFIG_ " (sub)string to search for "
320+ "(with or without \"" CONFIG_ "\")"),
321321 10, 75, "");
322322 switch (dres) {
323323 case 0:
@@ -329,10 +329,10 @@ again: · 5 unmodified lines
329329 return;
330330 }
331331
332− /* strip CONFIG_ if necessary */
332+ /* strip the prefix if necessary */
333333 dialog_input = dialog_input_result;
334− if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0)
335− dialog_input += 7;
334+ if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
335+ dialog_input += strlen(CONFIG_);
336336
337337 sym_arr = sym_re_search(dialog_input);
338338 res = get_relations_str(sym_arr);
scripts/kconfig/menu.c+1−1
@@ -566,7 +566,7 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help) · 565 unmodified lines
566566
567567 if (menu_has_help(menu)) {
568568 if (sym->name) {
569− str_printf(help, "CONFIG_%s:\n\n", sym->name);
569+ str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
570570 str_append(help, _(menu_get_help(menu)));
571571 str_append(help, "\n");
572572 }
scripts/kconfig/nconf.c+6−6
@@ -744,8 +744,8 @@ static void search_conf(void) · 743 unmodified lines
744744 again:
745745 dres = dialog_inputbox(main_window,
746746 _("Search Configuration Parameter"),
747− _("Enter CONFIG_ (sub)string to search for "
748− "(with or without \"CONFIG\")"),
747+ _("Enter " CONFIG_ " (sub)string to search for "
748+ "(with or without \"" CONFIG_ "\")"),
749749 "", dialog_input_result, 99);
750750 switch (dres) {
751751 case 0:
@@ -758,10 +758,10 @@ again: · 6 unmodified lines
758758 return;
759759 }
760760
761− /* strip CONFIG_ if necessary */
761+ /* strip the prefix if necessary */
762762 dialog_input = dialog_input_result;
763− if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0)
764− dialog_input += 7;
763+ if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
764+ dialog_input += strlen(CONFIG_);
765765
766766 sym_arr = sym_re_search(dialog_input);
767767 res = get_relations_str(sym_arr);
@@ -1261,7 +1261,7 @@ static void show_help(struct menu *menu) · 493 unmodified lines
12611261
12621262 if (menu && menu->sym && menu_has_help(menu)) {
12631263 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);
12651265 str_append(&help, _(menu_get_help(menu)));
12661266 str_append(&help, "\n");
12671267 get_symbol_str(&help, menu->sym);