shithub: aubio

Download patch

ref: 5215c01429c3ab39db65f1b8715ac52aab51d16c
parent: cad87837c401ad73f68409915193e169a16c1c79
author: Paul Brossier <piem@altern.org>
date: Mon Aug 8 22:21:02 EDT 2005

add c99 varargs checks, thanks to Mo DeJong

--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-dnl Process this file with autoconf to porduce a configure script
+dnl Process this file with autoconf to produce a configure script
 
 AC_INIT(src/aubio.h)
 
@@ -8,6 +8,7 @@
 PACKAGE=aubio
 
 AM_INIT_AUTOMAKE(${PACKAGE}, ${VERSION})
+AM_MAINTAINER_MODE
 
 AC_PREFIX_DEFAULT(/usr)
 
@@ -81,6 +82,24 @@
 AC_CHECK_HEADERS(complex.h,,AC_MSG_ERROR([Ouch! missing complex.h header]))
 AC_CHECK_HEADERS(fftw3.h  ,,AC_MSG_ERROR([Ouch! missing fftw3.h headeri]))
 
+AC_CACHE_CHECK(for C99 __VA_ARGS__ macro,
+    ac_cv_varargs_macros,
+AC_TRY_COMPILE([
+  #include <stdio.h>
+  #define AUBIO_ERR(...)                       fprintf(stderr, __VA_ARGS__)
+],
+[
+  AUBIO_ERR("%s\n", "ERR");
+],
+        ac_cv_varargs_macros=yes,
+        ac_cv_varargs_macros=no)
+)
+if test "$ac_cv_varargs_macros" = "yes"; then
+    AC_DEFINE(HAVE_C99_VARARGS_MACROS, 1,
+            [Defined when c99 style varargs macros are supported])
+fi
+
+
 dnl check for pkg-config
 AC_PATH_PROG(PKG_CONFIG,pkg-config,no)
 
@@ -153,6 +172,12 @@
 	fi
 fi
   
+AC_ARG_ENABLE(testprogs,
+  AC_HELP_STRING([--enable-testprogs],[compile test programs [[default=no]]]),
+  [with_testprogs=$enableval],
+  with_testprogs="no")
+AM_CONDITIONAL(COMPILE_TESTS,test "${with_testprogs}" != "no")
+
 dnl Check for optional programs
 
 dnl should check for swig version and python headers
@@ -178,7 +203,7 @@
 AC_PATH_PROG(DOCBOOK_TO_MAN,docbook-to-man,no)
 AM_CONDITIONAL(DOCBOOKFOUND, test "${DOCBOOK_TO_MAN}" != "no")
 
-AC_CHECK_HEADER(m_pd.h,PUREDATA=y,AC_MSG_WARN([Ouch! puredata header not found]))
+AC_CHECK_HEADER(m_pd.h,PUREDATA=y,AC_MSG_WARN([Puredata header not found.]))
 AM_CONDITIONAL(PUREDATAFOUND, test "${PUREDATA}" = "y")
 
 AC_OUTPUT([
@@ -186,8 +211,9 @@
 		src/Makefile
 		ext/Makefile
 		examples/Makefile
+		examples/tests/Makefile
 		sounds/Makefile
-                swig/Makefile
+		swig/Makefile
 		python/Makefile
 		python/aubio/Makefile
 		plugins/Makefile
--- a/src/aubio_priv.h
+++ b/src/aubio_priv.h
@@ -116,10 +116,17 @@
   AUBIO_FAIL = -1
 } aubio_status;
 
-#define AUBIO_ERR(...)							fprintf(stderr,__VA_ARGS__)
-#define AUBIO_MSG(...)							fprintf(stdout,__VA_ARGS__)
-#define AUBIO_DBG(...)							fprintf(stderr,__VA_ARGS__)
-#define AUBIO_QUIT(_s)							exit(_s)
-#define AUBIO_SPRINTF               sprintf
+#ifdef HAVE_C99_VARARGS_MACROS
+#define AUBIO_ERR(...)               fprintf(stderr,__VA_ARGS__)
+#define AUBIO_MSG(...)               fprintf(stdout,__VA_ARGS__)
+#define AUBIO_DBG(...)               fprintf(stderr,__VA_ARGS__)
+#else
+#define AUBIO_ERR(format, args...)   fprintf(stderr, format , ##args)
+#define AUBIO_MSG(format, args...)   fprintf(stdout, format , ##args)
+#define AUBIO_DBG(format, args...)   fprintf(stderr, format , ##args)
+#endif
+
+#define AUBIO_QUIT(_s)               exit(_s)
+#define AUBIO_SPRINTF                sprintf
 
 #endif/*_AUBIO_PRIV_H*/
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -12,6 +12,9 @@
 /* Define to enable fftw3 support */
 #undef FFTW3_SUPPORT
 
+/* Defined when c99 style varargs macros are supported */
+#undef HAVE_C99_VARARGS_MACROS
+
 /* Define to 1 if you have the <complex.h> header file. */
 #undef HAVE_COMPLEX_H