Package list cyrus-sasl2 / lintian-fixes/main configure.ac
lintian-fixes/main

Tree @lintian-fixes/main (Download .tar.gz)

configure.ac @lintian-fixes/mainraw · history · blame

   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
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
dnl configure.ac for the SASL library
dnl Rob Siemborski
dnl Rob Earhart
dnl $Id: configure.ac,v 1.224 2011/09/22 14:44:15 mel Exp $
dnl
dnl Copyright (c) 2001 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_PREREQ(2.63)

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
AC_INIT([cyrus-sasl],
        [2.1.27],
        [https://github.com/cyrusimap/cyrus-sasl/issues],
        [cyrus-sasl],
        [http://cyrusimap.org])

AC_CONFIG_MACRO_DIR([m4])

dnl use ./config.cache as the default cache file.
dnl we require a cache file to successfully configure our build.
if test $cache_file = "/dev/null"; then
cache_file="./config.cache"
AC_CACHE_LOAD
fi

AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET

AM_INIT_AUTOMAKE([1.11 tar-ustar dist-bzip2 foreign -Wno-portability subdir-objects])

DIRS=""

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

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

AC_ARG_ENABLE(obsolete_cram_attr,
              [AC_HELP_STRING([--enable-obsolete_cram_attr],
                              [enable support for cmusaslsecretCRAM-MD5 auxprop property [[yes]]])],
              enable_obsolete_cram_attr=$enableval,
              enable_obsolete_cram_attr=yes)

AC_ARG_ENABLE(obsolete_digest_attr,
              [AC_HELP_STRING([--enable-obsolete_digest_attr],
                              [enable support for cmusaslsecretDIGEST-MD5 auxprop property [[yes]]])],
              enable_obsolete_digest_attr=$enableval,
              enable_obsolete_digest_attr=yes)

AC_PROG_CC
AX_PROG_CC_FOR_BUILD
AC_PROG_CPP
AC_PROG_AWK
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_USE_SYSTEM_EXTENSIONS

dnl check for -R, etc. switch
CMU_GUESS_RUNPATH_SWITCH

dnl xxx compatibility
AC_ARG_WITH(staticsasl)
if test "$with_staticsasl" = yes; then
	enable_shared=yes
	enable_static=yes
fi

save_target=$target
if test -z "$target"; then
	target="NONE"
fi

# new libtool
AM_DISABLE_STATIC
AC_PROG_LIBTOOL

target=$save_target

if test "$enable_static" = yes; then
	SASL_STATIC_LIBS=libsasl2.a
else
	SASL_STATIC_LIBS=
fi

AC_ARG_ENABLE(staticdlopen, [  --enable-staticdlopen   try dynamic plugins when we are a static libsasl [[no]] ],
                enable_staticdlopen=$enableval,
                enable_staticdlopen=no)

if test "$enable_staticdlopen" = yes; then
  AC_DEFINE(TRY_DLOPEN_WHEN_STATIC,[],[Should we try to dlopen() plugins while statically compiled?])
fi

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=$enableval, 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
else
# Make distcheck work
  JAVAC="true"
  JAVAH="true"
  JAVADOC="true"
fi
AM_CONDITIONAL(JAVA, test "$enable_java" = yes)

if test "$enable_java" = yes; then
  AC_MSG_CHECKING([JNI cpp flags])
  AC_CACHE_VAL(sasl_cv_java_includes,[
  if test `echo $JAVAH | sed 's,.*/,,'` = "kaffeh"; then
    sasl_cv_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,)
	

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

  sasl_cv_java_includes="${sasl_cv_java_includes} -I$javapath/include"])

  JAVA_INCLUDES=$sasl_cv_java_includes
  AC_SUBST(JAVA_INCLUDES)
  AC_MSG_RESULT(ok)

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

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

dnl call before we do the berkeley DB checks
CMU_SOCKETS

dnl we extracted this to config/sasldb.m4
SASL_DB_PATH_CHECK()
SASL_DB_CHECK()

# Do we not install the SASL DB man pages?
AM_CONDITIONAL(NO_SASL_DB_MANS, test "x$SASL_DB_MANS" = "x")

AC_ARG_ENABLE(keep_db_open, [  --enable-keep-db-open   keep handle to DB open for improved performance [[no]] ],
                keep_db_open=$enableval,
                keep_db_open=no)

# Disable if Berkeley DB and LMDB are not used
if test "$dblib" != berkeley -a "$dblib" != lmdb; then
  keep_db_open=no
fi

if test "$keep_db_open" = yes; then
  AC_DEFINE(KEEP_DB_OPEN,[],[Should we keep handle to DB open in SASLDB plugin?])
fi
AC_MSG_CHECKING(if DB handle is kept open in SASLDB)
AC_MSG_RESULT($keep_db_open)

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

dnl /dev/random ?

AC_ARG_WITH(devrandom, [  --with-devrandom=PATH   set the path to pseudo random number generator [[/dev/urandom]] ],
  devrandom=$withval,
  devrandom=/dev/urandom)
AC_MSG_CHECKING(PRNG to use)
AC_MSG_RESULT($devrandom)
AC_DEFINE_UNQUOTED(SASL_DEV_RANDOM, "$devrandom", [File to use for source of randomness])

dnl Do we need leading underscores on our symbols?

AC_CHECK_PROGS(NM, nm)

AC_MSG_CHECKING(for underscore before symbols)
AC_CACHE_VAL(sasl_cv_uscore,[
    echo "int main(){int i=1; return 0;}
    void foo(){int i=6;}" > conftest.c
    ${CC} -o a.out conftest.c > /dev/null
    if (${NM} a.out | grep _foo) > /dev/null; then
      sasl_cv_uscore=yes
    else
      sasl_cv_uscore=no
    fi])
AC_MSG_RESULT($sasl_cv_uscore)
rm -f conftest.c a.out

if test $sasl_cv_uscore = yes; then
  if test $ac_cv_lib_dl_dlopen = yes ; then
	AC_MSG_CHECKING(whether dlsym adds the underscore for us)
	cmu_save_LIBS="$LIBS"
	LIBS="$LIBS $SASL_DL_LIB"
	AC_CACHE_VAL(sasl_cv_dlsym_adds_uscore,AC_TRY_RUN( [
#include <dlfcn.h>
#include <stdio.h>
void foo() { int i=0;}
int main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
    if(self) { ptr1=dlsym(self,"foo"); ptr2=dlsym(self,"_foo");
    if(ptr1 && !ptr2) exit(0); } exit(1); } 
], [sasl_cv_dlsym_adds_uscore=yes], sasl_cv_dlsym_adds_uscore=no
	AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, [], [Do we need a leading _ for dlsym?]),
	AC_MSG_WARN(cross-compiler, we'll do our best)))
	LIBS="$cmu_save_LIBS"
      AC_MSG_RESULT($sasl_cv_dlsym_adds_uscore)
  fi
fi

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

AC_ARG_WITH(saslauthd, [  --with-saslauthd=DIR    enable use of the saslauth daemon using state dir DIR ],
		with_saslauthd=$withval,
		with_saslauthd=yes)
if test "$with_saslauthd" != no; then
  if test "$with_saslauthd" = yes; then
    with_saslauthd="/var/state/saslauthd"
  fi
  AC_DEFINE(HAVE_SASLAUTHD,[],[Include support for saslauthd?])
  AC_DEFINE_UNQUOTED(PATH_SASLAUTHD_RUNDIR, "$with_saslauthd",
		     [Where do we look for saslauthd's socket?])
fi
AM_CONDITIONAL(SASLAUTHD, test "$with_saslauthd" != no)
AC_MSG_CHECKING(if I should include saslauthd)
AC_MSG_RESULT($with_saslauthd)

AC_ARG_WITH(authdaemond, [  --with-authdaemond=PATH enable use of authdaemon with default socket=PATH [[yes]] ],
		with_authdaemon=$withval,
		with_authdaemon=yes)
if test "$with_authdaemon" != no; then
  if test "$with_authdaemon" = yes; then
    with_authdaemon="/dev/null"
  fi
  AC_DEFINE(HAVE_AUTHDAEMON,[],[Include support for Courier's authdaemond?])
  AC_DEFINE_UNQUOTED(PATH_AUTHDAEMON_SOCKET, "$with_authdaemon",
		     [Where do we look for Courier authdaemond's socket?])
fi
AC_MSG_CHECKING(to include Courier authdaemond support)
AC_MSG_RESULT($with_authdaemon)

AC_ARG_WITH(pwcheck,
[  --with-pwcheck=DIR     enable deprecated pwcheck daemon using 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,[],[Include Support for pwcheck daemon?])
   AC_DEFINE_UNQUOTED(PWCHECKDIR, "$with_pwcheck", [Location of pwcheck socket])
   AC_CHECK_FUNC(getspnam,PWCHECKMETH="getspnam",PWCHECKMETH="getpwnam")
   AC_SUBST(PWCHECKMETH)
fi
AM_CONDITIONAL(PWCHECK, test "$with_pwcheck" != no)
AC_MSG_CHECKING(if I should include pwcheck)
AC_MSG_RESULT($with_pwcheck)

AC_ARG_WITH(ipctype, [  --with-ipctype={unix,doors}    use ipctype [[unix]] ],
       with_ipctype=$withval,
       with_ipctype="unix")
IPCTYPE=$with_ipctype
AC_SUBST(IPCTYPE)
LIB_DOOR=
if test "$with_ipctype" = "doors"; then
   LIB_DOOR="-ldoor"
   AC_DEFINE(USE_DOORS,[],[use the doors IPC API for saslauthd?])
fi
AC_SUBST(LIB_DOOR)

AC_ARG_ENABLE(alwaystrue, [  --enable-alwaystrue     enable the alwaystrue password verifier (discouraged)],
		enable_alwaystrue=$enableval,
		enable_alwaystrue=no)
if test "$enable_alwaystrue" = yes; then
  AC_DEFINE(HAVE_ALWAYSTRUE, [], [Enable 'alwaystrue' password verifier?])
fi
AC_MSG_CHECKING(if I should include the alwaystrue verifier)
AC_MSG_RESULT($enable_alwaystrue)

dnl sasl_checkapop support
AC_ARG_ENABLE(checkapop, [  --enable-checkapop      enable use of sasl_checkapop [[yes]] ],
  checkapop=$enableval,
  checkapop=yes)

AC_MSG_CHECKING(if we should enable sasl_checkapop)
if test "$checkapop" != no; then
  AC_MSG_RESULT(enabled)
  AC_DEFINE(DO_SASL_CHECKAPOP, [], [should we support sasl_checkapop?])
else
  AC_MSG_RESULT(disabled)
fi

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"
  if test "$enable_obsolete_cram_attr" = yes; then
    CPPFLAGS="$CPPFLAGS -DOBSOLETE_CRAM_ATTR=1"
  fi
  if test "$enable_static" = yes; then
    SASL_STATIC_OBJS="$SASL_STATIC_OBJS cram.o"
    SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/cram.c"
    AC_DEFINE(STATIC_CRAMMD5, [], [Link CRAM-MD5 Statically])
  fi
else
  AC_MSG_RESULT(disabled)
fi

CMU_HAVE_OPENSSL
AC_MSG_CHECKING(for OpenSSL)
AC_MSG_RESULT($with_openssl)

SASL_DES_CHK

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

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"
  if test "$enable_obsolete_digest_attr" = yes; then
    CPPFLAGS="$CPPFLAGS -DOBSOLETE_DIGEST_ATTR=1"
  fi
  if test "$enable_static" = yes; then
    SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/digestmd5.c"
    SASL_STATIC_OBJS="$SASL_STATIC_OBJS digestmd5.o"
    AC_DEFINE(STATIC_DIGESTMD5, [], [Link DIGEST-MD5 Statically])
  fi
else
  AC_MSG_RESULT(disabled)
fi

dnl SCRAM
AC_ARG_ENABLE(scram, [  --enable-scram            enable SCRAM authentication [[yes]] ],
  scram=$enableval,
  scram=yes)

if test "$with_openssl" = no; then
  AC_WARN([OpenSSL not found -- SCRAM will be disabled])
  scram=no
fi

AC_MSG_CHECKING(SCRAM)
if test "$scram" != no; then
  AC_MSG_RESULT(enabled)
  SCRAM_LIBS="-lcrypto $LIB_RSAREF"

  SASL_MECHS="$SASL_MECHS libscram.la"
  if test "$enable_static" = yes; then
    SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/scram.c"
    SASL_STATIC_OBJS="$SASL_STATIC_OBJS scram.o"
    AC_DEFINE(STATIC_SCRAM, [], [Link SCRAM Statically])
  fi

  AC_SUBST(SCRAM_LIBS)
else
  AC_MSG_RESULT(disabled)
fi

dnl OTP
AC_ARG_ENABLE(otp, [  --enable-otp            enable OTP authentication [[yes]] ],
  otp=$enableval,
  otp=yes)

if test "$with_openssl" = no; then
  AC_WARN([OpenSSL not found -- OTP will be disabled])
  otp=no
fi

AC_MSG_CHECKING(OTP)
if test "$otp" != no; then
  AC_MSG_RESULT(enabled)
  OTP_LIBS="-lcrypto $LIB_RSAREF"

  SASL_MECHS="$SASL_MECHS libotp.la"
  if test "$enable_static" = yes; then
    SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/otp.c"
    SASL_STATIC_OBJS="$SASL_STATIC_OBJS otp.o"
    AC_DEFINE(STATIC_OTP, [], [Link OTP Statically])
  fi

  dnl Test for OPIE
  AC_ARG_WITH(opie, AC_HELP_STRING([--with-opie=PATH], [use OPIE (One Time Passwords in Everything) from PATH]))

  case "$with_opie" in
	""|yes) 
		AC_CHECK_LIB(opie, opiechallenge, [
			AC_CHECK_HEADER(opie.h, with_opie="yes",
					with_opie="no")],
			with_opie="no")
		;;
	*)
		if test -d $with_opie; then
		  CPPFLAGS="${CPPFLAGS} -I${with_opie}/include"
		  LDFLAGS="${LDFLAGS} -L${with_opie}/lib"
		else
		  with_opie="no"
		fi
		;;
  esac

  AC_MSG_CHECKING(for OPIE)
  AC_MSG_RESULT($with_opie)

  if test "$with_opie" != no; then
    AC_DEFINE(HAVE_OPIE,[],[Use OPIE for server-side OTP?])
    OTP_LIBS="$OTP_LIBS -lopie"
  fi

  AC_SUBST(OTP_LIBS)

else
  AC_MSG_RESULT(disabled)
fi

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

if test "$with_openssl" = no; then
  AC_WARN([OpenSSL not found -- SRP will be disabled])
  srp=no
fi

AC_MSG_CHECKING(SRP)
if test "$srp" != no; then
  AC_MSG_RESULT(enabled)
  SRP_LIBS="-lcrypto $LIB_RSAREF"

  SASL_MECHS="$SASL_MECHS libsrp.la"
  if test "$enable_static" = yes; then
    SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/srp.c"
    SASL_STATIC_OBJS="$SASL_STATIC_OBJS srp.o"
    AC_DEFINE(STATIC_SRP, [], [Link SRP Statically])
  fi

dnl srp_setpass support
  AC_ARG_ENABLE(srp_setpass, [  --enable-srp-setpass    enable setting SRP secrets with saslpasswd [[no]]],
      srp_setpass=$enableval,
      srp_setpass=no)

  AC_MSG_CHECKING(if we should enable setting SRP secrets with saslpasswd)
  if test "$srp_setpass" != no; then
    AC_MSG_RESULT(enabled)
    AC_DEFINE(DO_SRP_SETPASS, [], [should we support setpass() for SRP?])
  else
    AC_MSG_RESULT(disabled)
  fi

  AC_SUBST(SRP_LIBS)
else
  AC_MSG_RESULT(disabled)
fi

dnl Kerberos based Mechanisms
SASL_KERBEROS_V4_CHK
SASL_GSSAPI_CHK

if test "$gssapi" != "no"; then
  AC_DEFINE(STATIC_GSSAPIV2,[],[Link GSSAPI Statically])
  AC_DEFINE(HAVE_GSSAPI,[],[Include GSSAPI/Kerberos 5 Support])

  mutex_default="no"
  if test "$gss_impl" = "mit"; then
     mutex_default="yes"
  elif test "$gss_impl" = "heimdal"; then
     AC_DEFINE(KRB5_HEIMDAL,[],[Using Heimdal]) 
  fi

  AC_MSG_CHECKING(to use mutexes aroung GSS calls)
  AC_ARG_ENABLE(gss_mutexes, [  --enable-gss_mutexes     use mutexes around calls to the GSS library],
                use_gss_mutexes=$enableval,
                use_gss_mutexes=$mutex_default)
  if test $use_gss_mutexes = "yes"; then
     AC_DEFINE(GSS_USE_MUTEXES, [], [should we mutex-wrap calls into the GSS library?])
  fi
  AC_MSG_RESULT($use_gss_mutexes)
fi

SASL2_CRYPT_CHK

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,[],[Include SIA Support])
    LIB_SIA="-lsecurity -ldb -lm -laud"
  else
    AC_MSG_ERROR([No support for SIA found])
  fi
fi
AC_SUBST(LIB_SIA)

AC_ARG_ENABLE(auth-sasldb, [  --enable-auth-sasldb    enable experimental SASLdb authentication module [no] ],
  authsasldb=$enableval,
  authsasldb=no)
if test "$authsasldb" != no; then
  AC_DEFINE(AUTH_SASLDB,[],[Include SASLdb Support])
  SASL_DB_PATH_CHECK()
  SASL_DB_CHECK()
fi
AM_CONDITIONAL(AUTH_SASLDB, test "$authsasldb" != no)

AC_ARG_ENABLE(httpform, [  --enable-httpform       enable HTTP form authentication [[no]] ],
  httpform=$enableval,
  httpform=no)
if test "$httpform" != no; then
  AC_DEFINE(HAVE_HTTPFORM,[],[Include HTTP form Support])
fi

AC_ARG_WITH(pam, AC_HELP_STRING([--with-pam=DIR], [use PAM (rooted in DIR) [yes]]),,
	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(for PAM support)
AC_MSG_RESULT($with_pam)
LIB_PAM=""
if test "$with_pam" != no; then
  AC_DEFINE(HAVE_PAM,[],[Support for PAM?])
  LIB_PAM="-lpam"
fi
AC_SUBST(LIB_PAM)

dnl PLAIN
SASL_PLAIN_CHK

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"
  if test "$enable_static" = yes; then
    SASL_STATIC_OBJS="$SASL_STATIC_OBJS anonymous.o"
    SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/anonymous.c"
    AC_DEFINE(STATIC_ANONYMOUS, [], [Link ANONYMOUS Statically])
  fi
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"
  if test "$enable_static" = yes; then
    SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/login.c"
    SASL_STATIC_OBJS="$SASL_STATIC_OBJS login.o"
    AC_DEFINE(STATIC_LOGIN,[],[Link LOGIN Statically])
  fi
else
  AC_MSG_RESULT(disabled)
fi

dnl NTLM
AC_ARG_ENABLE(ntlm, [  --enable-ntlm           enable unsupported NTLM authentication [[no]] ],
  ntlm=$enableval,
  ntlm=no)

if test "$with_openssl" = no; then
  AC_WARN([OpenSSL not found -- NTLM will be disabled])
  ntlm=no
fi

AC_MSG_CHECKING(NTLM)
if test "$ntlm" != no; then
  AC_MSG_RESULT(enabled)
  NTLM_LIBS="-lcrypto $LIB_RSAREF"
  AC_SUBST(NTLM_LIBS)

  SASL_MECHS="$SASL_MECHS libntlm.la"
  if test "$enable_static" = yes; then
    SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/ntlm.c"
    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ntlm.o"
    AC_DEFINE(STATIC_NTLM,[],[Link NTLM Statically])
  fi
else
  AC_MSG_RESULT(disabled)
fi

dnl PASSDSS
AC_ARG_ENABLE(passdss, [  --enable-passdss        enable PASSDSS authentication (experimental) [[no]] ],
  passdss=$enableval,
  passdss=no)

if test "$with_openssl" = no; then
  AC_WARN([OpenSSL not found -- PASSDSS will be disabled])
  passdss=no
fi

AC_MSG_CHECKING(PASSDSS)
if test "$passdss" != no; then
  AC_MSG_RESULT(enabled)
  PASSDSS_LIBS="-lcrypto $LIB_RSAREF"
  AC_SUBST(PASSDSS_LIBS)

  SASL_MECHS="$SASL_MECHS libpassdss.la"
  if test "$enable_static" = yes; then
    SASL_STATIC_OBJS="$SASL_STATIC_OBJS passdss.o"
    SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/passdss.c"
    AC_DEFINE(STATIC_PASSDSS,[],[Link PASSDSS Statically])
  fi
else
  AC_MSG_RESULT(disabled)
fi


AC_MSG_CHECKING(to include LDAP support)
AC_ARG_WITH(ldap, [  --with-ldap=DIR         use LDAP (in DIR) for saslauthd [no] ],
	with_ldap=$withval,
	with_ldap=no)
AC_MSG_RESULT($with_ldap)

if test -d $with_ldap; then
    CPPFLAGS="$CPPFLAGS -I${with_ldap}/include"
    CMU_ADD_LIBPATH(${with_ldap}/lib)
fi

LDAP_LIBS=""
if test "$with_ldap" != no; then
  AC_CHECK_LIB(ldap, ldap_initialize, [ AC_DEFINE(HAVE_LDAP,[],[Support for LDAP?])
                                        LDAP_LIBS="-lldap -llber"
					if test "$with_openssl" != "no"; then
					    LDAP_LIBS="$LDAP_LIBS -lcrypto $LIB_RSAREF"
					fi],,-llber)
fi
AC_SUBST(LDAP_LIBS)


dnl SQL
dnl This flag also changes the requirements of --with-mysql and --with-pgsql
dnl
dnl Desired behavior:
dnl
dnl doesn't require mysql or postgres if --disable-sql is chosen
dnl requires at least one (but not both) if --enable-sql is chosen

AC_ARG_ENABLE(sql, [  --enable-sql            enable SQL auxprop [[no]] ],
  sql=$enableval,
  sql=no)

AC_MSG_CHECKING(SQL)
if test "$sql" != no; then
  AC_MSG_RESULT(enabled)
  SASL_MECHS="$SASL_MECHS libsql.la"
  if test "$enable_static" = yes; then
    SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/sql.c"
    SASL_STATIC_OBJS="$SASL_STATIC_OBJS sql.o"
    AC_DEFINE(STATIC_SQL,[],[Link SQL plugin statically])
  fi
else
  AC_MSG_RESULT(disabled)
fi

dnl MySQL
AC_ARG_WITH(mysql,  [  --with-mysql=PATH       use MySQL from PATH ],
  with_mysql=$withval,
  with_mysql=$sql)

# find location of library 
# presuming if one given then correct
if test "${with_mysql}" = "yes"; then
  with_mysql=notfound
  for mysqlloc in lib/mysql lib mysql/lib
  do
    if test -f ${prefix}/${mysqlloc}/libmysqlclient.a; then
      with_mysql="${prefix}"
      break
    elif test -f /usr/local/${mysqlloc}/libmysqlclient.a; then
      with_mysql="/usr/local"
      break
    elif test -f /usr/${mysqlloc}/libmysqlclient.a; then
      with_mysql="/usr"
      break
    fi
  done
fi

LIB_MYSQL=""

case "$with_mysql" in
    no) true;;
    notfound)
     save_LDFLAGS=$LDFLAGS
     LIB_MYSQL=`mysql_config --libs`
     LIB_MYSQL="-lmysqlclient"
     LDFLAGS="$LDFLAGS $LIB_MYSQL"
     # CPPFLAGS="${CPPFLAGS} `mysql_config --include`"
     AC_CHECK_LIB(mysqlclient, mysql_select_db,
           AC_DEFINE(HAVE_MYSQL, [], [Do we have mysql support?]),
           [AC_WARN([MySQL library mysqlclient does not work])
            with_mysql=no])
     LDFLAGS=$save_LDFLAGS
     ;;
    *)
     if test -d ${with_mysql}/lib/mysql; then
	CMU_ADD_LIBPATH_TO(${with_mysql}/lib/mysql, LIB_MYSQL)
     elif test -d ${with_mysql}/mysql/lib; then
	CMU_ADD_LIBPATH_TO(${with_mysql}/mysql/lib, LIB_MYSQL)
     elif test -d ${with_mysql}/lib; then
	CMU_ADD_LIBPATH_TO(${with_mysql}/lib, LIB_MYSQL)
     else
	CMU_ADD_LIBPATH_TO(${with_mysql}, LIB_MYSQL)
     fi

     LIB_MYSQL_DIR=$LIB_MYSQL
     LIB_MYSQL="$LIB_MYSQL -lmysqlclient"

     if test -d ${with_mysql}/include/mysql; then
         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include/mysql"
     elif test -d ${with_mysql}/mysql/include; then
         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/mysql/include"
     elif test -d ${with_mysql}/include; then
         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include"
     elif test -d ${prefix}/include/mysql; then
         CPPFLAGS="${CPPFLAGS} -I${prefix}/include/mysql"
     else
         CPPFLAGS="${CPPFLAGS} -I${with_mysql}"
     fi

       save_LDFLAGS=$LDFLAGS
       LDFLAGS="$LDFLAGS $LIB_MYSQL_DIR"
       AC_CHECK_LIB(mysqlclient, mysql_select_db,
	   AC_DEFINE(HAVE_MYSQL, [], [Do we have mysql support?]),
           [AC_WARN([MySQL library mysqlclient does not work])
	    with_mysql=no])
       LDFLAGS=$save_LDFLAGS;;
         
esac
AC_SUBST(LIB_MYSQL)

dnl PgSQL
AC_ARG_WITH(pgsql,  [  --with-pgsql=PATH       use PostgreSQL from PATH ],
  with_pgsql=$withval,
  with_pgsql=$sql)

# find location of library 
# presuing if one given then correct
if test "${with_pgsql}" = "yes"; then
  with_pgsql=notfound
  for pgsqlloc in lib/pgsql lib pgsql/lib
  do
    if test -f ${prefix}/${pgsqlloc}/libpq.a; then
      with_pgsql="${prefix}"
      break
    elif test -f /usr/local/${pgsqlloc}/libpq.a; then
      with_pgsql="/usr/local"
      break
    elif test -f /usr/${pgsqlloc}/libpq.a; then
      with_pgsql="/usr"
      break
    fi
  done
fi

LIB_PGSQL=""

case "$with_pgsql" in
    no) true;;
    notfound)
     LIB_PGSQL="-lpq"
     # CPPFLAGS="${CPPFLAGS} -I`pg_config --includedir`"
     save_LDFLAGS=$LDFLAGS
     LDFLAGS="$LDFLAGS $LIB_PGSQL"
     AC_CHECK_LIB(pq, PQsetdbLogin, AC_DEFINE(HAVE_PGSQL,[],
         [Do we have Postgres support?]),
         [AC_WARN([PostgreSQL Library pq does not work])
          with_pgsql=no])
     LDFLAGS=$save_LDFLAGS
     ;;
    *)
     if test -d ${with_pgsql}/lib/pgsql; then
	CMU_ADD_LIBPATH_TO(${with_pgsql}/lib/pgsql, LIB_PGSQL)
     elif test -d ${with_pgsql}/pgsql/lib; then
	CMU_ADD_LIBPATH_TO(${with_pgsql}/pgsql/lib, LIB_PGSQL)
     elif test -d ${with_pgsql}/lib; then
	CMU_ADD_LIBPATH_TO(${with_pgsql}/lib, LIB_PGSQL)
     else
	CMU_ADD_LIBPATH_TO(${with_pgsql}, LIB_PGSQL)
     fi

     LIB_PGSQL_DIR=$LIB_PGSQL
     LIB_PGSQL="$LIB_PGSQL -lpq"

     if test -d ${with_pgsql}/include/pgsql; then
         CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/include/pgsql"
     elif test -d ${with_pgsql}/pgsql/include; then
         CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/pgsql/include"
     elif test -d ${with_pgsql}/include; then
         CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/include"
     elif test -d ${prefix}/include; then
         CPPFLAGS="${CPPFLAGS} -I${prefix}/include"
     else
         CPPFLAGS="${CPPFLAGS} -I${with_pgsql}"
     fi


       save_LDFLAGS=$LDFLAGS
       LDFLAGS="$LDFLAGS $LIB_PGSQL_DIR"
       AC_CHECK_LIB(pq, PQsetdbLogin, AC_DEFINE(HAVE_PGSQL,[],
	   [Do we have Postgres support?]),
           [AC_WARN([PostgreSQL Library pq does not work])
	    with_pgsql=no])
       LDFLAGS=$save_LDFLAGS;;
         
esac
AC_SUBST(LIB_PGSQL)

dnl SQLite
AC_ARG_WITH(sqlite,  [  --with-sqlite=PATH       use SQLite from PATH ],
  with_sqlite=$withval,
  with_sqlite=$sql)

# find location of library
# presuing if one given then correct
if test "${with_sqlite}" = "yes"; then
  with_sqlite=notfound
  for sqliteloc in lib
  do
    if test -f ${prefix}/${sqliteloc}/libsqlite.a; then
      with_sqlite="${prefix}"
      break
    elif test -f /usr/local/${sqliteloc}/libsqlite.a; then
      with_sqlite="/usr/local"
      break
    elif test -f /usr/${sqliteloc}/libsqlite.a; then
      with_sqlite="/usr"
      break
    fi
  done
fi

LIB_SQLITE=""

case "$with_sqlite" in
    no) true;;
    notfound) AC_WARN([SQLite Library not found]); true;;
    *)
     if test -d ${with_sqlite}/lib; then
         CMU_ADD_LIBPATH_TO(${with_sqlite}/lib, LIB_SQLITE)
     else
         CMU_ADD_LIBPATH_TO(${with_sqlite}, LIB_SQLITE)
     fi

     LIB_SQLITE_DIR=$LIB_SQLITE
     LIB_SQLITE="$LIB_SQLITE -lsqlite"

     if test -d ${with_sqlite}/include; then
         CPPFLAGS="${CPPFLAGS} -I${with_sqlite}/include"
     else
         CPPFLAGS="${CPPFLAGS} -I${with_sqlite}"
     fi
       AC_CHECK_LIB(sqlite, sqlite_open, AC_DEFINE(HAVE_SQLITE,[],
	   [Do we have SQLite support?]),
           [AC_WARN([SQLite Library sqlite does not work])
	    with_sqlite=no], $LIB_SQLITE_DIR);;

