avoid num-tracks repeat call EditorRegions::set_selected() when a region is selected...
[ardour.git] / wscript
diff --git a/wscript b/wscript
index 1fce071465f2b046d2ac047c3c17ef401a3ac45f..80596f3f5d059a99212ede4e93caa9f731822a1e 100644 (file)
--- a/wscript
+++ b/wscript
@@ -28,6 +28,7 @@ children = [
        'libs/ardour',
        'libs/gtkmm2ext',
        'libs/clearlooks-newer',
+       'libs/audiographer',
        'gtk2_ardour'
 ]
 
@@ -82,7 +83,7 @@ def create_stored_revision():
 
        try:
                text =  '#include "ardour/svn_revision.h"\n'
-               text += 'namespace ARDOUR { extern const char* svn_revision = \"' + rev + '\"; }\n'
+               text += 'namespace ARDOUR { const char* svn_revision = \"' + rev + '\"; }\n'
                print 'Writing svn revision info to libs/ardour/svn_revision.cc'
                o = file('libs/ardour/svn_revision.cc', 'w')
                o.write(text)
@@ -96,7 +97,7 @@ def set_compiler_flags (conf,opt):
        # Compiler flags and other system-dependent stuff
        #
 
-       build_host_supports_sse = 0
+       build_host_supports_sse = False
        optimization_flags = []
        if opt.gprofile:
                debug_flags = [ '-pg' ]
@@ -121,7 +122,7 @@ def set_compiler_flags (conf,opt):
                        # The [.] matches to the dot after the major version, "." would match any character
                        if re.search ("darwin[0-7][.]", config[config_kernel]) != None:
                                conf.define ('build_target', 'panther')
-                       if re.search ("darwin8[.]", config[config_kernel]) != None:
+                       elif re.search ("darwin8[.]", config[config_kernel]) != None:
                                conf.define ('build_target', 'tiger')
                        else:
                                conf.define ('build_target', 'leopard')
@@ -181,14 +182,14 @@ def set_compiler_flags (conf,opt):
                                if "mmx" in x86_flags:
                                        optimization_flags.append ("-mmmx")
                                if "sse" in x86_flags:
-                                       build_host_supports_sse = 1
+                                       build_host_supports_sse = True
                                if "3dnow" in x86_flags:
                                        optimization_flags.append ("-m3dnow")
             
-               if config[config_cpu] == "i586":
-                       optimization_flags.append ("-march=i586")
-               elif config[config_cpu] == "i686":
-                       optimization_flags.append ("-march=i686")
+                       if config[config_cpu] == "i586":
+                               optimization_flags.append ("-march=i586")
+                       elif config[config_cpu] == "i686":
+                               optimization_flags.append ("-march=i686")
     
                if ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse:
                        optimization_flags.extend (["-msse", "-mfpmath=sse", "-DUSE_XMMINTRIN"])
@@ -205,13 +206,15 @@ def set_compiler_flags (conf,opt):
                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")
-               if conf.env['build_target'] == 'x86_64':
+               elif conf.env['build_target'] == 'x86_64':
                        optimization_flags.append ("-DUSE_X86_64_ASM")
                        debug_flags.append ("-DUSE_X86_64_ASM")
-               if build_host_supports_sse != 1:
+               if not build_host_supports_sse:
                        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', ccflags='-D_XOPEN_SOURCE=600') == False:
-                       optimization_flags.append("-DNO_POSIX_MEMALIGN")
+       
+       # check this even if we aren't using FPU optimization
+       if conf.check_cc(function_name='posix_memalign', header_name='stdlib.h', ccflags='-D_XOPEN_SOURCE=600') == False:
+               optimization_flags.append("-DNO_POSIX_MEMALIGN")
 
        # end optimization section
                        
@@ -288,9 +291,9 @@ def set_compiler_flags (conf,opt):
        conf.env.append_value('CXXFLAGS', [ '-Wall', '-Woverloaded-virtual'])
 
        if opt.extra_warn:
-               conf.env.append_value('CCFLAGS', [ '-Wextra', '-pedantic', '-ansi' ])
-               conf.env.append_value('CXXFLAGS', [ '-Wextra', '-pedantic', '-ansi' ])
-               #conf.env.append_value('CFLAGS', "-iso")
+               flags = [ '-Wextra' ]
+               conf.env.append_value('CCFLAGS', flags )
+               conf.env.append_value('CXXFLAGS', flags )
 
 
        #
@@ -312,8 +315,6 @@ def set_options(opt):
        autowaf.set_options(opt)
        opt.add_option('--arch', type='string', action='store', dest='arch',
                        help='Architecture-specific compiler flags')
