xref: /illumos-gate/usr/src/cmd/krb5/krb5-config/krb5-config.sh (revision 4c28a617e3922d92a58e813a5b955eb526b9c386)
1#!/bin/sh
2
3#
4# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
5# Use is subject to license terms.
6#
7#
8# Copyright 2001, 2002, 2003 by the Massachusetts Institute of Technology.
9# All Rights Reserved.
10#
11# Export of this software from the United States of America may
12#   require a specific license from the United States Government.
13#   It is the responsibility of any person or organization contemplating
14#   export to obtain such a license before exporting.
15#
16# WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
17# distribute this software and its documentation for any purpose and
18# without fee is hereby granted, provided that the above copyright
19# notice appear in all copies and that both that copyright notice and
20# this permission notice appear in supporting documentation, and that
21# the name of M.I.T. not be used in advertising or publicity pertaining
22# to distribution of the software without specific, written prior
23# permission.  Furthermore if you modify this software you must label
24# your software as modified software and not distribute it in such a
25# fashion that it might be confused with the original M.I.T. software.
26# M.I.T. makes no representations about the suitability of
27# this software for any purpose.  It is provided "as is" without express
28# or implied warranty.
29#
30#
31
32# Configurable parameters set by autoconf
33version_string="Solaris Kerberos (based on MIT Kerberos 5 release 1.6.3)"
34
35prefix=/usr
36exec_prefix=${prefix}
37includedir=${prefix}/include/kerberosv5
38libdir=${exec_prefix}/lib
39
40# Defaults for program
41library=krb5
42
43# Some constants
44vendor_string="Sun Microsystems, Inc."
45
46# Process arguments
47# Yes, we are sloppy, library specifications can come before options
48while test $# != 0; do
49    case $1 in
50	--all)
51	    do_all=1
52	    ;;
53	--cflags)
54	    do_cflags=1
55	    ;;
56	--deps)
57	    do_deps=1
58	    ;;
59	--exec-prefix)
60	    do_exec_prefix=1
61	    ;;
62	--help)
63	    do_help=1
64	    ;;
65	--libs)
66	    do_libs=1
67	    ;;
68	--prefix)
69	    do_prefix=1
70	    ;;
71	--vendor)
72	    do_vendor=1
73	    ;;
74	--version)
75	    do_version=1
76	    ;;
77	krb5)
78	    library=krb5
79	    ;;
80	gssapi)
81	    library=gssapi
82	    ;;
83	*)
84	    echo "$0: Unknown option \`$1' -- use \`--help' for usage"
85	    exit 1
86    esac
87    shift
88done
89
90# If required options - provide help
91if test -z "$do_all" -a -z "$do_version" -a -z "$do_vendor" -a -z "$do_prefix" -a -z "$do_vendor" -a -z "$do_exec_prefix" -a -z "$do_cflags" -a -z "$do_libs"; then
92    do_help=1
93fi
94
95
96if test -n "$do_help"; then
97    echo "Usage: $0 [OPTIONS] [LIBRARIES]"
98    echo "Options:"
99    echo "        [--help]          Help"
100    echo "        [--all]           Display version, vendor, and various values"
101    echo "        [--version]       Version information"
102    echo "        [--vendor]        Vendor information"
103    echo "        [--prefix]        Kerberos installed prefix"
104    echo "        [--exec-prefix]   Kerberos installed exec_prefix"
105    echo "        [--cflags]        Compile time CFLAGS"
106    echo "        [--libs]          List libraries required to link [LIBRARIES]"
107    echo "Libraries:"
108    echo "        krb5              Kerberos 5 application"
109    echo "        gssapi            GSSAPI application"
110
111    exit 0
112fi
113
114if test -n "$do_all"; then
115    all_exit=
116    do_version=1
117    do_prefix=1
118    do_exec_prefix=1
119    do_vendor=1
120    title_version="Version:     "
121    title_prefix="Prefix:      "
122    title_exec_prefix="Exec_prefix: "
123    title_vendor="Vendor:      "
124else
125    all_exit="exit 0"
126fi
127
128if test -n "$do_version"; then
129    echo "$title_version$version_string"
130    $all_exit
131fi
132
133if test -n "$do_vendor"; then
134    echo "$title_vendor$vendor_string"
135    $all_exit
136fi
137
138if test -n "$do_prefix"; then
139    echo "$title_prefix$prefix"
140    $all_exit
141fi
142
143if test -n "$do_exec_prefix"; then
144    echo "$title_exec_prefix$exec_prefix"
145    $all_exit
146fi
147
148if test -n "$do_cflags"; then
149    echo "-I${includedir}"
150fi
151
152if test -n "$do_libs"; then
153    lib_flags="-L$libdir"
154
155    if test $library = 'gssapi'; then
156       lib_flags="$lib_flags -lgss"
157       library=krb5
158    fi
159
160    if test $library = 'krb5'; then
161       lib_flags="$lib_flags -lkrb5"
162    fi
163
164    echo "$lib_flags"
165fi
166
167exit 0
168