esac
AC_SUBST(LIB_SQLITE)

dnl SQLite3
AC_ARG_WITH(sqlite3,  [  --with-sqlite3=PATH       use SQLite3 from PATH ],
  with_sqlite3=$withval,
  with_sqlite3=$sql)

# find location of library
# we assume that if one given then it is correct
if test "${with_sqlite3}" = "yes"; then
  with_sqlite3=notfound
  for sqlite3loc in lib
  do
    if test -f ${prefix}/${sqlite3loc}/libsqlite3.a; then
      with_sqlite3="${prefix}"
      break
    elif test -f /usr/local/${sqlite3loc}/libsqlite3.a; then
      with_sqlite3="/usr/local"
      break
    elif test -f /usr/${sqlite3loc}/libsqlite3.a; then
      with_sqlite3="/usr"
      break
    fi
  done
fi

LIB_SQLITE3=""

case "$with_sqlite3" in
    no) true;;
    notfound) AC_WARN([SQLite3 Library not found]); true;;
    *)
     if test -d ${with_sqlite3}/lib; then
         CMU_ADD_LIBPATH_TO(${with_sqlite3}/lib, LIB_SQLITE3)
     else
         CMU_ADD_LIBPATH_TO(${with_sqlite3}, LIB_SQLITE3)
     fi

     LIB_SQLITE3_DIR=$LIB_SQLITE3
     LIB_SQLITE3="$LIB_SQLITE3 -lsqlite3"

     if test -d ${with_sqlite3}/include; then
         CPPFLAGS="${CPPFLAGS} -I${with_sqlite3}/include"
     else
         CPPFLAGS="${CPPFLAGS} -I${with_sqlite3}"
     fi
       AC_CHECK_LIB(sqlite3, sqlite3_open, AC_DEFINE(HAVE_SQLITE3,[],
	   [Do we have SQLite3 support?]),
           [AC_WARN([SQLite3 Library sqlite3 does not work])
	    with_sqlite3=no], $LIB_SQLITE3_DIR);;

