wscript: make sure all libav libraries are installed to build source_avcodec
authorPaul Brossier <piem@piem.org>
Tue, 10 Dec 2013 13:30:42 +0000 (08:30 -0500)
committerPaul Brossier <piem@piem.org>
Tue, 10 Dec 2013 13:30:42 +0000 (08:30 -0500)
Signed-off-by: Paul Brossier <piem@piem.org>
src/io/source.c
src/io/source_avcodec.c
wscript

index e82ff49..b5e6fe8 100644 (file)
@@ -23,9 +23,9 @@
 #include "fvec.h"
 #include "fmat.h"
 #include "io/source.h"
-#ifdef HAVE_AVCODEC
+#ifdef HAVE_LIBAV
 #include "io/source_avcodec.h"
-#endif /* HAVE_AVCODEC */
+#endif /* HAVE_LIBAV */
 #ifdef __APPLE__
 #include "io/source_apple_audio.h"
 #endif /* __APPLE__ */
@@ -52,7 +52,7 @@ struct _aubio_source_t {
 
 aubio_source_t * new_aubio_source(char_t * uri, uint_t samplerate, uint_t hop_size) {
   aubio_source_t * s = AUBIO_NEW(aubio_source_t);
-#if HAVE_AVCODEC
+#if HAVE_LIBAV
   s->source = (void *)new_aubio_source_avcodec(uri, samplerate, hop_size);
   if (s->source) {
     s->s_do = (aubio_source_do_t)(aubio_source_avcodec_do);
@@ -63,7 +63,7 @@ aubio_source_t * new_aubio_source(char_t * uri, uint_t samplerate, uint_t hop_si
     s->s_del = (del_aubio_source_t)(del_aubio_source_avcodec);
     return s;
   }
-#endif /* HAVE_AVCODEC */
+#endif /* HAVE_LIBAV */
 #ifdef __APPLE__
   s->source = (void *)new_aubio_source_apple_audio(uri, samplerate, hop_size);
   if (s->source) {
index ad0797b..7e8589f 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "config.h"
 
-#ifdef HAVE_AVCODEC
+#ifdef HAVE_LIBAV
 
 #include <sndfile.h>
 #include <libavcodec/avcodec.h>
@@ -402,4 +402,4 @@ void del_aubio_source_avcodec(aubio_source_avcodec_t * s){
   AUBIO_FREE(s);
 }
 
-#endif /* HAVE_SNDFILE */
+#endif /* HAVE_LIBAV */
diff --git a/wscript b/wscript
index 3d5aab4..94f0d04 100644 (file)
--- a/wscript
+++ b/wscript
@@ -213,6 +213,12 @@ def configure(ctx):
                 args = '--cflags --libs', uselib_store = 'AVUTIL', mandatory = False)
         ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1',
                 args = '--cflags --libs', uselib_store = 'AVRESAMPLE', mandatory = False)
+        if all ( 'HAVE_' + i in ctx.env.define_key
+                for i in ['AVCODEC', 'AVFORMAT', 'AVUTIL', 'AVRESAMPLE'] ):
+            ctx.define('HAVE_LIBAV', 1)
+            ctx.msg('Checking for all libav libraries', 'yes')
+        else:
+            ctx.msg('Checking for all libav libraries', 'not found', color = 'YELLOW')
 
     # use memcpy hacks
     if (ctx.options.enable_memcpy == True):