From 39c02c39b50f83a2d59d04a2791678a4420a81fd Mon Sep 17 00:00:00 2001
From: glenlow <devnull@localhost>
Date: Tue, 26 May 2009 04:30:20 +0000
Subject: [PATCH] carefully reapplied r1.83 without clobbering changes

---
 lib/gvc/gvplugin.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/lib/gvc/gvplugin.c b/lib/gvc/gvplugin.c
index ba3f127c4..4eeffdb8c 100644
--- a/lib/gvc/gvplugin.c
+++ b/lib/gvc/gvplugin.c
@@ -33,6 +33,10 @@
 
 #include	"const.h"
 
+#ifndef HAVE_STRCASECMP
+extern int strcasecmp(const char *s1, const char *s2);
+#endif
+
 /*
  * Define an apis array of name strings using an enumerated api_t as index.
  * The enumerated type is defined gvplugin.h.  The apis array is
@@ -293,17 +297,18 @@ gvplugin_available_t *gvplugin_load(GVC_t * gvc, api_t api, const char *str)
 	    continue;  /* types empty or mismatched */
  	if (dep && reqdep && strcmp(dep, reqdep))
 	    continue;  /* dependencies not empty, but mismatched */
-	if (! reqpkg)
-	    break; /* found with no packagename constraints */
-	if (strcmp(reqpkg, (*pnext)->package->name) == 0)
-	    break;  /* found with required matching packagname */
+	if (! reqpkg || strcmp(reqpkg, (*pnext)->package->name) == 0)
+	{
+		/* found with no packagename constraints, or with required matching packagname */
+    
+		if (dep && (apidep != api)) /* load dependency if needed, continue if can't find */
+			if (! (gvplugin_load(gvc, apidep, dep)))
+				continue;
+		break;
+    }
     }
     rv = *pnext;
 
-    if (dep && (apidep != api)) /* load dependency if needed */
-	if (! (gvplugin_load(gvc, apidep, dep)))
-	    rv = NULL;
-
     if (rv && rv->typeptr == NULL) {
 	library = gvplugin_library_load(gvc, rv->package->path);
 	if (library) {
-- 
2.40.0