dnl This file is part of the FreeType project.
dnl
dnl Process this file with autoconf to produce a configure script.

AC_INIT(lib/freetype.h)

dnl Checks for system type.
AC_CANONICAL_SYSTEM

dnl Checks for programs.
AC_PROG_CC

dnl get Compiler flags right.

if test "x$CC" = xgcc; then
	XX_CFLAGS="-Wall -pedantic -ansi"
else
	case "$host" in
  		alpha-dec-osf*)
        	XX_CFLAGS="-std1 -O2 -g3"
       		;;
  		*)
          	XX_CFLAGS=
       		;;
	esac
fi
AC_SUBST(XX_CFLAGS)

dnl Check for RANLIB.
AC_PROG_RANLIB

dnl Checks for libraries.

dnl Checks for header files.
AC_PATH_XTRA
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h getopt.h)

if test "$ac_cv_header_getopt-h" != yes; then
   HAVE_GETOPT_H=""
else
   HAVE_GETOPT_H=-DHAVE_GETOPT_H=1
fi
AC_SUBST(HAVE_GETOPT_H)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)

dnl Checks for library functions.

dnl Here we check whether we can use our mmap file component.
AC_FUNC_MMAP
if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
	TT_FILE_COMPONENT=ttfile.c
else
	TT_FILE_COMPONENT=arch/unix/ttmmap.c
fi
AC_SUBST(TT_FILE_COMPONENT)

AC_CHECK_FUNCS(memcpy basename)
if test "$ac_cv_func_basename" != yes; then
   HAVE_BASENAME=""
else
   HAVE_BASENAME=-DHAVE_BASENAME=1
fi
AC_SUBST(HAVE_BASENAME)

AC_CONFIG_HEADER(ft_conf.h)
AC_OUTPUT(Makefile lib/Makefile test/Makefile)
