shithub: aubio

Download patch

ref: 795fcd9f0c9481f47efd4382fb07e80cfed35c97
parent: e9270a4d444368d159296883a20099b0055163bf
author: Paul Brossier <piem@piem.org>
date: Wed Aug 12 15:01:34 EDT 2015

wscript: make foo mandatory only when --enable-foo is passed

--- a/wscript
+++ b/wscript
@@ -178,17 +178,22 @@
         # one of fftwf or fftw3f
         if (ctx.options.enable_fftw3f != False):
             ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
-                    args = '--cflags --libs', mandatory = False)
+                    args = '--cflags --libs',
+                    mandatory = ctx.options.enable_fftw3f)
             if (ctx.options.enable_double == True):
-                ctx.msg('Warning', 'fftw3f enabled, but compiling in double precision!')
+                ctx.msg('Warning',
+                        'fftw3f enabled, but compiling in double precision!')
         else:
-            # fftw3f not enabled, take most sensible one according to enable_double
+            # fftw3f disabled, take most sensible one according to
+            # enable_double
             if (ctx.options.enable_double == True):
                 ctx.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
-                        args = '--cflags --libs', mandatory = False)
+                        args = '--cflags --libs', mandatory =
+                        ctx.options.enable_fftw3)
             else:
                 ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
-                        args = '--cflags --libs', mandatory = False)
+                        args = '--cflags --libs',
+                        mandatory = ctx.options.enable_fftw3)
         ctx.define('HAVE_FFTW3', 1)
 
     # fftw not enabled, use vDSP or ooura
@@ -204,28 +209,35 @@
     # check for libsndfile
     if (ctx.options.enable_sndfile != False):
         ctx.check_cfg(package = 'sndfile', atleast_version = '1.0.4',
-                args = '--cflags --libs', mandatory = False)
+                args = '--cflags --libs',
+                mandatory = ctx.options.enable_sndfile)
 
     # check for libsamplerate
     if (ctx.options.enable_samplerate != False):
         ctx.check_cfg(package = 'samplerate', atleast_version = '0.0.15',
-                args = '--cflags --libs', mandatory = False)
+                args = '--cflags --libs',
+                mandatory = ctx.options.enable_samplerate)
 
     # check for jack
     if (ctx.options.enable_jack != False):
         ctx.check_cfg(package = 'jack',
-                args = '--cflags --libs', mandatory = False)
+                args = '--cflags --libs',
+                mandatory = ctx.options.enable_jack)
 
     # check for libav
     if (ctx.options.enable_avcodec != False):
         ctx.check_cfg(package = 'libavcodec', atleast_version = '54.35.0',
-                args = '--cflags --libs', uselib_store = 'AVCODEC', mandatory = False)
+                args = '--cflags --libs', uselib_store = 'AVCODEC',
+                mandatory = ctx.options.enable_avcodec)
         ctx.check_cfg(package = 'libavformat', atleast_version = '52.3.0',
-                args = '--cflags --libs', uselib_store = 'AVFORMAT', mandatory = False)
+                args = '--cflags --libs', uselib_store = 'AVFORMAT',
+                mandatory = ctx.options.enable_avcodec)
         ctx.check_cfg(package = 'libavutil', atleast_version = '52.3.0',
-                args = '--cflags --libs', uselib_store = 'AVUTIL', mandatory = False)
+                args = '--cflags --libs', uselib_store = 'AVUTIL',
+                mandatory = ctx.options.enable_avcodec)
         ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1',
-                args = '--cflags --libs', uselib_store = 'AVRESAMPLE', mandatory = False)
+                args = '--cflags --libs', uselib_store = 'AVRESAMPLE',
+                mandatory = ctx.options.enable_avcodec)
         if all ( 'HAVE_' + i in ctx.env.define_key
                 for i in ['AVCODEC', 'AVFORMAT', 'AVUTIL', 'AVRESAMPLE'] ):
             ctx.define('HAVE_LIBAV', 1)