--- SConstruct.orig	2007-08-01 07:04:48.000000000 +0200
+++ SConstruct	2007-09-06 11:09:13.000000000 +0200
@@ -38,7 +38,7 @@
     BoolOption('FPU_OPTIMIZATION', 'Build runtime checked assembler code', 1),
     BoolOption('LIBLO', 'Compile with support for liblo library', 1),
     BoolOption('NLS', 'Set to turn on i18n support', 1),
-    PathOption('PREFIX', 'Set the install "prefix"', '/usr/local'),
+    PathOption('PREFIX', 'Set the install "prefix"', '/usr/local', PathOption.PathIsDirCreate),
     BoolOption('SURFACES', 'Build support for control surfaces', 1),
     BoolOption('SYSLIBS', 'USE AT YOUR OWN RISK: CANCELS ALL SUPPORT FROM ARDOUR AUTHORS: Use existing system versions of various libraries instead of internal ones', 0),
     BoolOption('UNIVERSAL', 'Compile as universal binary.  Requires that external libraries are already universal.', 0),
@@ -381,7 +381,7 @@
 # Make sure they know what they are doing
 #
 
-if env['VST']:
+if False:
     if os.path.isfile('.personal_use_only'):
         print "Enabling VST support. Note that distributing a VST-enabled ardour\nis a violation of several different licences.\nBuild with VST=false if you intend to distribute ardour to others."
     else:
@@ -597,9 +597,9 @@
     opt_flags.extend (["-mhard-float", "-mpowerpc-gfxopt"])
     opt_flags.extend (["-Os"])
 
-elif ((re.search ("i[0-9]86", config[config_cpu]) != None) or (re.search ("x86_64", config[config_cpu]) != None)) and env['DIST_TARGET'] != 'none':
+elif ((re.search ("i[0-9]86", env['DIST_TARGET']) != None) or (re.search ("x86_64", env['DIST_TARGET']) != None)):
     
-    build_host_supports_sse = 0
+    build_host_supports_sse = 1
     
     debug_flags.append ("-DARCH_X86")
     opt_flags.append ("-DARCH_X86")
@@ -644,12 +644,7 @@
             print "\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be an error, especially if you are a package maintainer)"
 # end optimization section
 
-# handle x86/x86_64 libdir properly
-
-if env['DIST_TARGET'] == 'x86_64':
-    env['LIBDIR']='lib64'
-else:
-    env['LIBDIR']='lib'
+env['LIBDIR']='lib'
 
 #
 # save off guessed arch element in an env
@@ -668,13 +663,7 @@
 # prepend boiler plate optimization flags
 #
 
-opt_flags[:0] = [
-    "-O3",
-    "-fomit-frame-pointer",
-    "-ffast-math",
-    "-fstrength-reduce",
-    "-pipe"
-    ]
+opt_flags[:0] = [ "%%CFLAGS%%" ];
 
 if env['DEBUG'] == 1:
     env.Append(CCFLAGS=" ".join (debug_flags))
@@ -719,6 +708,7 @@
 
 libraries['usb'] = LibraryInfo ()
 prep_libcheck(env, libraries['usb'])
+libraries['usb'].Append(CCFLAGS="-I/usr/local/include", LINKFLAGS="-L/usr/local/lib")
 
 conf = Configure (libraries['usb'])
 if conf.CheckLib ('usb', 'usb_interrupt_write'):
@@ -777,6 +767,7 @@
 if env['LIBLO']:
     libraries['lo'] = LibraryInfo ()
     prep_libcheck(env, libraries['lo'])
+    libraries['lo'].Append(CCFLAGS="-I/usr/local/include", LINKFLAGS="-L/usr/local/lib")
 
     conf = Configure (libraries['lo'])
     if conf.CheckLib ('lo', 'lo_server_new') == False:
@@ -790,6 +781,7 @@
 
 libraries['dmalloc'] = LibraryInfo ()
 prep_libcheck(env, libraries['dmalloc'])
+libraries['dmalloc'].Append(CCFLAGS="-I/usr/local/include", LINKFLAGS="-L/usr/local/lib")
 
 #
 # look for the threaded version
@@ -821,8 +813,10 @@
     subst_dict['%MIDITAG%'] = "ardour"
     subst_dict['%MIDITYPE%'] = "coremidi"
 else:
-    print "It appears you don't have the required MIDI libraries installed. For Linux this means you are missing the development package for ALSA libraries."
-    sys.exit (1)
+    libraries['sysmidi'] = LibraryInfo ()
+    env['SYSMIDI'] = 'none'
+    subst_dict['%MIDITAG%'] = "none"
+    subst_dict['%MIDITYPE%'] = "none"
 
 env = conf.Finish()
 
@@ -992,8 +986,7 @@
 surface_subdirs = [ 'libs/surfaces/control_protocol',
                     'libs/surfaces/generic_midi',
                     'libs/surfaces/tranzport',
-                    'libs/surfaces/mackie',
-                    'libs/surfaces/powermate'
+                    'libs/surfaces/mackie'
                     ]
 
 if env['SURFACES']:
@@ -1106,8 +1099,8 @@
     subst_dict['%JACK_INPUT%'] = "coreaudio:Built-in Audio:in"
     subst_dict['%JACK_OUTPUT%'] = "coreaudio:Built-in Audio:out"
 else:
-    subst_dict['%JACK_INPUT%'] = "alsa_pcm:playback_"
-    subst_dict['%JACK_OUTPUT%'] = "alsa_pcm:capture_"
+    subst_dict['%JACK_INPUT%'] = "oss:playback_"
+    subst_dict['%JACK_OUTPUT%'] = "oss:capture_"
 
 # posix_memalign available
 if not conf.CheckFunc('posix_memalign'):