esac
AC_SUBST(LIB_SQLITE3)

if test "$sql" = yes -a "$with_pgsql" = no -a "$with_mysql" = no -a "$with_sqlite" = no -a "$with_sqlite3" = no; then
    AC_MSG_ERROR([--enable-sql chosen but neither Postgres nor MySQL nor SQLite nor SQLite3 found])
fi

if test "$enable_shared" = yes; then
	AC_DEFINE(DO_DLOPEN,[],[Should we build a shared plugin (via dlopen) library?])
fi

dnl LDAPDB
AC_ARG_ENABLE(ldapdb, [  --enable-ldapdb         enable LDAPDB plugin [no] ],
  ldapdb=$enableval,
  ldapdb=no)
AC_MSG_CHECKING(LDAPDB)
if test "$ldapdb" != no; then
    AC_MSG_RESULT(enabled)

    if test "$with_ldap" = no; then
        AC_MSG_ERROR([Cannot enable LDAPDB plugin: You need to specify --with-ldap])
    fi

    save_CPPFLAGS=$CPPFLAGS
    save_LDFLAGS=$LDFLAGS

    if test -d $with_ldap; then
        CPPFLAGS="${CPPFLAGS} -I${with_ldap}/include"
        CMU_ADD_LIBPATH(${with_ldap}/lib)
    fi

    AC_CHECK_HEADERS(ldap.h lber.h)

    if test $ac_cv_header_ldap_h = yes -a $ac_cv_header_lber_h = yes; then
        CMU_OPENLDAP_API

        if test "$cmu_cv_openldap_api" = yes; then
            AC_CHECK_LIB(ldap, ldap_initialize, [ cmu_link_openldap="-lldap -llber" ], [ cmu_link_openldap=no ],-llber)
        fi
    fi

    if test "$cmu_cv_openldap_api" = no -o "$cmu_link_openldap" = no; then
        AC_MSG_ERROR([Cannot enable LDAPDB plugin: Could not locate OpenLDAP])
    else
        CMU_OPENLDAP_COMPAT

        if test "$cmu_cv_openldap_compat" = no; then
            AC_MSG_ERROR([Cannot enable LDAPDB plugin: OpenLDAP library located but incompatible])
        else
            LIB_LDAP=$cmu_link_openldap
            AC_SUBST(LIB_LDAP)

            SASL_MECHS="$SASL_MECHS libldapdb.la"
            if test "$enable_static" = yes; then
                SASL_STATIC_SRCS="$SASL_STATIC_SRCS \$(top_srcdir)/plugins/ldapdb.c"
                SASL_STATIC_OBJS="$SASL_STATIC_OBJS ldapdb.o"
                AC_DEFINE(STATIC_LDAPDB,[],[Link ldapdb plugin Statically])
            fi
        fi
    fi

    if test "$cmu_cv_openldap_compat" != yes; then
        CPPFLAGS=$save_CPPFLAGS
        LDFLAGS=$save_LDFLAGS
    fi
