Add keytab kinit test cases
[krb5.git] / src / krb5-config.in
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
28 version_string="Kerberos 5 release @KRB5_VERSION@"
29
30 prefix=@prefix@
31 exec_prefix=@exec_prefix@
32 includedir=@includedir@
33 libdir=@libdir@
34 CC_LINK='@CC_LINK@'
35 KDB5_DB_LIB=@KDB5_DB_LIB@
36 LDFLAGS='@LDFLAGS@'
37 RPATH_FLAG='@RPATH_FLAG@'
38 PROG_RPATH_FLAGS='@PROG_RPATH_FLAGS@'
39 PTHREAD_CFLAGS='@PTHREAD_CFLAGS@'
40 DL_LIB='@DL_LIB@'
41
42 LIBS='@LIBS@'
43 GEN_LIB=@GEN_LIB@
44
45 # Defaults for program
46 library=krb5
47
48 # Some constants
49 vendor_string="Massachusetts Institute of Technology"
50
51 # Process arguments
52 # Yes, we are sloppy, library specifications can come before options
53 while test $# != 0; do
54     case $1 in
55         --all)
56             do_all=1
57             ;;
58         --cflags)
59             do_cflags=1
60             ;;
61         --deps)
62             do_deps=1
63             ;;
64         --exec-prefix)
65             do_exec_prefix=1
66             ;;
67         --help)
68             do_help=1
69             ;;
70         --libs)
71             do_libs=1
72             ;;
73         --prefix)
74             do_prefix=1
75             ;;
76         --vendor)
77             do_vendor=1
78             ;;
79         --version)
80             do_version=1
81             ;;
82         krb5)
83             library=krb5
84             ;;
85         gssapi)
86             library=gssapi
87             ;;
88         kadm-client)
89             library=kadm_client
90             ;;
91         kadm-server)
92             library=kadm_server
93             ;;
94         kdb)
95             library=kdb
96             ;;
97         *)
98             echo "$0: Unknown option \`$1' -- use \`--help' for usage"
99             exit 1
100     esac
101     shift
102 done
103
104 # If required options - provide help
105 if 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
106     do_help=1
107 fi
108
109
110 if test -n "$do_help"; then
111     echo "Usage: $0 [OPTIONS] [LIBRARIES]"
112     echo "Options:"
113     echo "        [--help]          Help"
114     echo "        [--all]           Display version, vendor, and various values"
115     echo "        [--version]       Version information"
116     echo "        [--vendor]        Vendor information"
117     echo "        [--prefix]        Kerberos installed prefix"
118     echo "        [--exec-prefix]   Kerberos installed exec_prefix"
119     echo "        [--cflags]        Compile time CFLAGS"
120     echo "        [--libs]          List libraries required to link [LIBRARIES]"
121     echo "Libraries:"
122     echo "        krb5              Kerberos 5 application"
123     echo "        gssapi            GSSAPI application with Kerberos 5 bindings"
124     echo "        kadm-client       Kadmin client"
125     echo "        kadm-server       Kadmin server"
126     echo "        kdb               Application that accesses the kerberos database"
127     exit 0
128 fi
129
130 if test -n "$do_all"; then
131     all_exit=
132     do_version=1
133     do_prefix=1
134     do_exec_prefix=1
135     do_vendor=1
136     title_version="Version:     "
137     title_prefix="Prefix:      "
138     title_exec_prefix="Exec_prefix: "
139     title_vendor="Vendor:      "
140 else
141     all_exit="exit 0"
142 fi
143
144 if test -n "$do_version"; then
145     echo "$title_version$version_string"
146     $all_exit
147 fi
148
149 if test -n "$do_vendor"; then
150     echo "$title_vendor$vendor_string"
151     $all_exit
152 fi
153
154 if test -n "$do_prefix"; then
155     echo "$title_prefix$prefix"
156     $all_exit
157 fi
158
159 if test -n "$do_exec_prefix"; then
160     echo "$title_exec_prefix$exec_prefix"
161     $all_exit
162 fi
163
164 if test -n "$do_cflags"; then
165     if test x"$includedir" != x"/usr/include" ; then
166         echo "-I${includedir}"
167     else
168         echo ''
169     fi
170 fi
171
172
173 if test -n "$do_libs"; then
174     # Assumes /usr/lib is the standard library directory everywhere...
175     if test "$libdir" = /usr/lib; then
176         libdirarg=
177     else
178         libdirarg="-L$libdir"
179     fi
180     # Ugly gross hack for our build tree
181     lib_flags=`echo $CC_LINK | sed -e 's/\$(CC)//' \
182             -e 's/\$(PURE)//' \
183             -e 's#\$(PROG_RPATH_FLAGS)#'"$PROG_RPATH_FLAGS"'#' \
184             -e 's#\$(PROG_RPATH)#'$libdir'#' \
185             -e 's#\$(PROG_LIBPATH)#'$libdirarg'#' \
186             -e 's#\$(RPATH_FLAG)#'"$RPATH_FLAG"'#' \
187             -e 's#\$(LDFLAGS)#'"$LDFLAGS"'#' \
188             -e 's#\$(PTHREAD_CFLAGS)#'"$PTHREAD_CFLAGS"'#' \
189             -e 's#\$(CFLAGS)##'`
190
191     if test $library = 'kdb'; then
192         lib_flags="$lib_flags -lkdb5 $KDB5_DB_LIB"
193         library=krb5
194     fi
195
196     if test $library = 'kadm_server'; then
197         lib_flags="$lib_flags -lkadm5srv_mit -lkdb5 $KDB5_DB_LIB"
198         library=kadm_common
199     fi
200
201     if test $library = 'kadm_client'; then
202         lib_flags="$lib_flags -lkadm5clnt_mit"
203         library=kadm_common
204     fi
205
206     if test $library = 'kadm_common'; then
207         lib_flags="$lib_flags -lgssrpc"
208         library=gssapi
209     fi
210
211     if test $library = 'gssapi'; then
212         lib_flags="$lib_flags -lgssapi_krb5"
213         library=krb5
214     fi
215
216     if test $library = 'krb5'; then
217         lib_flags="$lib_flags -lkrb5 -lk5crypto -lcom_err"
218     fi
219
220     # If we ever support a flag to generate output suitable for static
221     # linking, we would output "-lkrb5support $GEN_LIB $LIBS $DL_LIB"
222     # here.
223
224     echo $lib_flags
225 fi
226
227 exit 0