File: configure.in

package info (click to toggle)
cyrus-sasl-mit 1.5.24-15woody3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 3,132 kB
  • ctags: 1,870
  • sloc: ansic: 18,782; sh: 8,971; java: 1,536; cpp: 384; makefile: 227
file content (719 lines) | stat: -rw-r--r-- 20,247 bytes parent folder | download
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
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
dnl configure.in for the SASL library
dnl Rob Earhart
dnl $Id: configure.in,v 1.2 2001/03/30 07:49:49 hartmans Exp $
dnl
dnl Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that the following conditions
dnl are met:
dnl
dnl 1. Redistributions of source code must retain the above copyright
dnl    notice, this list of conditions and the following disclaimer. 
dnl
dnl 2. Redistributions in binary form must reproduce the above copyright
dnl    notice, this list of conditions and the following disclaimer in
dnl    the documentation and/or other materials provided with the
dnl    distribution.
dnl
dnl 3. The name "Carnegie Mellon University" must not be used to
dnl    endorse or promote products derived from this software without
dnl    prior written permission. For permission or any other legal
dnl    details, please contact  
dnl      Office of Technology Transfer
dnl      Carnegie Mellon University
dnl      5000 Forbes Avenue
dnl      Pittsburgh, PA  15213-3890
dnl      (412) 268-4387, fax: (412) 268-7395
dnl      tech-transfer@andrew.cmu.edu
dnl
dnl 4. Redistributions of any form whatsoever must retain the following
dnl    acknowledgment:
dnl    \"This product includes software developed by Computing Services
dnl     at Carnegie Mellon University (http://www.cmu.edu/computing/).\"
dnl
dnl CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
dnl THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dnl AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
dnl FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
dnl AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
dnl OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
dnl
AC_INIT(lib/saslint.h)
AC_CONFIG_AUX_DIR(config)
AM_CONFIG_HEADER(config.h)
AC_CANONICAL_HOST

dnl
dnl REMINDER: When changing the version number here, please also update
dnl the values in win32/include/config.h and include/sasl.h as well.
dnl
AM_INIT_AUTOMAKE(cyrus-sasl, 1.5.24)
CMU_INIT_AUTOMAKE

DIRS=""

AC_ARG_ENABLE(cmulocal, [  --enable-cmulocal       enable local mods for CMU [no]],,enable_cmulocal=no)

AC_ARG_ENABLE(sample, [  --enable-sample         compile sample code [yes]],,enable_sample=yes)

AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
CMU_C___ATTRIBUTE__

dnl check for -R, etc. switch
CMU_GUESS_RUNPATH_SWITCH
dnl let's just link against local.  otherwise we never find anything useful.
dnl CPPFLAGS="-I/usr/local/include ${CPPFLAGS}"
dnl CMU_ADD_LIBPATH("/usr/local/lib")

AM_DISABLE_STATIC

CMU_PROG_LIBTOOL

if test "$ac_cv_prog_gcc" = yes; then
  CFLAGS="-Wall -W ${CFLAGS}"
fi

AC_ARG_WITH(purecov,[  --with-purecov          link with purecov])
if test "$with_purecov" = yes; then
  AC_CHECK_PROGS(PURECOV, purecov)
fi
AC_ARG_WITH(purify,[  --with-purify           link with purify])
if test "$with_purify" = yes; then
  AC_CHECK_PROGS(PURIFY, purify)
fi

AC_ARG_ENABLE(java, [  --enable-java           compile Java support [no]],
	enable_java=yes, enable_java=no)
if test "$enable_java" = yes; then
  AC_PATH_PROG(JAVAC, javac, no)
  AC_PATH_PROGS(JAVAH, javah kaffeh, no)
  AC_CHECK_PROGS(JAVADOC, javadoc, :)	
  if test "$JAVAC" = "no" -o "$JAVAH" = "no"; then
    AC_WARN([Disabling Java support])
    enable_java=no
  fi
fi
AM_CONDITIONAL(JAVA, test "$enable_java" = yes)

if test "$enable_java" = yes; then
  AC_MSG_CHECKING([JNI cpp flags])
  if test `echo $JAVAH | sed 's,.*/,,'` = "kaffeh"; then
    JAVA_INCLUDES=-I`echo $JAVAH | sed -e 's,/bin.*,/include/kaffe,'`
  else
    java_base=`echo $JAVAC | sed 's,/bin.*,'','`

    AC_ARG_WITH(javabase, [  --with-javabase=PATH      set path to find jni.h in [/usr/java/include] ],
        java_base=$withval,)
	

    JAVA_INCLUDES=''
    for dir in `find ${java_base}/include -follow -type d -print | grep -v green_threads`; do
      JAVA_INCLUDES="${JAVA_INCLUDES} -I$dir"
    done
  fi
  JAVAROOT=".."
  AC_SUBST(JAVAROOT)

  JAVA_INCLUDES="${JAVA_INCLUDES} -I$javapath/include"

  AC_SUBST(JAVA_INCLUDES)
  AC_MSG_RESULT(JAVA_INCLUDES)
  JAVAC=`echo "$JAVAC" | sed 's,.*/,,'`
  JAVAH=`echo "$JAVAH" | sed 's,.*/,,'`
fi

AM_CONDITIONAL(SAMPLE, test "$enable_sample" = yes)

dnl Figure out what database path we're using
AC_ARG_WITH(dbpath, [  --with-dbpath=PATH      set the DB path to use [/etc/sasldb] ],
  dbpath=$withval,
  dbpath=/etc/sasldb)
AC_MSG_CHECKING(DB path to use)
AC_MSG_RESULT($dbpath)
AC_DEFINE_UNQUOTED(SASL_DB_PATH, "$dbpath")

dnl Figure out what database type we're using
cmu_save_LIBS="$LIBS"
AC_ARG_WITH(dblib, [  --with-dblib=DBLIB      set the DB library to use [berkeley] ],
  dblib=$withval,
  dblib=auto_detect)
SASL_DB_LIB=""
case "$dblib" in
dnl this is unbelievably painful due to confusion over what db-3 should be
dnl named.  arg.
  berkeley)
	AC_CHECK_HEADER(db.h,
			AC_CHECK_LIB(db-3, db_create, SASL_DB_LIB="-ldb-3";
			   dblib="berkeley",
			AC_CHECK_LIB(db, db_create, SASL_DB_LIB="-ldb";
			   dblib="berkeley",
			AC_CHECK_LIB(db, db_open, SASL_DB_LIB="-ldb"; 
			   dblib="berkeley",
                        dblib="no"))),
			dblib="no")
	;;
  gdbm)
	AC_CHECK_HEADER(gdbm.h,
			AC_CHECK_LIB(gdbm, gdbm_open, SASL_DB_LIB="-lgdbm",
                                           dblib="no"),
			dblib="no")
	;;
  ndbm)
	dnl We want to attempt to use -lndbm if we can, just in case
	dnl there's some version of it installed and overriding libc
	AC_CHECK_HEADER(ndbm.h,
			AC_CHECK_LIB(ndbm, dbm_open, SASL_DB_LIB="-lndbm",
				AC_CHECK_FUNC(dbm_open,,dblib="no")),
				dblib="no")
	;;
  auto_detect)
        dnl How about berkeley db?
	AC_CHECK_HEADER(db.h,
			AC_CHECK_LIB(db-3, db_create, SASL_DB_LIB="-ldb-3";
			   dblib="berkeley",
			AC_CHECK_LIB(db, db_create, SASL_DB_LIB="-ldb";
			   dblib="berkeley",
			AC_CHECK_LIB(db, db_open, SASL_DB_LIB="-ldb"; 
			   dblib="berkeley",
                        dblib="no"))),
			dblib="no")
	if test "$dblib" = no; then
	  dnl How about ndbm?
	  AC_CHECK_HEADER(ndbm.h, 
		AC_CHECK_LIB(ndbm, dbm_open,
			     dblib="ndbm"; SASL_DB_LIB="-lndbm",
		   	     dblib="weird"),
		   dblib="no")
	  if test "$dblib" = "weird"; then
	    dnl Is ndbm in the standard library?
            AC_CHECK_FUNC(dbm_open, dblib="ndbm", dblib="no")
	  fi

	  if test "$dblib" = no; then
            dnl Can we use gdbm?
   	    AC_CHECK_HEADER(gdbm.h,
		AC_CHECK_LIB(gdbm, gdbm_open, dblib="gdbm";
					     SASL_DB_LIB="-lgdbm", dblib="no"),
  			     dblib="no")
	  fi
	fi
	;;
  none)
	;;
  no)
	;;
  *)
	AC_MSG_WARN([Bad DB library implementation specified;])
	AC_ERROR([Use either \"berkeley\", \"gdbm\", \"ndbm\" or \"none\"])
	dblib=no
	;;
esac
LIBS="$cmu_save_LIBS"

AC_MSG_CHECKING(DB library to use)
AC_MSG_RESULT($dblib)



case "$dblib" in
  gdbm) 
    SASL_DB_BACKEND="db_${dblib}.lo"
    AC_DEFINE(SASL_GDBM)
    ;;
  ndbm)
    SASL_DB_BACKEND="db_${dblib}.lo"
    AC_DEFINE(SASL_NDBM)
    ;;
  berkeley)
    SASL_DB_BACKEND="db_${dblib}.lo"
    AC_DEFINE(SASL_BERKELEYDB)
    SASL_DB_LIB="-ldb"
    ;;
  *)
    AC_MSG_WARN([Disabling SASL authentication database support])
    SASL_DB_BACKEND="db_none.lo"
    SASL_DB_LIB=""
    ;;
