xref: /onnv-gate/usr/src/cmd/krb5/krb5-config/krb5-config.sh (revision 7934:6aeeafc994de)
11770Sgtb#!/bin/sh
21770Sgtb
31770Sgtb#
4*7934SMark.Phalan@Sun.COM# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
51770Sgtb# Use is subject to license terms.
61770Sgtb#
71770Sgtb#
81770Sgtb# Copyright 2001, 2002, 2003 by the Massachusetts Institute of Technology.
91770Sgtb# All Rights Reserved.
101770Sgtb#
111770Sgtb# Export of this software from the United States of America may
121770Sgtb#   require a specific license from the United States Government.
131770Sgtb#   It is the responsibility of any person or organization contemplating
141770Sgtb#   export to obtain such a license before exporting.
151770Sgtb#
161770Sgtb# WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
171770Sgtb# distribute this software and its documentation for any purpose and
181770Sgtb# without fee is hereby granted, provided that the above copyright
191770Sgtb# notice appear in all copies and that both that copyright notice and
201770Sgtb# this permission notice appear in supporting documentation, and that
211770Sgtb# the name of M.I.T. not be used in advertising or publicity pertaining
221770Sgtb# to distribution of the software without specific, written prior
231770Sgtb# permission.  Furthermore if you modify this software you must label
241770Sgtb# your software as modified software and not distribute it in such a
251770Sgtb# fashion that it might be confused with the original M.I.T. software.
261770Sgtb# M.I.T. makes no representations about the suitability of
271770Sgtb# this software for any purpose.  It is provided "as is" without express
281770Sgtb# or implied warranty.
291770Sgtb#
301770Sgtb#
311770Sgtb
321770Sgtb# Configurable parameters set by autoconf
33*7934SMark.Phalan@Sun.COMversion_string="Solaris Kerberos (based on MIT Kerberos 5 release 1.6.3)"
341770Sgtb
351770Sgtbprefix=/usr
361770Sgtbexec_prefix=${prefix}
371770Sgtbincludedir=${prefix}/include/kerberosv5
381770Sgtblibdir=${exec_prefix}/lib
391770SgtbCC_LINK='$(PURE) $(CC) $(PROG_LIBPATH) $(RPATH_FLAG)$(PROG_RPATH) $(CFLAGS) $(LDFLAGS)'
401770Sgtb#KRB4_LIB=-lkrb4
411770Sgtb#DES425_LIB=-ldes425
421770SgtbKDB5_DB_LIB=
431770SgtbLDFLAGS=''
441770SgtbRPATH_FLAG='-R'
451770SgtbPTHREAD_CFLAGS='-D_REENTRANT '
461770Sgtb
471770Sgtb#LIBS='-lresolv -lsocket -lnsl '
481770SgtbGEN_LIB=
491770Sgtb
501770Sgtb# Defaults for program
511770Sgtblibrary=krb5
521770Sgtb
531770Sgtb# Some constants
541770Sgtbvendor_string="Sun Microsystems, Inc."
551770Sgtb
561770Sgtb# Process arguments
571770Sgtb# Yes, we are sloppy, library specifications can come before options
581770Sgtbwhile test $# != 0; do
591770Sgtb    case $1 in
601770Sgtb	--all)
611770Sgtb	    do_all=1
621770Sgtb	    ;;
631770Sgtb	--cflags)
641770Sgtb	    do_cflags=1
651770Sgtb	    ;;
661770Sgtb	--deps)
671770Sgtb	    do_deps=1
681770Sgtb	    ;;
691770Sgtb	--exec-prefix)
701770Sgtb	    do_exec_prefix=1
711770Sgtb	    ;;
721770Sgtb	--help)
731770Sgtb	    do_help=1
741770Sgtb	    ;;
751770Sgtb	--libs)
761770Sgtb	    do_libs=1
771770Sgtb	    ;;
781770Sgtb	--prefix)
791770Sgtb	    do_prefix=1
801770Sgtb	    ;;
811770Sgtb	--vendor)
821770Sgtb	    do_vendor=1
831770Sgtb	    ;;
841770Sgtb	--version)
851770Sgtb	    do_version=1
861770Sgtb	    ;;
871770Sgtb	krb5)
881770Sgtb	    library=krb5
891770Sgtb	    ;;
901770Sgtb	*)
911770Sgtb	    echo "$0: Unknown option \`$1' -- use \`--help' for usage"
921770Sgtb	    exit 1
931770Sgtb    esac
941770Sgtb    shift
951770Sgtbdone
961770Sgtb
971770Sgtb# If required options - provide help
981770Sgtbif 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
991770Sgtb    do_help=1
1001770Sgtbfi
1011770Sgtb
1021770Sgtb
1031770Sgtbif test -n "$do_help"; then
1041770Sgtb    echo "Usage: $0 [OPTIONS] [LIBRARIES]"
1051770Sgtb    echo "Options:"
1061770Sgtb    echo "        [--help]          Help"
1071770Sgtb    echo "        [--all]           Display version, vendor, and various values"
1081770Sgtb    echo "        [--version]       Version information"
1091770Sgtb    echo "        [--vendor]        Vendor information"
1101770Sgtb    echo "        [--prefix]        Kerberos installed prefix"
1111770Sgtb    echo "        [--exec-prefix]   Kerberos installed exec_prefix"
1121770Sgtb    echo "        [--cflags]        Compile time CFLAGS"
1131770Sgtb    echo "        [--libs]          List libraries required to link [LIBRARIES]"
1141770Sgtb    echo "Libraries:"
1151770Sgtb    echo "        krb5              Kerberos 5 application"
1161770Sgtb
1171770Sgtb    exit 0
1181770Sgtbfi
1191770Sgtb
1201770Sgtbif test -n "$do_all"; then
1211770Sgtb    all_exit=
1221770Sgtb    do_version=1
1231770Sgtb    do_prefix=1
1241770Sgtb    do_exec_prefix=1
1251770Sgtb    do_vendor=1
1261770Sgtb    title_version="Version:     "
1271770Sgtb    title_prefix="Prefix:      "
1281770Sgtb    title_exec_prefix="Exec_prefix: "
1291770Sgtb    title_vendor="Vendor:      "
1301770Sgtbelse
1311770Sgtb    all_exit="exit 0"
1321770Sgtbfi
1331770Sgtb
1341770Sgtbif test -n "$do_version"; then
1351770Sgtb    echo "$title_version$version_string"
1361770Sgtb    $all_exit
1371770Sgtbfi
1381770Sgtb
1391770Sgtbif test -n "$do_vendor"; then
1401770Sgtb    echo "$title_vendor$vendor_string"
1411770Sgtb    $all_exit
1421770Sgtbfi
1431770Sgtb
1441770Sgtbif test -n "$do_prefix"; then
1451770Sgtb    echo "$title_prefix$prefix"
1461770Sgtb    $all_exit
1471770Sgtbfi
1481770Sgtb
1491770Sgtbif test -n "$do_exec_prefix"; then
1501770Sgtb    echo "$title_exec_prefix$exec_prefix"
1511770Sgtb    $all_exit
1521770Sgtbfi
1531770Sgtb
1541770Sgtbif test -n "$do_cflags"; then
1551770Sgtb    echo "-I${includedir}"
1561770Sgtbfi
1571770Sgtb
1581770Sgtb
1591770Sgtbif test -n "$do_libs"; then
1601770Sgtb    # Ugly gross hack for our build tree
1611770Sgtb    lib_flags=`echo $CC_LINK | sed -e 's/\$(CC)//' \
1621770Sgtb	    -e 's/\$(PURE)//' \
1631770Sgtb	    -e 's#\$(PROG_RPATH)#'$libdir'#' \
1641770Sgtb	    -e 's#\$(PROG_LIBPATH)#-L'$libdir'#' \
1651770Sgtb	    -e 's#\$(RPATH_FLAG)#'"$RPATH_FLAG"'#' \
1661770Sgtb	    -e 's#\$(LDFLAGS)#'"$LDFLAGS"'#' \
1671770Sgtb	    -e 's#\$(PTHREAD_CFLAGS)#'"$PTHREAD_CFLAGS"'#' \
1681770Sgtb	    -e 's#\$(CFLAGS)#'"$CFLAGS"'#'`
1691770Sgtb
1701770Sgtb    if test $library = 'kdb'; then
1711770Sgtb	lib_flags="$lib_flags -lkdb5 $KDB5_DB_LIB"
1721770Sgtb	library=krb5
1731770Sgtb    fi
1741770Sgtb
1751770Sgtb    if test $library = 'kadm_server'; then
1761770Sgtb	lib_flags="$lib_flags -lkadm5srv -lkdb5 $KDB5_DB_LIB"
1771770Sgtb	library=kadm_common
1781770Sgtb    fi
1791770Sgtb
1801770Sgtb    if test $library = 'kadm_client'; then
1811770Sgtb	lib_flags="$lib_flags -lkadm5clnt"
1821770Sgtb	library=kadm_common
1831770Sgtb    fi
1841770Sgtb
1851770Sgtb    if test $library = 'kadm_common'; then
1861770Sgtb	lib_flags="$lib_flags -lgssrpc"
1871770Sgtb	library=gssapi
1881770Sgtb    fi
1891770Sgtb
1901770Sgtb    if test $library = 'gssapi'; then
1911770Sgtb	lib_flags="$lib_flags -lgssapi_krb5"
1921770Sgtb	library=krb5
1931770Sgtb    fi
1941770Sgtb
1951770Sgtb    if test $library = 'krb4'; then
1961770Sgtb	lib_flags="$lib_flags $KRB4_LIB $DES425_LIB"
1971770Sgtb	library=krb5
1981770Sgtb    fi
1991770Sgtb
2001770Sgtb    if test $library = 'krb5'; then
2011770Sgtb	lib_flags="$lib_flags -lkrb5  $LIBS $GEN_LIB"
2021770Sgtb    fi
2031770Sgtb
2041770Sgtb    echo $lib_flags
2051770Sgtbfi
2061770Sgtb
2071770Sgtbexit 0
208