summaryrefslogtreecommitdiff
path: root/configure.in
blob: bea30e8a0654fb2f90d47a8dc8ffb0c9a691d0bd (plain)
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
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
dnl configure.in for cvs

AC_COPYRIGHT(
[Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
              1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
              Free Software Foundation, Inc.

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 2, 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.])

AC_INIT([Concurrent Versions System (CVS)],[1.12.13],
	[bug-cvs@nongnu.org],[cvs])
AC_CONFIG_SRCDIR(src/cvs.h)
AC_CONFIG_AUX_DIR(build-aux)
AM_INIT_AUTOMAKE([gnu 1.9.2 dist-bzip2 no-define])
AC_PREREQ(2.59)

AC_PREFIX_PROGRAM(cvs)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE

dnl This needs to be called to enable certain system extensions before calling
dnl a C compiler.
gl_EARLY

AC_PROG_CC
AM_PROG_CC_C_O

# Find the posix library needed on INTERACTIVE UNIX (ISC)
dnl
dnl From the Autoconf 2.53 manual (AC_ISC_POSIX):
dnl
dnl  For INTERACTIVE UNIX (ISC), add `-lcposix' to output variable
dnl  `LIBS' if necessary for POSIX facilities.  Call this after
dnl  `AC_PROG_CC' and before any other macros that use POSIX
dnl  interfaces.  INTERACTIVE UNIX is no longer sold, and Sun says that
dnl  they will drop support for it on 2006-07-23, so this macro is
dnl  becoming obsolescent.
dnl
AC_SEARCH_LIBS([strerror], [cposix])

dnl
dnl Autoconf stopped setting $ISC sometime before 2.53
dnl
dnl If this is still important, someone should come up with a generic test
dnl for whether _SYSV3 needs to be defined.  Removed code below:
dnl
dnl if test "$ISC" = yes; then
dnl CFLAGS="$CFLAGS -D_SYSV3"
dnl # And I don't like this...  In theory it should be found later if server is
dnl # enabled, but maybe something on INTERACTIVE UNIX (ISC) we didn't ask to
dnl # link with crypt tries?  Anyhow, the autoconf manual says we can delete
dnl # this ISC stuff on or after 2006-07-23 when Sun discontinues support and
dnl # ISC becomes obsolescent, but I suppose that is probably a matter of
dnl # opinion.
dnl #
dnl # N.B.  The reason for doing this is that some moron decided to put a stub
dnl # for crypt in libc that always returns NULL.  Without this here, the later
dnl # check will find the stub instead of the real thing, resulting in a server
dnl # that can't process crypted passwords correctly.
dnl
dnl # again, if we have to try and reenable this for ISC, someone should come
dnl # up with a generic test that figures out whether crypt is good or not -
dnl # Is it always returning NULL?
dnl LIBS="-lcrypt $LIBS"
dnl fi
dnl
dnl FIXME - This has been broken for at least a few months anyhow, so I'm
dnl removing the crypt lib define above, but the correct fix would be to
dnl provide a CRYPT_WORKS macro or the like that gets called sometime after
dnl the AC_SEARCH_LIBS call that normally finds crypt, and if crypt doesn't
dnl work, the macro should be retried with LIBS="-lcrypt $LIBS" forced.
dnl

AC_PROG_RANLIB
AC_PROG_LN_S
AC_SYS_LARGEFILE
AC_EXEEXT

AC_PATH_PROG(PERL, perl, no)
AC_PATH_PROG(CSH, csh, no)
# for contrib/rcs2log.sh & src/cvsbug.in.
AC_PATH_PROG(MKTEMP, mktemp, mktemp)
if test x"$MKTEMP" = xmktemp; then
	MKTEMP_SH_FUNCTION=$srcdir/mktemp.sh
else
	MKTEMP_SH_FUNCTION=/dev/null
fi
AC_SUBST_FILE(MKTEMP_SH_FUNCTION)
# for src/cvsbug.in
AC_PATH_PROG(SENDMAIL, sendmail, no, [$PATH:/usr/sbin:/usr/lib])
# For diff/util.c
AC_PATH_PROG(PR, pr, no)
if test x"$PR" != xno; then
	AC_DEFINE_UNQUOTED([PR_PROGRAM], ["$PR"], [Path to the pr utility])
fi

dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
dnl FIXME I pulled this default list from sanity.sh.  Perhaps these lists
dnl can be stored in one location?
dnl
dnl Yeah, put the value in a variable add it to the substitution list
dnl then have configure create sanity.sh from sanity.sh.in...
glocs="$PATH:/usr/local/bin:/usr/contrib/bin:/usr/gnu/bin:/local/bin:/local/gnu/bin:/gnu/bin"
AC_PATH_PROGS(ROFF, groff roff, $missing_dir/missing roff, $glocs)
AC_PATH_PROG(PS2PDF, ps2pdf, $missing_dir/missing ps2pdf)
AC_PATH_PROG(TEXI2DVI, texi2dvi, $missing_dir/missing texi2dvi)

AC_SYS_INTERPRETER
if test X"$ac_cv_sys_interpreter" != X"yes" ; then
  # silly trick to avoid problems in AC macros...
  ac_msg='perl scripts using #! may not be invoked properly'
  AC_MSG_WARN($ac_msg)
fi

# BSD's logo is a devil for a reason, hey?
AC_CACHE_CHECK(for BSD VPATH bug in make, ccvs_cv_bsd_make_vpath_bug,
[if test ! -d ac_test_dir ; then
	AC_TRY_COMMAND([mkdir ac_test_dir])
fi
cat >conftestmake <<EOF
VPATH = ac_test_dir
ac_test_target: ac_test_dep
	echo BSD VPATH bug present >&2
ac_test_dep: ac_test_dep_dep
EOF
touch ac_test_dir/ac_test_dep_dep
touch ac_test_dir/ac_test_dep
touch ac_test_target
# Don't know why, but the following test doesn't work under FreeBSD 4.2
# without this sleep command
sleep 1
if AC_TRY_COMMAND([make -f conftestmake 2>&1 >/dev/null |grep ^BSD\ VPATH\ bug\ present\$ >/dev/null]) ; then
	ccvs_cv_bsd_make_vpath_bug=yes
else
	ccvs_cv_bsd_make_vpath_bug=no
fi
AC_TRY_COMMAND([rm -rf ac_test_dir ac_test_target conftestmake])])
# We also don't need to worry about the bug when $srcdir = $builddir
AM_CONDITIONAL(MAKE_TARGETS_IN_VPATH, \
		test $ccvs_cv_bsd_make_vpath_bug = no \
		|| test $srcdir = .)

AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(\
	direct.h \
	fcntl.h \
	io.h \
	memory.h \
	ndbm.h \
	stdint.h \
	syslog.h \
	sys/bsdtypes.h \
	sys/file.h \
	sys/param.h \
	sys/resource.h \
	sys/select.h \
	unistd.h \
	utime.h\
)
AC_HEADER_STAT

AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL

AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_CHECK_MEMBERS([struct stat.st_rdev])

AC_FUNC_FSEEKO
if test $ac_cv_func_fseeko = no; then
    AC_LIBOBJ(fseeko)
    AC_LIBOBJ(ftello)
fi

# Replace functions with versions in lib/ when they can't be found.
AC_REPLACE_FUNCS(\
	waitpid \
)

#
# Special hack for a SunOS 5.7 (aka Solaris 7) select() problem.
#
ccvs_FUNC_SELECT

#
# Begin GNULIB stuff.
#

# Look for functions from GNULIB and replace with versions in lib/ when
# necessary.
dnl This calls most of the GNULIB macros we need via the
dnl autogenerated m4/gnulib.m4.
gl_INIT
dnl For one reason or another, the autogenerated m4/gnulib.m4 wants
dnl AM_GNU_GETTEXT([external]) called directly from here.
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION dnl work around for autoconf-2.57 bug.
# The error module still poses merge problems.
AC_FUNC_STRERROR_R
dnl The following macros can be called by other GNULIB macros but are also
dnl used by the UNIQUE_*_TYPE stuff below.  I don't want to rely on the GNULIB
dnl macros which call these to continue to do so, so use AC_REQUIRE, which can
dnl only be called from within another macro, to only call them only once.
AC_DEFUN([CCVS_CALL_GNULIB_MACROS_ONCE],
[AC_REQUIRE([gt_TYPE_LONGDOUBLE])
AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
AC_REQUIRE([gl_AC_TYPE_INTMAX_T])
AC_REQUIRE([gl_FUNC_MMAP_ANON])
AC_REQUIRE([gl_AC_TYPE_LONG_LONG])])
CCVS_CALL_GNULIB_MACROS_ONCE()
dnl Until I persuade the GNULIB folks to integrate this module.
gl_GLOB

#
# End GNULIB stuff.
#



# Check for function existance.
AC_CHECK_FUNCS(\
	fchdir \
	fchmod \
	fsync \
	ftime \
	geteuid \
	getgroups \
	getpagesize \
	gettimeofday \
	initgroups \
	login \
	logout \
	mknod \
	regcomp \
	regerror \
	regexec \
	regfree \
	sigaction \
	sigblock \
	sigprocmask \
	sigsetmask \
	sigvec \
	timezone \
	tzset \
	vprintf \
	wait3 \
)

dnl
dnl Find the sizes of various types and set a variable for some if they
dnl are "unique", meaning it does not share a size with a lower precedence
dnl type.
dnl
dnl also, I snagged this cross_compiling line from openldap's autoconf,
dnl because I can't figure out how to stop autoconf from giving cross compiler
dnl related warnings each time the AC_CHECK_SIZEOF function is run
dnl
if test $cross_compiling = yes ; then
	AC_DEFINE(CROSS_COMPILING, 1, [define if cross compiling])
else
	AC_CHECK_SIZEOF(char)
	AC_CACHE_CHECK(for uniquely sized char,
		ccvs_cv_unique_int_type_char,
		[if set |grep ^ccvs_cv_unique_int_type_ \
			|grep "($ac_cv_sizeof_char)" >/dev/null ; then
			ccvs_cv_unique_int_type_char=no
		else
			ccvs_cv_unique_int_type_char=yes\($ac_cv_sizeof_char\)
		fi])
	if test $ccvs_cv_unique_int_type_char != no ; then
		AC_DEFINE( UNIQUE_INT_TYPE_CHAR, 1,
                           [Define if char is the first integer type
		            detected with its size.])
	fi
	AC_CHECK_SIZEOF(short)
	AC_CACHE_CHECK(for uniquely sized short,
		ccvs_cv_unique_int_type_short,
		[if set |grep ^ccvs_cv_unique_int_type_ \
			|grep "($ac_cv_sizeof_short)" >/dev/null ; then
			ccvs_cv_unique_int_type_short=no
		else
			ccvs_cv_unique_int_type_short=yes\($ac_cv_sizeof_short\)
		fi])
	if test $ccvs_cv_unique_int_type_short != no ; then
		AC_DEFINE( UNIQUE_INT_TYPE_SHORT, 1,
                           [Define if short is the first integer type
		            detected with its size.])
	fi
	AC_CHECK_SIZEOF(int)
	AC_CACHE_CHECK(for uniquely sized int,
		ccvs_cv_unique_int_type_int,
		[if set |grep ^ccvs_cv_unique_int_type_ \
			|grep "($ac_cv_sizeof_int)" >/dev/null ; then
			ccvs_cv_unique_int_type_int=no
		else
			ccvs_cv_unique_int_type_int=yes\($ac_cv_sizeof_int\)
		fi])
	if test $ccvs_cv_unique_int_type_int != no ; then
		AC_DEFINE( UNIQUE_INT_TYPE_INT, 1,
                           [Define if int is the first integer type
		            detected with its size.])
	fi
	AC_CHECK_SIZEOF(long)
	AC_CACHE_CHECK(for uniquely sized long,
		ccvs_cv_unique_int_type_long,
		[if set |grep ^ccvs_cv_unique_int_type_ \
			|grep "($ac_cv_sizeof_long)" >/dev/null ; then
			ccvs_cv_unique_int_type_long=no
		else
			ccvs_cv_unique_int_type_long=yes\($ac_cv_sizeof_long\)
		fi])
	if test $ccvs_cv_unique_int_type_long != no ; then
		AC_DEFINE(UNIQUE_INT_TYPE_LONG, 1,
                          [Define if long int is the first integer type
		           detected with its size.])
	fi
	if test $ac_cv_type_long_long != no; then
		AC_CHECK_SIZEOF(long long)
		AC_CACHE_CHECK(for uniquely sized long long,
			ccvs_cv_unique_int_type_long_long,
			[if set |grep ^ccvs_cv_unique_int_type_ \
				|grep "($ac_cv_sizeof_long_long)" >/dev/null ; then
				ccvs_cv_unique_int_type_long_long=no
			else
				ccvs_cv_unique_int_type_long_long=yes\($ac_cv_sizeof_long_long\)
			fi])
		if test $ccvs_cv_unique_int_type_long_long != no ; then
			AC_DEFINE(UNIQUE_INT_TYPE_LONG_LONG, 1,
				  [Define if long long is the first integer type
				   detected with its size.])
		fi
	fi
	AC_CHECK_SIZEOF(size_t)
	AC_CACHE_CHECK(for uniquely sized size_t,
		ccvs_cv_unique_int_type_size_t,
		[if set |grep ^ccvs_cv_unique_int_type_ \
			|grep "($ac_cv_sizeof_size_t)" >/dev/null ; then
			ccvs_cv_unique_int_type_size_t=no
		else
			ccvs_cv_unique_int_type_size_t=yes\($ac_cv_sizeof_size_t\)
		fi])
	if test $ccvs_cv_unique_int_type_size_t != no ; then
		AC_DEFINE(UNIQUE_INT_TYPE_SIZE_T, 1,
                          [Define if size_t is the first integer type
		           detected with its size.])
	fi
	AC_CHECK_SIZEOF(ptrdiff_t)
	AC_CACHE_CHECK(for uniquely sized ptrdiff_t,
		ccvs_cv_unique_int_type_ptrdiff_t,
		[if set |grep ^ccvs_cv_unique_int_type_ \
			|grep "($ac_cv_sizeof_ptrdiff_t)" >/dev/null ; then
			ccvs_cv_unique_int_type_ptrdiff_t=no
		else
			ccvs_cv_unique_int_type_ptrdiff_t=yes\($ac_cv_sizeof_ptrdiff_t\)
		fi])
	if test $ccvs_cv_unique_int_type_ptrdiff_t != no ; then
		AC_DEFINE(UNIQUE_INT_TYPE_PTRDIFF_T, 1,
                          [Define if ptrdiff_t is the first integer type
		           detected with its size.])
	fi
	if test $gt_cv_c_wint_t != no; then
		AC_CHECK_SIZEOF(wint_t, [], [[#include <stdio.h>
#include <wchar.h>
]])
		AC_CACHE_CHECK(for uniquely sized wint_t,
			ccvs_cv_unique_int_type_wint_t,
			[if set |grep ^ccvs_cv_unique_int_type_ \
				|grep "($ac_cv_sizeof_wint_t)" >/dev/null ; then
				ccvs_cv_unique_int_type_wint_t=no
			else
				ccvs_cv_unique_int_type_wint_t=yes\($ac_cv_sizeof_wint_t\)
			fi])
		if test $ccvs_cv_unique_int_type_wint_t != no ; then
			AC_DEFINE( UNIQUE_INT_TYPE_WINT_T, 1,
				   [Define if wint_t is the first integer type
				    detected with its size.])
		fi
	fi
	if test $gt_cv_c_intmax_t != no; then
		AC_CHECK_SIZEOF(intmax_t, [], [[#include <stdio.h>
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#else
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#endif
]])
		AC_CACHE_CHECK(for uniquely sized intmax_t,
			ccvs_cv_unique_int_type_intmax_t,
			[if set |grep ^ccvs_cv_unique_int_type_ \
				|grep "($ac_cv_sizeof_intmax_t)" >/dev/null ; then
				ccvs_cv_unique_int_type_intmax_t=no
			else
				ccvs_cv_unique_int_type_intmax_t=yes\($ac_cv_sizeof_intmax_t\)
			fi])
		if test $ccvs_cv_unique_int_type_intmax_t != no ; then
			AC_DEFINE( UNIQUE_INT_TYPE_INTMAX_T, 1,
                        	   [Define if intmax_t is the first integer type
			            detected with its size.])
		fi
	fi

	dnl
	dnl and the same for floats...
	dnl
	AC_CHECK_SIZEOF(float)
	AC_CACHE_CHECK(for uniquely sized float,
		ccvs_cv_unique_float_type_float,
		[if set |grep ^ccvs_cv_unique_float_type_ \
			|grep "($ac_cv_sizeof_float)" >/dev/null ; then
			ccvs_cv_unique_float_type_float=no
		else
			ccvs_cv_unique_float_type_float=yes\($ac_cv_sizeof_float\)
		fi])
	if test $ccvs_cv_unique_float_type_float != no ; then
		AC_DEFINE( UNIQUE_FLOAT_TYPE_FLOAT, 1,
                           [Define if float is the first floating point type
		            detected with its size.])
	fi
	AC_CHECK_SIZEOF(double)
	AC_CACHE_CHECK(for uniquely sized double,
		ccvs_cv_unique_float_type_double,
		[if set |grep ^ccvs_cv_unique_float_type_ \
			|grep "($ac_cv_sizeof_double)" >/dev/null ; then
			ccvs_cv_unique_float_type_double=no
		else
			ccvs_cv_unique_float_type_double=yes\($ac_cv_sizeof_double\)
		fi])
	if test $ccvs_cv_unique_float_type_double != no ; then
		AC_DEFINE( UNIQUE_FLOAT_TYPE_DOUBLE, 1,
                           [Define if double is the first floating point type
		            detected with its size.])
	fi
	if test $gt_cv_c_long_double != no; then
		AC_CHECK_SIZEOF(long double)
		AC_CACHE_CHECK(for uniquely sized long double,
			ccvs_cv_unique_float_type_long_double,
			[if set |grep ^ccvs_cv_unique_float_type_ \
				|grep "($ac_cv_sizeof_long_double)" >/dev/null ; then
				ccvs_cv_unique_float_type_long_double=no
			else
				ccvs_cv_unique_float_type_long_double=yes\($ac_cv_sizeof_long_double\)
			fi])
		if test $ccvs_cv_unique_float_type_long_double != no ; then
			AC_DEFINE(UNIQUE_FLOAT_TYPE_LONG_DOUBLE, 1,
				  [Define if long double is the first floating point
				   type detected with its size.])
		fi
	fi
fi

dnl
dnl The CVS coding standard (as specified in HACKING) is that if it exists
dnl in SunOS4 and ANSI, we use it.  CVS itself, of course, therefore doesn't
dnl need HAVE_* defines for such functions, but diff wants them.
dnl
AC_DEFINE(HAVE_STRCHR, 1,
[Define if you have strchr (always for CVS).])
AC_DEFINE(HAVE_MEMCHR, 1,
[Define if you have memchr (always for CVS).])

dnl
dnl Force lib/regex.c to use malloc instead of messing around with alloca
dnl and define the old re_comp routines that we use.
dnl
AC_DEFINE(REGEX_MALLOC, 1,
[Define to force lib/regex.c to use malloc instead of alloca.])
AC_DEFINE(_REGEX_RE_COMP, 1,
[Define to force lib/regex.c to define re_comp et al.])
dnl
dnl AC_FUNC_FORK([]) is rather baroque.  It seems to be rather more picky
dnl than, say, the Single Unix Specification (version 2), which simplifies
dnl a lot of cases by saying that the child process can't set any variables
dnl (thus avoiding problems with register allocation) or call any functions
dnl (thus avoiding problems with whether file descriptors are shared).
dnl It would be nice if we could just write to the Single Unix Specification.
dnl I think the only way to do redirection this way is by doing it in the
dnl parent, and then undoing it afterwards (analogous to windows-NT/run.c).
dnl That would appear to have a race condition if the user hits ^C (or
dnl some other signal) at the wrong time, as main_cleanup will try to use
dnl stdout/stderr.  So maybe we are stuck with AC_FUNC_FORK([]).
dnl
AC_FUNC_FORK([])
AC_FUNC_CLOSEDIR_VOID

dnl
dnl Check for shadow password support.
dnl
dnl We used to try to determine whether shadow passwords were actually in
dnl use or not, but the code has been changed to work right reguardless,
dnl so we can go back to a simple check.
AC_SEARCH_LIBS(getspnam, sec gen, AC_DEFINE(HAVE_GETSPNAM, 1,
[Define if you have the getspnam function.]))

AC_FUNC_UTIME_NULL
AC_SYS_LONG_FILE_NAMES

dnl for debugging code
CVS_FUNC_PRINTF_PTR

# Try to find connect and gethostbyname.
AC_CHECK_LIB(nsl, main)
AC_SEARCH_LIBS(connect, xnet socket inet,
  AC_DEFINE(HAVE_CONNECT, 1,
[Define if you have the connect function.]))
dnl no need to search nsl for gethostbyname here since we should have
dnl just added libnsl above if we found it.
AC_SEARCH_LIBS(gethostbyname, netinet)

AC_SUBST(cvs_client_objects)


dnl
dnl begin --with-*
dnl

dnl
dnl set $(KRB4) from --with-krb4=value -- WITH_KRB4
dnl
dnl If you change this, keep in mind that some systems have a bogus
dnl libkrb in the system libraries, so --with-krb4=value needs to
dnl override the system -lkrb.
dnl
KRB4=/usr/kerberos
define(WITH_KRB4,[
AC_ARG_WITH(
  [krb4],
  AC_HELP_STRING(
    [--with-krb4],
    [Kerberos 4 directory (default /usr/kerberos)]),
  [KRB4=$with_krb4],
)dnl
AC_MSG_CHECKING([for KRB4 in $KRB4])
AC_MSG_RESULT([])
AC_SUBST(KRB4)])dnl
WITH_KRB4

krb_h=
AC_MSG_CHECKING([for krb.h])
if test "$cross_compiling" != yes && test -r $KRB4/include/krb.h; then
   hold_cflags=$CFLAGS
   CFLAGS="$CFLAGS -I$KRB4/include"
   AC_TRY_LINK([#include <krb.h>],[int i;],
          [krb_h=yes krb_incdir=$KRB4/include],
          [CFLAGS=$hold_cflags
           AC_TRY_LINK([#include <krb.h>],[int i;],
             [krb_h=yes krb_incdir=])])
   CFLAGS=$hold_cflags
else
   AC_TRY_LINK([#include <krb.h>],[int i;],
             [krb_h=yes krb_incdir=])
fi
if test -z "$krb_h"; then
  AC_TRY_LINK([#include <krb.h>],[int i;],
    [krb_h=yes krb_incdir=],
    [if test "$cross_compiling" != yes && test -r $KRB4/include/kerberosIV/krb.h; then
       hold_cflags=$CFLAGS
       CFLAGS="$CFLAGS -I$KRB4/include/kerberosIV"
       AC_TRY_LINK([#include <krb.h>],[int i;],
	 [krb_h=yes krb_incdir=$KRB4/include/kerberosIV])
       CFLAGS=$hold_cflags
     fi])
fi
AC_MSG_RESULT($krb_h)

if test -n "$krb_h"; then
  krb_lib=
  if test "$cross_compiling" != yes && test -r $KRB4/lib/libkrb.a; then
       hold_ldflags=$LDFLAGS
       LDFLAGS="-L${KRB4}/lib $LDFLAGS"
       AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=${KRB4}/lib],
           [LDFLAGS=$hold_ldflags
            # Using open here instead of printf so we don't
            # get confused by the cached value for printf from above.
            AC_CHECK_LIB(krb,open,[krb_lib=yes krb_libdir=])])
       LDFLAGS=$hold_ldflags
  else
       AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=])
       AC_CHECK_FUNC(krb_recvauth,[krb_lib=yes krb_libdir=])
  fi
  if test -n "$krb_lib"; then
    AC_DEFINE([HAVE_KERBEROS], 1,
	      [Define if you have MIT Kerberos version 4 available.])
    cvs_client_objects="$cvs_client_objects kerberos4-client.o"
    test -n "${krb_libdir}" && LIBS="${LIBS} -L${krb_libdir}"
    # Put -L${krb_libdir} in LDFLAGS temporarily so that it appears before
    # -ldes in the command line.  Don't do it permanently so that we honor
    # the user's setting for LDFLAGS
    hold_ldflags=$LDFLAGS
    test -n "${krb_libdir}" && LDFLAGS="$LDFLAGS -L${krb_libdir}"
    AC_CHECK_LIB(des,printf,[LIBS="${LIBS} -ldes"])
    AC_CHECK_LIB(krb,krb_recvauth)
    AC_CHECK_LIB(krb4,krb_recvauth)
    LDFLAGS=$hold_ldflags
    if test -n "$krb_incdir"; then
      CPPFLAGS="$CPPFLAGS -I$krb_incdir"
    fi
  fi
fi
AC_CHECK_FUNCS(krb_get_err_text)


dnl
dnl WITH_GSSAPI is external
dnl
dnl TODO - I tried to put these in alphabetical order, but ACX_WITH_GSSAPI
dnl fails unless called after the KRB4 stuff.  I don't know why.
dnl
ACX_WITH_GSSAPI

dnl
dnl WITH_EXTERNAL_ZLIB is external
dnl
ACX_WITH_EXTERNAL_ZLIB

dnl
dnl begin --with-rsh
dnl
dnl Many sites no longer desire the use of "rsh" as the default
dnl remote shell program. They typically favor "ssh" as the default

# What remote shell transport should our client cvs default to using?
AC_ARG_WITH(
  [rsh],
  AC_HELP_STRING(
    [--with-rsh],
    [The default remote shell CVS will use for :ext: transport
     (default ssh)]), ,
  [with_rsh="ssh rsh"])

if test no = "$with_rsh"; then
  AC_MSG_WARN([Failed to find usable remote shell. Using 'rsh'.])
  with_rsh=rsh
elif test yes = "$with_rsh"; then
  # Make --with-rsh mean the same thing as --with-rsh=rsh
  with_rsh=rsh
fi

if echo $with_rsh |grep ^/ >/dev/null; then
  # If $with_rsh is an absolute path, issue a warning if the executable
  # doesn't exist or isn't usable, but then trust the user and use it
  # regardless
  with_default_rsh=$with_rsh
  AC_MSG_CHECKING([for a remote shell])
  if ! test -f $with_rsh \
      || ! test -x $with_rsh; then
    # warn the user that they may encounter problems
    AC_MSG_WARN([$with_rsh is not a path to an executable file])
  fi
else
  # Search for a remote shell
  AC_CHECK_PROGS([with_default_rsh], [$with_rsh], "rsh")
fi

AC_DEFINE_UNQUOTED(
  [RSH_DFLT], ["$with_default_rsh"],
  [The default remote shell to use, if one does not specify the
   CVS_RSH environment variable.])
RSH_DFLT=$with_default_rsh
AC_SUBST(RSH_DFLT)
dnl done with finding a default CVS_RSH value
dnl
dnl end --with-rsh
dnl

dnl
dnl begin --with-editor
dnl
dnl Set the default editor to use for log messages
dnl

AC_ARG_VAR(
  [EDITOR],
  [The text editor CVS will use by default for log messages.])

# Let the confiscator request a specific editor
AC_ARG_WITH(
  [editor],
  AC_HELP_STRING(
    [--with-editor],
    [The default text editor CVS should use for log messages
     (default autoselects)]), ,
  [with_editor=yes])

# If --with-editor was supplied with an argument, let it override $EDITOR from
# the user's environment.  We need to unset EDITOR here because AC_CHECK_PROGS
# will let the value of EDITOR ride when it is set rather than searching.  We
# ignore the --without-editor case since it will be caught below.
if test -n "$EDITOR" && test yes != $with_editor; then
  AS_UNSET([EDITOR])
fi

# Set the default when --with-editor wasn't supplied or when it was supplied
# without an argument.
if test yes = $with_editor; then
  with_editor="vim vi emacs nano pico edit"
fi

if echo $with_editor |grep ^/ >/dev/null; then
  # If $with_editor is an absolute path, issue a warning if the executable
  # doesn't exist or isn't usable, but then trust the user and use it
  # regardless
  EDITOR=$with_editor
  AC_MSG_CHECKING([for an editor])
  AC_MSG_RESULT([$EDITOR])
  if ! test -f $with_editor \
      || ! test -x $with_editor; then
    # warn the user that they may encounter problems
    AC_MSG_WARN([\`$with_editor' is not a path to an executable file])
  fi
elif test no != "${with_editor}"; then
  # Search for an editor
  AC_CHECK_PROGS([EDITOR], [$with_editor], [no])
    if test no = "${EDITOR}"; then
      AC_MSG_ERROR([
    Failed to find a text file editor.  CVS cannot be compiled
    without a default log message editor.  Searched for
    \`$with_editor'.  Try \`configure --with-editor'.])
    fi
else
  AC_MSG_ERROR([
    CVS cannot be compiled without a default log message editor.
    Try \`configure --with-editor'.])
fi

dnl FIXME - Using --without-editor will probably break a compile at
dnl the moment, but maybe it is reasonable for someone to want to
dnl compile a CVS executable that refuses to run if no $EDITOR,
dnl $CVS_EDITOR, or -e option is specified?  Making a preliminary
dnl design decision in this direction, subject to discussion.
dnl
dnl Still don't know if the above would be useful, but we shouldn't
dnl be able to get here any longer without $EDITOR defined due to the
dnl error checking above.
AC_DEFINE_UNQUOTED(
  [EDITOR_DFLT], ["$EDITOR"],
  [The default editor to use, if one does not specify the "-e" option
   to cvs, or does not have an EDITOR environment variable.  If this
   is not set to an absolute path to an executable, use the shell to
   find where the editor actually is.  This allows sites with
   /usr/bin/vi or /usr/ucb/vi to work equally well (assuming that their
   PATH is reasonable).])

dnl
dnl done finding an editor
dnl
dnl end --with-editor
dnl



dnl
dnl --with-hardcoded-pam-service-name
dnl
AC_ARG_WITH(
  [hardcoded-pam-service-name],
  AC_HELP_STRING(
    [--with-hardcoded-pam-service-name],
    [Use this to hard code a service name for PAM CVS authentication.  The
     special name, `program_name', will cause CVS to use whatever name it
     was invoked as as the service name.  (defaults to `cvs')]),,
    [with_hardcoded_pam_service_name=cvs])

if test "x$with_hardcoded_pam_service_name" = xno ||
   test "x$with_hardcoded_pam_service_name" = xprogram_name; then
  AC_DEFINE([PAM_SERVICE_NAME], [program_name],
    [Define to set a service name for PAM.  This must be defined.  Define to
     `program_name', without the quotes, to use whatever name CVS was invoked
      as.  Otherwise, define to a double-quoted literal string, such as
      `"cvs"'.])
else
  if test x"$with_hardcoded_pam_service_name" = xyes; then
    with_hardcoded_pam_service_name=cvs
  fi
  AC_DEFINE_UNQUOTED([PAM_SERVICE_NAME], ["$with_hardcoded_pam_service_name"])
fi



dnl
dnl Find a temporary directory
dnl
AC_ARG_WITH(
  [tmpdir],
  AC_HELP_STRING(
    [--with-tmpdir],
    [The temporary directory CVS should use as a default
     (default autoselects)]))

AC_MSG_CHECKING([for temporary directory])
if test -z "$with_tmpdir" || test yes = "$with_tmpdir"; then
  for with_tmpdir in /tmp /var/tmp no; do
    if test -d "$with_tmpdir" && test -x "$with_tmpdir" \
        && test -w "$with_tmpdir" && test -r "$with_tmpdir"; then
      break
    fi
  done
  if test no = "$with_tmpdir"; then
    AC_MSG_WARN([Failed to find usable temporary directory.  Using '/tmp'.])
    with_tmpdir=/tmp
  fi
  AC_MSG_RESULT([$with_tmpdir])
elif ! echo "$with_tmpdir" |grep '^[[\\/]]'; then
  AC_MSG_RESULT([$with_tmpdir])
  AC_MSG_ERROR([--with-tmpdir requires an absolute path.])
elif ! test -d "$with_tmpdir" || ! test -x "$with_tmpdir" \
        || ! test -w "$with_tmpdir" || ! test -r "$with_tmpdir"; then
  AC_MSG_RESULT([$with_tmpdir])
  AC_MSG_WARN(
    [User supplied temporary directory ('$with_tmpdir') does not
     exist or lacks sufficient permissions for read/write.])
fi

AC_DEFINE_UNQUOTED(
  [TMPDIR_DFLT], ["$with_tmpdir"],
  [Directory used for storing temporary files, if not overridden by
   environment variables or the -T global option.  There should be little
   need to change this (-T is a better mechanism if you need to use a
   different directory for temporary files).])

dnl
dnl done finding tmpdir
dnl


dnl
dnl Get default umask
dnl

AC_ARG_WITH(
  [umask],
  AC_HELP_STRING(
    [--with-umask],
    [Set the umask CVS will use by default in the repository (default 002)]))

if test -z "$with_umask" || test yes = "$with_umask"; then
  with_umask=002
elif test no = "$with_umask"; then
  with_umask=000
fi

AC_DEFINE_UNQUOTED(
  [UMASK_DFLT], [$with_umask],
  [The default umask to use when creating or otherwise setting file or
   directory permissions in the repository.  Must be a value in the
   range of 0 through 0777.  For example, a value of 002 allows group
   rwx access and world rx access; a value of 007 allows group rwx
   access but no world access.  This value is overridden by the value
   of the CVSUMASK environment variable, which is interpreted as an
   octal number.])

dnl
dnl Done setting default umask
dnl

dnl
dnl Set CVS Administrator Group
dnl
AC_ARG_WITH(
  [cvs-admin-group],
  AC_HELP_STRING(
    [--with-cvs-admin-group=GROUP],
    [The CVS admin command is restricted to the members of this group.
     If this group does not exist, all users are allowed to run CVS admin.
     To disable the CVS admin command for all users, create an empty group
     by specifying the --with-cvs-admin-group= option.  To disable access
     control for CVS admin, run configure with the --without-cvs-admin-group
     option. (default 'cvsadmin')]), ,
  [with_cvs_admin_group=cvsadmin])

if test yes = "$with_cvs_admin_group"; then
  with_cvs_admin_group=cvsadmin
fi
if test no != "$with_cvs_admin_group"; then
  dnl FIXME We should warn if the group doesn't exist
  AC_DEFINE_UNQUOTED(
    [CVS_ADMIN_GROUP], ["$with_cvs_admin_group"],
    [The CVS admin command is restricted to the members of the group
     CVS_ADMIN_GROUP.  If this group does not exist, all users are
     allowed to run CVS admin.  To disable the CVS admin command for
     all users, create an empty CVS_ADMIN_GROUP by running configure
     with the --with-cvs-admin-group= option.  To disable access control
     for CVS admin, run configure with the --without-cvs-admin-group
     option in order to comment out the define below.])
fi

dnl
dnl Done setting CVS Administrator Group
dnl

dnl
dnl Set the NDBM library to use.
dnl
dnl XXX - FIXME - FIXME - FIXME - XXX
dnl
dnl This is very bad.  It should really autodetect an appropriate NDBM library
dnl and, if it doesn't find one, decide to use MY_NDBM.  I'm am defining
dnl this here since this is no worse than it worked when it was in options.h
dnl and I am cleaning out options.h so that the Windows version of CVS will
dnl compile properly for the next release.
dnl
dnl That's why this option is in the --with-* section rather than the
dnl --enable-* section.
dnl
dnl XXX - FIXME - FIXME - FIXME - XXX
dnl
AC_ARG_ENABLE(
  [cvs-ndbm],
  AC_HELP_STRING(
    [--enable-cvs-ndbm],
    [Use the NDBM library distributed with CVS rather than attempting to use
     a system NDBM library.  Disabling this may not work.  (default)]), ,
  [enable_cvs_ndbm=yes])
if test no != "$enable_cvs_ndbm"; then
  AC_DEFINE(
    [MY_NDBM], [1],
    [By default, CVS stores its modules and other such items in flat
     text files (MY_NDBM enables this).  Turning off MY_NDBM causes CVS
     to look for a system-supplied ndbm database library and use it
     instead.  That may speed things up, but the default setting
     generally works fine too.])
fi

dnl
dnl Done selecting NDBM library.
dnl



dnl
dnl end --with-*
dnl


dnl
dnl begin --enables
dnl


dnl
dnl begin --enable-client
dnl

# Check for options requesting client and server feature. If none are
# given and we have connect(), we want the full client & server arrangement.
AC_ARG_ENABLE(
  [client],
  AC_HELP_STRING(
    [--enable-client],
    [Include code for running as a remote client (default)]), ,
  [enable_client=$ac_cv_search_connect])
if test no != "$enable_client"; then
  AC_DEFINE(
    [CLIENT_SUPPORT], [1],
    [Define if you want CVS to be able to be a remote repository client.])
fi

dnl
dnl end --enable-client
dnl


dnl
dnl begin --enable-password-authenticated-client
dnl
AC_ARG_ENABLE(
  [password-authenticated-client],
  AC_HELP_STRING(
    [--enable-password-authenticated-client],
    [Enable pserver as a remote access method in the CVS client
     (default)]), ,
  [enable_password_authenticated_client=$enable_client])

if test xno != "x$enable_password_authenticated_client"; then
  if test xno != "x$enable_client"; then
    AC_DEFINE(
      [AUTH_CLIENT_SUPPORT], [1],
      [Enable AUTH_CLIENT_SUPPORT to enable pserver as a remote access
       method in the CVS client (default)])
  else
    AC_MSG_WARN(
      [--enable-password-authenticated-client is meaningless with
       the CVS client disabled (--disable-client)])
  fi
fi

dnl
dnl begin --enable-password-authenticated-client
dnl


dnl
dnl begin --enable-server
dnl

dnl
dnl Give the confiscator control over whether the server code is compiled
dnl
AC_ARG_ENABLE(
  [server],
  AC_HELP_STRING(
    [--enable-server],
    [Include code for running as a server (default)]), ,
  [enable_server=$ac_cv_search_connect])

if test no != "$enable_server"; then
  AC_DEFINE(
    [SERVER_SUPPORT], [1],
    [Define if you want CVS to be able to serve repositories to remote
     clients.])

  dnl
  dnl The auth server needs to be able to check passwords against passwd
  dnl file entries, so we only #define AUTH_SERVER_SUPPORT if we can
  dnl find the crypt function. 
  dnl
  AC_SEARCH_LIBS(
    [crypt], [crypt],
    [AC_DEFINE(
       [HAVE_CRYPT], [1],
       [Define if you have the crypt function.])
     AC_DEFINE(
       [AUTH_SERVER_SUPPORT], [1],
       [Define if you want to use the password authenticated server.])dnl
  ])dnl AC_SEARCH_LIBS

  dnl
  dnl Allow the configurer to enable server flowcontrol.  Read the help
  dnl strings below for a full explanation.
  dnl
  AC_ARG_ENABLE(
    [server-flow-control],
    AC_HELP_STRING(
      [--enable-server-flow-control],
      [If you are working with a large remote repository and a 'cvs
       checkout' is swamping your network and memory, define these to
       enable flow control.  You may optionally pass a low water mark
       in bytes and a high water mark in bytes, separated by commas.
       (default is enabled 1M,2M)]),
    [if test yes = $enable_server_flow_control; then
       enable_server_flow_control=1M,2M
     fi],
    [enable_server_flow_control=1M,2M])
  if test no != $enable_server_flow_control; then
    ccvs_lwm=`expr "$enable_server_flow_control" : '\(.*\),'`
    ccvs_hwm=`expr "$enable_server_flow_control" : '.*,\(.*\)'`
    ccvs_lwm_E=`expr "$ccvs_lwm" : '[[0-9]][[0-9]]*\(.*\)'`
    ccvs_lwm=`expr "$ccvs_lwm" : '\([[0-9]][[0-9]]*\)'`
    test "" != "$ccvs_lwm" || ccvs_lwm_E="?"
    case $ccvs_lwm_E in
        G) ccvs_lwm="$ccvs_lwm * 1024 * 1024 * 1024";;
        M) ccvs_lwm="$ccvs_lwm * 1024 * 1024";;
        k) ccvs_lwm="$ccvs_lwm * 1024";;
        b | '') ;;
        *) AC_MSG_ERROR([Can't parse argument to --enable-server-flow-control
                        ('$enable_server_flow_control') as <lwm>,<hwm>])
      esac
    ccvs_hwm_E=`expr "$ccvs_hwm" : '[[0-9]][[0-9]]*\(.*\)'`
    ccvs_hwm=`expr "$ccvs_hwm" : '\([[0-9]][[0-9]]*\).*'`
    test "" != "$ccvs_hwm" || ccvs_hwm_E="?"
    case $ccvs_hwm_E in
        G) ccvs_hwm="$ccvs_hwm * 1024 * 1024 * 1024";;
        M) ccvs_hwm="$ccvs_hwm * 1024 * 1024";;
        k) ccvs_hwm="$ccvs_hwm * 1024";;
        b | '') ccvs_hwm="$ccvs_hwm";;
        *) AC_MSG_ERROR([Can't parse argument to --enable-server-flow-control
                        ('$enable_server_flow_control') as <lwm>,<hwm>])
      esac

    AC_DEFINE(
      [SERVER_FLOWCONTROL], [1],
      [If you are working with a large remote repository and a 'cvs
       checkout' is swamping your network and memory, define these to
       enable flow control.  You will end up with even less probability of
       a consistent checkout (see Concurrency in cvs.texinfo), but CVS
       doesn't try to guarantee that anyway.  The master server process
       will monitor how far it is getting behind, if it reaches the high
       water mark, it will signal the child process to stop generating
       data when convenient (ie: no locks are held, currently at the
       beginning of a new directory).  Once the buffer has drained
       sufficiently to reach the low water mark, it will be signalled to
       start again.])
    AC_DEFINE_UNQUOTED(
      [SERVER_LO_WATER], [($ccvs_lwm)],
      [The low water mark in bytes for server flow control.  Required if
       SERVER_FLOWCONTROL is defined, and useless otherwise.])
    AC_DEFINE_UNQUOTED(
      [SERVER_HI_WATER], [($ccvs_hwm)],
      [The high water mark in bytes for server flow control.  Required if
       SERVER_FLOWCONTROL is defined, and useless otherwise.])
  fi # enable_server_flow_control
fi # enable_server

dnl
dnl end --enable-server
dnl


dnl
dnl begin --enable-proxy
dnl

dnl
dnl Give the confiscator control over whether the proxy server code is compiled
dnl
AC_ARG_ENABLE(
  [proxy],
  AC_HELP_STRING(
    [--enable-proxy],
    [Include code for running as a transparent proxy server.  Disabling this
     may produce a slight performance gain on some systems, at the expense of
     write proxy support. (default)]), ,
  [if test xno != "x$enable_client" && test xno != "x$enable_server"; then
     enable_proxy=yes
   else
     enable_proxy=no
   fi])

if test no != "$enable_proxy"; then
  if test xno = "x$enable_client" || test xno = "x$enable_server"; then
    AC_MSG_WARN(
      [--enable-proxy is meaningless when either the CVS client or the
       CVS server is disabled (--disable-client and --disable-server).])
  else
    AC_DEFINE(
      [PROXY_SUPPORT], [1],
      [Define if you want CVS to be able to serve as a transparent proxy for
       write operations.  Disabling this may produce a slight performance gain
       on some systems, at the expense of write proxy support.])
  fi
fi
dnl
dnl end --enable-proxy
dnl


dnl
dnl begin --enable-pam
dnl

dnl
dnl Check if PAM authentication is enabled
dnl
AC_ARG_ENABLE(
  [pam],
  AC_HELP_STRING(
    [--enable-pam],
    [Use to enable system authentication with PAM instead of using the 
    simple getpwnam interface.  This allows authentication (in theory) 
    with any PAM module, e.g. on systems with shadow passwords or via LDAP]), ,
  [enable_pam=no]
  )

if test yes = $enable_pam; then
  ac_pam_header_available=

  AC_CHECK_HEADER([security/pam_appl.h], [
    AC_DEFINE([HAVE_SECURITY_PAM_APPL_H], 1, [Define to 1 if security/pam_appl.h is available])
    ac_pam_header_available=1])

  if test -z "$ac_pam_header_available"; then
  AC_CHECK_HEADER([pam/pam_appl.h], [
    AC_DEFINE([HAVE_PAM_PAM_APPL_H], 1, [Define to 1 if pam/pam_appl.h is available])
    ac_pam_header_available=1])
  fi

  if test -z "$ac_pam_header_available"; then
    AC_MSG_ERROR([Could not find PAM headers])
  else
    AC_DEFINE(HAVE_PAM, 1, 
    [Define to enable system authentication with PAM instead of using the 
    simple getpwnam interface.  This allows authentication (in theory) 
    with any PAM module, e.g. on systems with shadow passwords or via LDAP])
    AC_CHECK_LIB(pam, pam_start, [LIBS="${LIBS} -lpam"],
      AC_MSG_ERROR([Could not find PAM libraries but the headers exist.
      Give the --disable-pam option to compile without PAM support (or fix
      your broken configuration)])
    )
  fi
fi

dnl
dnl end --enable-pam
dnl


dnl
dnl begin --enable-case-sensitivity
dnl

AC_ARG_ENABLE(
  [case-sensitivity],
  AC_HELP_STRING(
    [--enable-case-sensitivity],
    [Force CVS to expect a case sensitive file system.  Enabling this on a case
     insensitive system should have little effect on the server or client
     operation, though client users may ocassionally be suprised that the CVS
     server appears to be case sensitive.  Disabling this for a case sensitive
     server disables server support for case insensitive clients, which can
     confuse all users of case insensitive clients contacting the server.
     Disabling this for a case sensitive client will cause the client to ask
     servers to behave case insensitively, which could cause confusion for
     users, but also probably no real harm.  (default autoselects based on the
     case sensitivity of the file system containing the current working
     directory)]),
    [case "$enable_case_sensitivity" in
       yes | no | auto) ;;
       *)
          AC_MSG_ERROR([Unrecognized argument to --enable-case-sensitivity: \`$enable_case_sensitivity'.  Acceptable values are \`yes', \`no', and \`auto'.])
          ;;
     esac],
  [enable_case_sensitivity=auto])

acx_forced=' (forced)'
AC_MSG_CHECKING([for a case sensitive file system])
if test $enable_case_sensitivity = auto; then
  dnl
  dnl Check for a case insensitive filesystem, like Mac OS X and Windows have.
  dnl
  AC_CACHE_VAL([acx_cv_case_sensitive],
  [ rm -f ac_TEST_filenames_CASE_sensitive
    echo foo >ac_test_filenames_case_sensitive
    if test -f ac_TEST_filenames_CASE_sensitive; then
      acx_cv_case_sensitive=no
    else
      acx_cv_case_sensitive=yes
    fi
    rm ac_test_filenames_case_sensitive
  ])
  enable_case_sensitivity=$acx_cv_case_sensitive
  acx_forced=
fi
AC_MSG_RESULT([$enable_case_sensitivity$acx_forced])
if test $enable_case_sensitivity = no; then
  AC_DEFINE([FILENAMES_CASE_INSENSITIVE], [1],
            [Define if this executable will be running on case insensitive
             file systems.  In the client case, this means that it will request
             that the server pretend to be case insensitive if it isn't
             already.])
  dnl Compile fncase.c (containing fncase() & fncmp()) to handle file name
  dnl comparisons on case insensitive filesystems.
  AC_LIBOBJ(fncase)
fi

dnl
dnl end --enable-case-sensitivity
dnl


dnl
dnl begin --enable-encryption
dnl

dnl
dnl Use --enable-encryption to turn on encryption support, but ignore this
dnl option unless either client or server is enabled.
dnl
AC_ARG_ENABLE(
  [encryption],
  AC_HELP_STRING(
    [--enable-encryption],
    [Enable encryption support (disabled by default)]), ,
  [enable_encryption=no])
if test "x$enable_encryption" = xyes; then
  if test xno = "x$with_client" && test xno = "x$with_server"; then
    AC_MSG_WARN(
      [--enable-encryption is meaningless when neither the CVS client
       nor the CVS server is enabled (--disable-client and --disable-server).])
  else
    AC_DEFINE(
      [ENCRYPTION], [1],
      [Define to enable encryption support.])
  fi
fi

dnl
dnl end --enable-encryption
dnl


dnl
dnl begin --enable-force-editor
dnl

AC_ARG_ENABLE(
  [force-editor],
  AC_HELP_STRING(
    [--enable-force-editor],
    [When committing or importing files, you must enter a log message.
     Normally, you can do this either via the -m flag on the command
     line, the -F flag on the command line, or an editor will be started
     for you.  If you like to use logging templates (the rcsinfo file
     within the $CVSROOT/CVSROOT directory), you might want to force
     people to use the editor even if they specify a message with -m or
     -F.  --enable-force-editor will cause the -m or -F message to be
     appended to the temp file when the editor is started. (disabled
     by default)]), ,
  [enable_force_editor=no])

if test yes = "$enable_force_editor"; then
  AC_DEFINE(
    [FORCE_USE_EDITOR], [1],
    [When committing or importing files, you must enter a log message.
    Normally, you can do this either via the -m flag on the command
    line, the -F flag on the command line, or an editor will be started
    for you.  If you like to use logging templates (the rcsinfo file
    within the $CVSROOT/CVSROOT directory), you might want to force
    people to use the editor even if they specify a message with -m or
    -F.  Enabling FORCE_USE_EDITOR will cause the -m or -F message to be
    appended to the temp file when the editor is started.])
fi

dnl
dnl end --enable-force-editor
dnl


dnl
dnl begin --enable-lock-compatibility
dnl

# Check for options requesting client and server feature. If none are
# given and we have connect(), we want the full client & server arrangement.
AC_ARG_ENABLE(
  [lock-compatibility],
  AC_HELP_STRING(
    [--enable-lock-compatibility],
    [Include locking code which prevents versions of CVS earlier than 1.12.4
     directly accessing the same repositiory as this executable from ignoring
     this executable's promotable read locks.  If only CVS versions 1.12.4 and
     later will be accessing your repository directly (as a server or locally),
     you can safely disable this option in return for fewer disk accesses and a
     small speed increase.  Disabling this option when versions of CVS earlier
     than 1,12,4 _will_ be accessing your repository, however, is *VERY* *VERY*
     *VERY* dangerous and could result in data loss.  (enabled by default)]),,
  [enable_lock_compatibility=yes])

if test x$enable_lock_compatibility = xyes; then
  AC_DEFINE([LOCK_COMPATIBILITY], [1],
    [Define to include locking code which prevents versions of CVS earlier than
     1.12.4 directly accessing the same repositiory as this executable from
     ignoring this executable's promotable read locks.  If only CVS versions
     1.12.4 and later will be accessing your repository directly (as a server
     or locally), you can safely disable this option in return for fewer disk
     accesses and a small speed increase.  Disabling this option when versions
     of CVS earlier than 1,12,4 _will_ be accessing your repository, however,
     is *VERY* *VERY* *VERY* dangerous and could result in data loss.

     As such, by default, CVS is compiled with this code enabled.  If you are
     sure you would like this code disabled, you can disable it by passing the
     "--disable-lock-compatibility" option to configure or by commenting out
     the lines below.])
fi

dnl
dnl end --enable-lock-compatibility
dnl


dnl
dnl begin --enable-rootcommit
dnl

dnl
dnl I don't like this here, but I don't really like options.h, either.
dnl Besides, this is causing some problems currently when compiling under
dnl Windows and moving it here should avoid the issue (the wrong options.h
dnl is being used).
dnl
dnl I don't like making this a runtime option either.  I think I just don't
dnl like making it easy to get to, but putting it here goes along with the
dnl Autoconf ideal.
dnl
AC_ARG_ENABLE(
  [rootcommit],
  AC_HELP_STRING(
    [--enable-rootcommit],
    [Allow the root user to commit files (disabled by default)]), ,
  [enable_rootcommit=no])
if test "$enable_rootcommit" = no; then
  AC_DEFINE(
    [CVS_BADROOT], [1],
    [When committing a permanent change, CVS and RCS make a log entry of
     who committed the change.  If you are committing the change logged
     in as "root" (not under "su" or other root-priv giving program),
     CVS/RCS cannot determine who is actually making the change.

     As such, by default, CVS prohibits changes committed by users
     logged in as "root".  You can disable checking by passing the
     "--enable-rootcommit" option to configure or by commenting out the
     lines below.])
fi

dnl
dnl end --enable-rootcommit
dnl

dnl
dnl begin --enable-old-info-support
dnl
AC_ARG_ENABLE(
  [old-info-support],
  AC_HELP_STRING(
    [--enable-old-info-format-support],
    [Enable support for the pre 1.12.1 *info scripting hook format strings.
     Disable this option for a smaller executable once your scripting
     hooks have been updated to use the new *info format strings (default).]), ,
  [enable_old_info_format_support=yes])
if test "$enable_old_info_format_support" = yes; then
  AC_DEFINE(
    [SUPPORT_OLD_INFO_FMT_STRINGS], [1],
    [Enable support for the pre 1.12.1 *info scripting hook format strings.
     Disable this option for a smaller executable once your scripting
     hooks have been updated to use the new *info format strings by passing
     "--disable-old-info-format-support" option to configure or by commenting
     out the line below.])
fi

dnl
dnl end --enable-old-info-support
dnl


dnl
dnl begin --enable-config-override
dnl

AC_ARG_ENABLE(
  [config-override],
  AC_HELP_STRING(
    [--enable-config-override],
    [Set to a comma-seperated list of paths to directories (designated by
     trailing `/') and files, specifies the path prefixes (for directories) and
     paths to files the CVS server commands will allow configuration to be read
     from.  Specify `--enable-config-override=no' to disable config file
     overrides completely and `--enable-config-override=/' or simply
     `--enable-config-override' to allow all paths.  (Defaults to
     `SYSCONFDIR/cvs.conf,SYSCONFDIR/cvs/')]),,
  [# $sysconfdir may still contain variable references.  By default, this will
   # be to $prefix, and $prefix won't be set to its default value until later.
   # Compromise without setting $prefix for the rest of the file.
   cvs_save_prefix=$prefix
   if test "X$prefix" = XNONE; then
     prefix=$ac_prefix_default
   fi
   eval enable_config_override=`echo $sysconfdir/cvs.conf,$sysconfdir/cvs/`
   prefix=$cvs_save_prefix])

