Committing what I have. See ChangeLog for the last couple of things I
[mod_auth_kerb.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(Apache Kerberos Module,
3         alpha2,
4         modauthkerb-developers@lists.sourceforge.net,
5         mod_auth_kerb)
6 AC_CANONICAL_HOST
7
8
9 dnl OS specific options.
10 case "$host" in
11 *-*-netbsd*)
12         need_dash_r=1
13         ;;
14 *-*-solaris*)
15         need_dash_r=1
16         ;;
17 esac
18
19
20 dnl Custom args we care about.
21 AC_ARG_WITH(api,
22 [  --with-api=API                      api to use (apache1, apache2)],
23 [
24         case $withval in
25                 'apache1')
26                         ac_api=apache1
27                         ac_apidefs="-DAPXS1"
28                         ;;
29                 'apache2')
30                         ac_api=apache2
31                         ac_apidefs="-DAPXS2"
32                         ;;
33                 *)
34                         AC_ERROR(You can only specify apache1 or apache2.)
35                         ;;
36         esac
37 ]
38 )
39
40 AC_ARG_WITH(apxs,
41 [  --with-apxs=PATH                    path to apxs],
42 [
43         if test -e $withval ; then
44                 APXS="$withval"
45         else
46                 AC_ERROR(Specified apxs path does not exist.)
47         fi
48 ]
49 )
50
51 AC_ARG_WITH(static,
52 [  --with-static                       module is to be statically linked],
53 [
54         ac_static="yes"
55 ]
56 )
57
58 AC_ARG_WITH(krb5,
59 [  --with-krb5=DIR                     path to Kerberos 5 install],
60 [
61         CFLAGS="$CFLAGS -I$withval/include -I$withval/include/kerberosIV"
62         CPPFLAGS="$CPPFLAGS -I$withval/include -I$withval/include/kerberosIV"
63         LDFLAGS="$LDFLAGS -L$withval/lib"
64         if test -n "${need_dash_r}"; then
65                 LDFLAGS="$LDFLAGS -R$withval/lib"
66         fi
67 ]
68 )
69
70 AC_ARG_WITH(krb5-include,
71 [    --with-krb5-include=DIR           include path to Kerberos 5 install],
72 [
73         CFLAGS="$CFLAGS -I$withval -I$withval/kerberosIV"
74         CPPFLAGS="$CPPFLAGS -I$withval -I$withval/kerberosIV"
75 ]
76 )
77
78 AC_ARG_WITH(krb5-lib,
79 [    --with-krb5-lib=DIR               lib path to Kerberos 5 install],
80 [
81         LDFLAGS="$LDFLAGS -L$withval"
82         if test -n "${need_dash_r}"; then
83                 LDFLAGS="$LDFLAGS -R$withval"
84         fi
85 ]
86 )
87
88 AC_ARG_ENABLE(krb5,
89 [  --disable-krb5                      force disabling of krb5 support],
90 [
91         if test "$enable_krb5" = "no" ; then
92                 ac_krb5_disable="yes"
93         fi
94 ],
95 )
96
97 AC_ARG_WITH(krb4,
98 [  --with-krb4=DIR                     path to Kerberos 4 install],
99 [
100         CFLAGS="$CFLAGS -I$withval/include"
101         CPPFLAGS="$CPPFLAGS -I$withval/include"
102         LDFLAGS="$LDFLAGS -L$withval/lib"
103         if test -n "${need_dash_r}"; then
104                 LDFLAGS="$LDFLAGS -R$withval/lib"
105         fi
106 ]
107 )
108
109 AC_ARG_WITH(krb4-include,
110 [    --with-krb4-include=DIR           include path to Kerberos 4 install],
111 [
112         CFLAGS="$CFLAGS -I$withval"
113         CPPFLAGS="$CPPFLAGS -I$withval"
114 ]
115 )
116
117 AC_ARG_WITH(krb4-lib,
118 [    --with-krb4-lib=DIR               lib path to Kerberos 4 install],
119 [
120         LDFLAGS="$LDFLAGS -L$withval"
121         if test -n "${need_dash_r}"; then
122                 LDFLAGS="$LDFLAGS -R$withval"
123         fi
124 ]
125 )
126
127 AC_ARG_ENABLE(krb4,
128 [  --disable-krb4                      force disabling of krb4 support],
129 [
130         if test "$enable_krb4" = "no" ; then
131                 ac_krb4_disable="yes"
132         fi
133 ],
134 )
135
136 AC_ARG_WITH(gssapi,
137 [  --with-gssapi=DIR                   path to GSSAPI install],
138 [
139         CFLAGS="$CFLAGS -I$withval/include -I$withval/include/gssapi"
140         CPPFLAGS="$CPPFLAGS -I$withval/include -I$withval/include/gssapi"
141         LDFLAGS="$LDFLAGS -L$withval/lib"
142         if test -n "${need_dash_r}"; then
143                 LDFLAGS="$LDFLAGS -R$withval/lib"
144         fi
145 ]
146 )
147
148 AC_ARG_WITH(gssapi-include,
149 [    --with-gssapi-include=DIR         include path to GSSAPI install],
150 [
151         CFLAGS="$CFLAGS -I$withval -I$withval/gssapi"
152         CPPFLAGS="$CPPFLAGS -I$withval -I$withval/gssapi"
153 ]
154 )
155
156 AC_ARG_WITH(gssapi-lib,
157 [    --with-gssapi-lib=DIR             lib path to GSSAPI install],
158 [
159         LDFLAGS="$LDFLAGS -L$withval"
160         if test -n "${need_dash_r}"; then
161                 LDFLAGS="$LDFLAGS -R$withval"
162         fi
163 ]
164 )
165
166 AC_ARG_ENABLE(gssapi,
167 [  --disable-gssapi                    force disabling of gssapi support],
168 [
169         if test "$enable_gssapi" = "no" ; then
170                 ac_gssapi_disable="yes"
171         fi
172 ]
173 )
174
175
176
177 dnl Checks for programs.
178 AC_PROG_CC
179 AC_PROG_MAKE_SET
180 if test -z "$ac_static" ; then
181         AC_PATH_PROG(APXS, apxs)
182         if test -z "$APXS" ; then
183                 echo "No apxs found.  Defaulting to static module generation."
184                 ac_static="yes"
185         fi
186 fi
187
188
189 dnl Checks for libraries.
190 if test -z "$ac_krb5_disable" ; then
191         AC_CHECK_LIB(krb5, krb5_get_in_tkt_with_password, [
192                 ac_krb5="yes"
193                 ac_krbdefs="-DKRB5"
194                 ac_krblibs="-lkrb5"
195                 AC_CHECK_LIB(k5crypto, krb5_string_to_key, [
196                         ac_krblibs="$ac_krblibs -lk5crypto"
197                 ], [
198                         AC_CHECK_LIB(crypto, krb5_string_to_key, [
199                                 ac_krblibs="$ac_krblibs -lcrypto"
200                         ], [
201                                 ac_krblibs=""
202                         ], "-lcom_err")
203                 ], "-lcom_err")
204                 ac_krblibs="$ac_krblibs -lcom_err"
205                 
206                 if test -z "$ac_krb4_disable" ; then
207                         if test -n "$ac_krblibs" ; then
208                                 AC_CHECK_LIB(krb4, krb_get_pw_in_tkt, [
209                                         ac_krb4="yes"
210                                         ac_krbdefs="$ac_krbdefs -DKRB4"
211                                         ac_krblibs="-lkrb4 $ac_krblibs"
212                                 ],, $ac_krblibs)
213                         fi
214                 fi
215         ],, "-lcom_err")
216 fi
217
218 if test -z "$ac_krb4_disable" -a -z "$ac_krb4" ; then
219         AC_CHECK_LIB(krb, krb_get_pw_in_tkt, [
220                 ac_krb4="yes"
221                 ac_krbdefs="-DKRB4"
222                 ac_krblibs="$ac_krblibs -lkrb -lcom_err"
223         ],, "-lcom_err")
224 fi
225
226 if test -z "$ac_krb4" -a -z "$ac_krb5" ; then
227         AC_ERROR(Neither Kerberos 5 nor 4 support available.)
228 fi
229
230
231 dnl Checks for header files.
232 if test -n "$ac_krb5" ; then
233         AC_CHECK_HEADERS(krb5.h, [
234                 ac_foundkrb5="yes"
235                 break
236         ])
237
238         if test -z "$ac_foundkrb5" ; then
239                 AC_MSG_RESULT(krb5.h not found... removing krb5 support.)
240                 ac_krb5=""
241         fi
242 fi
243
244 if test -n "$ac_krb4" ; then
245         AC_CHECK_HEADERS(kerberosIV/krb.h krb.h, [
246                 ac_foundkrb4="yes"
247                 break
248         ])
249
250         if test -z "$ac_foundkrb4" ; then
251                 AC_MSG_RESULT(krb.h not found... removing krb4 support.)
252                 ac_krb4=""
253         fi
254 fi
255
256 if test -z "$ac_krb4" -a -z "$ac_krb5" ; then
257         AC_ERROR(Neither Kerberos 5 nor 4 support available.)
258 fi
259
260
261 dnl Checks for typedefs, structures, and compiler characteristics.
262 if test -z "$ac_api" ; then
263         if test -n "`$APXS -q bindir 2> /dev/null`" ; then
264                 echo "API autodetected to be Apache 2.*"
265                 ac_api=apache2
266                 ac_apidefs="-DAPXS2"
267         else
268                 echo "API autodetected to be Apache 1.*"
269                 ac_api=apache1
270                 ac_apidefs="-DAPXS1"
271         fi
272 fi
273
274
275 dnl Checks for library functions.
276
277
278 dnl Last minute settings.
279 LIBS="$LIBS $ac_krblibs"
280 DEFS="$DEFS $ac_apidefs $ac_krbdefs"
281 CFLAGS="$CFLAGS $DEFS"
282
283
284 dnl Create files necessary to compile mod_auth_kerb.
285 if test "$ac_static" = "yes" ; then
286         echo ""
287         echo ""
288         echo "This module is to be built statically into Apache.  You will need"
289         echo "to place it into the appropriate location in the source tree and"
290         echo "compile Apache accordingly.  You can look at the online docs at"
291         echo "http://modauthkerb.sourceforge.net/ or README.static for more"
292         echo "information."
293         echo ""
294         echo ""
295 else
296         AC_OUTPUT(Makefile)
297         AC_OUTPUT(src/Makefile)
298 fi
299
300 exit 0