else
    AC_MSG_RESULT(disabled)
fi

AC_SUBST(SASL_MECHS)
AC_SUBST(SASL_STATIC_SRCS)
AC_SUBST(SASL_STATIC_OBJS)
AC_SUBST(SASL_STATIC_LIBS)

AC_ARG_WITH(plugindir, [  --with-plugindir=DIR    set the directory where plugins will
                          be found [[LIBDIR/sasl2]] ],
  plugindir=$withval,
  plugindir='${libdir}/sasl2')
AC_SUBST(plugindir)

AC_ARG_WITH(configdir, [   --with-configdir=DIR    set the directory where config files will
                          be found [PLUGINDIR:SYSCONFDIR/sasl2] ],
  configdir=$withval,
  configdir='${plugindir}:${sysconfdir}/sasl2')
AC_SUBST(configdir)

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

if test "$with_rc4" != no; then
    AC_DEFINE(WITH_RC4,[],[Use internal RC4 implementation?])
fi

building_for_macosx=no
case "$host_os" in
        darwin*)
AC_ARG_ENABLE(macos-framework, [  --disable-macos-framework       disable building and installing replacement SASL2 Framework for MacOS X-provided SASL Framework [[no]]],building_for_macosx=no,building_for_macosx=yes)
        ;;
esac
AM_CONDITIONAL(MACOSX, test "$building_for_macosx" = yes)
AM_CONDITIONAL(WINDOWS, test "$host_os" = "mingw32")

