diff options
author | Arch Librarian <arch@canonical.com> | 2005-07-14 13:04:51 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2005-07-14 13:04:51 +0000 |
commit | d192f980069fac607473d00edb01af76ee5a1faa (patch) | |
tree | 0baba3cf7c535b398c436d241b1f241088b7a00d /pkg.c | |
parent | 0f8e43f49afecd763cf139d21ff6b0d4a9a77ce4 (diff) | |
download | pkg-config-d192f980069fac607473d00edb01af76ee5a1faa.tar.gz |
2002-02-01 Havoc Pennington <hp@redhat.com>
Author: hp
Date: 2002-02-01 22:24:24 GMT
2002-02-01 Havoc Pennington <hp@redhat.com>
Throughout: cast chars to guchar before passing to isspace, etc.,
noted by Morten Welinder
* pkg.c (verify_package): actually strip system -I/-L out of the
cflags/libs, unless you set an environment variable asking to
leave them in.
Diffstat (limited to 'pkg.c')
-rw-r--r-- | pkg.c | 56 |
1 files changed, 48 insertions, 8 deletions
@@ -557,7 +557,8 @@ verify_package (Package *pkg) GSList *iter; GSList *requires_iter; GSList *conflicts_iter; - + int count; + /* Be sure we have the required fields */ if (pkg->key == NULL) @@ -662,6 +663,7 @@ verify_package (Package *pkg) g_slist_free (requires); g_slist_free (conflicts); + count = 0; iter = pkg->I_cflags; while (iter != NULL) { @@ -673,10 +675,48 @@ verify_package (Package *pkg) { verbose_error ("Package %s has -I/usr/include in Cflags; this may cause problems and is not recommended\n", pkg->name); + if (g_getenv ("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS") == NULL) + { + iter->data = NULL; + ++count; + debug_spew ("Removing -I/usr/include from cflags for %s\n", pkg->key); + } + } + + iter = iter->next; + } + + while (count) + { + pkg->I_cflags = g_slist_remove (pkg->I_cflags, NULL); + --count; + } + + count = 0; + iter = pkg->L_libs; + while (iter != NULL) + { + if (strcmp (iter->data, "-L/usr/lib") == 0 || + strcmp (iter->data, "-L /usr/lib") == 0) + { + verbose_error ("Package %s has -L/usr/lib in Libs; this may cause problems and is not recommended\n", + pkg->name); + if (g_getenv ("PKG_CONFIG_ALLOW_SYSTEM_LIBS") == NULL) + { + iter->data = NULL; + ++count; + debug_spew ("Removing -I/usr/lib from libs for %s\n", pkg->key); + } } iter = iter->next; } + + while (count) + { + pkg->L_libs = g_slist_remove (pkg->L_libs, NULL); + --count; + } } static char* @@ -1054,8 +1094,8 @@ static int rpmvercmp(const char * a, const char * b) { /* loop through each version segment of str1 and str2 and compare them */ while (*one && *two) { - while (*one && !isalnum(*one)) one++; - while (*two && !isalnum(*two)) two++; + while (*one && !isalnum((guchar)*one)) one++; + while (*two && !isalnum((guchar)*two)) two++; str1 = one; str2 = two; @@ -1063,13 +1103,13 @@ static int rpmvercmp(const char * a, const char * b) { /* grab first completely alpha or completely numeric segment */ /* leave one and two pointing to the start of the alpha or numeric */ /* segment and walk str1 and str2 to end of segment */ - if (isdigit(*str1)) { - while (*str1 && isdigit(*str1)) str1++; - while (*str2 && isdigit(*str2)) str2++; + if (isdigit((guchar)*str1)) { + while (*str1 && isdigit((guchar)*str1)) str1++; + while (*str2 && isdigit((guchar)*str2)) str2++; isnum = 1; } else { - while (*str1 && isalpha(*str1)) str1++; - while (*str2 && isalpha(*str2)) str2++; + while (*str1 && isalpha((guchar)*str1)) str1++; + while (*str2 && isalpha((guchar)*str2)) str2++; isnum = 0; } |