diff -urN redland-1.0.9.orig/configure redland-1.0.9/configure
--- redland-1.0.9.orig/configure	2009-04-12 18:04:21.000000000 -0700
+++ redland-1.0.9/configure	2009-08-18 17:06:10.000000000 -0700
@@ -18163,7 +18163,7 @@
   sqlite_version=`$SQLITE_CONFIG --modversion 2>/dev/null`
 
 cat >>confdefs.h <<_ACEOF
-#define SQLITE_API $sqlite_api_version
+#define REDLAND_SQLITE_API $sqlite_api_version
 _ACEOF
 
 
diff -urN redland-1.0.9.orig/src/rdf_config.h.in redland-1.0.9/src/rdf_config.h.in
--- redland-1.0.9.orig/src/rdf_config.h.in	2009-04-12 18:04:50.000000000 -0700
+++ redland-1.0.9/src/rdf_config.h.in	2009-08-18 17:04:58.000000000 -0700
@@ -313,7 +313,7 @@
 #undef SIZEOF_UNSIGNED_LONG_LONG
 
 /* SQLite API version */
-#undef SQLITE_API
+#undef REDLAND_SQLITE_API
 
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
diff -urN redland-1.0.9.orig/src/rdf_storage_sqlite.c redland-1.0.9/src/rdf_storage_sqlite.c
--- redland-1.0.9.orig/src/rdf_storage_sqlite.c	2009-04-12 16:59:01.000000000 -0700
+++ redland-1.0.9/src/rdf_storage_sqlite.c	2009-08-18 17:03:52.000000000 -0700
@@ -45,7 +45,7 @@
 #include <rdf_storage.h>
 
 
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
 #include <sqlite3.h>
 #define sqlite_DB sqlite3
 #define sqlite_STATEMENT sqlite3_stmt
@@ -57,7 +57,7 @@
 #define sqlite_last_insert_rowid sqlite3_last_insert_rowid
 #endif
 
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
 #include <sqlite.h>
 #define sqlite_DB sqlite
 #define sqlite_STATEMENT sqlite_vm
@@ -68,11 +68,11 @@
 #endif
 
 
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
   #define GET_COLUMN_VALUE_TEXT(vm, col) sqlite3_column_text(vm, col)
   #define GET_COLUMN_VALUE_INT(vm, col) sqlite3_column_int(vm, col)
 #endif
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
   #define GET_COLUMN_VALUE_TEXT(vm, col) (unsigned char*)pazValue[col]
   #define GET_COLUMN_VALUE_INT(vm, col) atoi(pazValue[col])
 #endif
@@ -791,7 +791,7 @@
   librdf_storage_sqlite_instance* context=(librdf_storage_sqlite_instance*)storage->instance;
   int rc=SQLITE_OK;
   char *errmsg=NULL;
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
   int mode=0;
 #endif
   int db_file_exists=0;
@@ -804,13 +804,13 @@
   if(context->is_new && db_file_exists)
     unlink(context->name);
 
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
   context->db=NULL;
   rc=sqlite3_open(context->name, &context->db);
   if(rc != SQLITE_OK)
     errmsg=(char*)sqlite3_errmsg(context->db);
 #endif
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
   context->db=sqlite_open(context->name, mode, &errmsg);
   if(context->db == NULL)
     rc=SQLITE_ERROR;
@@ -819,7 +819,7 @@
     librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL,
                "SQLite database %s open failed - %s", 
                context->name, errmsg);
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
     sqlite_FREE(errmsg);
 #endif
     librdf_storage_sqlite_close(storage);
