2008-04-01 10:28:59 +00:00
# Copyright (C) 1999-2008 Erik de Castro Lopo (erikd AT mega-nerd DOT com).
2007-05-14 09:55:24 +00:00
dnl Require autoconf version
2007-05-13 10:51:01 +00:00
AC_PREREQ(2.57)
2007-05-14 09:55:24 +00:00
2007-12-03 09:17:10 +00:00
AC_INIT([libsndfile],[1.0.18pre20],[erikd@mega-nerd.com])
2007-10-15 10:09:49 +00:00
# Put config stuff in Cfg.
AC_CONFIG_AUX_DIR(Cfg)
2007-05-14 09:55:24 +00:00
AC_CONFIG_SRCDIR([src/sndfile.c])
AC_CANONICAL_TARGET([])
2004-11-15 22:29:27 +00:00
2007-05-14 09:55:24 +00:00
AM_INIT_AUTOMAKE($PACKAGE_NAME,$PACKAGE_VERSION)
2006-04-18 09:43:20 +00:00
AC_CONFIG_HEADERS([src/config.h])
2007-08-23 05:59:59 +00:00
dnl Add parameters for aclocal
AC_SUBST(ACLOCAL_AMFLAGS, "-I M4")
2006-04-18 09:43:20 +00:00
AC_LANG([C])
2007-05-14 09:55:24 +00:00
#------------------------------------------------------------------------------------
# Rules for library version information:
#
# 1. Start with version information of `0:0:0' for each libtool library.
# 2. Update the version information only immediately before a public release of
# your software. More frequent updates are unnecessary, and only guarantee
# that the current interface number gets larger faster.
# 3. If the library source code has changed at all since the last update, then
# increment revision (`c:r:a' becomes `c:r+1:a').
# 4. If any interfaces have been added, removed, or changed since the last update,
# increment current, and set revision to 0.
# 5. If any interfaces have been added since the last public release, then increment
# age.
# 6. If any interfaces have been removed since the last public release, then set age
# to 0.
2006-09-02 08:36:00 +00:00
SHARED_VERSION_INFO="1:18:0"
2007-05-14 09:55:24 +00:00
2004-10-06 08:42:42 +00:00
AC_PROG_CC
2007-11-16 10:16:56 +00:00
AC_PROG_CXX
2004-10-06 08:42:42 +00:00
AM_PROG_LIBTOOL
2007-08-23 04:42:06 +00:00
AC_CHECK_PROG(HAVE_AUTOGEN, autogen, yes, no)
2008-03-30 12:28:25 +00:00
AC_CHECK_PROG(HAVE_WINE, wine, yes, no)
2007-05-14 09:55:24 +00:00
AC_PROG_INSTALL
AC_PROG_LN_S
2004-05-14 13:52:30 +00:00
2007-05-14 09:55:24 +00:00
AC_HEADER_STDC
AC_CHECK_HEADERS(endian.h)
2004-07-17 12:26:33 +00:00
AC_CHECK_HEADERS(byteswap.h)
2005-09-20 02:03:43 +00:00
AC_CHECK_HEADERS(locale.h)
2006-01-05 10:31:29 +00:00
2007-05-14 09:55:24 +00:00
AC_HEADER_SYS_WAIT
AC_CHECK_DECLS(S_IRGRP)
2006-06-04 12:23:54 +00:00
if test x$ac_cv_have_decl_S_IRGRP = xyes ; then
AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP],1,[Set to 1 if S_IRGRP is defined.])
else
AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP],0)
fi
2004-03-15 09:21:04 +00:00
2008-03-30 12:28:25 +00:00
AM_CONDITIONAL([LINUX_MINGW_CROSS_TEST],
[test "$build_os:$target_os:$host_os:$HAVE_WINE" = "linux-gnu:mingw32msvc:mingw32msvc:yes"])
2004-03-15 09:21:04 +00:00
#====================================================================================
# Check for support of the struct hack.
2004-04-02 11:19:35 +00:00
AC_C99_FLEXIBLE_ARRAY
2004-03-15 09:21:04 +00:00
2004-04-30 14:40:08 +00:00
if test x$ac_cv_c99_flexible_array = xyes ; then
AC_DEFINE([HAVE_FLEXIBLE_ARRAY],1, [Set to 1 if the compile supports the struct hack.])
else
2004-05-27 04:29:38 +00:00
AC_MSG_WARN([[*** This compiler does not support the 1999 ISO C Standard ***]])
AC_MSG_WARN([[*** feature known as the flexible array struct member. ***]])
2004-04-30 14:40:08 +00:00
AC_DEFINE([HAVE_FLEXIBLE_ARRAY],0)
2004-03-15 09:21:04 +00:00
fi
2007-05-14 09:55:24 +00:00
#====================================================================================
# Couple of initializations here. Fill in real values later.
SHLIB_VERSION_ARG=""
#====================================================================================
# Finished checking, handle options.
AC_ARG_ENABLE(experimental,
2006-03-26 05:36:38 +00:00
AC_HELP_STRING([--enable-experimental], [enable experimental code]))
2007-05-14 09:55:24 +00:00
EXPERIMENTAL_CODE=0
2006-03-26 05:36:38 +00:00
if test x$enable_experimental = xyes ; then
2007-05-14 09:55:24 +00:00
EXPERIMENTAL_CODE=1
fi
AC_DEFINE_UNQUOTED([ENABLE_EXPERIMENTAL_CODE],${EXPERIMENTAL_CODE}, [Set to 1 to enable experimental code.])
2004-02-25 09:01:53 +00:00
AC_ARG_ENABLE(gcc-werror,
2006-03-26 05:36:38 +00:00
AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]))
2004-02-25 09:01:53 +00:00
2004-03-03 12:11:18 +00:00
AC_ARG_ENABLE(gcc-pipe,
2006-03-26 05:36:38 +00:00
AC_HELP_STRING([--disable-gcc-pipe], [disable gcc -pipe option]))
2007-05-14 09:55:24 +00:00
2004-03-03 12:11:18 +00:00
AC_ARG_ENABLE(gcc-opt,
2006-03-26 05:36:38 +00:00
AC_HELP_STRING([--disable-gcc-opt], [disable gcc optimisations]))
2007-05-14 09:55:24 +00:00
2004-03-03 12:11:18 +00:00
AC_ARG_ENABLE(cpu-clip,
2006-03-26 05:36:38 +00:00
AC_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper]))
2007-05-14 09:55:24 +00:00
2004-04-25 13:33:04 +00:00
AC_ARG_ENABLE(bow-docs,
2006-03-26 05:36:38 +00:00
AC_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs]))
2004-04-25 13:33:04 +00:00
2005-06-20 07:01:43 +00:00
AC_ARG_ENABLE(sqlite,
2006-03-26 05:36:38 +00:00
AC_HELP_STRING([--disable-sqlite], [disable use of sqlite]))
2005-06-20 07:01:43 +00:00
2005-10-07 13:27:53 +00:00
AC_ARG_ENABLE(alsa,
2006-03-26 05:36:38 +00:00
AC_HELP_STRING([--disable-alsa], [disable use of ALSA]))
2005-10-07 13:27:53 +00:00
2006-10-15 11:05:45 +00:00
AC_ARG_ENABLE(test-coverage,
AC_HELP_STRING([--enable-test-coverage], [enable test coverage]))
AM_CONDITIONAL([ENABLE_TEST_COVERAGE], [test "$enable_test_coverage" = yes])
2007-05-14 09:55:24 +00:00
#====================================================================================
# Check types and their sizes.
AC_CHECK_SIZEOF(short,2)
AC_CHECK_SIZEOF(int,4)
AC_CHECK_SIZEOF(long,4)
AC_CHECK_SIZEOF(float,4)
AC_CHECK_SIZEOF(double,4)
AC_CHECK_SIZEOF(void*,8)
AC_CHECK_SIZEOF(size_t,4)
2004-07-19 10:12:09 +00:00
AC_CHECK_SIZEOF(int64_t,8)
2004-10-14 00:17:05 +00:00
AC_CHECK_SIZEOF(long long,8)
2007-05-14 09:55:24 +00:00
#====================================================================================
# Find an appropriate type for sf_count_t.
# On systems supporting files larger than 2 Gig, sf_count_t must be a 64 bit value.
# Unfortunately there is more than one way of ensuring this so need to do some
# pretty rigourous testing here.
unset ac_cv_sizeof_off_t
AC_CHECK_SIZEOF(off_t,1) # Fake default value.
2005-08-16 11:13:32 +00:00
case "$host_os" in
2005-09-05 08:32:59 +00:00
mingw*)
2004-03-04 22:02:43 +00:00
TYPEOF_SF_COUNT_T="__int64"
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
SIZEOF_SF_COUNT_T=8
2004-04-20 12:17:38 +00:00
;;
*)
if test "x$ac_cv_sizeof_off_t" = "x8" ; then
# If sizeof (off_t) is 8, no further checking is needed.
TYPEOF_SF_COUNT_T="off_t"
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
SIZEOF_SF_COUNT_T=8
else
# Check for common 64 bit file offset types.
AC_CHECK_SIZEOF(loff_t,1) # Fake default value.
AC_CHECK_SIZEOF(off64_t,1) # Fake default value.
2005-09-23 10:02:20 +00:00
2004-04-20 12:17:38 +00:00
TYPEOF_SF_COUNT_T="unknown"
if test "x$ac_cv_sizeof_loff_t" = "x8" ; then
TYPEOF_SF_COUNT_T="loff_t"
SIZEOF_SF_COUNT_T=8
elif test "x$ac_cv_sizeof_off64_t" = "x8" ; then
TYPEOF_SF_COUNT_T="off64_t"
SIZEOF_SF_COUNT_T=8
fi
2005-09-23 10:02:20 +00:00
2004-04-20 12:17:38 +00:00
# Save the old sizeof (off_t) value and then unset it to see if it
# changes when Large File Support is enabled.
2005-09-23 10:02:20 +00:00
2004-04-20 12:17:38 +00:00
pre_largefile_sizeof_off_t=$ac_cv_sizeof_off_t
unset ac_cv_sizeof_off_t
2005-09-23 10:02:20 +00:00
2004-04-20 12:17:38 +00:00
AC_SYS_EXTRA_LARGEFILE
2005-09-23 10:02:20 +00:00
2004-04-20 12:17:38 +00:00
if test "x$ac_cv_sys_largefile_CFLAGS" = "xno" ; then
ac_cv_sys_largefile_CFLAGS=""
fi
if test "x$ac_cv_sys_largefile_LDFLAGS" = "xno" ; then
ac_cv_sys_largefile_LDFLAGS=""
fi
if test "x$ac_cv_sys_largefile_LIBS" = "xno" ; then
ac_cv_sys_largefile_LIBS=""
fi
2005-09-23 10:02:20 +00:00
2004-04-20 12:17:38 +00:00
AC_CHECK_SIZEOF(off_t,1) # Fake default value.
2005-09-23 10:02:20 +00:00
2004-04-20 12:17:38 +00:00
if test "x$ac_cv_sizeof_off_t" = "x8" ; then
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
elif test "x$ac_cv_sizeof_off_t" = "x$pre_largefile_sizeof_off_t" ; then
AC_MSG_WARN([[This machine does not seem to support 64 bit file offsets.]])
TYPEOF_SF_COUNT_T="off_t"
SIZEOF_SF_COUNT_T=$ac_cv_sizeof_off_t
elif test "x$TYPEOF_SF_COUNT_T" = "xunknown" ; then
echo
echo "*** The configure process has determined that this system is capable"
echo "*** of Large File Support but has not been able to find a type which"
echo "*** is an unambiguous 64 bit file offset."
echo "*** Please contact the author to help resolve this problem."
echo
AC_MSG_ERROR([[Bad file offset type.]])
fi
fi
;;
esac
2007-05-14 09:55:24 +00:00
2004-03-04 22:02:43 +00:00
if test $SIZEOF_SF_COUNT_T = 4 ; then
2007-05-14 09:55:24 +00:00
SF_COUNT_MAX="0x7FFFFFFF"
fi
AC_DEFINE_UNQUOTED([TYPEOF_SF_COUNT_T],${TYPEOF_SF_COUNT_T}, [Set to long if unknown.])
AC_SUBST(TYPEOF_SF_COUNT_T)
AC_DEFINE_UNQUOTED([SIZEOF_SF_COUNT_T],${SIZEOF_SF_COUNT_T}, [Set to sizeof (long) if unknown.])
AC_SUBST(SIZEOF_SF_COUNT_T)
AC_DEFINE_UNQUOTED([SF_COUNT_MAX],${SF_COUNT_MAX}, [Set to maximum allowed value of sf_count_t type.])
AC_SUBST(SF_COUNT_MAX)
2004-03-04 22:02:43 +00:00
AC_CHECK_TYPES(ssize_t)
2007-05-14 09:55:24 +00:00
AC_CHECK_SIZEOF(ssize_t,4)
#====================================================================================
# Determine endian-ness of target processor.
AC_C_FIND_ENDIAN
AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
[Target processor is big endian.])
AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
[Target processor is little endian.])
2007-05-12 02:28:08 +00:00
AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, ${ac_cv_c_big_endian},
[Target processor is big endian.])
2007-05-14 09:55:24 +00:00
#====================================================================================
2004-01-21 07:46:34 +00:00
# Check for functions.
2007-05-14 09:55:24 +00:00
2004-01-21 07:46:34 +00:00
AC_CHECK_FUNCS(malloc calloc realloc free)
AC_CHECK_FUNCS(open read write lseek pread pwrite)
2006-05-08 21:20:12 +00:00
AC_CHECK_FUNCS(fstat ftruncate fsync)
2004-01-21 07:46:34 +00:00
AC_CHECK_FUNCS(snprintf vsnprintf)
AC_CHECK_FUNCS(gmtime gmtime_r)
AC_CHECK_FUNCS(mmap getpagesize)
2005-09-20 02:03:43 +00:00
AC_CHECK_FUNCS(setlocale)
2007-05-14 09:55:24 +00:00
2004-01-21 07:46:34 +00:00
AC_CHECK_LIB([m],floor)
AC_CHECK_FUNCS(floor ceil fmod)
2007-05-14 09:55:24 +00:00
2005-08-16 11:13:32 +00:00
case "$host_os" in
2005-09-05 08:32:59 +00:00
cygwin*)
2005-09-17 07:22:05 +00:00
AC_MSG_WARN([[Not using built-in lrint() and lrintf() because they are broken on Cygwin.]])
2007-05-14 09:55:24 +00:00
;;
2004-01-21 07:46:34 +00:00
*)
AC_C99_FUNC_LRINT
AC_C99_FUNC_LRINTF
2007-05-14 09:55:24 +00:00
2004-03-04 22:02:43 +00:00
if test "x$ac_cv_c99_lrint" = "xno" ; then
if test "x$ac_cv_c99_lrintf" = "xno" ; then
AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
fi
2004-01-21 07:46:34 +00:00
fi
;;
2007-05-14 09:55:24 +00:00
esac
2007-08-23 11:16:57 +00:00
#====================================================================================
# Check for requirements for building plugins for other languages/enviroments.
2008-04-01 10:28:59 +00:00
dnl Octave maths environment http://www.octave.org/
if test x$cross_compiling = xno ; then
AC_OCTAVE_BUILD
else
AM_CONDITIONAL(BUILD_OCTAVE_MOD, false)
fi
2007-08-23 11:16:57 +00:00
2005-05-17 12:47:23 +00:00
#====================================================================================
# Check for libsqlite3 (only used in regtest).
2005-09-05 08:32:59 +00:00
ac_cv_sqlite3=no
2006-03-26 05:36:38 +00:00
if test x$enable_sqlite != xno ; then
2005-09-05 08:32:59 +00:00
PKG_CHECK_MODULES(SQLITE3, sqlite3 >= 3.2, ac_cv_sqlite3=yes, ac_cv_sqlite3=no)
2005-06-20 07:01:43 +00:00
fi
2005-05-17 12:47:23 +00:00
2005-09-05 08:32:59 +00:00
if test x$ac_cv_sqlite3 = "xyes" ; then
2005-05-17 12:47:23 +00:00
HAVE_SQLITE3=1
else
HAVE_SQLITE3=0
fi
2005-09-05 08:32:59 +00:00
AC_DEFINE_UNQUOTED([HAVE_SQLITE3],$HAVE_SQLITE3,[Set to 1 if you have libsqlite3.])
2007-11-23 23:00:29 +00:00
#====================================================================================
# Check for JACK (only used for examples/sndfile-jackplay).
PKG_CHECK_MODULES(JACK, jack >= 0.100, ac_cv_jack=yes, ac_cv_jack=no)
if test x$ac_cv_jack = "xyes" ; then
HAVE_JACK=1
else
HAVE_JACK=0
fi
AC_DEFINE_UNQUOTED([HAVE_JACK],$HAVE_JACK,[Set to 1 if you have JACK.])
2004-02-25 05:31:46 +00:00
#====================================================================================
# Determine if the processor can do clipping on float to int conversions.
2006-03-26 05:36:38 +00:00
if test x$enable_cpu_clip != "xno" ; then
2004-02-25 05:31:46 +00:00
AC_C_CLIP_MODE
else
echo "checking processor clipping capabilities... disabled"
ac_cv_c_clip_positive=0
ac_cv_c_clip_negative=0
fi
AC_DEFINE_UNQUOTED(CPU_CLIPS_POSITIVE, ${ac_cv_c_clip_positive},
[Target processor clips on positive float to int conversion.])
AC_DEFINE_UNQUOTED(CPU_CLIPS_NEGATIVE, ${ac_cv_c_clip_negative},
[Target processor clips on negative float to int conversion.])
2006-10-30 21:38:04 +00:00
#====================================================================================
# FLAC defines.
2007-04-30 12:29:23 +00:00
AC_DEFINE(FLAC__HAS_OGG, 1, [This is always true.])
2006-10-30 21:38:04 +00:00
case "$host_cpu" in
i*86)
cpu_ia32=true
AC_DEFINE(FLAC__CPU_IA32)
AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
;;
powerpc)
cpu_ppc=true
AC_DEFINE(FLAC__CPU_PPC)
AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
;;
sparc)
cpu_sparc=true
AC_DEFINE(FLAC__CPU_SPARC)
AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC])
;;
esac
AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
AM_CONDITIONAL(FLaC__CPU_PPC, test "x$cpu_ppc" = xtrue)
AM_CONDITIONAL(FLaC__CPU_SPARC, test "x$cpu_sparc" = xtrue)
case "$host" in
*-pc-linux-gnu)
sys_linux=true
AC_DEFINE(FLAC__SYS_LINUX)
AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
;;
*-*-darwin*)
sys_darwin=true
AC_DEFINE(FLAC__SYS_DARWIN)
AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
;;
esac
AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue)
AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue)
AC_ARG_ENABLE(asm-optimizations, AC_HELP_STRING([--disable-asm-optimizations], [Don't use any assembly optimization routines]), asm_opt=no, asm_opt=yes)
AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno)
if test "x$asm_opt" = xno ; then
AC_DEFINE(FLAC__NO_ASM)
AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
fi
AC_CHECK_PROGS(NASM, nasm)
AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
if test -n "$NASM" ; then
AC_DEFINE(FLAC__HAS_NASM)
AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
fi
2006-11-19 01:25:05 +00:00
# Only matters for PowerPC
2006-10-30 21:38:04 +00:00
AC_CHECK_PROGS(AS, as, as)
AC_CHECK_PROGS(GAS, gas, gas)
AM_CONDITIONAL(FLaC__HAS_AS, test "$AS" = "as")
AM_CONDITIONAL(FLaC__HAS_GAS, test "$AS" = "gas")
if test "$AS" = "as" ; then
AC_DEFINE(FLAC__HAS_AS)
AH_TEMPLATE(FLAC__HAS_AS, [define if you are compiling for PowerPC and have the 'as' assembler])
fi
if test "$AS" = "gas" ; then
# funniest. macro. ever.
AC_DEFINE(FLAC__HAS_GAS)
AH_TEMPLATE(FLAC__HAS_GAS, [define if you are compiling for PowerPC and have the 'gas' assembler])
fi
case "$host" in
2007-06-07 11:03:03 +00:00
i386-*-openbsd3.[[0-3]])
OBJ_FORMAT=aoutb
;;
*-*-cygwin|*mingw*)
OBJ_FORMAT=win32
;;
i*86-apple-darwin*)
OBJ_FORMAT=macho
NASM_FLAGS="-DFLAC__PUBLIC_NEEDS_UNDERSCORE"
OS_SPECIFIC_LIBLINKS="-Wl,-read_only_relocs -Wl,suppress"
;;
*)
OBJ_FORMAT=elf ;;
2006-10-30 21:38:04 +00:00
esac
AC_SUBST(OBJ_FORMAT)
2007-06-07 11:03:03 +00:00
AC_SUBST(NASM_FLAGS)
AC_SUBST(OS_SPECIFIC_LIBLINKS)
2006-10-30 21:38:04 +00:00
2007-05-14 09:55:24 +00:00
#====================================================================================
# Target OS specific stuff.
2004-02-19 11:49:34 +00:00
OS_SPECIFIC_CFLAGS=""
2004-03-04 22:02:43 +00:00
OS_SPECIFIC_LINKS=""
2007-05-14 09:55:24 +00:00
os_is_win32=0
os_is_macosx=0
2005-09-17 07:22:05 +00:00
use_windows_api=0
2007-05-14 09:55:24 +00:00
2005-08-16 11:13:32 +00:00
case "$host_os" in
2007-05-14 09:55:24 +00:00
darwin* | rhapsody*)
os_is_macosx=1
2004-02-19 11:49:34 +00:00
OS_SPECIFIC_CFLAGS="-fpascal-strings -I/Developer/Headers/FlatCarbon"
2007-05-14 09:55:24 +00:00
OS_SPECIFIC_LINKS="-framework CoreAudio"
;;
2005-09-17 07:22:05 +00:00
mingw*)
os_is_win32=1
use_windows_api=1
OS_SPECIFIC_LINKS="-lwinmm"
;;
cygwin*)
2007-05-14 09:55:24 +00:00
os_is_win32=1
2004-06-15 01:29:48 +00:00
OS_SPECIFIC_LINKS="-lwinmm"
2007-05-14 09:55:24 +00:00
;;
esac
AC_DEFINE_UNQUOTED(OS_IS_WIN32, ${os_is_win32}, [Set to 1 if compiling for Win32])
AC_DEFINE_UNQUOTED(OS_IS_MACOSX, ${os_is_macosx}, [Set to 1 if compiling for MacOSX])
2005-09-17 07:22:05 +00:00
AC_DEFINE_UNQUOTED(USE_WINDOWS_API, ${use_windows_api}, [Set to 1 to use the native windows API])
2007-05-14 09:55:24 +00:00
2004-03-17 08:49:55 +00:00
#====================================================================================
# Check for ALSA.
ALSA_LIBS=""
2006-03-26 05:36:38 +00:00
if test x$enable_alsa != xno ; then
2005-10-07 13:27:53 +00:00
AC_CHECK_HEADERS(alsa/asoundlib.h)
if test x$ac_cv_header_alsa_asoundlib_h = xyes ; then
ALSA_LIBS="-lasound"
fi
2004-03-17 08:49:55 +00:00
fi
2007-05-14 09:55:24 +00:00
#====================================================================================
# Test for sanity when cross-compiling.
2004-03-10 08:52:38 +00:00
if test x$cross_compiling = xyes ; then
2007-05-14 09:55:24 +00:00
AC_MSG_WARN([[******************************************************************]])
AC_MSG_WARN([[*** We are cross-compiling, so have to assume sizeof (short) == 2 ]])
AC_MSG_WARN([[*** and sizeof (int) == 4. If this is not the case there is no ]])
AC_MSG_WARN([[*** chance of this working. Please contact the mantainer. ]])
AC_MSG_WARN([[******************************************************************]])
fi
if test $ac_cv_sizeof_short != 2 ; then
AC_MSG_WARN([[******************************************************************]])
AC_MSG_WARN([[*** sizeof (short) != 2. ]])
AC_MSG_WARN([[******************************************************************]])
fi
if test $ac_cv_sizeof_int != 4 ; then
AC_MSG_WARN([[******************************************************************]])
AC_MSG_WARN([[*** sizeof (int) != 4 ]])
AC_MSG_WARN([[******************************************************************]])
fi
if test $ac_cv_sizeof_float != 4 ; then
AC_MSG_WARN([[******************************************************************]])
AC_MSG_WARN([[*** sizeof (float) != 4. ]])
AC_MSG_WARN([[******************************************************************]])
fi
if test $ac_cv_sizeof_double != 8 ; then
AC_MSG_WARN([[******************************************************************]])
AC_MSG_WARN([[*** sizeof (double) != 8. ]])
AC_MSG_WARN([[******************************************************************]])
fi
2007-08-23 04:42:06 +00:00
if test x"$ac_cv_prog_HAVE_AUTOGEN" = "xno" ; then
2007-05-14 09:55:24 +00:00
AC_MSG_WARN([[Touching files in directory tests/.]])
2004-03-03 12:11:18 +00:00
touch tests/*.c tests/*.h
2007-05-14 09:55:24 +00:00
fi
2004-04-25 13:33:04 +00:00
#====================================================================================
# Settings for the HTML documentation.
htmldocdir=$prefix/share/doc/libsndfile1-dev/html
if test $prefix = "NONE" ; then
htmldocdir=/usr/local/share/doc/libsndfile1-dev/html
else
htmldocdir=$prefix/share/doc/libsndfile1-dev/html
fi
2006-03-26 05:36:38 +00:00
if test x$enable_bow_docs = "xyes" ; then
2004-04-25 13:33:04 +00:00
HTML_BGCOLOUR="white"
HTML_FGCOLOUR="black"
else
HTML_BGCOLOUR="black"
HTML_FGCOLOUR="white"
fi
2007-05-14 09:55:24 +00:00
#====================================================================================
# Now use the information from the checking stage.
2007-04-23 08:23:05 +00:00
win32_target_dll=0
2007-11-23 23:00:29 +00:00
COMPILER_IS_GCC=0
2007-04-23 08:23:05 +00:00
2004-02-25 09:01:53 +00:00
if test x$ac_cv_c_compiler_gnu = xyes ; then
2005-09-24 07:11:19 +00:00
AC_ADD_CFLAGS(-std=gnu99)
2007-11-05 04:18:42 +00:00
AC_GCC_VERSION
if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then
AC_MSG_WARN([****************************************************************])
AC_MSG_WARN([** GCC version 4.2 warns about the inline keyword for no good **])
AC_MSG_WARN([** reason but the maintainers do not see it as a bug. **])
AC_MSG_WARN([** See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33995 **])
2007-11-17 09:43:40 +00:00
AC_MSG_WARN([** Using -fgnu-inline to avoid this stupidity. **])
2007-11-05 04:18:42 +00:00
AC_MSG_WARN([****************************************************************])
AC_ADD_CFLAGS([-fgnu89-inline])
fi
2005-09-23 10:02:20 +00:00
CFLAGS="$CFLAGS -W -Wall"
2006-07-27 10:38:01 +00:00
CXXFLAGS="$CXXFLAGS -W -Wall"
2005-09-24 01:45:43 +00:00
2006-10-15 11:05:45 +00:00
AC_ADD_CFLAGS([-Wdeclaration-after-statement])
AC_ADD_CFLAGS([-Wpointer-arith])
2005-09-24 01:45:43 +00:00
2006-03-26 05:36:38 +00:00
if test x$enable_gcc_werror = "xyes" ; then
2005-09-23 10:02:20 +00:00
CFLAGS="-Werror $CFLAGS"
2006-07-27 10:38:01 +00:00
CXXFLAGS="-Werror $CXXFLAGS"
2005-09-23 10:02:20 +00:00
fi
2006-10-15 11:05:45 +00:00
if test x$enable_test_coverage = "xyes" ; then
# AC_ADD_CFLAGS([-ftest-coverage])
AC_ADD_CFLAGS([-coverage])
fi
2006-07-27 10:38:01 +00:00
CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast -Wwrite-strings "
# -Wundef -Wmissing-declarations -Winline -Wconversion"
CXXFLAGS="$CXXFLAGS -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreorder -Wsign-promo "
2005-09-23 10:02:20 +00:00
2006-03-26 05:36:38 +00:00
if test "x$enable_gcc_opt" = "xno" ; then
2004-02-25 09:01:53 +00:00
temp_CFLAGS=`echo $CFLAGS | sed "s/O2/O0/"`
CFLAGS=$temp_CFLAGS
AC_MSG_WARN([[*** Compiler optimisations switched off. ***]])
fi
# OS specific tweaks.
2005-08-16 11:13:32 +00:00
case "$host_os" in
2004-02-25 09:01:53 +00:00
darwin* | rhapsody*)
# Disable -Wall, -pedantic and -Wshadow for Apple Darwin/Rhapsody.
# System headers on these systems are broken.
temp_CFLAGS=`echo $CFLAGS | sed "s/-Wall -pedantic//" | sed "s/-Wshadow//" | sed "s/-Waggregate-return//"`
CFLAGS=$temp_CFLAGS
2004-02-28 20:20:06 +00:00
SHLIB_VERSION_ARG="-Wl,-exported_symbols_list -Wl,\$(srcdir)/Symbols.darwin"
2004-02-25 09:01:53 +00:00
;;
linux*)
2004-02-28 20:20:06 +00:00
SHLIB_VERSION_ARG="-Wl,--version-script=\$(srcdir)/Symbols.linux"
2004-02-25 09:01:53 +00:00
;;
2006-03-08 22:49:20 +00:00
mingw*)
2006-03-08 08:05:56 +00:00
SHLIB_VERSION_ARG="-Wl,\$(srcdir)/libsndfile.def"
2007-04-23 08:23:05 +00:00
win32_target_dll=1
if test x"$enable_shared" = xno ; then
win32_target_dll=0
fi
2006-03-08 08:05:56 +00:00
;;
2006-03-08 22:49:20 +00:00
cygwin*)
SHLIB_VERSION_ARG="-Wl,\$(srcdir)/cygsndfile.def"
2007-04-23 08:23:05 +00:00
win32_target_dll=1
if test x"$enable_shared" = xno ; then
win32_target_dll=0
fi
2006-03-08 22:49:20 +00:00
;;
2007-11-16 10:16:56 +00:00
os2*)
SHLIB_VERSION_ARG="-Wl,-export-symbols \$(srcdir)/Symbols.os2"
;;
2004-02-25 09:01:53 +00:00
*)
;;
esac
2006-03-26 05:36:38 +00:00
if test x$enable_gcc_pipe != "xno" ; then
2004-02-25 09:01:53 +00:00
CFLAGS="$CFLAGS -pipe"
fi
2007-11-23 23:00:29 +00:00
COMPILER_IS_GCC=1
2004-02-25 09:01:53 +00:00
fi
2007-11-23 23:00:29 +00:00
AC_DEFINE_UNQUOTED([WIN32_TARGET_DLL], ${win32_target_dll}, [Set to 1 if windows DLL is being built.])
AC_DEFINE_UNQUOTED([COMPILER_IS_GCC], ${COMPILER_IS_GCC}, [Set to 1 if the compile is GNU GCC.])
2007-04-23 08:23:05 +00:00
2004-07-02 13:20:15 +00:00
CFLAGS="$CFLAGS $OS_SPECIFIC_CFLAGS"
2004-02-19 11:49:34 +00:00
2007-05-14 09:55:24 +00:00
if test x"$CFLAGS" = x ; then
echo "Error in configure script. CFLAGS has been screwed up."
exit
fi
2007-04-23 08:23:05 +00:00
#-------------------------------------------------------------------------------
2004-04-20 13:20:25 +00:00
AC_SUBST(htmldocdir)
2004-04-25 13:33:04 +00:00
AC_SUBST(HTML_BGCOLOUR)
AC_SUBST(HTML_FGCOLOUR)
2004-04-20 13:20:25 +00:00
2007-05-14 09:55:24 +00:00
AC_SUBST(SHLIB_VERSION_ARG)
AC_SUBST(SHARED_VERSION_INFO)
2004-02-19 11:49:34 +00:00
AC_SUBST(OS_SPECIFIC_CFLAGS)
2007-05-14 09:55:24 +00:00
AC_SUBST(OS_SPECIFIC_LINKS)
2004-03-17 08:49:55 +00:00
AC_SUBST(ALSA_LIBS)
2007-05-14 09:55:24 +00:00
AC_SUBST(ENABLE_EXPERIMENTAL_CODE)
AC_SUBST(COMPILER_IS_GCC)
AC_SUBST(GCC_MAJOR_VERSION)
2007-11-23 23:00:29 +00:00
AC_SUBST(HAVE_JACK)
2005-09-23 10:02:20 +00:00
dnl The following line causes the libtool distributed with the source
2004-10-05 08:41:31 +00:00
dnl to be replaced if the build system has a more recent version.
AC_SUBST(LIBTOOL_DEPS)
2004-04-25 13:33:04 +00:00
AC_CONFIG_FILES([ \
2007-04-30 12:03:05 +00:00
src/sndfile.h src/Makefile src/GSM610/Makefile src/G72x/Makefile \
\
src/FLAC/Makefile src/FLAC/include/FLAC/Makefile src/FLAC/include/Makefile \
src/FLAC/include/share/grabbag/Makefile src/FLAC/include/share/Makefile \
src/FLAC/include/test_libs_common/Makefile src/FLAC/src/Makefile \
src/FLAC/src/libFLAC/ia32/Makefile src/FLAC/src/libFLAC/Makefile \
src/FLAC/src/libFLAC/include/private/Makefile \
src/FLAC/src/libFLAC/include/Makefile \
src/FLAC/src/libFLAC/include/protected/Makefile \
src/FLAC/src/libFLAC/ppc/as/Makefile src/FLAC/src/libFLAC/ppc/Makefile \
src/FLAC/src/libFLAC/ppc/gas/Makefile src/FLAC/src/share/Makefile \
src/FLAC/src/share/getopt/Makefile src/FLAC/src/share/grabbag/Makefile \
src/FLAC/src/share/replaygain_anal/Makefile \
src/FLAC/src/share/replaygain_syn/include/private/Makefile \
src/FLAC/src/share/replaygain_syn/include/Makefile \
src/FLAC/src/share/replaygain_syn/Makefile \
src/FLAC/src/share/utf8/Makefile src/FLAC/src/test_libFLAC/Makefile \
src/FLAC/src/test_libs_common/Makefile src/FLAC/src/test_seeking/Makefile \
2008-03-31 09:57:30 +00:00
src/FLAC/src/test_streams/Makefile \
2007-04-30 12:03:05 +00:00
src/FLAC/src/test_grabbag/Makefile src/FLAC/src/test_grabbag/cuesheet/Makefile \
src/FLAC/src/test_grabbag/picture/Makefile \
\
2007-08-19 10:55:02 +00:00
src/VORBIS/Makefile src/VORBIS/lib/Makefile src/VORBIS/include/Makefile \
src/VORBIS/include/vorbis/Makefile src/VORBIS/lib/modes/Makefile \
src/VORBIS/lib/books/floor/Makefile src/VORBIS/lib/books/coupled/Makefile \
2007-08-30 04:00:25 +00:00
src/VORBIS/lib/books/uncoupled/Makefile src/VORBIS/lib/books/Makefile \
src/VORBIS/test/Makefile \
2007-08-19 10:55:02 +00:00
\
2007-04-30 12:03:05 +00:00
src/OGG/include/ogg/Makefile src/OGG/include/Makefile src/OGG/Makefile \
man/Makefile examples/Makefile tests/Makefile regtest/Makefile \
2007-08-23 05:46:14 +00:00
M4/Makefile doc/Makefile Win32/Makefile Octave/Makefile \
doc/libsndfile.css \
2007-04-30 12:03:05 +00:00
Makefile libsndfile.spec sndfile.pc \
])
2007-05-14 09:55:24 +00:00
AC_OUTPUT
#====================================================================================
AC_MSG_RESULT([
-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
Configuration summary :
Version : ..................... ${VERSION}
2006-03-26 05:36:38 +00:00
Experimental code : ........... ${enable_experimental:-no}
2007-05-14 09:55:24 +00:00
])
if test x$ac_cv_c_compiler_gnu = xyes ; then
echo -e " Tools :\n"
echo " Compiler is GCC : ............. ${ac_cv_c_compiler_gnu}"
2007-11-29 10:30:35 +00:00
echo " GCC version : ................. ${GCC_VERSION}"
2007-05-14 09:55:24 +00:00
if test $GCC_MAJOR_VERSION -lt 3 ; then
2004-04-03 12:00:28 +00:00
echo -e "\n ** This compiler version allows applications to write"
2007-05-14 09:55:24 +00:00
echo " ** to static strings within the library."
2007-11-29 10:30:35 +00:00
echo " ** Compile with GCC version 3.X or above to avoid this problem."
2007-05-14 09:55:24 +00:00
fi
fi
2004-04-03 12:00:28 +00:00
if test $libdir = "\${exec_prefix}/lib" ; then
libdir="$prefix/lib"
fi
if test $bindir = "\${exec_prefix}/bin" ; then
2004-04-20 06:24:07 +00:00
bindir="$prefix/bin"
2004-04-03 12:00:28 +00:00
fi
AC_MSG_RESULT([[
2007-05-14 09:55:24 +00:00
Installation directories :
2004-04-03 12:00:28 +00:00
Library directory : ........... $libdir
Program directory : ........... $bindir
Pkgconfig directory : ......... $libdir/pkgconfig
2004-04-20 13:20:25 +00:00
HTML docs directory : ......... $htmldocdir
2004-04-03 12:00:28 +00:00
]])
2007-05-14 09:55:24 +00:00
if test x$prefix != "x/usr" ; then
2004-04-03 12:00:28 +00:00
echo "Compiling some other packages against libsndfile may require"
echo -e "the addition of \"$libdir/pkgconfig\" to the"
2007-05-14 09:55:24 +00:00
echo -e "PKG_CONFIG_PATH environment variable.\n"
fi
2007-04-15 10:14:28 +00:00
#==================================================================================
# Ugly hack to remove -Werror from some Makefiles.
TMPFILE=/tmp/strchange$$
2007-04-30 12:03:05 +00:00
for f in "src/FLAC/src/libFLAC/Makefile" ; do
2007-04-15 10:14:28 +00:00
tmp=`grep -l "\-Werror" "$f"`
if test -n "$tmp" ; then
if sed -e "s!\-Werror!!g" "$f" > $TMPFILE ; then
cp -f $TMPFILE "$f"
fi
fi
done