configure.ac, Makefile.am, plugins: move to pd-aubio
[aubio.git] / configure.ac
index a7516c02dfdfbd5d2896db6389f4966dc91f44ca..71a1a6ac1c875ad5220b4e3e4ea8f77eb145d3e6 100644 (file)
@@ -10,15 +10,15 @@ AUBIO_VERSION=${AUBIO_MAJOR_VERSION}.${AUBIO_MINOR_VERSION}.${AUBIO_PATCH_VERSIO
 VERSION=${AUBIO_VERSION}
 
 dnl Shared library version
-LIBAUBIO_LT_CURRENT=2
-LIBAUBIO_LT_REVISION=0
-LIBAUBIO_LT_AGE=0
-SHARED_VERSION_INFO="$LIBAUBIO_LT_CURRENT:$LIBAUBIO_LT_REVISION:$LIBAUBIO_LT_AGE"
+SHARED_VERSION_INFO=${LIBAUBIO_LT_CUR}:${LIBAUBIO_LT_REV}:${LIBAUBIO_LT_AGE}
 AC_SUBST(SHARED_VERSION_INFO)
 
 dnl Init automake
 AM_INIT_AUTOMAKE(${PACKAGE}, ${VERSION})
 
+dnl Enable silent rules, use with make V=0 
+dnl AM_SILENT_RULES
+
 dnl Maintainer mode
 AM_MAINTAINER_MODE
 
@@ -27,28 +27,38 @@ AC_CANONICAL_HOST
 
 dnl Check for programs
 AC_PROG_CC
+AM_PROG_CC_C_O dnl compiling with per-target flag 
 if test "$ac_cv_prog_cc" = "no" ; then
    AC_MSG_ERROR([*** No C compiler found !])
 fi
 AC_PROG_INSTALL
 
-dnl Default optimization
-CFLAGS="$CFLAGS -O2"
+AUBIO_CFLAGS=
+
+dnl Enable double precision (no)
+AC_ARG_ENABLE(double,
+  AC_HELP_STRING([--enable-double],[compile in double precision [[default=no]]]),
+  with_double_precision="yes",
+  with_double_precision="no")
+if test "$with_double_precision" = "yes"
+then
+  AC_DEFINE(HAVE_AUBIO_DOUBLE,1,[Define to enable double precision])
+fi
 
 dnl Enable debugging (no)
 AC_ARG_ENABLE(debug,
-  [  --enable-debug[[=value]]  compile with debug [[default=no]]],
+  AC_HELP_STRING([--enable-debug],[compile in debug mode [[default=no]]]),
   with_debug="yes",
   with_debug="no")
 if test "$with_debug" = "yes"
 then
   AC_DEFINE(DEBUG,1,[Define to enable debug])
-  CFLAGS="$CFLAGS -g"
+  AUBIO_CFLAGS="$AUBIO_CFLAGS -g"
 fi
 
 dnl Enable full warnings (yes)
-AC_ARG_ENABLE(warnme,
-  [  --enable-warnme[[=value]] compile with all -W [[default=yes]]],
+AC_ARG_ENABLE(warnings,
+  AC_HELP_STRING([--enable-warnings],[compile with all gcc warnings [[default=yes]]]),
   with_warnme="no",
   with_warnme="yes")
 if test "$with_warnme" = "yes"
@@ -59,39 +69,50 @@ then
   CFLAGS="$CFLAGS -Wextra"
   AC_COMPILE_IFELSE([void foo (void) {}],
           ac_cv_cc_wextra=yes, ac_cv_cc_wextra=no)
+  CFLAGS="$old_CFLAGS"
   ])
   if test "$ac_cv_cc_wextra" = "yes"
   then
-    CFLAGS="$old_CFLAGS -Wall -Wextra"
+    AUBIO_CFLAGS="$AUBIO_CFLAGS -Wall -Wextra"
   else 
-    CFLAGS="$old_CFLAGS -Wall"
+    AUBIO_CFLAGS="$AUBIO_CFLAGS -Wall"
   fi
 fi
 
