AC_INIT(art_misc.h)
AM_CONFIG_HEADER(config.h)

LIBART_MAJOR_VERSION=2
LIBART_MINOR_VERSION=3
LIBART_MICRO_VERSION=12
LIBART_VERSION=$LIBART_MAJOR_VERSION.$LIBART_MINOR_VERSION.$LIBART_MICRO_VERSION
LIBART_VERSION_INFO=`expr $LIBART_MAJOR_VERSION + $LIBART_MINOR_VERSION`:$LIBART_MICRO_VERSION:$LIBART_MINOR_VERSION

AC_SUBST(LIBART_MAJOR_VERSION)
AC_SUBST(LIBART_MINOR_VERSION)
AC_SUBST(LIBART_MICRO_VERSION)
AC_SUBST(LIBART_VERSION)
AC_SUBST(LIBART_VERSION_INFO)

VERSION=$LIBART_VERSION

AM_INIT_AUTOMAKE(libart_lgpl, $VERSION)

AC_ARG_ENABLE(ansi, [  --enable-ansi           turn on strict ansi [default=no]],
		    , enable_ansi=no)

AC_PROG_CC
AC_PROG_CPP
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL

AM_MAINTAINER_MODE

AC_MSG_CHECKING([for Win32])
case "$host" in
  *-*-mingw*)
    os_win32=yes
    ;;
  *)
    os_win32=no
    ;;
esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")

if test "$os_win32" = "yes"; then
  AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
fi
AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)

changequote(,)dnl
if test "x$GCC" = "xyes"; then
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wmissing-prototypes[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
  esac

  if test "x$enable_ansi" = "xyes"; then
    case " $CFLAGS " in
    *[\ \	]-ansi[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -ansi" ;;
    esac

    case " $CFLAGS " in
    *[\ \	]-pedantic[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -pedantic" ;;
    esac
  fi
fi
changequote([,])dnl

AC_FUNC_ALLOCA

LIBART_LIBDIR='-L${libdir}'
LIBART_INCLUDEDIR='-I${includedir}'
LIBART_LIBS='-lart_lgpl'

AC_SUBST(LIBART_LIBDIR)
AC_SUBST(LIBART_INCLUDEDIR)
AC_SUBST(LIBART_LIBS)

AC_C_BIGENDIAN

AC_OUTPUT([
libart-features.h
Makefile
libart-config
libart-2.0.pc
libart-zip], [case "$CONFIG_FILES" in *libart-config*) chmod +x libart-config;; esac])