esac
AC_SUBST(SASL_DB_BACKEND)
AC_SUBST(SASL_DB_LIB)

AC_CHECK_LIB(dl, dlopen, SASL_DL_LIB="-ldl", SASL_DL_LIB="")
AC_SUBST(SASL_DL_LIB)

dnl See if we can provide a default logging function...
AC_CHECK_FUNCS(syslog)

LIB_CRYPT=""
AC_CHECK_FUNC(crypt, cmu_have_crypt=yes,
  AC_CHECK_LIB(crypt, crypt,
	       LIB_CRYPT="-lcrypt"; cmu_have_crypt=yes,
	       cmu_have_crypt=no))
AC_SUBST(LIB_CRYPT)

CMU_SOCKETS

AC_ARG_ENABLE(sia, [  --enable-sia            enable SIA authentication [no] ],
  sia=$enableval,
  sia=no)
LIB_SIA=""
if test "$sia" != no; then
  if test -f /etc/sia/matrix.conf; then
    AC_DEFINE(HAVE_SIA)
    LIB_SIA="-lsecurity -ldb -lm -laud"
  else
    AC_ERROR([No support for SIA found])
  fi
fi
AC_SUBST(LIB_SIA)

AC_ARG_WITH(pam, [  --with-pam=DIR          use PAM (rooted in DIR) [yes] ],
	with_pam=$withval,
	with_pam=yes)
