xref: /titanic_52/usr/src/cmd/krb5/krb5-config/krb5-config.sh (revision 159d09a20817016f09b3ea28d1bdada4a336bb91)
110db1377Sgtb#!/bin/sh
210db1377Sgtb
310db1377Sgtb#
4*159d09a2SMark Phalan# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
510db1377Sgtb# Use is subject to license terms.
610db1377Sgtb#
710db1377Sgtb#
810db1377Sgtb# Copyright 2001, 2002, 2003 by the Massachusetts Institute of Technology.
910db1377Sgtb# All Rights Reserved.
1010db1377Sgtb#
1110db1377Sgtb# Export of this software from the United States of America may
1210db1377Sgtb#   require a specific license from the United States Government.
1310db1377Sgtb#   It is the responsibility of any person or organization contemplating
1410db1377Sgtb#   export to obtain such a license before exporting.
1510db1377Sgtb#
1610db1377Sgtb# WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
1710db1377Sgtb# distribute this software and its documentation for any purpose and
1810db1377Sgtb# without fee is hereby granted, provided that the above copyright
1910db1377Sgtb# notice appear in all copies and that both that copyright notice and
2010db1377Sgtb# this permission notice appear in supporting documentation, and that
2110db1377Sgtb# the name of M.I.T. not be used in advertising or publicity pertaining
2210db1377Sgtb# to distribution of the software without specific, written prior
2310db1377Sgtb# permission.  Furthermore if you modify this software you must label
2410db1377Sgtb# your software as modified software and not distribute it in such a
2510db1377Sgtb# fashion that it might be confused with the original M.I.T. software.
2610db1377Sgtb# M.I.T. makes no representations about the suitability of
2710db1377Sgtb# this software for any purpose.  It is provided "as is" without express
2810db1377Sgtb# or implied warranty.
2910db1377Sgtb#
3010db1377Sgtb#
3110db1377Sgtb
3210db1377Sgtb# Configurable parameters set by autoconf
33*159d09a2SMark Phalanversion_string="Solaris Kerberos (based on MIT Kerberos 5 release 1.6.3)"
3410db1377Sgtb
3510db1377Sgtbprefix=/usr
3610db1377Sgtbexec_prefix=${prefix}
3710db1377Sgtbincludedir=${prefix}/include/kerberosv5
3810db1377Sgtblibdir=${exec_prefix}/lib
3910db1377SgtbCC_LINK='$(PURE) $(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(CFLAGS) $(LDFLAGS)'
4010db1377Sgtb#KRB4_LIB=-lkrb4
4110db1377Sgtb#DES425_LIB=-ldes425
4210db1377SgtbKDB5_DB_LIB=
4310db1377SgtbLDFLAGS=''
4410db1377SgtbRPATH_FLAG='-R'
4510db1377SgtbPTHREAD_CFLAGS='-D_REENTRANT '
4610db1377Sgtb
4710db1377Sgtb#LIBS='-lresolv -lsocket -lnsl '
4810db1377SgtbGEN_LIB=
4910db1377Sgtb
5010db1377Sgtb# Defaults for program
5110db1377Sgtblibrary=krb5
5210db1377Sgtb
5310db1377Sgtb# Some constants
5410db1377Sgtbvendor_string="Sun Microsystems, Inc."
5510db1377Sgtb
5610db1377Sgtb# Process arguments
5710db1377Sgtb# Yes, we are sloppy, library specifications can come before options
5810db1377Sgtbwhile test $# != 0; do
5910db1377Sgtb    case $1 in
6010db1377Sgtb	--all)
6110db1377Sgtb	    do_all=1
6210db1377Sgtb	    ;;
6310db1377Sgtb	--cflags)
6410db1377Sgtb	    do_cflags=1
6510db1377Sgtb	    ;;
6610db1377Sgtb	--deps)
6710db1377Sgtb	    do_deps=1
6810db1377Sgtb	    ;;
6910db1377Sgtb	--exec-prefix)
7010db1377Sgtb	    do_exec_prefix=1
7110db1377Sgtb	    ;;
7210db1377Sgtb	--help)
7310db1377Sgtb	    do_help=1
7410db1377Sgtb	    ;;
7510db1377Sgtb	--libs)
7610db1377Sgtb	    do_libs=1
7710db1377Sgtb	    ;;
7810db1377Sgtb	--prefix)
7910db1377Sgtb	    do_prefix=1
8010db1377Sgtb	    ;;
8110db1377Sgtb	--vendor)
8210db1377Sgtb	    do_vendor=1
8310db1377Sgtb	    ;;
8410db1377Sgtb	--version)
8510db1377Sgtb	    do_version=1
8610db1377Sgtb	    ;;
8710db1377Sgtb	krb5)
8810db1377Sgtb	    library=krb5
8910db1377Sgtb	    ;;
9010db1377Sgtb	*)
9110db1377Sgtb	    echo "$0: Unknown option \`$1' -- use \`--help' for usage"
9210db1377Sgtb	    exit 1
9310db1377Sgtb    esac
9410db1377Sgtb    shift
9510db1377Sgtbdone
9610db1377Sgtb
9710db1377Sgtb# If required options - provide help
9810db1377Sgtbif 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
9910db1377Sgtb    do_help=1
10010db1377Sgtbfi
10110db1377Sgtb
10210db1377Sgtb
10310db1377Sgtbif test -n "$do_help"; then
10410db1377Sgtb    echo "Usage: $0 [OPTIONS] [LIBRARIES]"
10510db1377Sgtb    echo "Options:"
10610db1377Sgtb    echo "        [--help]          Help"
10710db1377Sgtb    echo "        [--all]           Display version, vendor, and various values"
10810db1377Sgtb    echo "        [--version]       Version information"
10910db1377Sgtb    echo "        [--vendor]        Vendor information"
11010db1377Sgtb    echo "        [--prefix]        Kerberos installed prefix"
11110db1377Sgtb    echo "        [--exec-prefix]   Kerberos installed exec_prefix"
11210db1377Sgtb    echo "        [--cflags]        Compile time CFLAGS"
11310db1377Sgtb    echo "        [--libs]          List libraries required to link [LIBRARIES]"
11410db1377Sgtb    echo "Libraries:"
11510db1377Sgtb    echo "        krb5              Kerberos 5 application"
11610db1377Sgtb
11710db1377Sgtb    exit 0
11810db1377Sgtbfi
11910db1377Sgtb
12010db1377Sgtbif test -n "$do_all"; then
12110db1377Sgtb    all_exit=
12210db1377Sgtb    do_version=1
12310db1377Sgtb    do_prefix=1
12410db1377Sgtb    do_exec_prefix=1
12510db1377Sgtb    do_vendor=1
12610db1377Sgtb    title_version="Version:     "
12710db1377Sgtb    title_prefix="Prefix:      "
12810db1377Sgtb    title_exec_prefix="Exec_prefix: "
12910db1377Sgtb    title_vendor="Vendor:      "
13010db1377Sgtbelse
13110db1377Sgtb    all_exit="exit 0"
13210db1377Sgtbfi
13310db1377Sgtb
13410db1377Sgtbif test -n "$do_version"; then
13510db1377Sgtb    echo "$title_version$version_string"
13610db1377Sgtb    $all_exit
13710db1377Sgtbfi
13810db1377Sgtb
13910db1377Sgtbif test -n "$do_vendor"; then
14010db1377Sgtb    echo "$title_vendor$vendor_string"
14110db1377Sgtb    $all_exit
14210db1377Sgtbfi
14310db1377Sgtb
14410db1377Sgtbif test -n "$do_prefix"; then
14510db1377Sgtb    echo "$title_prefix$prefix"
14610db1377Sgtb    $all_exit
14710db1377Sgtbfi
14810db1377Sgtb
14910db1377Sgtbif test -n "$do_exec_prefix"; then
15010db1377Sgtb    echo "$title_exec_prefix$exec_prefix"
15110db1377Sgtb    $all_exit
15210db1377Sgtbfi
15310db1377Sgtb
15410db1377Sgtbif test -n "$do_cflags"; then
15510db1377Sgtb    echo "-I${includedir}"
15610db1377Sgtbfi
15710db1377Sgtb
15810db1377Sgtb
15910db1377Sgtbif test -n "$do_libs"; then
16010db1377Sgtb    # Ugly gross hack for our build tree
16110db1377Sgtb    lib_flags=`echo $CC_LINK | sed -e 's/\$(CC)//' \
16210db1377Sgtb	    -e 's/\$(PURE)//' \
16310db1377Sgtb	    -e 's#\$(PROG_RPATH)#'$libdir'#' \
16410db1377Sgtb	    -e 's#\$(PROG_LIBPATH)#-L'$libdir'#' \
16510db1377Sgtb	    -e 's#\$(RPATH_FLAG)#'"$RPATH_FLAG"'#' \
16610db1377Sgtb	    -e 's#\$(LDFLAGS)#'"$LDFLAGS"'#' \
16710db1377Sgtb	    -e 's#\$(PTHREAD_CFLAGS)#'"$PTHREAD_CFLAGS"'#' \
16810db1377Sgtb	    -e 's#\$(CFLAGS)#'"$CFLAGS"'#'`
16910db1377Sgtb
17010db1377Sgtb    if test $library = 'kdb'; then
17110db1377Sgtb	lib_flags="$lib_flags -lkdb5 $KDB5_DB_LIB"
17210db1377Sgtb	library=krb5
17310db1377Sgtb    fi
17410db1377Sgtb
17510db1377Sgtb    if test $library = 'kadm_server'; then
17610db1377Sgtb	lib_flags="$lib_flags -lkadm5srv -lkdb5 $KDB5_DB_LIB"
17710db1377Sgtb	library=kadm_common
17810db1377Sgtb    fi
17910db1377Sgtb
18010db1377Sgtb    if test $library = 'kadm_client'; then
18110db1377Sgtb	lib_flags="$lib_flags -lkadm5clnt"
18210db1377Sgtb	library=kadm_common
18310db1377Sgtb    fi
18410db1377Sgtb
18510db1377Sgtb    if test $library = 'kadm_common'; then
18610db1377Sgtb	lib_flags="$lib_flags -lgssrpc"
18710db1377Sgtb	library=gssapi
18810db1377Sgtb    fi
18910db1377Sgtb
19010db1377Sgtb    if test $library = 'gssapi'; then
19110db1377Sgtb	lib_flags="$lib_flags -lgssapi_krb5"
19210db1377Sgtb	library=krb5
19310db1377Sgtb    fi
19410db1377Sgtb
19510db1377Sgtb    if test $library = 'krb4'; then
19610db1377Sgtb	lib_flags="$lib_flags $KRB4_LIB $DES425_LIB"
19710db1377Sgtb	library=krb5
19810db1377Sgtb    fi
19910db1377Sgtb
20010db1377Sgtb    if test $library = 'krb5'; then
20110db1377Sgtb	lib_flags="$lib_flags -lkrb5  $LIBS $GEN_LIB"
20210db1377Sgtb    fi
20310db1377Sgtb
20410db1377Sgtb    echo $lib_flags
20510db1377Sgtbfi
20610db1377Sgtb
20710db1377Sgtbexit 0
208