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