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