Rebase for cups 2.2.1
[platform/upstream/cups.git] / cups-config.in
1 #!/bin/sh
2 #
3 # CUPS configuration utility.
4 #
5 # Copyright 2007-2016 by Apple Inc.
6 # Copyright 2001-2006 by Easy Software Products, all rights reserved.
7 #
8 # These coded instructions, statements, and computer programs are the
9 # property of Apple Inc. and are protected by Federal copyright
10 # law.  Distribution and use rights are outlined in the file "LICENSE.txt"
11 # which should have been included with this file.  If this file is
12 # file is missing or damaged, see the license at "http://www.cups.org/".
13 #
14
15 VERSION="@CUPS_VERSION@"
16 APIVERSION="2.2"
17 BUILD="@CUPS_BUILD@"
18
19 prefix=@prefix@
20 exec_prefix=@exec_prefix@
21 bindir=@bindir@
22 includedir=@includedir@
23 libdir=@libdir@
24 imagelibdir=@libdir@
25 datarootdir=@datadir@
26 datadir=@datadir@
27 sysconfdir=@sysconfdir@
28 cups_datadir=@CUPS_DATADIR@
29 cups_serverbin=@CUPS_SERVERBIN@
30 cups_serverroot=@CUPS_SERVERROOT@
31 INSTALLSTATIC=@INSTALLSTATIC@
32
33 # flags for C++ compiler:
34 CFLAGS=""
35 LDFLAGS="@EXPORT_LDFLAGS@"
36 LIBS="@LIBGSSAPI@ @EXPORT_SSLLIBS@ @LIBZ@ @LIBS@"
37
38 # Check for local invocation...
39 selfdir=`dirname $0`
40
41 if test -f "$selfdir/cups/cups.h"; then
42     CFLAGS="-I$selfdir"
43     LDFLAGS="-L$selfdir/cups -L$selfdir/filter $LDFLAGS"
44     libdir="$selfdir/cups"
45     imagelibdir="$selfdir/filter"
46 else
47     if test $includedir != /usr/include; then
48         CFLAGS="$CFLAGS -I$includedir"
49     fi
50
51     if test $libdir != /usr/lib -a $libdir != /usr/lib32 -a $libdir != /usr/lib64; then
52         LDFLAGS="$LDFLAGS -L$libdir"
53     fi
54 fi
55
56
57 usage ()
58 {
59     echo "Usage: cups-config --api-version"
60     echo "       cups-config --build"
61     echo "       cups-config --cflags"
62     echo "       cups-config --datadir"
63     echo "       cups-config --help"
64     echo "       cups-config --ldflags"
65     echo "       cups-config [--image] [--static] --libs"
66     echo "       cups-config --serverbin"
67     echo "       cups-config --serverroot"
68     echo "       cups-config --version"
69
70     exit $1
71 }
72
73 if test $# -eq 0; then
74     usage 1
75 fi
76
77 # Parse command line options
78 static=no
79 image=no
80
81 while test $# -gt 0; do
82     case $1 in
83         --api-version)
84             echo $APIVERSION
85             ;;
86         --build)
87             echo $BUILD
88             ;;
89         --cflags)
90             echo $CFLAGS
91             ;;
92         --datadir)
93             echo $cups_datadir
94             ;;
95         --help)
96             usage 0
97             ;;
98         --image)
99             image=yes
100             ;;
101         --ldflags)
102             echo $LDFLAGS
103             ;;
104         --libs)
105             if test $static = no; then
106                 libs="@EXTLINKCUPS@ $LIBS";
107                 if test $image = yes; then
108                     libs="@EXTLINKCUPSIMAGE@ $libs"
109                 fi
110             else
111                 libs="$libdir/libcups.a $LIBS";
112                 if test $image = yes; then
113                     libs="$libdir/libcupsimage.a $libs"
114                 fi
115             fi
116             echo $libs
117             ;;
118         --serverbin)
119             echo $cups_serverbin
120             ;;
121         --serverroot)
122             echo $cups_serverroot
123             ;;
124         --static)
125             if test -z "$INSTALLSTATIC"; then
126                 echo "WARNING: Static libraries not installed!" >&2
127             else
128                 static=yes
129             fi
130             ;;
131         --version)
132             echo $VERSION
133             ;;
134         *)
135             usage 1
136             ;;
137     esac
138
139     shift
140 done