comparison src/libsndfile-1.0.27/configure.ac @ 125:cd6cdf86811e

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