Blame SOURCES/configure.ac

d35507
# Process this file with autoconf to create configure.
d35507
d35507
AC_PREREQ([2.65])
d35507
d35507
# ====================
d35507
# Version informations
d35507
# ====================
d35507
m4_define([cups_filters_version_major],[1])
d35507
m4_define([cups_filters_version_minor],[0])
d35507
m4_define([cups_filters_version_micro],[35])
d35507
m4_define([cups_filters_version],[cups_filters_version_major.cups_filters_version_minor.cups_filters_version_micro])
d35507
d35507
# =============
d35507
# Automake init
d35507
# =============
d35507
AC_INIT([cups-filters],[cups_filters_version])
d35507
AC_CONFIG_MACRO_DIR([m4])
d35507
m4_include([m4/ac_define_dir.m4])
d35507
m4_include([m4/ax_compare_version.m4])
d35507
AM_INIT_AUTOMAKE([1.11 gnu dist-xz dist-bzip2])
d35507
AM_SILENT_RULES([yes])
d35507
AC_LANG([C++])
d35507
AC_CONFIG_HEADERS([config.h])
d35507
# Extra defines for the config.h
d35507
AH_BOTTOM([
d35507
#ifdef HAVE_LONG_LONG
d35507
#  define CUPS_LLFMT   "%lld"
d35507
#  define CUPS_LLCAST  (long long)
d35507
#else
d35507
#  define CUPS_LLFMT   "%ld"
d35507
#  define CUPS_LLCAST  (long)
d35507
#endif /* HAVE_LONG_LONG */
d35507
d35507
#ifdef HAVE_ARC4RANDOM
d35507
#  define CUPS_RAND() arc4random()
d35507
#  define CUPS_SRAND(v) arc4random_stir()
d35507
#elif defined(HAVE_RANDOM)
d35507
#  define CUPS_RAND() random()
d35507
#  define CUPS_SRAND(v) srandom(v)
d35507
#elif defined(HAVE_LRAND48)
d35507
#  define CUPS_RAND() lrand48()
d35507
#  define CUPS_SRAND(v) srand48(v)
d35507
#else
d35507
#  define CUPS_RAND() rand()
d35507
#  define CUPS_SRAND(v) srand(v)
d35507
#endif /* HAVE_ARC4RANDOM */
d35507
])
d35507
d35507
# ===========================
d35507
# Find required base packages
d35507
# ===========================
d35507
AC_PROG_CC
d35507
AC_PROG_CXX
d35507
AM_PROG_CC_C_O
d35507
AC_PROG_CPP
d35507
AC_PROG_INSTALL
d35507
AC_PROG_LN_S
d35507
AC_PROG_MAKE_SET
d35507
AC_PROG_LIBTOOL
d35507
PKG_PROG_PKG_CONFIG([0.20])
d35507
d35507
# ========================================
d35507
# Specify the fontdir patch if not default
d35507
# ========================================
d35507
AC_ARG_WITH([fontdir],
d35507
	[AS_HELP_STRING([--with-fontdir=path], [Specify path to font config directory (default: fonts/conf.d/).])],
d35507
	[FONTDIR="$withval"],
d35507
	[FONTDIR="fonts/conf.d"]
d35507
)
d35507
AC_SUBST(FONTDIR)
d35507
d35507
# ================================
d35507
# Find CUPS internals (no pc file)
d35507
# ================================
d35507
AC_ARG_WITH([cups-config],
d35507
	[AS_HELP_STRING([--with-cups-config=path], [Specify path to cups-config executable.])],
d35507
	[with_cups_config="$withval"],
d35507
	[with_cups_config=system]
d35507
)
d35507
d35507
AS_IF([test "x$with_cups_config" != "xsystem"], [
d35507
	CUPSCONFIG=$with_cups_config
d35507
], [
d35507
	AC_PATH_PROG(CUPSCONFIG, [cups-config])
d35507
	AS_IF([test -z "$CUPSCONFIG"], [
d35507
		AC_MSG_ERROR([Required cups-config is missing. Please install CUPS developer packages.])
d35507
	])
d35507
])
d35507
CUPS_CFLAGS=`$CUPSCONFIG --cflags`
d35507
CUPS_LIBS=`$CUPSCONFIG --image --libs`
d35507
CUPS_VERSION=`$CUPSCONFIG --version`
d35507
AC_SUBST(CUPS_CFLAGS)
d35507
AC_SUBST(CUPS_LIBS)
d35507
d35507
CUPS_DATADIR="`$CUPSCONFIG --datadir`"
d35507
AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$CUPS_DATADIR", [CUPS datadir])
d35507
AC_SUBST(CUPS_DATADIR)
d35507
d35507
CUPS_SERVERROOT="`$CUPSCONFIG --serverroot`"
d35507
AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$CUPS_SERVERROOT", [CUPS serverroot])
d35507
AC_SUBST(CUPS_SERVERROOT)
d35507
d35507
CUPS_FONTPATH="$CUPS_DATADIR/fonts"
d35507
AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$CUPS_FONTPATH", [Path to CUPS fonts dir])
d35507
AC_SUBST(CUPS_FONTPATH)
d35507
d35507
CUPS_SERVERBIN="`$CUPSCONFIG --serverbin`"
d35507
AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$CUPS_SERVERBIN", [Path to CUPS binaries dir])
d35507
AC_SUBST(CUPS_SERVERBIN)
d35507
d35507
AX_COMPARE_VERSION([$CUPS_VERSION],[gt],[1.4], [
d35507
	AC_DEFINE(CUPS_1_4, 1, [CUPS Version is 1.4 or newer])
d35507
])
d35507
AC_DEFINE(PDFTOPDF, [], [Needed for pdftopdf filter compilation])
d35507
AC_DEFINE_DIR(BANNERTOPDF_DATADIR, "{CUPS_DATADIR}/data", [Directory where bannertopdf finds its data files (PDF templates)])
d35507
d35507
AC_SEARCH_LIBS([dlopen],
d35507
	[dl],
d35507
	DLOPEN_LIBS="-ldl",
d35507
	AC_MSG_ERROR([unable to find the dlopen() function])
d35507
)
d35507
AC_SUBST(DLOPEN_LIBS)
d35507
d35507
# Transient run-time state dir of CUPS
d35507
CUPS_STATEDIR=""
d35507
AC_ARG_WITH(cups-rundir, [  --with-cups-rundir           set transient run-time state directory of CUPS],CUPS_STATEDIR="$withval",[
d35507
        case "$uname" in
d35507
                Darwin*)
d35507
                        # Darwin (OS X)
d35507
                        CUPS_STATEDIR="$CUPS_SERVERROOT"
d35507
                        ;;
d35507
                *)
d35507
                        # All others
d35507
                        CUPS_STATEDIR="$localstatedir/run/cups"
d35507
                        ;;
d35507
        esac])
d35507
AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR", [Transient run-time state dir of CUPS])
d35507
AC_SUBST(CUPS_STATEDIR)
d35507
d35507
# Domain socket of CUPS...
d35507
CUPS_DEFAULT_DOMAINSOCKET=""
d35507
AC_ARG_WITH(cups-domainsocket, [  --with-cups-domainsocket     set unix domain socket name used by CUPS
d35507
],
d35507
        default_domainsocket="$withval",
d35507
        default_domainsocket="")
d35507
d35507
if test x$enable_domainsocket != xno -a x$default_domainsocket != xno; then
d35507
        if test "x$default_domainsocket" = x; then
d35507
                case "$uname" in
d35507
                        Darwin*)
d35507
                                # Darwin and MaxOS X do their own thing...
d35507
                                CUPS_DEFAULT_DOMAINSOCKET="$localstatedir/run/cupsd"
d35507
                                ;;
d35507
                        *)
d35507
                                # All others use FHS standard...
d35507
                                CUPS_DEFAULT_DOMAINSOCKET="$CUPS_STATEDIR/cups.sock"
d35507
                                ;;
d35507
                esac
d35507
        else
d35507
                CUPS_DEFAULT_DOMAINSOCKET="$default_domainsocket"
d35507
        fi
d35507
fi
d35507
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DOMAINSOCKET, "$CUPS_DEFAULT_DOMAINSOCKET", "Domain socket of CUPS")
d35507
AC_SUBST(CUPS_DEFAULT_DOMAINSOCKET)
d35507
d35507
# ======================
d35507
# Check system functions
d35507
# ======================
d35507
AC_CHECK_FUNCS(strlcat)
d35507
AC_CHECK_FUNCS(strlcpy)
d35507
AC_CHECK_FUNCS(sigaction)
d35507
AC_CHECK_FUNCS(waitpid wait3)
d35507
AC_CHECK_FUNCS(strtoll)
d35507
AC_CHECK_FUNCS(open_memstream)
d35507
AC_CHECK_FUNCS(getline,[],AC_SUBST([GETLINE],['bannertopdf-getline.$(OBJEXT)']))
d35507
AC_CHECK_FUNCS(strcasestr,[],AC_SUBST([STRCASESTR],['pdftops-strcasestr.$(OBJEXT)']))
d35507
AC_SEARCH_LIBS(pow, m)
d35507
d35507
# ========================
d35507
# Check for system headers
d35507
# ========================
d35507
AC_CHECK_HEADERS([stdlib.h])
d35507
AC_CHECK_HEADERS([sys/stat.h])
d35507
AC_CHECK_HEADERS([sys/types.h])
d35507
AC_CHECK_HEADERS([unistd.h])
d35507
AC_CHECK_HEADERS([zlib.h])
d35507
AC_CHECK_HEADERS([endian.h])
d35507
AC_CHECK_HEADERS([dirent.h])
d35507
AC_CHECK_HEADERS([sys/ioctl.h])
d35507
d35507
# =============
d35507
# Image options
d35507
# =============
d35507
AC_ARG_ENABLE([imagefilters],
d35507
	[AS_HELP_STRING([--disable-imagefilters], [Build the image filters.])],
d35507
	[enable_imagefilters="$enableval"],
d35507
	[enable_imagefilters=yes]
d35507
)
d35507
AM_CONDITIONAL([ENABLE_IMAGEFILTERS], [test "x$enable_imagefilters" != "xno"])
d35507
d35507
# Libraries
d35507
AC_ARG_WITH([jpeg],
d35507
	[AS_HELP_STRING([--without-jpeg], [Disable jpeg support.])],
d35507
	[with_jpeg="$withval"],
d35507
	[with_jpeg=yes]
d35507
)
d35507
AS_IF([test x"$with_jpeg" != "xno"], [
d35507
	AC_DEFINE([HAVE_LIBJPEG], [], [Defines if we provide jpeg library.])
d35507
	AC_CHECK_HEADERS([jpeglib.h])
d35507
	AC_SEARCH_LIBS([jpeg_destroy_decompress],
d35507
		[jpeg],
d35507
		LIBJPEG_LIBS="-ljpeg",
d35507
		AC_MSG_ERROR([jpeg libraries not found.])
d35507
	)
d35507
	AC_SUBST(LIBJPEG_LIBS)
d35507
])
d35507
d35507
AC_ARG_WITH([png],
d35507
	[AS_HELP_STRING([--without-png], [Disable png support.])],
d35507
	[with_png="$withval"],
d35507
	[with_png=yes]
d35507
)
d35507
AS_IF([test x"$with_png" != "xno"], [
d35507
	PKG_CHECK_MODULES([LIBPNG], [libpng])
d35507
	AC_DEFINE([HAVE_LIBPNG], [], [Defines if we provide png library.])
d35507
])
d35507
d35507
AC_ARG_WITH([tiff],
d35507
	[AS_HELP_STRING([--without-tiff], [Disable tiff support.])],
d35507
	[with_tiff="$withval"],
d35507
	[with_tiff=yes]
d35507
)
d35507
AS_IF([test x"$with_tiff" != "xno"], [
d35507
	AC_DEFINE([HAVE_LIBTIFF], [], [Defines if we provide tiff library.])
d35507
	AC_CHECK_HEADERS([tiff.h])
d35507
	AC_SEARCH_LIBS([TIFFReadScanline],
d35507
		[tiff],
d35507
		LIBJPEG_LIBS="-ltiff",
d35507
		AC_MSG_ERROR([tiff libraries not found.])
d35507
	)
d35507
	AC_SUBST(LIBTIFF_LIBS)
d35507
])
d35507
d35507
# ==================================
d35507
# Check for modules needed by utils/
d35507
# ==================================
d35507
d35507
dnl Avahi for cups-browsed
d35507
AVAHI_LIBS=""
d35507
AVAHI_CFLAGS=""
d35507
AVAHI_GLIB_CFLAGS=""
d35507
AVAHI_GLIB_LIBS=""
d35507
d35507
AC_ARG_ENABLE([avahi],
d35507
	[AS_HELP_STRING([--disable-avahi], [Disable DNS Service Discovery support using Avahi.])],
d35507
	[enable_avahi="$enableval"],
d35507
	[enable_avahi=yes]
d35507
)
d35507
AM_CONDITIONAL([ENABLE_AVAHI], [test "x$enable_avahi" != "xno"])
d35507
d35507
AC_ARG_WITH(avahi-libs,
d35507
	[AS_HELP_STRING([--with-avahi-libs], [Set directory for Avahi library.])],
d35507
	AVAHI_LIBS="-L$withval $AVAHI_LIBS",)
d35507
AC_ARG_WITH(avahi-includes,
d35507
	[AS_HELP_STRING([--with-avahi-includes], [Set directory for Avahi includes])],
d35507
	AVAHI_CFLAGS="-I$withval $AVAHI_CFLAGS",)
d35507
d35507
if test "x$enable_avahi" != xno; then
d35507
	PKG_CHECK_MODULES(AVAHI, avahi-client,
d35507
		[AC_DEFINE(HAVE_AVAHI, [], [Define if you have the avahi library])])
d35507
fi
d35507
d35507
AC_SUBST(AVAHI_LIBS)
d35507
AC_SUBST(AVAHI_CFLAGS)
d35507
d35507
dnl
d35507
dnl   LDAP configuration stuff for CUPS.
d35507
dnl
d35507
dnl   Copyright 2007-2011 by Apple Inc.
d35507
dnl   Copyright 2003-2006 by Easy Software Products, all rights reserved.
d35507
dnl
d35507
dnl   These coded instructions, statements, and computer programs are the
d35507
dnl   property of Apple Inc. and are protected by Federal copyright
d35507
dnl   law.  Distribution and use rights are outlined in the file "COPYING"
d35507
dnl   which should have been included with this file.
d35507
dnl
d35507
d35507
AC_ARG_ENABLE([ldap], [AS_HELP_STRING([--disable-ldap], [disable LDAP support.])],
d35507
        [enable_ldap="$enableval"],
d35507
        [enable_ldap=yes]
d35507
)
d35507
AC_ARG_WITH([ldap-libs], [AS_HELP_STRING([--with-ldap-libs], [set directory for LDAP library.])],
d35507
    LDFLAGS="-L$withval $LDFLAGS"
d35507
    DSOFLAGS="-L$withval $DSOFLAGS",)
d35507
AC_ARG_WITH([ldap-includes], [AS_HELP_STRING([--with-ldap-includes], [set directory for LDAP includes.])],
d35507
    CFLAGS="-I$withval $CFLAGS"
d35507
    CPPFLAGS="-I$withval $CPPFLAGS",)
d35507
d35507
if test x$enable_ldap != xno; then
d35507
d35507
    AC_CHECK_HEADER([ldap.h], [
d35507
	AC_SEARCH_LIBS([ldap_initialize], [ldap], [
d35507
	    AC_DEFINE([HAVE_LDAP], [], [Define if LDAP support should be enabled])
d35507
	    AC_DEFINE([HAVE_OPENLDAP], [], [If LDAP support is that of OpenLDAP])
d35507
	    AC_CHECK_LIB([ldap], [ldap_start_tls],
d35507
		AC_DEFINE([HAVE_LDAP_SSL], [], [If LDAP has SSL/TLS support enabled]))],[
d35507
d35507
	    AC_CHECK_LIB([ldap], [ldap_init], [
d35507
		AC_DEFINE([HAVE_LDAP], [], [Define if LDAP support should be enabled])
d35507
		AC_DEFINE([HAVE_MOZILLA_LDAP], [], [If LDAP support is that of Mozilla])
d35507
		AC_CHECK_HEADERS([ldap_ssl.h], [], [], [#include <ldap.h>])
d35507
		AC_CHECK_LIB([ldap], [ldapssl_init],
d35507
		    AC_DEFINE([HAVE_LDAP_SSL], [], [If LDAP has SSL/TLS support enabled]))])]
d35507
	)
d35507
	AC_CHECK_LIB([ldap], [ldap_set_rebind_proc], AC_DEFINE([HAVE_LDAP_REBIND_PROC], [], [If libldap implements ldap_set_rebind_proc]))
d35507
    ])
d35507
d35507
fi
d35507
d35507
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.30.2])
d35507
AC_SUBST(GLIB_CFLAGS)
d35507
AC_SUBST(GLIB_LIBS)
d35507
d35507
if test x$enable_avahi != xno; then
d35507
	PKG_CHECK_MODULES(AVAHI_GLIB, [avahi-glib])
d35507
fi
d35507
d35507
AC_SUBST(AVAHI_GLIB_CFLAGS)
d35507
AC_SUBST(AVAHI_GLIB_LIBS)
d35507
d35507
PKG_CHECK_MODULES(GIO, [gio-2.0])
d35507
AC_SUBST(GIO_CFLAGS)
d35507
AC_SUBST(GIO_LIBS)
d35507
d35507
PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0])
d35507
AC_SUBST(GIO_UNIX_CFLAGS)
d35507
AC_SUBST(GIO_UNIX_LIBS)
d35507
d35507
AC_ARG_WITH([browseremoteprotocols],
d35507
	[AS_HELP_STRING([--with-browseremoteprotocols=value], [Set which protocols to listen for in cups-browsed (default: dnssd cups)])],
d35507
	[with_browseremoteprotocols="$withval"],
d35507
	[with_browseremoteprotocols="dnssd cups"]
d35507
)
d35507
BROWSEREMOTEPROTOCOLS="$with_browseremoteprotocols"
d35507
AC_SUBST(BROWSEREMOTEPROTOCOLS)
d35507
d35507
dnl Setup init.d locations...
d35507
AC_ARG_WITH(rcdir, [AS_HELP_STRING([--with-rcdir], [Set path for rc scripts])],rcdir="$withval",rcdir="")
d35507
AC_ARG_WITH(rclevels, [AS_HELP_STRING([--with-rclevels], [Set run levels for rc scripts])],rclevels="$withval",rclevels="2 3 5")
d35507
AC_ARG_WITH(rcstart, [AS_HELP_STRING([--with-rcstart], [Set start number for rc scripts])],rcstart="$withval",rcstart="99")
d35507
AC_ARG_WITH(rcstop, [AS_HELP_STRING([--with-rcstop], [Set stop number for rc scripts])],rcstop="$withval",rcstop="00")
d35507
d35507
INITDIR=""
d35507
INITDDIR=""
d35507
RCLEVELS="$rclevels"
d35507
RCSTART="$rcstart"
d35507
RCSTOP="$rcstop"
d35507
d35507
if test x$rcdir = x; then
d35507
	case "`uname`" in
d35507
		FreeBSD* | OpenBSD* | MirBSD* | ekkoBSD*)
d35507
			# FreeBSD and OpenBSD
d35507
			;;
d35507
d35507
		Linux | GNU | GNU/k*BSD*)
d35507
			# Linux/HURD seems to choose an init.d directory at random...
d35507
			if test -d /sbin/init.d; then
d35507
				# SuSE
d35507
				INITDIR="/sbin/init.d"
d35507
			else
d35507
				if test -d /etc/init.d; then
d35507
					# Others
d35507
					INITDIR="/etc"
d35507
				else
d35507
					# RedHat
d35507
					INITDIR="/etc/rc.d"
d35507
				fi
d35507
			fi
d35507
			RCSTART="82"
d35507
			RCSTOP="35"
d35507
			;;
d35507
d35507
		NetBSD*)
d35507
			# NetBSD
d35507
			INITDDIR="/etc/rc.d"
d35507
			;;
d35507
d35507
		*)
d35507
			INITDIR="/etc"
d35507
			;;
d35507
d35507
	esac
d35507
elif test "x$rcdir" != xno; then
d35507
	if test "x$rclevels" = x; then
d35507
		INITDDIR="$rcdir"
d35507
	else
d35507
		INITDIR="$rcdir"
d35507
	fi
d35507
fi
d35507
d35507
AM_CONDITIONAL([RCLINKS], [test "x$INITDIR" != "x"])
d35507
d35507
if test "x${INITDIR}" != "x" -a "x${INITDDIR}" = "x"; then
d35507
   INITDDIR="${INITDIR}/init.d"
d35507
fi
d35507
d35507
AC_SUBST(INITDIR)
d35507
AC_SUBST(INITDDIR)
d35507
AC_SUBST(RCLEVELS)
d35507
AC_SUBST(RCSTART)
d35507
AC_SUBST(RCSTOP)
d35507
d35507
# ======================================
d35507
# Check for various pdf required modules
d35507
# ======================================
d35507
PKG_CHECK_MODULES([LCMS], [lcms2], [lcms2=yes], [lcms2=no])
d35507
AS_IF([test x"$lcms2" = "xno"], [
d35507
	PKG_CHECK_MODULES([LCMS], [lcms])
d35507
	AC_DEFINE([USE_LCMS1], [1], [Defines if use lcms1])
d35507
])
d35507
PKG_CHECK_MODULES([FREETYPE], [freetype2], [AC_DEFINE([HAVE_FREETYPE_H], [1], [Have FreeType2 include files])])
d35507
PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.0.0])
d35507
PKG_CHECK_MODULES([IJS], [ijs], [have_ijs=yes], [have_ijs=no])
d35507
PKG_CHECK_MODULES([ZLIB], [zlib])
d35507
AC_DEFINE([HAVE_LIBZ], [], [Define that we use zlib])
d35507
PKG_CHECK_MODULES([LIBQPDF], [libqpdf >= 3.0.2])
d35507
d35507
# =================
d35507
# Check for Poppler
d35507
# =================
d35507
AC_ARG_ENABLE(poppler, AS_HELP_STRING([--enable-poppler],[enable Poppler-based filters]),
d35507
	      enable_poppler=$enableval,enable_poppler=yes)
d35507
AM_CONDITIONAL(ENABLE_POPPLER, test x$enable_poppler = xyes)
d35507
if test x$enable_poppler = xyes; then
d35507
	PKG_CHECK_MODULES([POPPLER], [poppler >= 0.18])
d35507
	AC_CHECK_HEADER([poppler/cpp/poppler-version.h], [AC_DEFINE([HAVE_CPP_POPPLER_VERSION_H],,[Define if you have Poppler's "cpp/poppler-version.h" header file.])], [])
d35507
fi
d35507
d35507
# ===============
d35507
# Check for D-Bus
d35507
# ===============
d35507
AC_ARG_ENABLE(dbus, AS_HELP_STRING([--enable-dbus],[enable DBus CMS code]),
d35507
	      enable_dbus=$enableval,enable_dbus=yes)
d35507
AM_CONDITIONAL(BUILD_DBUS, test x$enable_dbus = xyes)
d35507
if test x$enable_dbus = xyes; then
d35507
	PKG_CHECK_MODULES(DBUS, dbus-1)
d35507
fi
d35507
d35507
# ===================================
d35507
# Check for large files and long long
d35507
# ===================================
d35507
AC_SYS_LARGEFILE
d35507
LARGEFILE=""
d35507
AS_IF([test x"$enable_largefile" != "xno"], [
d35507
	LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
d35507
	AS_IF([test x"$ac_cv_sys_large_files" = "x1"], [LARGEFILE="$LARGEFILE -D_LARGE_FILES"])
d35507
	AS_IF([test x"$ac_cv_sys_file_offset_bits" = "x64"], [LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"])
d35507
])
d35507
AC_SUBST(LARGEFILE)
d35507
d35507
AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no])
d35507
AS_IF([test x"$long_long_found" = "xyes"], [
d35507
	AC_DEFINE([HAVE_LONG_LONG], [], [Platform supports long long type])
d35507
])
d35507
d35507
# ================
d35507
# Check for pdf2ps
d35507
# ================
d35507
AC_ARG_WITH([pdftops],
d35507
	[AS_HELP_STRING([--with-pdftops=value], [Set which pdftops to use (gs,pdftops,pdftocairo,acroread).])],
d35507
	[with_pdftops="$withval"],
d35507
	[with_pdftops=gs]
d35507
)
d35507
AS_CASE([x$with_pdftops],
d35507
        [xgs|xpdftops|xpdftocairo|xacroread], [],
d35507
        [AC_MSG_ERROR([Unknown value of with-pdftops provided: $with_pdftops])]
d35507
)
d35507
AC_ARG_WITH([gs-path],
d35507
	[AS_HELP_STRING([--with-gs-path=value], [Set path to ghostcript binary (default: system).])],
d35507
	[with_gs_path="$withval"],
d35507
	[with_gs_path=system]
d35507
)
d35507
AC_ARG_WITH([pdftops-path],
d35507
        [AS_HELP_STRING([--with-pdftops-path=value], [Set path to pdftops/ghostscript binary (default: system).])],
d35507
        [with_pdftops_path="$withval"],
d35507
        [with_pdftops_path=system]
d35507
)
d35507
AC_ARG_WITH([pdftocairo-path],
d35507
        [AS_HELP_STRING([--with-pdftocairo-path=value], [Set path to pdftocairo binary (default: system).])],
d35507
        [with_pdftocairo_path="$withval"],
d35507
        [with_pdftocairo_path=system]
d35507
)
d35507
AC_ARG_WITH([acroread-path],
d35507
        [AS_HELP_STRING([--with-acroread-path=value], [Set path to acroread binary (default: system).])],
d35507
        [with_acroread_path="$withval"],
d35507
        [with_acroread_path=system]
d35507
)
d35507
AC_ARG_WITH([pdftops-maxres],
d35507
	[AS_HELP_STRING([--with-pdftops-maxres=value], [Set maximum image rendering resolution for pdftops filter (0, 75, 150, 300, 600, 1200, 2400, 4800, 90, 180, 360, 720, 1440, 2880, 5760, unlimited). Default: 1440])],
d35507
	[with_pdftops_maxres="$withval"],
d35507
	[with_pdftops_maxres=1440]
d35507
)
d35507
AS_CASE([x$with_pdftops_maxres],
d35507
	[x0|x75|x150|x300|x600|x1200|x2400|x4800|x90|x180|x360|x720|x1440|x2880|x5760], [CUPS_PDFTOPS_MAXRES=$with_pdftops_maxres],
d35507
	[xunlimited], [CUPS_PDFTOPS_MAXRES=0],
d35507
	[AC_MSG_ERROR([Unknown value of with-pdftops-maxres provided: $with_pdftops])]
d35507
)
d35507
d35507
AS_IF([test "x$with_gs_path" != "xsystem"], [
d35507
	CUPS_GHOSTSCRIPT="$with_gs_path"
d35507
], [
d35507
	AC_PATH_PROG(CUPS_GHOSTSCRIPT, [gs], [AC_MSG_ERROR([Required gs binary is missing. Please install ghostscript-gpl package.])])
d35507
])
d35507
AS_IF([test "x$CUPS_GHOSTSCRIPT" != "x"], [
d35507
	AC_DEFINE([HAVE_GHOSTSCRIPT], [], [Define that we provide ghostscript binary])
d35507
	AS_IF([test x"$with_pdftops" = xgs], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [GS], [Define default renderer])])
d35507
d35507
	AC_MSG_CHECKING(whether gs supports the ps2write device)
d35507
	AS_IF([`$CUPS_GHOSTSCRIPT -h 2>&1 | grep -q ps2write`], [
d35507
		AC_MSG_RESULT([yes])
d35507
		AC_DEFINE([HAVE_GHOSTSCRIPT_PS2WRITE], [], [gs supports ps2write])
d35507
	], [
d35507
		AC_MSG_RESULT([no])
d35507
	])
d35507
])
d35507
d35507
AS_IF([test "x$with_pdftops_path" != "xsystem"], [
d35507
	CUPS_PDFTOPS="$with_pdftops"
d35507
], [
d35507
	AC_PATH_PROG(CUPS_PDFTOPS, [pdftops], [AC_MSG_ERROR([Required pdftops is missing. Please install CUPS developer packages.])])
d35507
])
d35507
AS_IF([test "x$CUPS_PDFTOPS" != "x"], [
d35507
	AC_DEFINE([HAVE_POPPLER_PDFTOPS], [], [Define that we provide poppler pdftops.])
d35507
	AS_IF([test x"$with_pdftops" = xpdftops], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [PDFTOPS], [Define default renderer])])
d35507
d35507
	AC_MSG_CHECKING([whether pdftops supports -origpagesizes])
d35507
	AS_IF([`$CUPS_PDFTOPS -h 2>&1 | grep -q -- -origpagesizes`], [
d35507
        	AC_MSG_RESULT([yes])
d35507
		AC_DEFINE([HAVE_POPPLER_PDFTOPS_WITH_ORIGPAGESIZES], [] , [pdftops supports -origpagesizes.])
d35507
	], [
d35507
	        AC_MSG_RESULT([no])
d35507
	])
d35507
	AC_MSG_CHECKING([whether pdftops supports -r])
d35507
	AS_IF([`$CUPS_PDFTOPS -h 2>&1 | grep -q -- '-r '`], [
d35507
	        AC_MSG_RESULT([yes])
d35507
		AC_DEFINE([HAVE_POPPLER_PDFTOPS_WITH_RESOLUTION], [] , [pdftops supports -r argument.])
d35507
	], [
d35507
        	AC_MSG_RESULT([no])
d35507
	])
d35507
])
d35507
AS_IF([test "x$with_pdftocairo_path" != "xsystem"], [
d35507
	CUPS_PDFTOPS="$with_pdftocairo_path"
d35507
], [
d35507
	AC_PATH_PROG(CUPS_PDFTOCAIRO, [pdftocairo], [AC_MSG_ERROR([Required pdftocairo is missing. Please install Poppler developer packages.])])
d35507
])
d35507
AS_IF([test "x$CUPS_PDFTOCAIRO" != "x"], [
d35507
	AC_DEFINE([HAVE_POPPLER_PDFTOCAIRO], [], [Define that we provide poppler pdftocairo.])
d35507
	AS_IF([test x"$with_pdftops" = xpdftocairo], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [PDFTOCAIRO], [Define default renderer])])
d35507
])
d35507
AS_IF([test "x$with_acroread_path" != "xsystem"], [
d35507
	CUPS_ACROREAD="$with_acroread_path"
d35507
], [
d35507
	AC_PATH_PROG(CUPS_ACROREAD, [acroread], [AC_MSG_ERROR([Required acroread binary is missing. Please install acroread package.])])
d35507
])
d35507
AS_IF([test "x$CUPS_ACROREAD" != "x"], [
d35507
	AC_DEFINE([HAVE_ACROREAD], [], [Define that we provide acroread.])
d35507
	AS_IF([test x"$with_pdftops" = xacroread], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [ACROREAD], [Define default renderer])])
d35507
])
d35507
d35507
AC_DEFINE_UNQUOTED([CUPS_GHOSTSCRIPT], "$CUPS_GHOSTSCRIPT", [gs binary to use])
d35507
AC_DEFINE_UNQUOTED([CUPS_POPPLER_PDFTOPS], "$CUPS_PDFTOPS", [pdftops binary to use.])
d35507
AC_DEFINE_UNQUOTED([CUPS_POPPLER_PDFTOCAIRO], "$CUPS_PDFTOCAIRO", [pdftocairo binary to use.])
d35507
AC_DEFINE_UNQUOTED([CUPS_ACROREAD], "$CUPS_ACROREAD", [acroread binary to use.])
d35507
AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_MAX_RESOLUTION], [$CUPS_PDFTOPS_MAXRES], [max resolution used for pdftops when converting images])
d35507
d35507
# =============
d35507
# Check for php
d35507
# =============
d35507
# NOTE: This stuff is broken, requires internal cups headers.
d35507
AC_ARG_WITH([php],
d35507
	[AS_HELP_STRING([--with-php], [Determine whether to build php cups extension.])],
d35507
	[with_php="$withval"],
d35507
	[with_php=no]
d35507
)
d35507
AC_ARG_WITH([php-config],
d35507
	[AS_HELP_STRING([--with-php-config=path], [Specify path to php-config executable.])],
d35507
	[with_php_config="$withval"],
d35507
	[with_php_config=system]
d35507
)
d35507
AM_CONDITIONAL([WITH_PHP], [test "x$with_php" = "xyes"])
d35507
AS_IF([test x"$with_php" = "xyes"], [
d35507
	AS_IF([test "x$with_php_config" != "xsystem"], [
d35507
		PHPCONFIG=$with_php_config
d35507
	], [
d35507
		AC_PATH_PROG(PHPCONFIG, [php-config])
d35507
		AS_IF([test -z "$PHPCONFIG"], [
d35507
			AC_MSG_ERROR([Required php-config is missing. Please install PHP developer packages.])
d35507
		])
d35507
	])
d35507
	PHPDIR="`$PHPCONFIG --extension-dir`"
d35507
	AC_SUBST(PHPDIR)
d35507
])
d35507
d35507
# =========
d35507
# Test ARGS
d35507
# =========
d35507
AC_ARG_WITH([test-font-path],
d35507
	[AS_HELP_STRING([--with-test-font-path=value], [Set path to pdftops/ghostscript binary (default: /usr/share/fonts/dejavu/DejaVuSans.ttf).])],
d35507
	[with_test_font_path="$withval"],
d35507
	[with_test_font_path="/usr/share/fonts/dejavu/DejaVuSans.ttf"]
d35507
)
d35507
AC_DEFINE_UNQUOTED([TESTFONT], ["$with_test_font_path"], [Path to font used in tests])
d35507
d35507
# ================
d35507
# Check for cflags
d35507
# ================
d35507
AC_ARG_ENABLE([werror],
d35507
	[AS_HELP_STRING([--enable-werror], [Treat all warnings as errors, useful for development.])],
d35507
	[enable_werror="$enableval"],
d35507
	[enable_werror=no]
d35507
)
d35507
AS_IF([test x"$enable_werror" = "xyes"], [
d35507
	CFLAGS="$CFLAGS -Werror"
d35507
])
d35507
AS_IF([test x"$GCC" = "xyes"], [
d35507
	# Be tough with warnings and produce less careless code
d35507
	CFLAGS="$CFLAGS -Wall -pedantic -std=gnu99"
d35507
	CXXFLAGS="$CXXFLAGS -Wall -pedantic" # -Weffc++" # TODO: enable when it does not print 1MB of warnings
d35507
])
d35507
CFLAGS="$CFLAGS -D_GNU_SOURCE"
d35507
CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE"
d35507
d35507
# =====================
d35507
# Prepare all .in files
d35507
# =====================
d35507
AC_CONFIG_FILES([
d35507
	libcupsfilters.pc
d35507
	libfontembed.pc
d35507
	Makefile
d35507
	utils/cups-browsed
d35507
	utils/cups-browsed.conf
d35507
])
d35507
AC_OUTPUT
d35507
d35507
# ==============================================
d35507
# Display final informations about configuration
d35507
# ==============================================
d35507
AC_MSG_NOTICE([
d35507
==============================================================================
d35507
Environment settings:
d35507
	CFLAGS:          ${CFLAGS}
d35507
	CXXFLAGS:        ${CXXFLAGS}
d35507
	LDFLAGS:         ${LDFLAGS}
d35507
Build configuration:
d35507
	cups-config:     ${with_cups_config}
d35507
	font directory:  ${sysconfdir}/${FONTDIR}
d35507
	init directory:  ${INITDDIR}
d35507
	cups dom socket: ${CUPS_DEFAULT_DOMAINSOCKET}
d35507
	gs-path:         ${with_gs_path}
d35507
	imagefilters:    ${enable_imagefilters}
d35507
	jpeg:            ${with_jpeg}
d35507
	pdftocairo-path: ${with_pdftocairo_path}
d35507
	pdftops:         ${with_pdftops}
d35507
	pdftops-path:    ${with_pdftops_path}
d35507
	png:             ${with_png}
d35507
	php:             ${with_php}
d35507
	php-config:      ${with_php_config}
d35507
	test-font:       ${with_test_font_path}
d35507
	tiff:            ${with_tiff}
d35507
	avahi:           ${enable_avahi}
d35507
	dbus:            ${enable_dbus}
d35507
	browsing:        ${with_browseremoteprotocols}
d35507
	werror:          ${enable_werror}
d35507
==============================================================================
d35507
])