Index: makefile.vc
==================================================================
--- makefile.vc
+++ makefile.vc
@@ -1,10 +1,11 @@
 # $Id: $
 #
 # NMAKE Makefile to build libspatialite on Windows
 #
 !INCLUDE nmake.opt
+INSTDIR=$(LIBRARY_PREFIX)
 
 LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.obj \
 	src\gaiaexif\gaia_exif.obj src\gaiageo\gg_advanced.obj \
 	src\gaiageo\gg_endian.obj src\gaiageo\gg_ewkt.obj \
 	src\gaiageo\gg_geodesic.obj src\gaiageo\gg_geoJSON.obj \
@@ -94,11 +95,11 @@
 	src\topology\net_callbacks.obj src\topology\topo_callbacks.obj
 
 SPATIALITE_DLL = spatialite$(VERSION).dll
 
 CFLAGS = /nologo -I.\src\headers -I.\src\topology \
-	-I. -IC:\OSGeo4W\include $(OPTFLAGS)
+	-I. -I$(LIBRARY_INC) $(OPTFLAGS)
 
 default:	all
 
 all: spatialite.lib spatialite_i.lib
 #$(EXIF_LOADER_EXE)
@@ -110,14 +111,14 @@
 $(SPATIALITE_DLL):	spatialite_i.lib
 
 spatialite_i.lib:     $(LIBOBJ)
 	link /dll /out:$(SPATIALITE_DLL) \
 		/implib:spatialite_i.lib $(LIBOBJ) \
-		C:\OSGeo4W\lib\proj_i.lib C:\OSGeo4W\lib\geos_c.lib \
-		C:\OSGeo4w\lib\freexl_i.lib C:\OSGeo4w\lib\iconv.lib \
-		C:\OSGeo4W\lib\sqlite3_i.lib C:\OSGeo4W\lib\zlib.lib \
-		C:\OSGeo4W\lib\libxml2.lib C:\OSGeo4W\lib\librttopo.lib
+		$(LIBRARY_LIB)\proj.lib $(LIBRARY_LIB)\geos_c.lib \
+		$(LIBRARY_LIB)\freexl_i.lib $(LIBRARY_LIB)\iconv.lib \
+		$(LIBRARY_LIB)\sqlite3.lib $(LIBRARY_LIB)\zlib.lib \
+		$(LIBRARY_LIB)\libxml2.lib $(LIBRARY_LIB)\charset.lib
 	if exist $(SPATIALITE_DLL).manifest mt -manifest \
 		$(SPATIALITE_DLL).manifest -outputresource:$(SPATIALITE_DLL);2
 		
 .c.obj:
 	$(CC) $(CFLAGS) /c $*.c /Fo$@

Index: makefile64.vc
==================================================================
--- makefile64.vc
+++ makefile64.vc
@@ -1,10 +1,11 @@
 # $Id: $
 #
 # NMAKE Makefile to build libspatialite on Windows
 #
 !INCLUDE nmake64.opt
+INSTDIR=$(LIBRARY_PREFIX)
 
 LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.obj \
 	src\gaiaexif\gaia_exif.obj src\gaiageo\gg_advanced.obj \
 	src\gaiageo\gg_endian.obj src\gaiageo\gg_ewkt.obj \
 	src\gaiageo\gg_geodesic.obj src\gaiageo\gg_geoJSON.obj \
@@ -94,11 +95,11 @@
 	src\topology\net_callbacks.obj src\topology\topo_callbacks.obj
 
 SPATIALITE_DLL = spatialite$(VERSION).dll
 
 CFLAGS = /nologo -I.\src\headers -I.\src\topology \
-	-I. -IC:\OSGeo4W64\include -IC:\OSGeo4W64\include\libxml2 $(OPTFLAGS)
+	-I. -I$(LIBRARY_INC) -I$(LIBRARY_INC)\libxml2 $(OPTFLAGS)
 
 default:	all
 
 all: spatialite.lib spatialite_i.lib
 #$(EXIF_LOADER_EXE)
@@ -110,14 +111,14 @@
 $(SPATIALITE_DLL):	spatialite_i.lib
 
 spatialite_i.lib:     $(LIBOBJ)
 	link /dll /out:$(SPATIALITE_DLL) \
 		/implib:spatialite_i.lib $(LIBOBJ) \
