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