if test "$with_pam" != no; then
  if test -d $with_pam; then
    CPPFLAGS="$CPPFLAGS -I${with_pam}/include"
    LDFLAGS="$LDFLAGS -L${with_pam}/lib"
  fi
  cmu_save_LIBS="$LIBS"
  AC_CHECK_LIB(pam, pam_start,
	  AC_CHECK_HEADER(security/pam_appl.h,,
			  with_pam=no),
		with_pam=no, $SASL_DL_LIB)
  LIBS="$cmu_save_LIBS"
fi

AC_MSG_CHECKING(PAM support)
AC_MSG_RESULT($with_pam)
LIB_PAM=""
if test "$with_pam" != no; then
  AC_DEFINE(HAVE_PAM)
  LIB_PAM="-lpam"
fi
AC_SUBST(LIB_PAM)

AC_ARG_WITH(pwcheck,[  --with-pwcheck=DIR      enable use of the pwcheck daemonusing statedir DIR ],
	with_pwcheck=$withval,
	with_pwcheck=no)
if test "$with_pwcheck" != no; then
   if test "$with_pwcheck" = yes; then
     with_pwcheck=/var/pwcheck
   fi
   AC_DEFINE(HAVE_PWCHECK)
   AC_DEFINE_UNQUOTED(PWCHECKDIR, "$with_pwcheck")
   AC_CHECK_FUNC(getspnam,PWCHECKMETH="getspnam",PWCHECKMETH="getpwnam")
   AC_SUBST(PWCHECKMETH)