-		C:\OSGeo4W64\lib\proj_i.lib C:\OSGeo4W64\lib\geos_c.lib \
-		C:\OSGeo4w64\lib\freexl_i.lib C:\OSGeo4w64\lib\iconv.lib \
-		C:\OSGeo4W64\lib\sqlite3_i.lib C:\OSGeo4W64\lib\zlib.lib \
-		C:\OSGeo4W64\lib\libxml2.lib C:\OSGeo4W64\lib\librttopo.lib
+ 		$(LIBRARY_LIB)\proj.lib $(LIBRARY_LIB)\geos_c.lib \
+ 		$(LIBRARY_LIB)\freexl_i.lib $(LIBRARY_LIB)\iconv.lib \
+ 		$(LIBRARY_LIB)\sqlite3.lib $(LIBRARY_LIB)\zlib.lib \
+ 		$(LIBRARY_LIB)\libxml2.lib $(LIBRARY_LIB)\charset.lib
 	if exist $(SPATIALITE_DLL).manifest mt -manifest \
 		$(SPATIALITE_DLL).manifest -outputresource:$(SPATIALITE_DLL);2
 		
 .c.obj:
 	$(CC) $(CFLAGS) /c $*.c /Fo$@

Index: makefile_mod.vc
==================================================================
--- makefile_mod.vc
+++ makefile_mod.vc
@@ -1,10 +1,11 @@
 # $Id: $
 #
 # NMAKE Makefile to build libspatialite on Windows
 #
 !INCLUDE nmake_mod.opt
+INSTDIR=$(LIBRARY_PREFIX)
 
 LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.obj \
 	src\gaiaexif\gaia_exif.obj src\gaiageo\gg_advanced.obj \
 	src\gaiageo\gg_endian.obj src\gaiageo\gg_ewkt.obj \
 	src\gaiageo\gg_geodesic.obj src\gaiageo\gg_geoJSON.obj \
@@ -94,11 +95,11 @@
 	src\topology\net_callbacks.obj src\topology\topo_callbacks.obj
 	
 MOD_SPATIALITE_DLL = mod_spatialite$(VERSION).dll
 
 CFLAGS = /nologo -I.\src\headers -I.\src\topology \
-	-I. -IC:\OSGeo4W\include $(OPTFLAGS)
+	-I. -I$(LIBRARY_INC) $(OPTFLAGS)
 
 default:	all
 
 all: mod_spatialite.lib mod_spatialite_i.lib
 #$(EXIF_LOADER_EXE)
@@ -110,14 +111,14 @@
 $(MOD_SPATIALITE_DLL):	mod_spatialite_i.lib
 
 mod_spatialite_i.lib:     $(LIBOBJ)
 	link /dll /out:$(MOD_SPATIALITE_DLL) \
 		/implib:mod_spatialite_i.lib $(LIBOBJ) \
-		C:\OSGeo4W\lib\proj_i.lib C:\OSGeo4W\lib\geos_c.lib \
-		C:\OSGeo4w\lib\freexl_i.lib C:\OSGeo4w\lib\iconv.lib \
-		C:\OSGeo4W\lib\sqlite3_i.lib C:\OSGeo4W\lib\zlib.lib \
-		C:\OSGeo4W\lib\libxml2.lib C:\OSGeo4W\lib\librttopo.lib
+		$(LIBRARY_LIB)\proj.lib $(LIBRARY_LIB)\geos_c.lib \
+		$(LIBRARY_LIB)\freexl_i.lib $(LIBRARY_LIB)\iconv.lib \
+		$(LIBRARY_LIB)\sqlite3.lib $(LIBRARY_LIB)\zlib.lib \
+		$(LIBRARY_LIB)\libxml2.lib $(LIBRARY_LIB)\charset.lib
 	if exist $(MOD_SPATIALITE_DLL).manifest mt -manifest \
 		$(MOD_SPATIALITE_DLL).manifest -outputresource:$(MOD_SPATIALITE_DLL);2
 		
 .c.obj:
 	$(CC) $(CFLAGS) /c $*.c /Fo$@

Index: makefile_mod64.vc
==================================================================
--- makefile_mod64.vc
+++ makefile_mod64.vc
@@ -1,10 +1,11 @@
 # $Id: $
 #
 # NMAKE Makefile to build libspatialite on Windows
 #
 !INCLUDE nmake_mod64.opt
+INSTDIR=$(LIBRARY_PREFIX)
 
 LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.obj \
 	src\gaiaexif\gaia_exif.obj src\gaiageo\gg_advanced.obj \
 	src\gaiageo\gg_endian.obj src\gaiageo\gg_ewkt.obj \
 	src\gaiageo\gg_geodesic.obj src\gaiageo\gg_geoJSON.obj \
@@ -94,11 +95,11 @@
 	src\topology\net_callbacks.obj src\topology\topo_callbacks.obj
 	
 MOD_SPATIALITE_DLL = mod_spatialite$(VERSION).dll
 
 CFLAGS = /nologo -I.\src\headers -I.\src\topology \
-	-I. -IC:\OSGeo4W64\include -IC:\OSGeo4W64\include\libxml2 $(OPTFLAGS)
+	-I. -I$(LIBRARY_INC) -I$(LIBRARY_INC)\libxml2 $(OPTFLAGS)
 
 default:	all
 
 all: mod_spatialite.lib mod_spatialite_i.lib
 #$(EXIF_LOADER_EXE)
