• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Process this file with autoconf to create configure.
2
3AC_PREREQ([2.65])
4
5# ====================
6# Version informations
7# ====================
8m4_define([cups_filters_version_major],[1])
9m4_define([cups_filters_version_minor],[28])
10m4_define([cups_filters_version_micro],[17])
11m4_define([cups_filters_version],[cups_filters_version_major.cups_filters_version_minor.cups_filters_version_micro])
12
13# =============
14# Automake init
15# =============
16AC_INIT([cups-filters],[cups_filters_version])
17AC_CONFIG_MACRO_DIR([m4])
18m4_include([m4/ac_define_dir.m4])
19m4_include([m4/ax_compare_version.m4])
20m4_include([m4/basic-directories.m4])
21AM_INIT_AUTOMAKE([1.11 gnu dist-xz dist-bzip2 subdir-objects])
22AM_SILENT_RULES([yes])
23AC_LANG([C++])
24AC_CONFIG_HEADERS([config.h])
25# Extra defines for the config.h
26AH_BOTTOM([
27#ifdef HAVE_LONG_LONG
28#  define CUPS_LLFMT   "%lld"
29#  define CUPS_LLCAST  (long long)
30#else
31#  define CUPS_LLFMT   "%ld"
32#  define CUPS_LLCAST  (long)
33#endif /* HAVE_LONG_LONG */
34
35#ifdef HAVE_ARC4RANDOM
36#  define CUPS_RAND() arc4random()
37#  define CUPS_SRAND(v) arc4random_stir()
38#elif defined(HAVE_RANDOM)
39#  define CUPS_RAND() random()
40#  define CUPS_SRAND(v) srandom(v)
41#elif defined(HAVE_LRAND48)
42#  define CUPS_RAND() lrand48()
43#  define CUPS_SRAND(v) srand48(v)
44#else
45#  define CUPS_RAND() rand()
46#  define CUPS_SRAND(v) srand(v)
47#endif /* HAVE_ARC4RANDOM */
48])
49
50# ===========================
51# Find required base packages
52# ===========================
53AC_PROG_CC
54AC_PROG_CXX
55AX_CXX_COMPILE_STDCXX([11],[noext],[mandatory])
56AM_PROG_CC_C_O
57AM_ICONV
58AC_PROG_CPP
59AC_PROG_INSTALL
60AC_PROG_LN_S
61AS_LN_SRF_PREPARE
62AC_PROG_LN_SRF
63AC_PROG_MAKE_SET
64AC_PROG_LIBTOOL
65PKG_PROG_PKG_CONFIG([0.20])
66
67AM_GNU_GETTEXT_VERSION([0.18.3])
68AM_GNU_GETTEXT([external])
69
70# ========================================
71# Specify the fontdir patch if not default
72# ========================================
73AC_ARG_WITH([fontdir],
74	[AS_HELP_STRING([--with-fontdir=path], [Specify path to font config directory (default: fonts/conf.d/).])],
75	[FONTDIR="$withval"],
76	[FONTDIR="fonts/conf.d"]
77)
78AC_SUBST(FONTDIR)
79
80# ================================
81# Find CUPS internals (no pc file)
82# ================================
83AC_ARG_WITH([cups-config],
84	[AS_HELP_STRING([--with-cups-config=path], [Specify path to cups-config executable.])],
85	[with_cups_config="$withval"],
86	[with_cups_config=system]
87)
88
89AS_IF([test "x$with_cups_config" != "xsystem"], [
90	CUPSCONFIG=$with_cups_config
91], [
92	AC_PATH_TOOL(CUPSCONFIG, [cups-config])
93	AS_IF([test -z "$CUPSCONFIG"], [
94		AC_MSG_ERROR([Required cups-config is missing. Please install CUPS developer packages.])
95	])
96])
97CUPS_CFLAGS=`$CUPSCONFIG --cflags`' -D_PPD_DEPRECATED=""'
98CUPS_LIBS=`$CUPSCONFIG --image --libs`
99CUPS_VERSION=`$CUPSCONFIG --version`
100AC_SUBST(CUPS_CFLAGS)
101AC_SUBST(CUPS_LIBS)
102
103CUPS_DATADIR="`$CUPSCONFIG --datadir`"
104AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$CUPS_DATADIR", [CUPS datadir])
105AC_SUBST(CUPS_DATADIR)
106
107CUPS_SERVERROOT="`$CUPSCONFIG --serverroot`"
108AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$CUPS_SERVERROOT", [CUPS serverroot])
109AC_SUBST(CUPS_SERVERROOT)
110
111CUPS_FONTPATH="$CUPS_DATADIR/fonts"
112AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$CUPS_FONTPATH", [Path to CUPS fonts dir])
113AC_SUBST(CUPS_FONTPATH)
114
115CUPS_SERVERBIN="`$CUPSCONFIG --serverbin`"
116AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$CUPS_SERVERBIN", [Path to CUPS binaries dir])
117AC_SUBST(CUPS_SERVERBIN)
118
119AX_COMPARE_VERSION([$CUPS_VERSION],[gt],[1.4], [
120	AC_DEFINE(CUPS_1_4, 1, [CUPS Version is 1.4 or newer])
121])
122
123AC_ARG_ENABLE([driverless], [AS_HELP_STRING([--enable-driverless], [enable PPD generator for driverless printing in /usr/lib/cups/driver/, for manual setup of driverless printers with printer setup tool.])],
124        [enable_driverless="$enableval"],
125        [enable_driverless=yes]
126)
127AX_COMPARE_VERSION([$CUPS_VERSION],[lt],[1.6], [
128	enable_driverless=no
129])
130AM_CONDITIONAL([ENABLE_DRIVERLESS],
131[test "x$enable_driverless" != "xno"])
132
133APPLE_RASTER_FILTER=rastertopdf
134AX_COMPARE_VERSION([$CUPS_VERSION],[lt],[2.2.2], [
135	APPLE_RASTER_FILTER=urftopdf
136])
137AC_ARG_WITH([apple-raster-filter],
138	[AS_HELP_STRING([--with-apple-raster-filter=rastertopdf|urftopdf], [Select filter for Apple Raster input. Default: rastertopdf for CUPS 2.2.2+, urftopdf for older CUPS])],
139	[with_apple_raster_filter="$withval"],
140	[with_apple_raster_filter="$APPLE_RASTER_FILTER"]
141)
142AS_CASE([x$with_apple_raster_filter],
143	[xrastertopdf|xurftopdf], [APPLE_RASTER_FILTER=$with_apple_raster_filter],
144	[AC_MSG_ERROR([Unknown value of with-apple-raster-filter provided: $with_apple_raster_filter])]
145)
146AM_CONDITIONAL([ENABLE_URFTOPDF],
147	       [test "x$APPLE_RASTER_FILTER" = "xurftopdf"])
148AC_SUBST(APPLE_RASTER_FILTER)
149
150AC_DEFINE(PDFTOPDF, [], [Needed for pdftopdf filter compilation])
151AC_DEFINE_DIR(BANNERTOPDF_DATADIR, "{CUPS_DATADIR}/data", [Directory where bannertopdf finds its data files (PDF templates)])
152
153AC_ARG_ENABLE([auto-setup-local-only], [AS_HELP_STRING([--enable-auto-setup-local-only], [enable automatic setup of only local IPP printers.])],
154        [enable_auto_setup_local_only="$enableval"],
155        [enable_auto_setup_local_only=no]
156)
157if test "x$enable_auto_setup_local_only" != "xno"; then
158	AC_DEFINE([ONLY_LOCAL_IPP_PRINTERS_AUTO_SETUP], [], [Auto-setup only local IPP network printers?])
159fi
160
161AC_ARG_ENABLE([auto-setup-driverless-only], [AS_HELP_STRING([--enable-auto-setup-driverless-only], [enable automatic setup of only IPP network printers with driverless printing support.])],
162        [enable_auto_setup_driverless_only="$enableval"],
163        [enable_auto_setup_driverless_only=no]
164)
165if test "x$enable_auto_setup_driverless_only" != "xno"; then
166	AC_DEFINE([ONLY_DRIVERLESS_IPP_PRINTERS_AUTO_SETUP], [], [Auto-setup only driverless IPP network printers?])
167fi
168
169if test "x$enable_auto_setup_local_only" != "xno"; then
170	enable_auto_setup_driverless_only=no
171	enable_auto_setup_all=no
172else
173	if test "x$enable_auto_setup_driverless_only" != "xno"; then
174		enable_auto_setup_all=no
175	else
176		enable_auto_setup_all=yes
177	fi
178fi
179
180AC_SEARCH_LIBS([dlopen],
181	[dl],
182	[AS_IF([test "$ac_cv_search_dlopen" != "none required"], [
183		DLOPEN_LIBS="$ac_cv_search_dlopen"
184	])],
185	AC_MSG_ERROR([unable to find the dlopen() function])
186)
187AC_SUBST(DLOPEN_LIBS)
188
189# Transient run-time state dir of CUPS
190CUPS_STATEDIR=""
191AC_ARG_WITH(cups-rundir, [  --with-cups-rundir           set transient run-time state directory of CUPS],CUPS_STATEDIR="$withval",[
192        case "$uname" in
193                Darwin*)
194                        # Darwin (OS X)
195                        CUPS_STATEDIR="$CUPS_SERVERROOT"
196                        ;;
197                *)
198                        # All others
199                        CUPS_STATEDIR="$localstatedir/run/cups"
200                        ;;
201        esac])
202AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR", [Transient run-time state dir of CUPS])
203AC_SUBST(CUPS_STATEDIR)
204
205# Domain socket of CUPS...
206CUPS_DEFAULT_DOMAINSOCKET=""
207AC_ARG_WITH(cups-domainsocket, [  --with-cups-domainsocket     set unix domain socket name used by CUPS
208],
209        default_domainsocket="$withval",
210        default_domainsocket="")
211
212if test x$enable_domainsocket != xno -a x$default_domainsocket != xno; then
213        if test "x$default_domainsocket" = x; then
214                case "$uname" in
215                        Darwin*)
216                                # Darwin and MaxOS X do their own thing...
217                                CUPS_DEFAULT_DOMAINSOCKET="$localstatedir/run/cupsd"
218                                ;;
219                        *)
220                                # All others use FHS standard...
221                                CUPS_DEFAULT_DOMAINSOCKET="$CUPS_STATEDIR/cups.sock"
222                                ;;
223                esac
224        else
225                CUPS_DEFAULT_DOMAINSOCKET="$default_domainsocket"
226        fi
227fi
228AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DOMAINSOCKET, "$CUPS_DEFAULT_DOMAINSOCKET", "Domain socket of CUPS")
229AC_SUBST(CUPS_DEFAULT_DOMAINSOCKET)
230
231# ======================
232# Check system functions
233# ======================
234AC_CHECK_FUNCS(strlcat)
235AC_CHECK_FUNCS(strlcpy)
236AC_CHECK_FUNCS(sigaction)
237AC_CHECK_FUNCS(waitpid wait3)
238AC_CHECK_FUNCS(strtoll)
239AC_CHECK_FUNCS(open_memstream)
240AC_CHECK_FUNCS(getline,[],AC_SUBST([GETLINE],['bannertopdf-getline.$(OBJEXT)']))
241AC_CHECK_FUNCS(strcasestr,[],AC_SUBST([STRCASESTR],['pdftops-strcasestr.$(OBJEXT)']))
242AC_SEARCH_LIBS(pow, m)
243
244# ========================
245# Check for system headers
246# ========================
247AC_CHECK_HEADERS([stdlib.h])
248AC_CHECK_HEADERS([sys/stat.h])
249AC_CHECK_HEADERS([sys/types.h])
250AC_CHECK_HEADERS([unistd.h])
251AC_CHECK_HEADERS([zlib.h])
252AC_CHECK_HEADERS([endian.h])
253AC_CHECK_HEADERS([dirent.h])
254AC_CHECK_HEADERS([sys/ioctl.h])
255
256# =============
257# Image options
258# =============
259AC_ARG_ENABLE([imagefilters],
260	[AS_HELP_STRING([--disable-imagefilters], [Build the image filters.])],
261	[enable_imagefilters="$enableval"],
262	[enable_imagefilters=yes]
263)
264AM_CONDITIONAL([ENABLE_IMAGEFILTERS], [test "x$enable_imagefilters" != "xno"])
265
266# Libraries
267AC_ARG_WITH([jpeg],
268	[AS_HELP_STRING([--without-jpeg], [Disable jpeg support.])],
269	[with_jpeg="$withval"],
270	[with_jpeg=yes]
271)
272AS_IF([test x"$with_jpeg" != "xno"], [
273	AC_DEFINE([HAVE_LIBJPEG], [], [Defines if we provide jpeg library.])
274	AC_CHECK_HEADERS([jpeglib.h])
275	AC_SEARCH_LIBS([jpeg_destroy_decompress],
276		[jpeg],
277		LIBJPEG_LIBS="-ljpeg",
278		AC_MSG_ERROR([jpeg libraries not found.])
279	)
280	AC_SUBST(LIBJPEG_LIBS)
281])
282
283AC_ARG_WITH([png],
284	[AS_HELP_STRING([--without-png], [Disable png support.])],
285	[with_png="$withval"],
286	[with_png=yes]
287)
288AS_IF([test x"$with_png" != "xno"], [
289	PKG_CHECK_MODULES([LIBPNG], [libpng])
290	AC_DEFINE([HAVE_LIBPNG], [], [Defines if we provide png library.])
291])
292
293AC_ARG_WITH([tiff],
294	[AS_HELP_STRING([--without-tiff], [Disable tiff support.])],
295	[with_tiff="$withval"],
296	[with_tiff=yes]
297)
298AS_IF([test x"$with_tiff" != "xno"], [
299	AC_DEFINE([HAVE_LIBTIFF], [], [Defines if we provide tiff library.])
300	AC_CHECK_HEADERS([tiff.h])
301	AC_SEARCH_LIBS([TIFFReadScanline],
302		[tiff],
303		LIBJPEG_LIBS="-ltiff",
304		AC_MSG_ERROR([tiff libraries not found.])
305	)
306	AC_SUBST(LIBTIFF_LIBS)
307])
308
309# ==================================
310# Check for modules needed by utils/
311# ==================================
312
313dnl including EXIF library
314EXIF_LIBS=""
315EXIF_CFLAGS=""
316
317AC_ARG_ENABLE([exif],
318	[AS_HELP_STRING([--disable-exif], [Disable exif metadata readout from images])],
319	[enable_exif="$enableval"],
320	[enable_exif=yes]
321)
322AM_CONDITIONAL([ENABLE_EXIF], [test "x$enable_exif" != "xno"])
323
324AC_ARG_WITH(exif-libs,
325	[AS_HELP_STRING([--with-exif-libs], [Set directory for exif library.])],
326	EXIF_LIBS="-L$withval $EXIF_LIBS",)
327AC_ARG_WITH(exif-includes,
328	[AS_HELP_STRING([--with-exif-includes], [Set directory for exif includes.])],
329	EXIF_CFLAGS="-I$withval $EXIF_CFLAGS",)
330
331if test "x$enable_exif" != xno; then
332	PKG_CHECK_MODULES(EXIF, libexif,
333		[AC_DEFINE(HAVE_EXIF, [], [Define if you have the libexif library])])
334fi
335
336AC_SUBST(EXIF_LIBS)
337AC_SUBST(EXIF_CFLAGS)
338
339dnl Avahi for cups-browsed
340AVAHI_LIBS=""
341AVAHI_CFLAGS=""
342AVAHI_GLIB_CFLAGS=""
343AVAHI_GLIB_LIBS=""
344
345AC_ARG_ENABLE([avahi],
346	[AS_HELP_STRING([--disable-avahi], [Disable DNS Service Discovery support using Avahi.])],
347	[enable_avahi="$enableval"],
348	[enable_avahi=yes]
349)
350AM_CONDITIONAL([ENABLE_AVAHI], [test "x$enable_avahi" != "xno"])
351
352AC_ARG_WITH(avahi-libs,
353	[AS_HELP_STRING([--with-avahi-libs], [Set directory for Avahi library.])],
354	AVAHI_LIBS="-L$withval $AVAHI_LIBS",)
355AC_ARG_WITH(avahi-includes,
356	[AS_HELP_STRING([--with-avahi-includes], [Set directory for Avahi includes])],
357	AVAHI_CFLAGS="-I$withval $AVAHI_CFLAGS",)
358
359if test "x$enable_avahi" != xno; then
360	PKG_CHECK_MODULES(AVAHI, avahi-client,
361		[AC_DEFINE(HAVE_AVAHI, [], [Define if you have the avahi library])])
362fi
363
364AC_SUBST(AVAHI_LIBS)
365AC_SUBST(AVAHI_CFLAGS)
366
367dnl
368dnl   LDAP configuration stuff for CUPS.
369dnl
370dnl   Copyright 2007-2011 by Apple Inc.
371dnl   Copyright 2003-2006 by Easy Software Products, all rights reserved.
372dnl
373dnl   These coded instructions, statements, and computer programs are the
374dnl   property of Apple Inc. and are protected by Federal copyright
375dnl   law.  Distribution and use rights are outlined in the file "COPYING"
376dnl   which should have been included with this file.
377dnl
378
379AC_ARG_ENABLE([ldap], [AS_HELP_STRING([--disable-ldap], [disable LDAP support.])],
380        [enable_ldap="$enableval"],
381        [enable_ldap=yes]
382)
383AC_ARG_WITH([ldap-libs], [AS_HELP_STRING([--with-ldap-libs], [set directory for LDAP library.])],
384    LDFLAGS="-L$withval $LDFLAGS"
385    DSOFLAGS="-L$withval $DSOFLAGS",)
386AC_ARG_WITH([ldap-includes], [AS_HELP_STRING([--with-ldap-includes], [set directory for LDAP includes.])],
387    CFLAGS="-I$withval $CFLAGS"
388    CPPFLAGS="-I$withval $CPPFLAGS",)
389
390if test x$enable_ldap != xno; then
391
392    AC_CHECK_HEADER([ldap.h], [
393	AC_SEARCH_LIBS([ldap_initialize], [ldap], [
394	    AC_DEFINE([HAVE_LDAP], [], [Define if LDAP support should be enabled])
395	    AC_DEFINE([HAVE_OPENLDAP], [], [If LDAP support is that of OpenLDAP])
396	    AC_CHECK_LIB([ldap], [ldap_start_tls],
397		AC_DEFINE([HAVE_LDAP_SSL], [], [If LDAP has SSL/TLS support enabled]))],[
398
399	    AC_CHECK_LIB([ldap], [ldap_init], [
400		AC_DEFINE([HAVE_LDAP], [], [Define if LDAP support should be enabled])
401		AC_DEFINE([HAVE_MOZILLA_LDAP], [], [If LDAP support is that of Mozilla])
402		AC_CHECK_HEADERS([ldap_ssl.h], [], [], [#include <ldap.h>])
403		AC_CHECK_LIB([ldap], [ldapssl_init],
404		    AC_DEFINE([HAVE_LDAP_SSL], [], [If LDAP has SSL/TLS support enabled]))])]
405	)
406	AC_CHECK_LIB([ldap], [ldap_set_rebind_proc], AC_DEFINE([HAVE_LDAP_REBIND_PROC], [], [If libldap implements ldap_set_rebind_proc]))
407    ])
408
409fi
410
411PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.30.2])
412AC_SUBST(GLIB_CFLAGS)
413AC_SUBST(GLIB_LIBS)
414
415if test x$enable_avahi != xno; then
416	PKG_CHECK_MODULES(AVAHI_GLIB, [avahi-glib])
417fi
418
419AC_SUBST(AVAHI_GLIB_CFLAGS)
420AC_SUBST(AVAHI_GLIB_LIBS)
421
422PKG_CHECK_MODULES(GIO, [gio-2.0])
423AC_SUBST(GIO_CFLAGS)
424AC_SUBST(GIO_LIBS)
425
426PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0])
427AC_SUBST(GIO_UNIX_CFLAGS)
428AC_SUBST(GIO_UNIX_LIBS)
429
430AC_ARG_WITH([browseremoteprotocols],
431	[AS_HELP_STRING([--with-browseremoteprotocols=value], [Set which protocols to listen for in cups-browsed (default: dnssd cups)])],
432	[with_browseremoteprotocols="$withval"],
433	[with_browseremoteprotocols="dnssd cups"]
434)
435BROWSEREMOTEPROTOCOLS="$with_browseremoteprotocols"
436AC_SUBST(BROWSEREMOTEPROTOCOLS)
437
438dnl Setup init.d locations...
439AC_ARG_WITH(rcdir, [AS_HELP_STRING([--with-rcdir], [Set path for rc scripts])],rcdir="$withval",rcdir="")
440AC_ARG_WITH(rclevels, [AS_HELP_STRING([--with-rclevels], [Set run levels for rc scripts])],rclevels="$withval",rclevels="2 3 5")
441AC_ARG_WITH(rcstart, [AS_HELP_STRING([--with-rcstart], [Set start number for rc scripts])],rcstart="$withval",rcstart="99")
442AC_ARG_WITH(rcstop, [AS_HELP_STRING([--with-rcstop], [Set stop number for rc scripts])],rcstop="$withval",rcstop="00")
443
444INITDIR=""
445INITDDIR=""
446RCLEVELS="$rclevels"
447RCSTART="$rcstart"
448RCSTOP="$rcstop"
449
450if test x$rcdir = x; then
451	case "`uname`" in
452		FreeBSD* | OpenBSD* | MirBSD* | ekkoBSD*)
453			# FreeBSD and OpenBSD
454			;;
455
456		Linux | GNU | GNU/k*BSD*)
457			# Linux/HURD seems to choose an init.d directory at random...
458			if test -d /sbin/init.d; then
459				# SuSE
460				INITDIR="/sbin/init.d"
461			else
462				if test -d /etc/init.d; then
463					# Others
464					INITDIR="/etc"
465				else
466					# RedHat
467					INITDIR="/etc/rc.d"
468				fi
469			fi
470			RCSTART="82"
471			RCSTOP="35"
472			;;
473
474		NetBSD*)
475			# NetBSD
476			INITDDIR="/etc/rc.d"
477			;;
478
479		*)
480			INITDIR="/etc"
481			;;
482
483	esac
484elif test "x$rcdir" != xno; then
485	if test "x$rclevels" = x; then
486		INITDDIR="$rcdir"
487	else
488		INITDIR="$rcdir"
489	fi
490fi
491
492AM_CONDITIONAL([RCLINKS], [test "x$INITDIR" != "x"])
493
494if test "x${INITDIR}" != "x" -a "x${INITDDIR}" = "x"; then
495   INITDDIR="${INITDIR}/init.d"
496fi
497
498AC_SUBST(INITDIR)
499AC_SUBST(INITDDIR)
500AC_SUBST(RCLEVELS)
501AC_SUBST(RCSTART)
502AC_SUBST(RCSTOP)
503
504# ======================================
505# Check for various pdf required modules
506# ======================================
507PKG_CHECK_MODULES([LCMS], [lcms2], [lcms2=yes], [lcms2=no])
508AS_IF([test x"$lcms2" = "xno"], [
509	PKG_CHECK_MODULES([LCMS], [lcms])
510	AC_DEFINE([USE_LCMS1], [1], [Defines if use lcms1])
511])
512PKG_CHECK_MODULES([FREETYPE], [freetype2], [AC_DEFINE([HAVE_FREETYPE_H], [1], [Have FreeType2 include files])])
513PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.0.0])
514PKG_CHECK_MODULES([ZLIB], [zlib])
515AC_DEFINE([HAVE_LIBZ], [], [Define that we use zlib])
516PKG_CHECK_MODULES([LIBQPDF], [libqpdf >= 8.3.0])
517
518# ===============================
519# Check for PCLm printing support
520# ===============================
521AC_ARG_ENABLE([pclm], [AS_HELP_STRING([--enable-pclm], [enable PCLm printing.])],
522	[enable_pclm="$enableval"],
523	[enable_pclm=yes]
524)
525if test "x$enable_pclm" != "xno"; then
526	AC_DEFINE([QPDF_HAVE_PCLM], [1], [QPDF has PCLm support?])
527	QPDF_NO_PCLM=
528else
529	QPDF_NO_PCLM=\#
530fi
531AC_SUBST(QPDF_NO_PCLM)
532
533
534
535# =================
536# Check for Poppler
537# =================
538AC_ARG_ENABLE(poppler, AS_HELP_STRING([--enable-poppler],[enable Poppler-based filters]),
539	      enable_poppler=$enableval,enable_poppler=yes)
540AM_CONDITIONAL(ENABLE_POPPLER, test x$enable_poppler = xyes)
541if test x$enable_poppler = xyes; then
542	PKG_CHECK_MODULES([POPPLER], [poppler-cpp >= 0.19])
543	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.])], [])
544fi
545
546# ===============
547# Check for D-Bus
548# ===============
549AC_ARG_ENABLE(dbus, AS_HELP_STRING([--enable-dbus],[enable DBus CMS code]),
550	      enable_dbus=$enableval,enable_dbus=yes)
551AM_CONDITIONAL(BUILD_DBUS, test x$enable_dbus = xyes)
552if test x$enable_dbus = xyes; then
553	PKG_CHECK_MODULES(DBUS, dbus-1)
554fi
555
556# ===================================
557# Check for large files and long long
558# ===================================
559AC_SYS_LARGEFILE
560LARGEFILE=""
561AS_IF([test x"$enable_largefile" != "xno"], [
562	LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
563	AS_IF([test x"$ac_cv_sys_large_files" = "x1"], [LARGEFILE="$LARGEFILE -D_LARGE_FILES"])
564	AS_IF([test x"$ac_cv_sys_file_offset_bits" = "x64"], [LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"])
565])
566AC_SUBST(LARGEFILE)
567
568AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no])
569AS_IF([test x"$long_long_found" = "xyes"], [
570	AC_DEFINE([HAVE_LONG_LONG], [], [Platform supports long long type])
571])
572
573# ================
574# Check for Mutool
575# ================
576AC_ARG_ENABLE([mutool],
577	[AS_HELP_STRING([--disable-mutool], [Disable filters using mutool.])],
578	[enable_mutool="$enableval"],
579	[enable_mutool=yes]
580)
581
582AC_ARG_WITH([mutool-path],
583	[AS_HELP_STRING([--with-mutool-path=value], [Set path to mutool binary (default: system).])],
584	[with_mutool_path="$withval"],
585	[with_mutool_path=system]
586)
587
588# ================
589# Check for pdf2ps
590# ================
591AC_ARG_ENABLE([ghostscript],
592	[AS_HELP_STRING([--disable-ghostscript], [Disable filters using Ghostscript.])],
593	[enable_ghostscript="$enableval"],
594	[enable_ghostscript=yes]
595)
596AC_ARG_WITH([pdftops],
597	[AS_HELP_STRING([--with-pdftops=value], [Set which pdftops to use (gs,pdftops,pdftocairo,acroread,mupdf,hybrid).])],
598	[with_pdftops="$withval"],
599	[with_pdftops=hybrid]
600)
601AS_CASE([x$with_pdftops],
602        [xgs|xpdftops|xpdftocairo|xacroread|xmupdf|xhybrid], [],
603        [AC_MSG_ERROR([Unknown value of with-pdftops provided: $with_pdftops])]
604)
605AC_ARG_WITH([gs-path],
606	[AS_HELP_STRING([--with-gs-path=value], [Set path to ghostcript binary (default: system).])],
607	[with_gs_path="$withval"],
608	[with_gs_path=system]
609)
610AC_ARG_WITH([pdftops-path],
611        [AS_HELP_STRING([--with-pdftops-path=value], [Set path to pdftops/ghostscript binary (default: system).])],
612        [with_pdftops_path="$withval"],
613        [with_pdftops_path=system]
614)
615AC_ARG_WITH([pdftocairo-path],
616        [AS_HELP_STRING([--with-pdftocairo-path=value], [Set path to pdftocairo binary (default: system).])],
617        [with_pdftocairo_path="$withval"],
618        [with_pdftocairo_path=system]
619)
620AC_ARG_WITH([acroread-path],
621        [AS_HELP_STRING([--with-acroread-path=value], [Set path to acroread binary (default: system).])],
622        [with_acroread_path="$withval"],
623        [with_acroread_path=system]
624)
625AC_ARG_WITH([ippfind-path],
626        [AS_HELP_STRING([--with-ippfind-path=value], [Set path to ippfind binary (default: system).])],
627        [with_ippfind_path="$withval"],
628        [with_ippfind_path=system]
629)
630AC_ARG_WITH([pdftops-maxres],
631	[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])],
632	[with_pdftops_maxres="$withval"],
633	[with_pdftops_maxres=1440]
634)
635AS_CASE([x$with_pdftops_maxres],
636	[x0|x75|x150|x300|x600|x1200|x2400|x4800|x90|x180|x360|x720|x1440|x2880|x5760], [CUPS_PDFTOPS_MAXRES=$with_pdftops_maxres],
637	[xunlimited], [CUPS_PDFTOPS_MAXRES=0],
638	[AC_MSG_ERROR([Unknown value of with-pdftops-maxres provided: $with_pdftops])]
639)
640AC_ARG_ENABLE([gs-ps2write],
641	[AS_HELP_STRING([--disable-gs-ps2write], [Ghostscript doesn't support ps2write device.])],
642	[enable_gs_ps2write="$enableval"],
643	[enable_gs_ps2write=yes]
644)
645
646CUPS_GHOSTSCRIPT=""
647AS_IF([test "x$enable_ghostscript" != "xyes"], [
648       with_gs_path=""
649], [
650	AS_IF([test "x$with_gs_path" != "xsystem"], [
651		CUPS_GHOSTSCRIPT="$with_gs_path"
652	], [
653		AS_IF([test "x$cross_compiling" = "xyes"], [
654			CUPS_GHOSTSCRIPT="gs"
655		], [
656			AC_CHECK_PROG(CUPS_GHOSTSCRIPT, gs, gs)
657		])
658	])
659	AS_IF([test "x$CUPS_GHOSTSCRIPT" = "x"], [
660		AC_MSG_ERROR([Required gs binary is missing. Please install ghostscript-gpl package.])
661	])
662	AC_DEFINE([HAVE_GHOSTSCRIPT], [], [Define that we provide ghostscript binary])
663	AS_IF([test x"$with_pdftops" = xgs], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [GS], [Define default renderer])])
664
665	AS_IF([test x"$enable_gs_ps2write" = "xyes"], [
666		AC_DEFINE([HAVE_GHOSTSCRIPT_PS2WRITE], [], [gs supports ps2write])
667	])
668	AS_IF([test "x$cross_compiling" != "xyes"], [
669		AC_MSG_CHECKING(whether gs supports the ps2write device)
670		AS_IF([`$CUPS_GHOSTSCRIPT -h 2>&1 | grep -q ps2write`], [
671			AC_MSG_RESULT([yes])
672			AC_DEFINE([HAVE_GHOSTSCRIPT_PS2WRITE], [], [gs supports ps2write])
673		], [
674			AC_MSG_RESULT([no])
675		])
676	])
677])
678AM_CONDITIONAL(ENABLE_GHOSTSCRIPT, test "x$enable_ghostscript" = xyes)
679AC_SUBST(CUPS_GHOSTSCRIPT)
680
681CUPS_MUTOOL=""
682AS_IF([test "x$enable_mutool" != "xyes"], [
683	with_mutool_path=""
684], [
685	AS_IF([test "x$with_mutool_path" != "xsystem"], [
686		CUPS_MUTOOL="$with_mutool_path"
687	], [
688		AS_IF([test "x$cross_compiling" = "xyes"], [
689			CUPS_MUTOOL="mutool"
690		], [
691			AC_CHECK_PROG(CUPS_MUTOOL, mutool, mutool)
692		])
693	])
694	AS_IF([test "x$CUPS_MUTOOL" = "x"], [
695		AC_MSG_ERROR([Required mutool binary is missing. Please install mutool.])
696	])
697	AS_IF([test x"$with_pdftops" = xmupdf], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [MUPDF], [Define default renderer])])
698])
699AM_CONDITIONAL(ENABLE_MUTOOL, test "x$enable_mutool" = xyes)
700AC_SUBST(CUPS_MUTOOL)
701
702AS_IF([test "x$with_pdftops_path" != "xsystem"], [
703	CUPS_PDFTOPS="$with_pdftops_path"
704], [
705	AS_IF([test "x$cross_compiling" = "xyes"], [
706		CUPS_PDFTOPS="/usr/bin/pdftops"
707	], [
708		AC_CHECK_PROG(CUPS_PDFTOPS, pdftops, /usr/bin/pdftops)
709	])
710	AS_IF([test "x$CUPS_PDFTOPS" = "x"], [
711		AC_MSG_ERROR([Required pdftops is missing. Please install the pdftops utility of Poppler.])
712	])
713])
714AS_IF([test "x$CUPS_PDFTOPS" != "x"], [
715	AC_DEFINE([HAVE_POPPLER_PDFTOPS], [], [Define that we provide poppler pdftops.])
716	AS_IF([test x"$with_pdftops" = xpdftops], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [PDFTOPS], [Define default renderer])])
717
718	AS_IF([test "x$cross_compiling" != "xyes"], [
719		AC_MSG_CHECKING([whether pdftops supports -origpagesizes])
720		AS_IF([`$CUPS_PDFTOPS -h 2>&1 | grep -q -- -origpagesizes`], [
721        		AC_MSG_RESULT([yes])
722			AC_DEFINE([HAVE_POPPLER_PDFTOPS_WITH_ORIGPAGESIZES], [] , [pdftops supports -origpagesizes.])
723		], [
724	        	AC_MSG_RESULT([no])
725		])
726		AC_MSG_CHECKING([whether pdftops supports -r])
727		AS_IF([`$CUPS_PDFTOPS -h 2>&1 | grep -q -- '-r '`], [
728	        	AC_MSG_RESULT([yes])
729			AC_DEFINE([HAVE_POPPLER_PDFTOPS_WITH_RESOLUTION], [] , [pdftops supports -r argument.])
730		], [
731        		AC_MSG_RESULT([no])
732		])
733	])
734])
735AS_IF([test "x$with_pdftocairo_path" != "xsystem"], [
736	CUPS_PDFTOCAIRO="$with_pdftocairo_path"
737], [
738	CUPS_PDFTOCAIRO="pdftocairo"
739])
740AS_IF([test "x$CUPS_PDFTOCAIRO" != "x"], [
741	AS_IF([test x"$with_pdftops" = xpdftocairo], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [PDFTOCAIRO], [Define default renderer])])
742], [
743	AC_MSG_ERROR([Required pdftocairo is missing. Please install Poppler developer packages.])
744])
745AS_IF([test "x$with_acroread_path" != "xsystem"], [
746	CUPS_ACROREAD="$with_acroread_path"
747], [
748	CUPS_ACROREAD="acroread"
749])
750AS_IF([test "x$CUPS_ACROREAD" != "x"], [
751	AS_IF([test x"$with_pdftops" = xacroread], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [ACROREAD], [Define default renderer])])
752])
753AS_IF([test "x$with_ippfind_path" != "xsystem"], [
754	CUPS_IPPFIND="$with_ippfind_path"
755], [
756	CUPS_IPPFIND="ippfind"
757])
758
759AS_IF([test "x$CUPS_GHOSTSCRIPT" != "x" -a "x$CUPS_PDFTOPS" != "x"], [
760	AS_IF([test x"$with_pdftops" = xhybrid], [AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_RENDERER], [HYBRID], [Define default renderer])])
761])
762
763AC_DEFINE_UNQUOTED([CUPS_GHOSTSCRIPT], "$CUPS_GHOSTSCRIPT", [gs binary to use])
764AC_DEFINE_UNQUOTED([CUPS_MUTOOL],"$CUPS_MUTOOL",[mutool binary to use])
765AC_DEFINE_UNQUOTED([CUPS_POPPLER_PDFTOPS], "$CUPS_PDFTOPS", [pdftops binary to use.])
766AC_DEFINE_UNQUOTED([CUPS_POPPLER_PDFTOCAIRO], "$CUPS_PDFTOCAIRO", [pdftocairo binary to use.])
767AC_DEFINE_UNQUOTED([CUPS_ACROREAD], "$CUPS_ACROREAD", [acroread binary to use.])
768AC_DEFINE_UNQUOTED([CUPS_IPPFIND], "$CUPS_IPPFIND", [ippfind binary to use.])
769AC_DEFINE_UNQUOTED([CUPS_PDFTOPS_MAX_RESOLUTION], [$CUPS_PDFTOPS_MAXRES], [max resolution used for pdftops when converting images])
770
771# ==================
772# Check for foomatic
773# ==================
774AC_ARG_ENABLE([foomatic],
775	[AS_HELP_STRING([--disable-foomatic], [Disable Foomatic-based filters.])],
776	[enable_foomatic="$enableval"],
777	[enable_foomatic=yes]
778)
779AM_CONDITIONAL([ENABLE_FOOMATIC], [test "x$enable_foomatic" = "xyes"])
780
781# =============
782# Check for php
783# =============
784# NOTE: This stuff is broken, requires internal cups headers.
785AC_ARG_WITH([php],
786	[AS_HELP_STRING([--with-php], [Determine whether to build php cups extension.])],
787	[with_php="$withval"],
788	[with_php=no]
789)
790AC_ARG_WITH([php-config],
791	[AS_HELP_STRING([--with-php-config=path], [Specify path to php-config executable.])],
792	[with_php_config="$withval"],
793	[with_php_config=system]
794)
795AM_CONDITIONAL([WITH_PHP], [test "x$with_php" = "xyes"])
796AS_IF([test x"$with_php" = "xyes"], [
797	AS_IF([test "x$with_php_config" != "xsystem"], [
798		PHPCONFIG=$with_php_config
799	], [
800		AC_PATH_TOOL(PHPCONFIG, [php-config])
801		AS_IF([test -z "$PHPCONFIG"], [
802			AC_MSG_ERROR([Required php-config is missing. Please install PHP developer packages.])
803		])
804	])
805	PHPDIR="`$PHPCONFIG --extension-dir`"
806	AC_SUBST(PHPDIR)
807])
808
809# =========
810# Test ARGS
811# =========
812AC_ARG_WITH([test-font-path],
813	[AS_HELP_STRING([--with-test-font-path=value], [Set path to font used for tests (default: /usr/share/fonts/dejavu/DejaVuSans.ttf).])],
814	[with_test_font_path="$withval"],
815	[with_test_font_path=`( find /usr/share/fonts -name DejaVuSans.ttf; echo /usr/share/fonts/dejavu/DejaVuSans.ttf ) | head -1`]
816)
817
818AS_IF([test "x$cross_compiling" != "xyes" && ! test -f "$with_test_font_path"],
819	[AC_MSG_WARN(DejaVuSans.ttf font file is missing. Please install a package providing it.) && [with_test_font_path=no]]
820)
821AC_DEFINE_UNQUOTED([TESTFONT], ["$with_test_font_path"], [Path to font used in tests])
822
823# ================
824# Check for cflags
825# ================
826AC_ARG_ENABLE([werror],
827	[AS_HELP_STRING([--enable-werror], [Treat all warnings as errors, useful for development.])],
828	[enable_werror="$enableval"],
829	[enable_werror=no]
830)
831AS_IF([test x"$enable_werror" = "xyes"], [
832	CFLAGS="$CFLAGS -Werror"
833])
834AS_IF([test x"$GCC" = "xyes"], [
835	# Be tough with warnings and produce less careless code
836	CFLAGS="$CFLAGS -Wall -std=gnu11"
837	CXXFLAGS="$CXXFLAGS -Wall " # -Weffc++" # TODO: enable when it does not print 1MB of warnings
838])
839CFLAGS="$CFLAGS -D_GNU_SOURCE"
840CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE"
841
842# ==========================
843# Braille embossing/liblouis
844# ==========================
845AC_ARG_ENABLE(braille, AS_HELP_STRING([--enable-braille],[enable Braille embosing filters, requires liblouis]),
846	      enable_braille=$enableval,enable_braille=yes)
847AC_MSG_CHECKING(for liblouis)
848PKG_CHECK_EXISTS([liblouis], [
849	AC_MSG_RESULT(yes)
850	if test "x$enable_braille" = xyes; then
851		TABLESDIR=`$PKG_CONFIG --variable=tablesdir liblouis`
852	else
853		TABLESDIR=/usr/share/liblouis/tables
854	fi
855], [
856	AC_MSG_RESULT(no)
857	TABLESDIR=/usr/share/liblouis/tables
858])
859AM_CONDITIONAL(ENABLE_BRAILLE, test "x$enable_braille" = xyes)
860AC_SUBST(TABLESDIR)
861
862# ===============================================
863# Should we keep generated queues after shutdown?
864# ===============================================
865AC_ARG_ENABLE(saving-created-queues, AS_HELP_STRING([--enable-saving-created-queues], [enable saving created queues during shutdown]),
866	      [SAVING_CREATED_QUEUES=$enableval],[SAVING_CREATED_QUEUES="no"])
867
868AS_IF([test "x$SAVING_CREATED_QUEUES" != "xno"],
869      [AC_DEFINE([SAVING_CREATED_QUEUES], [1], [Define whether we save queues during shutdown])]
870)
871
872# =========================================
873# Local queue naming for remote CUPS queues
874# =========================================
875AC_ARG_WITH([remote-cups-local-queue-naming],
876	[AS_HELP_STRING([--with-remote-cups-local-queue-naming=DNS-SD|MakeModel|RemoteName], [Choose the origin of local queue naming for remote CUPS queues, default based on DNS-SD ID])],
877	[case "x$withval" in
878		"xMakeModel")
879			REMOTE_CUPS_LOCAL_QUEUE_NAMING="MakeModel"
880	                AC_DEFINE([NAMING_MAKE_MODEL], [1], [Define that we create local queues for remote CUPS queues based on printer Make-Model])
881			;;
882		"xRemoteName")
883			REMOTE_CUPS_LOCAL_QUEUE_NAMING="RemoteName"
884	                AC_DEFINE([NAMING_REMOTE_NAME], [1], [Define that we create local queues for remote CUPS queues based on their print queue name on the server])
885			;;
886		*)
887			REMOTE_CUPS_LOCAL_QUEUE_NAMING="DNS-SD"
888	                AC_DEFINE([NAMING_DNSSD], [1], [Define that we create local queues for remote CUPS queues based on DNS-SD name])
889			;;
890	esac],
891	[REMOTE_CUPS_LOCAL_QUEUE_NAMING="DNS-SD"
892	 AC_DEFINE([NAMING_DNSSD], [1], [Define that we create local queues for remote CUPS queues based on DNS-SD name])]
893)
894
895# =========================================================
896# Select a different shell instead of the default /bin/bash
897# =========================================================
898AC_ARG_WITH([shell],
899	[AS_HELP_STRING([--with-shell=path], [Specify path for a modern shell.])],
900	[with_shell="$withval"],
901	[with_shell="/bin/bash"]
902)
903AC_DEFINE_UNQUOTED([SHELL], "$with_shell", [Path for a modern shell])
904
905# =====================
906# Prepare all .in files
907# =====================
908AC_CONFIG_FILES([
909	libcupsfilters.pc
910	libfontembed.pc
911	Makefile
912	utils/cups-browsed
913	utils/cups-browsed.conf
914	filter/foomatic-rip/foomatic-rip.1
915	filter/braille/drivers/index/indexv4.sh
916	filter/braille/drivers/index/indexv3.sh
917	filter/braille/drivers/index/index.sh
918	filter/braille/drivers/index/textbrftoindexv3
919	filter/braille/drivers/index/imageubrltoindexv3
920	filter/braille/drivers/index/imageubrltoindexv4
921	filter/braille/drivers/generic/brftoembosser
922	filter/braille/filters/cups-braille.sh
923	filter/braille/filters/imagetobrf
924	filter/braille/filters/texttobrf
925	filter/braille/filters/brftopagedbrf
926	filter/braille/filters/vectortopdf
927	filter/braille/filters/vectortobrf
928	filter/braille/filters/musicxmltobrf
929	filter/braille/filters/liblouis1.defs.gen
930	mime/cupsfilters.convs
931])
932AC_CONFIG_COMMANDS([executable-scripts], [
933	chmod +x filter/braille/filters/liblouis1.defs.gen
934])
935AC_OUTPUT
936
937# ==============================================
938# Display final informations about configuration
939# ==============================================
940AC_MSG_NOTICE([
941==============================================================================
942Environment settings:
943	CFLAGS:                                    ${CFLAGS}
944	CXXFLAGS:                                  ${CXXFLAGS}
945	LDFLAGS:                                   ${LDFLAGS}
946Build configuration:
947	cups-config:     ${with_cups_config}
948	font directory:  ${sysconfdir}/${FONTDIR}
949	foomatic:        ${enable_foomatic}
950	init directory:  ${INITDDIR}
951	cups dom socket: ${CUPS_DEFAULT_DOMAINSOCKET}
952	poppler:         ${enable_poppler}
953	ghostscript:     ${enable_ghostscript}
954	gs-path:         ${with_gs_path}
955	mutool:          ${enable_mutool}
956	mutool-path:     ${with_mutool_path}
957	ippfind-path:    ${with_ippfind_path}
958	imagefilters:    ${enable_imagefilters}
959	jpeg:            ${with_jpeg}
960	exif:            ${enable_exif}
961	pdftocairo-path: ${with_pdftocairo_path}
962	pdftops:         ${with_pdftops}
963	pdftops-path:    ${with_pdftops_path}
964	png:             ${with_png}
965	php:             ${with_php}
966	php-config:      ${with_php_config}
967	shell:           ${with_shell}
968	test-font:       ${with_test_font_path}
969	tiff:            ${with_tiff}
970	avahi:           ${enable_avahi}
971	dbus:            ${enable_dbus}
972	browsing:        ${with_browseremoteprotocols}
973	werror:          ${enable_werror}
974	braille:	 ${enable_braille}
975	braille tables:  ${TABLESDIR}
976	driverless:      ${enable_driverless}
977	apple-raster:    ${APPLE_RASTER_FILTER}
978	pclm:            ${enable_pclm}
979	local queue naming for remote CUPS queues: ${REMOTE_CUPS_LOCAL_QUEUE_NAMING}
980	keep generated queues during shutdown:     ${SAVING_CREATED_QUEUES}
981	all ipp printer auto-setup: ${enable_auto_setup_all}
982	only driverless auto-setup: ${enable_auto_setup_driverless_only}
983	only local auto-setup: ${enable_auto_setup_local_only}
984==============================================================================
985])
986