Doc fix.
[gsasl.git] / lib / configure.ac
blobc577ef95adf295bb8f02ab6e1406f666d436f074
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.3.0], [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, 10)
29 AC_SUBST(LT_REVISION, 1)
30 AC_SUBST(LT_AGE, 3)
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_LIBTOOL_WIN32_DLL
42 AC_PROG_LIBTOOL
44 # ANONYMOUS
45 AC_ARG_ENABLE(anonymous,
46   AS_HELP_STRING([--disable-anonymous], [don't use the ANONYMOUS mechanism]),
47   anonymous=$enableval)
48 if test "$anonymous" != "no" ; then
49         anonymous=yes
50         AC_DEFINE(USE_ANONYMOUS, 1, [Define to 1 if you want ANONYMOUS.])
52 AC_MSG_CHECKING([if ANONYMOUS should be used])
53 AC_MSG_RESULT($anonymous)
54 AM_CONDITIONAL(ANONYMOUS, test x$anonymous = xyes)
56 # EXTERNAL
57 AC_ARG_ENABLE(external,
58   AS_HELP_STRING([--disable-external], [don't use the EXTERNAL mechanism]),
59   external=$enableval)
60 if test "$external" != "no" ; then
61         external=yes
62         AC_DEFINE(USE_EXTERNAL, 1, [Define to 1 if you want EXTERNAL.])
64 AC_MSG_CHECKING([if EXTERNAL should be used])
65 AC_MSG_RESULT($external)
66 AM_CONDITIONAL(EXTERNAL, test x$external = xyes)
68 # PLAIN
69 AC_ARG_ENABLE(plain,
70   AS_HELP_STRING([--disable-plain], [don't use the PLAIN mechanism]),
71   plain=$enableval)
72 if test "$plain" != "no" ; then
73         plain=yes
74         AC_DEFINE(USE_PLAIN, 1, [Define to 1 if you want PLAIN.])
76 AC_MSG_CHECKING([if PLAIN should be used])
77 AC_MSG_RESULT($plain)
78 AM_CONDITIONAL(PLAIN, test x$plain = xyes)
80 # LOGIN
81 AC_ARG_ENABLE(login,
82   AS_HELP_STRING([--disable-login], [don't use the LOGIN mechanism]),
83   login=$enableval)
84 if test "$login" != "no" ; then
85         login=yes
86         AC_DEFINE(USE_LOGIN, 1, [Define to 1 if you want LOGIN.])
88 AC_MSG_CHECKING([if LOGIN should be used])
89 AC_MSG_RESULT($login)
90 AM_CONDITIONAL(LOGIN, test x$login = xyes)
92 # SECURID
93 AC_ARG_ENABLE(securid,
94   AS_HELP_STRING([--disable-securid], [don't use the SECURID mechanism]),
95   securid=$enableval)
96 if test "$securid" != "no" ; then
97         securid=yes
98         AC_DEFINE(USE_SECURID, 1, [Define to 1 if you want SECURID.])
100 AC_MSG_CHECKING([if SECURID should be used])
101 AC_MSG_RESULT($securid)
102 AM_CONDITIONAL(SECURID, test x$securid = xyes)
104 # NTLM
105 AC_ARG_ENABLE(ntlm,
106   AS_HELP_STRING([--disable-ntlm], [don't use the NTLM mechanism]),
107   ntlm=$enableval)
108 if test "$ntlm" != "no"; then
109     AC_LIB_HAVE_LINKFLAGS(ntlm,, [#include <ntlm.h>],
110       [buildSmbNtlmAuthRequest_noatsplit (0, 0, 0);])
111   if test "$ac_cv_libntlm" != yes; then
112     ntlm=no
113     AC_MSG_WARN([Libntlm >= 0.3.5 not found, disabling NTLM.])
114   else
115     ntlm=yes
116     AC_DEFINE(USE_NTLM, 1, [Define to 1 if you want NTLM.])
117   fi
119 AC_MSG_CHECKING([if NTLM should be used])
120 AC_MSG_RESULT($ntlm)
121 AM_CONDITIONAL(NTLM, test x$ntlm = xyes)
123 # CRAM-MD5
124 AC_ARG_ENABLE(cram-md5,
125   AS_HELP_STRING([--disable-cram-md5], [don't use the CRAM-MD5 mechanism]),
126   cram_md5=$enableval)
127 if test "$cram_md5" != "no" ; then
128         cram_md5=yes
129         AC_DEFINE(USE_CRAM_MD5, 1, [Define to 1 if you want CRAM-MD5.])
131 AC_MSG_CHECKING([if CRAM-MD5 should be used])
132 AC_MSG_RESULT($cram_md5)
133 AM_CONDITIONAL(CRAM_MD5, test x$cram_md5 = xyes)
135 # DIGEST-MD5
136 AC_ARG_ENABLE(digest-md5,
137   AS_HELP_STRING([--disable-digest-md5], [don't use the DIGEST-MD5 mechanism]),
138   digest_md5=$enableval)
139 if test "$digest_md5" != "no" ; then
140         digest_md5=yes
141         AC_DEFINE(USE_DIGEST_MD5, 1, [Define to 1 if you want DIGEST-MD5.])
143 AC_MSG_CHECKING([if DIGEST-MD5 should be used])
144 AC_MSG_RESULT($digest_md5)
145 AM_CONDITIONAL(DIGEST_MD5, test x$digest_md5 = xyes)
147 # GS2, first part
148 AC_ARG_ENABLE(gs2,
149   AS_HELP_STRING([--enable-gs2], [use the GS2 mechanism]),
150   gs2=$enableval, gs2=no)
151 if test "$gs2" != "no" ; then
152         gs2=yes
155 # GSSAPI, first part
156 AC_ARG_ENABLE(gssapi,
157   AS_HELP_STRING([--disable-gssapi], [don't use the GSSAPI mechanism]),
158   gssapi=$enableval)
159 if test "$gssapi" != "no" ; then
160         gssapi=yes
163 # GSSAPI.
164 AC_ARG_WITH(gssapi-impl,
165   AS_HELP_STRING([--with-gssapi-impl=gss/mit/heimdal/yes],
166                  [select GSS-API implementation]),
167   gssapi_impl=$withval, gssapi_impl=yes)
168 AC_MSG_NOTICE([checking for GSS implementation ($gssapi_impl)])
169 if test "$gssapi_impl" = "gss"; then
170   AC_MSG_NOTICE([trying GSS])
171   AC_LIB_HAVE_LINKFLAGS(gss,, [#include <gss.h>], [gss_check_version (0);])
172   if test "$ac_cv_libgss" != yes; then
173     gssapi_impl=no
174     AC_MSG_WARN([GNU GSS not found, disabling GSSAPI.])
175   fi
176 elif test "$gssapi_impl" = "mit"; then
177   AC_MSG_NOTICE([trying MIT])
178   AC_PATH_PROG(KRB5_CONFIG, krb5-config, no)
179   if test "$KRB5_CONFIG" != "no" ; then
180     CPPFLAGS="$CPPFLAGS `$KRB5_CONFIG --cflags`"
181     LIBS="$LIBS `$KRB5_CONFIG --libs gssapi`"
182     AC_CHECK_HEADERS(gssapi/gssapi.h gssapi/gssapi_generic.h)
183     AC_CHECK_DECL(GSS_C_NT_HOSTBASED_SERVICE,,
184       [AC_DEFINE(GSS_C_NT_HOSTBASED_SERVICE, gss_nt_service_name,
185                  [Work around buggy MIT library])], [
186 #ifdef HAVE_GSSAPI_GSSAPI_H
187 # include <gssapi/gssapi.h>
188 #endif
189 #ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
190 # include <gssapi/gssapi_generic.h>
191 #endif
193   else
194     AC_MSG_WARN([MIT Kerberos krb5-config not found, disabling GSSAPI])
195     gssapi_impl=no
196   fi
197 elif test "$gssapi_impl" = "heimdal"; then
198   AC_MSG_NOTICE([trying Heimdal])
199   AC_PATH_PROG(KRB5_CONFIG, krb5-config, no)
200   if test "$KRB5_CONFIG" != "no" ; then
201     CPPFLAGS="$CPPFLAGS `$KRB5_CONFIG --cflags`"
202     LIBS="$LIBS `$KRB5_CONFIG --libs gssapi`"
203     AC_CHECK_HEADERS(gssapi.h)
204   else
205     AC_MSG_WARN([Heimdal krb5-config not found, disabling GSSAPI])
206     gssapi_impl=no
207   fi
208 elif test "$gssapi_impl" != "no" ; then
209   AC_MSG_NOTICE([auto-detecing GSS/MIT/Heimdal])
210   AC_MSG_NOTICE([use --with-gssapi-impl=IMPL to override])
211   AC_MSG_NOTICE([where IMPL is `gss', `mit', or `heimdal'])
212   AC_LIB_HAVE_LINKFLAGS(gss,, [#include <gss.h>], [gss_check_version (0);])
213   if test "$ac_cv_libgss" = yes; then
214     gssapi_impl=gss
215     AC_MSG_NOTICE([GNU GSS found])
216   elif test "$cross_compiling" != "no"; then
217     AC_MSG_WARN([Cross-compiling, won't rely on MIT/Heimdal krb5-config])
218     AC_MSG_NOTICE([Use --with-gssapi-impl=mit or --with-gssapi-impl=heimdal.])
219     gssapi_impl=no
220   else
221     AC_MSG_WARN([GNU GSS not found (see http://josefsson.org/gss/)...])
222     AC_PATH_PROG(KRB5_CONFIG, krb5-config, no)
223     if test "$KRB5_CONFIG" != "no" ; then
224       AC_MSG_NOTICE([MIT/Heimdal found])
225       CPPFLAGS="$CPPFLAGS `$KRB5_CONFIG --cflags`"
226       LIBS="$LIBS `$KRB5_CONFIG --libs gssapi`"
227       AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h)
228       if test "$ac_cv_header_gssapi_h" = "yes" &&
229          test "$ac_cv_header_gssapi_gssapi_h" = "yes"; then
230         AC_MSG_WARN([Both Heimdal and MIT GSSAPI header files found.  Will use Heimdal.])
231         AC_MSG_WARN([Use --with-gssapi-impl=mit to override.])
232       fi
233       if test "$ac_cv_header_gssapi_h" != "no"; then
234         AC_MSG_NOTICE([Heimdal found])
235         gssapi_impl=heimdal
236       else
237         AC_MSG_NOTICE([MIT found])
238         AC_CHECK_DECL(GSS_C_NT_HOSTBASED_SERVICE,,
239           [AC_DEFINE(GSS_C_NT_HOSTBASED_SERVICE, gss_nt_service_name,
240             [Work around buggy MIT library])], [
241 #ifdef HAVE_GSSAPI_GSSAPI_H
242 # include <gssapi/gssapi.h>
243 #endif
244 #ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
245 # include <gssapi/gssapi_generic.h>
246 #endif
248         gssapi_impl=mit
249       fi
250     else
251       gssapi_impl=no
252       AC_MSG_WARN([krb5-config not found, disabling GSSAPI])
253     fi
254   fi
257 # Disable GSSAPI/GS2 if we can't find GSS-API implementation
258 if test "$gssapi_impl" = "no"; then
259   gs2=no
260   gssapi=no
263 # GSSAPI, second part
264 if test "$gs2" != "no" ; then
265   AC_DEFINE(USE_GS2, 1, [Define to 1 if you want GS2.])
267 AC_MSG_CHECKING([if GS2 should be used])
268 AC_MSG_RESULT($gs2)
269 AM_CONDITIONAL(GS2, test x$gs2 = xyes)
271 # GS2, second part
272 if test "$gssapi" != "no" ; then
273   AC_DEFINE(USE_GSSAPI, 1, [Define to 1 if you want GSSAPI.])
275 AC_MSG_CHECKING([if GSSAPI should be used])
276 AC_MSG_RESULT($gssapi)
277 AM_CONDITIONAL(GSSAPI, test x$gssapi = xyes)
279 # KERBEROS_V5
280 AC_ARG_ENABLE(kerberos_v5,
281   AS_HELP_STRING([--enable-kerberos_v5],
282     [use the KERBEROS_V5 mechanism]),
283   kerberos_v5=$enableval, kerberos_v5=no)
284 if test "$kerberos_v5" != "no" ; then
285   AC_LIB_HAVE_LINKFLAGS(shishi,, [#include <shishi.h>], [shishi ();])
286   if test "$ac_cv_libshishi" != yes; then
287     kerberos_v5=no
288     AC_MSG_WARN([GNU Shishi not found, disabling KERBEROS_V5])
289   else
290     kerberos_v5=yes
291     AC_DEFINE(USE_KERBEROS_V5, 1, [Define to 1 if you want KERBEROS_V5.])
292   fi
294 AC_MSG_CHECKING([if KERBEROS_V5 should be used])
295 AC_MSG_RESULT($kerberos_v5)
296 AM_CONDITIONAL(KERBEROS_V5, test x$kerberos_v5 = xyes)
298 # Check for libidn
299 AC_ARG_WITH(stringprep,
300   AS_HELP_STRING([--without-stringprep], [disable non-ASCII support]),
301   stringprep=$withval, stringprep=yes)
302 if test "$stringprep" != "no"; then
303   AC_LIB_HAVE_LINKFLAGS(idn,, [#include <stringprep.h>],
304       [stringprep_check_version (0);])
305   if test "$ac_cv_libidn" != yes; then
306     stringprep=no
307     AC_MSG_WARN([GNU Libidn not found.  Stringprep disabled.])
308   else
309     stringprep=yes
310     save_LIBS="$LIBS"
311     LIBS="$LIBS $LIBIDN"
312     AC_CHECK_FUNCS(pr29_8z)
313     AC_CHECK_HEADERS(pr29.h)
314     LIBS="$save_LIBS"
315   fi
317 AC_MSG_CHECKING([if non-ASCII support via Libidn should be built])
318 AC_MSG_RESULT($stringprep)
320 # Allow disabling of client or server.
321 AC_ARG_ENABLE(client,
322               AS_HELP_STRING([--disable-client], [disable client code]),
323               client=$enableval)
324 AC_ARG_ENABLE(server,
325               AS_HELP_STRING([--disable-server], [disable server code]),
326               server=$enableval)
327 if test "$client" != "no"; then
328   AC_DEFINE(USE_CLIENT, 1, [Define to 1 if you want client code.])
329   client=yes
331 if test "$server" != "no"; then
332   AC_DEFINE(USE_SERVER, 1, [Define to 1 if you want server code.])
333   server=yes
335 if test "$server" = "no" && test "$client" = "no"; then
336   AC_MSG_ERROR([Disabling both client and server mode is meaningless])
338 AC_MSG_CHECKING([if client code should be built])
339 AC_MSG_RESULT($client)
340 AC_MSG_CHECKING([if server code should be built])
341 AC_MSG_RESULT($server)
342 AM_CONDITIONAL(CLIENT, test x$client = xyes)
343 AM_CONDITIONAL(SERVER, test x$server = xyes)
345 # Allow disabling of obsolete stuff.
346 AC_ARG_ENABLE(obsolete,
347   AS_HELP_STRING([--disable-obsolete], [disable backwards compatibility code]),
348     obsolete=$enableval)
349 if test "$obsolete" = "no"; then
350   AC_DEFINE(GSASL_NO_OBSOLETE, 1,
351     [Define to 1 if you don't want backwards compatibility code.])
352 else
353   obsolete=yes
355 AC_MSG_CHECKING([if backwards compatibility code should be present])
356 AC_MSG_RESULT($obsolete)
357 AM_CONDITIONAL(OBSOLETE, test "$obsolete" = "yes")
359 # For gnulib stuff in gl/.
360 gl_INIT
362 # Update version number in src/gsasl.h.
363 if ! sed 's/GSASL_VERSION ".*"/GSASL_VERSION "'$PACKAGE_VERSION'"/' \
364     $srcdir/src/gsasl.h > fixhdr.tmp; then
365   AC_MSG_ERROR([[*** Failed to update version number in src/gsasl.h...]])
367 if cmp -s $srcdir/src/gsasl.h fixhdr.tmp 2>/dev/null; then
368   rm -f fixhdr.tmp
369 elif ! mv fixhdr.tmp $srcdir/src/gsasl.h; then
370   AC_MSG_ERROR([[*** Failed to move fixhdr.tmp to src/gsasl.h...]])
373 AC_CONFIG_FILES(Makefile libgsasl.pc po/Makefile.in \
374                 gl/Makefile tests/Makefile src/Makefile \
375                 anonymous/Makefile cram-md5/Makefile \
376                 digest-md5/Makefile external/Makefile \
377                 gssapi/Makefile gs2/Makefile kerberos_v5/Makefile \
378                 login/Makefile ntlm/Makefile plain/Makefile \
379                 securid/Makefile)
380 AC_OUTPUT