-AC_ARG_ENABLE(failonerror,
-  [  --enable-fwarn[[=value]]  fail on compilation warnings [[default=yes]]],
-  with_warnme="no",
-  CFLAGS="$CFLAGS -Werror -Wmissing-prototypes -Wmissing-declarations -Wno-unused-parameter")
+dnl fail on compilation warnings 
+AC_ARG_ENABLE(errorfail,
+  AC_HELP_STRING([--enable-errorfail],[fail on compilation warnings [[default=no]]]),
+  AUBIO_CFLAGS="$AUBIO_CFLAGS -Werror -Wmissing-prototypes -Wmissing-declarations -Wno-unused-parameter",
+  with_errorfail="no")
+
+dnl add gcov/lcov profiling and coverage flags
+AC_ARG_ENABLE(lcov,
+  AC_HELP_STRING([--enable-lcov],[compile with gcov/lcov profiling flags [[default=no]]]),
+  AUBIO_CFLAGS="$AUBIO_CFLAGS -fprofile-arcs -ftest-coverage",
+  with_lcov="no")
 
 dnl Check for libtool
 AC_LIBTOOL_DLOPEN
 dnl AC_DISABLE_STATIC
+dnl allow cross compiling
+AC_LIBTOOL_WIN32_DLL
 AC_PROG_LIBTOOL
 
 AC_CONFIG_HEADERS(src/config.h)
 AC_CONFIG_FILES(aubio.pc)
 
-case "${host_os}" in
-*mingw*)
+AM_CONDITIONAL(MINGW, false)
+AM_CONDITIONAL(DARWIN, false)
+case "${host}" in
+*mingw* | *cygwin*)
   mingw32_support="yes"
   AC_CHECK_HEADER(windows.h)
+  AM_CONDITIONAL(MINGW, true)
+  LDFLAGS="$LDFLAGS -no-undefined"
   ;;
-*darwin*)
-  dnl on macosx, cosf went to -lmx
-  LDFLAGS="$LDFLAGS -lmx"
-  dnl as long double doesn't sit well with -Wall -Werror
-  CFLAGS="$CFLAGS -Wno-long-double"
+*darwin* | *rhapsody* | *macosx*)
   AC_ISC_POSIX
+  AM_CONDITIONAL(DARWIN, true)
   ;;
 *)
   AC_ISC_POSIX
@@ -102,10 +123,15 @@ dnl Check for required libraries
 AC_CHECK_LIB(pthread, pthread_create)
 
 dnl Check for header files
-AC_HEADER_STDC
-AC_CHECK_HEADERS([string.h stdlib.h stdio.h math.h errno.h stdarg.h unistd.h signal.h],,)
-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 header]))
+AC_CHECK_HEADERS([string.h stdlib.h stdio.h math.h limits.h errno.h stdarg.h unistd.h signal.h],,)
+AC_CHECK_HEADERS(fftw3.h,,AC_MSG_ERROR([Ouch! missing fftw3.h header]))
+AC_ARG_ENABLE(complex,
+  AC_HELP_STRING([--enable-complex],[compile with complex.h [[default=auto]]]),
+  [with_complex=$enableval],
+  with_complex="no")
+if test "$with_complex" = "yes"; then
+  AC_CHECK_HEADERS(complex.h,,AC_MSG_WARN([Ouch! missing complex.h header]))
+fi
 
 dnl Check for __VAR_ARGS__ support
 AC_CACHE_CHECK(for C99 __VA_ARGS__ macro,
@@ -128,31 +154,48 @@ fi
 dnl Check for pkg-config
 AC_PATH_PROG(PKG_CONFIG,pkg-config,no)
 
-PKG_CHECK_MODULES(SNDLIB,     sndfile >= 1.0.4,       SNDLIB_SUPPORT=1)
-PKG_CHECK_MODULES(SAMPLERATE, samplerate  >= 0.0.15,  SAMPLERATE_SUPPORT=1)
+PKG_CHECK_MODULES(SNDFILE,     sndfile >= 1.0.4,       HAVE_SNDFILE=1)
+if test "${HAVE_SNDFILE}" = "1"; then
+  AC_DEFINE(HAVE_SNDFILE,1,[Define to enable libsndfile support])
+fi
 
-if test "${SNDLIB_SUPPORT}" = "1"; then
-  AC_DEFINE(SNDLIB_SUPPORT,1,[Define to enable libsndfile support])
+dnl Enable samplerate support (auto)
+AC_ARG_ENABLE(samplerate,
+  AC_HELP_STRING([--enable-samplerate],[compile with samplerate [[default=auto]]]),
+  [with_samplerate=$enableval],
+  with_samplerate="yes")
+if test "$with_samplerate" = "yes"; then
+  PKG_CHECK_MODULES(SAMPLERATE, samplerate  >= 0.0.15,  HAVE_SAMPLERATE=1,
+                    HAVE_SAMPLERATE=0)
+  if test "${HAVE_SAMPLERATE}" = "1"; then
+    AC_DEFINE(HAVE_SAMPLERATE,1,[Define to enable libsamplerate support])
+  fi
 fi
 
 dnl Check for fftw3 (required)
+dnl if we compile in double precsion, default to fftw3, else fftw3f
+if test "$with_double_precision" = "yes"; then
+    default_fftw3f="no"
+else
+    default_fftw3f="yes"
+fi
 AC_ARG_ENABLE(fftw3f,
   AC_HELP_STRING([--enable-fftw3f],[compile with fftw3f [[default=auto]]]),
   [with_fftw3f=$enableval],
-  with_fftw3f="yes")
+  [with_fftw3f=$default_fftw3f])
 if test "$with_fftw3f" = "yes"; then
