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