FST code from 2.X branch
[ardour.git] / libs / fst / SConscript
index bdffd959b5745c55ce2a3d8b44036db515f6b991..a543d72a501ae4f7cbb0b7e9299fdaa0f58368f0 100644 (file)
@@ -7,50 +7,64 @@ import glob
 
 fst_src = glob.glob('*.c')
 
-Import('env install_prefix')
-fst = env.Copy(CC="winegcc")
+Import('env install_prefix libraries')
+fst = env.Clone()
 fst.Append (CPPPATH=".")
-
-if fst['VST']:
-    vst_dir     = Dir ('libs/vst')
-    vst_sdk_dir = Dir ('vstsdk2.3')
-    #
-    # if it exists, try to use the Steinberg zip package
-    #
-    vst_sdk_zip = File ('vstsdk2.3.zip')
-
-    if os.access (vst_sdk_zip.abspath, os.F_OK):
-        print 'VST package discovered.'
-    elif os.access ('vst_sdk2_3.zip', os.F_OK):
-        #
-        # add a build target that unpacks the zip package the Steinberg "meta" zip package
-        #
-        vst_meta_zip = fst.Command (vst_sdk_zip, 'vst_sdk2_3.zip',  "unzip -o -d ${TARGET.dir} $SOURCES vstsdk2.3.zip" )
-        print 'VST meta-package discovered.'
-    else:
-        if os.access ('vstsdk2.3.zip', os.F_OK) != 1:
-            print 'Did not find vst_sdk2_3.zip or vstsdk2.3.zip in libs/fst.'
-            print 'Make sure the correct file is in the correct location and correctly named.'
-            print 'Please see http://ardour.org/building_vst_support for more information.'
-            sys.exit (1)    
-
-    vst_headers = fst.Command ([ 'vst/aeffectx.h', 'vst/AEffect.h' ], vst_sdk_zip, [
-        "unzip -qq -d ${SOURCE.dir} -o $SOURCE",
-        Delete ('$TARGET.dir'),
-        Copy ('${TARGET.dir}', 'libs/fst/vstsdk2.3/source/common'),
-        "sed -i '/struct VstFileType\|struct VstFileSelect/,/};/d' $TARGET"
+fst.Merge ([
+        libraries['jack'],
+        libraries['glib2']
         ])
 
+#
+# See if JACK supports jack_set_thread_creator()
+#
+
+jack_test_source_file = """
+#include <jack/jack.h>
+#include <pthread.h>
+int
+my_pthread_create (pthread_t* thread_id, const pthread_attr_t* attr, void *(*function)(void*), void* arg)
+{
+    return 0;
+}
+int main(int argc, char **argv)
+{
+    jack_set_thread_creator (my_pthread_create);
+    return 0;
+}
+"""
+def CheckJackSetThreadCreator(context):
+    context.Message('Checking for jack_set_thread_creator()...')
+    result = context.TryLink(jack_test_source_file, '.c')
+    context.Result(result)
+    return result
+
+
+conf = Configure(fst, custom_tests = {
+       'CheckJackSetThreadCreator' : CheckJackSetThreadCreator,
+})
+
+if conf.CheckJackSetThreadCreator():
+    fst.Append(CCFLAGS="-DHAVE_JACK_SET_THREAD_CREATOR")
+
+fst = conf.Finish ()
+
+if fst['VST']:
+    fst.Replace(CC = ("winegcc"))
     a = fst.Object ('fst', 'fst.c')
     b = fst.Object ('fstinfofile', 'fstinfofile.c')
     c = fst.Object ('vstwin', 'vstwin.c')
     d = fst.Object ('vsti', 'vsti.c')
-
-    Default([vst_headers,a,b,c,d])
+    e = fst.Object ('thread', 'thread.c')
+    Default([a,b,c,d,e])
     
+vestige_headers = glob.glob ('vestige/*.h')
+
 env.Alias('tarball', env.Distribute (env['DISTTREE'],
-                                     fst_src + ['SConscript',
-                                                'fst.h',
-                                                'jackvst.h'
-                                                ] ))
+                                     fst_src + vestige_headers +
+                                     ['SConscript',
+                                      'fst.h',
+                                      'jackvst.h',
+                                      ] 
+                                     ))