Index: trunk/src/kmk/make.h
===================================================================
--- trunk/src/kmk/make.h	(revision 1884)
+++ trunk/src/kmk/make.h	(revision 1885)
@@ -644,6 +644,6 @@
 
 # define strcache_iscached(str)     strcache2_is_cached(&file_strcache, str)
-# define strcache_add(str)          strcache2_add(&file_strcache, str, strlen (str))
-# define strcache_add_len(str, len) strcache2_add(&file_strcache, str, len)
+# define strcache_add(str)          strcache2_add_file(&file_strcache, str, strlen (str))
+# define strcache_add_len(str, len) strcache2_add_file(&file_strcache, str, len)
 # ifdef CONFIG_WITH_INCLUDEDEP
 #  define strcache_add_prehashed(str, len, hash1, hash2) \
Index: trunk/src/kmk/strcache2.c
===================================================================
--- trunk/src/kmk/strcache2.c	(revision 1884)
+++ trunk/src/kmk/strcache2.c	(revision 1885)
@@ -61,4 +61,10 @@
 
 
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/* List of initialized string caches. */
+static struct strcache2 *strcache_head;
+
 
 
@@ -375,8 +381,9 @@
   struct strcache2_entry const *entry;
   unsigned int hash2;
-  unsigned int hash1 = cache->case_insensitive
-    ? strcache2_case_insensitive_hash_1 (str, length)
-    : strcache2_case_sensitive_hash_1 (str, length);
+  unsigned int hash1 = strcache2_case_sensitive_hash_1 (str, length);
   unsigned int idx;
+
+  assert (!cache->case_insensitive);
+
 
   cache->lookup_count++;
@@ -394,7 +401,5 @@
       cache->collision_1st_count++;
 
-      hash2 = cache->case_insensitive
-        ? strcache2_case_insensitive_hash_2 (str, length)
-        : strcache2_case_sensitive_hash_2 (str, length);
+      hash2 = strcache2_case_sensitive_hash_2 (str, length);
       idx += hash2;
       idx &= cache->hash_mask;
@@ -489,4 +494,61 @@
 }
 
+#if defined(HAVE_CASE_INSENSITIVE_FS)
+
+/* The public add/lookup string interface for case insensitive strings. */
+const char *
+strcache2_iadd (struct strcache2 *cache, const char *str, unsigned int length)
+{
+  struct strcache2_entry const *entry;
+  unsigned int hash2;
+  unsigned int hash1 = strcache2_case_insensitive_hash_1 (str, length);
+  unsigned int idx;
+
+  assert (cache->case_insensitive);
+  cache->lookup_count++;
+
+  /* Lookup the entry in the hash table, hoping for an
+     early match. */
+  idx = hash1 & cache->hash_mask;
+  entry = cache->hash_tab[idx];
+  if (strcache2_is_equal (cache, entry, str, length, hash1))
+    return (const char *)(entry + 1);
+  if (!entry)
+    hash2 = 0;
+  else
+    {
+      cache->collision_1st_count++;
+
+      hash2 = strcache2_case_insensitive_hash_2 (str, length);
+      idx += hash2;
+      idx &= cache->hash_mask;
+      entry = cache->hash_tab[idx];
+      if (strcache2_is_equal (cache, entry, str, length, hash1))
+        return (const char *)(entry + 1);
+
+      if (entry)
+        {
+          cache->collision_2nd_count++;
+          do
+            {
+              idx += hash2;
+              idx &= cache->hash_mask;
+              entry = cache->hash_tab[idx];
+              cache->collision_3rd_count++;
+              if (strcache2_is_equal (cache, entry, str, length, hash1))
+                return (const char *)(entry + 1);
+            }
+          while (entry);
+        }
+    }
+
+  /* Not found, add it at IDX. */
+  return strcache2_enter_string (cache, idx, str, length, hash1, hash2);
+}
+
+/* strcache_ilookup later */
+
+#endif /* HAVE_CASE_INSENSITIVE_FS */
+
 /* Is the given string cached? returns 1 if it is, 0 if it isn't. */
 int
@@ -591,6 +653,4 @@
 
 
-/* List of initialized string caches. */
-static struct strcache2 *strcache_head;
 
 /* Initalizes a new cache. */
Index: trunk/src/kmk/strcache2.h
===================================================================
--- trunk/src/kmk/strcache2.h	(revision 1884)
+++ trunk/src/kmk/strcache2.h	(revision 1885)
@@ -74,4 +74,10 @@
 void strcache2_print_stats_all (const char *prefix);
 const char *strcache2_add (struct strcache2 *cache, const char *str, unsigned int length);
+const char *strcache2_iadd (struct strcache2 *cache, const char *str, unsigned int length);
+#ifdef HAVE_CASE_INSENSITIVE_FS
+# define strcache2_add_file(cache, str, length) strcache2_iadd((cache), (str), (length))
+#else
+# define strcache2_add_file(cache, str, length) strcache2_add((cache), (str), (length))
+#endif
 const char *strcache2_add_hashed (struct strcache2 *cache, const char *str, unsigned int length,
                                   unsigned int hash1, unsigned int hash2);