-       opt.add_option('--aubio', action='store_true', default=True, dest='aubio',
-                       help="Use Paul Brossier's aubio library for feature detection (if available)")
        opt.add_option('--boost-sp-debug', action='store_true', default=False, dest='boost_sp_debug',
                        help='Compile with Boost shared pointer debugging')
        opt.add_option('--audiounits', action='store_true', default=False, dest='audiounits',
@@ -325,7 +326,8 @@ def set_options(opt):
        opt.add_option('--extra-warn', action='store_true', default=False, dest='extra_warn',
                        help='Build with even more compiler warning flags')
        opt.add_option('--fpu-optimization', action='store_true', default=True, dest='fpu_optimization',
-                       help='Build runtime checked assembler code')
+                       help='Build runtime checked assembler code (default)')
+       opt.add_option('--no-fpu-optimization', action='store_false', dest='fpu_optimization')
        opt.add_option('--freedesktop', action='store_true', default=False, dest='freedesktop',
                        help='Install MIME type, icons and .desktop file as per freedesktop.org standards')
        opt.add_option('--freesound', action='store_true', default=False, dest='freesound',
@@ -337,11 +339,10 @@ def set_options(opt):
        opt.add_option('--lv2', action='store_true', default=False, dest='lv2',
                        help='Compile with support for LV2 (if slv2 is available)')
        opt.add_option('--nls', action='store_true', default=True, dest='nls',
-                       help='Enable i18n (native language support)')
+                       help='Enable i18n (native language support) (default)')
+       opt.add_option('--no-nls', action='store_false', dest='nls')
        opt.add_option('--stl-debug', action='store_true', default=False, dest='stl_debug',
                        help='Build with debugging for the STL')
-       opt.add_option('--syslibs', action='store_true', default=True, dest='syslibs',
-                       help='Use existing system versions of various libraries instead of internal ones')
        opt.add_option('--tranzport', action='store_true', default=False, dest='tranzport',
                        help='Compile with support for Frontier Designs Tranzport (if libusb is available)')
        opt.add_option('--universal', action='store_true', default=False, dest='universal',
@@ -379,7 +380,7 @@ def configure(conf):
                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")
 
@@ -392,79 +393,79 @@ def configure(conf):
                #       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.boost_sp_debug:
-               conf.env.append_value('CXXFLAGS', '-DBOOST_SP_ENABLE_DEBUG_HOOKS')
 
-       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/")
+               conf.env.append_value('CPPPATH_OSX', "/System/Library/Frameworks/")
+               conf.env.append_value('CPPPATH_OSX', "/usr/include/")
+               conf.env.append_value('CPPPATH_OSX', "/usr/include/c++/4.0.0")
+               conf.env.append_value('CPPPATH_OSX', "/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/")
+               conf.env.append_value('CPPPATH_OSX', "/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/")
+
+               conf.env.append_value('FRAMEWORK_OSX', ['CoreFoundation'])
+
+               conf.env.append_value('LINKFLAGS_OSX', ['-undefined', 'suppress'])
+               conf.env.append_value('LINKFLAGS_OSX', "-flat_namespace")
                #
-               #       I had a note the previous was for MacTypes.h
+               #       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")
+
+               # GTKOSX only builds on darwin anyways
+               if Options.options.gtkosx:
+                       #
+                       #       Define Include Paths for GTKOSX
+                       #
+                       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/")
        
-       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.coreaudio:
+                       conf.check_cc (header_name = '/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h',
+                                      define_name = 'HAVE_COREAUDIO', linkflags = ['-framework CoreAudio'],
+                                      uselib_store="COREAUDIO")
+                       conf.check_cxx (header_name = '/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h',
+                                       linkflags = [ '-framework AudioToolbox' ], uselib_store="COREAUDIO")
+                       conf.check_cc (header_name = '/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h',
+                                      linkflags = ['-framework CoreServices'], uselib_store="COREAUDIO")
+
+               if Options.options.audiounits:
+                       #conf.env.append_value('CXXFLAGS_AUDIOUNIT', "-DHAVE_AUDIOUNITS")
+                       conf.env.append_value('FRAMEWORK_AUDIOUNIT', ['AudioToolbox'])
+                       conf.env.append_value('FRAMEWORK_AUDIOUNIT', ['CoreServices'])
+                       conf.check_cc (header_name = '/System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.h',
+                                      define_name = 'HAVE_AUDIOUNITS', linkflags = [ '-framework AudioUnit' ],
+                                      uselib_store="AUDIOUNIT")
+
+       if Options.options.boost_sp_debug:
+               conf.env.append_value('CXXFLAGS', '-DBOOST_SP_ENABLE_DEBUG_HOOKS')
+
+       autowaf.check_header(conf, 'boost/signals2.hpp')
+
+       conf.check_cc(fragment = "#include <boost/version.hpp>\nint main(void) { return (BOOST_VERSION >= 103900 ? 0 : 1); }\n",
+                     execute = "1",
+                     mandatory = True,
+                     msg = 'Checking for boost library >= 1.39',
+                     okmsg = 'ok',
+                     errmsg = 'too old\nPlease install boost version 1.39 or higher.')
 
        autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
+       autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', 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')
@@ -486,6 +487,9 @@ def configure(conf):
        autowaf.display_msg(conf, 'Architecture flags', opts.arch)
        autowaf.display_msg(conf, 'Aubio', bool(conf.env['HAVE_AUBIO']))
        autowaf.display_msg(conf, 'AudioUnits', opts.audiounits)
