Chris@0
|
1 # Copyright (C) 1999-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([libsndfile],[1.0.25],[sndfile@mega-nerd.com],
|
Chris@0
|
7 [libsndfile],[http://www.mega-nerd.com/libsndfile/])
|
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/sndfile.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_CHECK_PROG(HAVE_AUTOGEN, autogen, yes, no)
|
Chris@0
|
38 AC_CHECK_PROG(HAVE_WINE, wine, yes, no)
|
Chris@0
|
39
|
Chris@0
|
40 AC_PROG_INSTALL
|
Chris@0
|
41 AC_PROG_LN_S
|
Chris@0
|
42
|
Chris@0
|
43 #------------------------------------------------------------------------------------
|
Chris@0
|
44 # Rules for library version information:
|
Chris@0
|
45 #
|
Chris@0
|
46 # 1. Start with version information of `0:0:0' for each libtool library.
|
Chris@0
|
47 # 2. Update the version information only immediately before a public release of
|
Chris@0
|
48 # your software. More frequent updates are unnecessary, and only guarantee
|
Chris@0
|
49 # that the current interface number gets larger faster.
|
Chris@0
|
50 # 3. If the library source code has changed at all since the last update, then
|
Chris@0
|
51 # increment revision (`c:r:a' becomes `c:r+1:a').
|
Chris@0
|
52 # 4. If any interfaces have been added, removed, or changed since the last update,
|
Chris@0
|
53 # increment current, and set revision to 0.
|
Chris@0
|
54 # 5. If any interfaces have been added since the last public release, then increment
|
Chris@0
|
55 # age.
|
Chris@0
|
56 # 6. If any interfaces have been removed since the last public release, then set age
|
Chris@0
|
57 # to 0.
|
Chris@0
|
58
|
Chris@0
|
59 CLEAN_VERSION=`echo $PACKAGE_VERSION | $SED "s/p.*//"`
|
Chris@0
|
60 VERSION_MINOR=`echo $CLEAN_VERSION | $SED "s/.*\.//"`
|
Chris@0
|
61
|
Chris@0
|
62 SHARED_VERSION_INFO="1:$VERSION_MINOR:0"
|
Chris@0
|
63
|
Chris@0
|
64 #------------------------------------------------------------------------------------
|
Chris@0
|
65
|
Chris@0
|
66 AC_HEADER_STDC
|
Chris@0
|
67
|
Chris@0
|
68 AC_CHECK_HEADERS(endian.h)
|
Chris@0
|
69 AC_CHECK_HEADERS(byteswap.h)
|
Chris@0
|
70 AC_CHECK_HEADERS(locale.h)
|
Chris@0
|
71 AC_CHECK_HEADERS(sys/time.h)
|
Chris@0
|
72
|
Chris@0
|
73 AC_HEADER_SYS_WAIT
|
Chris@0
|
74
|
Chris@0
|
75 AC_CHECK_DECLS(S_IRGRP)
|
Chris@0
|
76 if test x$ac_cv_have_decl_S_IRGRP = xyes ; then
|
Chris@0
|
77 AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP],1,[Set to 1 if S_IRGRP is defined.])
|
Chris@0
|
78 else
|
Chris@0
|
79 AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP],0)
|
Chris@0
|
80 fi
|
Chris@0
|
81
|
Chris@0
|
82 AM_CONDITIONAL([LINUX_MINGW_CROSS_TEST],
|
Chris@0
|
83 [test "$build_os:$target_os:$host_os:$HAVE_WINE" = "linux-gnu:mingw32msvc:mingw32msvc:yes"])
|
Chris@0
|
84
|
Chris@0
|
85 #====================================================================================
|
Chris@0
|
86 # Check for support of the struct hack.
|
Chris@0
|
87
|
Chris@0
|
88 MN_C99_FLEXIBLE_ARRAY
|
Chris@0
|
89
|
Chris@0
|
90 if test x$ac_cv_c99_flexible_array = xyes ; then
|
Chris@0
|
91 AC_DEFINE([HAVE_FLEXIBLE_ARRAY],1, [Set to 1 if the compile supports the struct hack.])
|
Chris@0
|
92 else
|
Chris@0
|
93 AC_MSG_WARN([[*** This compiler does not support the 1999 ISO C Standard ***]])
|
Chris@0
|
94 AC_MSG_WARN([[*** feature known as the flexible array struct member. ***]])
|
Chris@0
|
95 AC_DEFINE([HAVE_FLEXIBLE_ARRAY],0)
|
Chris@0
|
96 fi
|
Chris@0
|
97
|
Chris@0
|
98 #====================================================================================
|
Chris@0
|
99 # Couple of initializations here. Fill in real values later.
|
Chris@0
|
100
|
Chris@0
|
101 SHLIB_VERSION_ARG=""
|
Chris@0
|
102
|
Chris@0
|
103 #====================================================================================
|
Chris@0
|
104 # Finished checking, handle options.
|
Chris@0
|
105
|
Chris@0
|
106 AC_ARG_ENABLE(experimental,
|
Chris@0
|
107 AC_HELP_STRING([--enable-experimental], [enable experimental code]))
|
Chris@0
|
108
|
Chris@0
|
109 EXPERIMENTAL_CODE=0
|
Chris@0
|
110 if test x$enable_experimental = xyes ; then
|
Chris@0
|
111 EXPERIMENTAL_CODE=1
|
Chris@0
|
112 fi
|
Chris@0
|
113 AC_DEFINE_UNQUOTED([ENABLE_EXPERIMENTAL_CODE],${EXPERIMENTAL_CODE}, [Set to 1 to enable experimental code.])
|
Chris@0
|
114
|
Chris@0
|
115 AC_ARG_ENABLE(gcc-werror,
|
Chris@0
|
116 AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]))
|
Chris@0
|
117
|
Chris@0
|
118 AC_ARG_ENABLE(gcc-pipe,
|
Chris@0
|
119 AC_HELP_STRING([--disable-gcc-pipe], [disable gcc -pipe option]))
|
Chris@0
|
120
|
Chris@0
|
121 AC_ARG_ENABLE(gcc-opt,
|
Chris@0
|
122 AC_HELP_STRING([--disable-gcc-opt], [disable gcc optimisations]))
|
Chris@0
|
123
|
Chris@0
|
124 AC_ARG_ENABLE(cpu-clip,
|
Chris@0
|
125 AC_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper]))
|
Chris@0
|
126
|
Chris@0
|
127 AC_ARG_ENABLE(bow-docs,
|
Chris@0
|
128 AC_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs]))
|
Chris@0
|
129
|
Chris@0
|
130 AC_ARG_ENABLE(sqlite,
|
Chris@0
|
131 AC_HELP_STRING([--disable-sqlite], [disable use of sqlite]))
|
Chris@0
|
132
|
Chris@0
|
133 AC_ARG_ENABLE(alsa,
|
Chris@0
|
134 AC_HELP_STRING([--disable-alsa], [disable use of ALSA]))
|
Chris@0
|
135
|
Chris@0
|
136 AC_ARG_ENABLE(external-libs,
|
Chris@0
|
137 AC_HELP_STRING([--disable-external-libs], [disable use of FLAC, Ogg and Vorbis [[default=no]]]))
|
Chris@0
|
138
|
Chris@0
|
139 AC_ARG_ENABLE(octave,
|
Chris@0
|
140 AC_HELP_STRING([--enable-octave], [disable building of GNU Octave module]))
|
Chris@0
|
141
|
Chris@0
|
142 AC_ARG_ENABLE(test-coverage,
|
Chris@0
|
143 AC_HELP_STRING([--enable-test-coverage], [enable test coverage]))
|
Chris@0
|
144 AM_CONDITIONAL([ENABLE_TEST_COVERAGE], [test "$enable_test_coverage" = yes])
|
Chris@0
|
145
|
Chris@0
|
146 #====================================================================================
|
Chris@0
|
147 # Check types and their sizes.
|
Chris@0
|
148
|
Chris@0
|
149 AC_CHECK_SIZEOF(wchar_t,4)
|
Chris@0
|
150 AC_CHECK_SIZEOF(short,2)
|
Chris@0
|
151 AC_CHECK_SIZEOF(int,4)
|
Chris@0
|
152 AC_CHECK_SIZEOF(long,4)
|
Chris@0
|
153 AC_CHECK_SIZEOF(float,4)
|
Chris@0
|
154 AC_CHECK_SIZEOF(double,4)
|
Chris@0
|
155 AC_CHECK_SIZEOF(void*,8)
|
Chris@0
|
156 AC_CHECK_SIZEOF(size_t,4)
|
Chris@0
|
157 AC_CHECK_SIZEOF(int64_t,8)
|
Chris@0
|
158 AC_CHECK_SIZEOF(long long,8)
|
Chris@0
|
159
|
Chris@0
|
160 #====================================================================================
|
Chris@0
|
161 # Find an appropriate type for sf_count_t.
|
Chris@0
|
162 # On systems supporting files larger than 2 Gig, sf_count_t must be a 64 bit value.
|
Chris@0
|
163 # Unfortunately there is more than one way of ensuring this so need to do some
|
Chris@0
|
164 # pretty rigourous testing here.
|
Chris@0
|
165
|
Chris@0
|
166 unset ac_cv_sizeof_off_t
|
Chris@0
|
167
|
Chris@0
|
168 AC_CHECK_SIZEOF(off_t,1) # Fake default value.
|
Chris@0
|
169
|
Chris@0
|
170 case "$host_os" in
|
Chris@0
|
171 mingw32msvc | mingw32)
|
Chris@0
|
172 TYPEOF_SF_COUNT_T="__int64"
|
Chris@0
|
173 SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
|
Chris@0
|
174 SIZEOF_SF_COUNT_T=8
|
Chris@0
|
175 AC_DEFINE([__USE_MINGW_ANSI_STDIO],1,[Set to 1 to use C99 printf/snprintf in MinGW.])
|
Chris@0
|
176 ;;
|
Chris@0
|
177 *)
|
Chris@0
|
178 if test "x$ac_cv_sizeof_off_t" = "x8" ; then
|
Chris@0
|
179 # If sizeof (off_t) is 8, no further checking is needed.
|
Chris@0
|
180 TYPEOF_SF_COUNT_T="int64_t"
|
Chris@0
|
181 SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
|
Chris@0
|
182 SIZEOF_SF_COUNT_T=8
|
Chris@0
|
183 else
|
Chris@0
|
184 # Check for common 64 bit file offset types.
|
Chris@0
|
185 AC_CHECK_SIZEOF(loff_t,1) # Fake default value.
|
Chris@0
|
186 AC_CHECK_SIZEOF(off64_t,1) # Fake default value.
|
Chris@0
|
187
|
Chris@0
|
188 TYPEOF_SF_COUNT_T="unknown"
|
Chris@0
|
189 if test "x$ac_cv_sizeof_loff_t" = "x8" ; then
|
Chris@0
|
190 TYPEOF_SF_COUNT_T="int64_t"
|
Chris@0
|
191 SIZEOF_SF_COUNT_T=8
|
Chris@0
|
192 elif test "x$ac_cv_sizeof_off64_t" = "x8" ; then
|
Chris@0
|
193 TYPEOF_SF_COUNT_T="int64_t"
|
Chris@0
|
194 SIZEOF_SF_COUNT_T=8
|
Chris@0
|
195 fi
|
Chris@0
|
196
|
Chris@0
|
197 # Save the old sizeof (off_t) value and then unset it to see if it
|
Chris@0
|
198 # changes when Large File Support is enabled.
|
Chris@0
|
199
|
Chris@0
|
200 pre_largefile_sizeof_off_t=$ac_cv_sizeof_off_t
|
Chris@0
|
201 unset ac_cv_sizeof_off_t
|
Chris@0
|
202
|
Chris@0
|
203 AC_SYS_EXTRA_LARGEFILE
|
Chris@0
|
204
|
Chris@0
|
205 if test "x$ac_cv_sys_largefile_CFLAGS" = "xno" ; then
|
Chris@0
|
206 ac_cv_sys_largefile_CFLAGS=""
|
Chris@0
|
207 fi
|
Chris@0
|
208 if test "x$ac_cv_sys_largefile_LDFLAGS" = "xno" ; then
|
Chris@0
|
209 ac_cv_sys_largefile_LDFLAGS=""
|
Chris@0
|
210 fi
|
Chris@0
|
211 if test "x$ac_cv_sys_largefile_LIBS" = "xno" ; then
|
Chris@0
|
212 ac_cv_sys_largefile_LIBS=""
|
Chris@0
|
213 fi
|
Chris@0
|
214
|
Chris@0
|
215 AC_CHECK_SIZEOF(off_t,1) # Fake default value.
|
Chris@0
|
216
|
Chris@0
|
217 if test "x$ac_cv_sizeof_off_t" = "x8" ; then
|
Chris@0
|
218 TYPEOF_SF_COUNT_T="int64_t"
|
Chris@0
|
219 SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
|
Chris@0
|
220 elif test "x$ac_cv_sizeof_off_t" = "x$pre_largefile_sizeof_off_t" ; then
|
Chris@0
|
221 AC_MSG_WARN([[This machine does not seem to support 64 bit file offsets.]])
|
Chris@0
|
222 TYPEOF_SF_COUNT_T="off_t"
|
Chris@0
|
223 SIZEOF_SF_COUNT_T=$ac_cv_sizeof_off_t
|
Chris@0
|
224 elif test "x$TYPEOF_SF_COUNT_T" = "xunknown" ; then
|
Chris@0
|
225 echo
|
Chris@0
|
226 echo "*** The configure process has determined that this system is capable"
|
Chris@0
|
227 echo "*** of Large File Support but has not been able to find a type which"
|
Chris@0
|
228 echo "*** is an unambiguous 64 bit file offset."
|
Chris@0
|
229 echo "*** Please contact the author to help resolve this problem."
|
Chris@0
|
230 echo
|
Chris@0
|
231 AC_MSG_ERROR([[Bad file offset type.]])
|
Chris@0
|
232 fi
|
Chris@0
|
233 fi
|
Chris@0
|
234 ;;
|
Chris@0
|
235 esac
|
Chris@0
|
236
|
Chris@0
|
237 if test $SIZEOF_SF_COUNT_T = 4 ; then
|
Chris@0
|
238 SF_COUNT_MAX="0x7FFFFFFF"
|
Chris@0
|
239 fi
|
Chris@0
|
240
|
Chris@0
|
241 AC_DEFINE_UNQUOTED([TYPEOF_SF_COUNT_T],${TYPEOF_SF_COUNT_T}, [Set to long if unknown.])
|
Chris@0
|
242 AC_SUBST(TYPEOF_SF_COUNT_T)
|
Chris@0
|
243
|
Chris@0
|
244 AC_DEFINE_UNQUOTED([SIZEOF_SF_COUNT_T],${SIZEOF_SF_COUNT_T}, [Set to sizeof (long) if unknown.])
|
Chris@0
|
245 AC_SUBST(SIZEOF_SF_COUNT_T)
|
Chris@0
|
246
|
Chris@0
|
247 AC_DEFINE_UNQUOTED([SF_COUNT_MAX],${SF_COUNT_MAX}, [Set to maximum allowed value of sf_count_t type.])
|
Chris@0
|
248 AC_SUBST(SF_COUNT_MAX)
|
Chris@0
|
249
|
Chris@0
|
250 AC_CHECK_TYPES(ssize_t)
|
Chris@0
|
251 AC_CHECK_SIZEOF(ssize_t,4)
|
Chris@0
|
252
|
Chris@0
|
253 #====================================================================================
|
Chris@0
|
254 # Determine endian-ness of target processor.
|
Chris@0
|
255
|
Chris@0
|
256 MN_C_FIND_ENDIAN
|
Chris@0
|
257
|
Chris@0
|
258 AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
|
Chris@0
|
259 [Target processor is big endian.])
|
Chris@0
|
260 AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
|
Chris@0
|
261 [Target processor is little endian.])
|
Chris@0
|
262 AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, ${ac_cv_c_big_endian},
|
Chris@0
|
263 [Target processor is big endian.])
|
Chris@0
|
264
|
Chris@0
|
265 #====================================================================================
|
Chris@0
|
266 # Check for functions.
|
Chris@0
|
267
|
Chris@0
|
268 AC_CHECK_FUNCS(malloc calloc realloc free)
|
Chris@0
|
269 AC_CHECK_FUNCS(open read write lseek pread pwrite)
|
Chris@0
|
270 AC_CHECK_FUNCS(fstat ftruncate fsync)
|
Chris@0
|
271 AC_CHECK_FUNCS(snprintf vsnprintf)
|
Chris@0
|
272 AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r gettimeofday)
|
Chris@0
|
273 AC_CHECK_FUNCS(mmap getpagesize)
|
Chris@0
|
274 AC_CHECK_FUNCS(setlocale)
|
Chris@0
|
275 AC_CHECK_FUNCS(pipe waitpid)
|
Chris@0
|
276
|
Chris@0
|
277 AC_CHECK_LIB([m],floor)
|
Chris@0
|
278 AC_CHECK_FUNCS(floor ceil fmod)
|
Chris@0
|
279
|
Chris@0
|
280 MN_C99_FUNC_LRINT
|
Chris@0
|
281 MN_C99_FUNC_LRINTF
|
Chris@0
|
282
|
Chris@0
|
283 #====================================================================================
|
Chris@0
|
284 # Check for requirements for building plugins for other languages/enviroments.
|
Chris@0
|
285
|
Chris@0
|
286 dnl Octave maths environment http://www.octave.org/
|
Chris@0
|
287 if test x$cross_compiling = xno ; then
|
Chris@0
|
288 if test x$enable_octave = xno ; then
|
Chris@0
|
289 AM_CONDITIONAL(BUILD_OCTAVE_MOD, false)
|
Chris@0
|
290 else
|
Chris@0
|
291 AC_OCTAVE_BUILD
|
Chris@0
|
292 fi
|
Chris@0
|
293 else
|
Chris@0
|
294 AM_CONDITIONAL(BUILD_OCTAVE_MOD, false)
|
Chris@0
|
295 fi
|
Chris@0
|
296
|
Chris@0
|
297 #====================================================================================
|
Chris@0
|
298 # Check for Ogg, Vorbis and FLAC.
|
Chris@0
|
299
|
Chris@0
|
300 HAVE_EXTERNAL_LIBS=0
|
Chris@0
|
301 EXTERNAL_CFLAGS=""
|
Chris@0
|
302 EXTERNAL_LIBS=""
|
Chris@0
|
303
|
Chris@0
|
304 # Check for pkg-config outside the if statement.
|
Chris@0
|
305 PKG_PROG_PKG_CONFIG
|
Chris@0
|
306
|
Chris@0
|
307 if test -n "$PKG_CONFIG" ; then
|
Chris@0
|
308 if test x$enable_external_libs = xno ; then
|
Chris@0
|
309 AC_MSG_WARN([[*** External libs (FLAC, Ogg, Vorbis) disabled. ***]])
|
Chris@0
|
310 else
|
Chris@0
|
311 PKG_CHECK_MOD_VERSION(FLAC, flac >= 1.2.1, ac_cv_flac=yes, ac_cv_flac=no)
|
Chris@0
|
312
|
Chris@0
|
313 # Make sure the FLAC_CFLAGS value is sane.
|
Chris@0
|
314 FLAC_CFLAGS=`echo $FLAC_CLFAGS | $SED "s/FLAC$//"`
|
Chris@0
|
315
|
Chris@0
|
316 PKG_CHECK_MOD_VERSION(OGG, ogg >= 1.1.3, ac_cv_ogg=yes, ac_cv_ogg=no)
|
Chris@0
|
317
|
Chris@0
|
318 if test x$enable_experimental = xyes ; then
|
Chris@0
|
319 PKG_CHECK_MOD_VERSION(SPEEX, speex >= 1.2, ac_cv_speex=yes, ac_cv_speex=no)
|
Chris@0
|
320 else
|
Chris@0
|
321 SPEEX_CFLAGS=""
|
Chris@0
|
322 SPEEX_LIBS=""
|
Chris@0
|
323 fi
|
Chris@0
|
324
|
Chris@0
|
325 # Vorbis versions earlier than 1.2.3 have bugs that cause the libsndfile
|
Chris@0
|
326 # test suite to fail on MIPS, PowerPC and others.
|
Chris@0
|
327 # See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=549899
|
Chris@0
|
328 PKG_CHECK_MOD_VERSION(VORBIS, vorbis >= 1.2.3, ac_cv_vorbis=yes, ac_cv_vorbis=no)
|
Chris@0
|
329 PKG_CHECK_MOD_VERSION(VORBISENC, vorbisenc >= 1.2.3, ac_cv_vorbisenc=yes, ac_cv_vorbisenc=no)
|
Chris@0
|
330 enable_external_libs=yes
|
Chris@0
|
331 fi
|
Chris@0
|
332
|
Chris@0
|
333 if test x$ac_cv_flac$ac_cv_ogg$ac_cv_vorbis$ac_cv_vorbisenc = "xyesyesyesyes" ; then
|
Chris@0
|
334 HAVE_EXTERNAL_LIBS=1
|
Chris@0
|
335 enable_external_libs=yes
|
Chris@0
|
336
|
Chris@0
|
337 EXTERNAL_CFLAGS="$FLAC_CFLAGS $OGG_CFLAGS $VORBISENC_CFLAGS $SPEEX_CFLAGS"
|
Chris@0
|
338 EXTERNAL_LIBS="$FLAC_LIBS $VORBISENC_LIBS $SPEEX_LIBS"
|
Chris@0
|
339 else
|
Chris@0
|
340 echo
|
Chris@0
|
341 AC_MSG_WARN([[*** One or more of the external libraries (ie libflac, libogg and]])
|
Chris@0
|
342 AC_MSG_WARN([[*** libvorbis) is either missing (possibly only the development]])
|
Chris@0
|
343 AC_MSG_WARN([[*** headers) or is of an unsupported version.]])
|
Chris@0
|
344 AC_MSG_WARN([[***]])
|
Chris@0
|
345 AC_MSG_WARN([[*** Unfortunately, for ease of maintenance, the external libs]])
|
Chris@0
|
346 AC_MSG_WARN([[*** are an all or nothing affair.]])
|
Chris@0
|
347 echo
|
Chris@0
|
348 enable_external_libs=no
|
Chris@0
|
349 fi
|
Chris@0
|
350 fi
|
Chris@0
|
351
|
Chris@0
|
352 AC_DEFINE_UNQUOTED([HAVE_EXTERNAL_LIBS], $HAVE_EXTERNAL_LIBS, [Will be set to 1 if flac, ogg and vorbis are available.])
|
Chris@0
|
353
|
Chris@0
|
354 #====================================================================================
|
Chris@0
|
355 # Check for libsqlite3 (only used in regtest).
|
Chris@0
|
356
|
Chris@0
|
357 ac_cv_sqlite3=no
|
Chris@0
|
358 if test x$enable_sqlite != xno ; then
|
Chris@0
|
359 PKG_CHECK_MOD_VERSION(SQLITE3, sqlite3 >= 3.2, ac_cv_sqlite3=yes, ac_cv_sqlite3=no)
|
Chris@0
|
360 fi
|
Chris@0
|
361
|
Chris@0
|
362 if test x$ac_cv_sqlite3 = "xyes" ; then
|
Chris@0
|
363 HAVE_SQLITE3=1
|
Chris@0
|
364 else
|
Chris@0
|
365 HAVE_SQLITE3=0
|
Chris@0
|
366 fi
|
Chris@0
|
367
|
Chris@0
|
368 AC_DEFINE_UNQUOTED([HAVE_SQLITE3],$HAVE_SQLITE3,[Set to 1 if you have libsqlite3.])
|
Chris@0
|
369
|
Chris@0
|
370 #====================================================================================
|
Chris@0
|
371 # Determine if the processor can do clipping on float to int conversions.
|
Chris@0
|
372
|
Chris@0
|
373 if test x$enable_cpu_clip != "xno" ; then
|
Chris@0
|
374 MN_C_CLIP_MODE
|
Chris@0
|
375 else
|
Chris@0
|
376 echo "checking processor clipping capabilities... disabled"
|
Chris@0
|
377 ac_cv_c_clip_positive=0
|
Chris@0
|
378 ac_cv_c_clip_negative=0
|
Chris@0
|
379 fi
|
Chris@0
|
380
|
Chris@0
|
381 AC_DEFINE_UNQUOTED(CPU_CLIPS_POSITIVE, ${ac_cv_c_clip_positive},
|
Chris@0
|
382 [Target processor clips on positive float to int conversion.])
|
Chris@0
|
383 AC_DEFINE_UNQUOTED(CPU_CLIPS_NEGATIVE, ${ac_cv_c_clip_negative},
|
Chris@0
|
384 [Target processor clips on negative float to int conversion.])
|
Chris@0
|
385
|
Chris@0
|
386 #====================================================================================
|
Chris@0
|
387 # Target OS specific stuff.
|
Chris@0
|
388
|
Chris@0
|
389 OS_SPECIFIC_CFLAGS=""
|
Chris@0
|
390 OS_SPECIFIC_LINKS=""
|
Chris@0
|
391 os_is_win32=0
|
Chris@0
|
392 os_is_macosx=0
|
Chris@0
|
393 use_windows_api=0
|
Chris@0
|
394
|
Chris@0
|
395 case "$host_os" in
|
Chris@0
|
396 darwin* | rhapsody*)
|
Chris@0
|
397 os_is_macosx=1
|
Chris@0
|
398 OS_SPECIFIC_CFLAGS="-I/Developer/Headers/FlatCarbon"
|
Chris@0
|
399 OS_SPECIFIC_LINKS="-framework CoreAudio"
|
Chris@0
|
400 ;;
|
Chris@0
|
401 mingw*)
|
Chris@0
|
402 os_is_win32=1
|
Chris@0
|
403 use_windows_api=1
|
Chris@0
|
404 OS_SPECIFIC_LINKS="-lwinmm"
|
Chris@0
|
405 ;;
|
Chris@0
|
406 esac
|
Chris@0
|
407
|
Chris@0
|
408 AC_DEFINE_UNQUOTED(OS_IS_WIN32, ${os_is_win32}, [Set to 1 if compiling for Win32])
|
Chris@0
|
409 AC_DEFINE_UNQUOTED(OS_IS_MACOSX, ${os_is_macosx}, [Set to 1 if compiling for MacOSX])
|
Chris@0
|
410 AC_DEFINE_UNQUOTED(USE_WINDOWS_API, ${use_windows_api}, [Set to 1 to use the native windows API])
|
Chris@0
|
411
|
Chris@0
|
412 AM_CONDITIONAL(USE_WIN_VERSION_FILE, test ${use_windows_api} -eq 1)
|
Chris@0
|
413
|
Chris@0
|
414 #====================================================================================
|
Chris@0
|
415 # Check for ALSA.
|
Chris@0
|
416
|
Chris@0
|
417 ALSA_LIBS=""
|
Chris@0
|
418
|
Chris@0
|
419 if test x$enable_alsa != xno ; then
|
Chris@0
|
420 AC_CHECK_HEADERS(alsa/asoundlib.h)
|
Chris@0
|
421 if test x$ac_cv_header_alsa_asoundlib_h = xyes ; then
|
Chris@0
|
422 ALSA_LIBS="-lasound"
|
Chris@0
|
423 enable_alsa=yes
|
Chris@0
|
424 fi
|
Chris@0
|
425 fi
|
Chris@0
|
426
|
Chris@0
|
427 #====================================================================================
|
Chris@0
|
428 # Check for OpenBSD's sndio.
|
Chris@0
|
429
|
Chris@0
|
430 SNDIO_LIBS=""
|
Chris@0
|
431 AC_CHECK_HEADERS(sndio.h)
|
Chris@0
|
432 if test x$ac_cv_header_sndio_h = xyes ; then
|
Chris@0
|
433 SNDIO_LIBS="-lsndio"
|
Chris@0
|
434 fi
|
Chris@0
|
435
|
Chris@0
|
436 #====================================================================================
|
Chris@0
|
437 # Test for sanity when cross-compiling.
|
Chris@0
|
438
|
Chris@0
|
439 if test x$cross_compiling = xyes ; then
|
Chris@0
|
440 AC_MSG_WARN([[******************************************************************]])
|
Chris@0
|
441 AC_MSG_WARN([[*** We are cross-compiling, so have to assume sizeof (short) == 2 ]])
|
Chris@0
|
442 AC_MSG_WARN([[*** and sizeof (int) == 4. If this is not the case there is no ]])
|
Chris@0
|
443 AC_MSG_WARN([[*** chance of this working. Please contact the mantainer. ]])
|
Chris@0
|
444 AC_MSG_WARN([[******************************************************************]])
|
Chris@0
|
445 fi
|
Chris@0
|
446
|
Chris@0
|
447 if test $ac_cv_sizeof_short != 2 ; then
|
Chris@0
|
448 AC_MSG_WARN([[******************************************************************]])
|
Chris@0
|
449 AC_MSG_WARN([[*** sizeof (short) != 2. ]])
|
Chris@0
|
450 AC_MSG_WARN([[******************************************************************]])
|
Chris@0
|
451 fi
|
Chris@0
|
452
|
Chris@0
|
453 if test $ac_cv_sizeof_int != 4 ; then
|
Chris@0
|
454 AC_MSG_WARN([[******************************************************************]])
|
Chris@0
|
455 AC_MSG_WARN([[*** sizeof (int) != 4 ]])
|
Chris@0
|
456 AC_MSG_WARN([[******************************************************************]])
|
Chris@0
|
457 fi
|
Chris@0
|
458
|
Chris@0
|
459 if test $ac_cv_sizeof_float != 4 ; then
|
Chris@0
|
460 AC_MSG_WARN([[******************************************************************]])
|
Chris@0
|
461 AC_MSG_WARN([[*** sizeof (float) != 4. ]])
|
Chris@0
|
462 AC_MSG_WARN([[******************************************************************]])
|
Chris@0
|
463 fi
|
Chris@0
|
464
|
Chris@0
|
465 if test $ac_cv_sizeof_double != 8 ; then
|
Chris@0
|
466 AC_MSG_WARN([[******************************************************************]])
|
Chris@0
|
467 AC_MSG_WARN([[*** sizeof (double) != 8. ]])
|
Chris@0
|
468 AC_MSG_WARN([[******************************************************************]])
|
Chris@0
|
469 fi
|
Chris@0
|
470
|
Chris@0
|
471 if test x"$ac_cv_prog_HAVE_AUTOGEN" = "xno" ; then
|
Chris@0
|
472 AC_MSG_WARN([[Touching files in directory tests/.]])
|
Chris@0
|
473 touch tests/*.c tests/*.h
|
Chris@0
|
474 fi
|
Chris@0
|
475
|
Chris@0
|
476 #====================================================================================
|
Chris@0
|
477 # Settings for the HTML documentation.
|
Chris@0
|
478
|
Chris@0
|
479 htmldocdir=$prefix/share/doc/libsndfile1-dev/html
|
Chris@0
|
480
|
Chris@0
|
481 if test $prefix = "NONE" ; then
|
Chris@0
|
482 htmldocdir=/usr/local/share/doc/libsndfile1-dev/html
|
Chris@0
|
483 else
|
Chris@0
|
484 htmldocdir=$prefix/share/doc/libsndfile1-dev/html
|
Chris@0
|
485 fi
|
Chris@0
|
486
|
Chris@0
|
487 if test x$enable_bow_docs = "xyes" ; then
|
Chris@0
|
488 HTML_BGCOLOUR="white"
|
Chris@0
|
489 HTML_FGCOLOUR="black"
|
Chris@0
|
490 else
|
Chris@0
|
491 HTML_BGCOLOUR="black"
|
Chris@0
|
492 HTML_FGCOLOUR="white"
|
Chris@0
|
493 fi
|
Chris@0
|
494
|
Chris@0
|
495 #====================================================================================
|
Chris@0
|
496 # Now use the information from the checking stage.
|
Chris@0
|
497
|
Chris@0
|
498 win32_target_dll=0
|
Chris@0
|
499 COMPILER_IS_GCC=0
|
Chris@0
|
500
|
Chris@0
|
501 if test x$ac_cv_c_compiler_gnu = xyes ; then
|
Chris@0
|
502 MN_ADD_CFLAGS(-std=gnu99)
|
Chris@0
|
503
|
Chris@0
|
504 MN_GCC_VERSION
|
Chris@0
|
505
|
Chris@0
|
506 if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then
|
Chris@0
|
507 AC_MSG_WARN([****************************************************************])
|
Chris@0
|
508 AC_MSG_WARN([** GCC version 4.2 warns about the inline keyword for no good **])
|
Chris@0
|
509 AC_MSG_WARN([** reason but the maintainers do not see it as a bug. **])
|
Chris@0
|
510 AC_MSG_WARN([** See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33995 **])
|
Chris@0
|
511 AC_MSG_WARN([** Using -fgnu-inline to avoid this stupidity. **])
|
Chris@0
|
512 AC_MSG_WARN([****************************************************************])
|
Chris@0
|
513 MN_ADD_CFLAGS([-fgnu89-inline])
|
Chris@0
|
514 fi
|
Chris@0
|
515
|
Chris@0
|
516 CFLAGS="$CFLAGS -Wall"
|
Chris@0
|
517 CXXFLAGS="$CXXFLAGS -Wall"
|
Chris@0
|
518
|
Chris@0
|
519 MN_ADD_CFLAGS([-Wextra])
|
Chris@0
|
520
|
Chris@0
|
521 AC_LANG_PUSH([C++])
|
Chris@0
|
522 MN_ADD_CXXFLAGS([-Wextra])
|
Chris@0
|
523 AC_LANG_POP([C++])
|
Chris@0
|
524
|
Chris@0
|
525 MN_ADD_CFLAGS([-Wdeclaration-after-statement])
|
Chris@0
|
526 MN_ADD_CFLAGS([-Wpointer-arith])
|
Chris@0
|
527 MN_ADD_CFLAGS([-funsigned-char])
|
Chris@0
|
528
|
Chris@0
|
529 if test x$enable_gcc_werror = "xyes" ; then
|
Chris@0
|
530 CFLAGS="-Werror $CFLAGS"
|
Chris@0
|
531 CXXFLAGS="-Werror $CXXFLAGS"
|
Chris@0
|
532 fi
|
Chris@0
|
533
|
Chris@0
|
534 if test x$enable_test_coverage = "xyes" ; then
|
Chris@0
|
535 # MN_ADD_CFLAGS([-ftest-coverage])
|
Chris@0
|
536 MN_ADD_CFLAGS([-coverage])
|
Chris@0
|
537 fi
|
Chris@0
|
538
|
Chris@0
|
539 CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast -Wwrite-strings -Wundef "
|
Chris@0
|
540 # -Wundef -Wmissing-declarations -Winline -Wconversion"
|
Chris@0
|
541 CXXFLAGS="$CXXFLAGS -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreorder -Wsign-promo -Wundef "
|
Chris@0
|
542
|
Chris@0
|
543 if test "x$enable_gcc_opt" = "xno" ; then
|
Chris@0
|
544 temp_CFLAGS=`echo $CFLAGS | $SED "s/O2/O0/"`
|
Chris@0
|
545 CFLAGS=$temp_CFLAGS
|
Chris@0
|
546 AC_MSG_WARN([[*** Compiler optimisations switched off. ***]])
|
Chris@0
|
547 fi
|
Chris@0
|
548
|
Chris@0
|
549 # OS specific tweaks.
|
Chris@0
|
550 case "$host_os" in
|
Chris@0
|
551 darwin* | rhapsody*)
|
Chris@0
|
552 # Disable -Wall, -pedantic and -Wshadow for Apple Darwin/Rhapsody.
|
Chris@0
|
553 # System headers on these systems are broken.
|
Chris@0
|
554 temp_CFLAGS=`echo $CFLAGS | $SED "s/-Wall -pedantic//" | $SED "s/-Wshadow//" | $SED "s/-Waggregate-return//"`
|
Chris@0
|
555 CFLAGS=$temp_CFLAGS
|
Chris@0
|
556 SHLIB_VERSION_ARG="-Wl,-exported_symbols_list -Wl,\$(srcdir)/Symbols.darwin"
|
Chris@0
|
557 ;;
|
Chris@0
|
558 linux*|kfreebsd*-gnu*|gnu*)
|
Chris@0
|
559 SHLIB_VERSION_ARG="-Wl,--version-script=\$(srcdir)/Symbols.gnu-binutils"
|
Chris@0
|
560 ;;
|
Chris@0
|
561 mingw*)
|
Chris@0
|
562 # Linker flag '-Wl,--out-implib' does not work with mingw cross compiler
|
Chris@0
|
563 # so we don't use it here.
|
Chris@0
|
564 SHLIB_VERSION_ARG="-Wl,\$(srcdir)/libsndfile-1.def"
|
Chris@0
|
565 win32_target_dll=1
|
Chris@0
|
566 if test x"$enable_shared" = xno ; then
|
Chris@0
|
567 win32_target_dll=0
|
Chris@0
|
568 fi
|
Chris@0
|
569 ;;
|
Chris@0
|
570 os2*)
|
Chris@0
|
571 SHLIB_VERSION_ARG="-Wl,-export-symbols \$(srcdir)/Symbols.os2"
|
Chris@0
|
572 ;;
|
Chris@0
|
573 *)
|
Chris@0
|
574 ;;
|
Chris@0
|
575 esac
|
Chris@0
|
576 if test x$enable_gcc_pipe != "xno" ; then
|
Chris@0
|
577 CFLAGS="$CFLAGS -pipe"
|
Chris@0
|
578 fi
|
Chris@0
|
579
|
Chris@0
|
580 COMPILER_IS_GCC=1
|
Chris@0
|
581 fi
|
Chris@0
|
582
|
Chris@0
|
583 AC_DEFINE_UNQUOTED([WIN32_TARGET_DLL], ${win32_target_dll}, [Set to 1 if windows DLL is being built.])
|
Chris@0
|
584 AC_DEFINE_UNQUOTED([COMPILER_IS_GCC], ${COMPILER_IS_GCC}, [Set to 1 if the compile is GNU GCC.])
|
Chris@0
|
585
|
Chris@0
|
586 CFLAGS="$CFLAGS $OS_SPECIFIC_CFLAGS"
|
Chris@0
|
587
|
Chris@0
|
588 if test x"$CFLAGS" = x ; then
|
Chris@0
|
589 echo "Error in configure script. CFLAGS has been screwed up."
|
Chris@0
|
590 exit
|
Chris@0
|
591 fi
|
Chris@0
|
592
|
Chris@0
|
593 HOST_TRIPLET="${host_cpu}-${host_vendor}-${host_os}"
|
Chris@0
|
594
|
Chris@0
|
595 if test "$HOST_TRIPLET" = "x86_64-w64-mingw32" ; then
|
Chris@0
|
596 OS_SPECIFIC_LINKS=" -static-libgcc $OS_SPECIFIC_LINKS"
|
Chris@0
|
597 fi
|
Chris@0
|
598
|
Chris@0
|
599 WIN_RC_VERSION=`echo $PACKAGE_VERSION | $SED -e "s/p.*//" -e "s/\./,/g"`
|
Chris@0
|
600
|
Chris@0
|
601 #-------------------------------------------------------------------------------
|
Chris@0
|
602
|
Chris@0
|
603 AC_SUBST(HOST_TRIPLET)
|
Chris@0
|
604
|
Chris@0
|
605 AC_SUBST(htmldocdir)
|
Chris@0
|
606 AC_SUBST(HTML_BGCOLOUR)
|
Chris@0
|
607 AC_SUBST(HTML_FGCOLOUR)
|
Chris@0
|
608
|
Chris@0
|
609 AC_SUBST(SHLIB_VERSION_ARG)
|
Chris@0
|
610 AC_SUBST(SHARED_VERSION_INFO)
|
Chris@0
|
611 AC_SUBST(CLEAN_VERSION)
|
Chris@0
|
612 AC_SUBST(WIN_RC_VERSION)
|
Chris@0
|
613
|
Chris@0
|
614 AC_SUBST(OS_SPECIFIC_CFLAGS)
|
Chris@0
|
615 AC_SUBST(OS_SPECIFIC_LINKS)
|
Chris@0
|
616 AC_SUBST(ALSA_LIBS)
|
Chris@0
|
617 AC_SUBST(SNDIO_LIBS)
|
Chris@0
|
618
|
Chris@0
|
619 AC_SUBST(EXTERNAL_CFLAGS)
|
Chris@0
|
620 AC_SUBST(EXTERNAL_LIBS)
|
Chris@0
|
621
|
Chris@0
|
622 dnl The following line causes the libtool distributed with the source
|
Chris@0
|
623 dnl to be replaced if the build system has a more recent version.
|
Chris@0
|
624 AC_SUBST(LIBTOOL_DEPS)
|
Chris@0
|
625
|
Chris@0
|
626 AC_CONFIG_FILES([ \
|
Chris@0
|
627 src/Makefile man/Makefile examples/Makefile tests/Makefile regtest/Makefile \
|
Chris@0
|
628 M4/Makefile doc/Makefile Win32/Makefile Octave/Makefile programs/Makefile \
|
Chris@0
|
629 Makefile \
|
Chris@0
|
630 src/version-metadata.rc tests/test_wrapper.sh tests/pedantic-header-test.sh \
|
Chris@0
|
631 doc/libsndfile.css build-test-tarball.mk libsndfile.spec sndfile.pc \
|
Chris@0
|
632 src/sndfile.h \
|
Chris@0
|
633 ])
|
Chris@0
|
634 AC_OUTPUT
|
Chris@0
|
635
|
Chris@0
|
636 # Make sure these are executable.
|
Chris@0
|
637 chmod u+x tests/test_wrapper.sh build-test-tarball.mk
|
Chris@0
|
638
|
Chris@0
|
639 #====================================================================================
|
Chris@0
|
640
|
Chris@0
|
641 AC_MSG_RESULT([
|
Chris@0
|
642 -=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
|
Chris@0
|
643
|
Chris@0
|
644 Configuration summary :
|
Chris@0
|
645
|
Chris@0
|
646 libsndfile version : .................. ${VERSION}
|
Chris@0
|
647
|
Chris@0
|
648 Host CPU : ............................ ${host_cpu}
|
Chris@0
|
649 Host Vendor : ......................... ${host_vendor}
|
Chris@0
|
650 Host OS : ............................. ${host_os}
|
Chris@0
|
651
|
Chris@0
|
652 Experimental code : ................... ${enable_experimental:-no}
|
Chris@0
|
653 Using ALSA in example programs : ...... ${enable_alsa:-no}
|
Chris@0
|
654 External FLAC/Ogg/Vorbis : ............ ${enable_external_libs:-no}
|
Chris@0
|
655 ])
|
Chris@0
|
656
|
Chris@0
|
657 if test -z "$PKG_CONFIG" ; then
|
Chris@0
|
658 echo " *****************************************************************"
|
Chris@0
|
659 echo " *** The pkg-config program is missing. ***"
|
Chris@0
|
660 echo " *** External FLAC/Ogg/Vorbis libs cannot be found without it. ***"
|
Chris@0
|
661 echo " *** http://pkg-config.freedesktop.org/wiki/ ***"
|
Chris@0
|
662 echo " *****************************************************************"
|
Chris@0
|
663 echo
|
Chris@0
|
664 fi
|
Chris@0
|
665
|
Chris@0
|
666 if test x$ac_cv_c_compiler_gnu = xyes ; then
|
Chris@0
|
667 echo " Tools :"
|
Chris@0
|
668 echo
|
Chris@0
|
669 echo " Compiler is GCC : ..................... ${ac_cv_c_compiler_gnu}"
|
Chris@0
|
670 echo " GCC version : ......................... ${GCC_VERSION}"
|
Chris@0
|
671 if test $GCC_MAJOR_VERSION -lt 3 ; then
|
Chris@0
|
672 echo "\n"
|
Chris@0
|
673 echo " ** This compiler version allows applications to write"
|
Chris@0
|
674 echo " ** to static strings within the library."
|
Chris@0
|
675 echo " ** Compile with GCC version 3.X or above to avoid this problem."
|
Chris@0
|
676 fi
|
Chris@0
|
677 fi
|
Chris@0
|
678
|
Chris@0
|
679 if test $libdir = "\${exec_prefix}/lib" ; then
|
Chris@0
|
680 libdir="$prefix/lib"
|
Chris@0
|
681 fi
|
Chris@0
|
682
|
Chris@0
|
683 if test $bindir = "\${exec_prefix}/bin" ; then
|
Chris@0
|
684 bindir="$prefix/bin"
|
Chris@0
|
685 fi
|
Chris@0
|
686
|
Chris@0
|
687 AC_MSG_RESULT([[
|
Chris@0
|
688 Installation directories :
|
Chris@0
|
689
|
Chris@0
|
690 Library directory : ................... $libdir
|
Chris@0
|
691 Program directory : ................... $bindir
|
Chris@0
|
692 Pkgconfig directory : ................. $libdir/pkgconfig
|
Chris@0
|
693 HTML docs directory : ................. $htmldocdir
|
Chris@0
|
694 ]])
|
Chris@0
|
695
|
Chris@0
|
696 if test x$prefix != "x/usr" ; then
|
Chris@0
|
697 echo "Compiling some other packages against libsndfile may require"
|
Chris@0
|
698 echo "the addition of '$libdir/pkgconfig' to the"
|
Chris@0
|
699 echo "PKG_CONFIG_PATH environment variable."
|
Chris@0
|
700 echo
|
Chris@0
|
701 fi
|
Chris@0
|
702
|
Chris@0
|
703 (cd src && make genfiles)
|
Chris@0
|
704 (cd tests && make genfiles)
|