summaryrefslogtreecommitdiff
path: root/scripts/kconfig/confdata.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/confdata.c')
-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 2bafd9a7c8da..a1a9872e4a2d 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -768,6 +768,29 @@ out:
return res;
}
+static void conf_write_function_autoconf(FILE *out, char* conf, char* name,
+ int val)
+{
+ char c;
+ char *tmp, *d;
+
+ d = strdup(conf);
+ tmp = d;
+ while ((c = *conf++))
+ *d++ = tolower(c);
+
+ fprintf(out, "#define %sis_", tmp);
+ free(tmp);
+
+ d = strdup(name);
+ tmp = d;
+ while ((c = *name++))
+ *d++ = tolower(c);
+ fprintf(out, "%s%s() %d\n", tmp, (val > 1) ? "_module" : "",
+ val ? 1 : 0);
+ free(tmp);
+}
+
int conf_write_autoconf(void)
{
struct symbol *sym;
@@ -775,6 +798,7 @@ int conf_write_autoconf(void)
const char *name;
FILE *out, *tristate, *out_h;
int i;
+ int fct_val;
sym_clear_all_valid();
@@ -815,6 +839,7 @@ int conf_write_autoconf(void)
rootmenu.prompt->text);
for_all_symbols(i, sym) {
+ fct_val = 1;
sym_calc_value(sym);
if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
continue;
@@ -828,12 +853,14 @@ int conf_write_autoconf(void)
case S_TRISTATE:
switch (sym_get_tristate_value(sym)) {
case no:
+ fct_val = 0;
break;
case mod:
fprintf(tristate, "%s%s=M\n",
CONFIG_, sym->name);
fprintf(out_h, "#define %s%s_MODULE 1\n",
CONFIG_, sym->name);
+ fct_val = 2;
break;
case yes:
if (sym->type == S_TRISTATE)
@@ -860,8 +887,10 @@ int conf_write_autoconf(void)
CONFIG_, sym->name, str);
break;
default:
+ fct_val = 0;
break;
}
+ conf_write_function_autoconf(out_h, CONFIG_, sym->name, fct_val);
}
fclose(out);
fclose(tristate);