File: configure.ac

package info (click to toggle)
gsasl 2.2.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,604 kB
  • sloc: ansic: 16,551; sh: 1,739; makefile: 677; xml: 301; php: 172; perl: 4
file content (643 lines) | stat: -rw-r--r-- 20,814 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
dnl Process this file with autoconf to produce a configure script.

# Copyright (C) 2002-2025 Simon Josefsson
#
# This file is part of GNU SASL.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

AC_PREREQ([2.64])
AC_INIT([GNU SASL],
        m4_esyscmd([build-aux/git-version-gen .tarball-version]),
        [bug-gsasl@gnu.org],
        [gsasl])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])

# Library code modified:                              REVISION++
# Interfaces changed/added/removed:   CURRENT++       REVISION=0
# Interfaces added:                             AGE++
# Interfaces removed:                           AGE=0
AC_SUBST(LT_CURRENT, 18)
AC_SUBST(LT_REVISION, 0)
AC_SUBST(LT_AGE, 0)

# Used when creating libgsasl-XX.def.
DLL_VERSION=`expr ${LT_CURRENT} - ${LT_AGE}`
AC_SUBST(DLL_VERSION)

AC_SUBST([MAJOR_VERSION], [`echo $PACKAGE_VERSION|cut -d. -f1`])
AC_SUBST([MINOR_VERSION], [`echo $PACKAGE_VERSION|cut -d. -f2`])
AC_SUBST([PATCH_VERSION], [`echo $PACKAGE_VERSION.0|cut -d. -f3|cut -d- -f1`])
AC_SUBST(NUMBER_VERSION, `printf "0x%02x%02x%02x" $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION 2>/dev/null`)

AC_MSG_NOTICE([$PACKAGE_NAME $PACKAGE_VERSION $PACKAGE_TARNAME $MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION $NUMBER_VERSION $LT_CURRENT:$LT_REVISION:$LT_AGE $DLL_VERSION])

AM_INIT_AUTOMAKE([1.13 -Wall -Wno-override])
AM_SILENT_RULES([yes])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC
gl_EARLY
lgl_EARLY
AM_PROG_AR
LT_INIT([win32-dll])
AM_MISSING_PROG(PERL, perl, $missing_dir)
AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
AM_MISSING_PROG(DIA, dia, $missing_dir)
AM_MISSING_PROG(EPSTOPDF, epstopdf, $missing_dir)

# Internationalization.
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.8])

# https://developer.gnome.org/gtk-doc-manual/stable/settingup_autoconf.html.en
m4_ifdef([GTK_DOC_CHECK], [
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
],[
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
])

