xref: /freebsd/crypto/krb5/src/build-tools/krb5-config.in (revision df21a004be237a1dccd03c7b47254625eea62fa9)
1#!/bin/sh
2
3# Copyright 2001, 2002, 2003 by the Massachusetts Institute of Technology.
4# All Rights Reserved.
5#
6# Export of this software from the United States of America may
7#   require a specific license from the United States Government.
8#   It is the responsibility of any person or organization contemplating
9#   export to obtain such a license before exporting.
10#
11# WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
12# distribute this software and its documentation for any purpose and
13# without fee is hereby granted, provided that the above copyright
14# notice appear in all copies and that both that copyright notice and
15# this permission notice appear in supporting documentation, and that
16# the name of M.I.T. not be used in advertising or publicity pertaining
17# to distribution of the software without specific, written prior
18# permission.  Furthermore if you modify this software you must label
19# your software as modified software and not distribute it in such a
20# fashion that it might be confused with the original M.I.T. software.
21# M.I.T. makes no representations about the suitability of
22# this software for any purpose.  It is provided "as is" without express
23# or implied warranty.
24#
25#
26
27# Configurable parameters set by autoconf
28version_string="Kerberos 5 release @KRB5_VERSION@"
29
30prefix=@prefix@
31exec_prefix=@exec_prefix@
32includedir=@includedir@
33libdir=@libdir@
34CC_LINK='@CC_LINK@'
35KDB5_DB_LIB=@KDB5_DB_LIB@
36RPATH_FLAG='@RPATH_FLAG@'
37PROG_RPATH_FLAGS='@PROG_RPATH_FLAGS@'
38PTHREAD_CFLAGS='@PTHREAD_CFLAGS@'
39DL_LIB='@DL_LIB@'
40DEFCCNAME='@DEFCCNAME@'
41DEFKTNAME='@DEFKTNAME@'
42DEFCKTNAME='@DEFCKTNAME@'
43
44LIBS='@LIBS@'
45
46# Defaults for program
47library=krb5
48
49# Some constants
50vendor_string="Massachusetts Institute of Technology"
51
52# Process arguments
53# Yes, we are sloppy, library specifications can come before options
54while test $# != 0; do
55    case $1 in
56	--all)
57	    do_all=1
58	    ;;
59	--cflags)
60	    do_cflags=1
61	    ;;
62	--defccname)
63	    do_defccname=1
64	    ;;
65	--defcktname)
66	    do_defcktname=1
67	    ;;
68	--defktname)
69	    do_defktname=1
70	    ;;
71	--deps) # historically a no-op
72	    ;;
73	--exec-prefix)
74	    do_exec_prefix=1
75	    ;;
76	--help)
77	    do_help=1
78	    ;;
79	--libs)
80	    do_libs=1
81	    ;;
82	--prefix)
83	    do_prefix=1
84	    ;;
85	--vendor)
86	    do_vendor=1
87	    ;;
88	--version)
89	    do_version=1
90	    ;;
91	krb5)
92	    library=krb5
93	    ;;
94	gssapi)
95	    library=gssapi
96	    ;;
97	gssrpc)
98	    library=gssrpc
99	    ;;
100	kadm-client)
101	    library=kadm_client
102	    ;;
103	kadm-server)
104	    library=kadm_server
105	    ;;
106	kdb)
107	    library=kdb
108	    ;;
109	*)
110	    echo "$0: Unknown option \`$1' -- use \`--help' for usage"
111	    exit 1
112    esac
113    shift
114done
115
116# If required options - provide help
117if test -z "$do_all" -a -z "$do_version" -a -z "$do_vendor" -a \
118    -z "$do_prefix" -a -z "$do_vendor" -a -z "$do_exec_prefix" -a \
119    -z "$do_defccname" -a -z "$do_defktname" -a -z "$do_defcktname" -a \
120    -z "$do_cflags" -a -z "$do_libs"; then
121    do_help=1
122fi
123
124
125if test -n "$do_help"; then
126    echo "Usage: $0 [OPTIONS] [LIBRARIES]"
127    echo "Options:"
128    echo "        [--help]          Help"
129    echo "        [--all]           Display version, vendor, and various values"
130    echo "        [--version]       Version information"
131    echo "        [--vendor]        Vendor information"
132    echo "        [--prefix]        Kerberos installed prefix"
133    echo "        [--exec-prefix]   Kerberos installed exec_prefix"
134    echo "        [--defccname]     Show built-in default ccache name"
135    echo "        [--defktname]     Show built-in default keytab name"
136    echo "        [--defcktname]    Show built-in default client keytab name"
137    echo "        [--cflags]        Compile time CFLAGS"
138    echo "        [--libs]          List libraries required to link [LIBRARIES]"
139    echo "Libraries:"
140    echo "        krb5              Kerberos 5 application"
141    echo "        gssapi            GSSAPI application with Kerberos 5 bindings"
142    echo "        gssrpc            GSSAPI RPC application"
143    echo "        kadm-client       Kadmin client"
144    echo "        kadm-server       Kadmin server"
145    echo "        kdb               Application that accesses the kerberos database"
146    exit 0
147fi
148
149if test -n "$do_all"; then
150    all_exit=
151    do_version=1
152    do_prefix=1
153    do_exec_prefix=1
154    do_vendor=1
155    title_version="Version:     "
156    title_prefix="Prefix:      "
157    title_exec_prefix="Exec_prefix: "
158    title_vendor="Vendor:      "
159else
160    all_exit="exit 0"
161fi
162
163if test -n "$do_version"; then
164    echo "$title_version$version_string"
165    $all_exit
166fi
167
168if test -n "$do_vendor"; then
169    echo "$title_vendor$vendor_string"
170    $all_exit
171fi
172
173if test -n "$do_prefix"; then
174    echo "$title_prefix$prefix"
175    $all_exit
176fi
177
178if test -n "$do_exec_prefix"; then
179    echo "$title_exec_prefix$exec_prefix"
180    $all_exit
181fi
182
183if test -n "$do_defccname"; then
184    echo "$DEFCCNAME"
185    $all_exit
186fi
187
188if test -n "$do_defktname"; then
189    echo "$DEFKTNAME"
190    $all_exit
191fi
192
193if test -n "$do_defcktname"; then
194    echo "$DEFCKTNAME"
195    $all_exit
196fi
197
198if test -n "$do_cflags"; then
199    if test x"$includedir" != x"/usr/include" ; then
200        echo "-I${includedir}"
201    else
202        echo ''
203    fi
204fi
205
206
207if test -n "$do_libs"; then
208    # Assumes /usr/lib is the standard library directory everywhere...
209    if test "$libdir" = /usr/lib; then
210	libdirarg=
211    else
212	libdirarg="-L$libdir"
213    fi
214    # Ugly gross hack for our build tree
215    lib_flags=`echo $CC_LINK | sed -e 's/\$(CC)//' \
216	    -e 's/\$(PURE)//' \
217	    -e 's#\$(PROG_RPATH_FLAGS)#'"$PROG_RPATH_FLAGS"'#' \
218	    -e 's#\$(PROG_RPATH)#'$libdir'#' \
219	    -e 's#\$(PROG_LIBPATH)#'$libdirarg'#' \
220	    -e 's#\$(RPATH_FLAG)#'"$RPATH_FLAG"'#' \
221	    -e 's#\$(LDFLAGS)##' \
222	    -e 's#\$(PTHREAD_CFLAGS)#'"$PTHREAD_CFLAGS"'#' \
223	    -e 's#\$(CFLAGS)##'`
224
225    if test $library = 'kdb'; then
226	lib_flags="$lib_flags -lkdb5 $KDB5_DB_LIB"
227	library=krb5
228    fi
229
230    if test $library = 'kadm_server'; then
231	lib_flags="$lib_flags -lkadm5srv_mit -lkdb5 $KDB5_DB_LIB"
232	library=gssrpc
233    fi
234
235    if test $library = 'kadm_client'; then
236	lib_flags="$lib_flags -lkadm5clnt_mit"
237	library=gssrpc
238    fi
239
240    if test $library = 'gssrpc'; then
241	lib_flags="$lib_flags -lgssrpc"
242	library=gssapi
243    fi
244
245    if test $library = 'gssapi'; then
246	lib_flags="$lib_flags -lgssapi_krb5"
247	library=krb5
248    fi
249
250    if test $library = 'krb5'; then
251	lib_flags="$lib_flags -lkrb5 -lk5crypto @COM_ERR_LIB@"
252    fi
253
254    # If we ever support a flag to generate output suitable for static
255    # linking, we would output "-lkrb5support $LIBS $DL_LIB" here.
256
257    echo $lib_flags
258fi
259
260exit 0
261