dnl Process this file with autoconf to produce a configure script.
AC_INIT(dvipdfm.c)

define([_version_],"0.13.2b")

VERSION=_version_
AC_SUBST(VERSION)
AC_DEFINE(VERSION,_version_)
AC_DEFINE(PACKAGE,"dvipdfm")

AC_CONFIG_HEADER(config.h)

AC_ARG_ENABLE(maint, [  --enable-maint          enable autoconf portions of Makefile],
  [MAINT=''], [MAINT='#'])
AC_SUBST(MAINT)  

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

dnl Don't bother going further if we don't have kpse installed.
AC_ARG_WITH(kpathsea,
[  --with-kpathsea=DIR     use kpathsea include/library files from DIR], [
  if test -d "$withval"; then
    CPPFLAGS="$CPPFLAGS -I$withval/include"
    LDFLAGS="$LDFLAGS -L$withval/lib"
 fi
])

AC_HAS_KPSE_FORMATS
AC_HAS_OMEGA_FORMATS
TTF_OPT='#'
AC_HAS_TTF_FORMATS
AC_SUBST(TTF_OPT)

AC_CHECK_LIB(kpathsea, kpse_find_file, [AC_DEFINE(HAVE_KPATHSEA) LIBS="-lkpathsea $LIBS"],
  AC_MSG_ERROR([kpathsea library not found
This version of dvipdfm requires the kpathsea library and its headers.  If
you know where it is you might try setting the LDFLAGS environment variable
with -L pointing to the directory containing libkpathsea.a
]))

dnl Check whether this version of kpathsea have xbasename() instead of basename()

AC_CHECK_LIB(kpathsea, xbasename, [AC_DEFINE(HAVE_XBASENAME)])

TEXMF='${datadir}/texmf'
AC_SUBST(TEXMF)

AC_HAS_ZLIB
AC_HAS_LIBPNG
  
dnl Check for functions
AC_CHECK_FUNC(system,[AC_DEFINE(HAVE_SYSTEM)])

dnl Checks for libraries.

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

dnl Checks for typedefs, structures, and compiler characteristics.
AC_EXT_TIMEZONE
AC_TZ_HAS_TM_GMTOFF

AC_C_CONST
AC_TYPE_SIZE_T
AC_STRUCT_TM

dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_CHECK_FUNCS(strspn)


AC_OUTPUT(Makefile)