]>
Commit | Line | Data |
---|---|---|
1 | # Copyright (C) 2002-2011 Erik de Castro Lopo (erikd AT mega-nerd DOT com). | |
2 | ||
3 | dnl Require autoconf version | |
4 | AC_PREREQ(2.57) | |
5 | ||
6 | AC_INIT([libsamplerate],[0.1.9],[erikd@mega-nerd.com], | |
7 | [libsamplerate],[http://www.mega-nerd.com/libsamplerate/]) | |
8 | ||
9 | # Put config stuff in Cfg. | |
10 | AC_CONFIG_AUX_DIR(Cfg) | |
11 | ||
12 | AC_CONFIG_SRCDIR([src/samplerate.c]) | |
13 | AC_CANONICAL_TARGET([]) | |
14 | ||
15 | AC_CONFIG_MACRO_DIR([M4]) | |
16 | AC_CONFIG_HEADERS([src/config.h]) | |
17 | ||
18 | AM_INIT_AUTOMAKE($PACKAGE_NAME,$PACKAGE_VERSION) | |
19 | AM_SILENT_RULES([yes]) | |
20 | ||
21 | dnl Add parameters for aclocal | |
22 | AC_SUBST(ACLOCAL_AMFLAGS, "-I M4") | |
23 | ||
24 | AC_LANG([C]) | |
25 | ||
26 | AC_PROG_CC | |
27 | AM_PROG_CC_C_O | |
28 | AC_PROG_CXX | |
29 | AC_PROG_SED | |
30 | ||
31 | # Do not check for F77. | |
32 | define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl | |
33 | ||
34 | AM_PROG_LIBTOOL | |
35 | LT_PROG_RC | |
36 | ||
37 | AC_PROG_INSTALL | |
38 | AC_PROG_LN_S | |
39 | ||
40 | #------------------------------------------------------------------------------------ | |
41 | # Rules for library version information: | |
42 | # | |
43 | # 1. Start with version information of `0:0:0' for each libtool library. | |
44 | # 2. Update the version information only immediately before a public release of | |
45 | # your software. More frequent updates are unnecessary, and only guarantee | |
46 | # that the current interface number gets larger faster. | |
47 | # 3. If the library source code has changed at all since the last update, then | |
48 | # increment revision (`c:r:a' becomes `c:r+1:a'). | |
49 | # 4. If any interfaces have been added, removed, or changed since the last update, | |
50 | # increment current, and set revision to 0. | |
51 | # 5. If any interfaces have been added since the last public release, then increment | |
52 | # age. | |
53 | # 6. If any interfaces have been removed since the last public release, then set age | |
54 | # to 0. | |
55 | ||
56 | SHARED_VERSION_INFO="1:8:1" | |
57 | ||
58 | ||
59 | ||
60 | ||
61 | ||
62 | AC_PROG_MAKE_SET | |
63 | AC_PROG_LN_S | |
64 | AC_PROG_MKDIR_P | |
65 | ||
66 | if test "x-$build_os-$host_os-$target_os" = x-mingw32-mingw32-mingw32 ; then | |
67 | AC_CHECK_PROG(DLLTOOL, dlltool, dlltool) | |
68 | AC_CHECK_PROG(DLLWRAP, dllwrap, dllwrap) | |
69 | AC_CHECK_PROG(PEXPORTS, pexports, pexports) | |
70 | fi | |
71 | ||
72 | AC_HEADER_STDC | |
73 | ||
74 | AC_CHECK_HEADERS(stdint.h sys/times.h) | |
75 | ||
76 | #==================================================================================== | |
77 | # Couple of initializations here. Fill in real values later. | |
78 | ||
79 | SHLIB_VERSION_ARG="" | |
80 | ||
81 | #==================================================================================== | |
82 | # Finished checking, handle options. | |
83 | ||
84 | AC_ARG_ENABLE(gcc-werror, | |
85 | AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]), | |
86 | ac_arg_gcc_werror=yes, ac_arg_gcc_werror=no) | |
87 | ||
88 | AC_ARG_ENABLE(gcc-pipe, | |
89 | AC_HELP_STRING([--disable-gcc-pipe], [disable gcc -pipe option ]), | |
90 | ac_arg_gcc_pipe="N", ac_arg_gcc_pipe="Y") | |
91 | ||
92 | AC_ARG_ENABLE(gcc-opt, | |
93 | AC_HELP_STRING([--disable-gcc-opt], [disable gcc optimisations ]), | |
94 | ac_arg_gcc_opt="N", ac_arg_gcc_opt="Y") | |
95 | ||
96 | AC_ARG_ENABLE(fftw, | |
97 | AC_HELP_STRING([--disable-fftw], [disable usage of FFTW ]), | |
98 | ac_arg_fftw="N", ac_arg_fftw="Y") | |
99 | ||
100 | AC_ARG_ENABLE(cpu-clip, | |
101 | AC_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper]), | |
102 | ac_arg_cpu_clip="N", ac_arg_cpu_clip="Y") | |
103 | ||
104 | #==================================================================================== | |
105 | # Check types and their sizes. | |
106 | ||
107 | AC_CHECK_SIZEOF(int,0) | |
108 | AC_CHECK_SIZEOF(long,0) | |
109 | AC_CHECK_SIZEOF(float,4) | |
110 | AC_CHECK_SIZEOF(double,8) | |
111 | ||
112 | #==================================================================================== | |
113 | # Determine endian-ness of target processor. | |
114 | ||
115 | AC_C_FIND_ENDIAN | |
116 | ||
117 | AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian}, | |
118 | [Target processor is big endian.]) | |
119 | AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian}, | |
120 | [Target processor is little endian.]) | |
121 | ||
122 | #==================================================================================== | |
123 | # Check for functions. | |
124 | ||
125 | AC_CHECK_FUNCS(malloc calloc free memcpy memmove alarm signal) | |
126 | ||
127 | AC_CHECK_LIB([m],floor) | |
128 | AC_CHECK_FUNCS(floor ceil fmod) | |
129 | ||
130 | AC_CHECK_SIGNAL(SIGALRM) | |
131 | ||
132 | AC_C99_FUNC_LRINT | |
133 | AC_C99_FUNC_LRINTF | |
134 | # AC_C99_FUNC_LLRINT Don't need this (yet?). | |
135 | ||
136 | case "x$ac_cv_c99_lrint$ac_cv_c99_lrintf" in | |
137 | xyesyes) | |
138 | ;; | |
139 | *) | |
140 | AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]]) | |
141 | AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]]) | |
142 | ;; | |
143 | esac | |
144 | ||
145 | #==================================================================================== | |
146 | # Determine if the processor can do clipping on float to int conversions. | |
147 | ||
148 | if test x$ac_arg_cpu_clip = "xY" ; then | |
149 | AC_C_CLIP_MODE | |
150 | else | |
151 | echo "checking processor clipping capabilities... disabled" | |
152 | ac_cv_c_clip_positive=0 | |
153 | ac_cv_c_clip_negative=0 | |
154 | fi | |
155 | ||
156 | AC_DEFINE_UNQUOTED(CPU_CLIPS_POSITIVE, ${ac_cv_c_clip_positive}, | |
157 | [Target processor clips on positive float to int conversion.]) | |
158 | AC_DEFINE_UNQUOTED(CPU_CLIPS_NEGATIVE, ${ac_cv_c_clip_negative}, | |
159 | [Target processor clips on negative float to int conversion.]) | |
160 | ||
161 | #==================================================================================== | |
162 | # Check for libsndfile which is required for the test and example programs. | |
163 | ||
164 | AC_ARG_ENABLE(sndfile, | |
165 | AC_HELP_STRING([--disable-sndfile], [disable support for sndfile (default=autodetect)]), | |
166 | [ enable_sndfile=$enableval ], [ enable_sndfile=yes ]) | |
167 | ||
168 | # Check for pkg-config outside the if statement. | |
169 | PKG_PROG_PKG_CONFIG | |
170 | ||
171 | if test "x$enable_sndfile" = "xyes"; then | |
172 | PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.6, ac_cv_sndfile=1, ac_cv_sndfile=0) | |
173 | else | |
174 | ac_cv_sndfile=0 | |
175 | fi | |
176 | ||
177 | AC_DEFINE_UNQUOTED([HAVE_SNDFILE],$ac_cv_sndfile,[Set to 1 if you have libsndfile.]) | |
178 | ||
179 | if test x$ac_cv_sndfile = x1 ; then | |
180 | ac_cv_sndfile=yes | |
181 | HAVE_SNDFILE=1 | |
182 | else | |
183 | ac_cv_sndfile=no | |
184 | HAVE_SNDFILE=0 | |
185 | fi | |
186 | ||
187 | #==================================================================================== | |
188 | # Check for ALSA. | |
189 | ||
190 | ALSA_LIBS="" | |
191 | ||
192 | if test x$enable_alsa != xno ; then | |
193 | AC_CHECK_HEADERS(alsa/asoundlib.h) | |
194 | if test x$ac_cv_header_alsa_asoundlib_h = xyes ; then | |
195 | ALSA_LIBS="-lasound" | |
196 | enable_alsa=yes | |
197 | fi | |
198 | fi | |
199 | ||
200 | #==================================================================================== | |
201 | # Check for libfftw3 which is required for the test and example programs. | |
202 | ||
203 | if test $ac_arg_fftw = "Y" ; then | |
204 | PKG_CHECK_MODULES(FFTW3, fftw3 >= 0.15.0, ac_cv_fftw3=1, ac_cv_fftw3=0) | |
205 | AC_DEFINE_UNQUOTED([HAVE_FFTW3],$ac_cv_fftw3,[Set to 1 if you have libfftw3.]) | |
206 | ||
207 | if test x$ac_cv_fftw3 = x1 ; then | |
208 | ac_cv_fftw3=yes | |
209 | HAVE_FFTW3=1 | |
210 | fi | |
211 | fi | |
212 | ||
213 | if test x$ac_cv_fftw3 != xyes ; then | |
214 | ac_cv_fftw3=no | |
215 | HAVE_FFTW3=0 | |
216 | fi | |
217 | ||
218 | #==================================================================================== | |
219 | # GCC stuff. | |
220 | ||
221 | if test $ac_cv_c_compiler_gnu = yes ; then | |
222 | CFLAGS="$CFLAGS -std=gnu99 -W -Wstrict-prototypes -Wmissing-prototypes -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wpointer-arith" | |
223 | # -Wundef -Wbad-function-cast -Wmissing-declarations -Wconversion -Winline" | |
224 | if test "$ac_arg_gcc_opt" = "N" ; then | |
225 | temp_CFLAGS=`echo $CFLAGS | sed "s/O2/O0/"` | |
226 | CFLAGS=$temp_CFLAGS | |
227 | AC_MSG_WARN([[*** Compiler optimisations switched off. ***]]) | |
228 | fi | |
229 | ||
230 | # Disable -Wall for Apple Darwin/Rhapsody. | |
231 | # System headers on these systems are broken. | |
232 | case "$target_os" in | |
233 | darwin* | rhapsody*) | |
234 | temp_CFLAGS=`echo $CFLAGS | sed "s/-Wall//"` | |
235 | CFLAGS=$temp_CFLAGS | |
236 | ;; | |
237 | ||
238 | linux*|kfreebsd*-gnu*|gnu*) | |
239 | SHLIB_VERSION_ARG="-Wl,--version-script=Version_script" | |
240 | ;; | |
241 | *) | |
242 | ;; | |
243 | esac | |
244 | if test x$ac_arg_gcc_pipe != "xN" ; then | |
245 | CFLAGS="$CFLAGS -pipe" | |
246 | fi | |
247 | ||
248 | if test x$ac_arg_gcc_werror = "xyes" ; then | |
249 | CFLAGS="-Werror $CFLAGS" | |
250 | fi | |
251 | ||
252 | AC_DEFINE([COMPILER_IS_GCC],1, [Set to 1 if the compile is GNU GCC.]) | |
253 | GCC_MAJOR_VERSION=`$CC -dumpversion | sed "s/\..*//"` | |
254 | AC_DEFINE_UNQUOTED([GCC_MAJOR_VERSION],${GCC_MAJOR_VERSION}, [Major version of GCC or 3 otherwise.]) | |
255 | fi | |
256 | ||
257 | #==================================================================================== | |
258 | # Find known target OS. | |
259 | ||
260 | OS_SPECIFIC_INCLUDES="" | |
261 | os_is_win32=0 | |
262 | ||
263 | case "$target_os" in | |
264 | darwin* | rhapsody*) | |
265 | OS_SPECIFIC_INCLUDES="-fpascal-strings -I/Developer/Headers/FlatCarbon" | |
266 | OS_SPECIFIC_LINKS="-framework CoreAudio" | |
267 | ;; | |
268 | mingw32*) | |
269 | OS_SPECIFIC_LINKS="-lwinmm" | |
270 | os_is_win32=1 | |
271 | ;; | |
272 | *) | |
273 | OS_SPECIFIC_INCLUDES="" | |
274 | OS_SPECIFIC_LINKS="" | |
275 | ;; | |
276 | esac | |
277 | ||
278 | htmldocdir=$prefix/share/doc/libsamplerate0-dev/html | |
279 | ||
280 | if test $prefix = "NONE" ; then | |
281 | htmldocdir=/usr/local/share/doc/libsamplerate0-dev/html | |
282 | else | |
283 | htmldocdir=$prefix/share/doc/libsamplerate0-dev/html | |
284 | fi | |
285 | ||
286 | #==================================================================================== | |
287 | # Now use the information from the checking stage. | |
288 | ||
289 | AC_DEFINE_UNQUOTED(OS_IS_WIN32, ${os_is_win32}, [Set to 1 if compiling for Win32]) | |
290 | ||
291 | AC_SUBST(htmldocdir) | |
292 | ||
293 | AC_SUBST(SHLIB_VERSION_ARG) | |
294 | AC_SUBST(SHARED_VERSION_INFO) | |
295 | AC_SUBST(OS_SPECIFIC_INCLUDES) | |
296 | AC_SUBST(OS_SPECIFIC_LINKS) | |
297 | ||
298 | AC_SUBST(COMPILER_IS_GCC) | |
299 | AC_SUBST(GCC_MAJOR_VERSION) | |
300 | ||
301 | AC_SUBST(HAVE_FFTW3) | |
302 | AC_SUBST(FFTW3_CFLAGS) | |
303 | AC_SUBST(FFTW3_LIBS) | |
304 | ||
305 | AC_SUBST(HAVE_SNDFILE) | |
306 | AC_SUBST(SNDFILE_CFLAGS) | |
307 | AC_SUBST(SNDFILE_LIBS) | |
308 | ||
309 | AC_SUBST(ALSA_LIBS) | |
310 | ||
311 | AC_CONFIG_FILES([Makefile M4/Makefile src/Version_script \ | |
312 | Win32/Makefile Win32/Makefile.mingw \ | |
313 | src/Makefile examples/Makefile tests/Makefile doc/Makefile \ | |
314 | libsamplerate.spec samplerate.pc]) | |
315 | AC_OUTPUT | |
316 | ||
317 | #==================================================================================== | |
318 | ||
319 | AC_MSG_RESULT([ | |
320 | -=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-=- | |
321 | ||
322 | Configuration summary : | |
323 | ||
324 | Version : ..................... ${VERSION} | |
325 | ||
326 | Host CPU : .................... ${host_cpu} | |
327 | Host Vendor : ................. ${host_vendor} | |
328 | Host OS : ..................... ${host_os} | |
329 | ]) | |
330 | ||
331 | if test x$ac_cv_c_compiler_gnu = xyes ; then | |
332 | echo -e " Tools :\n" | |
333 | echo " Compiler is GCC : ............. ${ac_cv_c_compiler_gnu}" | |
334 | echo " GCC major version : ........... ${GCC_MAJOR_VERSION}" | |
335 | fi | |
336 | ||
337 | AC_MSG_RESULT([ | |
338 | Extra tools required for testing and examples : | |
339 | ||
340 | Have FFTW : ................... ${ac_cv_fftw3}]) | |
341 | ||
342 | AC_MSG_RESULT([ Have libsndfile : ............. ${ac_cv_sndfile}]) | |
343 | AC_MSG_RESULT([ Have ALSA : ................... ${ac_cv_header_alsa_asoundlib_h} | |
344 | ]) | |
345 | ||
346 | AC_MSG_RESULT([ Installation directories : | |
347 | ||
348 | Library directory : ........... ${prefix}/lib | |
349 | Program directory : ........... ${prefix}/bin | |
350 | Pkgconfig directory : ......... ${prefix}/lib/pkgconfig | |
351 | ]) | |
352 | ||
353 | if test x$prefix != "x/usr" ; then | |
354 | echo "Compiling some other packages against ${PACKAGE} may require " | |
355 | echo -e "the addition of \"${prefix}/lib/pkgconfig\" to the " | |
356 | echo -e "PKG_CONFIG_PATH environment variable.\n" | |
357 | fi | |
358 |