1 # Copyright (C) 1999-2006 Erik de Castro Lopo (erikd AT mega-nerd DOT com).
3 dnl Require autoconf version
6 AC_INIT([libsndfile],[ardour-special],[ardour@ardour.org])
7 AC_CONFIG_SRCDIR([src/sndfile.c])
8 AC_CANONICAL_TARGET([])
10 AC_CONFIG_HEADERS(src/config.h)
14 #------------------------------------------------------------------------------------
15 # Rules for library version information:
17 # 1. Start with version information of `0:0:0' for each libtool library.
18 # 2. Update the version information only immediately before a public release of
19 # your software. More frequent updates are unnecessary, and only guarantee
20 # that the current interface number gets larger faster.
21 # 3. If the library source code has changed at all since the last update, then
22 # increment revision (`c:r:a' becomes `c:r+1:a').
23 # 4. If any interfaces have been added, removed, or changed since the last update,
24 # increment current, and set revision to 0.
25 # 5. If any interfaces have been added since the last public release, then increment
27 # 6. If any interfaces have been removed since the last public release, then set age
30 SHARED_VERSION_INFO="1:16:0"
35 AC_CHECK_PROG(autogen, autogen, yes, no)
42 AC_CHECK_HEADERS(endian.h)
43 AC_CHECK_HEADERS(byteswap.h)
44 AC_CHECK_HEADERS(locale.h)
45 AC_CHECK_HEADERS(inttypes.h)
49 AC_CHECK_DECLS(S_IRGRP)
50 AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP],${HAVE_DECL_S_IRGRP},
51 [Set to 1 if S_IRGRP is defined.])
53 #====================================================================================
54 # Check for support of the struct hack.
58 if test x$ac_cv_c99_flexible_array = xyes ; then
59 AC_DEFINE([HAVE_FLEXIBLE_ARRAY],1, [Set to 1 if the compile supports the struct hack.])
61 AC_MSG_WARN([[*** This compiler does not support the 1999 ISO C Standard ***]])
62 AC_MSG_WARN([[*** feature known as the flexible array struct member. ***]])
63 AC_DEFINE([HAVE_FLEXIBLE_ARRAY],0)
66 #====================================================================================
67 # Couple of initializations here. Fill in real values later.
71 #====================================================================================
72 # Finished checking, handle options.
74 AC_ARG_ENABLE(experimental,
75 AC_HELP_STRING([--enable-experimental], [enable experimental code]))
78 if test x$enable_experimental = xyes ; then
81 AC_DEFINE_UNQUOTED([ENABLE_EXPERIMENTAL_CODE],${EXPERIMENTAL_CODE}, [Set to 1 to enable experimental code.])
83 AC_ARG_ENABLE(gcc-werror,
84 AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]))
86 AC_ARG_ENABLE(gcc-pipe,
87 AC_HELP_STRING([--disable-gcc-pipe], [disable gcc -pipe option]))
89 AC_ARG_ENABLE(gcc-opt,
90 AC_HELP_STRING([--disable-gcc-opt], [disable gcc optimisations]))
92 AC_ARG_ENABLE(cpu-clip,
93 AC_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper]))
95 AC_ARG_ENABLE(bow-docs,
96 AC_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs]))
99 AC_HELP_STRING([--disable-sqlite], [disable use of sqlite]))
102 AC_HELP_STRING([--disable-flac], [disable use of FLAC]))
105 AC_HELP_STRING([--disable-alsa], [disable use of ALSA]))
107 #====================================================================================
108 # Check types and their sizes.
110 AC_CHECK_SIZEOF(short,2)
111 AC_CHECK_SIZEOF(int,4)
112 AC_CHECK_SIZEOF(long,4)
113 AC_CHECK_SIZEOF(float,4)
114 AC_CHECK_SIZEOF(double,4)
115 AC_CHECK_SIZEOF(void*,8)
116 AC_CHECK_SIZEOF(size_t,4)
117 AC_CHECK_SIZEOF(int64_t,8)
118 AC_CHECK_SIZEOF(long long,8)
120 #====================================================================================
121 # Find an appropriate type for sf_count_t.
122 # On systems supporting files larger than 2 Gig, sf_count_t must be a 64 bit value.
123 # Unfortunately there is more than one way of ensuring this so need to do some
124 # pretty rigourous testing here.
126 unset ac_cv_sizeof_off_t
128 AC_CHECK_SIZEOF(off_t,1) # Fake default value.
132 TYPEOF_SF_COUNT_T="__int64"
133 SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
137 if test "x$ac_cv_sizeof_off_t" = "x8" ; then
138 # If sizeof (off_t) is 8, no further checking is needed.
139 TYPEOF_SF_COUNT_T="off_t"
140 SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
143 # Check for common 64 bit file offset types.
144 AC_CHECK_SIZEOF(loff_t,1) # Fake default value.
145 AC_CHECK_SIZEOF(off64_t,1) # Fake default value.
147 TYPEOF_SF_COUNT_T="unknown"
148 if test "x$ac_cv_sizeof_loff_t" = "x8" ; then
149 TYPEOF_SF_COUNT_T="loff_t"
151 elif test "x$ac_cv_sizeof_off64_t" = "x8" ; then
152 TYPEOF_SF_COUNT_T="off64_t"
156 # Save the old sizeof (off_t) value and then unset it to see if it
157 # changes when Large File Support is enabled.
159 pre_largefile_sizeof_off_t=$ac_cv_sizeof_off_t
160 unset ac_cv_sizeof_off_t
162 AC_SYS_EXTRA_LARGEFILE
164 if test "x$ac_cv_sys_largefile_CFLAGS" = "xno" ; then
165 ac_cv_sys_largefile_CFLAGS=""
167 if test "x$ac_cv_sys_largefile_LDFLAGS" = "xno" ; then
168 ac_cv_sys_largefile_LDFLAGS=""
170 if test "x$ac_cv_sys_largefile_LIBS" = "xno" ; then
171 ac_cv_sys_largefile_LIBS=""
174 AC_CHECK_SIZEOF(off_t,1) # Fake default value.
176 if test "x$ac_cv_sizeof_off_t" = "x8" ; then
177 SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
178 elif test "x$ac_cv_sizeof_off_t" = "x$pre_largefile_sizeof_off_t" ; then
179 AC_MSG_WARN([[This machine does not seem to support 64 bit file offsets.]])
180 TYPEOF_SF_COUNT_T="off_t"
181 SIZEOF_SF_COUNT_T=$ac_cv_sizeof_off_t
182 elif test "x$TYPEOF_SF_COUNT_T" = "xunknown" ; then
184 echo "*** The configure process has determined that this system is capable"
185 echo "*** of Large File Support but has not been able to find a type which"
186 echo "*** is an unambiguous 64 bit file offset."
187 echo "*** Please contact the author to help resolve this problem."
189 AC_MSG_ERROR([[Bad file offset type.]])
195 if test $SIZEOF_SF_COUNT_T = 4 ; then
196 SF_COUNT_MAX="0x7FFFFFFF"
199 AC_DEFINE_UNQUOTED([TYPEOF_SF_COUNT_T],${TYPEOF_SF_COUNT_T}, [Set to long if unknown.])
200 AC_SUBST(TYPEOF_SF_COUNT_T)
202 AC_DEFINE_UNQUOTED([SIZEOF_SF_COUNT_T],${SIZEOF_SF_COUNT_T}, [Set to sizeof (long) if unknown.])
203 AC_SUBST(SIZEOF_SF_COUNT_T)
205 AC_DEFINE_UNQUOTED([SF_COUNT_MAX],${SF_COUNT_MAX}, [Set to maximum allowed value of sf_count_t type.])
206 AC_SUBST(SF_COUNT_MAX)
208 AC_CHECK_TYPES(ssize_t)
209 AC_CHECK_SIZEOF(ssize_t,4)
211 #====================================================================================
212 # Determine endian-ness of target processor.
216 AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
217 [Target processor is big endian.])
218 AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
219 [Target processor is little endian.])
221 #====================================================================================
222 # Check for functions.
224 AC_CHECK_FUNCS(malloc calloc realloc free)
225 AC_CHECK_FUNCS(open read write lseek pread pwrite)
226 AC_CHECK_FUNCS(fstat ftruncate fsync fdatasync)
227 AC_CHECK_FUNCS(snprintf vsnprintf)
228 AC_CHECK_FUNCS(gmtime gmtime_r)
229 AC_CHECK_FUNCS(mmap getpagesize)
230 AC_CHECK_FUNCS(setlocale)
232 AC_CHECK_LIB([m],floor)
233 AC_CHECK_FUNCS(floor ceil fmod)
237 AC_MSG_WARN([[Not using built-in lrint() and lrintf() because they are broken on Cygwin.]])
243 if test "x$ac_cv_c99_lrint" = "xno" ; then
244 if test "x$ac_cv_c99_lrintf" = "xno" ; then
245 AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
246 AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
252 #====================================================================================
253 # Check for libsqlite3 (only used in regtest).
256 if test x$enable_sqlite != xno ; then
257 PKG_CHECK_MODULES(SQLITE3, sqlite3 >= 3.2, ac_cv_sqlite3=yes, ac_cv_sqlite3=no)
260 if test x$ac_cv_sqlite3 = "xyes" ; then
266 AC_DEFINE_UNQUOTED([HAVE_SQLITE3],$HAVE_SQLITE3,[Set to 1 if you have libsqlite3.])
268 #====================================================================================
269 # Determine if the processor can do clipping on float to int conversions.
271 if test x$enable_cpu_clip != "xno" ; then
274 echo "checking processor clipping capabilities... disabled"
275 ac_cv_c_clip_positive=0
276 ac_cv_c_clip_negative=0
279 AC_DEFINE_UNQUOTED(CPU_CLIPS_POSITIVE, ${ac_cv_c_clip_positive},
280 [Target processor clips on positive float to int conversion.])
281 AC_DEFINE_UNQUOTED(CPU_CLIPS_NEGATIVE, ${ac_cv_c_clip_negative},
282 [Target processor clips on negative float to int conversion.])
284 #====================================================================================
285 # Target OS specific stuff.
287 OS_SPECIFIC_CFLAGS=""
296 OS_SPECIFIC_CFLAGS="-fpascal-strings -I/Developer/Headers/FlatCarbon"
297 OS_SPECIFIC_LINKS="-framework CoreAudio"
302 OS_SPECIFIC_LINKS="-lwinmm"
306 OS_SPECIFIC_LINKS="-lwinmm"
310 AC_DEFINE_UNQUOTED(OS_IS_WIN32, ${os_is_win32}, [Set to 1 if compiling for Win32])
311 AC_DEFINE_UNQUOTED(OS_IS_MACOSX, ${os_is_macosx}, [Set to 1 if compiling for MacOSX])
312 AC_DEFINE_UNQUOTED(USE_WINDOWS_API, ${use_windows_api}, [Set to 1 to use the native windows API])
314 #====================================================================================
319 if test x$enable_alsa != xno ; then
320 AC_CHECK_HEADERS(alsa/asoundlib.h)
321 if test x$ac_cv_header_alsa_asoundlib_h = xyes ; then
326 #====================================================================================
331 if test x$enable_flac != xno ; then
332 AC_CHECK_HEADERS(FLAC/all.h)
333 if test x$ac_cv_header_FLAC_all_h = xyes ; then
334 AC_CHECK_LIB(FLAC, FLAC__seekable_stream_encoder_set_tell_callback, HAVE_FLAC_1_1_1="yes")
335 if test "x$HAVE_FLAC_1_1_1" = xyes ; then
336 AC_DEFINE(HAVE_FLAC_1_1_1, [1], [Define to 1 if you have libflac 1.1.1])
342 #====================================================================================
343 # Test for sanity when cross-compiling.
345 if test x$cross_compiling = xyes ; then
346 AC_MSG_WARN([[******************************************************************]])
347 AC_MSG_WARN([[*** We are cross-compiling, so have to assume sizeof (short) == 2 ]])
348 AC_MSG_WARN([[*** and sizeof (int) == 4. If this is not the case there is no ]])
349 AC_MSG_WARN([[*** chance of this working. Please contact the mantainer. ]])
350 AC_MSG_WARN([[******************************************************************]])
353 if test $ac_cv_sizeof_short != 2 ; then
354 AC_MSG_WARN([[******************************************************************]])
355 AC_MSG_WARN([[*** sizeof (short) != 2. ]])
356 AC_MSG_WARN([[******************************************************************]])
359 if test $ac_cv_sizeof_int != 4 ; then
360 AC_MSG_WARN([[******************************************************************]])
361 AC_MSG_WARN([[*** sizeof (int) != 4 ]])
362 AC_MSG_WARN([[******************************************************************]])
365 if test $ac_cv_sizeof_float != 4 ; then
366 AC_MSG_WARN([[******************************************************************]])
367 AC_MSG_WARN([[*** sizeof (float) != 4. ]])
368 AC_MSG_WARN([[******************************************************************]])
371 if test $ac_cv_sizeof_double != 8 ; then
372 AC_MSG_WARN([[******************************************************************]])
373 AC_MSG_WARN([[*** sizeof (double) != 8. ]])
374 AC_MSG_WARN([[******************************************************************]])
377 if test x"$ac_cv_prog_autogen" = "xno" ; then
378 AC_MSG_WARN([[Touching files in directory tests/.]])
379 touch tests/*.c tests/*.h
382 #====================================================================================
383 # Settings for the HTML documentation.
385 htmldocdir=$prefix/share/doc/libsndfile1-dev/html
387 if test $prefix = "NONE" ; then
388 htmldocdir=/usr/local/share/doc/libsndfile1-dev/html
390 htmldocdir=$prefix/share/doc/libsndfile1-dev/html
393 if test x$enable_bow_docs = "xyes" ; then
394 HTML_BGCOLOUR="white"
395 HTML_FGCOLOUR="black"
397 HTML_BGCOLOUR="black"
398 HTML_FGCOLOUR="white"
401 #====================================================================================
402 # Now use the information from the checking stage.
404 if test x$ac_cv_c_compiler_gnu = xyes ; then
405 AC_ADD_CFLAGS(-std=gnu99)
407 CFLAGS="$CFLAGS -W -Wall"
409 AC_ADD_CFLAGS(-Wdeclaration-after-statement)
411 if test x$enable_gcc_werror = "xyes" ; then
412 CFLAGS="-Werror $CFLAGS"
415 CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast -Wwrite-strings"
416 # -Wpointer-arith -Wundef -Wmissing-declarations -Winline -Wconversion"
418 if test "x$enable_gcc_opt" = "xno" ; then
419 temp_CFLAGS=`echo $CFLAGS | sed "s/O2/O0/"`
421 AC_MSG_WARN([[*** Compiler optimisations switched off. ***]])
424 # OS specific tweaks.
427 # Disable -Wall, -pedantic and -Wshadow for Apple Darwin/Rhapsody.
428 # System headers on these systems are broken.
429 temp_CFLAGS=`echo $CFLAGS | sed "s/-Wall -pedantic//" | sed "s/-Wshadow//" | sed "s/-Waggregate-return//"`
431 SHLIB_VERSION_ARG="-Wl,-exported_symbols_list -Wl,\$(srcdir)/Symbols.darwin"
434 SHLIB_VERSION_ARG="-Wl,--version-script=\$(srcdir)/Symbols.linux"
437 SHLIB_VERSION_ARG="-Wl,\$(srcdir)/libsndfile.def"
440 SHLIB_VERSION_ARG="-Wl,\$(srcdir)/cygsndfile.def"
445 if test x$enable_gcc_pipe != "xno" ; then
446 CFLAGS="$CFLAGS -pipe"
449 AC_DEFINE([COMPILER_IS_GCC],1, [Set to 1 if the compile is GNU GCC.])
450 GCC_MAJOR_VERSION=`$CC -dumpversion | sed "s/\..*//"`
451 AC_DEFINE_UNQUOTED([GCC_MAJOR_VERSION],${GCC_MAJOR_VERSION}, [Major version of GCC or 3 otherwise.])
454 CFLAGS="$CFLAGS $OS_SPECIFIC_CFLAGS"
456 if test x"$CFLAGS" = x ; then
457 echo "Error in configure script. CFLAGS has been screwed up."
462 AC_SUBST(HTML_BGCOLOUR)
463 AC_SUBST(HTML_FGCOLOUR)
465 AC_SUBST(SHLIB_VERSION_ARG)
466 AC_SUBST(SHARED_VERSION_INFO)
467 AC_SUBST(OS_SPECIFIC_CFLAGS)
468 AC_SUBST(OS_SPECIFIC_LINKS)
471 AC_SUBST(ENABLE_EXPERIMENTAL_CODE)
473 AC_SUBST(COMPILER_IS_GCC)
474 AC_SUBST(GCC_MAJOR_VERSION)
476 dnl The following line causes the libtool distributed with the source
477 dnl to be replaced if the build system has a more recent version.
478 AC_SUBST(LIBTOOL_DEPS)
486 #====================================================================================
489 -=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
491 Configuration summary :
493 Version : ..................... ${VERSION}
494 Experimental code : ........... ${enable_experimental:-no}
497 if test x$ac_cv_c_compiler_gnu = xyes ; then
499 echo " Compiler is GCC : ............. ${ac_cv_c_compiler_gnu}"
500 echo " GCC major version : ........... ${GCC_MAJOR_VERSION}"
501 if test $GCC_MAJOR_VERSION -lt 3 ; then
502 echo -e "\n ** This compiler version allows applications to write"
503 echo " ** to static strings within the library."
504 echo " ** Compile with GCC version 3.X to avoid this problem."
508 if test $libdir = "\${exec_prefix}/lib" ; then
512 if test $bindir = "\${exec_prefix}/bin" ; then
517 Installation directories :
519 Library directory : ........... $libdir
520 Program directory : ........... $bindir
521 Pkgconfig directory : ......... $libdir/pkgconfig
522 HTML docs directory : ......... $htmldocdir
525 if test x$prefix != "x/usr" ; then
526 echo "Compiling some other packages against libsndfile may require"
527 echo -e "the addition of \"$libdir/pkgconfig\" to the"
528 echo -e "PKG_CONFIG_PATH environment variable.\n"
531 #====================================================================================
535 Do not edit or modify anything in this comment block.
536 The arch-tag line is a file identity tag for the GNU Arch
537 revision control system.
539 arch-tag: 6391b316-6cfc-43c2-a18a-8defdc4ee359