File pkg-config-lib64-excludes.patch of Package pkg-config

=== modified file 'pkg.c'
--- pkg.c	2008-03-23 20:39:07 +0000
+++ pkg.c	2008-06-06 18:49:58 +0000
@@ -936,31 +936,44 @@
   g_slist_foreach (system_directories, (GFunc) g_free, NULL);
   g_slist_free (system_directories);
 
+
+  system_directories = g_slist_prepend (NULL, "/usr/lib");
 #ifdef PREFER_LIB64
-#define SYSTEM_LIBDIR "/usr/lib64"
-#else
-#define SYSTEM_LIBDIR "/usr/lib"
+  system_directories = g_slist_prepend (system_directories, "/usr/lib64");
 #endif
   count = 0;
   iter = pkg->L_libs;
   while (iter != NULL)
     {
-      if (strcmp (iter->data, "-L" SYSTEM_LIBDIR) == 0 ||
-          strcmp (iter->data, "-L " SYSTEM_LIBDIR) == 0)
+      GSList *subiter = system_directories;
+      while (subiter != NULL)
         {
-          debug_spew ("Package %s has -L" SYSTEM_LIBDIR " in Libs\n",
-                      pkg->name);
-          if (g_getenv ("PKG_CONFIG_ALLOW_SYSTEM_LIBS") == NULL)
-            {              
-              iter->data = NULL;
-              ++count;
-              debug_spew ("Removing -L" SYSTEM_LIBDIR " from libs for %s\n", pkg->key);
+          gboolean is_system = FALSE;
+          const char *linker_arg = iter->data;
+          const char *system_libpath = subiter->data;
+          if (strncmp (linker_arg, "-L ", 3) == 0 &&
+              strcmp (linker_arg + 3, system_libpath) == 0)
+            is_system = TRUE;
+          else if (strncmp (linker_arg, "-L", 2) == 0 &&
+              strcmp (linker_arg + 2, system_libpath) == 0)
+            is_system = TRUE;
+          if (is_system)
+            {
+              debug_spew ("Package %s has -L %s in Libs\n",
+                          pkg->name, system_libpath);
+              if (g_getenv ("PKG_CONFIG_ALLOW_SYSTEM_LIBS") == NULL)
+                {              
+                  iter->data = NULL;
+                  ++count;
+                  debug_spew ("Removing -L %s from libs for %s\n", system_libpath, pkg->key);
+                  break;
+                }
             }
+          subiter = subiter->next;
         }
-
       iter = iter->next;
     }
-#undef SYSTEM_LIBDIR
+  g_slist_free (system_directories);
 
   while (count)
     {