##
## This file is part of the 'OpenPrinting Japan' project
## $Id: configure.in,v 1.2 2005/03/23 00:58:01 gishi Exp $
##
## Copyright (C) 2004 by Turbolinux,Inc.
## This file is free software, distributed under the terms of the GNU
## General Public License.  As a special exception to the GNU General
## Public License, this file may be distributed as part of a program
## that contains a configuration script generated by Autoconf, under
## the same distribution terms as the rest of that program.

AC_PREREQ(2.2)
AC_INIT(configure.in)
AC_CONFIG_HEADERS([config.h])
AC_PREFIX_DEFAULT(/usr)

opvp_hppagecolor_version=`cat VERSION | grep '^opvp_hppagecolor' | cut -f2 -d'='`

PACKAGE=opfc-ModuleHP
VERSION=`echo ${opvp_hppagecolor_version} | sed -e 's|:|.|g'`

AM_INIT_AUTOMAKE($PACKAGE,$VERSION)

# set the library version
HPPAGECOLOR_MAJOR_VERSION=`echo ${opvp_hppagecolor_version} | cut -f1 -d':'`
HPPAGECOLOR_MINOR_VERSION=`echo ${opvp_hppagecolor_version} | cut -f2 -d':'`
HPPAGECOLOR_MICRO_VERSION=`echo ${opvp_hppagecolor_version} | cut -f3 -d':'`

HPPAGECOLOR_VERSION=$HPPAGECOLOR_MAJOR_VERSION.$HPPAGECOLOR_MINOR_VERSION.$HPPAGECOLOR_MICRO_VERSION
HPPAGECOLOR_VERSION_INFO=`expr $HPPAGECOLOR_MAJOR_VERSION + $HPPAGECOLOR_MINOR_VERSION`:$HPPAGECOLOR_MICRO_VERSION:$HPPAGECOLOR_MINOR_VERSION
HPPAGECOLOR_VERSION_NUMBER=`expr $HPPAGECOLOR_MAJOR_VERSION \* 10000 + $HPPAGECOLOR_MINOR_VERSION \* 100 + $HPPAGECOLOR_MICRO_VERSION`

AC_SUBST(HPPAGECOLOR_MAJOR_VERSION)
AC_SUBST(HPPAGECOLOR_MINOR_VERSION)
AC_SUBST(HPPAGECOLOR_MICRO_VERSION)
AC_SUBST(HPPAGECOLOR_VERSION)
AC_SUBST(HPPAGECOLOR_VERSION_INFO)
AC_SUBST(HPPAGECOLOR_VERSION_NUMBER)

# Checks for dynamic loading library
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL

# Checks for typical programs and library
AC_PROG_CC
AC_PROG_INSTALL
AC_HEADER_STDC
AC_FUNC_MALLOC

# see where math library 
AC_CHECK_FUNCS(floor, [MATH_LIBS=""], [
  AC_CHECK_LIB(m, floor, [MATH_LIBS="-lm"], [
    AC_MSG_WARN([could not find floor() needed by pdapi.h
    your system may not be supported.])
  ])
])
AC_SUBST(MATH_LIBS)

AC_CHECK_PROG([CUPS_CONFIG], [cups-config], [cups-config])
if test x$CUPS_CONFIG != xcups-config; then
    AC_MSG_ERROR([the cups-config utility is required])
fi

dnl debug option
AC_ARG_ENABLE(debug,
	[  --enable-deubug     turn on debugging],
	if test "x$enable_debug" = "xyes" ; then
	  CFLAGS="-DDEBUG $CFLAGS"
	fi
)

dnl fonts options
AC_ARG_ENABLE(IPAFonts,
	[  --enable-IPAFonts     distributed with IPA TrueType fonts (default: no)],
 	[case "${enableval}" in
 	  yes) IPAFonts=true;;
 	  no) IPAFonts=false;;
 	  *) AC_MSG_ERROR([bad value ${enableval}]);;
 	esac],[IPAFonts=false]
)
AM_CONDITIONAL(WITH_IPAFONTS, test x$IPAFonts = xtrue)

if test x$IPAFonts = xtrue ; then
  RELEASE_TAG=_withIPAFonts
else
  RELEASE_TAG=
fi
AC_SUBST(RELEASE_TAG)

AC_OUTPUT([
Makefile
doc/Makefile
libopvp/Makefile
libopvp/doc/Makefile
opvp/Makefile
ppd/Makefile
fonts/Makefile
])
