moved cpp to interfaces/
[aubio.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script
2
3 dnl Init autoconf
4 AC_INIT(src/aubio.h)
5
6 dnl Package name and version
7 PACKAGE=aubio
8 . $srcdir/VERSION
9 AUBIO_VERSION=${AUBIO_MAJOR_VERSION}.${AUBIO_MINOR_VERSION}.${AUBIO_PATCH_VERSION}${AUBIO_VERSION_STATUS}
10 VERSION=${AUBIO_VERSION}
11
12 dnl Shared library version
13 SHARED_VERSION_INFO=${LIBAUBIO_LT_CUR}:${LIBAUBIO_LT_REV}:${LIBAUBIO_LT_AGE}
14 AC_SUBST(SHARED_VERSION_INFO)
15
16 dnl Init automake
17 AM_INIT_AUTOMAKE(${PACKAGE}, ${VERSION})
18
19 dnl Enable silent rules, use with make V=0 
20 AM_SILENT_RULES
21
22 dnl Maintainer mode
23 AM_MAINTAINER_MODE
24
25 dnl Guess the host
26 AC_CANONICAL_HOST
27
28 dnl Check for programs
29 AC_PROG_CC
30 AM_PROG_CC_C_O dnl compiling with per-target flag 
31 if test "$ac_cv_prog_cc" = "no" ; then
32    AC_MSG_ERROR([*** No C compiler found !])
33 fi
34 AC_PROG_CXX
35 AC_PROG_INSTALL
36
37 AUBIO_CFLAGS=
38
39 dnl Enable debugging (no)
40 AC_ARG_ENABLE(debug,
41   AC_HELP_STRING([--enable-debug],[compile in debug mode [[default=no]]]),
42   with_debug="yes",
43   with_debug="no")
44 if test "$with_debug" = "yes"
45 then
46   AC_DEFINE(DEBUG,1,[Define to enable debug])
47   AUBIO_CFLAGS="$AUBIO_CFLAGS -g"
48 fi
49
50 dnl Enable full warnings (yes)
51 AC_ARG_ENABLE(warnings,
52   AC_HELP_STRING([--enable-warnings],[compile with all gcc warnings [[default=yes]]]),
53   with_warnme="no",
54   with_warnme="yes")
55 if test "$with_warnme" = "yes"
56 then
57   dnl Check for -Wextra support to allow compilation on gcc <= 3.4
58   AC_CACHE_CHECK([for -Wextra option to $CC], ac_cv_cc_wextra, 
59   [old_CFLAGS="$CFLAGS"
60   CFLAGS="$CFLAGS -Wextra"
61   AC_COMPILE_IFELSE([void foo (void) {}],
62           ac_cv_cc_wextra=yes, ac_cv_cc_wextra=no)
63   CFLAGS="$old_CFLAGS"
64   ])
65   if test "$ac_cv_cc_wextra" = "yes"
66   then
67     AUBIO_CFLAGS="$AUBIO_CFLAGS -Wall -Wextra"
68   else 
69     AUBIO_CFLAGS="$AUBIO_CFLAGS -Wall"
70   fi
71 fi
72
73 dnl fail on compilation warnings 
74 AC_ARG_ENABLE(errorfail,
75   AC_HELP_STRING([--enable-errorfail],[fail on compilation warnings [[default=no]]]),
76   AUBIO_CFLAGS="$AUBIO_CFLAGS -Werror -Wmissing-prototypes -Wmissing-declarations -Wno-unused-parameter",
77   with_errorfail="no")
78
79 dnl add gcov/lcov profiling and coverage flags
80 AC_ARG_ENABLE(lcov,
81   AC_HELP_STRING([--enable-lcov],[compile with gcov/lcov profiling flags [[default=no]]]),
82   AUBIO_CFLAGS="$AUBIO_CFLAGS -fprofile-arcs -ftest-coverage",
83   with_lcov="no")
84
85 dnl Check for libtool
86 AC_LIBTOOL_DLOPEN
87 dnl AC_DISABLE_STATIC
88 dnl allow cross compiling
89 AC_LIBTOOL_WIN32_DLL
90 AC_PROG_LIBTOOL
91
92 AC_CONFIG_HEADERS(src/config.h)
93 AC_CONFIG_FILES(aubio.pc)
94
95 AM_CONDITIONAL(MINGW, false)
96 AM_CONDITIONAL(DARWIN, false)
97 case "${host}" in
98 *mingw* | *cygwin*)
99   mingw32_support="yes"
100   AC_CHECK_HEADER(windows.h)
101   AM_CONDITIONAL(MINGW, true)
102   LDFLAGS="$LDFLAGS -no-undefined"
103   ;;
104 *darwin* | *rhapsody* | *macosx*)
105   AC_ISC_POSIX
106   AM_CONDITIONAL(DARWIN, true)
107   ;;
108 *)
109   AC_ISC_POSIX
110   ;;
111 esac
112
113 dnl Check for required libraries
114 AC_CHECK_LIB(pthread, pthread_create)
115
116 dnl Check for header files
117 AC_CHECK_HEADERS([string.h stdlib.h stdio.h math.h errno.h stdarg.h unistd.h signal.h],,)
118 AC_CHECK_HEADERS(fftw3.h,,AC_MSG_ERROR([Ouch! missing fftw3.h header]))
119 AC_ARG_ENABLE(complex,
120   AC_HELP_STRING([--enable-complex],[compile with complex.h [[default=auto]]]),
121   [with_complex=$enableval],
122   with_complex="yes")
123 if test "$with_complex" = "yes"; then
124   AC_CHECK_HEADERS(complex.h,,AC_MSG_WARN([Ouch! missing complex.h header]))
125 fi
126
127 dnl Check for __VAR_ARGS__ support
128 AC_CACHE_CHECK(for C99 __VA_ARGS__ macro,
129     ac_cv_varargs_macros,
130 AC_TRY_COMPILE([
131   #include <stdio.h>
132   #define AUBIO_ERR(...)                       fprintf(stderr, __VA_ARGS__)
133 ],
134 [
135   AUBIO_ERR("%s\n", "ERR");
136 ],
137         ac_cv_varargs_macros=yes,
138         ac_cv_varargs_macros=no)
139 )
140 if test "$ac_cv_varargs_macros" = "yes"; then
141     AC_DEFINE(HAVE_C99_VARARGS_MACROS, 1,
142             [Defined when c99 style varargs macros are supported])
143 fi
144
145 dnl Check for pkg-config
146 AC_PATH_PROG(PKG_CONFIG,pkg-config,no)
147
148 PKG_CHECK_MODULES(SNDFILE,     sndfile >= 1.0.4,       HAVE_SNDFILE=1)
149 if test "${HAVE_SNDFILE}" = "1"; then
150   AC_DEFINE(HAVE_SNDFILE,1,[Define to enable libsndfile support])
151 fi
152
153 dnl Enable samplerate support (auto)
154 AC_ARG_ENABLE(samplerate,
155   AC_HELP_STRING([--enable-samplerate],[compile with samplerate [[default=auto]]]),
156   [with_samplerate=$enableval],
157   with_samplerate="yes")
158 if test "$with_samplerate" = "yes"; then
159   PKG_CHECK_MODULES(SAMPLERATE, samplerate  >= 0.0.15,  HAVE_SAMPLERATE=1)
160   if test "${HAVE_SAMPLERATE}" = "1"; then
161     AC_DEFINE(HAVE_SAMPLERATE,1,[Define to enable libsamplerate support])
162   fi
163 fi
164
165 dnl Check for fftw3 (required)
166 AC_ARG_ENABLE(fftw3f,
167   AC_HELP_STRING([--enable-fftw3f],[compile with fftw3f [[default=auto]]]),
168   [with_fftw3f=$enableval],
169   with_fftw3f="yes")
170 if test "$with_fftw3f" = "yes"; then
171   PKG_CHECK_MODULES(FFTWLIB,    fftw3f >= 3.0.0,     HAVE_FFTW3F=1, HAVE_FFTW3F=0)
172 else
173   PKG_CHECK_MODULES(FFTWLIB,    fftw3  >= 3.0.0,     HAVE_FFTW3=1)
174 fi
175 if test "${HAVE_FFTW3F}" = "0"; then
176   PKG_CHECK_MODULES(FFTWLIB,    fftw3  >= 3.0.0,     HAVE_FFTW3=1)
177 fi
178 if test "${HAVE_FFTW3}" = "1"; then
179   AC_DEFINE(HAVE_FFTW3,1,[Define to enable fftw3 support])
180 fi
181 if test "${HAVE_FFTW3F}" = "1"; then
182   AC_DEFINE(HAVE_FFTW3F,1,[Define to enable fftw3f support])
183 fi
184
185 dnl Enable jack support (auto)
186 AC_ARG_ENABLE(jack,
187   AC_HELP_STRING([--enable-jack],[compile with jack [[default=auto]]]),
188   [with_jack=$enableval],
189   with_jack="yes")
190 if test "$with_jack" = "yes"
191 then
192   PKG_CHECK_MODULES(JACK,       jack  >= 0.15.0,     HAVE_JACK=1, HAVE_JACK=0)
193   if test "${HAVE_JACK}" = "1"; then
194     AC_DEFINE(HAVE_JACK,1,[Define to enable jack support])
195   fi
196 fi
197
198 dnl Enable lash support
199 AC_ARG_ENABLE(lash,
200   AC_HELP_STRING([--enable-lash],[compile with lash [[default=auto]]]),
201   [with_lash=$enableval],
202   with_lash="yes")
203 if test "$with_lash" = "yes"
204 then
205   PKG_CHECK_MODULES(LASH,   lash-1.0 >= 0.5.0,   HAVE_LASH=1, HAVE_LASH=0)
206   if test "${HAVE_LASH}" = "1"; then
207     LASH_CFLAGS+="-DHAVE_LASH"
208   fi
209 fi
210   
211 dnl Enable unit tests 
212 AC_ARG_ENABLE(testprogs,
213   AC_HELP_STRING([--enable-testprogs],[compile test programs [[default=no]]]),
214   [with_testprogs=$enableval],
215   with_testprogs="no")
216 AM_CONDITIONAL(COMPILE_TESTS,test "${with_testprogs}" != "no")
217
218 AC_SUBST(AUBIO_CFLAGS)
219
220 dnl Check for swig and python
221 dnl should check for swig version and python headers
222 AC_PATH_PROG(SWIG,swig,no)
223 AM_CONDITIONAL(SWIGFOUND, test "${SWIG}" != "no")
224 AM_PATH_PYTHON
225 AM_CONDITIONAL(PYTHONFOUND, test "${PYTHON}" != "no")
226
227 dnl Check for docbook-to-man
228 AC_PATH_PROG(DOCBOOK_TO_MAN,docbook-to-man,no)
229 AM_CONDITIONAL(DOCBOOKFOUND, test "${DOCBOOK_TO_MAN}" != "no")
230
231 dnl Check for Puredata
232 AC_CHECK_HEADER(m_pd.h,PUREDATA=y,AC_MSG_WARN([Puredata header not found.]))
233 AM_CONDITIONAL(PUREDATAFOUND, test "${PUREDATA}" = "y")
234
235 dnl Check for Java
236 AC_CHECK_HEADER(jni.h,JAVAHEADERS=y,AC_MSG_WARN([Java header jni.h not found.]))
237 AM_CONDITIONAL(JAVAFOUND, test "${JAVAHEADERS}" = "y")
238
239 dnl Create Makefiles
240 AC_OUTPUT([
241     Makefile
242     src/Makefile
243     ext/Makefile
244     examples/Makefile
245     tests/Makefile
246     tests/src/Makefile
247     tests/cpp/Makefile
248     sounds/Makefile
249     swig/Makefile
250     python/Makefile
251     python/aubio/Makefile
252     interfaces/java/Makefile
253     interfaces/java/aubio/Makefile
254     interfaces/cpp/Makefile
255     plugins/Makefile
256     plugins/audacity/Makefile
257     plugins/audacity/plug-ins/Makefile
258     plugins/wavesurfer/Makefile
259     plugins/puredata/Makefile
260     doc/Makefile
261   ])
262
263 dnl Print summary
264 echo
265 echo "**************************************************************"
266 echo "Summary:"
267 if test "${HAVE_FFTW3F}" = "1"; then
268   echo "Fftw3:                   yes (using fftw3f)"
269 else
270 if test "${HAVE_FFTW3}" = "1"; then
271   echo "Fftw3:                   yes (not using fftw3f)"
272 else
273   echo "Fftw3:                   no (that should not happen)"
274 fi
275 fi
276 if test "${HAVE_SNDFILE}" = "1"; then
277   echo "Libsndfile:              yes"
278 else
279   echo "Libsndfile:              no"
280 fi
281 if test "${HAVE_SAMPLERATE}" = "1"; then
282   echo "Libsamplerate:           yes"
283 else
284   echo "Libsamplerate:           no"
285 fi
286 if test "${HAVE_JACK}" = "1"; then
287   echo "JACK:                    yes"
288 else
289   echo "JACK:                    no"
290 fi
291 if test "${HAVE_LASH}" = "1"; then
292   echo "Lash:                    yes"
293 else
294   echo "Lash:                    no"
295 fi
296 if test "${PUREDATA}" = "y"; then
297   echo "PureData:                yes"
298 else
299   echo "PureData:                no"
300 fi
301 echo "**************************************************************"
302 echo Configuration completed successfully. Type \'make\' to build ${PACKAGE}