aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/kconfig/confdata.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 834eecb010ba..db06af0321b3 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -778,6 +778,29 @@ out:
778 return res; 778 return res;
779} 779}
780 780
781static void conf_write_function_autoconf(FILE *out, char* conf, char* name,
782 int val)
783{
784 char c;
785 char *tmp, *d;
786
787 d = strdup(conf);
788 tmp = d;
789 while ((c = *conf++))
790 *d++ = tolower(c);
791
792 fprintf(out, "#define %sis_", tmp);
793 free(tmp);
794
795 d = strdup(name);
796 tmp = d;
797 while ((c = *name++))
798 *d++ = tolower(c);
799 fprintf(out, "%s%s() %d\n", tmp, (val > 1) ? "_module" : "",
800 val ? 1 : 0);
801 free(tmp);
802}
803
781int conf_write_autoconf(void) 804int conf_write_autoconf(void)
782{ 805{
783 struct symbol *sym; 806 struct symbol *sym;
@@ -785,6 +808,7 @@ int conf_write_autoconf(void)
785 const char *name; 808 const char *name;
786 FILE *out, *tristate, *out_h; 809 FILE *out, *tristate, *out_h;
787 int i; 810 int i;
811 int fct_val;
788 812
789 sym_clear_all_valid(); 813 sym_clear_all_valid();
790 814
@@ -825,6 +849,7 @@ int conf_write_autoconf(void)
825 rootmenu.prompt->text); 849 rootmenu.prompt->text);
826 850
827 for_all_symbols(i, sym) { 851 for_all_symbols(i, sym) {
852 fct_val = 1;
828 sym_calc_value(sym); 853 sym_calc_value(sym);
829 if (!(sym->flags & SYMBOL_WRITE) || !sym->name) 854 if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
830 continue; 855 continue;
@@ -838,12 +863,14 @@ int conf_write_autoconf(void)
838 case S_TRISTATE: 863 case S_TRISTATE:
839 switch (sym_get_tristate_value(sym)) { 864 switch (sym_get_tristate_value(sym)) {
840 case no: 865 case no:
866 fct_val = 0;
841 break; 867 break;
842 case mod: 868 case mod:
843 fprintf(tristate, "%s%s=M\n", 869 fprintf(tristate, "%s%s=M\n",
844 CONFIG_, sym->name); 870 CONFIG_, sym->name);
845 fprintf(out_h, "#define %s%s_MODULE 1\n", 871 fprintf(out_h, "#define %s%s_MODULE 1\n",
846 CONFIG_, sym->name); 872 CONFIG_, sym->name);
873 fct_val = 2;
847 break; 874 break;
848 case yes: 875 case yes:
849 if (sym->type == S_TRISTATE) 876 if (sym->type == S_TRISTATE)
@@ -870,8 +897,10 @@ int conf_write_autoconf(void)
870 CONFIG_, sym->name, str); 897 CONFIG_, sym->name, str);
871 break; 898 break;
872 default: 899 default:
900 fct_val = 0;
873 break; 901 break;
874 } 902 }
903 conf_write_function_autoconf(out_h, CONFIG_, sym->name, fct_val);
875 } 904 }
876 fclose(out); 905 fclose(out);
877 fclose(tristate); 906 fclose(tristate);