build system: check for ENABLE_, USE_ and SKIP_ (not only for CONFIG_)
authorDenis Vlasenko <vda.linux@googlemail.com>
Thu, 19 Oct 2006 22:14:58 +0000 (22:14 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Thu, 19 Oct 2006 22:14:58 +0000 (22:14 -0000)
include/bb_config.h
scripts/basic/fixdep.c

index 1f96026..152eb13 100644 (file)
@@ -2,6 +2,9 @@
  * which depend on other symbols, which themself are off.
  * Provide them here by hand. Need a better idea. */
 
+/* This is especially bad because it forces rebuild of
+ * everything whenever any of these options change */
+
 #ifndef ENABLE_FEATURE_GUNZIP_UNCOMPRESS
 #define ENABLE_FEATURE_GUNZIP_UNCOMPRESS 0
 #define    USE_FEATURE_GUNZIP_UNCOMPRESS(...)
index cc2c654..df3446e 100644 (file)
 #include <ctype.h>
 #include <arpa/inet.h>
 
+/* bbox: not needed
 #define INT_CONF ntohl(0x434f4e46)
 #define INT_ONFI ntohl(0x4f4e4649)
 #define INT_NFIG ntohl(0x4e464947)
 #define INT_FIG_ ntohl(0x4649475f)
+*/
 
 char *target;
 char *depfile;
@@ -222,30 +224,32 @@ void use_config(char *m, int slen)
 
 void parse_config_file(char *map, size_t len)
 {
-       int *end = (int *) (map + len);
-       /* start at +1, so that p can never be < map */
-       int *m   = (int *) map + 1;
-       char *p, *q;
-
-       for (; m < end; m++) {
-               if (*m == INT_CONF) { p = (char *) m  ; goto conf; }
-               if (*m == INT_ONFI) { p = (char *) m-1; goto conf; }
-               if (*m == INT_NFIG) { p = (char *) m-2; goto conf; }
-               if (*m == INT_FIG_) { p = (char *) m-3; goto conf; }
+       /* modified for bbox */
+       char *end = map + len;
+       char *p = map;
+       char *q;
+       int off;
+
+       for (; p < end; p++) {
+               if (!memcmp(p, "CONFIG_", 7)) goto conf7;
+               if (!memcmp(p, "ENABLE_", 7)) goto conf7;
+               if (!memcmp(p, "USE_", 4)) goto conf4;
+               if (!memcmp(p, "SKIP_", 5)) goto conf5;
                continue;
+       conf4:  off = 4; goto conf;
+       conf5:  off = 5; goto conf;
+       conf7:  off = 7;
        conf:
-               if (p > map + len - 7)
+               if (p > map + len - off)
                        continue;
-               if (memcmp(p, "CONFIG_", 7))
-                       continue;
-               for (q = p + 7; q < map + len; q++) {
+               for (q = p + off; q < map + len; q++) {
                        if (!(isalnum(*q) || *q == '_'))
                                goto found;
                }
                continue;
 
        found:
-               use_config(p+7, q-p-7);
+               use_config(p+off, q-p-off);
        }
 }
 
@@ -366,6 +370,7 @@ void print_deps(void)
 
 void traps(void)
 {
+/* bbox: not needed
        static char test[] __attribute__((aligned(sizeof(int)))) = "CONF";
 
        if (*(int *)test != INT_CONF) {
@@ -373,6 +378,7 @@ void traps(void)
                        *(int *)test);
                exit(2);
        }
+*/
 }
 
 int main(int argc, char *argv[])