dnl dmalloc tests
AC_MSG_CHECKING(for dmalloc library)
AC_ARG_WITH(dmalloc, [  --with-dmalloc=DIR      with DMALLOC support (for test applications) [[no]] ],
	with_dmalloc=$withval,
	with_dmalloc=no)

DMALLOC_LIBS=""

if test "$with_dmalloc" != "no"; then
   if test "$with_dmalloc" = "yes"; then
	with_dmalloc="/usr/local"
   fi

   if test -r "$with_dmalloc/libdmalloc.a"; then
	DMALLOC_LIBS="$with_dmalloc/libdmalloc.a"
	AC_DEFINE(WITH_DMALLOC,[],[Linking against dmalloc?])
	AC_MSG_RESULT(yes)
   elif test -r "$with_dmalloc/lib/libdmalloc.a"; then
	DMALLOC_LIBS="$with_dmalloc/lib/libdmalloc.a"
	AC_DEFINE(WITH_DMALLOC,[],[Linking against dmalloc?])
	AC_MSG_RESULT(yes)
   else
	AC_MSG_ERROR(cannot find dmalloc library, please check your installation.)
   fi
else
   AC_MSG_RESULT(no)
fi

AC_SUBST(DMALLOC_LIBS)

dnl sfio tests
AC_MSG_CHECKING(for sfio library)
AC_ARG_WITH(sfio, [  --with-sfio=DIR         with SFIO support (for smtptest/libsfsasl) [[no]] ],
	with_sfio=$withval,
	with_sfio=no)