fi
AM_CONDITIONAL(PWCHECK, test "$with_pwcheck" != no)

dnl CRAM-MD5
AC_ARG_ENABLE(cram, [  --enable-cram           enable CRAM-MD5 authentication [yes] ],
  cram=$enableval,
  cram=yes)

AC_MSG_CHECKING(CRAM-MD5)
if test "$cram" != no; then
  AC_MSG_RESULT(enabled)
  SASL_MECHS="$SASL_MECHS libcrammd5.la"
else
  AC_MSG_RESULT(disabled)
fi


dnl SCRAM-MD5
AC_ARG_ENABLE(scram, [  --enable-scram          enable unsupported SCRAM-MD5 authentication [no] ],
  scram=$enableval,
  scram=no)

AC_MSG_CHECKING(SCRAM-MD5)
if test "$scram" != no; then
  AC_MSG_RESULT(enabled)
  SASL_MECHS="$SASL_MECHS libscrammd5.la"
else
  AC_MSG_RESULT(disabled)
fi

dnl DIGEST-MD5
AC_ARG_ENABLE(digest, [  --enable-digest         enable DIGEST-MD5 authentication [yes] ],
  digest=$enableval,
  digest=yes)

AC_ARG_WITH(des, [  --with-des=DIR          with DES (look in DIR) [yes] ],
	with_des=$withval,
	with_des=yes)

LIB_DES=""
if test "$with_des" != no; then
  if test -d $with_des; then
    CPPFLAGS="$CPPFLAGS -I${with_des}/include"
    LDFLAGS="$LDFLAGS -L${with_des}/lib"
  fi
  AC_CHECK_LIB(des425, des_pcbc_encrypt, [LIB_DES="-ldes425";
				       with_des=yes], with_des=no)

  if test "$with_des" = no; then
    dnl if openssl is around, we might be able to use that for des

    dnl if openssl has been compiled with the rsaref2 libraries,
    dnl we need to include the rsaref libraries in the crypto check
    LIB_RSAREF=""
    AC_CHECK_LIB(rsaref, RSAPublicEncrypt,
                 LIB_RSAREF="-lRSAglue -lrsaref"; cmu_have_rsaref=yes,
                 cmu_have_rsaref=no)

    AC_CHECK_LIB(crypto, des_pcbc_encrypt, 
	AC_CHECK_HEADER(openssl/des.h, [AC_DEFINE(WITH_SSL_DES)
					LIB_DES="-lcrypto";
					with_des=yes],
			with_des=no), 
        with_des=no, $LIB_RSAREF)
  fi
fi



if test "$with_des" != no; then
  AC_DEFINE(WITH_DES)
fi

AC_SUBST(LIB_DES)

if test "$digest" != no; then
  dnl In order to compile digest, we should look for need libdes.
  if test -d $digest; then
    CPPFLAGS="$CPPFLAGS -I$digest/include"
    LDFLAGS="$LDFLAGS -L$digest/lib"
  fi
  if test "$with_des" = no; then
    AC_WARN(No DES support for DIGEST-MD5)
  fi
fi

AC_MSG_CHECKING(DIGEST-MD5)
if test "$digest" != no; then
  AC_MSG_RESULT(enabled)
  SASL_MECHS="$SASL_MECHS libdigestmd5.la"
else
  AC_MSG_RESULT(disabled)
fi


dnl KERBEROS_V4
AC_ARG_ENABLE(krb4, [  --enable-krb4           enable KERBEROS_V4 authentication [yes] ],
  krb4=$enableval,
  krb4=yes)

