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