if test "$with_sfio" != "no"; then
   if test "$with_sfio" = "yes"; then
	with_sfio="/usr/local"
   fi

   AC_DEFUN([SFIO_INC_CHK],
	[if test -r "$with_sfio$1/sfio.h"; then SFIO_DIR=$with_sfio;
					      SFIO_INC_DIR=$with_sfio$1])

   AC_DEFUN([SFIO_LIB_CHK],[
		str="$SFIO_DIR/$1/libsfio.*"
		for i in `echo $str`; do
			if test -r $i; then
				SFIO_LIBDIR=$SFIO_DIR/$1
				break 2
			fi
		done
		])

   SFIO_INC_CHK()
   el[]SFIO_INC_CHK(/include)
   el[]SFIO_INC_CHK(/include/sfio)
   fi

   if test -z "$SFIO_DIR"; then
	AC_MSG_ERROR(Cannot find sfio.h, Please check your SFIO installation.)
   fi

   SFIO_LIB_CHK(lib)
   SFIO_LIB_CHK(lib/sfio)

   if test -z "$SFIO_LIBDIR"; then
	AC_MSG_ERROR(Cannot find sfio library, Please check your SFIO installation.)
   fi

   SFIO_INC_FLAGS="-I$SFIO_INC_DIR"
   SFIO_LIB_FLAGS="-L$SFIO_LIBDIR -lsfio"
   SMTPTEST_PROGRAM="smtptest"
   SASL_UTIL_LIBS_EXTRA=libsfsasl2.la
   SASL_UTIL_HEADERS_EXTRA=sfsasl.h

   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
   SFIO_INC_FLAGS=""
   SFIO_LIB_FLAGS=""
   SMTPTEST_PROGRAM=""
   SASL_UTIL_LIBS_EXTRA=""
   SASL_UTIL_HEADERS_EXTRA=""