if test "$krb4" != no; then
  dnl In order to compile kerberos4, we need libkrb and libdes.

  dnl we might need -lresolv for kerberos
  AC_CHECK_LIB(resolv,res_search)

  dnl if we were ambitious, we would look more aggressively for the
  dnl krb4 install
  if test -d ${krb4}; then
     AC_CACHE_CHECK(for Kerberos includes, cyrus_krbinclude, [
       for krbhloc in include/kerberosIV include/kerberos include
       do
         if test -f ${krb4}/${krbhloc}/krb.h ; then
           cyrus_krbinclude=${krb4}/${krbhloc}
           break
         fi
       done
       ])

     if test -n "${cyrus_krbinclude}"; then
       CPPFLAGS="$CPPFLAGS -I${cyrus_krbinclude}"
     fi
     LDFLAGS="$LDFLAGS -L$krb4/lib"
  fi

  if test "$with_des" != no; then
    AC_CHECK_HEADER(krb.h,
      AC_CHECK_LIB(krb4, krb_mk_priv, COM_ERR="",
	AC_CHECK_LIB(krb, krb_mk_priv, COM_ERR="-lcom_err",
                     AC_WARN(No Kerberos V4 found); krb4=no, -ldes -lcom_err),
        -ldes425 -lk5crypto -lkrb5 -lcom_err),
      AC_WARN(No Kerberos V4 found); krb4=no)
  else
    AC_WARN(No DES library found for Kerberos V4 support)
    krb4=no
  fi
fi

AC_MSG_CHECKING(KERBEROS_V4)
if test "$krb4" != no; then
  AC_MSG_RESULT(enabled)
  SASL_MECHS="$SASL_MECHS libkerberos4.la"
  AC_DEFINE(HAVE_KRB)
  SASL_KRB_LIB="-lkrb4 -ldes425 -lk5crypto -lkrb5  $COM_ERR"
  AC_SUBST(SASL_KRB_LIB)
else
  AC_MSG_RESULT(disabled)
fi

dnl GSSAPI
AC_ARG_ENABLE(gssapi, [  --enable-gssapi	  enable GSSAPI authentication [yes] ],
  gssapi=$enableval,
  gssapi=yes)

if test "$gssapi" != no; then
  if test -d ${gssapi}; then
     CPPFLAGS="$CPPFLAGS -I$gssapi/include"
     LDFLAGS="$LDFLAGS -L$gssapi/lib"
  fi
  AC_CHECK_HEADER(gssapi.h, AC_DEFINE(HAVE_GSSAPI_H),
    AC_CHECK_HEADER(gssapi/gssapi.h,, AC_WARN(Disabling GSSAPI); gssapi=no))
fi

if test "$gssapi" != no; then
  dnl We need to find out which gssapi implementation we are
  dnl using. Supported alternatives are: MIT Kerberos 5 and
  dnl Heimdal Kerberos 5 (http://www.pdc.kth.se/heimdal)
  dnl
  dnl The choice is reflected in GSSAPIBASE_LIBS
  dnl we might need libdb
  AC_CHECK_LIB(db, db_open)

  gss_impl="mit";
  AC_CHECK_LIB(resolv,res_search)
  if test -d ${gssapi}; then 
     CPPFLAGS="$CPPFLAGS -I$gssapi/include"
     LDFLAGS="$LDFLAGS -L$gssapi/lib"
  fi

  AC_CHECK_LIB(roken,base64_decode,gss_impl="heimdal",, $LIB_CRYPT)

  if test -d ${gssapi}; then
     GSSAPIBASE_LIBS="-L$gssapi"
  fi

  if test "$gss_impl" = mit; then
     GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS/lib -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
  elif test "$gss_impl" = "heimdal"; then
     GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS/lib -lgssapi -lkrb5 -lcrypto -lasn1 -lroken ${LIB_CRYPT} -lcom_err"
  else
     gssapi="no"
     AC_WARN(Disabling GSSAPI)
  fi

fi

if test "$ac_cv_header_gssapi_h" = "yes"; then
  AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h,
    AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE))
elif test "$ac_cv_header_gssapi_gssapi_h"; then
  AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi/gssapi.h,
    AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE))
fi

