kdc: fix kx509 service principal match
[heimdal.git] / tools / krb5-config.in
blob77652d3bc8f414fc9354ab76b65e324e6dea5171
1 #!/bin/sh
3 # Copyright (c) 2000 - 2008 Kungliga Tekniska Högskolan
4 # (Royal Institute of Technology, Stockholm, Sweden).
5 # All rights reserved.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
11 # 1. Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
18 # 3. Neither the name of the Institute nor the names of its contributors
19 # may be used to endorse or promote products derived from this software
20 # without specific prior written permission.
22 # THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
23 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 # ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
26 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 # SUCH DAMAGE.
35 do_all=no
36 do_libs=no
37 do_lib_deps=no
38 do_cflags=no
39 do_usage=no
40 print_prefix=no
41 print_exec_prefix=no
42 library=
43 lib_krb5=no
44 lib_gssapi=no
45 lib_kadm_client=no
46 lib_kadm_server=no
47 lib_kafs=no
49 if test $# -eq 0; then
50 do_usage=yes
51 usage_exit=1
54 for i in $*; do
55 case $i in
56 --help)
57 do_usage=yes
58 usage_exit=0
60 --all)
61 do_all=yes
63 --vendor)
64 echo "Heimdal"
65 exit 0;
67 --version)
68 echo "@PACKAGE@ @VERSION@"
69 exit 0
71 --prefix=*)
72 prefix=`echo $i | sed 's/^--prefix=//'`
74 --prefix)
75 print_prefix=yes
77 --exec-prefix=*)
78 exec_prefix=`echo $i | sed 's/^--exec-prefix=//'`
80 --exec-prefix)
81 print_exec_prefix=yes
83 --libs)
84 do_libs=yes
86 --deps)
87 do_lib_deps=yes
89 --cflags)
90 do_cflags=yes
92 krb5)
93 library=krb5
94 lib_krb5=yes
96 gssapi)
97 library=gssapi
98 lib_gssapi=yes
100 kadm-client)
101 library=kadm-client
102 lib_kadm_client=yes
104 kadm-server)
105 library=kadm-server
106 lib_kadm_server=yes
108 kafs)
109 library=kafs
110 lib_kafs=yes
113 echo "unknown option: $i"
114 exit 1
116 esac
117 done
119 if test "$do_usage" = "yes"; then
120 echo "usage: $0 [options] [libraries]"
121 echo "options: [--help] show this message"
122 echo " [--all] display version, vendor, etc."
123 echo " [--version] display version information"
124 echo " [--prefix] display the prefix of Kerberos"
125 echo " [--exec-prefix] display the exec_prefix of Kerberos"
126 echo " [--cflags] display the CFLAGS required"
127 echo " [--libs] display the libraries required to link"
128 echo " [--deps] display the dependent libs required"
129 echo " for static linking"
130 echo
131 echo "libraries: krb5 Kerberos 5 applications"
132 echo " gssapi GSSAPI applications"
133 echo " kadm-client libkadm5 client"
134 echo " kadm-server libkadm5 server"
135 echo " kafs kafs"
136 exit $usage_exit
139 if test X"$library" = X; then
140 lib_krb5=yes
143 if test "$prefix" = ""; then
144 prefix=@prefix@
146 if test "$exec_prefix" = ""; then
147 exec_prefix=@exec_prefix@
150 libdir=@libdir@
151 includedir=@includedir@
153 if test "$do_all" = "yes"; then
154 echo "Version: @PACKAGE@ @VERSION@"
155 echo "Vendor: Heimdal"
156 echo "Prefix: $prefix"
157 echo "Exec_prefix: $exec_prefix"
158 exit 0
161 if test "$print_prefix" = "yes"; then
162 echo $prefix
163 exit 0
166 if test "$print_exec_prefix" = "yes"; then
167 echo $exec_prefix
168 exit 0
171 # The following rpath_flag setting code is distilled from MIT Kerberos'
172 # src/config/shlib.conf. Some of this seems ancient and likely to be
173 # wrong in some cases, but right for all the cases we probably care
174 # about. Also, this will very likely be wrong depending on how the
175 # caller will be doing link-edits (with what compiler-driver or
176 # link-editor)! There's no fixing this.
178 # In principle this doesn't belong here: application should instead use
179 # krb5-config --libdir to get the directory to use for the rpath, then
180 # workout the rpath flags on their own. Of course, there's no --libdir
181 # option... And MIT's krb5-config does include rpath flags.
183 # Compatibility with MIT is the winning consideration for now.
184 case "@CANONICAL_HOST@" in
185 alpha*-dec-osf*)
186 rpath_flag='-Wl,-rpath -Wl,';;
187 *-*-hpux*)
188 rpath_flag='-Wl,+b,';;
189 *-*-irix* | mips-*-netbsd*)
190 rpath_flag='-Wl,-rpath -Wl,';;
191 *-*-netbsd* | *-*-openbsd* | *-*-solaris*)
192 rpath_flag='-R';;
193 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-freebsd*)
194 rpath_flag='-Wl,--enable-new-dtags -Wl,-rpath -Wl,';;
195 *-*-aix*)
196 rpath_flag='-Wl,-blibpath:';;
198 rpath_flag=;;
199 esac
201 if test "$do_libs" = "yes"; then
202 deplibs=""
203 if test "$lib_gssapi" = yes; then
204 lib_flags="$lib_flags -lgssapi"
205 deplibs="$deplibs -lheimntlm"
206 if test X"$do_lib_deps" = Xyes; then
207 lib_krb5=yes
210 if test "$lib_kadm_client" = yes; then
211 lib_flags="$lib_flags -lkadm5clnt"
212 if test X"$do_lib_deps" = Xyes; then
213 lib_krb5=yes
216 if test "$lib_kadm_server" = yes; then
217 lib_flags="$lib_flags -lkadm5srv"
218 deplibs="$deplibs @LIB_dbopen@"
219 if test X"$do_lib_deps" = Xyes; then
220 lib_krb5=yes
223 if test "$lib_kafs" = yes; then
224 lib_flags="$lib_flags -lkafs"
225 if test X"$do_lib_deps" = Xyes; then
226 lib_krb5=yes
229 if test "$lib_krb5" = yes; then
230 lib_flags="$lib_flags -lkrb5"
232 deplibs="$deplibs @LIB_pkinit@ -lcom_err"
233 deplibs="$deplibs @LIB_hcrypto_appl@ -lasn1 -lwind -lheimbase -lroken"
234 deplibs="$deplibs @LIB_crypt@ @PTHREAD_LIBADD@ @LIB_dlopen@"
235 deplibs="$deplibs @LIB_door_create@ @LIBS@"
236 if test X"$do_lib_deps" = X"yes"; then
237 lib_flags="$lib_flags $deplibs"
239 if test X"$libdir" != X/usr/lib; then
240 lib_flags="-L${libdir} $lib_flags"
241 if test X"$rpath_flag" != X; then
242 lib_flags="${rpath_flag}${libdir} $lib_flags"
246 echo ${lib_flags}
248 if test "$do_cflags" = "yes"; then
249 cflags=""
250 if test X"${includedir}" != X/usr/include; then
251 cflags="-I${includedir} $cflags"
253 echo $cflags
256 exit 0