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