fi

AC_SUBST(SFIO_INC_FLAGS)
AC_SUBST(SFIO_LIB_FLAGS)
AC_SUBST(SMTPTEST_PROGRAM)
AC_SUBST(SASL_UTIL_LIBS_EXTRA)
AC_SUBST(SASL_UTIL_HEADERS_EXTRA)

dnl check for getsubopt
sasl_cv_getsubopt=no
AC_CHECK_FUNC(getsubopt, [AC_DEFINE(HAVE_GETSUBOPT,[],
	[do we have getsubopt()?])], [sasl_cv_getsubopt=yes])
if test $sasl_cv_getsubopt = yes; then
	AC_LIBOBJ(getsubopt)
	GETSUBOPT="getsubopt.lo"
fi
AC_SUBST(GETSUBOPT)

dnl Check for snprintf
sasl_cv_snprintf=no
SNPRINTFOBJS=""
LTSNPRINTFOBJS=""
AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF,[],[Does the system have snprintf()?])], [sasl_cv_snprintf=yes])
AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF,[],[Does the system have vsnprintf()?])], [sasl_cv_snprintf=yes])
if test $sasl_cv_snprintf = yes; then
       AC_LIBOBJ(snprintf)
       SNPRINTFOBJS="snprintf.o"
       LTSNPRINTFOBJS="snprintf.lo"
fi
AC_SUBST(SNPRINTFOBJS)
AC_SUBST(LTSNPRINTFOBJS)

dnl do we need to link in -lresolv?
AC_CHECK_LIB(resolv, inet_aton)

dnl Check for getaddrinfo
GETADDRINFOOBJS=""
sasl_cv_getaddrinfo=yes
IPv6_CHECK_FUNC(getaddrinfo, [IPv6_CHECK_FUNC(gai_strerror,
                [AC_DEFINE(HAVE_GETADDRINFO,[],[Do we have a getaddrinfo() function?])
                sasl_cv_getaddrinfo=no])])
if test $sasl_cv_getaddrinfo = yes; then
    AC_LIBOBJ(getaddrinfo)
    GETADDRINFOOBJS="getaddrinfo.o"
    LTGETADDRINFOOBJS="getaddrinfo.lo"
fi
AC_SUBST(GETADDRINFOOBJS)
AC_SUBST(LTGETADDRINFOOBJS)

dnl Check for getnameinfo
GETNAMEINFOOBJS=""
sasl_cv_getnameinfo=no
IPv6_CHECK_FUNC(getnameinfo,
		[AC_DEFINE(HAVE_GETNAMEINFO,[],[Do we have a getnameinfo() function?])], [sasl_cv_getnameinfo=yes])
if test $sasl_cv_getnameinfo = yes; then
	AC_LIBOBJ(getnameinfo)
        GETNAMEINFOOBJS="getnameinfo.o"
        LTGETNAMEINFOOBJS="getnameinfo.lo"
fi
AC_SUBST(GETNAMEINFOOBJS)
AC_SUBST(LTGETNAMEINFOOBJS)

