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