Don't be fooled by krb5-config when cross-compiling.
[gsasl.git] / lib / configure.ac
blobdf50807e75d6b6317584d63bca30e91a9d3148ad
1 dnl Process this file with autoconf to produce a configure script.
3 # Copyright (C) 2002, 2003, 2004, 2005, 2006 Simon Josefsson.
5 # This file is part of GNU SASL Library.
7 # GNU SASL Library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public License
9 # as published by the Free Software Foundation; either version 2.1 of
10 # the License, or (at your option) any later version.
12 # GNU SASL Library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with GNU SASL Library; if not, write to the Free
19 # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 # MA 02110-1301, USA.
22 AC_INIT([libgsasl], [0.2.11], [bug-gsasl@gnu.org])
24 # Library code modified:                              REVISION++
25 # Interfaces changed/added/removed:   CURRENT++       REVISION=0
26 # Interfaces added:                             AGE++
27 # Interfaces removed:                           AGE=0
28 AC_SUBST(LT_CURRENT, 9)
29 AC_SUBST(LT_REVISION, 7)
30 AC_SUBST(LT_AGE, 2)
32 AC_PREREQ(2.59)
33 AM_INIT_AUTOMAKE([1.9 gnits])
34 AC_CONFIG_HEADERS(config.h)
36 # Checks for programs.
37 AM_GNU_GETTEXT(external)
38 AM_GNU_GETTEXT_VERSION(0.14.1)
39 AC_PROG_CC
40 gl_EARLY
41 AC_PROG_LIBTOOL
43 # Checks for header files.
44 AC_CHECK_HEADERS(sys/types.h netinet/in.h)
46 # ANONYMOUS
47 AC_ARG_ENABLE(anonymous,
48   AS_HELP_STRING([--disable-anonymous], [don't use the ANONYMOUS mechanism]),
49   anonymous=$enableval)
50 if test "$anonymous" != "no" ; then
51         anonymous=yes
52         AC_DEFINE(USE_ANONYMOUS, 1, [Define to 1 if you want ANONYMOUS.])
54 AC_MSG_CHECKING([if ANONYMOUS should be used])
55 AC_MSG_RESULT($anonymous)
56 AM_CONDITIONAL(ANONYMOUS, test x$anonymous = xyes)
58 # EXTERNAL
59 AC_ARG_ENABLE(external,
60   AS_HELP_STRING([--disable-external], [don't use the EXTERNAL mechanism]),
61   external=$enableval)
62 if test "$external" != "no" ; then
63         external=yes
64         AC_DEFINE(USE_EXTERNAL, 1, [Define to 1 if you want EXTERNAL.])
66 AC_MSG_CHECKING([if EXTERNAL should be used])
67 AC_MSG_RESULT($external)
68 AM_CONDITIONAL(EXTERNAL, test x$external = xyes)
70 # PLAIN
71 AC_ARG_ENABLE(plain,
72   AS_HELP_STRING([--disable-plain], [don't use the PLAIN mechanism]),
73   plain=$enableval)
74 if test "$plain" != "no" ; then
75         plain=yes
76         AC_DEFINE(USE_PLAIN, 1, [Define to 1 if you want PLAIN.])
78 AC_MSG_CHECKING([if PLAIN should be used])
79 AC_MSG_RESULT($plain)
80 AM_CONDITIONAL(PLAIN, test x$plain = xyes)
82 # LOGIN
83 AC_ARG_ENABLE(login,
84   AS_HELP_STRING([--disable-login], [don't use the LOGIN mechanism]),
85   login=$enableval)
86 if test "$login" != "no" ; then
87         login=yes
88         AC_DEFINE(USE_LOGIN, 1, [Define to 1 if you want LOGIN.])
90 AC_MSG_CHECKING([if LOGIN should be used])
91 AC_MSG_RESULT($login)
92 AM_CONDITIONAL(LOGIN, test x$login = xyes)
94 # SECURID
95 AC_ARG_ENABLE(securid,
96   AS_HELP_STRING([--disable-securid], [don't use the SECURID mechanism]),
97   securid=$enableval)
98 if test "$securid" != "no" ; then
99         securid=yes
100         AC_DEFINE(USE_SECURID, 1, [Define to 1 if you want SECURID.])
102 AC_MSG_CHECKING([if SECURID should be used])
103 AC_MSG_RESULT($securid)
104 AM_CONDITIONAL(SECURID, test x$securid = xyes)
106 # NTLM
107 AC_ARG_ENABLE(ntlm,
108   AS_HELP_STRING([--disable-ntlm], [don't use the NTLM mechanism]),
109   ntlm=$enableval)
110 if test "$ntlm" != "no"; then
111     AC_LIB_HAVE_LINKFLAGS(ntlm,, [#include <ntlm.h>],
112       [buildSmbNtlmAuthRequest_noatsplit (0, 0, 0);])
113   if test "$ac_cv_libntlm" != yes; then
114     ntlm=no
115     AC_MSG_WARN([Libntlm >= 0.3.5 not found, disabling NTLM.])
116   else
117     ntlm=yes
118     AC_DEFINE(USE_NTLM, 1, [Define to 1 if you want NTLM.])
119   fi
121 AC_MSG_CHECKING([if NTLM should be used])
122 AC_MSG_RESULT($ntlm)
123 AM_CONDITIONAL(NTLM, test x$ntlm = xyes)
125 # CRAM-MD5
126 AC_ARG_ENABLE(cram-md5,
127   AS_HELP_STRING([--disable-cram-md5], [don't use the CRAM-MD5 mechanism]),
128   cram_md5=$enableval)
129 if test "$cram_md5" != "no" ; then
130         cram_md5=yes
131         AC_DEFINE(USE_CRAM_MD5, 1, [Define to 1 if you want CRAM-MD5.])
133 AC_MSG_CHECKING([if CRAM-MD5 should be used])
134 AC_MSG_RESULT($cram_md5)
135 AM_CONDITIONAL(CRAM_MD5, test x$cram_md5 = xyes)
137 # DIGEST-MD5
138 AC_ARG_ENABLE(digest-md5,
139   AS_HELP_STRING([--disable-digest-md5], [don't use the DIGEST-MD5 mechanism]),
140   digest_md5=$enableval)
141 if test "$digest_md5" != "no" ; then
142         digest_md5=yes
143         AC_DEFINE(USE_DIGEST_MD5, 1, [Define to 1 if you want DIGEST-MD5.])
145 AC_MSG_CHECKING([if DIGEST-MD5 should be used])
146 AC_MSG_RESULT($digest_md5)
147 AM_CONDITIONAL(DIGEST_MD5, test x$digest_md5 = xyes)
149 # GSSAPI.
150 AC_ARG_ENABLE(gssapi,
151   AS_HELP_STRING([--disable-gssapi], [don't use the GSSAPI mechanism]),
152   gssapi=$enableval, gssapi=yes)
153 AC_MSG_NOTICE([checking for GSS implementation])
154 if test "$gssapi" = "gss"; then
155   AC_MSG_NOTICE([trying GSS])
156   AC_LIB_HAVE_LINKFLAGS(gss,, [#include <gss.h>], [gss_check_version (0);])
157   if test "$ac_cv_libgss" != yes; then
158     gssapi=no
159     AC_MSG_WARN([GNU GSS not found, disabling GSSAPI.])
160   else
161     gssapi=yes
162     AC_DEFINE(USE_GSS, 1, [Define to 1 if you want GSS.])
163   fi
164 elif test "$gssapi" = "mit"; then
165   AC_MSG_NOTICE([trying MIT])
166   AC_PATH_PROG(KRB5_CONFIG, krb5-config, no)
167   if test "$KRB5_CONFIG" != "no" ; then
168     CPPFLAGS="$CPPFLAGS `$KRB5_CONFIG --cflags`"
169     LIBS="$LIBS `$KRB5_CONFIG --libs gssapi`"
170     AC_CHECK_HEADERS(gssapi/gssapi.h gssapi/gssapi_generic.h)
171     AC_CHECK_DECL(GSS_C_NT_HOSTBASED_SERVICE,,
172       [AC_DEFINE(GSS_C_NT_HOSTBASED_SERVICE, gss_nt_service_name,
173                  [Work around buggy MIT library])], [
174 #ifdef HAVE_GSSAPI_GSSAPI_H
175 # include <gssapi/gssapi.h>
176 #endif
177 #ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
178 # include <gssapi/gssapi_generic.h>
179 #endif
181     gssapi=yes
182   else
183     AC_MSG_WARN([MIT Kerberos krb5-config not found, disabling GSSAPI])
184     gssapi=no
185   fi
186 elif test "$gssapi" = "heimdal"; then
187   AC_MSG_NOTICE([trying Heimdal])
188   AC_PATH_PROG(KRB5_CONFIG, krb5-config, no)
189   if test "$KRB5_CONFIG" != "no" ; then
190     CPPFLAGS="$CPPFLAGS `$KRB5_CONFIG --cflags`"
191     LIBS="$LIBS `$KRB5_CONFIG --libs gssapi`"
192     AC_CHECK_HEADERS(gssapi.h)
193     gssapi=yes
194   else
195     AC_MSG_WARN([Heimdal krb5-config not found, disabling GSSAPI])
196     gssapi=no
197   fi
198 elif test "$gssapi" != "no" ; then
199   AC_MSG_NOTICE([auto-detecing GSS/MIT/Heimdal])
200   AC_MSG_NOTICE([use --enable-gssapi=IMPL to override])
201   AC_MSG_NOTICE([where IMPL is `gss', `mit', or `heimdal'])
202   AC_LIB_HAVE_LINKFLAGS(gss,, [#include <gss.h>], [gss_check_version (0);])
203   if test "$ac_cv_libgss" = yes; then
204     gssapi=yes
205     AC_MSG_NOTICE([GNU GSS found])
206     AC_DEFINE(USE_GSS, 1, [Define to 1 if you want GSS.])
207   elif test "$cross_compiling" = "yes"; then
208     AC_MSG_NOTICE([Cross-compiling, won't rely on MIT/Heimdal krb5-config])
209     AC_MSG_NOTICE([Use --enable-gssapi=mit or --enable-gssapi=heimdal.])
210   else
211     AC_MSG_WARN([GNU GSS not found (see http://josefsson.org/gss/)...])
212     AC_PATH_PROG(KRB5_CONFIG, krb5-config, no)
213     if test "$KRB5_CONFIG" != "no" ; then
214       AC_MSG_NOTICE([MIT/Heimdal found])
215       CPPFLAGS="$CPPFLAGS `$KRB5_CONFIG --cflags`"
216       LIBS="$LIBS `$KRB5_CONFIG --libs gssapi`"
217       AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h)
218       if test "$ac_cv_header_gssapi_h" = "yes" &&
219          test "$ac_cv_header_gssapi_gssapi_h" = "yes"; then
220         AC_MSG_WARN([Both Heimdal and MIT GSSAPI header files found.  Will use Heimdal.])
221         AC_MSG_WARN([Use --enable-gssapi=mit to override.])
222       fi
223       if test "$ac_cv_header_gssapi_h" != "no"; then
224         AC_MSG_NOTICE([Heimdal found])
225       else
226         AC_MSG_NOTICE([MIT found])
227         AC_CHECK_DECL(GSS_C_NT_HOSTBASED_SERVICE,,
228           [AC_DEFINE(GSS_C_NT_HOSTBASED_SERVICE, gss_nt_service_name,
229             [Work around buggy MIT library])], [
230 #ifdef HAVE_GSSAPI_GSSAPI_H
231 # include <gssapi/gssapi.h>
232 #endif
233 #ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
234 # include <gssapi/gssapi_generic.h>
235 #endif
237       fi
238       gssapi=yes
239     else
240       gssapi=no
241       AC_MSG_WARN([krb5-config not found, disabling GSSAPI])
242     fi
243   fi
245 if test "$gssapi" = "yes"; then
246         AC_DEFINE(USE_GSSAPI, 1, [Define to 1 if you want GSSAPI.])
248 AC_MSG_CHECKING([if GSSAPI should be used])
249 AC_MSG_RESULT($gssapi)
250 AM_CONDITIONAL(GSSAPI, test x$gssapi = xyes)
252 # KERBEROS_V5
253 AC_ARG_ENABLE(kerberos_v5,
254   AS_HELP_STRING([--disable-kerberos_v5],
255     [don't use the KERBEROS_V5 mechanism]),
256   kerberos_v5=$enableval, kerberos_v5=no)
257 if test "$kerberos_v5" != "no" ; then
258   AC_LIB_HAVE_LINKFLAGS(shishi,, [#include <shishi.h>], [shishi ();])
259   if test "$ac_cv_libshishi" != yes; then
260     kerberos_v5=no
261     AC_MSG_WARN([GNU Shishi not found, disabling KERBEROS_V5])
262   else
263     kerberos_v5=yes
264     AC_DEFINE(USE_KERBEROS_V5, 1, [Define to 1 if you want KERBEROS_V5.])
265   fi
267 AC_MSG_CHECKING([if KERBEROS_V5 should be used])
268 AC_MSG_RESULT($kerberos_v5)
269 AM_CONDITIONAL(KERBEROS_V5, test x$kerberos_v5 = xyes)
271 # Check for libidn
272 AC_ARG_WITH(stringprep,
273   AS_HELP_STRING([--without-stringprep], [disable non-ASCII support]),
274   stringprep=$withval, stringprep=yes)
275 if test "$stringprep" != "no"; then
276   AC_LIB_HAVE_LINKFLAGS(idn,, [#include <stringprep.h>],
277       [stringprep_check_version (0);])
278   if test "$ac_cv_libidn" != yes; then
279     stringprep=no
280     AC_MSG_WARN([GNU Libidn not found.  Stringprep disabled.])
281   else
282     stringprep=yes
283     save_LIBS="$LIBS"
284     LIBS="$LIBS $LIBIDN"
285     AC_CHECK_FUNCS(pr29_8z)
286     AC_CHECK_HEADERS(pr29.h)
287     LIBS="$save_LIBS"
288   fi
290 AC_MSG_CHECKING([if non-ASCII support via Libidn should be built])
291 AC_MSG_RESULT($stringprep)
293 # Allow disabling of client or server.
294 AC_ARG_ENABLE(client,
295               AS_HELP_STRING([--disable-client], [disable client code]),
296               client=$enableval)
297 AC_ARG_ENABLE(server,
298               AS_HELP_STRING([--disable-server], [disable server code]),
299               server=$enableval)
300 if test "$client" != "no"; then
301   AC_DEFINE(USE_CLIENT, 1, [Define to 1 if you want client code.])
302   client=yes
304 if test "$server" != "no"; then
305   AC_DEFINE(USE_SERVER, 1, [Define to 1 if you want server code.])
306   server=yes
308 if test "$server" = "no" && test "$client" = "no"; then
309   AC_MSG_ERROR([Disabling both client and server mode is meaningless])
311 AC_MSG_CHECKING([if client code should be built])
312 AC_MSG_RESULT($client)
313 AC_MSG_CHECKING([if server code should be built])
314 AC_MSG_RESULT($server)
315 AM_CONDITIONAL(CLIENT, test x$client = xyes)
316 AM_CONDITIONAL(SERVER, test x$server = xyes)
318 # Allow disabling of obsolete stuff.
319 AC_ARG_ENABLE(obsolete,
320   AS_HELP_STRING([--disable-obsolete], [disable backwards compatibility code]),
321     obsolete=$enableval)
322 if test "$obsolete" = "no"; then
323   AC_DEFINE(GSASL_NO_OBSOLETE, 1,
324     [Define to 1 if you don't want backwards compatibility code.])
325 else
326   obsolete=yes
328 AC_MSG_CHECKING([if backwards compatibility code should be present])
329 AC_MSG_RESULT($obsolete)
330 AM_CONDITIONAL(OBSOLETE, test "$obsolete" = "yes")
332 # For gnulib stuff in gl/.
333 gl_INIT
335 AC_CONFIG_FILES(Makefile libgsasl.pc po/Makefile.in \
336                 gl/Makefile tests/Makefile \
337                 src/gsasl.h src/Makefile \
338                 anonymous/Makefile cram-md5/Makefile \
339                 digest-md5/Makefile external/Makefile \
340                 gssapi/Makefile kerberos_v5/Makefile \
341                 login/Makefile ntlm/Makefile plain/Makefile \
342                 securid/Makefile)
343 AC_OUTPUT