-  PKG_CHECK_MODULES(FFTWLIB,    fftw3f >= 3.0.0,     FFTW3F_SUPPORT=1, FFTW3F_SUPPORT=0)
+  PKG_CHECK_MODULES(FFTWLIB,    fftw3f >= 3.0.0,     HAVE_FFTW3F=1, HAVE_FFTW3F=0)
 else
-  PKG_CHECK_MODULES(FFTWLIB,    fftw3  >= 3.0.0,     FFTW3_SUPPORT=1)
+  PKG_CHECK_MODULES(FFTWLIB,    fftw3  >= 3.0.0,     HAVE_FFTW3=1)
 fi
-if test "${FFTW3F_SUPPORT}" = "0"; then
-  PKG_CHECK_MODULES(FFTWLIB,    fftw3  >= 3.0.0,     FFTW3_SUPPORT=1)
+if test "${HAVE_FFTW3F}" = "0"; then
+  PKG_CHECK_MODULES(FFTWLIB,    fftw3  >= 3.0.0,     HAVE_FFTW3=1)
 fi
-if test "${FFTW3_SUPPORT}" = "1"; then
-  AC_DEFINE(FFTW3_SUPPORT,1,[Define to enable fftw3 support])
+if test "${HAVE_FFTW3}" = "1"; then
+  AC_DEFINE(HAVE_FFTW3,1,[Define to enable fftw3 support])
 fi
-if test "${FFTW3F_SUPPORT}" = "1"; then
-  AC_DEFINE(FFTW3F_SUPPORT,1,[Define to enable fftw3f support])
+if test "${HAVE_FFTW3F}" = "1"; then
+  AC_DEFINE(HAVE_FFTW3F,1,[Define to enable fftw3f support])
 fi
 
 dnl Enable jack support (auto)
@@ -162,27 +205,9 @@ AC_ARG_ENABLE(jack,
   with_jack="yes")
 if test "$with_jack" = "yes"
 then
-  PKG_CHECK_MODULES(JACK,       jack  >= 0.15.0,     JACK_SUPPORT=1, JACK_SUPPORT=0)
-  if test "${JACK_SUPPORT}" = "1"; then
-    AC_DEFINE(JACK_SUPPORT,1,[Define to enable jack support])
-  fi
-fi
-
-dnl Enable alsa support (auto)
-AC_ARG_ENABLE(alsa,
-  AC_HELP_STRING([--enable-alsa],[compile with alsa [[default=auto]]]),
-  [with_alsa=$enableval],
-  with_alsa="yes")
-if test "$with_alsa" = "yes"
-then
-  if test "$with_jack" = "yes"
-  then
-    PKG_CHECK_MODULES(ALSA,      alsa >= 0.0.9,      ALSA_SUPPORT=1, ALSA_SUPPORT=0)
-    if test "${ALSA_SUPPORT}" = "1"; then
-      AC_DEFINE(ALSA_SUPPORT,1,[Define to enable alsa support])
-    fi
-  else
-    AC_MSG_WARN([Disabling alsa as jack was not found])
+  PKG_CHECK_MODULES(JACK,       jack  >= 0.15.0,     HAVE_JACK=1, HAVE_JACK=0)
+  if test "${HAVE_JACK}" = "1"; then
+    AC_DEFINE(HAVE_JACK,1,[Define to enable jack support])
   fi
 fi
 
@@ -193,9 +218,9 @@ AC_ARG_ENABLE(lash,
   with_lash="yes")
 if test "$with_lash" = "yes"
 then
-  PKG_CHECK_MODULES(LASH,   lash-1.0 >= 0.5.0,   LASH_SUPPORT=1, LASH_SUPPORT=0)
-  if test "${LASH_SUPPORT}" = "1"; then
-    LASH_CFLAGS+="-DLASH_SUPPORT"
+  PKG_CHECK_MODULES(LASH,   lash-1.0 >= 0.5.0,   HAVE_LASH=1, HAVE_LASH=0)
+  if test "${HAVE_LASH}" = "1"; then
+    LASH_CFLAGS+="-DHAVE_LASH"
   fi
 fi
   
