kconfig: get CONFIG_ prefix from the environment
authorYann E. MORIN <yann.morin.1998@free.fr>
Fri, 19 Oct 2012 23:06:25 +0000 (01:06 +0200)
committerMichal Marek <mmarek@suse.cz>
Tue, 20 Nov 2012 10:20:08 +0000 (11:20 +0100)
Currently, the CONFIG_ prefix is hard-coded in the kconfig frontends
executables. This means that two projects that use kconfig with
different prefixes can not share the same kconfig frontends.

Instead of hard-coding the prefix in the frontends, get it from the
environment, and revert back to hard-coded value if not found.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/kconfig/gconf.c
scripts/kconfig/lkc.h
scripts/kconfig/nconf.c

index adc230638c5b141ceaa2cf9b25d35f99324c19b6..f2bee70e26f4940061c97add6dafbf273b272dcd 100644 (file)
@@ -10,6 +10,7 @@
 #  include <config.h>
 #endif
 
+#include <stdlib.h>
 #include "lkc.h"
 #include "images.c"
 
@@ -22,7 +23,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <time.h>
-#include <stdlib.h>
 
 //#define DEBUG
 
index 7aa9db0b2a7776513bfb7ad7f9a79d567509861a..7577a7fbb405f7c2d4c585b4f88ab687e90c863a 100644 (file)
@@ -41,7 +41,7 @@ extern "C" {
 #endif
 static inline const char *CONFIG_prefix(void)
 {
-       return CONFIG_;
+       return getenv( "CONFIG_" ) ?: CONFIG_;
 }
 #undef CONFIG_
 #define CONFIG_ CONFIG_prefix()
index 261f926d8f4b28ec6f1d4d5a1de8b89491b1cac1..ce93e879a29c8fcd71458889b632c8ea43c654db 100644 (file)
@@ -7,6 +7,7 @@
  */
 #define _GNU_SOURCE
 #include <string.h>
+#include <stdlib.h>
 
 #include "lkc.h"
 #include "nconf.h"