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