@@ -1279,7 +1279,7 @@
 
   LIBRDF_DEBUG2("SQLite prepare '%s'\n", request);
 
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
   status=sqlite3_prepare(context->db,
                          (const char*)request,
                          raptor_stringbuffer_length(sb),
@@ -1288,7 +1288,7 @@
   if(status != SQLITE_OK)
     errmsg=(char*)sqlite3_errmsg(context->db);
 #endif
-#if SQLITE_API == 2  
+#if REDLAND_SQLITE_API == 2  
   status=sqlite_compile(context->db,
                         (const char*)request,
                         &scontext->zTail,
@@ -1328,7 +1328,7 @@
                                       librdf_statement **statement,
                                       librdf_node **context_node) {
   int status=SQLITE_BUSY;
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
   int pN;
   const char **pazValue;   /* Column data */
   const char **pazColName; /* Column names and datatypes */
@@ -1342,10 +1342,10 @@
    * SQLITE_MISUSE.
   */
   do {
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
     status=sqlite3_step(vm);
 #endif
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
     status=sqlite_step(vm, &pN, &pazValue, &pazColName);
 #endif
     if(status == SQLITE_BUSY) {
@@ -1479,12 +1479,12 @@
   if(status == SQLITE_ERROR) {
     char *errmsg=NULL;
 
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
     status=sqlite3_finalize(vm);
     if(status != SQLITE_OK)
       errmsg=(char*)sqlite3_errmsg(scontext->db);
 #endif
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
     status=sqlite_finalize(vm, &errmsg);
 #endif
     if(status != SQLITE_OK) {
@@ -1492,7 +1492,7 @@
                  0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL,
                  "SQLite database %s finalize failed - %s (%d)", 
                  scontext->name, errmsg, status);
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
       sqlite_FREE(errmsg);
 #endif
     }
@@ -1583,12 +1583,12 @@
     char *errmsg=NULL;
     int status;
     
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
     status=sqlite3_finalize(scontext->vm);
     if(status != SQLITE_OK)
       errmsg=(char*)sqlite3_errmsg(scontext->sqlite_context->db);
 #endif
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
     status=sqlite_finalize(scontext->vm, &errmsg);
 #endif
     if(status != SQLITE_OK) {
@@ -1596,7 +1596,7 @@
                  0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL,
                  "SQLite database %s finalize failed - %s (%d)", 
                  scontext->sqlite_context->name, errmsg, status);
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
       sqlite_FREE(errmsg);
 #endif
     }
@@ -1734,7 +1734,7 @@
 
   LIBRDF_DEBUG2("SQLite prepare '%s'\n", request);
 
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
   status=sqlite3_prepare(context->db,
                          (const char*)request,
                          raptor_stringbuffer_length(sb),
@@ -1743,7 +1743,7 @@
   if(status != SQLITE_OK)
     errmsg=(char*)sqlite3_errmsg(context->db);
 #endif
-#if SQLITE_API == 2  
+#if REDLAND_SQLITE_API == 2  
   status=sqlite_compile(context->db,
                         (const char*)request,
                         &scontext->zTail, 
@@ -1856,12 +1856,12 @@
     char *errmsg=NULL;
     int status;
     
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
     status=sqlite3_finalize(scontext->vm);
     if(status != SQLITE_OK)
       errmsg=(char*)sqlite3_errmsg(scontext->sqlite_context->db);
 #endif
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
     status=sqlite_finalize(scontext->vm, &errmsg);
 #endif
     if(status != SQLITE_OK) {
@@ -1869,7 +1869,7 @@
                  0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL,
                  "SQLite database %s finalize failed - %s (%d)", 
                  scontext->sqlite_context->name, errmsg, status);
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
       sqlite_FREE(errmsg);
 #endif
     }
@@ -2180,7 +2180,7 @@
 
   LIBRDF_DEBUG2("SQLite prepare '%s'\n", request);
 
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
   status=sqlite3_prepare(context->db,
                          (const char*)request,
                          raptor_stringbuffer_length(sb),
@@ -2189,7 +2189,7 @@
   if(status != SQLITE_OK)
     errmsg=(char*)sqlite3_errmsg(context->db);
 #endif
-#if SQLITE_API == 2  
+#if REDLAND_SQLITE_API == 2  
   status=sqlite_compile(context->db,
                         (const char*)request,
                         &scontext->zTail,
@@ -2303,12 +2303,12 @@
     char *errmsg=NULL;
     int status;
     
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
     status=sqlite3_finalize(scontext->vm);
     if(status != SQLITE_OK)
       errmsg=(char*)sqlite3_errmsg(scontext->sqlite_context->db);
 #endif
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
     status=sqlite_finalize(scontext->vm, &errmsg);
 #endif
     if(status != SQLITE_OK) {
@@ -2316,7 +2316,7 @@
                  0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL,
                  "SQLite database %s finalize failed - %s (%d)", 
                  scontext->sqlite_context->name, errmsg, status);
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
       sqlite_FREE(errmsg);
 #endif
     }
@@ -2360,7 +2360,7 @@
                                               sqlite_STATEMENT *vm,
                                               librdf_node **context_node) {
   int status=SQLITE_BUSY;
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
   int pN;
   const char **pazValue;   /* Column data */
   const char **pazColName; /* Column names and datatypes */
@@ -2374,10 +2374,10 @@
    * SQLITE_MISUSE.
   */
   do {
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
     status=sqlite3_step(vm);
 #endif
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
     status=sqlite_step(vm, &pN, &pazValue, &pazColName);
 #endif
     if(status == SQLITE_BUSY) {
@@ -2429,12 +2429,12 @@
   if(status == SQLITE_ERROR) {
     char *errmsg=NULL;
 
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
     status=sqlite3_finalize(vm);
     if(status != SQLITE_OK)
       errmsg=(char*)sqlite3_errmsg(scontext->db);
 #endif
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
     status=sqlite_finalize(vm, &errmsg);
 #endif
     if(status != SQLITE_OK) {
@@ -2442,7 +2442,7 @@
                  0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL,
                  "SQLite database %s finalize failed - %s (%d)", 
                  scontext->name, errmsg, status);
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
       sqlite_FREE(errmsg);
 #endif
     }
@@ -2541,12 +2541,12 @@
     char *errmsg=NULL;
     int status;
     
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
     status=sqlite3_finalize(icontext->vm);
     if(status != SQLITE_OK)
       errmsg=(char*)sqlite3_errmsg(icontext->sqlite_context->db);
 #endif
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
     status=sqlite_finalize(icontext->vm, &errmsg);
 #endif
     if(status != SQLITE_OK) {
@@ -2554,7 +2554,7 @@
                  0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL,
                  "SQLite database %s finalize failed - %s (%d)", 
                  icontext->sqlite_context->name, errmsg, status);
-#if SQLITE_API == 2
+#if REDLAND_SQLITE_API == 2
       sqlite_FREE(errmsg);
 #endif
     }
@@ -2619,7 +2619,7 @@
 
   LIBRDF_DEBUG2("SQLite prepare '%s'\n", request);
 
-#if SQLITE_API == 3
+#if REDLAND_SQLITE_API == 3
   status=sqlite3_prepare(context->db,
                          (const char*)request,
                          raptor_stringbuffer_length(sb),
@@ -2628,7 +2628,7 @@
   if(status != SQLITE_OK)
     errmsg=(char*)sqlite3_errmsg(context->db);
 #endif
-#if SQLITE_API == 2  
+#if REDLAND_SQLITE_API == 2  
   status=sqlite_compile(context->db,
                         (const char*)request,
                         &icontext->zTail,
diff -urN redland-1.0.9.orig/src/win32_rdf_config.h redland-1.0.9/src/win32_rdf_config.h
--- redland-1.0.9.orig/src/win32_rdf_config.h	2009-04-07 21:31:14.000000000 -0700
+++ redland-1.0.9/src/win32_rdf_config.h	2009-08-18 17:04:41.000000000 -0700
@@ -249,7 +249,7 @@
 #define SIZEOF_UNSIGNED_LONG_LONG 8
 
 /* SQLite API version */
-#define SQLITE_API 3
+#define REDLAND_SQLITE_API 3
 
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
