Index: trunk/zoo-services/gdal/grid/Makefile
===================================================================
--- trunk/zoo-services/gdal/grid/Makefile	(revision 106)
+++ trunk/zoo-services/gdal/grid/Makefile	(revision 284)
@@ -1,7 +1,9 @@
-CFLAGS=-I../../../zoo-kernel-svn/ -I./ `xml2-config --cflags` `python-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG
+ZRPATH=../../..
+include ${ZRPATH}/zoo-kernel/ZOOMakefile.opts
+CFLAGS=${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} -DLINUX_FREE_ISSUE #-DDEBUG
 CC=gcc
 
 cgi-env/service.zo: service.c
-	g++  -DZOO_SERVICE ${CFLAGS} -shared -fpic -o cgi-env/gdal_grid_service.zo ./service.c -lgdal
+	g++  -DZOO_SERVICE ${CFLAGS} -shared -fpic -o cgi-env/gdal_grid_service.zo ./service.c ${GDAL_LIBS} ${MACOS_LD_FLAGS}
 
 clean:
Index: trunk/zoo-services/gdal/grid/service.c
===================================================================
--- trunk/zoo-services/gdal/grid/service.c	(revision 106)
+++ trunk/zoo-services/gdal/grid/service.c	(revision 284)
@@ -879,14 +879,14 @@
       char *ext=new char[4];
       ext="tif";
-      if(strcmp(mtoupper((char*)pszFormat),"AAIGRID")==0)
+      if(strncasecmp(pszFormat,"AAIGRID",7)==0)
         ext="csv";
       else 
-        if(strcmp(mtoupper((char*)pszFormat),"PNG")==0)
+        if(strncasecmp(pszFormat,"PNG",3)==0)
           ext="png";
         else
-          if(strcmp(mtoupper((char*)pszFormat),"GIF")==0)
+          if(strncasecmp(pszFormat,"GIF",3)==0)
             ext="gif";
           else
-            if(strcmp(mtoupper((char*)pszFormat),"JPEG")==0)
+            if(strncasecmp(pszFormat,"JPEG",4)==0)
               ext="jpg";
       sprintf((char*)pszDest,"%s/%s.%s",tempPath,tmpMap->value,ext);
Index: trunk/zoo-services/gdal/profile/Makefile
===================================================================
--- trunk/zoo-services/gdal/profile/Makefile	(revision 106)
+++ trunk/zoo-services/gdal/profile/Makefile	(revision 284)
@@ -1,7 +1,9 @@
-CFLAGS=-I../../../zoo-kernel/ -I./ `xml2-config --cflags` `python-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG
+ZRPATH=../../..
+include ${ZRPATH}/zoo-kernel/ZOOMakefile.opts
+CFLAGS=${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} -DLINUX_FREE_ISSUE #-DDEBUG
 CC=gcc
 
 cgi-env/gdal_profile_service.zo: service.c
-	g++  -DZOO_SERVICE ${CFLAGS} -shared -fpic -o cgi-env/gdal_profile_service.zo ./service.c -lgdal
+	g++  -DZOO_SERVICE ${CFLAGS} -shared -fpic -o cgi-env/gdal_profile_service.zo ./service.c ${GDAL_LIBS} ${MACOS_LD_FLAGS}
 
 clean:
Index: trunk/zoo-services/gdal/translate/Makefile
===================================================================
--- trunk/zoo-services/gdal/translate/Makefile	(revision 106)
+++ trunk/zoo-services/gdal/translate/Makefile	(revision 284)
@@ -1,9 +1,10 @@
-CFLAGS=-I../../../zoo-kernel-svn/ -I./ `xml2-config --cflags` `python-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG
+ZRPATH=../../..
+include ${ZRPATH}/zoo-kernel/ZOOMakefile.opts
+CFLAGS=${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} -DLINUX_FREE_ISSUE #-DDEBUG
 CC=gcc
 
 cgi-env/service.zo: service.c
-	g++ ${CFLAGS} -shared -fpic -o cgi-env/service.zo ./service.c -lgdal
+	g++ ${CFLAGS} -shared -fpic -o cgi-env/service.zo ./service.c ${GDAL_LIBS} ${MACOS_LD_FLAGS}
 
 clean:
-	rm -f *.zo *.o *.tab.c *.tab.h *.sr.c* service_loader lex.* *.lreg *.sibling
-	rm -rf service_loader.dSYM
+	rm -f cgi-env/*.zo
Index: trunk/zoo-services/gdal/translate/service.c
===================================================================
--- trunk/zoo-services/gdal/translate/service.c	(revision 106)
+++ trunk/zoo-services/gdal/translate/service.c	(revision 284)
@@ -133,14 +133,14 @@
       char *ext=new char[4];
       ext="tif";
-      if(strcmp(mtoupper((char*)pszFormat),"AAIGRID")==0)
+      if(strncasecmp(pszFormat,"AAIGRID",7)==0)
 	ext="csv";
       else 
-	if(strcmp(mtoupper((char*)pszFormat),"PNG")==0)
+	if(strncasecmp(pszFormat,"PNG",3)==0)
 	  ext="png";
 	else
-	  if(strcmp(mtoupper((char*)pszFormat),"GIF")==0)
+	  if(strncasecmp(pszFormat,"GIF",3)==0)
 	    ext="gif";
 	  else
-	    if(strcmp(mtoupper((char*)pszFormat),"JPEG")==0)
+	    if(strncasecmp(pszFormat,"JPEG",4)==0)
 	      ext="jpg";
       sprintf((char*)pszDest,"%s/%s.%s",tempPath,tmpMap->value,ext);
