1dnl $Id: cups.m4,v 1.3 2010-04-12 14:28:47 franklahm Exp $
2dnl Autoconf macros to check for CUPS
3
4AC_DEFUN([NETATALK_AC_CUPS], [
5
6	dnl Don't use spool unless it's needed
7	spool_required=no
8	netatalk_cv_use_cups=no
9
10	AC_ARG_ENABLE(cups,
11	[  --enable-cups           Turn on CUPS support (default=auto)])
12
13	if test x$enable_cups != xno; then
14        	AC_PATH_PROG(CUPS_CONFIG, cups-config)
15
16        	if test "x$CUPS_CONFIG" != x; then
17                	AC_DEFINE(HAVE_CUPS, 1, [Define to enable CUPS Support])
18	                CUPS_CFLAGS="`$CUPS_CONFIG --cflags`"
19        	        CUPS_LDFLAGS="`$CUPS_CONFIG --ldflags`"
20                	CUPS_LIBS="`$CUPS_CONFIG --libs`"
21			CUPS_VERSION="`$CUPS_CONFIG --version`"
22			AC_DEFINE_UNQUOTED(CUPS_API_VERSION, "`$CUPS_CONFIG --api-version`", [CUPS API Version])
23			AC_SUBST(CUPS_CFLAGS)
24			AC_SUBST(CUPS_LDFLAGS)
25			AC_SUBST(CUPS_LIBS)
26	
27			AC_MSG_CHECKING([CUPS version])
28                	AC_MSG_RESULT([$CUPS_VERSION])
29			netatalk_cv_use_cups=yes
30	
31			if test x"$netatalk_cv_HAVE_USABLE_ICONV" = x"no" ; then
32				AC_WARN([*** Warning: iconv not found on your system, using simple ascii mapping***])
33			fi
34	                spool_required="yes"
35		elif test x"$enable_cups" = "xyes"; then
36			AC_MSG_ERROR([*** CUPS not found. You might need to specify the path to cups-config ***])
37	        fi
38	fi
39
40	AC_MSG_CHECKING([whether CUPS support can be enabled])
41	AC_MSG_RESULT([$netatalk_cv_use_cups])
42
43
44	AC_ARG_WITH(spooldir,
45       	[  --with-spooldir=PATH     path for spooldir used for CUPS support (LOCALSTATEDIR/spool/netatalk)],[
46
47	        if test "$withval" = "no"; then
48        	       if test x"$spool_required" = x"yes"; then
49                	       AC_MSG_ERROR([*** CUPS support requires a spooldir ***])
50	               else
51        	               AC_DEFINE(DISABLE_SPOOL, 1, [Define to enable spooldir support])
52                	       AC_MSG_RESULT([spool disabled])
53               		fi
54        	elif test "$withval" != "yes"; then
55			SPOOLDIR="$withval"
56	                AC_MSG_RESULT([spooldir set to $withval])
57        	else
58			SPOOLDIR="${localstatedir}/spool/netatalk"
59	                AC_MSG_RESULT([spool set to default])
60        	fi
61	],[
62		SPOOLDIR="${localstatedir}/spool/netatalk"
63	])
64
65	AM_CONDITIONAL(USE_SPOOLDIR, test x"$spool_required" = x"yes")
66	AC_SUBST(SPOOLDIR)
67])
68