Haibo Huang | 4c28362 | 2019-12-13 16:47:52 -0800 | [diff] [blame] | 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 | |
| 12 | VERSION="@CUPS_VERSION@" |
| 13 | APIVERSION="2.3" |
| 14 | BUILD="@CUPS_BUILD@" |
| 15 | |
| 16 | prefix=@prefix@ |
| 17 | exec_prefix=@exec_prefix@ |
| 18 | bindir=@bindir@ |
| 19 | includedir=@includedir@ |
| 20 | libdir=@libdir@ |
| 21 | datarootdir=@datadir@ |
| 22 | datadir=@datadir@ |
| 23 | sysconfdir=@sysconfdir@ |
| 24 | cups_datadir=@CUPS_DATADIR@ |
| 25 | cups_serverbin=@CUPS_SERVERBIN@ |
| 26 | cups_serverroot=@CUPS_SERVERROOT@ |
| 27 | INSTALLSTATIC=@INSTALLSTATIC@ |
| 28 | |
| 29 | # flags for compiler and linker... |
| 30 | CFLAGS="" |
| 31 | LDFLAGS="@EXPORT_LDFLAGS@" |
| 32 | LIBS="@LIBGSSAPI@ @DNSSDLIBS@ @EXPORT_SSLLIBS@ @LIBZ@ @LIBS@" |
| 33 | |
| 34 | # Check for local invocation... |
| 35 | selfdir=`dirname $0` |
| 36 | |
| 37 | if test -f "$selfdir/cups/cups.h"; then |
| 38 | CFLAGS="-I$selfdir" |
| 39 | LDFLAGS="-L$selfdir/cups $LDFLAGS" |
| 40 | libdir="$selfdir/cups" |
| 41 | else |
| 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 |
| 49 | fi |
| 50 | |
| 51 | |
| 52 | usage () |
| 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 | |
| 68 | if test $# -eq 0; then |
| 69 | usage 1 |
| 70 | fi |
| 71 | |
| 72 | # Parse command line options |
| 73 | static=no |
| 74 | |
| 75 | while 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 |
| 128 | done |