aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/confdata.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 2bafd9a7c8da..d01f962e879f 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -768,6 +768,29 @@ out:
768 return res; 768 return res;
769} 769}
770 770
771static void conf_write_function_autoconf(FILE *out, char* conf, char* name,
772 int val)
773{
774 char c;
775 char *tmp, *d;
776
777 d = strdup(conf);
778 tmp = d;
779 while ((c = *conf++))
780 *d++ = tolower(c);
781
782 fprintf(out, "#define %sis_", tmp);
783 free(tmp);
784
785 d = strdup(name);
786 tmp = d;
787 while ((c = *name++))
788 *d++ = tolower(c);
789 fprintf(out, "%s%s() %d\n", tmp, (val > 1) ? "_module" : "",
790 val ? 1 : 0);
791 free(tmp);
792}
793
771int conf_write_autoconf(void) 794int conf_write_autoconf(void)
772{ 795{
773 struct symbol *sym; 796 struct symbol *sym;
@@ -815,6 +838,7 @@ int conf_write_autoconf(void)
815 rootmenu.prompt->text); 838 rootmenu.prompt->text);
816 839
817 for_all_symbols(i, sym) { 840 for_all_symbols(i, sym) {
841 int fct_val = 0;
818 sym_calc_value(sym); 842 sym_calc_value(sym);
819 if (!(sym->flags & SYMBOL_WRITE) || !sym->name) 843 if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
820 continue; 844 continue;
@@ -834,6 +858,7 @@ int conf_write_autoconf(void)
834 CONFIG_, sym->name); 858 CONFIG_, sym->name);
835 fprintf(out_h, "#define %s%s_MODULE 1\n", 859 fprintf(out_h, "#define %s%s_MODULE 1\n",
836 CONFIG_, sym->name); 860 CONFIG_, sym->name);
861 fct_val = 2;
837 break; 862 break;
838 case yes: 863 case yes:
839 if (sym->type == S_TRISTATE) 864 if (sym->type == S_TRISTATE)
@@ -841,8 +866,10 @@ int conf_write_autoconf(void)
841 CONFIG_, sym->name); 866 CONFIG_, sym->name);
842 fprintf(out_h, "#define %s%s 1\n", 867 fprintf(out_h, "#define %s%s 1\n",
843 CONFIG_, sym->name); 868 CONFIG_, sym->name);
869 fct_val = 1;
844 break; 870 break;
845 } 871 }
872 conf_write_function_autoconf(out_h, CONFIG_, sym->name, fct_val);
846 break; 873 break;
847 case S_STRING: 874 case S_STRING:
848 conf_write_string(true, sym->name, sym_get_string_value(sym), out_h); 875 conf_write_string(true, sym->name, sym_get_string_value(sym), out_h);