--- SConstruct.orig	2011-05-18 09:00:42.000000000 -0700
+++ SConstruct	2011-05-18 11:32:01.000000000 -0700
@@ -48,6 +48,12 @@
 # opts.Add(BoolVariable('style', 'Check style', "no"))
 
 env = Environment(options=opts, CXXFLAGS=["${opt}","${warn}"])
+env.Append( CPPPATH=["@@PREFIX@@/include"] )
+env.Append( LIBPATH=["@@PREFIX@@/lib/"] )
+env["CFLAGS"] = os.getenv("CFLAGS")
+env["CXXFLAGS"] = os.getenv("CXXFLAGS")
+env["LINKFLAGS"] = os.getenv("LINKFLAGS")
+
 Help(opts.GenerateHelpText(env))
 
 conf = Configure(env)
@@ -117,6 +123,7 @@
 else:
     sources += ["utils/dgraphics_nosdl.cc"]
 
+env.Append(SHLINKFLAGS = '-dynamiclib -install_name "@@PREFIX@@/lib/libiulib.dylib"')
 libiulib = env.SharedLibrary('libiulib',sources)
 
 env.Append(CXXFLAGS=['-g','-fPIC'])
@@ -145,8 +152,10 @@
 progs.Append(BUILDERS={'Test':test_builder})
 
 if env["test"]:
+    progs.Prepend(ENV = {'DYLD_LIBRARY_PATH': '.'})
     for file in glob.glob("*/test-*.cc") + glob.glob("*/*/test-*.cc"):
-        if not file.startswith('vidio'):
+        #Jason C - I exclude test-pbmpng becuase it depends on convert from ImageMagick
+        if not (file.startswith('vidio') or file.startswith('imgio/tests/test-pbmpng')):
             progs.Program(file[:-3],file)
             progs.Test(file[:-3])
             progs.Alias("test",file[:-3]+".passed")
