Split OPT make variable into OPT and BASECFLAGS.  The latter contains those
compiler flags which are necessary to get a clean compile.  The former is
for user-specified optimizer, debug, trace fiddling.  See patch 640843.

Add /sw/lib and /sw/include to setup.py search paths on Darwin to take
advantage of fink goodies.

Add scriptsinstall target to Makefile to install certain scripts from
Tools/scripts directory.
diff --git a/setup.py b/setup.py
index 85fbf41..613c296 100644
--- a/setup.py
+++ b/setup.py
@@ -173,8 +173,8 @@
         # unfortunately, distutils doesn't let us provide separate C and C++
         # compilers
         if compiler is not None:
-            (ccshared,opt) = sysconfig.get_config_vars('CCSHARED','OPT')
-            args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared
+            (ccshared,opt,base) = sysconfig.get_config_vars('CCSHARED','OPT','BASECFLAGS')
+            args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared + ' ' + base
         if linker_so is not None:
             args['linker_so'] = linker_so
         self.compiler.set_executables(**args)
@@ -252,6 +252,12 @@
         add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
         add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
 
+        # fink installs lots of goodies in /sw/... - make sure we
+        # check there
+        if sys.platform == "darwin":
+            add_dir_to_list(self.compiler.library_dirs, '/sw/lib')
+            add_dir_to_list(self.compiler.include_dirs, '/sw/include')
+
         if os.path.normpath(sys.prefix) != '/usr':
             add_dir_to_list(self.compiler.library_dirs,
                             sysconfig.get_config_var("LIBDIR"))