vserver 1.9.5.x5
[linux-2.6.git] / scripts / kconfig / confdata.c
index 90247d2..1e82ae3 100644 (file)
@@ -8,6 +8,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 #include <unistd.h>
 
 #define LKC_DIRECT_LINK
@@ -26,10 +27,10 @@ const char *conf_confnames[] = {
        NULL,
 };
 
-static char *conf_expand_value(const char *in)
+static char *conf_expand_value(const signed char *in)
 {
        struct symbol *sym;
-       const char *src;
+       const signed char *src;
        static char res_value[SYMBOL_MAXLENGTH];
        char *dst, name[SYMBOL_MAXLENGTH];
 
@@ -268,6 +269,9 @@ int conf_write(const char *name)
        char dirname[128], tmpname[128], newname[128];
        int type, l;
        const char *str;
+       time_t now;
+       int use_timestamp = 1;
+       char *env;
 
        dirname[0] = 0;
        if (name && name[0]) {
@@ -291,7 +295,7 @@ int conf_write(const char *name)
        } else
                basename = conf_def_filename;
 
-       sprintf(newname, "%s.tmpconfig.%d", dirname, getpid());
+       sprintf(newname, "%s.tmpconfig.%d", dirname, (int)getpid());
        out = fopen(newname, "w");
        if (!out)
                return 1;
@@ -301,14 +305,31 @@ int conf_write(const char *name)
                if (!out_h)
                        return 1;
        }
+       sym = sym_lookup("KERNELRELEASE", 0);
+       sym_calc_value(sym);
+       time(&now);
+       env = getenv("KCONFIG_NOTIMESTAMP");
+       if (env && *env)
+               use_timestamp = 0;
+
        fprintf(out, "#\n"
                     "# Automatically generated make config: don't edit\n"
-                    "#\n");
+                    "# Linux kernel version: %s\n"
+                    "%s%s"
+                    "#\n",
+                    sym_get_string_value(sym),
+                    use_timestamp ? "# " : "",
+                    use_timestamp ? ctime(&now) : "");
        if (out_h)
                fprintf(out_h, "/*\n"
                               " * Automatically generated C config: don't edit\n"
+                              " * Linux kernel version: %s\n"
+                              "%s%s"
                               " */\n"
-                              "#define AUTOCONF_INCLUDED\n");
+                              "#define AUTOCONF_INCLUDED\n",
+                              sym_get_string_value(sym),
+                              use_timestamp ? " * " : "",
+                              use_timestamp ? ctime(&now) : "");
 
        if (!sym_change_count)
                sym_clear_all_valid();