@@ -206,51 +231,36 @@ AC_ARG_ENABLE(testprogs,
   with_testprogs="no")
 AM_CONDITIONAL(COMPILE_TESTS,test "${with_testprogs}" != "no")
 
+AC_SUBST(AUBIO_CFLAGS)
+
 dnl Check for swig and python
 dnl should check for swig version and python headers
 AC_PATH_PROG(SWIG,swig,no)
 AM_CONDITIONAL(SWIGFOUND, test "${SWIG}" != "no")
 AM_PATH_PYTHON
 AM_CONDITIONAL(PYTHONFOUND, test "${PYTHON}" != "no")
-#
-#if PYTHONFOUND
-case "${host_os}" in
-*darwin*)
-  SWCFLAGS="-Wno-long-double"
-  SWLDFLAGS="-bundle -framework python -L${prefix}/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
-  ;;
-*)
-  SWLDFLAGS="-shared"
-  ;;
-esac
-#
-AC_SUBST(SWCFLAGS)
-AC_SUBST(SWLDFLAGS)
 
 dnl Check for docbook-to-man
 AC_PATH_PROG(DOCBOOK_TO_MAN,docbook-to-man,no)
 AM_CONDITIONAL(DOCBOOKFOUND, test "${DOCBOOK_TO_MAN}" != "no")
 
-dnl Check for Puredata
-AC_CHECK_HEADER(m_pd.h,PUREDATA=y,AC_MSG_WARN([Puredata header not found.]))
-AM_CONDITIONAL(PUREDATAFOUND, test "${PUREDATA}" = "y")
+dnl Check for Java
+AC_CHECK_HEADER(jni.h,JAVAHEADERS=y,AC_MSG_WARN([Java header jni.h not found.]))
+AM_CONDITIONAL(JAVAFOUND, test "${JAVAHEADERS}" = "y")
 
 dnl Create Makefiles
 AC_OUTPUT([
     Makefile
     src/Makefile
-    ext/Makefile
     examples/Makefile
-    examples/tests/Makefile
+    tests/Makefile
+    tests/src/Makefile
     sounds/Makefile
     swig/Makefile
     python/Makefile
     python/aubio/Makefile
-    plugins/Makefile
-    plugins/audacity/Makefile
-    plugins/audacity/plug-ins/Makefile
-    plugins/wavesurfer/Makefile
-    plugins/puredata/Makefile
+    interfaces/java/Makefile
+    interfaces/java/aubio/Makefile
     doc/Makefile
   ])
 
@@ -258,44 +268,34 @@ dnl Print summary
 echo
 echo "**************************************************************"
 echo "Summary:"
-if test "${FFTW3F_SUPPORT}" = "1"; then
+if test "${HAVE_FFTW3F}" = "1"; then
   echo "Fftw3:                   yes (using fftw3f)"
 else
-if test "${FFTW3_SUPPORT}" = "1"; then
+if test "${HAVE_FFTW3}" = "1"; then
   echo "Fftw3:                   yes (not using fftw3f)"
 else
   echo "Fftw3:                   no (that should not happen)"
 fi
 fi
-if test "${SNDLIB_SUPPORT}" = "1"; then
+if test "${HAVE_SNDFILE}" = "1"; then
   echo "Libsndfile:              yes"
 else
   echo "Libsndfile:              no"
 fi
-if test "${SAMPLERATE_SUPPORT}" = "1"; then
+if test "${HAVE_SAMPLERATE}" = "1"; then
   echo "Libsamplerate:           yes"
 else
   echo "Libsamplerate:           no"
 fi
-if test "${JACK_SUPPORT}" = "1"; then
+if test "${HAVE_JACK}" = "1"; then
   echo "JACK:                    yes"
 else
   echo "JACK:                    no"
 fi
-if test "${ALSA_SUPPORT}" = "1"; then
-  echo "ALSA midi:               yes"
-else
-  echo "ALSA midi:               no"
-fi
-if test "${LASH_SUPPORT}" = "1"; then
+if test "${HAVE_LASH}" = "1"; then
   echo "Lash:                    yes"
 else
   echo "Lash:                    no"
 fi
-if test "${PUREDATA}" = "y"; then
-  echo "PureData:                yes"
-else
-  echo "PureData:                no"
-fi
 echo "**************************************************************"
 echo Configuration completed successfully. Type \'make\' to build ${PACKAGE}