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