@@ -110,14 +111,14 @@
 $(MOD_SPATIALITE_DLL):	mod_spatialite_i.lib
 
 mod_spatialite_i.lib:     $(LIBOBJ)
 	link /dll /out:$(MOD_SPATIALITE_DLL) \
 		/implib:mod_spatialite_i.lib $(LIBOBJ) \
-		C:\OSGeo4W64\lib\proj_i.lib C:\OSGeo4W64\lib\geos_c.lib \
-		C:\OSGeo4w64\lib\freexl_i.lib C:\OSGeo4w64\lib\iconv.lib \
-		C:\OSGeo4W64\lib\sqlite3_i.lib C:\OSGeo4W64\lib\zlib.lib \
-		C:\OSGeo4W64\lib\libxml2.lib C:\OSGeo4W64\lib\librttopo.lib
+ 		$(LIBRARY_LIB)\proj.lib $(LIBRARY_LIB)\geos_c.lib \
+ 		$(LIBRARY_LIB)\freexl_i.lib $(LIBRARY_LIB)\iconv.lib \
+ 		$(LIBRARY_LIB)\sqlite3.lib $(LIBRARY_LIB)\zlib.lib \
+ 		$(LIBRARY_LIB)\libxml2.lib $(LIBRARY_LIB)\charset.lib
 	if exist $(MOD_SPATIALITE_DLL).manifest mt -manifest \
 		$(MOD_SPATIALITE_DLL).manifest -outputresource:$(MOD_SPATIALITE_DLL);2
 		
 .c.obj:
 	$(CC) $(CFLAGS) /c $*.c /Fo$@

Index: src/headers/spatialite/gaiaconfig-msvc.h
==================================================================
--- src/headers/spatialite/gaiaconfig-msvc.h
+++ src/headers/spatialite/gaiaconfig-msvc.h
@@ -1,19 +1,19 @@
 /* ./src/headers/spatialite/gaiaconfig-msvc.h.  Generated from gaiaconfig-msvc.h.in by configure.  */
 /* ./src/headers/spatialite/gaiaconfig-msvc.h.in - manually maintained */
 
 /* Should be defined in order to enable GCP support. */
-#define ENABLE_GCP 1
+#undef ENABLE_GCP
 
 /* Should be defined in order to enable GeoPackage support. */
 #define ENABLE_GEOPACKAGE 1
 
 /* Should be defined in order to enable LIBXML2 support. */
 #define ENABLE_LIBXML2 1
 
 /* Should be defined in order to enable RTTOPO support. */
-#define ENABLE_RTTOPO 1
+#undef ENABLE_RTTOPO
 
 /* Should be defined in order to enable GEOS_370 support. */
 #define GEOS_370 1
 
 /* Should be defined in order to enable GEOS_ADVANCED support. */

Index: src/headers/spatialite/gaiaconfig-msvc.h.in
==================================================================
--- src/headers/spatialite/gaiaconfig-msvc.h.in
+++ src/headers/spatialite/gaiaconfig-msvc.h.in
@@ -8,11 +8,11 @@
 
 /* Should be defined in order to enable LIBXML2 support. */
 #define ENABLE_LIBXML2 1
 
 /* Should be defined in order to enable RTTOPO support. */
-#define ENABLE_RTTOPO 1
+#undef ENABLE_RTTOPO
 
 /* Should be defined in order to enable GEOS_370 support. */
 #define GEOS_370 1
 
 /* Should be defined in order to enable GEOS_ADVANCED support. */

Index: src/headers/spatialite/gaiaconfig.h
==================================================================
--- src/headers/spatialite/gaiaconfig.h
+++ src/headers/spatialite/gaiaconfig.h
@@ -1,10 +1,10 @@
 /* ./src/headers/spatialite/gaiaconfig.h.  Generated from gaiaconfig.h.in by configure.  */
 /* ./src/headers/spatialite/gaiaconfig.h.in - manually maintained */
 
 /* Should be defined in order to enable GCP support. */
-#define ENABLE_GCP 1
+#undef ENABLE_GCP
 
 /* Should be defined in order to enable GeoPackage support. */
 #define ENABLE_GEOPACKAGE 1
 
 /* Should be defined in order to enable LIBXML2 support. */
@@ -12,11 +12,11 @@
 
 /* Should be defined in order to enable MiniZIP support. */
 #define ENABLE_MINIZIP 1
 
 /* Should be defined in order to enable RTTOPO support. */
-#define ENABLE_RTTOPO 1
+#undef ENABLE_RTTOPO
 
 /* Should be defined in order to enable GEOS_370 support. */
 #define GEOS_370 1
 
 /* Should be defined in order to enable GEOS_3100 support. */
