dnl Process this file with autoconf to produce a configure script.

AC_INIT(../../lib/freetype.h)

AC_PROG_CC

AC_ARG_WITH(kpathsea-dir,
            [  --with-kpathsea-dir=DIR Location of the kpathsea base dir (/usr/local)],[
  if test x$withval = xyes; then
    AC_MSG_WARN(Usage is: --with-kpathsea-dir=basedir)
  else
    if test x$withval = xno; then
      AC_MSG_WARN(Usage is: --with-kpathsea-dir=basedir)
    else
      kpathsea_dir=$withval
    fi
  fi
])

LIBS="$LIBS -L$kpathsea_dir/lib"
CPPFLAGS="$CPPFLAGS -I$kpathsea_dir/include -I."

AC_CHECK_LIB(kpathsea, kpse_init_prog, LIBS="$LIBS -lkpathsea",[
             AC_MSG_ERROR([Can't find kpathsea library! Use --with-kpathsea-dir option.])])

AC_CHECK_HEADER(kpathsea/kpathsea.h, ,[
                AC_MSG_ERROR([Can't find kpathsea include files! Use --with-kpathsea-dir option.])])

AC_SUBST(kpathsea_dir)

LIBS="$LIBS -L../../lib"
CPPFLAGS="$CPPFLAGS -I../../lib"
AC_CHECK_LIB(ttf, TT_Init_FreeType, LIBS="$LIBS -lttf",[
             AC_MSG_ERROR([Can't find ttf library! Compile FreeType first.])])

AC_CHECK_LIB(m, floor)

dnl get Compiler flags right.

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

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

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

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


AC_OUTPUT(Makefile)
