fix crash when copy'ing latent plugins
[ardour.git] / libs / backends / jack / wscript
index 3f99a2127e842bfa69f3612c31aa8549e1ffba3c..8de15ef74d93e9d384551021e931f9508ffb4337 100644 (file)
@@ -5,11 +5,6 @@ import os
 import sys
 import re
 
-# Library version (UNIX style major, minor, micro)
-# major increment <=> incompatible changes
-# minor increment <=> compatible changes (additions)
-# micro increment <=> no interface changes
-JACKBACKEND_VERSION = '1.0.0'
 I18N_PACKAGE = 'jack-backend'
 
 # Mandatory variables
@@ -42,10 +37,32 @@ def configure(conf):
     else:
         conf.env['libjack_link'] = "link"
 
+    # Check that metadata API is available and working
+    conf.check_cxx(fragment = "#include <jack/jack.h>\n#include <jack/metadata.h>\nint main(void) { jack_port_uuid(NULL); return 0; }\n",
+                   mandatory = False,
+                   msg = 'Checking for JACK metadata API',
+                   execute = False,
+                   features = ['cxx'],
+                   okmsg = 'ok',
+                   errmsg = 'not found (or broken). JACK metadata API will not be used',
+                   define_name = 'HAVE_JACK_METADATA',
+                   uselib = 'JACK')
+
+    # Check to see if jack_port_rename() is available and working
+    if conf.env['libjack_link'] == 'link':
+            conf.check_cxx(fragment = "#include <jack/jack.h>\nint main(void) { jack_client_t* c; jack_port_t* p; jack_port_rename (c, p, \"foo\"); return 0; }\n",
+                   mandatory = False,
+                   execute = False,
+                   features = ['cxx'],
+                   msg = 'Checking for jack_port_rename()',
+                   okmsg = 'ok',
+                   errmsg = 'not found (or broken). jack_port_rename() will not be used, and jack_port_set_name() will be used instead',
+                   define_name = 'HAVE_JACK_PORT_RENAME',
+                   uselib = 'JACK')
 
 def build(bld):
-    obj = bld(features = 'cxx cxxshlib')
-    obj.source = [ 
+    obj = bld(features = 'c cxx cxxshlib')
+    obj.source = [
             'jack_api.cc',
             'jack_connection.cc',
             'jack_audiobackend.cc',
@@ -57,29 +74,46 @@ def build(bld):
     obj.includes = ['.']
     obj.name     = 'jack_audiobackend'
     obj.target   = 'jack_audiobackend'
-    obj.defines = ['PACKAGE="' + I18N_PACKAGE + '"', 
+    obj.defines = ['PACKAGE="' + I18N_PACKAGE + '"',
                    'ARDOURBACKEND_DLL_EXPORTS'
                    ]
     obj.use      = 'libardour libpbd ardouralsautil'
     obj.install_path  = os.path.join(bld.env['LIBDIR'], 'backends')
-    obj.cxxflags = [ '-fPIC' ]
-    obj.cflags   = [ '-fPIC' ]
+    if bld.env['build_target'] != 'mingw':
+        obj.cxxflags = [ '-fPIC' ]
+        obj.cflags   = [ '-fPIC' ]
+    else:
+        obj.cxxflags = [ ]
+        obj.cflags   = [ ]
+
+    if bld.is_defined ('HAVE_JACK_METADATA'):
+        obj.cxxflags += [ '-DHAVE_JACK_METADATA' ]
+        obj.cflags += [ '-DHAVE_JACK_METADATA' ]
+
+    if bld.is_defined ('HAVE_JACK_PORT_RENAME'):
+        obj.cxxflags += [ '-DHAVE_JACK_PORT_RENAME' ]
+        obj.cflags += [ '-DHAVE_JACK_PORT_RENAME' ]
 
     if (bld.env['build_target'] == 'mingw'):
         obj.uselib   = [ 'PORTAUDIO' ]
     else:
         obj.uselib   = [ ]
-        obj.vnum     = JACKBACKEND_VERSION
 
     if bld.env['libjack_link'] == 'link':
         obj.uselib   += [ 'JACK' ]
-    else:
+    elif bld.env['build_target'] == 'mingw':
         obj.defines += [ 'USE_WEAK_JACK' ]
+        obj.deps = [ 'weak_libjack.def' ]
+    else:
+        obj.defines += [ 'USE_WEAK_JACK', 'HAVE_JACK_PORT_RENAME' ]
+        obj.deps = [ 'weak_libjack.def' ]
+
+    obj.uselib   += [ 'GLIBMM', 'XML' ];
 
     #
     # device discovery code in the jack backend needs ALSA
     # on Linux.
-    # 
+    #
 
     if re.search ("linux", sys.platform) != None:
        obj.uselib += [ 'ALSA' ]