bump version number, use VERSION to store it
[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 Maintainer mode
20 AM_MAINTAINER_MODE
21
22 dnl Guess the host
23 AC_CANONICAL_HOST
24
25 dnl Check for programs
26 AC_PROG_CC
27 if test "$ac_cv_prog_cc" = "no" ; then
28    AC_MSG_ERROR([*** No C compiler found !])
29 fi
30 AC_PROG_INSTALL
31
32 dnl Enable debugging (no)
33 AC_ARG_ENABLE(debug,
34   [  --enable-debug[[=value]]  compile with debug [[default=no]]],
35   with_debug="yes",
36   with_debug="no")
37 if test "$with_debug" = "yes"
38 then
39   AC_DEFINE(DEBUG,1,[Define to enable debug])
40   CFLAGS="$CFLAGS -g"
41 fi
42
43 dnl Enable full warnings (yes)
44 AC_ARG_ENABLE(warnme,
45   [  --enable-warnme[[=value]] compile with all -W [[default=yes]]],
46   with_warnme="no",
47   with_warnme="yes")
48 if test "$with_warnme" = "yes"
49 then
50   dnl Check for -Wextra support to allow compilation on gcc <= 3.4
51   AC_CACHE_CHECK([for -Wextra option to $CC], ac_cv_cc_wextra, 
52   [old_CFLAGS="$CFLAGS"
53   CFLAGS="$CFLAGS -Wextra"
54   AC_COMPILE_IFELSE([void foo (void) {}],
55           ac_cv_cc_wextra=yes, ac_cv_cc_wextra=no)
56   ])
57   if test "$ac_cv_cc_wextra" = "yes"
58   then
59     CFLAGS="$old_CFLAGS -Wall -Wextra"
60   else 
61     CFLAGS="$old_CFLAGS -Wall"
62   fi
63 fi
64
65 AC_ARG_ENABLE(failonerror,
66   [  --enable-fwarn[[=value]]  fail on compilation warnings [[default=yes]]],
67   with_warnme="no",
68   CFLAGS="$CFLAGS -Werror -Wmissing-prototypes -Wmissing-declarations -Wno-unused-parameter")
69
70 dnl Check for libtool
71 AC_LIBTOOL_DLOPEN
72 dnl AC_DISABLE_STATIC
73 AC_PROG_LIBTOOL
74
75 AC_CONFIG_HEADERS(src/config.h)
76 AC_CONFIG_FILES(aubio.pc)
77
78 case "${host_os}" in
79 *mingw*)
80   mingw32_support="yes"
81   AC_CHECK_HEADER(windows.h)
82   ;;
83 *darwin*)
84   dnl on macosx, cosf went to -lmx
85   LDFLAGS="$LDFLAGS -lmx"
86   dnl as long double doesn't sit well with -Wall -Werror
87   CFLAGS="$CFLAGS -Wno-long-double"
88   AC_ISC_POSIX
89   ;;
90 *)
91   AC_ISC_POSIX
92   ;;
93 esac
94
95 dnl Check for required libraries
96 AC_CHECK_LIB(pthread, pthread_create)
97
98 dnl Check for header files
99 AC_HEADER_STDC
100 AC_CHECK_HEADERS([string.h stdlib.h stdio.h math.h errno.h stdarg.h unistd.h signal.h],,)
101 AC_CHECK_HEADERS(complex.h,,AC_MSG_ERROR([Ouch! missing complex.h header]))
102 AC_CHECK_HEADERS(fftw3.h  ,,AC_MSG_ERROR([Ouch! missing fftw3.h header]))
103
104 dnl Check for __VAR_ARGS__ support
105 AC_CACHE_CHECK(for C99 __VA_ARGS__ macro,
106     ac_cv_varargs_macros,
107 AC_TRY_COMPILE([
108   #include <stdio.h>
109   #define AUBIO_ERR(...)                       fprintf(stderr, __VA_ARGS__)
110 ],
111 [
112   AUBIO_ERR("%s\n", "ERR");
113 ],
114         ac_cv_varargs_macros=yes,
115         ac_cv_varargs_macros=no)
116 )
117 if test "$ac_cv_varargs_macros" = "yes"; then
118     AC_DEFINE(HAVE_C99_VARARGS_MACROS, 1,
119             [Defined when c99 style varargs macros are supported])
120 fi
121
122 dnl Check for pkg-config
123 AC_PATH_PROG(PKG_CONFIG,pkg-config,no)
124
125 PKG_CHECK_MODULES(SNDLIB,     sndfile >= 1.0.4,       SNDLIB_SUPPORT=1)
126 PKG_CHECK_MODULES(SAMPLERATE, samplerate  >= 0.0.15,  SAMPLERATE_SUPPORT=1)
127
128 if test "${SNDLIB_SUPPORT}" = "1"; then
129   AC_DEFINE(SNDLIB_SUPPORT,1,[Define to enable libsndfile support])
130 fi
131
132 dnl Check for fftw3 (required)
133 AC_ARG_ENABLE(fftw3f,
134   AC_HELP_STRING([--enable-fftw3f],[compile with fftw3f [[default=auto]]]),
135   [with_fftw3f=$enableval],
136   with_fftw3f="yes")
137 if test "$with_fftw3f" = "yes"; then
138   PKG_CHECK_MODULES(FFTWLIB,    fftw3f >= 3.0.0,     FFTW3F_SUPPORT=1, FFTW3F_SUPPORT=0)
139 else
140   PKG_CHECK_MODULES(FFTWLIB,    fftw3  >= 3.0.0,     FFTW3_SUPPORT=1)
141 fi
142 if test "${FFTW3F_SUPPORT}" = "0"; then
143   PKG_CHECK_MODULES(FFTWLIB,    fftw3  >= 3.0.0,     FFTW3_SUPPORT=1)
144 fi
145 if test "${FFTW3_SUPPORT}" = "1"; then
146   AC_DEFINE(FFTW3_SUPPORT,1,[Define to enable fftw3 support])
147 fi
148 if test "${FFTW3F_SUPPORT}" = "1"; then
149   AC_DEFINE(FFTW3F_SUPPORT,1,[Define to enable fftw3f support])
150 fi
151
152 dnl Enable jack support (auto)
153 AC_ARG_ENABLE(jack,
154   AC_HELP_STRING([--enable-jack],[compile with jack [[default=auto]]]),
155   [with_jack=$enableval],
156   with_jack="yes")
157 if test "$with_jack" = "yes"
158 then
159   PKG_CHECK_MODULES(JACK,       jack  >= 0.15.0,     JACK_SUPPORT=1, JACK_SUPPORT=0)
160   if test "${JACK_SUPPORT}" = "1"; then
161     AC_DEFINE(JACK_SUPPORT,1,[Define to enable jack support])
162   fi
163 fi
164
165 dnl Enable alsa support (auto)
166 AC_ARG_ENABLE(alsa,
167   AC_HELP_STRING([--enable-alsa],[compile with alsa [[default=auto]]]),
168   [with_alsa=$enableval],
169   with_alsa="yes")
170 if test "$with_alsa" = "yes"
171 then
172   if test "$with_jack" = "yes"
173   then
174     PKG_CHECK_MODULES(ALSA,      alsa >= 0.0.9,      ALSA_SUPPORT=1, ALSA_SUPPORT=0)
175     if test "${ALSA_SUPPORT}" = "1"; then
176       AC_DEFINE(ALSA_SUPPORT,1,[Define to enable alsa support])
177     fi
178   else
179     AC_MSG_WARN([Disabling alsa as jack was not found])
180   fi
181 fi
182
183 dnl Enable lash support
184 AC_ARG_ENABLE(lash,
185   AC_HELP_STRING([--enable-lash],[compile with lash [[default=auto]]]),
186   [with_lash=$enableval],
187   with_lash="yes")
188 if test "$with_lash" = "yes"
189 then
190   PKG_CHECK_MODULES(LASH,   lash-1.0 >= 0.5.0,   LASH_SUPPORT=1, LASH_SUPPORT=0)
191   if test "${LASH_SUPPORT}" = "1"; then
192     LASH_CFLAGS+="-DLASH_SUPPORT"
193   fi
194 fi
195   
196 dnl Enable unit tests 
197 AC_ARG_ENABLE(testprogs,
198   AC_HELP_STRING([--enable-testprogs],[compile test programs [[default=no]]]),
199   [with_testprogs=$enableval],
200   with_testprogs="no")
201 AM_CONDITIONAL(COMPILE_TESTS,test "${with_testprogs}" != "no")
202
203 dnl Check for swig and python
204 dnl should check for swig version and python headers
205 AC_PATH_PROG(SWIG,swig,no)
206 AM_CONDITIONAL(SWIGFOUND, test "${SWIG}" != "no")
207 AM_PATH_PYTHON
208 AM_CONDITIONAL(PYTHONFOUND, test "${PYTHON}" != "no")
209 #
210 #if PYTHONFOUND
211 case "${host_os}" in
212 *darwin*)
213   SWCFLAGS="-Wno-long-double"
214   SWLDFLAGS="-bundle -framework python -L${prefix}/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
215   ;;
216 *)
217   SWLDFLAGS="-shared"
218   ;;
219 esac
220 #
221 AC_SUBST(SWCFLAGS)
222 AC_SUBST(SWLDFLAGS)
223
224 dnl Check for docbook-to-man
225 AC_PATH_PROG(DOCBOOK_TO_MAN,docbook-to-man,no)
226 AM_CONDITIONAL(DOCBOOKFOUND, test "${DOCBOOK_TO_MAN}" != "no")
227
228 dnl Check for Puredata
229 AC_CHECK_HEADER(m_pd.h,PUREDATA=y,AC_MSG_WARN([Puredata header not found.]))
230 AM_CONDITIONAL(PUREDATAFOUND, test "${PUREDATA}" = "y")
231
232 dnl Create Makefiles
233 AC_OUTPUT([
234     Makefile
235     src/Makefile
236     ext/Makefile
237     examples/Makefile
238     examples/tests/Makefile
239     sounds/Makefile
240     swig/Makefile
241     python/Makefile
242     python/aubio/Makefile
243     plugins/Makefile
244     plugins/audacity/Makefile
245     plugins/audacity/plug-ins/Makefile
246     plugins/wavesurfer/Makefile
247     plugins/puredata/Makefile
248     doc/Makefile
249   ])
250
251 dnl Print summary
252 echo
253 echo "**************************************************************"
254 echo "Summary:"
255 if test "${FFTW3F_SUPPORT}" = "1"; then
256   echo "Fftw3:                   yes (using fftw3f)"
257 else
258 if test "${FFTW3_SUPPORT}" = "1"; then
259   echo "Fftw3:                   yes (not using fftw3f)"
260 else
261   echo "Fftw3:                   no (that should not happen)"
262 fi
263 fi
264 if test "${SNDLIB_SUPPORT}" = "1"; then
265   echo "Libsndfile:              yes"
266 else
267   echo "Libsndfile:              no"
268 fi
269 if test "${SAMPLERATE_SUPPORT}" = "1"; then
270   echo "Libsamplerate:           yes"
271 else
272   echo "Libsamplerate:           no"
273 fi
274 if test "${JACK_SUPPORT}" = "1"; then
275   echo "JACK:                    yes"
276 else
277   echo "JACK:                    no"
278 fi
279 if test "${ALSA_SUPPORT}" = "1"; then
280   echo "ALSA midi:               yes"
281 else
282   echo "ALSA midi:               no"
283 fi
284 if test "${LASH_SUPPORT}" = "1"; then
285   echo "Lash:                    yes"
286 else
287   echo "Lash:                    no"
288 fi
289 if test "${PUREDATA}" = "y"; then
290   echo "PureData:                yes"
291 else
292   echo "PureData:                no"
293 fi
294 echo "**************************************************************"
295 echo Configuration completed successfully. Type \'make\' to build ${PACKAGE}