GSSAPI_LIBS=""
AC_MSG_CHECKING(GSSAPI)
if test "$gssapi" != no; then
  AC_MSG_RESULT(with implementation ${gss_impl})
  AC_CHECK_LIB(ndbm,dbm_open,GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lndbm")
  AC_CHECK_LIB(resolv,res_search,GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lresolv")
  SASL_MECHS="$SASL_MECHS libgssapiv2.la"
else
  AC_MSG_RESULT(disabled)
fi
AC_SUBST(GSSAPI_LIBS)
AC_SUBST(GSSAPIBASE_LIBS)

dnl ANONYMOUS
AC_ARG_ENABLE(anon, [  --enable-anon           enable ANONYMOUS authentication [yes] ],
  anon=$enableval,
  anon=yes)

AC_MSG_CHECKING(ANONYMOUS)
if test "$anon" != no; then
  AC_MSG_RESULT(enabled)
  SASL_MECHS="$SASL_MECHS libanonymous.la"
else
  AC_MSG_RESULT(disabled)
fi


dnl PLAIN
AC_ARG_ENABLE(plain, [  --enable-plain          enable PLAIN authentication [yes] ],
  plain=$enableval,
  plain=yes)

PLAIN_LIBS=""
if test "$plain" != no; then
  dnl In order to compile plain, we need crypt.
  if test "$cmu_have_crypt" = yes; then
    PLAIN_LIBS=$LIB_CRYPT
  fi
  if test "$krb4" != "no"; then
    PLAIN_LIBS="$PLAIN_LIBS $SASL_KRB_LIB"
  fi  
  if test "$with_pam" != no; then
    PLAIN_LIBS="$PLAIN_LIBS $LIB_PAM"
  fi
  if test "$sia" != no; then
    PLAIN_LIBS="$PLAIN_LIBS $LIB_SIA"
  fi
fi
AC_SUBST(PLAIN_LIBS)

AC_MSG_CHECKING(PLAIN)
if test "$plain" != no; then
  AC_MSG_RESULT(enabled)
  SASL_MECHS="$SASL_MECHS libplain.la"
else
  AC_MSG_RESULT(disabled)
fi

dnl LOGIN
AC_ARG_ENABLE(login, [  --enable-login          enable unsupported LOGIN authentication [no] ],
  login=$enableval,
  login=no)

AC_MSG_CHECKING(LOGIN)
if test "$login" != no; then
  AC_MSG_RESULT(enabled)
  SASL_MECHS="$SASL_MECHS liblogin.la"
else
  AC_MSG_RESULT(disabled)
fi

dnl SRP
AC_ARG_ENABLE(srp, [  --enable-srp           enable SRP authentication [no] ],
  srp=$enableval,
  srp=no)

AC_MSG_CHECKING(SRP)
if test "$srp" != no; then
  AC_ERROR([This is pre-alpha. You probably don't want to use this])
  AC_MSG_RESULT(enabled)
  SRP_LIBS="-lgmp -lcrypto"
  AC_SUBST(SRP_LIBS)
  SASL_MECHS="$SASL_MECHS libsrp.la"
else
  AC_MSG_RESULT(disabled)
fi

dnl 7879-*
AC_ARG_ENABLE(x509, [  --enable-x509           enable 7879 authentication [no] ],
  x509=$enableval,
  x509=no)

AC_MSG_CHECKING(X509)
if test "$x509" != no; then
  AC_ERROR([This is pre-alpha. You probably don't want to use this])
  AC_MSG_RESULT(enabled)
  X509_LIBS="-lssl -lcrypto"
  AC_SUBST(X509_LIBS)
  SASL_MECHS="$SASL_MECHS libx509.la"
else
  AC_MSG_RESULT(disabled)
fi

AC_SUBST(SASL_MECHS)


AC_ARG_WITH(plugindir, [  --with-plugindir=DIR    set the directory where plugins will
                          be found [/usr/lib/sasl] ],
  plugindir=$withval,
  plugindir=/usr/lib/sasl)
AC_DEFINE_UNQUOTED(PLUGINDIR, "$plugindir")
AC_SUBST(plugindir)

dnl look for rc4 libraries. we accept the CMU one or one from openSSL
AC_ARG_WITH(rc4, [  --with-rc4=DIR          use rc4 (look in DIR) [yes] ],
	with_rc4=$withval,
	with_rc4=yes)

LIB_RC4=""
if test "$with_rc4" != no; then
  if test -d $with_rc4; then
    CPPFLAGS="$CPPFLAGS -I${with_rc4}/include"
    LDFLAGS="$LDFLAGS -L${with_rc4}/lib"
  fi
  cmu_save_LIBS="$LIBS"
  AC_CHECK_LIB(rc4, rc4_init,
	  AC_CHECK_HEADER(rc4.h,  [AC_DEFINE(WITH_CMU_RC4)
	                           LIB_RC4="-lrc4"; with_rc4="cmu"],
		          with_rc4=no),
	    with_rc4=no)

  if test "$with_rc4" = no; then
	  dnl if openssl has been compiled with the rsaref2 libraries,
	  dnl we need to include the rsaref libraries in the crypto check
	  LIB_RSAREF=""
	  AC_CHECK_LIB(rsaref, RSAPublicEncrypt,
		  LIB_RSAREF="-lRSAglue -lrsaref"; cmu_have_rsaref=yes,
		  cmu_have_rsaref=no)

	  AC_CHECK_LIB(crypto, RC4_set_key,
		  AC_CHECK_HEADER(openssl/rc4.h, [AC_DEFINE(WITH_SSL_RC4)
                                                  LIB_RC4="-lcrypto";
						  with_rc4="openssl"],
			          AC_WARN([SSL: Disabling rc4 support]); 
                                  with_rc4=no),
		       AC_WARN([SSL2: Disabling rc4 support]); with_rc4=no,
			       $LIB_RSAREF)
  fi

  LIBS="$cmu_save_LIBS"
fi

AC_MSG_CHECKING(rc4 support)
AC_MSG_RESULT($with_rc4)
AC_SUBST(LIB_RC4)

AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_FUNCS(strchr memcpy getpwnam getspnam gettimeofday)

dnl check for getsubopt
sasl_cv_getsubopt=no
AC_CHECK_FUNC(getsubopt, [AC_DEFINE(HAVE_GETSUBOPT)], [sasl_cv_getsubopt=yes])
if test $sasl_cv_getsubopt = yes; then
	LIBOBJS="$LIBOBJS getsubopt.o"
	GETSUBOPT="getsubopt.lo"
fi
AC_SUBST(GETSUBOPT)

dnl Check for snprintf
sasl_cv_snprintf=no
SNPRINTFOBJS=""
AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF)], [sasl_cv_snprintf=yes])
AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF)], [sasl_cv_snprintf=yes])
if test $sasl_cv_snprintf = yes; then
	LIBOBJS="$LIBOBJS snprintf.o"
        SNPRINTFOBJS="snprintf.o"
