main: fix --with-system-includedir and --with-system-libdir behaviour (closes #63)

pull/70/head
William Pitcock 2014-06-07 20:11:06 +00:00
parent 1f1feb0022
commit 912d1d9013
1 changed files with 20 additions and 6 deletions

26
main.c
View File

@ -59,18 +59,32 @@ FILE *error_msgout = NULL;
static bool static bool
fragment_has_system_dir(pkg_fragment_t *frag) fragment_has_system_dir(pkg_fragment_t *frag)
{ {
int check_flags = 0;
char *check_paths = NULL;
char *save, *chunk;
switch (frag->type) switch (frag->type)
{ {
case 'L': case 'L':
if ((want_flags & PKG_KEEP_SYSTEM_LIBS) == 0 && !strcasecmp(SYSTEM_LIBDIR, frag->data)) check_flags = PKG_KEEP_SYSTEM_LIBS;
return true; check_paths = strdup(SYSTEM_LIBDIR);
case 'I':
if ((want_flags & PKG_KEEP_SYSTEM_CFLAGS) == 0 && !strcasecmp(SYSTEM_INCLUDEDIR, frag->data))
return true;
default:
break; break;
case 'I':
check_flags = PKG_KEEP_SYSTEM_CFLAGS;
check_paths = strdup(SYSTEM_INCLUDEDIR);
break;
default:
return false;
} }
for (chunk = strtok_r(check_paths, ":", &save); chunk != NULL; chunk = strtok_r(NULL, ":", &save))
{
if ((want_flags & check_flags) == 0 && !strcmp(chunk, frag->data))
return true;
}
free(check_paths);
return false; return false;
} }