# ANONYMOUS
AC_ARG_ENABLE(anonymous,
  AS_HELP_STRING([--disable-anonymous], [don't use the ANONYMOUS mechanism]),
  anonymous=$enableval)
if test "$anonymous" != "no" ; then
	anonymous=yes
	AC_DEFINE([USE_ANONYMOUS], 1, [Define to 1 if you want ANONYMOUS.])
fi
AC_MSG_CHECKING([if ANONYMOUS should be used])
AC_MSG_RESULT($anonymous)
AM_CONDITIONAL(ANONYMOUS, test x$anonymous = xyes)

# EXTERNAL
AC_ARG_ENABLE(external,
  AS_HELP_STRING([--disable-external], [don't use the EXTERNAL mechanism]),
  external=$enableval)
if test "$external" != "no" ; then
	external=yes
	AC_DEFINE([USE_EXTERNAL], 1, [Define to 1 if you want EXTERNAL.])
fi
AC_MSG_CHECKING([if EXTERNAL should be used])
AC_MSG_RESULT($external)
AM_CONDITIONAL(EXTERNAL, test x$external = xyes)

# PLAIN
AC_ARG_ENABLE(plain,
  AS_HELP_STRING([--disable-plain], [don't use the PLAIN mechanism]),
  plain=$enableval)
if test "$plain" != "no" ; then
	plain=yes
	AC_DEFINE([USE_PLAIN], 1, [Define to 1 if you want PLAIN.])
fi
AC_MSG_CHECKING([if PLAIN should be used])
AC_MSG_RESULT($plain)
AM_CONDITIONAL(PLAIN, test x$plain = xyes)

# LOGIN
AC_ARG_ENABLE(login,
  AS_HELP_STRING([--disable-login], [don't use the LOGIN mechanism]),
  login=$enableval)
if test "$login" != "no" ; then
	login=yes
	AC_DEFINE([USE_LOGIN], 1, [Define to 1 if you want LOGIN.])
fi
AC_MSG_CHECKING([if LOGIN should be used])
AC_MSG_RESULT($login)
AM_CONDITIONAL(LOGIN, test x$login = xyes)

# SECURID
AC_ARG_ENABLE(securid,
  AS_HELP_STRING([--disable-securid], [don't use the SECURID mechanism]),
  securid=$enableval)
if test "$securid" != "no" ; then
	securid=yes
	AC_DEFINE([USE_SECURID], 1, [Define to 1 if you want SECURID.])
fi
AC_MSG_CHECKING([if SECURID should be used])
AC_MSG_RESULT($securid)
AM_CONDITIONAL(SECURID, test x$securid = xyes)

# NTLM
AC_ARG_ENABLE(ntlm,
  AS_HELP_STRING([--disable-ntlm], [don't use the NTLM mechanism]),
  ntlm=$enableval)
if test "$ntlm" != "no"; then
    AC_LIB_HAVE_LINKFLAGS(ntlm,, [#include <ntlm.h>],
      [buildSmbNtlmAuthRequest_noatsplit (0, 0, 0);])
  if test "$ac_cv_libntlm" != yes; then
    ntlm=no
    AC_MSG_WARN([Libntlm >= 0.3.5 not found, disabling NTLM.])
  else
    ntlm=yes
    AC_DEFINE([USE_NTLM], 1, [Define to 1 if you want NTLM.])
  fi
fi
AC_MSG_CHECKING([if NTLM should be used])
AC_MSG_RESULT($ntlm)
AM_CONDITIONAL(NTLM, test x$ntlm = xyes)

# CRAM-MD5
AC_ARG_ENABLE(cram-md5,
  AS_HELP_STRING([--disable-cram-md5], [don't use the CRAM-MD5 mechanism]),
  cram_md5=$enableval)
if test "$cram_md5" != "no" ; then
	cram_md5=yes
	AC_DEFINE([USE_CRAM_MD5], 1, [Define to 1 if you want CRAM-MD5.])
fi
AC_MSG_CHECKING([if CRAM-MD5 should be used])
AC_MSG_RESULT($cram_md5)
AM_CONDITIONAL(CRAM_MD5, test x$cram_md5 = xyes)

# DIGEST-MD5
AC_ARG_ENABLE(digest-md5,
  AS_HELP_STRING([--disable-digest-md5], [don't use the DIGEST-MD5 mechanism]),
  digest_md5=$enableval)
if test "$digest_md5" != "no" ; then
	digest_md5=yes
	AC_DEFINE([USE_DIGEST_MD5], 1, [Define to 1 if you want DIGEST-MD5.])
fi
AC_MSG_CHECKING([if DIGEST-MD5 should be used])
AC_MSG_RESULT($digest_md5)
AM_CONDITIONAL(DIGEST_MD5, test x$digest_md5 = xyes)

# SCRAM-SHA-1
AC_ARG_ENABLE(scram-sha1,
  AS_HELP_STRING([--enable-scram-sha1], [use the SCRAM-SHA-1 mechanism]),
  scram_sha1=$enableval)
if test "$scram_sha1" != "no" ; then
  scram_sha1=yes
  AC_DEFINE([USE_SCRAM_SHA1], 1, [Define to 1 if you want SCRAM-SHA-1.])
fi
AC_MSG_CHECKING([if SCRAM-SHA-1 should be used])
AC_MSG_RESULT($scram_sha1)

# SCRAM-SHA-256
AC_ARG_ENABLE(scram-sha256,
  AS_HELP_STRING([--enable-scram-sha256], [use the SCRAM-SHA-256 mechanism]),
  scram_sha256=$enableval)
if test "$scram_sha256" != "no" ; then
  scram_sha256=yes
  AC_DEFINE([USE_SCRAM_SHA256], 1, [Define to 256 if you want SCRAM-SHA-256.])
fi
AC_MSG_CHECKING([if SCRAM-SHA-256 should be used])
AC_MSG_RESULT($scram_sha256)

AM_CONDITIONAL(SCRAM, test "$scram_sha1$scram_sha256" != "nono")

# SAML20
AC_ARG_ENABLE(saml20,
  AS_HELP_STRING([--disable-saml20], [don't use the SAML20 mechanism]),
  saml20=$enableval, saml20=yes)
if test "$saml20" != "no" ; then
	saml20=yes
	AC_DEFINE([USE_SAML20], 1, [Define to 1 if you want SAML20.])
fi
AC_MSG_CHECKING([if SAML20 should be used])
AC_MSG_RESULT($saml20)
AM_CONDITIONAL(SAML20, test x$saml20 = xyes)

# OPENID20
AC_ARG_ENABLE(openid20,
  AS_HELP_STRING([--disable-openid20], [don't use the OPENID20 mechanism]),
  openid20=$enableval, openid20=yes)
if test "$openid20" != "no" ; then
	openid20=yes
	AC_DEFINE([USE_OPENID20], 1, [Define to 1 if you want OPENID20.])
fi
AC_MSG_CHECKING([if OPENID20 should be used])
AC_MSG_RESULT($openid20)
AM_CONDITIONAL(OPENID20, test x$openid20 = xyes)

# GS2, first part
AC_ARG_ENABLE(gs2,
  AS_HELP_STRING([--disable-gs2], [don't use the GS2 mechanism]),
  gs2=$enableval)
if test "$gs2" != "no" ; then
  gs2=yes
fi

# GSSAPI, first part
AC_ARG_ENABLE(gssapi,
  AS_HELP_STRING([--disable-gssapi], [don't use the GSSAPI mechanism]),
  gssapi=$enableval)
if test "$gssapi" != "no" ; then
  gssapi=yes
fi

# GSSAPI.
AC_ARG_WITH(gssapi-impl,
  AS_HELP_STRING([--with-gssapi-impl=no/gss/gssglue/kfw/mit/heimdal/framework/yes],
                 [select GSS-API implementation]),
  gssapi_impl=$withval, gssapi_impl=yes)
if test "$gs2" = no && test "$gssapi" = no; then
  gssapi_impl=no
else
  AC_MSG_NOTICE([checking for GSS implementation ($gssapi_impl)])
fi

if test "$gssapi_impl" = "gss"; then
  AC_MSG_NOTICE([trying GSS])
  AC_LIB_HAVE_LINKFLAGS(gss,, [#include <gss.h>], [
#if GSS_VERSION_NUMBER < 0x010000
too old version
#else
gss_check_version (0);
#endif
])
  if test "$ac_cv_libgss" != yes; then
    gssapi_impl=no
    AC_MSG_WARN([GNU GSS not found, disabling GSSAPI.])
  fi
elif test "$gssapi_impl" = "gssglue"; then
  AC_MSG_NOTICE([trying libgssglue])
  AC_LIB_HAVE_LINKFLAGS(gssglue,, [#include <gssglue/gssapi/gssapi.h>],
                        [gss_release_buffer ((OM_uint32*)0, GSS_C_NO_BUFFER)])
  if test "$ac_cv_libgssglue" != yes; then
    gssapi_impl=no
    AC_MSG_WARN([libgssglue not found, disabling GSSAPI.])
  fi
elif test "$gssapi_impl" = "kfw"; then
  AC_MSG_NOTICE([trying MIT Kerberos for Windows GSS-API library])
  AC_LIB_HAVE_LINKFLAGS(gssapi32,, [#include <gssapi/gssapi.h>],
                        [gss_release_oid (NULL, NULL)])
  if test "$ac_cv_libgssapi32" != yes; then
    gssapi_impl=no
    AC_MSG_WARN([MIT Kerberos for Windows not found, disabling GSSAPI.])
  fi
elif test "$gssapi_impl" = "mit"; then
  AC_MSG_NOTICE([trying MIT])
  AC_PATH_PROGS(KRB5_CONFIG, [krb5-config.mit krb5-config], no)
  if test "$KRB5_CONFIG" != "no" ; then
    GSS_CFLAGS="`$KRB5_CONFIG --cflags`"
    GSS_LIBS="`$KRB5_CONFIG --libs gssapi`"
  else
    AC_MSG_WARN([MIT Kerberos krb5-config not found, disabling GSSAPI])
    gssapi_impl=no
  fi
elif test "$gssapi_impl" = "heimdal"; then
  AC_MSG_NOTICE([trying Heimdal])
  AC_PATH_PROGS(KRB5_CONFIG, [krb5-config.heimdal krb5-config], no)
  if test "$KRB5_CONFIG" != "no" ; then
    GSS_CFLAGS="`$KRB5_CONFIG --cflags`"
    GSS_LIBS="`$KRB5_CONFIG --libs gssapi`"
  else
    AC_MSG_WARN([Heimdal krb5-config not found, disabling GSSAPI])
    gssapi_impl=no
  fi
elif test "$gssapi_impl" = "framework"; then
  AC_MSG_NOTICE([trying GSS framework])
  GSS_CFLAGS=""		# <GSS/gssapi.h> in default search-path
  GSS_LIBS="-framework GSS"
  AC_CHECK_HEADERS([GSS/gssapi.h])
  if test "$ac_cv_header_gss_gssapi_h" = "no"; then
    gssapi_impl=no
    AC_MSG_WARN([Cannot find GSS/gssapi.h, disabling GSSAPI])
  fi
  # linking with -framework flag tested later via function tests
elif test "$gssapi_impl" != "no"; then
  AC_MSG_NOTICE([auto-detecting GSS-API library GSS/Libgssglue/MIT/Heimdal])
  AC_MSG_NOTICE([use --with-gssapi-impl=IMPL to hard code])
  AC_MSG_NOTICE([where IMPL is `gss', `libgssglue', `mit', or `heimdal'])
  AC_LIB_HAVE_LINKFLAGS(gss,, [#include <gss.h>], [
#if GSS_VERSION_NUMBER < 0x010000
too old version
#else
gss_check_version (0);
#endif
])
  if test "$ac_cv_libgss" = yes; then
    gssapi_impl=gss
    AC_MSG_NOTICE([GNU GSS found])
  else
    AC_LIB_HAVE_LINKFLAGS(gssglue,, [#include <gssglue/gssapi/gssapi.h>],
                   [gss_release_buffer ((OM_uint32*)0, GSS_C_NO_BUFFER)])
    if test "$ac_cv_libgssglue" = yes; then
      gssapi_impl=gssglue
      AC_MSG_NOTICE([Libgssglue found])
    else
      AC_MSG_WARN([Auto-detecting MIT/Heimdal is unreliable, disabling GSSAPI])
      gssapi_impl=no
    fi
  fi
fi

AC_SUBST([GSS_CFLAGS])
AC_SUBST([GSS_LIBS])

# Test for GSS-API library features.
if test "$gssapi_impl" != "no"; then
  save_CPPFLAGS="$CPPFLAGS"
  save_LIBS="$LIBS"
  CPPFLAGS="$CPPFLAGS $GSS_CFLAGS"
  LIBS="$LIBS $LIBGSS $GSS_LIBS"
  AC_CHECK_FUNCS([gss_encapsulate_token])
  AC_CHECK_FUNCS([gss_decapsulate_token])
  AC_CHECK_FUNCS([gss_oid_equal])
  AC_CHECK_FUNCS([gss_inquire_mech_for_saslname])
  # "framework" already verified its own header path
  if test "$gssapi_impl" != "gss" && test "$gssapi_impl" != "gssglue" && test "$gssapi_impl" != "framework"; then
    AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h gssapi/gssapi_ext.h])
    if test "$ac_cv_header_gssapi_h$ac_cv_header_gssapi_gssapi_h" = "nono"; then
      gssapi_impl=no
      AC_MSG_WARN([Cannot find gssapi.h or gssapi/gssapi.h, disabling GSSAPI])
    fi
  fi
  AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
# ifdef HAVE_LIBGSS
#  include <gss.h>
# elif HAVE_LIBGSSGLUE
#  include <gssglue/gssapi/gssapi.h>
# else
#  if HAVE_GSSAPI_H
#   include <gssapi.h>
#  elif HAVE_GSSAPI_GSSAPI_H
#   include <gssapi/gssapi.h>
#  endif
#  if HAVE_GSSAPI_GSSAPI_EXT_H
#   include <gssapi/gssapi_ext.h>
#  endif
#  if HAVE_GSS_GSSAPI_H
#   include <GSS/gssapi.h>
#  endif
# endif
]])
  CPPFLAGS="$save_CPPFLAGS"
  LIBS="$save_LIBS"
fi

# Check for libidn
AC_ARG_WITH(stringprep,
  AS_HELP_STRING([--without-stringprep], [disable non-ASCII support]),
  stringprep=$withval, stringprep=yes)
if test "$stringprep" != "no"; then
  AC_LIB_HAVE_LINKFLAGS(idn,, [#include <stringprep.h>],
      [stringprep_check_version (0);])
  if test "$ac_cv_libidn" != yes; then
    stringprep=no
    AC_MSG_WARN([GNU Libidn not found.  Stringprep disabled.])
  else
    stringprep=yes
    save_LIBS="$LIBS"
    LIBS="$LIBS $LIBIDN"
    AC_CHECK_FUNCS(pr29_8z)
    AC_CHECK_HEADERS(pr29.h)
    LIBS="$save_LIBS"
  fi
fi
AC_MSG_CHECKING([if non-ASCII support via Libidn should be built])
AC_MSG_RESULT($stringprep)

# Allow disabling of client or server.
AC_ARG_ENABLE(client,
              AS_HELP_STRING([--disable-client], [disable client code]),
	      client=$enableval)
AC_ARG_ENABLE(server,
              AS_HELP_STRING([--disable-server], [disable server code]),
	      server=$enableval)
if test "$client" != "no"; then
  AC_DEFINE([USE_CLIENT], 1, [Define to 1 if you want client code.])
  client=yes
fi
if test "$server" != "no"; then
  AC_DEFINE([USE_SERVER], 1, [Define to 1 if you want server code.])
  server=yes
fi
if test "$server" = "no" && test "$client" = "no"; then
  AC_MSG_ERROR([Disabling both client and server mode is meaningless])
fi
AC_MSG_CHECKING([if client code should be built])
AC_MSG_RESULT($client)
AC_MSG_CHECKING([if server code should be built])
AC_MSG_RESULT($server)
AM_CONDITIONAL(CLIENT, test x$client = xyes)
AM_CONDITIONAL(SERVER, test x$server = xyes)

# Checks for header files.
AC_CHECK_HEADERS(pwd.h)

# Checks for library functions.
AC_SEARCH_LIBS(socket, socket)
AC_CHECK_FUNCS(getpwuid)

# Check for GnuTLS.
AC_ARG_WITH(gnutls,
  AS_HELP_STRING([--without-gnutls], [disable GnuTLS support]),
	gnutls=$withval, gnutls=yes)
if test "$gnutls" != "no"; then
  AC_LIB_HAVE_LINKFLAGS(gnutls,, [#include <gnutls/gnutls.h>],
    [gnutls_session_set_verify_cert (NULL, NULL, 0);])
fi
if test "$ac_cv_libgnutls" != yes; then
  gnutls=no
  AC_MSG_WARN([GnuTLS >= 3.4 not found.  STARTTLS support disabled.])
fi
AC_MSG_CHECKING([if STARTTLS support via GnuTLS should be built])
AC_MSG_RESULT($gnutls)

if test "$ac_cv_libgnutls" = yes; then
  save_LIBS="$LIBS"
  LIBS="$LIBS $LIBGNUTLS"
  AC_CHECK_FUNCS([gnutls_session_channel_binding])
  AC_CHECK_DECLS([GNUTLS_CB_TLS_EXPORTER], [], [], [[#include <gnutls/gnutls.h>]])
  LIBS="$save_LIBS"
fi

# For gnulib stuff in gl/ see also lib/gl/m4/gss-extra.m4 and lib/gl/lib/gss-extra.?.
gl_INIT
lgl_INIT
AC_DEFINE([GNULIB_NO_VLA], 1, [Disable VLA usage in gettext.h.])
AM_CONDITIONAL(WINDOWS, test "$gl_cv_func_wsastartup" = "yes")

# Disable GSSAPI/GS2 if we can't find GSS-API implementation
if test "$gssapi_impl" = "no"; then
  gs2=no
  gssapi=no
fi

# GS2, second part
if test "$gs2" != "no" ; then
  AC_DEFINE([USE_GS2], 1, [Define to 1 if you want GS2.])
fi
AC_MSG_CHECKING([if GS2 should be used])
AC_MSG_RESULT($gs2)
AM_CONDITIONAL(GS2, test x$gs2 = xyes)

# GSSAPI, second part
if test "$gssapi" != "no" ; then
  AC_DEFINE([USE_GSSAPI], 1, [Define to 1 if you want GSSAPI.])
fi
AC_MSG_CHECKING([if GSSAPI should be used])
AC_MSG_RESULT($gssapi)
AM_CONDITIONAL(GSSAPI, test x$gssapi = xyes)

AC_ARG_ENABLE([gcc-warnings],
  [AS_HELP_STRING([[--enable-gcc-warnings[=TYPE]]],
    [control generation of GCC warnings.  The TYPE 'no' disables
     warnings; 'yes' (default) generates cheap warnings;
     'expensive' in addition generates expensive warnings
     and 'error' also turn warnings into errors.])])

# https://www.gnu.org/software/gnulib//manual/html_node/manywarnings.html
AS_IF([test "$enable_gcc_warnings" != no],
  [
   # Set up the list of unwanted warning options.
   nw=
   if test "$enable_gcc_warnings" = yes; then
     nw="$nw -fanalyzer"
   fi
   nw="$nw -Wbad-function-cast" # Casting a function's result is not more
                                # dangerous than casting any other value.
   nw="$nw -Winline"            # It's OK to not inline.
   nw="$nw -Wsign-compare"      # Too many false alarms.
   nw="$nw -Wstrict-overflow"   # It's OK to optimize strictly.
   nw="$nw -Wsystem-headers"    # Don't warn in system headers.

   nw="$nw -Wsuggest-attribute=pure"  # Is it worth using attributes?
   nw="$nw -Wsuggest-attribute=const" # Is it worth using attributes?
   gl_WARN_ADD([-Wframe-larger-than=800], [WARN_LIB_CFLAGS])

   if test "$enable_gcc_warnings" = error; then
     gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
     gl_WARN_ADD([-Wno-error=tautological-constant-out-of-range-compare], [WERROR_CFLAGS])
     gl_WARN_ADD([-Wno-error=missing-field-initializers], [WERROR_CFLAGS])
   fi

   # Setup the list of meaningful warning options for the C compiler.
   # The list comes from manywarnings.m4. Warning options that are not
   # generally meaningful have already been filtered out (cf.
   # build-aux/gcc-warning.spec).
   gl_MANYWARN_ALL_GCC([possible_warning_options])

   # Compute the list of warning options that are desired.
   gl_MANYWARN_COMPLEMENT([desired_warning_options],
                          [$possible_warning_options], [$nw])
   # Compute the list of remaining undesired warning options.
   # Namely those, that were not in manywarnings.m4 because they were
   # already listed in build-aux/gcc-warning.spec; this includes those
   # that are implied by -Wall.
   gl_MANYWARN_COMPLEMENT([remaining_undesired_warning_options],
                          [$nw], [$possible_warning_options])

   # Add the desired warning options to WARN_CFLAGS.
   for w in $desired_warning_options; do
     gl_WARN_ADD([$w])
   done

   # Add the opposites of the remaining undesired warning options to
   # WARN_CFLAGS.
   for w in `echo "$remaining_undesired_warning_options" | sed -e 's/-W/-Wno-/g'`; do
     gl_WARN_ADD([$w])
   done
])

AC_CONFIG_FILES([
  Makefile
  doc/Makefile
  doc/cyclo/Makefile
  doc/doxygen/Doxyfile
  doc/reference/Makefile
  examples/Makefile
  examples/openid20/Makefile
  examples/saml20/Makefile
  gl/Makefile
  lib/Makefile
  lib/anonymous/Makefile
  lib/cram-md5/Makefile
  lib/digest-md5/Makefile
  lib/external/Makefile
  lib/gl/Makefile
  lib/gs2/Makefile
  lib/gssapi/Makefile
  lib/libgsasl.pc
  lib/login/Makefile
  lib/ntlm/Makefile
  lib/openid20/Makefile
  lib/plain/Makefile
  lib/saml20/Makefile
  lib/scram/Makefile
  lib/securid/Makefile
  lib/src/Makefile
  lib/src/gsasl-version.h
  po/Makefile.in
  src/Makefile
  tests/Makefile
])
gl_CONFIG_VERSION_STAMP
AC_OUTPUT

if test -e $srcdir/.git && command -v git > /dev/null; then
  AC_MSG_CHECKING([git timestamp for mtime of NEWS and doc/$PACKAGE.texi])
  REPRO_TIME=$(git log -1 --format=%cd --date=format-local:%Y%m%d%H%M.%S)
  touch -m -t "$REPRO_TIME" $srcdir/NEWS $srcdir/doc/$PACKAGE.texi
  AC_MSG_RESULT($REPRO_TIME)
fi

AC_MSG_NOTICE([summary of main build options:

  Version:            ${VERSION}
  Libtool version     $LT_CURRENT:$LT_REVISION:$LT_AGE
  DLL version:        $DLL_VERSION
  Header version:     major $MAJOR_VERSION minor $MINOR_VERSION patch $PATCH_VERSION number $NUMBER_VERSION
  Build system:       ${build}
  Host/Target system: ${host}
  Install prefix:     ${prefix}
  Compiler:           ${CC}
  CFLAGS:             ${CFLAGS}
  CPPFLAGS:           ${CPPFLAGS}
  LDFLAGS:            ${LDFLAGS}
  Library types:      Shared=${enable_shared}, Static=${enable_static}

  Warning flags:      $enable_gcc_warnings
      WERROR_CFLAGS:  $WERROR_CFLAGS
    WARN_LIB_CFLAGS:  $WARN_LIB_CFLAGS
        WARN_CFLAGS:  $WARN_CFLAGS

  Client side:        $client
  Server side:        $server

  Libidn:             $LTLIBIDN
  Libgcrypt:          $LIB_CRYPTO
  Libntlm:            $LTLIBNTLM
  GSS-API:            $gssapi_impl
           LTLIBGSS:  $LTLIBGSS
       LTLIBGSSGLUE:  $LTLIBGSSGLUE
      LTLIBGSSAPI32:  $LTLIBGSSAPI32
           GSS_LIBS:  $GSS_LIBS

  ANONYMOUS:          $anonymous
  EXTERNAL:           $external
  PLAIN:              $plain
  LOGIN:              $login
  SECURID:            $securid
  NTLM:               $ntlm
  CRAM-MD5:           $cram_md5
  DIGEST-MD5:         $digest_md5
  SCRAM-SHA-1:        $scram_sha1
  SCRAM-SHA-256:      $scram_sha256
  SAML20:             $saml20
  OPENID20:           $openid20
  GS2:                $gs2
  GSSAPI:             $gssapi

  Readline:           $gl_cv_lib_readline
        LIBREADLINE:  $LIBREADLINE

  GnuTLS:             $gnutls
       INCLIBGNUTLS:  $INCLIBGNUTLS
        LTLIBGNUTLS:  $LTLIBGNUTLS

  Valgrind:           $opt_valgrind_tests ${VALGRIND}
])