mirror of
https://github.com/sheumann/hush.git
synced 2024-12-27 01:32:08 +00:00
build system: check for ENABLE_, USE_ and SKIP_ (not only for CONFIG_)
This commit is contained in:
parent
b560577cb2
commit
9fa9950784
@ -2,6 +2,9 @@
|
|||||||
* which depend on other symbols, which themself are off.
|
* which depend on other symbols, which themself are off.
|
||||||
* Provide them here by hand. Need a better idea. */
|
* 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
|
#ifndef ENABLE_FEATURE_GUNZIP_UNCOMPRESS
|
||||||
#define ENABLE_FEATURE_GUNZIP_UNCOMPRESS 0
|
#define ENABLE_FEATURE_GUNZIP_UNCOMPRESS 0
|
||||||
#define USE_FEATURE_GUNZIP_UNCOMPRESS(...)
|
#define USE_FEATURE_GUNZIP_UNCOMPRESS(...)
|
||||||
|
@ -114,10 +114,12 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
/* bbox: not needed
|
||||||
#define INT_CONF ntohl(0x434f4e46)
|
#define INT_CONF ntohl(0x434f4e46)
|
||||||
#define INT_ONFI ntohl(0x4f4e4649)
|
#define INT_ONFI ntohl(0x4f4e4649)
|
||||||
#define INT_NFIG ntohl(0x4e464947)
|
#define INT_NFIG ntohl(0x4e464947)
|
||||||
#define INT_FIG_ ntohl(0x4649475f)
|
#define INT_FIG_ ntohl(0x4649475f)
|
||||||
|
*/
|
||||||
|
|
||||||
char *target;
|
char *target;
|
||||||
char *depfile;
|
char *depfile;
|
||||||
@ -222,30 +224,32 @@ void use_config(char *m, int slen)
|
|||||||
|
|
||||||
void parse_config_file(char *map, size_t len)
|
void parse_config_file(char *map, size_t len)
|
||||||
{
|
{
|
||||||
int *end = (int *) (map + len);
|
/* modified for bbox */
|
||||||
/* start at +1, so that p can never be < map */
|
char *end = map + len;
|
||||||
int *m = (int *) map + 1;
|
char *p = map;
|
||||||
char *p, *q;
|
char *q;
|
||||||
|
int off;
|
||||||
|
|
||||||
for (; m < end; m++) {
|
for (; p < end; p++) {
|
||||||
if (*m == INT_CONF) { p = (char *) m ; goto conf; }
|
if (!memcmp(p, "CONFIG_", 7)) goto conf7;
|
||||||
if (*m == INT_ONFI) { p = (char *) m-1; goto conf; }
|
if (!memcmp(p, "ENABLE_", 7)) goto conf7;
|
||||||
if (*m == INT_NFIG) { p = (char *) m-2; goto conf; }
|
if (!memcmp(p, "USE_", 4)) goto conf4;
|
||||||
if (*m == INT_FIG_) { p = (char *) m-3; goto conf; }
|
if (!memcmp(p, "SKIP_", 5)) goto conf5;
|
||||||
continue;
|
continue;
|
||||||
|
conf4: off = 4; goto conf;
|
||||||
|
conf5: off = 5; goto conf;
|
||||||
|
conf7: off = 7;
|
||||||
conf:
|
conf:
|
||||||
if (p > map + len - 7)
|
if (p > map + len - off)
|
||||||
continue;
|
continue;
|
||||||
if (memcmp(p, "CONFIG_", 7))
|
for (q = p + off; q < map + len; q++) {
|
||||||
continue;
|
|
||||||
for (q = p + 7; q < map + len; q++) {
|
|
||||||
if (!(isalnum(*q) || *q == '_'))
|
if (!(isalnum(*q) || *q == '_'))
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
found:
|
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)
|
void traps(void)
|
||||||
{
|
{
|
||||||
|
/* bbox: not needed
|
||||||
static char test[] __attribute__((aligned(sizeof(int)))) = "CONF";
|
static char test[] __attribute__((aligned(sizeof(int)))) = "CONF";
|
||||||
|
|
||||||
if (*(int *)test != INT_CONF) {
|
if (*(int *)test != INT_CONF) {
|
||||||
@ -373,6 +378,7 @@ void traps(void)
|
|||||||
*(int *)test);
|
*(int *)test);
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
Loading…
Reference in New Issue
Block a user