if test x"$enable_config_override" = xyes; then
  enable_config_override=/
fi

if test x"$enable_config_override" = xno; then :; else
  save_IFS=$IFS
  IFS=,
  arrayinit=""
  for path in $enable_config_override; do
    IFS=$save_IFS
    case "$path" in
      [[\\/$]]* | ?:[[\\/]]* )
	arrayinit="$arrayinit\"$path\", "
	;;
      *)  AC_MSG_ERROR(
          [expected comma separated list of absolute directory
           names for --enable-config-override, or \`no', not:
           \`$enable_config_override'
           (\`$path' invalid.)]);;
    esac
  done
  arrayinit="${arrayinit}NULL"

  AC_DEFINE_UNQUOTED(ALLOW_CONFIG_OVERRIDE, [$arrayinit],
    [Define this to a NULL terminated list of allowed path prefixes (for
     directories) and paths to files the CVS server will allow configuration to
     be read from when specified from the command line.])
fi

dnl
dnl end --enable-config-override
dnl



dnl
dnl end --enables
dnl



dnl For the moment we will assume that all systems which have
dnl the unixyness to run configure are unixy enough to do the
dnl PreservePermissions stuff.  I have this sinking feeling that
dnl things won't be that simple, before long.
dnl AC_DEFINE(PRESERVE_PERMISSIONS_SUPPORT, 1,
dnl [Define if this system supports chown(), link(), and friends.])

dnl On cygwin32, we configure like a Unix system, but we need some support
dnl libraries.  We do this at the end so that the new libraries are added at
dnl the end of LIBS.
dnl
dnl FIXME: We should be trying to meet the autoconf ideal of checking for
dnl the properties of the system rather than the name of the os here.  In other
dnl words, we should check the case sensitivty of the system and then for
dnl the support functions we are using and which library we find them in.
AC_CACHE_CHECK(for cygwin32, ccvs_cv_sys_cygwin32,
[AC_TRY_COMPILE([], [return __CYGWIN32__;],
ccvs_cv_sys_cygwin32=yes, ccvs_cv_sys_cygwin32=no)])
if test $ccvs_cv_sys_cygwin32 = yes; then
  LIBS="$LIBS -ladvapi32"

  dnl On Windows you can only change file times if you can write to
  dnl the file.  cygwin32 should really handle this for us, but as of
  dnl January 1998 it doesn't.
  AC_DEFINE(UTIME_EXPECTS_WRITABLE, 1,
[Define if utime requires write access to the file (true on Windows,
but not Unix).])

  dnl On Windows we must use setmode to change between binary and text
  dnl mode.  This probably doesn't really require two macro definitions
  AC_DEFINE(USE_SETMODE_STDOUT, 1,
[Define if setmode is required when writing binary data to stdout.])
  AC_DEFINE(HAVE_SETMODE, 1,
[Define if the diff library should use setmode for binary files.])
fi

dnl associate the setting of the execute bit with the individual scripts
AC_CONFIG_FILES(contrib/validate_repo, [chmod +x contrib/validate_repo])
AC_CONFIG_FILES(contrib/clmerge, [chmod +x contrib/clmerge])
AC_CONFIG_FILES(contrib/cln_hist, [chmod +x contrib/cln_hist])
AC_CONFIG_FILES(contrib/commit_prep, [chmod +x contrib/commit_prep])
AC_CONFIG_FILES(contrib/cvs_acls, [chmod +x contrib/cvs_acls])
AC_CONFIG_FILES(contrib/log, [chmod +x contrib/log])
AC_CONFIG_FILES(contrib/log_accum, [chmod +x contrib/log_accum])
AC_CONFIG_FILES(contrib/mfpipe, [chmod +x contrib/mfpipe])
AC_CONFIG_FILES(contrib/pvcs2rcs, [chmod +x contrib/pvcs2rcs])
AC_CONFIG_FILES(contrib/rcs2log:contrib/rcs2log.sh, [chmod +x contrib/rcs2log])
AC_CONFIG_FILES(contrib/rcslock, [chmod +x contrib/rcslock])
AC_CONFIG_FILES(contrib/sccs2rcs, [chmod +x contrib/sccs2rcs])
AC_CONFIG_FILES(doc/mkman:doc/mkman.pl, [chmod +x doc/mkman])
AC_CONFIG_FILES(src/cvsbug, [chmod +x src/cvsbug])

dnl the bulk files
AC_CONFIG_FILES([Makefile \
	  contrib/Makefile \
	  contrib/pam/Makefile \
	  cvs.spec \
	  diff/Makefile \
	  doc/Makefile \
	  doc/i18n/Makefile \
	  doc/i18n/pt_BR/Makefile \
	  emx/Makefile \
	  lib/Makefile \
	  maint-aux/Makefile \
	  man/Makefile \
	  os2/Makefile \
	  src/Makefile \
	  src/sanity.config.sh \
	  tools/Makefile \
	  vms/Makefile \
	  windows-NT/Makefile \
	  windows-NT/SCC/Makefile \
	  zlib/Makefile])

dnl and we're done
AC_OUTPUT



# Report the state of this version of CVS if this is from dev.
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]),  [[0-9]*\.[0-9]*\.[0-9]*\.[0-9]],
[    cat <<EOF

You are about to use an unreleased version of CVS.  Be sure to
read the relevant mailing lists, most importantly <info-cvs@nongnu.org>.

Below you will find information on the status of this version of CVS.


EOF
    sed -n '/^\* Status/,$p' $srcdir/BUGS
])