dnl
dnl Support for packaging CUPS in a Snap and have it work with client Snaps.
dnl
-dnl Copyright © 2021 by Till Kamppeter
dnl Copyright © 2021 by OpenPrinting
dnl
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
dnl information.
dnl
-# Snap packaging and Snap interaction support
-
-AC_ARG_ENABLE(snapped_cupsd, [ --enable-snapped-cupsd enable support for packaging CUPS in a Snap])
-AC_ARG_ENABLE(snapped_clients, [ --enable-snapped-clients enable support for CUPS controlling admin access from snapped clients])
-AC_ARG_WITH(snapctl, [ --with-snapctl Set path for snapctl, only needed with --enable-snapped-cupsd, default=/usr/bin/snapctl],
- SNAPCTL="$withval", SNAPCTL="/usr/bin/snapctl")
-AC_DEFINE_UNQUOTED(SNAPCTL, "$SNAPCTL")
-AC_ARG_WITH(cups_control_slot, [ --with-cups-control-slot Name for cups-control slot as defined in snapcraft.yaml, only needed with --enable-snapped-cupsd, default=admin],
- CUPS_CONTROL_SLOT="$withval", CUPS_CONTROL_SLOT="admin")
-AC_DEFINE_UNQUOTED(CUPS_CONTROL_SLOT, "$CUPS_CONTROL_SLOT")
+AC_ARG_ENABLE([snapped_cupsd], AS_HELP_STRING([--enable-snapped-cupsd], [enable support for packaging CUPS in a Snap]))
+AC_ARG_ENABLE([snapped_clients], AS_HELP_STRING([--enable-snapped-clients], [enable support for CUPS controlling admin access from snapped clients]))
+AC_ARG_WITH([snapctl], AS_HELP_STRING([--with-snapctl], [Set path for snapctl, only needed with --enable-snapped-cupsd, default=/usr/bin/snapctl]), [
+ SNAPCTL="$withval"
+], [
+ SNAPCTL="/usr/bin/snapctl"
+])
+AC_DEFINE_UNQUOTED([SNAPCTL], ["$SNAPCTL"], [Location of snapctl program.])
+AC_ARG_WITH([cups_control_slot], AS_HELP_STRING([--with-cups-control-slot], [Name for cups-control slot as defined in snapcraft.yaml, only needed with --enable-snapped-cupsd, default=admin]), [
+ CUPS_CONTROL_SLOT="$withval"
+], [
+ CUPS_CONTROL_SLOT="admin"
+])
+AC_DEFINE_UNQUOTED([CUPS_CONTROL_SLOT], ["$CUPS_CONTROL_SLOT"], ["cups-control" slot name for snap.])
APPARMORLIBS=""
SNAPDGLIBLIBS=""
ENABLE_SNAPPED_CUPSD="NO"
ENABLE_SNAPPED_CLIENTS="NO"
-# Both --enable-snapped-cupsd and --enable-snapped-clients are about additional
-# access control for clients, allowing clients which are confined Snaps only
-# to do adminstrative tasks (create queues, delete someone else's jobs, ...)
-# if they plug the "cups-control" interface, so --enable-snapped-cupsd implies
-# --enable-snapped-clients. The difference is only the method how to determine
-# whether a client Snap is confined and plugs "cups-control".
-if test x$enable_snapped_cupsd == xyes; then
- enable_snapped_clients=yes;
-fi
+dnl Both --enable-snapped-cupsd and --enable-snapped-clients are about
+dnl additional access control for clients, allowing clients which are confined
+dnl Snaps only to do adminstrative tasks (create queues, delete someone else's
+dnl jobs, ...) if they plug the "cups-control" interface, so
+dnl --enable-snapped-cupsd implies --enable-snapped-clients. The difference is
+dnl only the method how to determine whether a client Snap is confined and plugs
+dnl "cups-control".
+AS_IF([test x$enable_snapped_cupsd == xyes], [
+ enable_snapped_clients="yes"
+])
+
+AS_IF([test "x$PKGCONFIG" != x -a x$enable_snapped_clients = xyes], [
+ AC_MSG_CHECKING([for libapparmor])
+ AS_IF([$PKGCONFIG --exists libapparmor], [
+ AC_MSG_RESULT([yes])
+
+ CFLAGS="$CFLAGS $($PKGCONFIG --cflags libapparmor)"
+ APPARMORLIBS="$($PKGCONFIG --libs libapparmor)"
+ AC_DEFINE([HAVE_APPARMOR], [1], [Have the apparmor library?])
+
+ AC_MSG_CHECKING([for libsnapd-glib])
+
+ AS_IF([$PKGCONFIG --exists snapd-glib glib-2.0 gio-2.0], [
+ AC_MSG_RESULT([yes])
+ CFLAGS="$CFLAGS $($PKGCONFIG --cflags snapd-glib glib-2.0 gio-2.0)"
+ SNAPDGLIBLIBS="$($PKGCONFIG --libs snapd-glib glib-2.0 gio-2.0)"
+ AC_DEFINE([HAVE_SNAPDGLIB], [1], [Have the snapd-glib library?])
+ ], [
+ AC_MSG_RESULT([no])
+ ])
-if test "x$PKGCONFIG" != x -a x$enable_snapped_clients == xyes; then
- AC_MSG_CHECKING(for libapparmor)
- if $PKGCONFIG --exists libapparmor; then
- AC_MSG_RESULT(yes)
- CFLAGS="$CFLAGS `$PKGCONFIG --cflags libapparmor`"
- APPARMORLIBS="`$PKGCONFIG --libs libapparmor`"
- AC_DEFINE(HAVE_APPARMOR)
- AC_MSG_CHECKING(for libsnapd-glib)
- if $PKGCONFIG --exists snapd-glib glib-2.0 gio-2.0; then
- AC_MSG_RESULT(yes)
- CFLAGS="$CFLAGS `$PKGCONFIG --cflags snapd-glib glib-2.0 gio-2.0`"
- SNAPDGLIBLIBS="`$PKGCONFIG --libs snapd-glib glib-2.0 gio-2.0`"
- AC_DEFINE(HAVE_SNAPDGLIB)
- else
- AC_MSG_RESULT(no)
- fi
- if test x$enable_snapped_cupsd == xyes; then
- AC_CHECK_LIB(snapd-glib, snapd_client_run_snapctl2_sync, [
- AC_DEFINE(HAVE_SNAPD_CLIENT_RUN_SNAPCTL2_SYNC)
- AC_DEFINE(SUPPORT_SNAPPED_CUPSD)
- AC_DEFINE(SUPPORT_SNAPPED_CLIENTS)
- ENABLE_SNAPPED_CUPSD="YES"
- ENABLE_SNAPPED_CLIENTS="YES"
- ], [
- if test "x$SNAPDGLIBLIBS" != "x"; then
- SNAPDGLIBLIBS=""
- fi
- AC_PATH_TOOL(SNAPCTL, snapctl)
- AC_MSG_CHECKING(for "snapctl is-connected" support)
- if test "x$SNAPCTL" != x && $SNAPCTL is-connected --help >/dev/null 2>&1; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SNAPCTL_IS_CONNECTED)
- AC_DEFINE(SUPPORT_SNAPPED_CUPSD)
- AC_DEFINE(SUPPORT_SNAPPED_CLIENTS)
- ENABLE_SNAPPED_CUPSD="YES"
- ENABLE_SNAPPED_CLIENTS="YES"
- else
- AC_MSG_RESULT(no)
- fi
- ])
- else
- if test "x$SNAPDGLIBLIBS" != "x"; then
- AC_DEFINE(SUPPORT_SNAPPED_CLIENTS)
- ENABLE_SNAPPED_CLIENTS="YES"
- fi
- fi
- else
- AC_MSG_RESULT(no)
- fi
-fi
+ AS_IF([test x$enable_snapped_cupsd = xyes], [
+ AC_CHECK_LIB([snapd-glib], [snapd_client_run_snapctl2_sync], [
+ AC_DEFINE([HAVE_SNAPD_CLIENT_RUN_SNAPCTL2_SYNC], [1], [Have snapd_client_run_snapctl2_sync function?])
+ AC_DEFINE([SUPPORT_SNAPPED_CUPSD], [1], [Support snapped cupsd?])
+ AC_DEFINE([SUPPORT_SNAPPED_CLIENTS], [1], [Support snapped CUPS clients?])
+ ENABLE_SNAPPED_CUPSD="YES"
+ ENABLE_SNAPPED_CLIENTS="YES"
+ ], [
+ AS_IF([test "x$SNAPDGLIBLIBS" != "x"], [
+ SNAPDGLIBLIBS=""
+ ])
+ AC_PATH_TOOL([SNAPCTL], [snapctl])
+ AC_MSG_CHECKING([for snapctl is-connected support])
+ AS_IF([test "x$SNAPCTL" != x && $SNAPCTL is-connected --help >/dev/null 2>&1], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_SNAPCTL_IS_CONNECTED], [1], [Have snapctl is-connected command?])
+ AC_DEFINE([SUPPORT_SNAPPED_CUPSD], [1], [Support snapped cupsd?])
+ AC_DEFINE([SUPPORT_SNAPPED_CLIENTS], [1], [Support snapped CUPS clients?])
+ ENABLE_SNAPPED_CUPSD="YES"
+ ENABLE_SNAPPED_CLIENTS="YES"
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+ ])
+ ], [
+ AS_IF([test "x$SNAPDGLIBLIBS" != "x"], [
+ AC_DEFINE([SUPPORT_SNAPPED_CLIENTS], [1], [Support snapped CUPS clients?])
+ ENABLE_SNAPPED_CLIENTS="YES"
+ ])
+ ])
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+])
-AC_MSG_CHECKING(for Snap support)
-if test "x$ENABLE_SNAPPED_CLIENTS" != "xNO"; then
- if test "x$ENABLE_SNAPPED_CUPSD" != "xNO"; then
- AC_MSG_RESULT(yes: cupsd + clients)
- else
- AC_MSG_RESULT(yes: clients only)
- fi
-else
- AC_MSG_RESULT(no)
-fi
+AC_MSG_CHECKING([for Snap support])
+AS_IF([test "x$ENABLE_SNAPPED_CLIENTS" != "xNO"], [
+ AS_IF([test "x$ENABLE_SNAPPED_CUPSD" != "xNO"], [
+ AC_MSG_RESULT([yes: cupsd + clients])
+ ], [
+ AC_MSG_RESULT([yes: clients only])
+ ])
+], [
+ AC_MSG_RESULT([no])
+])
-AC_SUBST(APPARMORLIBS)
-AC_SUBST(SNAPDGLIBLIBS)
+AC_SUBST([APPARMORLIBS])
+AC_SUBST([SNAPDGLIBLIBS])
--disable-pam disable PAM support
--disable-largefile omit support for large files
--enable-snapped-cupsd enable support for packaging CUPS in a Snap
- --enable-snapped-clients enable support for CUPS controlling admin access from snapped clients
+ --enable-snapped-clients
+ enable support for CUPS controlling admin access
+ from snapped clients
--disable-launchd disable launchd support
--disable-systemd disable systemd support
--enable-upstart enable upstart support
mdnsresponder, no, yes)
--with-dnssd-libs set directory for DNS Service Discovery library
--with-dnssd-includes set directory for DNS Service Discovery header files
- --with-snapctl Set path for snapctl, only needed with --enable-snapped-cupsd, default=/usr/bin/snapctl
- --with-cups-control-slot Name for cups-control slot as defined in snapcraft.yaml, only needed with --enable-snapped-cupsd, default=admin
+ --with-snapctl Set path for snapctl, only needed with
+ --enable-snapped-cupsd, default=/usr/bin/snapctl
+ --with-cups-control-slot
+ Name for cups-control slot as defined in
+ snapcraft.yaml, only needed with
+ --enable-snapped-cupsd, default=admin
--with-systemd set directory for systemd service files
--with-smfmanifestdir set path for Solaris SMF manifest
--with-rcdir set path for rc scripts
-# Snap packaging and Snap interaction support
-
# Check whether --enable-snapped_cupsd was given.
if test ${enable_snapped_cupsd+y}
then :
# Check whether --with-snapctl was given.
if test ${with_snapctl+y}
then :
- withval=$with_snapctl; SNAPCTL="$withval"
+ withval=$with_snapctl;
+ SNAPCTL="$withval"
+
else $as_nop
- SNAPCTL="/usr/bin/snapctl"
+
+ SNAPCTL="/usr/bin/snapctl"
+
fi
+
printf "%s\n" "#define SNAPCTL \"$SNAPCTL\"" >>confdefs.h
# Check whether --with-cups_control_slot was given.
if test ${with_cups_control_slot+y}
then :
- withval=$with_cups_control_slot; CUPS_CONTROL_SLOT="$withval"
+ withval=$with_cups_control_slot;
+ CUPS_CONTROL_SLOT="$withval"
+
else $as_nop
- CUPS_CONTROL_SLOT="admin"
+
+ CUPS_CONTROL_SLOT="admin"
+
fi
+
printf "%s\n" "#define CUPS_CONTROL_SLOT \"$CUPS_CONTROL_SLOT\"" >>confdefs.h
ENABLE_SNAPPED_CUPSD="NO"
ENABLE_SNAPPED_CLIENTS="NO"
-# Both --enable-snapped-cupsd and --enable-snapped-clients are about additional
-# access control for clients, allowing clients which are confined Snaps only
-# to do adminstrative tasks (create queues, delete someone else's jobs, ...)
-# if they plug the "cups-control" interface, so --enable-snapped-cupsd implies
-# --enable-snapped-clients. The difference is only the method how to determine
-# whether a client Snap is confined and plugs "cups-control".
-if test x$enable_snapped_cupsd == xyes; then
- enable_snapped_clients=yes;
+if test x$enable_snapped_cupsd == xyes
+then :
+
+ enable_snapped_clients="yes"
+
fi
-if test "x$PKGCONFIG" != x -a x$enable_snapped_clients == xyes; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libapparmor" >&5
+if test "x$PKGCONFIG" != x -a x$enable_snapped_clients = xyes
+then :
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libapparmor" >&5
printf %s "checking for libapparmor... " >&6; }
- if $PKGCONFIG --exists libapparmor; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ if $PKGCONFIG --exists libapparmor
+then :
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
- CFLAGS="$CFLAGS `$PKGCONFIG --cflags libapparmor`"
- APPARMORLIBS="`$PKGCONFIG --libs libapparmor`"
- printf "%s\n" "#define HAVE_APPARMOR 1" >>confdefs.h
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libsnapd-glib" >&5
+ CFLAGS="$CFLAGS $($PKGCONFIG --cflags libapparmor)"
+ APPARMORLIBS="$($PKGCONFIG --libs libapparmor)"
+
+printf "%s\n" "#define HAVE_APPARMOR 1" >>confdefs.h
+
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libsnapd-glib" >&5
printf %s "checking for libsnapd-glib... " >&6; }
- if $PKGCONFIG --exists snapd-glib glib-2.0 gio-2.0; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+
+ if $PKGCONFIG --exists snapd-glib glib-2.0 gio-2.0
+then :
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
- CFLAGS="$CFLAGS `$PKGCONFIG --cflags snapd-glib glib-2.0 gio-2.0`"
- SNAPDGLIBLIBS="`$PKGCONFIG --libs snapd-glib glib-2.0 gio-2.0`"
- printf "%s\n" "#define HAVE_SNAPDGLIB 1" >>confdefs.h
+ CFLAGS="$CFLAGS $($PKGCONFIG --cflags snapd-glib glib-2.0 gio-2.0)"
+ SNAPDGLIBLIBS="$($PKGCONFIG --libs snapd-glib glib-2.0 gio-2.0)"
+
+printf "%s\n" "#define HAVE_SNAPDGLIB 1" >>confdefs.h
+
+
+else $as_nop
- else
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
- fi
- if test x$enable_snapped_cupsd == xyes; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for snapd_client_run_snapctl2_sync in -lsnapd-glib" >&5
+
+fi
+
+ if test x$enable_snapped_cupsd = xyes
+then :
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for snapd_client_run_snapctl2_sync in -lsnapd-glib" >&5
printf %s "checking for snapd_client_run_snapctl2_sync in -lsnapd-glib... " >&6; }
if test ${ac_cv_lib_snapd_glib_snapd_client_run_snapctl2_sync+y}
then :
if test "x$ac_cv_lib_snapd_glib_snapd_client_run_snapctl2_sync" = xyes
then :
- printf "%s\n" "#define HAVE_SNAPD_CLIENT_RUN_SNAPCTL2_SYNC 1" >>confdefs.h
- printf "%s\n" "#define SUPPORT_SNAPPED_CUPSD 1" >>confdefs.h
+printf "%s\n" "#define HAVE_SNAPD_CLIENT_RUN_SNAPCTL2_SYNC 1" >>confdefs.h
- printf "%s\n" "#define SUPPORT_SNAPPED_CLIENTS 1" >>confdefs.h
- ENABLE_SNAPPED_CUPSD="YES"
- ENABLE_SNAPPED_CLIENTS="YES"
+printf "%s\n" "#define SUPPORT_SNAPPED_CUPSD 1" >>confdefs.h
+
+
+printf "%s\n" "#define SUPPORT_SNAPPED_CLIENTS 1" >>confdefs.h
+
+ ENABLE_SNAPPED_CUPSD="YES"
+ ENABLE_SNAPPED_CLIENTS="YES"
else $as_nop
- if test "x$SNAPDGLIBLIBS" != "x"; then
- SNAPDGLIBLIBS=""
- fi
- if test -n "$ac_tool_prefix"; then
+ if test "x$SNAPDGLIBLIBS" != "x"
+then :
+
+ SNAPDGLIBLIBS=""
+
+fi
+ if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}snapctl", so it can be a program name with args.
set dummy ${ac_tool_prefix}snapctl; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
SNAPCTL="$ac_cv_path_SNAPCTL"
fi
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for \"snapctl is-connected\" support" >&5
-printf %s "checking for \"snapctl is-connected\" support... " >&6; }
- if test "x$SNAPCTL" != x && $SNAPCTL is-connected --help >/dev/null 2>&1; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for snapctl is-connected support" >&5
+printf %s "checking for snapctl is-connected support... " >&6; }
+ if test "x$SNAPCTL" != x && $SNAPCTL is-connected --help >/dev/null 2>&1
+then :
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
- printf "%s\n" "#define HAVE_SNAPCTL_IS_CONNECTED 1" >>confdefs.h
- printf "%s\n" "#define SUPPORT_SNAPPED_CUPSD 1" >>confdefs.h
+printf "%s\n" "#define HAVE_SNAPCTL_IS_CONNECTED 1" >>confdefs.h
+
+
+printf "%s\n" "#define SUPPORT_SNAPPED_CUPSD 1" >>confdefs.h
- printf "%s\n" "#define SUPPORT_SNAPPED_CLIENTS 1" >>confdefs.h
- ENABLE_SNAPPED_CUPSD="YES"
- ENABLE_SNAPPED_CLIENTS="YES"
- else
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "#define SUPPORT_SNAPPED_CLIENTS 1" >>confdefs.h
+
+ ENABLE_SNAPPED_CUPSD="YES"
+ ENABLE_SNAPPED_CLIENTS="YES"
+
+else $as_nop
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
- fi
fi
- else
- if test "x$SNAPDGLIBLIBS" != "x"; then
- printf "%s\n" "#define SUPPORT_SNAPPED_CLIENTS 1" >>confdefs.h
+fi
- ENABLE_SNAPPED_CLIENTS="YES"
- fi
- fi
- else
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+
+else $as_nop
+
+ if test "x$SNAPDGLIBLIBS" != "x"
+then :
+
+
+printf "%s\n" "#define SUPPORT_SNAPPED_CLIENTS 1" >>confdefs.h
+
+ ENABLE_SNAPPED_CLIENTS="YES"
+
+fi
+
+fi
+
+else $as_nop
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
- fi
+
+fi
+
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Snap support" >&5
printf %s "checking for Snap support... " >&6; }
-if test "x$ENABLE_SNAPPED_CLIENTS" != "xNO"; then
- if test "x$ENABLE_SNAPPED_CUPSD" != "xNO"; then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: cupsd + clients" >&5
+if test "x$ENABLE_SNAPPED_CLIENTS" != "xNO"
+then :
+
+ if test "x$ENABLE_SNAPPED_CUPSD" != "xNO"
+then :
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: cupsd + clients" >&5
printf "%s\n" "yes: cupsd + clients" >&6; }
- else
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: clients only" >&5
+
+else $as_nop
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: clients only" >&5
printf "%s\n" "yes: clients only" >&6; }
- fi
-else
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+
+fi
+
+else $as_nop
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
+
fi