lib-cups.m4 revision 1670:ee11e7837c17
1#
2# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# This code is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 2 only, as
7# published by the Free Software Foundation.  Oracle designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Oracle in the LICENSE file that accompanied this code.
10#
11# This code is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14# version 2 for more details (a copy is included in the LICENSE file that
15# accompanied this code).
16#
17# You should have received a copy of the GNU General Public License version
18# 2 along with this work; if not, write to the Free Software Foundation,
19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# questions.
24#
25
26################################################################################
27# Setup cups (Common Unix Printing System)
28################################################################################
29AC_DEFUN_ONCE([LIB_SETUP_CUPS],
30[
31  AC_ARG_WITH(cups, [AS_HELP_STRING([--with-cups],
32      [specify prefix directory for the cups package
33      (expecting the headers under PATH/include)])])
34  AC_ARG_WITH(cups-include, [AS_HELP_STRING([--with-cups-include],
35      [specify directory for the cups include files])])
36
37  if test "x$NEEDS_LIB_CUPS" = xfalse; then
38    if test "x${with_cups}" != x || test "x${with_cups_include}" != x; then
39      AC_MSG_WARN([cups not used, so --with-cups is ignored])
40    fi
41    CUPS_CFLAGS=
42  else
43    CUPS_FOUND=no
44
45    if test "x${with_cups}" = xno || test "x${with_cups_include}" = xno; then
46      AC_MSG_ERROR([It is not possible to disable the use of cups. Remove the --without-cups option.])
47    fi
48
49    if test "x${with_cups}" != x; then
50      CUPS_CFLAGS="-I${with_cups}/include"
51      CUPS_FOUND=yes
52    fi
53    if test "x${with_cups_include}" != x; then
54      CUPS_CFLAGS="-I${with_cups_include}"
55      CUPS_FOUND=yes
56    fi
57    if test "x$CUPS_FOUND" = xno; then
58      # Are the cups headers installed in the default /usr/include location?
59      AC_CHECK_HEADERS([cups/cups.h cups/ppd.h], [
60          CUPS_FOUND=yes
61          CUPS_CFLAGS=
62          DEFAULT_CUPS=yes
63      ])
64    fi
65    if test "x$CUPS_FOUND" = xno; then
66      # Getting nervous now? Lets poke around for standard Solaris third-party
67      # package installation locations.
68      AC_MSG_CHECKING([for cups headers])
69      if test -s $SYSROOT/opt/sfw/cups/include/cups/cups.h; then
70        # An SFW package seems to be installed!
71        CUPS_FOUND=yes
72        CUPS_CFLAGS="-I$SYSROOT/opt/sfw/cups/include"
73      elif test -s $SYSROOT/opt/csw/include/cups/cups.h; then
74        # A CSW package seems to be installed!
75        CUPS_FOUND=yes
76        CUPS_CFLAGS="-I$SYSROOT/opt/csw/include"
77      fi
78      AC_MSG_RESULT([$CUPS_FOUND])
79    fi
80    if test "x$CUPS_FOUND" = xno; then
81      HELP_MSG_MISSING_DEPENDENCY([cups])
82      AC_MSG_ERROR([Could not find cups! $HELP_MSG ])
83    fi
84  fi
85
86  AC_SUBST(CUPS_CFLAGS)
87])
88