comparison src/libsamplerate-0.1.8/configure.ac @ 85:545efbb81310

Import initial set of sources
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 18 Mar 2013 14:12:14 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 85:545efbb81310
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.8],[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 libfftw3 which is required for the test and example programs.
189
190 if test $ac_arg_fftw = "Y" ; then
191 PKG_CHECK_MODULES(FFTW3, fftw3 >= 0.15.0, ac_cv_fftw3=1, ac_cv_fftw3=0)
192 AC_DEFINE_UNQUOTED([HAVE_FFTW3],$ac_cv_fftw3,[Set to 1 if you have libfftw3.])
193
194 if test x$ac_cv_fftw3 = x1 ; then
195 ac_cv_fftw3=yes
196 HAVE_FFTW3=1
197 fi
198 fi
199
200 if test x$ac_cv_fftw3 != xyes ; then
201 ac_cv_fftw3=no
202 HAVE_FFTW3=0
203 fi
204
205 #====================================================================================
206 # GCC stuff.
207
208 if test $ac_cv_c_compiler_gnu = yes ; then
209 CFLAGS="$CFLAGS -std=gnu99 -W -Wstrict-prototypes -Wmissing-prototypes -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wpointer-arith"
210 # -Wundef -Wbad-function-cast -Wmissing-declarations -Wconversion -Winline"
211 if test "$ac_arg_gcc_opt" = "N" ; then
212 temp_CFLAGS=`echo $CFLAGS | sed "s/O2/O0/"`
213 CFLAGS=$temp_CFLAGS
214 AC_MSG_WARN([[*** Compiler optimisations switched off. ***]])
215 fi
216
217 # Disable -Wall for Apple Darwin/Rhapsody.
218 # System headers on these systems are broken.
219 case "$target_os" in
220 darwin* | rhapsody*)
221 temp_CFLAGS=`echo $CFLAGS | sed "s/-Wall//"`
222 CFLAGS=$temp_CFLAGS
223 ;;
224
225 linux*|kfreebsd*-gnu*|gnu*)
226 SHLIB_VERSION_ARG="-Wl,--version-script=Version_script"
227 ;;
228 *)
229 ;;
230 esac
231 if test x$ac_arg_gcc_pipe != "xN" ; then
232 CFLAGS="$CFLAGS -pipe"
233 fi
234
235 if test x$ac_arg_gcc_werror = "xyes" ; then
236 CFLAGS="-Werror $CFLAGS"
237 fi
238
239 AC_DEFINE([COMPILER_IS_GCC],1, [Set to 1 if the compile is GNU GCC.])
240 GCC_MAJOR_VERSION=`$CC -dumpversion | sed "s/\..*//"`
241 AC_DEFINE_UNQUOTED([GCC_MAJOR_VERSION],${GCC_MAJOR_VERSION}, [Major version of GCC or 3 otherwise.])
242 fi
243
244 #====================================================================================
245 # Find known target OS.
246
247 OS_SPECIFIC_INCLUDES=""
248 os_is_win32=0
249
250 case "$target_os" in
251 darwin* | rhapsody*)
252 OS_SPECIFIC_INCLUDES="-fpascal-strings -I/Developer/Headers/FlatCarbon"
253 OS_SPECIFIC_LINKS="-framework CoreAudio"
254 ;;
255 mingw32*)
256 OS_SPECIFIC_LINKS="-lwinmm"
257 os_is_win32=1
258 ;;
259 *)
260 OS_SPECIFIC_INCLUDES=""
261 OS_SPECIFIC_LINKS=""
262 ;;
263 esac
264
265 htmldocdir=$prefix/share/doc/libsamplerate0-dev/html
266
267 if test $prefix = "NONE" ; then
268 htmldocdir=/usr/local/share/doc/libsamplerate0-dev/html
269 else
270 htmldocdir=$prefix/share/doc/libsamplerate0-dev/html
271 fi
272
273 #====================================================================================
274 # Now use the information from the checking stage.
275
276 AC_DEFINE_UNQUOTED(OS_IS_WIN32, ${os_is_win32}, [Set to 1 if compiling for Win32])
277
278 AC_SUBST(htmldocdir)
279
280 AC_SUBST(SHLIB_VERSION_ARG)
281 AC_SUBST(SHARED_VERSION_INFO)
282 AC_SUBST(OS_SPECIFIC_INCLUDES)
283 AC_SUBST(OS_SPECIFIC_LINKS)
284
285 AC_SUBST(COMPILER_IS_GCC)
286 AC_SUBST(GCC_MAJOR_VERSION)
287
288 AC_SUBST(HAVE_FFTW3)
289 AC_SUBST(FFTW3_CFLAGS)
290 AC_SUBST(FFTW3_LIBS)
291
292 AC_SUBST(HAVE_SNDFILE)
293 AC_SUBST(SNDFILE_CFLAGS)
294 AC_SUBST(SNDFILE_LIBS)
295
296 AC_CONFIG_FILES([Makefile M4/Makefile src/Version_script \
297 Win32/Makefile Win32/Makefile.mingw \
298 src/Makefile examples/Makefile tests/Makefile doc/Makefile \
299 libsamplerate.spec samplerate.pc])
300 AC_OUTPUT
301
302 #====================================================================================
303
304 AC_MSG_RESULT([
305 -=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-=-
306
307 Configuration summary :
308
309 Version : ..................... ${VERSION}
310
311 Host CPU : .................... ${host_cpu}
312 Host Vendor : ................. ${host_vendor}
313 Host OS : ..................... ${host_os}
314 ])
315
316 if test x$ac_cv_c_compiler_gnu = xyes ; then
317 echo -e " Tools :\n"
318 echo " Compiler is GCC : ............. ${ac_cv_c_compiler_gnu}"
319 echo " GCC major version : ........... ${GCC_MAJOR_VERSION}"
320 fi
321
322 AC_MSG_RESULT([
323 Extra tools required for testing and examples :
324
325 Use FFTW : .................... ${ac_cv_fftw3}])
326
327 AC_MSG_RESULT([ Have libsndfile : ............. ${ac_cv_sndfile}
328 ])
329
330 AC_MSG_RESULT([ Installation directories :
331
332 Library directory : ........... ${prefix}/lib
333 Program directory : ........... ${prefix}/bin
334 Pkgconfig directory : ......... ${prefix}/lib/pkgconfig
335 ])
336
337 if test x$prefix != "x/usr" ; then
338 echo "Compiling some other packages against ${PACKAGE} may require "
339 echo -e "the addition of \"${prefix}/lib/pkgconfig\" to the "
340 echo -e "PKG_CONFIG_PATH environment variable.\n"
341 fi
342