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