• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3# CUPS configuration utility.
4#
5# Copyright © 2020-2024 by OpenPrinting.
6# Copyright © 2007-2019 by Apple Inc.
7# Copyright © 2001-2006 by Easy Software Products, all rights reserved.
8#
9# Licensed under Apache License v2.0.  See the file "LICENSE" for more
10# information.
11#
12
13VERSION="@CUPS_VERSION@"
14APIVERSION="@CUPS_API_VERSION@"
15BUILD="@CUPS_BUILD@"
16
17prefix=@prefix@
18exec_prefix=@exec_prefix@
19bindir=@bindir@
20includedir=@includedir@
21libdir=@libdir@
22datarootdir=@datadir@
23datadir=@datadir@
24sysconfdir=@sysconfdir@
25cups_datadir=@CUPS_DATADIR@
26cups_serverbin=@CUPS_SERVERBIN@
27cups_serverroot=@CUPS_SERVERROOT@
28INSTALLSTATIC=@INSTALLSTATIC@
29
30# flags for compiler and linker...
31CFLAGS=""
32LDFLAGS="@EXPORT_LDFLAGS@"
33LIBS="@LIBGSSAPI@ @DNSSDLIBS@ @EXPORT_TLSLIBS@ @LIBZ@ @LIBS@"
34
35# Check for local invocation...
36selfdir=`dirname $0`
37
38if test -f "$selfdir/cups/cups.h"; then
39    CFLAGS="-I$selfdir"
40    LDFLAGS="-L$selfdir/cups $LDFLAGS"
41    libdir="$selfdir/cups"
42else
43    if test $includedir != /usr/include; then
44	CFLAGS="$CFLAGS -I$includedir"
45    fi
46
47    if test $libdir != /usr/lib -a $libdir != /usr/lib32 -a $libdir != /usr/lib64; then
48	LDFLAGS="$LDFLAGS -L$libdir"
49    fi
50fi
51
52
53usage()
54{
55    echo "Usage: cups-config --api-version"
56    echo "       cups-config --build"
57    echo "       cups-config --cflags"
58    echo "       cups-config --datadir"
59    echo "       cups-config --help"
60    echo "       cups-config --ldflags"
61    echo "       cups-config [--image] [--static] --libs"
62    echo "       cups-config --serverbin"
63    echo "       cups-config --serverroot"
64    echo "       cups-config --version"
65    echo ""
66    echo "Note: The cups-config utility is deprecated and will be removed in a future"
67    echo "      version of CUPS.  Use the pkg-config utility instead."
68
69    exit $1
70}
71
72if test $# -eq 0; then
73    usage 1
74fi
75
76# Parse command line options
77static=no
78
79while test $# -gt 0; do
80    case $1 in
81	--api-version)
82	    echo $APIVERSION
83	    ;;
84	--build)
85	    echo $BUILD
86	    ;;
87	--cflags)
88	    echo $CFLAGS
89	    ;;
90	--datadir)
91	    echo $cups_datadir
92	    ;;
93	--help)
94	    usage 0
95	    ;;
96	--image)
97	    # Do nothing
98	    ;;
99	--ldflags)
100	    echo $LDFLAGS
101	    ;;
102	--libs)
103	    if test $static = no; then
104	        libs="@EXTLINKCUPS@";
105	    else
106	        libs="$libdir/libcups.a $LIBS";
107	    fi
108	    echo $libs
109	    ;;
110	--serverbin)
111	    echo $cups_serverbin
112	    ;;
113	--serverroot)
114	    echo $cups_serverroot
115	    ;;
116	--static)
117	    if test -z "$INSTALLSTATIC"; then
118	        echo "WARNING: Static libraries not installed." >&2
119	    else
120	        static=yes
121	    fi
122	    ;;
123	--version)
124	    echo $VERSION
125	    ;;
126	*)
127	    usage 1
128	    ;;
129    esac
130
131    shift
132done
133