dnl
dnl Copyright (c) 1996-2001 by Guardsoft Pty Ltd.
dnl
dnl All rights reserved. This program and the accompanying materials
dnl are made available under the terms of the Eclipse Public License v1.0
dnl which accompanies this distribution, and is available at
dnl http://www.eclipse.org/legal/epl-v10.html
dnl

AC_PREREQ(2.50)

AC_INIT(libaif, 2.1.0)
AM_INIT_AUTOMAKE
AC_CONFIG_HEADER(config.h)

dnl Checks for programs.
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_RANLIB

dnl Checks for libraries.

dnl Check endianness
AC_C_BIGENDIAN

dnl See if compiler supports "long long" type.

AC_CHECK_SIZEOF(long long)
if test $ac_cv_sizeof_long_long -ne 0; then
	AC_DEFINE(CC_HAS_LONG_LONG,1,[define if system has long long type.])
fi

dnl See if compiler supports "long double" type.

AC_CHECK_SIZEOF(long double)
if test $ac_cv_sizeof_long_double -ne 0; then
	dnl See if "long double" is longer than "double".

	AC_CHECK_SIZEOF(double)
	if test $ac_cv_sizeof_long_double -gt $ac_cv_sizeof_double; then
		AC_DEFINE(HAVE_LONG_DOUBLE,1,[define if system has long double type.])
	fi
fi

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(strings.h sys/time.h unistd.h)

os=`uname -s`
if test "x$os" = "xAIX" ; then
        CFLAGS="$CFLAGS -qinfo=gen -qcpluscmt"
else
        CFLAGS="$CFLAGS -Wall"
fi

dnl Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME
AC_STRUCT_TM

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

AC_PATH_PROG(XMLTO, xmlto)
if test -z "$ac_cv_path_XMLTO"; then
	AC_MSG_WARN([You must have XMLTO to compile the XML documentation for libaif.])
	XMLTO=":"
fi

AC_OUTPUT([Makefile doc/Makefile])