LTLIBOBJS=`echo "$LIB@&t@OBJS" | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
AM_CONDITIONAL(BUILD_LIBOBJ, test "$LTLIBOBJS" != "")
AC_SUBST(LTLIBOBJS)

AC_C_CONST
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL

AC_HEADER_TIME
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(crypt.h des.h dlfcn.h fcntl.h limits.h malloc.h paths.h strings.h sys/file.h sys/time.h syslog.h unistd.h inttypes.h sys/uio.h sys/param.h sysexits.h stdarg.h varargs.h krb5.h)

IPv6_CHECK_SS_FAMILY()
IPv6_CHECK_SA_LEN()
IPv6_CHECK_SOCKLEN_T()

#AC_FUNC_MEMCMP
#AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gethostname getdomainname getpwnam getspnam gettimeofday inet_aton memcpy mkdir select socket strchr strdup strerror strspn strstr strtol jrand48 getpassphrase asprintf strlcat strlcpy)

if test $ac_cv_func_getspnam = yes; then
	AC_MSG_CHECKING(if getpwnam_r/getspnam_r take 5 arguments)
	AC_TRY_COMPILE(
		[
#include <sys/types.h>
#include <pwd.h>
#include <shadow.h>
		],
		[
struct passwd *pw;
struct passwd pwbuf;
char pwdata[512];
(void) getpwnam_r("bin", &pwbuf, pwdata, sizeof(pwdata), &pw);
		],
		[AC_MSG_RESULT(yes)
		 AC_DEFINE(GETXXNAM_R_5ARG, 1,
			[Define if your getpwnam_r()/getspnam_r()
			functions take 5 arguments])],
		[AC_MSG_RESULT(no)]
	)
fi

if test $enable_cmulocal = yes; then
    AC_WARN([enabling CMU local kludges])
    AC_DEFINE(KRB4_IGNORE_IP_ADDRESS,[],[Ignore IP Address in Kerberos 4 tickets?])
    AC_DEFINE_UNQUOTED(PREFER_MECH, "KERBEROS_V4", [Force a preferred mechanism])
fi

AC_EGREP_HEADER(sockaddr_storage, sys/socket.h, [
		AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE,[],[Do we have struct sockaddr_stroage?])])

AC_SUBST(DIRS)

dnl documentation generation (sphinx, perl2rst)
AC_ARG_VAR(SPHINX_BUILD, [Location of sphinx-build])
AC_ARG_WITH([sphinx-build],
            AS_HELP_STRING([with-sphinx-build=(yes|no|PATH)], [Look for sphinx-build in PATH]),
            [with_sphinx_build=$withval],
            [with_sphinx_build=yes])
AS_CASE([$with_sphinx_build],
        [yes],  [AC_PATH_PROG(SPHINX_BUILD, sphinx-build)],
        [no],   [SPHINX_BUILD=''],
        [*],    [AC_PATH_PROG(SPHINX_BUILD, sphinx-build, [], [$with_sphinx_build])])
AS_IF([test -z "$SPHINX_BUILD"],
      [AC_MSG_WARN([No sphinx-build, won't be able to regenerate docs])])
AC_SUBST([SPHINX_BUILD])
AC_PROG_PERL_MODULES([Pod::POM::View::Restructured],
                     [have_ppvr=yes],
                     [AC_MSG_WARN([No Pod::POM::View::Restructured, won't be able to regenerate docs])])
AM_CONDITIONAL([HAVE_SPHINX_BUILD], [ test -n "$SPHINX_BUILD" -a x"$have_ppvr" = xyes])


AH_TOP([
/* acconfig.h - autoheader configuration input */
/* 
 * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer. 
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The name "Carnegie Mellon University" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For permission or any other legal
 *    details, please contact  
 *      Office of Technology Transfer
 *      Carnegie Mellon University
 *      5000 Forbes Avenue
 *      Pittsburgh, PA  15213-3890
 *      (412) 268-4387, fax: (412) 268-7395
 *      tech-transfer@andrew.cmu.edu
 *
 * 4. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by Computing Services
 *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
 *
 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef CONFIG_H
#define CONFIG_H
])

AH_BOTTOM([


/* Create a struct iovec if we need one */
#if !defined(_WIN32)
#if !defined(HAVE_SYS_UIO_H)
/* (win32 is handled in sasl.h) */
struct iovec {
    char *iov_base;
    long iov_len;
};
#else
#include <sys/types.h>
#include <sys/uio.h>
#endif
#endif

/* location of the random number generator */
#ifdef DEV_RANDOM
#undef DEV_RANDOM
#endif
#define DEV_RANDOM SASL_DEV_RANDOM

/* if we've got krb_get_err_txt, we might as well use it;
   especially since krb_err_txt isn't in some newer distributions
   (MIT Kerb for Mac 4 being a notable example). If we don't have
   it, we fall back to the krb_err_txt array */
#ifdef HAVE_KRB_GET_ERR_TEXT
#define get_krb_err_txt krb_get_err_text
#else
#define get_krb_err_txt(X) (krb_err_txt[(X)])
#endif

/* Make Solaris happy... */
#ifndef __EXTENSIONS__
#define __EXTENSIONS__
#endif

/* Make Linux happy... */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#define SASL_PATH_ENV_VAR "SASL_PATH"
#define SASL_CONF_PATH_ENV_VAR "SASL_CONF_PATH"

#include <stdlib.h>
#include <sys/types.h>
#ifndef WIN32
# include <sys/socket.h>
# include <netdb.h>
# include <netinet/in.h>
# ifdef HAVE_SYS_PARAM_H
#  include <sys/param.h>
# endif
#else /* WIN32 */
# include <winsock2.h>
#endif /* WIN32 */
#include <string.h>

#ifndef HAVE_SOCKLEN_T
typedef unsigned int socklen_t;
#endif /* HAVE_SOCKLEN_T */

#if !defined(HAVE_STRUCT_SOCKADDR_STORAGE) && !defined(WIN32)
#define	_SS_MAXSIZE	128	/* Implementation specific max size */
#define	_SS_PADSIZE	(_SS_MAXSIZE - sizeof (struct sockaddr))

struct sockaddr_storage {
	struct	sockaddr ss_sa;
	char		__ss_pad2[_SS_PADSIZE];
};
# define ss_family ss_sa.sa_family
#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */

#ifndef AF_INET6
/* Define it to something that should never appear */
#define	AF_INET6	AF_MAX
#endif

#ifndef HAVE_GETADDRINFO
#define	getaddrinfo	sasl_getaddrinfo
#define	freeaddrinfo	sasl_freeaddrinfo
#define	gai_strerror	sasl_gai_strerror
#endif

#ifndef HAVE_GETNAMEINFO
#define	getnameinfo	sasl_getnameinfo
#endif

#if !defined(HAVE_GETNAMEINFO) || !defined(HAVE_GETADDRINFO)
#include "gai.h"
#endif

#ifndef AI_NUMERICHOST   /* support glibc 2.0.x */
#define AI_NUMERICHOST  4
#define NI_NUMERICHOST  2
#define NI_NAMEREQD     4
#define NI_NUMERICSERV  8
#endif

/* Defined in RFC 1035. max strlen is only 253 due to length bytes. */
#ifndef MAXHOSTNAMELEN
#define        MAXHOSTNAMELEN  255
#endif

#ifndef HAVE_SYSEXITS_H
#include "exits.h"
#else
#include "sysexits.h"
#endif

/* Get the correct time.h */
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
#  include <sys/time.h>
# else
#  include <time.h>
# endif
#endif

#ifndef HIER_DELIMITER
#define HIER_DELIMITER '/'
#endif

#ifdef WIN32
#define SASL_ROOT_KEY "SOFTWARE\\Carnegie Mellon\\Project Cyrus\\SASL Library"
#define SASL_PLUGIN_PATH_ATTR "SearchPath"
#define SASL_CONF_PATH_ATTR "ConfFile"

#include <windows.h>
inline static unsigned int sleep(unsigned int seconds) {
       Sleep(seconds * 1000);
       return 0;
}
#endif

/* handy string manipulation functions */
#ifndef HAVE_STRLCPY
extern size_t saslauthd_strlcpy(char *dst, const char *src, size_t len);
#define strlcpy(x,y,z) saslauthd_strlcpy((x),(y),(z))
#endif
#ifndef HAVE_STRLCAT
extern size_t saslauthd_strlcat(char *dst, const char *src, size_t len);
#define strlcat(x,y,z) saslauthd_strlcat((x),(y),(z))
#endif
#ifndef HAVE_ASPRINTF
extern int asprintf(char **str, const char *fmt, ...);
#endif

#endif /* CONFIG_H */
])

AH_BOTTOM([#if defined __GNUC__ &&  __GNUC__ > 6
    #define GCC_FALLTHROUGH __attribute__((fallthrough));
#else
    #define GCC_FALLTHROUGH /* fall through */
#endif
])

AC_CONFIG_HEADERS(config.h)

AC_OUTPUT(Makefile
libsasl2.pc
include/Makefile
saslauthd/Makefile
sasldb/Makefile
common/Makefile
plugins/Makefile
lib/Makefile
utils/Makefile
sample/Makefile
java/Makefile
java/CyrusSasl/Makefile
java/Test/Makefile
java/javax/Makefile
java/javax/security/Makefile
java/javax/security/auth/Makefile
java/javax/security/auth/callback/Makefile
pwcheck/Makefile)

AC_MSG_NOTICE([

cyrus-sasl - $VERSION

 Prefix: $prefix
 Plugins: $SASL_MECHS

Now type 'make' to build $PACKAGE
])