=== modified file 'autowaf.py'
--- autowaf.py	2009-07-22 19:51:13 +0000
+++ autowaf.py	2009-08-08 17:11:30 +0000
@@ -130,6 +130,102 @@
 	conf.env['DEBUG'] = Options.options.debug
 	conf.env['STRICT'] = Options.options.strict
 	conf.env['PREFIX'] = os.path.abspath(os.path.expanduser(os.path.normpath(conf.env['PREFIX'])))
+	
+	if sys.platform == 'darwin':
+		#
+		#	Define OSX as a uselib to use when compiling
+		#	on Darwin to add all applicable flags at once
+		#
+		conf.env.append_value('CXXFLAGS_OSX', "-mmacosx-version-min=10.4")
+		conf.env.append_value('CCFLAGS_OSX', "-mmacosx-version-min=10.4")
+		conf.env.append_value('CXXFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
+		conf.env.append_value('CCFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
+		conf.env.append_value('LINKFLAGS_OSX', "-mmacosx-version-min=10.4")
+		conf.env.append_value('LINKFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
+		
+		conf.env.append_value('LINKFLAGS_OSX', "-sysroot /Developer/SDKs/MacOSX10.4u.sdk")
+		conf.env.append_value('LINKFLAGS_OSX', "-F/System/Library/Frameworks")
+
+		conf.env.append_value('CXXFLAGS_OSX', "-msse")
+		conf.env.append_value('CCFLAGS_OSX', "-msse")
+		conf.env.append_value('CXXFLAGS_OSX', "-msse2")
+		conf.env.append_value('CCFLAGS_OSX', "-msse2")
+		#
+		#	TODO: The previous sse flags NEED to be based
+		#	off processor type.  Need to add in a check
+		#	for that.
+		#
+		
+		conf.env.append_value('LINKFLAGS_OSX', ['-undefined', 'suppress'])
+		conf.env.append_value('LINKFLAGS_OSX', "-flat_namespace")
+		#
+		#	The previous 2 flags avoid circular dependencies
+		#	between libardour and libardour_cp on OS X.
+		#	ld reported -undefined suppress as an unknown option
+		#	in one of the tests ran, removing it for the moment
+		#
+		conf.env.append_value('CXXFLAGS_OSX', "-F/System/Library/Frameworks")
+		conf.env.append_value('CCFLAGS_OSX', "-F/System/Library/Frameworks")
+
+
+	if Options.options.gtkosx:
+		#
+		#	Define Include Paths for GTKOSX
+		#
+		conf.env.append_value('CPPPATH_GTKOSX', "/usr/include/")
+		conf.env.append_value('CPPPATH_GTKOSX', "/usr/include/c++/4.0.0")
+		conf.env.append_value('CPPPATH_GTKOSX', "/usr/include/c++/4.0.0/i686-apple-darwin8/")
+		#
+		#	TODO: Fix the above include path, it needs to be
+		#	defined based off what is read in the configuration
+		#	stage about the machine(PPC, X86, X86_64, etc.)
+		#
+		conf.env.append_value('CPPPATH_GTKOSX', "/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/")
+		#
+		#	TODO: Likewise this needs to be defined not only
+		#	based off the machine characteristics, but also
+		#	based off the version of GCC being used.
+		#
+		conf.env.append_value('CPPPATH_GTKOSX', "/System/Library/Frameworks/")
+		conf.env.append_value('CXXFLAGS_GTKOSX', '-DTOP_MENUBAR')
+		conf.env.append_value('CXXFLAGS_GTKOSX', '-DGTKOSX')
+		conf.env.append_value('LINKFLAGS_GTKOSX', "-framework AppKit")
+		conf.env.append_value('LINKFLAGS_GTKOSX', "-Xlinker -headerpad")
+		conf.env.append_value('LINKFLAGS_GTKOSX', "-Xlinker 2048")
+		conf.env.append_value('CPPPATH_GTKOSX', "/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/")
+		#
+		#	I had a note the previous was for MacTypes.h
+		#
+	
+	if Options.options.coreaudio:
+	   #conf.env.append_value('LINKFLAGS_COREAUDIO', "-framework CoreAudioKit")
+	   #conf.env.append_value('LINKFLAGS_COREAUDIO', "-framework AudioToolbox")
+	   #conf.env.append_value('LINKFLAGS_COREAUDIO', "-framework CoreServices")
+	   conf.check_cc (header_name = '/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h',
+					  define_name = 'HAVE_COREAUDIO', linkflags = ['-framework', 'CoreAudio'])
+	   conf.check_cxx (header_name = '/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h',
+					  linkflags = [ '-framework', 'AudioToolbox' ])
+	   conf.check_cc (header_name = '/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h',
+					  linkflags = ['-framework', 'CoreFoundation'])
+	   conf.check_cc (header_name = '/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h',
+					  linkflags = ['-framework', 'CoreServices'])
+	   #
+	   #	TODO: For some reason the above doesn't seem to be correctly adding the
+	   #	the link flags, so we will add them manually.
+	   #
+	   conf.env.append_value('LINKFLAGS_COREAUDIO', ['-framework', 'CoreServices'])
+	   conf.env.append_value('LINKFLAGS_COREAUDIO', ['-framework', 'CoreFoundation'])
+	   conf.env.append_value('LINKFLAGS_COREAUDIO', ['-framework', 'AudioToolbox'])
+	   conf.env.append_value('LINKFLAGS_COREAUDIO', ['-framework', 'CoreAudio'])
+
+	if Options.options.audiounits:
+	   #conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DHAVE_AUDIOUNITS")
+	   conf.env.append_value('LINKFLAGS_AUDIOUNITS', "-framework AudioToolbox")
+	   conf.env.append_value('LINKFLAGS_AUDIOUNITS', "-framework CoreServices")
+	   conf.check_cc (header_name = '/System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.h',
+					  define_name = 'HAVE_AUDIOUNITS', linkflags = [ '-framework', 'AudioUnit' ])
+	
+
 	if Options.options.bundle:
 		conf.env['BUNDLE'] = True
 		conf.define('BUNDLE', 1)

=== modified file 'gtk2_ardour/ardour_ui.cc'
--- gtk2_ardour/ardour_ui.cc	2009-07-21 14:55:17 +0000
+++ gtk2_ardour/ardour_ui.cc	2009-08-07 03:06:49 +0000
@@ -172,7 +172,12 @@
 	
 
 #ifdef TOP_MENUBAR
-	_auto_display_errors = false;
+	// _auto_display_errors = false;
+	/*
+	 * This was commented out as it wasn't defined
+	 * in A3 IIRC.  If this is not needed it should
+	 * be completely removed.
+	 */
 #endif
 
 	about = 0;
@@ -2204,6 +2209,41 @@
 }
 
 void
+ARDOUR_UI::idle_load (const Glib::ustring& path)
+{
+	if (session) {
+		if (Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) {
+			/* /path/to/foo => /path/to/foo, foo */
+			load_session (path, basename_nosuffix (path));
+		} else {
+			/* /path/to/foo/foo.ardour => /path/to/foo, foo */
+			load_session (Glib::path_get_dirname (path), basename_nosuffix (path));
+		}
+	} else {
+
+		ARDOUR_COMMAND_LINE::session_name = path;
+
+		/*
+		 * new_session_dialog doens't exist in A3
+		 * Try to remove all references to it to
+		 * see if it will compile.  NOTE: this will
+		 * likely cause a runtime issue is my somewhat
+		 * uneducated guess.
+		 */
+
+		//if (new_session_dialog) {
+
+
+			/* make it break out of Dialog::run() and
+			   start again.
+			 */
+
+			//new_session_dialog->response (1);
+		//}
+	}
+}
+
+void
 ARDOUR_UI::end_loading_messages ()
 {
 	// hide_splash ();

=== modified file 'gtk2_ardour/ardour_ui.h'
--- gtk2_ardour/ardour_ui.h	2009-07-21 02:23:57 +0000
+++ gtk2_ardour/ardour_ui.h	2009-08-07 03:08:39 +0000
@@ -115,6 +115,7 @@
 	void show_about ();
 	void hide_about ();
 
+	void idle_load (const Glib::ustring& path);
 	void finish();
 
 	int load_session (const Glib::ustring& path, const Glib::ustring& snapshot, Glib::ustring mix_template = Glib::ustring());

=== modified file 'gtk2_ardour/cocoacarbon.mm'
--- gtk2_ardour/cocoacarbon.mm	2008-12-12 14:43:24 +0000
+++ gtk2_ardour/cocoacarbon.mm	2009-08-07 03:10:55 +0000
@@ -21,6 +21,14 @@
 #undef YES   // stupid, stupid gtkmm and/or NSObjC
 #undef NO    // ditto
 
+#ifdef GTKOSX
+#include <objc/objc.h>
+#ifdef nil
+	/*Stupid OS X defining nil*/
+#undef nil
+#endif
+#endif
+
 #include "ardour_ui.h"
 #include "actions.h"
 #include "opts.h"

=== modified file 'gtk2_ardour/diamond.cc'
--- gtk2_ardour/diamond.cc	2008-04-21 15:42:55 +0000
+++ gtk2_ardour/diamond.cc	2009-08-07 03:11:38 +0000
@@ -32,10 +32,10 @@
 Diamond::set_height(double height)
 {
 	Points points;
-	points.push_back(Point(0, height*2.0));
-	points.push_back(Point(height, height));
-	points.push_back(Point(0, 0));
-	points.push_back(Point(-height, height));
+	points.push_back(Art::Point(0, height*2.0));
+	points.push_back(Art::Point(height, height));
+	points.push_back(Art::Point(0, 0));
+	points.push_back(Art::Point(-height, height));
 	property_points() = points;	
 }
 

=== modified file 'gtk2_ardour/diamond.h'
--- gtk2_ardour/diamond.h	2008-04-29 20:58:05 +0000
+++ gtk2_ardour/diamond.h	2009-08-07 03:11:56 +0000
@@ -22,6 +22,7 @@
 
 #include <libgnomecanvasmm/polygon.h>
 #include "canvas-note-event.h"
+#include "canvas.h"
 
 namespace Gnome {
 namespace Canvas {

=== modified file 'gtk2_ardour/editor.h'
--- gtk2_ardour/editor.h	2009-08-04 17:21:09 +0000
+++ gtk2_ardour/editor.h	2009-08-07 03:13:52 +0000
@@ -38,8 +38,8 @@
 
 #include <cmath>
 
-#include <gtkmm/layout.h>
 #include <gtkmm/comboboxtext.h>
+#include <gtkmm/layout.h>
 
 #include <gtkmm2ext/selector.h>
 #include <gtkmm2ext/click_box.h>
@@ -48,7 +48,6 @@
 #include "pbd/stateful.h"
 #include "ardour/session.h"
 #include "ardour/tempo.h"
-#include "ardour/stretch.h"
 #include "ardour/location.h"
 #include "ardour/audioregion.h"
 #include "ardour/track.h"

=== modified file 'gtk2_ardour/editor_canvas_events.cc'
--- gtk2_ardour/editor_canvas_events.cc	2009-07-21 14:55:17 +0000
+++ gtk2_ardour/editor_canvas_events.cc	2009-08-07 03:14:38 +0000
@@ -26,9 +26,9 @@
 
 #include "ardour/audio_diskstream.h"
 #include "ardour/audioplaylist.h"
-#include "ardour/midi_region.h"
 #include "ardour/audioregion.h"
 #include "ardour/region_factory.h"
+#include "ardour/midi_region.h"
 
 #include "editor.h"
 #include "keyboard.h"

=== modified file 'gtk2_ardour/editor_routes.cc'
--- gtk2_ardour/editor_routes.cc	2009-08-01 23:33:16 +0000
+++ gtk2_ardour/editor_routes.cc	2009-08-07 03:15:18 +0000
@@ -24,8 +24,6 @@
 #include <cmath>
 #include <cassert>
 
-#include "gtkmm2ext/cell_renderer_pixbuf_toggle.h"
-
 #include "ardour/diskstream.h"
 
 #include "editor.h"
@@ -44,6 +42,8 @@
 
 #include "ardour/route.h"
 
+#include "gtkmm2ext/cell_renderer_pixbuf_toggle.h"
+
 #include "i18n.h"
 
 using namespace std;

=== modified file 'gtk2_ardour/marker.cc'
--- gtk2_ardour/marker.cc	2009-05-21 16:30:45 +0000
+++ gtk2_ardour/marker.cc	2009-08-07 03:16:57 +0000
@@ -20,11 +20,17 @@
 #include <sigc++/bind.h>
 #include "ardour/tempo.h"
 
+#include "ardour_ui.h"
+/*
+ * ardour_ui.h include was moved to the top of the list
+ * due to a conflicting definition of 'Rect' between
+ * Apple's MacTypes.h and GTK.
+ */
+
 #include "marker.h"
 #include "public_editor.h"
 #include "utils.h"
 #include "canvas_impl.h"
-#include "ardour_ui.h"
 #include "simpleline.h"
 
 #include <gtkmm2ext/utils.h>

=== modified file 'gtk2_ardour/public_editor.h'
--- gtk2_ardour/public_editor.h	2009-07-28 19:51:28 +0000
+++ gtk2_ardour/public_editor.h	2009-08-07 03:19:22 +0000
@@ -25,6 +25,7 @@
 #include <string>
 #include <glib.h>
 #include <gdk/gdktypes.h>
+#include <gtkmm/box.h>
 #include <gtkmm/window.h>
 #include <gtkmm/actiongroup.h>
 #include <jack/types.h>
@@ -327,6 +328,14 @@
 	static const int vertical_spacing;
 	static const int horizontal_spacing;
 
+#ifdef TOP_MENUBAR
+	/*
+	 * This is needed for OS X primarily
+	 * but also any other OS that uses a single
+	 * top menubar instead of per window menus
+	 */
+	virtual Gtk::HBox& get_status_bar_packer() = 0;
+#endif
 
 	virtual gdouble get_trackview_group_vertical_offset () const = 0;
 	virtual gdouble get_canvas_timebars_vsize () const = 0;

=== modified file 'gtk2_ardour/time_axis_view_item.cc'
--- gtk2_ardour/time_axis_view_item.cc	2009-07-21 14:55:17 +0000
+++ gtk2_ardour/time_axis_view_item.cc	2009-08-07 03:20:51 +0000
@@ -25,6 +25,13 @@
 
 #include <gtkmm2ext/utils.h>
 
+#include "ardour_ui.h"
+/*
+ * ardour_ui.h was moved up in the include list
+ * due to a conflicting definition of 'Rect' between
+ * Apple's MacTypes.h file and GTK
+ */
+
 #include "public_editor.h"
 #include "time_axis_view_item.h"
 #include "time_axis_view.h"
@@ -32,7 +39,6 @@
 #include "utils.h"
 #include "canvas_impl.h"
 #include "rgb_macros.h"
-#include "ardour_ui.h"
 
 #include "i18n.h"
 

=== modified file 'gtk2_ardour/wscript'
--- gtk2_ardour/wscript	2009-07-23 02:01:31 +0000
+++ gtk2_ardour/wscript	2009-08-07 03:35:24 +0000
@@ -2,6 +2,8 @@
 import autowaf
 import os
 import glob
+import sys
+import TaskGen
 from w18n import build_i18n
 
 # Version of this package (even if built as a child)
@@ -202,7 +204,13 @@
 	autowaf.configure(conf)
 	conf.check_tool('compiler_cxx')
 
+	if sys.platform == 'linux':
 	autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
+		#
+		#	TODO: Insert a sanity check for on OS X
+		#	to ensure that CoreAudio is present....
+		#	Really shouldn't these checks be in AutoWaf?
+		#
 	autowaf.check_pkg(conf, 'flac', uselib_store='FLAC', atleast_version='1.2.1')
 	autowaf.check_pkg(conf, 'gthread', uselib_store='GTHREAD', atleast_version='2.10.1')
 	autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK', atleast_version='2.12.1')
@@ -231,7 +239,7 @@
 	obj.target       = 'ardour-3.0'
 	obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
 	obj.uselib       = 'UUID FLAC GLIBMM GTHREAD GTK GNOMECANVAS OGG ALSA'
-	obj.uselib       += ' GTKMM GNOMECANVASMM'
+	obj.uselib       += ' GTKMM GNOMECANVASMM OSX GTKOSX COREAUDIO'
 	obj.uselib_local = '''libpbd libmidipp libtaglib libardour libardour_cp
 	                      libgtkmm2ext libtaglib'''
 	obj.cflags       = ['-DPACKAGE="gtk2_ardour"']
@@ -254,14 +262,11 @@
 		obj.cxxflags += [ '-DVST_SUPPORT' ]
 
 	if bld.env['GTKOSX']:
-		obj.features += ' objc '
+		TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
 		obj.source += [ 'cocoacarbon.mm' ]
-		obj.cxxflags += [ '-DTOP_MENUBAR', '-DGTKOSX' ]
-		obj.linkflags += [ '-framework', 'AppKit', '-framework', 'CoreAudioKit' ]
 
 		if bld.env['AUDIOUNITS']:
 			obj.source += [ 'au_pluginui.mm' ]
-			obj.cxxflags += [ '-DHAVE_AUDIOUNITS' ]
 			obj.uselib_local += ' libappleutility '
 
 	else:

=== added file 'libs/appleutility/wscript'
--- libs/appleutility/wscript	1970-01-01 00:00:00 +0000
+++ libs/appleutility/wscript	2009-08-08 00:35:24 +0000
@@ -0,0 +1,44 @@
+import autowaf
+import os
+
+libappleutility_sources = [
+	'AUOutputBL.cpp',
+	'AUParamInfo.cpp',
+	'CAAudioChannelLayout.cpp',
+	'CAAudioChannelLayoutObject.cpp',
+	'CAAudioFile.cpp',
+	'CAAudioUnit.cpp',
+	'CAAUParameter.cpp',
+	'CABufferList.cpp',
+	'CACFDictionary.cpp',
+	'CACFNumber.cpp',
+	'CACFString.cpp',
+	'CAComponent.cpp',
+	'CAComponentDescription.cpp',
+	'CADebugMacros.cpp',
+	'CAStreamBasicDescription.cpp',
+	'CAXException.cpp'
+]
+
+def set_options(opt):
+	autowaf.set_options(opt)
+	
+def configure(conf):
+	autowaf.configure(conf)
+	
+def build(bld):
+	obj              = bld.new_task_gen('cxx', 'shlib',
+										uselib = 'COREAUDIO CORESERVICES COREFOUNDATION AUDIOTOOLBOX AUDIOUNITS OSX GTKOSX')
+	obj.source       = libappleutility_sources
+	obj.export_incdirs = ['.']
+	obj.includes     = ['.']
+	obj.name         = 'libappleutility'
+	obj.target       = 'appleutility'
+	obj.install_path = os.path.join(bld.env['LIBDIR'], 'appleutility')
+
+
+def shutdown():
+	autowaf.shutdown()
+
+def i18n(bld):
+	pass
\ No newline at end of file

=== modified file 'libs/ardour/ardour/coreaudiosource.h'
--- libs/ardour/ardour/coreaudiosource.h	2009-02-25 18:26:51 +0000
+++ libs/ardour/ardour/coreaudiosource.h	2009-08-08 02:37:21 +0000
@@ -22,17 +22,20 @@
 
 #include <appleutility/CAAudioFile.h>
 #include "ardour/audiofilesource.h"
+#include <string>
+
+using namespace std;
 
 namespace ARDOUR {
 
 class CoreAudioSource : public AudioFileSource {
   public:
 	CoreAudioSource (ARDOUR::Session&, const XMLNode&);
-	CoreAudioSource (ARDOUR::Session&, const string& path, int chn, Flag);
+	CoreAudioSource (ARDOUR::Session&, const string& path, bool, int chn, Flag);
 	~CoreAudioSource ();
 
 	float sample_rate() const;
-	int update_header (nframes_t when, struct tm&, time_t);
+	int update_header (sframes_t when, struct tm&, time_t);
 
 	int flush_header () {return 0;};
 	void set_header_timeline_position () {};
@@ -40,7 +43,7 @@
 	static int get_soundfile_info (string path, SoundFileInfo& _info, string& error_msg);
 
   protected:
-	nframes_t read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const;
+	nframes_t read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) const;
 	nframes_t write_unlocked (Sample *dst, nframes_t cnt) { return 0; }
 
   private:

=== modified file 'libs/ardour/coreaudiosource.cc'
--- libs/ardour/coreaudiosource.cc	2009-02-25 18:26:51 +0000
+++ libs/ardour/coreaudiosource.cc	2009-08-08 03:32:12 +0000
@@ -38,14 +38,16 @@
 using namespace PBD;
 
 CoreAudioSource::CoreAudioSource (Session& s, const XMLNode& node)
-	: AudioFileSource (s, node)
+	: 	Source (s, node),
+	AudioFileSource (s, node)
 {
 	init ();
 }
 
-CoreAudioSource::CoreAudioSource (Session& s, const string& path, int chn, Flag flags)
+CoreAudioSource::CoreAudioSource (Session& s, const string& path, bool, int chn, Flag flags)
 	/* files created this way are never writable or removable */
-	: AudioFileSource (s, path,
+	: Source (s, DataType::AUDIO, path, Source::Flag (flags & ~(Writable|Removable|RemovableIfEmpty|RemoveAtDestroy))),
+		AudioFileSource (s, path,
 			Source::Flag (flags & ~(Writable|Removable|RemovableIfEmpty|RemoveAtDestroy)))
 {
 	_channel = chn;
@@ -138,7 +140,7 @@
 	
 
 nframes_t
-CoreAudioSource::read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const
+CoreAudioSource::read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) const
 {
 	nframes_t file_cnt;
 	AudioBufferList abl;
@@ -217,7 +219,7 @@
 }
 
 int
-CoreAudioSource::update_header (nframes_t when, struct tm&, time_t)
+CoreAudioSource::update_header (sframes_t when, struct tm&, time_t)
 {
 	return 0;
 }

=== modified file 'libs/ardour/plugin_manager.cc'
--- libs/ardour/plugin_manager.cc	2009-07-21 14:55:17 +0000
+++ libs/ardour/plugin_manager.cc	2009-08-08 01:47:34 +0000
@@ -80,7 +80,7 @@
 
 	load_favorites ();
 
-#ifdef GTKOSX
+#ifdef HAVE_AUDIOUNITS
 	ProcessSerialNumber psn = { 0, kCurrentProcess }; 
 	OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication);
 	if( returnCode != 0) {

=== modified file 'libs/ardour/wscript'
--- libs/ardour/wscript	2009-07-23 15:55:50 +0000
+++ libs/ardour/wscript	2009-08-08 17:58:59 +0000
@@ -210,19 +210,6 @@
 	conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H')
 	conf.check(header_name='wordexp.h', define_name='HAVE_WORDEXP')
 	
-	if conf.env['IS_OSX']:
-		conf.check_cc (header_name = '/System/Library/Frameworks/CoreMIDI.framework/Headers/CoreMIDI.h',
-			       linkflags = [ '-framework', 'CoreMIDI' ])
-		
-		conf.check_cc (header_name = '/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h',
-			       linkflags = [ '-framework', 'AudioToolbox' ])
-		
-		conf.check_cc (header_name = '/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h',
-			      define_name = 'HAVE_COREAUDIO')
-		
-		conf.check_cc (header_name = '/System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.h',
-			       define_name = 'HAVE_AUDIOUNITS', linkflags = [ '-framework', 'AudioUnit' ])
-
 	conf.write_config_header('libardour-config.h')
 
 	# Boost headers
@@ -234,10 +221,10 @@
 	obj              = bld.new_task_gen('cxx', 'shlib')
 	obj.source       = libardour_sources
 	obj.export_incdirs = ['.']
-	obj.includes     = ['.', '../surfaces/control_protocol']
+	obj.includes     = ['.', '../surfaces/control_protocol', '..']
 	obj.name         = 'libardour'
 	obj.target       = 'ardour'
-	obj.uselib       = 'GLIBMM AUBIO SIGCPP XML UUID JACK SNDFILE SAMPLERATE LRDF'
+	obj.uselib       = 'GLIBMM AUBIO SIGCPP XML UUID JACK SNDFILE SAMPLERATE LRDF OSX'
 	obj.uselib_local = 'libpbd libmidipp libevoral libvamphost libvampplugin libtaglib librubberband'
 	obj.vnum         = LIBARDOUR_LIB_VERSION
 	obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
@@ -251,6 +238,14 @@
 			os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"']
 	#obj.source += ' st_stretch.cc st_pitch.cc '
 	#obj.uselib += ' SOUNDTOUCH '
+	#obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
+	
+	obj.env.append_value('LINKFLAGS', 'default/libs/surfaces/control_protocol/smpte_1.o')
+	#
+	#	TODO: The above is an ugly hack that shouldn't be needed.  We really need
+	#	to refactor SMPTE out of libardour_cp to get rid of that circular dependency
+	#	alltogether.
+	#
 	if bld.env['HAVE_SLV2']:
 		obj.source += [ 'lv2_plugin.cc', 'lv2_event_buffer.cc', 'uri_map.cc' ]
 		obj.uselib += ' SLV2 '
@@ -259,14 +254,13 @@
 		obj.source += [ 'vst_plugin.cc', 'session_vst.cc' ]
 
 	if bld.env['HAVE_COREAUDIO'] and bld.env['COREAUDIO']:
-		obj.sources += [ 'coreaudio.cc', 'caimportable.cc' ]
+		obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
 
-	if bld.env['HAVE_AUDIOUNITS'] and bld.env['AUDIOUNITS']:
-		obj.sources += [ 'audio_unit.cc' ]
+	if bld.env['HAVE_AUDIOUNITS'] or bld.env['HAVE_COREAUDIO']:
+		obj.uselib_local += ' libappleutility'	
 
-	if bld.env['IS_OSX']:
-		# this avoids issues with circular dependencies between libardour and libardour_cp.
-		obj.linkflags += '-undefined suppress -flat_namespace'
+	if bld.env['HAVE_AUDIOUNITS'] and bld.env['AUDIOUNITS']:
+		obj.source += [ 'audio_unit.cc' ]
 
 	if bld.env['FPU_OPTIMIZATION']:
 		obj.source += [ 'sse_functions_xmm.cc' ]

=== modified file 'libs/gtkmm2ext/barcontroller.cc'
--- libs/gtkmm2ext/barcontroller.cc	2009-07-21 14:55:17 +0000
+++ libs/gtkmm2ext/barcontroller.cc	2009-08-07 04:43:44 +0000
@@ -369,7 +369,7 @@
 }
 
 void
-BarController::set_style (Style s)
+BarController::set_style (barStyle s)
 {
 	_style = s;
 	darea.queue_draw ();

=== modified file 'libs/gtkmm2ext/gtkmm2ext/barcontroller.h'
--- libs/gtkmm2ext/gtkmm2ext/barcontroller.h	2009-07-21 14:55:17 +0000
+++ libs/gtkmm2ext/gtkmm2ext/barcontroller.h	2009-08-07 04:44:48 +0000
@@ -33,7 +33,7 @@
 
 	virtual ~BarController () {}
 
-	enum Style {
+	enum barStyle {
 		LeftToRight,
 		RightToLeft,
 		Line,
@@ -43,8 +43,8 @@
 		BottomToTop
 	};
 
-	Style style() const { return _style; }
-	void set_style (Style);
+	barStyle style() const { return _style; }
+	void set_style (barStyle);
 	void set_use_parent (bool yn);
 
 	void set_sensitive (bool yn);
@@ -64,7 +64,7 @@
 	BindingProxy        binding_proxy;
 	Gtk::DrawingArea    darea;
 	Glib::RefPtr<Pango::Layout> layout;
-	Style              _style;
+	barStyle              _style;
 	bool                grabbed;
 	bool                switching;
 	bool                switch_on_release;

=== modified file 'libs/gtkmm2ext/gtkmm2ext/cell_renderer_pixbuf_toggle.h'
--- libs/gtkmm2ext/gtkmm2ext/cell_renderer_pixbuf_toggle.h	2009-07-01 22:20:18 +0000
+++ libs/gtkmm2ext/gtkmm2ext/cell_renderer_pixbuf_toggle.h	2009-08-07 04:46:52 +0000
@@ -17,6 +17,13 @@
 
 */
 
+#ifdef GTKOSX
+#include <MacTypes.h>
+#if defined(Style)
+#undef style
+#endif
+#endif
+
 #ifndef __gtkmm2ext_cell_renderer_pixbuf_toggle_h__ 
 #define __gtkmm2ext_cell_renderer_pixbuf_toggle_h__
 
@@ -37,7 +44,7 @@
 	CellRendererPixbufToggle();  
 	virtual ~CellRendererPixbufToggle(){};
 
-	virtual void render_vfunc (const Glib::RefPtr<Gdk::Drawable>& window, Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, const Gdk::Rectangle& expose_area, Gtk::CellRendererState flags);  
+	virtual void render_vfunc (const Glib::RefPtr<Gdk::Drawable>& window, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, const Gdk::Rectangle& expose_area, Gtk::CellRendererState flags);
 
 	virtual void get_size_vfunc (Gtk::Widget& widget, const Gdk::Rectangle* cell_area, int* x_offset, int* y_offset, int* width, int* height) const;
 

=== modified file 'libs/gtkmm2ext/wscript'
--- libs/gtkmm2ext/wscript	2009-07-22 19:51:13 +0000
+++ libs/gtkmm2ext/wscript	2009-08-07 06:23:40 +0000
@@ -18,6 +18,34 @@
 APPNAME = 'gtkmm2ext'
 VERSION = GTKMM2EXT_VERSION
 
+gtkmm2ext_sources = [
+	'auto_spin.cc',
+	'barcontroller.cc',
+	'binding_proxy.cc',
+	'cell_renderer_pixbuf_toggle.cc',
+	'choice.cc',
+	'click_box.cc',
+	'dndtreeview.cc',
+	'fastmeter.cc',
+	'focus_entry.cc',
+	'grouped_buttons.cc',
+	'gtk_ui.cc',
+	'idle_adjustment.cc',
+	'pixfader.cc',
+	'pixscroller.cc',
+	'popup.cc',
+	'prompter.cc',
+	'scroomer.cc',
+	'selector.cc',
+	'slider_controller.cc',
+	'stateful_button.cc',
+	'tearoff.cc',
+	'textviewer.cc',
+	'utils.cc',
+	'version.cc',
+	'window_title.cc'
+]
+
 # Mandatory variables
 srcdir = '.'
 blddir = 'build'
@@ -33,41 +61,17 @@
 	autowaf.configure(conf)
 	conf.check_tool('compiler_cxx')
 	autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM', atleast_version='2.8')
+	autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK', atleast_version='2.12.1')
+
 
 def build(bld):
-	obj = bld.new_task_gen('cxx', 'shlib')
-	obj.source = '''
-		auto_spin.cc
-		barcontroller.cc
-		binding_proxy.cc
-		cell_renderer_pixbuf_toggle.cc
-		choice.cc
-		click_box.cc
-		dndtreeview.cc
-		fastmeter.cc
-		focus_entry.cc
-		grouped_buttons.cc
-		gtk_ui.cc
-		idle_adjustment.cc
-		pixfader.cc
-		pixscroller.cc
-		popup.cc
-		prompter.cc
-		scroomer.cc
-		selector.cc
-		slider_controller.cc
-		stateful_button.cc
-		tearoff.cc
-		textviewer.cc
-		utils.cc
-		version.cc
-		window_title.cc
-	'''
+	obj = bld.new_task_gen(features = 'cc cxx cshlib')
+	obj.source = gtkmm2ext_sources
 	obj.export_incdirs = ['.']
 	obj.includes     = ['.']
 	obj.name         = 'libgtkmm2ext'
 	obj.target       = 'gtkmm2ext'
-	obj.uselib       = 'GTKMM'
+	obj.uselib       = 'GTKMM GTK GTKOSX OSX GDK'
 	obj.uselib_local = 'libpbd'
 	obj.vnum         = GTKMM2EXT_LIB_VERSION
 	obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
@@ -75,6 +79,8 @@
 			'-DPACKAGE="libgtkmm2ext"',
 			'-DLOCALEDIR="' + os.path.join(
 				os.path.normpath(bld.env['DATADIRNAME']), 'locale') + '"']
+	if bld.env['GTKOSX']:
+		obj.source	+= ['sync-menu.c']
 
 def shutdown():
 	autowaf.shutdown()

=== modified file 'libs/pbd/wscript'
--- libs/pbd/wscript	2009-07-22 19:51:13 +0000
+++ libs/pbd/wscript	2009-08-07 04:52:02 +0000
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 import autowaf
 import os
+import sys
 
 # Version of this package (even if built as a child)
 MAJOR = '4'
@@ -34,6 +35,7 @@
 	conf.check_tool('compiler_cxx')
 	autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
 	autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
+	if sys.platform != 'darwin':
 	autowaf.check_pkg(conf, 'uuid', uselib_store='UUID')
 
 	conf.check(function_name='getmntent', header_name='mntent.h', define_name='HAVE_GETMNTENT')

=== modified file 'libs/surfaces/control_protocol/wscript'
--- libs/surfaces/control_protocol/wscript	2009-07-17 21:12:21 +0000
+++ libs/surfaces/control_protocol/wscript	2009-08-08 16:59:06 +0000
@@ -6,6 +6,7 @@
 # major increment <=> incompatible changes
 # minor increment <=> compatible changes (additions)
 # micro increment <=> no interface changes
+APPNAME = 'libardour_cp'
 LIBARDOUR_CP_LIB_VERSION = '4.1.0'
 
 # Mandatory variables

=== modified file 'libs/surfaces/osc/wscript'
--- libs/surfaces/osc/wscript	2009-07-17 21:12:21 +0000
+++ libs/surfaces/osc/wscript	2009-08-08 18:03:48 +0000
@@ -17,7 +17,12 @@
 
 def configure(conf):
 	autowaf.configure(conf)
-	autowaf.check_pkg(conf, 'liblo', uselib_store='LO')
+	autowaf.check_pkg(conf, 'liblo', uselib_store='LO', linkflags='-llo')
+	conf.env.append_value('LINKFLAGS_LO', '-llo')
+	#
+	#	TODO: Again this append_value shouldn't be necessary really
+	#	but for some reason the link flag is not being added otherwise.
+	#
 
 def build(bld):
 	obj = bld.new_task_gen('cxx', 'shlib')

=== modified file 'wscript'
--- wscript	2009-07-23 11:04:46 +0000
+++ wscript	2009-08-08 00:28:03 +0000
@@ -6,6 +6,7 @@
 import re
 import string
 import subprocess
+import sys
 
 # Variables for 'waf dist'
 VERSION = '3.0pre0'
@@ -200,7 +201,7 @@
 		if conf.env['build_target'] == 'tiger' or conf.env['build_target'] == 'leopard':
 			optimization_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS");
 			debug_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS");
-			libraries['core'].Append(LINKFLAGS= '-framework Accelerate')
+			conf.env.append_value('LINKFLAGS', "-framework Accelerate")
 		elif conf.env['build_target'] == 'i686' or conf.env['build_target'] == 'x86_64':
 			optimization_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
 			debug_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
@@ -209,6 +210,8 @@
 			debug_flags.append ("-DUSE_X86_64_ASM")
 		if build_host_supports_sse != 1:
 			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)"
+		if conf.check_cc(function_name='posix_memalign', header_name='stdlib.h') == False:
+			optimization_flags.append("-DNO_POSIX_MEMALIGN")
 
 	# end optimization section
 			
@@ -231,13 +234,7 @@
 		conf.define ('IS_OSX', 1)
 		# force tiger or later, to avoid issues on PPC which defaults
 		# back to 10.1 if we don't tell it otherwise.
-		conf.env.append_value (CCFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040")
-
-		if conf.env['build_target'] == 'leopard':
-			# need this to force build against the 10.4 SDK when building on later versions of OS X
-			# ideally this would be configurable, but lets just do that later when we need it
-			conf.env.append_value(CCFLAGS="-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk")
-			conf.env.append_value(LINKFLAGS="-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk")
+		conf.env.append_value('CCFLAGS', "-DMAC_OS_X_VERSION_MIN_REQUIRED=1040")
 
 	else:
 		conf.define ('IS_OSX', 0)
@@ -368,6 +365,8 @@
 	autowaf.configure(conf)
 	autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
 	autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0')
+	if sys.platform == 'darwin':
+		sub_config_and_use(conf, 'libs/appleutility')
 	for i in children:
 		sub_config_and_use(conf, i)
 
@@ -398,6 +397,8 @@
 	autowaf.display_msg(conf, 'GtkOSX', opts.gtkosx)
 	if opts.gtkosx:
 		conf.define ('GTKOSX', 1)
+	if opts.coreaudio:
+		conf.define ('COREAUDIO', 1)
 	autowaf.display_msg(conf, 'LV2 Support', bool(conf.env['HAVE_SLV2']))
 	autowaf.display_msg(conf, 'Rubberband', bool(conf.env['HAVE_RUBBERBAND']))
 	autowaf.display_msg(conf, 'Samplerate', bool(conf.env['HAVE_SAMPLERATE']))
@@ -427,6 +428,8 @@
 
 def build(bld):
 	autowaf.set_recursive()
+	if sys.platform == 'darwin':
+		bld.add_subdirs('libs/appleutility')
 	for i in children:
 		bld.add_subdirs(i)
 

