AC_INIT([libmpcs], [0.1])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([libmpcdec/mpc_reader.c])
AM_CONFIG_HEADER([include/config.h])
AM_INIT_AUTOMAKE(subdir-objects)
AM_MAINTAINER_MODE

AC_LANG_C
AC_PROG_CC
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL

AC_CHECK_HEADERS([replaygain/gain_analysis.h])
AM_CONDITIONAL([MPC_GAIN], [test "x$ac_cv_header_replaygain_gain_analysis_h" = xyes])

AC_CANONICAL_HOST()
case $host_os in
	*mingw32* )
		LDFLAGS="${LDFLAGS} -mwindows"
		EXTRALIBS="-lwinmm"
		;;
	* )
		EXTRALIBS=""
		;;
esac

AC_SUBST([EXTRALIBS])

AC_ARG_ENABLE([mpcchap], [AS_HELP_STRING([--enable-mpcchap], [enable building mpcchap])])
if test "x$enable_mpcchap" = xyes; then
  PKG_CHECK_MODULES(LIBCUE, libcue)
  AC_SUBST(LIBCUE_CFLAGS)
  AC_SUBST(LIBCUE_LIBS)
fi

AM_CONDITIONAL([MPC_CHAP], [test "x$enable_mpcchap" = xyes])

AM_CONDITIONAL([HAVE_VISIBILITY], true)


AC_CONFIG_FILES([
Makefile
include/Makefile
libmpcdec/Makefile
libmpcenc/Makefile
libmpcpsy/Makefile
libwavformat/Makefile
mpc2sv8/Makefile
mpcchap/Makefile
mpccut/Makefile
mpcdec/Makefile
mpcenc/Makefile
mpcgain/Makefile
wavcmp/Makefile
])

AC_OUTPUT