fi
AC_SUBST(SNPRINTFOBJS)

LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'`
AC_SUBST(LTLIBOBJS)

AC_CHECK_HEADERS(getopt.h unistd.h crypt.h pwd.h shadow.h paths.h)
AC_C_CONST
AC_C_INLINE

AC_CHECK_HEADER(sfio.h,
	        SASL_UTIL_LIBS_EXTRA=libsfsasl.la
	          SASL_UTIL_HEADERS_EXTRA=sfsasl.h,
                SASL_UTIL_LIBS_EXTRA=""
                  SASL_UTIL_HEADERS_EXTRA="")
AC_SUBST(SASL_UTIL_LIBS_EXTRA)
AC_SUBST(SASL_UTIL_HEADERS_EXTRA)

AC_CHECK_FUNCS(getdomainname getpassphrase getpid)

if test $enable_cmulocal = yes; then
    AC_WARN([enabling CMU local kludges])
    AC_DEFINE(KRB4_IGNORE_IP_ADDRESS)
    AC_DEFINE_UNQUOTED(PREFER_MECH, "KERBEROS_V4")
fi

AC_SUBST(DIRS)

AC_OUTPUT(Makefile include/Makefile lib/Makefile plugins/Makefile utils/Makefile doc/Makefile sample/Makefile java/Makefile java/CyrusSasl/Makefile pwcheck/Makefile man/Makefile)