dnl @(#)configure.in	1.11 09/08/08	Copyright 1998-2003 Heiko Eißfeldt
dnl Process this file with autoconf to produce a configure script.
AC_INIT(cdda2wav.c)
AC_CONFIG_HEADER(lconfig.h)

dnl get canonical host
AC_CANONICAL_HOST

dnl extract cdrtools version from the cdrecord.c file
dnl CDRTOOLS_VERSION=`sed -n -f ../../version.sed <../../../cdrecord/cdrecord.c`
dnl AC_SUBST(CDRTOOLS_VERSION)

dnl set object extension needed for AC_CHECK_HEADERS by autoconf 2.57
dnl _AC_COMPILER_OBJEXT

dnl check for posix4 library on Solaris or SunOS
case "$host_os" in
   solaris*|sunos*)
AC_CHECK_LIB(posix4, sched_get_priority_max)
;;
esac
AC_CHECK_LIB(ossaudio, _oss_ioctl)

EXTRALIBS="$LIBS"

AC_SUBST(EXTRALIBS)

dnl check header files
AC_CHECK_HEADERS(sys/cdio.h sys/cdrio.h sundev/srreg.h sys/audioio.h sun/audioio.h)
AC_CHECK_HEADERS(soundcard.h sys/soundcard.h linux/soundcard.h machine/soundcard.h)
dnl We no longer include HAVE_WINDOWS_H in lconfig.h but we need the test
dnl result together with the test for mmsystem.h
AC_CHECK_HEADERS(sys/asoundlib.h windows.h mmsystem.h)

case "${ac_cv_header_sys_cdio_h}""${ac_cv_header_sundev_srreg_h}" in
   *yes*)
HAVE_SUN_IOCTL=1
;;
   *)
HAVE_SUN_IOCTL=
;;
esac
AC_SUBST(HAVE_SUN_IOCTL)

case "${ac_cv_header_sys_audioio_h}""${ac_cv_header_sun_audioio_h}" in
   *yes*)
HAVE_SUNSOUND=1
;;
   *)
HAVE_SUNSOUND=
;;
esac
AC_SUBST(HAVE_SUNSOUND)

case "${ac_cv_header_machine_soundcard_h}""${ac_cv_header_sys_soundcard_h}""${ac_cv_header_linux_soundcard_h}" in
   *yes*)
HAVE_OSS=1
;;
   *)
HAVE_OSS=
;;
esac
AC_SUBST(HAVE_OSS)

AC_SUBST(HAVE_SYS_ASOUNDLIB_H)

case "${ac_cv_header_windows_h}""${ac_cv_header_mmsystem_h}" in
   *yesyes*)
HAVE_WINSOUND=1
;;
   *)
HAVE_WINSOUND=
;;
esac
AC_SUBST(HAVE_WINSOUND)

case "${ac_cv_header_os2_h}""${ac_cv_header_os2me_h}" in
   *yesyes*)
HAVE_OS2SOUND=1
;;
   *)
HAVE_OS2SOUND=
;;
esac
AC_SUBST(HAVE_OS2SOUND)

dnl Checks for library functions.

AC_OUTPUT(local.cnf)
