Index: /anuga_core/source/anuga/utilities/compile.py
===================================================================
--- /anuga_core/source/anuga/utilities/compile.py	(revision 4447)
+++ /anuga_core/source/anuga/utilities/compile.py	(revision 4448)
@@ -8,5 +8,5 @@
      compile.compile(<filename>,..)
 
-   Ole Nielsen, Oct 2001      
+   Ole Nielsen, Duncan Gray Oct 2001      
 """     
 
@@ -25,5 +25,4 @@
   
   
-  ###########################jhdsgfjgdjfg
   
   import os, string, sys, types
@@ -119,5 +118,5 @@
       compiler = CC
     else:  
-      compiler = 'gcc.exe'  #Some systems require this (perhaps a security measure?)
+      compiler = 'gcc.exe' #Some systems require this (a security measure?) 
     if LD:
       loader = LD
@@ -222,5 +221,4 @@
       open(FN, 'r')
     except:
-      #print 'CWD:', os.getcwd()      
       raise Exception, "Could not open: " + FN
 
@@ -232,9 +230,13 @@
     #
     if utilities_include_dir is None:    
-      s = '%s -c %s -I%s -o %s.o -Wall -O3'\
+      s = '%s -c %s -I"%s" -o "%s.o" -Wall -O3'\
           %(compiler, FN, python_include, root)
     else:
-      s = '%s -c %s -I%s -I%s -o %s.o -Wall -O3'\
-          %(compiler, FN, python_include, utilities_include_dir, root)
+      if FN == "triangle.c" or FN == "mesh_engine_c_layer.c":
+        s = '%s -c %s -I"%s" -I"%s" -o "%s.o" -O3 -DTRILIBRARY=1 -DNO_TIMER=1'\
+            %(compiler, FN, python_include, utilities_include_dir, root)
+      else:
+        s = '%s -c %s -I"%s" -I"%s" -o "%s.o" -Wall -O3'\
+            %(compiler, FN, python_include, utilities_include_dir, root)
 
     if os.name == 'posix' and os.uname()[4] == 'x86_64':
@@ -262,6 +264,8 @@
   
   # Make shared library (*.so or *.dll)
-  
-  s = "%s -%s %s -o %s.%s %s -lm" %(loader, sharedflag, object_files, root1, libext, libs)
+  if libs is "":
+    s = '%s -%s %s -o %s.%s -lm' %(loader, sharedflag, object_files, root1, libext)
+  else:
+    s = '%s -%s %s -o %s.%s "%s" -lm' %(loader, sharedflag, object_files, root1, libext, libs)
   if verbose:
     print s
@@ -282,4 +286,5 @@
     """
 
+    from anuga.config import use_extensions
 
     from os.path import splitext
@@ -288,35 +293,34 @@
     
     C=False
-
-    try:
-        s = 'import %s' %root
-        #print s
-        exec(s)
-    except:
+    if use_extensions:
         try:
-            open(filename)
+            s = 'import %s' %root
+            #print s
+            exec(s)
         except:
-            msg = 'C extension %s cannot be opened' %filename
-            print msg                
-        else:    
-            print '------- Trying to compile c-extension %s' %filename
-
-            compile(filename)        
             try:
-                compile(filename)
+                open(filename)
             except:
-                print 'WARNING: Could not compile C-extension %s'\
-                      %filename
-            else:
+                msg = 'C extension %s cannot be opened' %filename
+                print msg                
+            else:    
+                print '------- Trying to compile c-extension %s' %filename
+            
                 try:
-                    exec('import %s' %root)
+                    compile(filename)
                 except:
-                    msg = 'C extension %s seems to compile OK, '
-                    msg += 'but it can still not be imported.'
-                    raise msg
+                    print 'WARNING: Could not compile C-extension %s'\
+                          %filename
                 else:
-                    C=True
-    else:
-        C=True
+                    try:
+                        exec('import %s' %root)
+                    except:
+                        msg = 'C extension %s seems to compile OK, '
+                        msg += 'but it can still not be imported.'
+                        raise msg
+                    else:
+                        C=True
+        else:
+            C=True
             
     if not C:
@@ -325,6 +329,4 @@
 
     return C
-
-
 
 
@@ -360,10 +362,13 @@
                   pass
 
-          print '--------------------------------------'      
+          print '-------------------------------_-------'      
           print 'Trying to compile c-extension %s in %s'\
                 %(filename, os.getcwd())
-
-          compile(filename)          
           try:
+            if filename == 'triang.c': 
+              compile(['triang.c','triangle.c'])
+            elif  filename == 'mesh_engine_c_layer.c': 
+              compile(['mesh_engine_c_layer.c','triangle.c'])
+            else:
               compile(filename)
           except Exception, e:
