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