xref: /titanic_50/usr/src/cmd/krb5/krb5-config/krb5-config.sh (revision c2cb63342c63c60cee771d1af82f377e34aa1217)
1#!/bin/sh
2
3#
4# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
5# Use is subject to license terms.
6#
7# pragma ident	"%Z%%M%	%I%	%E% SMI"
8#
9# Copyright 2001, 2002, 2003 by the Massachusetts Institute of Technology.
10# All Rights Reserved.
11#
12# Export of this software from the United States of America may
13#   require a specific license from the United States Government.
14#   It is the responsibility of any person or organization contemplating
15#   export to obtain such a license before exporting.
16#
17# WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
18# distribute this software and its documentation for any purpose and
19# without fee is hereby granted, provided that the above copyright
20# notice appear in all copies and that both that copyright notice and
21# this permission notice appear in supporting documentation, and that
22# the name of M.I.T. not be used in advertising or publicity pertaining
23# to distribution of the software without specific, written prior
24# permission.  Furthermore if you modify this software you must label
25# your software as modified software and not distribute it in such a
26# fashion that it might be confused with the original M.I.T. software.
27# M.I.T. makes no representations about the suitability of
28# this software for any purpose.  It is provided "as is" without express
29# or implied warranty.
30#
31#
32
33# Configurable parameters set by autoconf
34version_string="Solaris Kerberos (based on MIT Kerberos 5 release 1.4.0)"
35
36prefix=/usr
37exec_prefix=${prefix}
38includedir=${prefix}/include/kerberosv5
39libdir=${exec_prefix}/lib
40CC_LINK='$(PURE) $(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(CFLAGS) $(LDFLAGS)'
41#KRB4_LIB=-lkrb4
42#DES425_LIB=-ldes425
43KDB5_DB_LIB=
44LDFLAGS=''
45RPATH_FLAG='-R'
46PTHREAD_CFLAGS='-D_REENTRANT '
47
48#LIBS='-lresolv -lsocket -lnsl '
49GEN_LIB=
50
51# Defaults for program
52library=krb5
53
54# Some constants
55vendor_string="Sun Microsystems, Inc."
56
57# Process arguments
58# Yes, we are sloppy, library specifications can come before options
59while test $# != 0; do
60    case $1 in
61	--all)
62	    do_all=1
63	    ;;
64	--cflags)
65	    do_cflags=1
66	    ;;
67	--deps)
68	    do_deps=1
69	    ;;
70	--exec-prefix)
71	    do_exec_prefix=1
72	    ;;
73	--help)
74	    do_help=1
75	    ;;
76	--libs)
77	    do_libs=1
78	    ;;
79	--prefix)
80	    do_prefix=1
81	    ;;
82	--vendor)
83	    do_vendor=1
84	    ;;
85	--version)
86	    do_version=1
87	    ;;
88	krb5)
89	    library=krb5
90	    ;;
91	*)
92	    echo "$0: Unknown option \`$1' -- use \`--help' for usage"
93	    exit 1
94    esac
95    shift
96done
97
98# If required options - provide help
99if 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
100    do_help=1
101fi
102
103
104if test -n "$do_help"; then
105    echo "Usage: $0 [OPTIONS] [LIBRARIES]"
106    echo "Options:"
107    echo "        [--help]          Help"
108    echo "        [--all]           Display version, vendor, and various values"
109    echo "        [--version]       Version information"
110    echo "        [--vendor]        Vendor information"
111    echo "        [--prefix]        Kerberos installed prefix"
112    echo "        [--exec-prefix]   Kerberos installed exec_prefix"
113    echo "        [--cflags]        Compile time CFLAGS"
114    echo "        [--libs]          List libraries required to link [LIBRARIES]"
115    echo "Libraries:"
116    echo "        krb5              Kerberos 5 application"
117
118    exit 0
119fi
120
121if test -n "$do_all"; then
122    all_exit=
123    do_version=1
124    do_prefix=1
125    do_exec_prefix=1
126    do_vendor=1
127    title_version="Version:     "
128    title_prefix="Prefix:      "
129    title_exec_prefix="Exec_prefix: "
130    title_vendor="Vendor:      "
131else
132    all_exit="exit 0"
133fi
134
135if test -n "$do_version"; then
136    echo "$title_version$version_string"
137    $all_exit
138fi
139
140if test -n "$do_vendor"; then
141    echo "$title_vendor$vendor_string"
142    $all_exit
143fi
144
145if test -n "$do_prefix"; then
146    echo "$title_prefix$prefix"
147    $all_exit
148fi
149
150if test -n "$do_exec_prefix"; then
151    echo "$title_exec_prefix$exec_prefix"
152    $all_exit
153fi
154
155if test -n "$do_cflags"; then
156    echo "-I${includedir}"
157fi
158
159
160if test -n "$do_libs"; then
161    # Ugly gross hack for our build tree
162    lib_flags=`echo $CC_LINK | sed -e 's/\$(CC)//' \
163	    -e 's/\$(PURE)//' \
164	    -e 's#\$(PROG_RPATH)#'$libdir'#' \
165	    -e 's#\$(PROG_LIBPATH)#-L'$libdir'#' \
166	    -e 's#\$(RPATH_FLAG)#'"$RPATH_FLAG"'#' \
167	    -e 's#\$(LDFLAGS)#'"$LDFLAGS"'#' \
168	    -e 's#\$(PTHREAD_CFLAGS)#'"$PTHREAD_CFLAGS"'#' \
169	    -e 's#\$(CFLAGS)#'"$CFLAGS"'#'`
170
171    if test $library = 'kdb'; then
172	lib_flags="$lib_flags -lkdb5 $KDB5_DB_LIB"
173	library=krb5
174    fi
175
176    if test $library = 'kadm_server'; then
177	lib_flags="$lib_flags -lkadm5srv -lkdb5 $KDB5_DB_LIB"
178	library=kadm_common
179    fi
180
181    if test $library = 'kadm_client'; then
182	lib_flags="$lib_flags -lkadm5clnt"
183	library=kadm_common
184    fi
185
186    if test $library = 'kadm_common'; then
187	lib_flags="$lib_flags -lgssrpc"
188	library=gssapi
189    fi
190
191    if test $library = 'gssapi'; then
192	lib_flags="$lib_flags -lgssapi_krb5"
193	library=krb5
194    fi
195
196    if test $library = 'krb4'; then
197	lib_flags="$lib_flags $KRB4_LIB $DES425_LIB"
198	library=krb5
199    fi
200
201    if test $library = 'krb5'; then
202	lib_flags="$lib_flags -lkrb5  $LIBS $GEN_LIB"
203    fi
204
205    echo $lib_flags
206fi
207
208exit 0
209