dnl Process this file with autoconf to produce a configure script.
AC_INIT(test/testaupv.c)

PACKAGE=audiofile
AUDIOFILE_MAJOR_VERSION=0
AUDIOFILE_MINOR_VERSION=1
AUDIOFILE_MICRO_VERSION=6
AUDIOFILE_VERSION=$AUDIOFILE_MAJOR_VERSION.$AUDIOFILE_MINOR_VERSION.$AUDIOFILE_MICRO_VERSION

dnl set version info for libaudiofile.so to package rev - $MAJOR + $MINOR : $MICRO : $MINOR
AUDIOFILE_VERSION_INFO=1:6:1

AC_SUBST(AUDIOFILE_MAJOR_VERSION)
AC_SUBST(AUDIOFILE_MINOR_VERSION)
AC_SUBST(AUDIOFILE_MICRO_VERSION)
AC_SUBST(AUDIOFILE_VERSION)
AC_SUBST(AUDIOFILE_VERSION_INFO)

VERSION=$AUDIOFILE_VERSION


AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AM_CONFIG_HEADER(config.h)
AM_PROG_LIBTOOL

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET

dnl Checks for libraries.
dnl Replace `main' with a function in -laudio:
AC_CHECK_LIB(audio, main)

AC_CHECK_LIB(m, sin)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T

dnl Workaround the lack of these typedefs
AC_CHECK_TYPE(u_int8_t, unsigned char)
AC_CHECK_TYPE(u_int16_t, unsigned short)
AC_CHECK_TYPE(u_int32_t, unsigned int)

dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_CHECK_FUNCS(strdup)

dnl Set up platform specific stuff
platform=none
AC_MSG_CHECKING([for platform specific tests to compile])
case "$host_os" in
  linux*)
    TEST_BIN=linuxtest
    platform=linux
    ;;
  irix5* | irix6*)
    TEST_BIN=read test testloop testaupv bitdepth
    platform=irix
    ;;
esac
AC_MSG_RESULT($platform)
AC_SUBST(TEST_BIN)

AC_OUTPUT([
	audiofile.spec
	sfcommands/Makefile 
	test/Makefile 
	libaudiofile/Makefile 
	docs/Makefile 
	Makefile 
	audiofile-config], [case "$CONFIG_FILES" in *audiofile-config*) chmod +x audiofile-config;; esac])
