AC_INIT(rtaudio/float_sys.pw13p.cc)
AM_INIT_AUTOMAKE(pw13_stk-0,1.0.0)

AC_CANONICAL_HOST

AC_MSG_CHECKING([for native Win32])
case "$host" in
  *-*-mingw*)
    if test `uname -s` != Linux; then
      os_win32=yes
      AC_DEFINE(WIN32)
    fi
    ;;
  *)
    os_win32=no
    ;;
esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")

if test "$os_win32" = "yes"; then
 if test x$enable_static = xyes -o x$enable_static = x; then
   AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.])
   enable_static=no
 fi
 if test x$enable_shared = xno; then
   AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.])
 fi
 enable_shared=yes
fi

AC_LANG([C++])
AC_CHECK_HEADER([stk/RtAudio.h])
stk_CFLAGS=''
stk_LIBS='-lstk'

PKG_CHECK_MODULES(pw13, libpw13-0)
#PKG_CHECK_MODULES(stk, libstk-4.2.1)

PW13_CFLAGS="$pw13_CFLAGS $stk_CFLAGS"
PW13_LIBS="$pw13_LIBS $stk_LIBS"
AC_SUBST(PW13_CFLAGS)
AC_SUBST(PW13_LIBS)

AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL

AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL

AC_SUBST(LIBTOOL_DEPS)

dnl AC_CONFIG_SUBDIRS(stk-4.2.1)

AC_MSG_CHECKING([if we want debugging])
AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug], [Activate debugging]),
	      [if test "x$debug" = x; then debug=yes; fi], [debug=no])
if test "x$debug" = xyes; then
  export CFLAGS='-W -Wall -O0 -g'
else
  debug=no
  export CFLAGS='-W -Wall -O3'
fi
AC_MSG_RESULT([$debug])

AC_OUTPUT([
  Makefile
  rtaudio/Makefile
])