+       autowaf.display_msg(conf, 'CoreAudio', bool(conf.env['HAVE_COREAUDIO']))
+       if bool(conf.env['HAVE_COREAUDIO']):
+               conf.define ('COREAUDIO', 1)
        if opts.audiounits:
                conf.define('AUDIOUNITS',1)
        autowaf.display_msg(conf, 'FPU Optimization', opts.fpu_optimization)
@@ -498,8 +502,6 @@ def configure(conf):
        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']))
@@ -507,7 +509,6 @@ def configure(conf):
        autowaf.display_msg(conf, 'Translation', opts.nls)
        if opts.nls:
                conf.define ('ENABLE_NLS', 1)
-       autowaf.display_msg(conf, 'System Libraries', opts.syslibs)
        autowaf.display_msg(conf, 'Tranzport', opts.tranzport)
        if opts.tranzport:
                conf.define('TRANZPORT', 1)
@@ -527,6 +528,38 @@ def configure(conf):
        autowaf.display_msg(conf, 'C Compiler flags', conf.env['CCFLAGS'])
        autowaf.display_msg(conf, 'C++ Compiler flags', conf.env['CXXFLAGS'])
 
+       # and dump the same stuff to a file for use in the build
+
+       config_text = open ('libs/ardour/config_text.cc',"w")
+       config_text.write ('#include "ardour/ardour.h"\n\nnamespace ARDOUR {\nconst char* const ardour_config_info = "\\n\\\n')
+       config_text.write ("Install prefix "); config_text.write (str (conf.env['PREFIX'])); config_text.write ("\\n\\\n")
+       config_text.write ("Debuggable build "); config_text.write (str (str(conf.env['DEBUG']))); config_text.write ("\\n\\\n")
+       config_text.write ("Strict compiler flags "); config_text.write (str (str(conf.env['STRICT']))); config_text.write ("\\n\\\n")
+       config_text.write ("Build documentation "); config_text.write (str (str(conf.env['BUILD_DOCS']))); config_text.write ("\\n\\\n")
+       config_text.write ('Build Target '); config_text.write (str (conf.env['build_target'])); config_text.write ("\\n\\\n")
+       config_text.write ('Architecture flags '); config_text.write (str (opts.arch)); config_text.write ("\\n\\\n")
+       config_text.write ('Aubio '); config_text.write (str (bool(conf.env['HAVE_AUBIO']))); config_text.write ("\\n\\\n")
+       config_text.write ('AudioUnits '); config_text.write (str (opts.audiounits)); config_text.write ("\\n\\\n")
+       config_text.write ('CoreAudio '); config_text.write (str (bool(conf.env['HAVE_COREAUDIO']))); config_text.write ("\\n\\\n")
+       config_text.write ('FPU Optimization '); config_text.write (str (opts.fpu_optimization)); config_text.write ("\\n\\\n")
+       config_text.write ('Freedesktop Files '); config_text.write (str (opts.freedesktop)); config_text.write ("\\n\\\n")
+       config_text.write ('Freesound '); config_text.write (str (opts.freesound)); config_text.write ("\\n\\\n")
+       config_text.write ('GtkOSX '); config_text.write (str (opts.gtkosx)); config_text.write ("\\n\\\n")
+       config_text.write ('LV2 Support '); config_text.write (str (bool(conf.env['HAVE_SLV2']))); config_text.write ("\\n\\\n")
+       config_text.write ('Rubberband '); config_text.write (str (bool(conf.env['HAVE_RUBBERBAND']))); config_text.write ("\\n\\\n")
+       config_text.write ('Samplerate '); config_text.write (str (bool(conf.env['HAVE_SAMPLERATE']))); config_text.write ("\\n\\\n")
+       config_text.write ('Soundtouch '); config_text.write (str (bool(conf.env['HAVE_SOUNDTOUCH']))); config_text.write ("\\n\\\n")
+       config_text.write ('Translation '); config_text.write (str (opts.nls)); config_text.write ("\\n\\\n")
+       config_text.write ('Tranzport '); config_text.write (str (opts.tranzport)); config_text.write ("\\n\\\n")
+       config_text.write ('Universal Binary '); config_text.write (str (opts.universal)); config_text.write ("\\n\\\n")
+       config_text.write ('VST Support '); config_text.write (str (opts.vst)); config_text.write ("\\n\\\n")
+       config_text.write ('Wiimote Support '); config_text.write (str (opts.wiimote)); config_text.write ("\\n\\\n")
+       config_text.write ('Windows Key '); config_text.write (str (opts.windows_key)); config_text.write ("\\n\\\n")
+       config_text.write ('C Compiler flags '); config_text.write (str (conf.env['CCFLAGS'])); config_text.write ("\\n\\\n")
+       config_text.write ('C++ Compiler flags '); config_text.write (str (conf.env['CXXFLAGS'])); config_text.write ("\\n\\\n")
+       config_text.write ('";}\n')
+       config_text.close ()
+
 def build(bld):
        autowaf.set_recursive()
        if sys.platform == 'darwin':