summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/configure.in
blob: fc33197493693c6296b6e5694709c20893086575 (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
dnl configure.in for cvs
AC_INIT([Concurrent Versions System (CVS)],[1.11.17],[bug-cvs@gnu.org],[cvs])
AC_CONFIG_SRCDIR(src/cvs.h)
AM_INIT_AUTOMAKE([gnu 1.7.9 dist-bzip2 no-define])
AC_PREREQ(2.58)

AC_PREFIX_PROGRAM(cvs)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE

AC_PROG_CC
AM_PROG_CC_C_O

dnl FIXME the next three calls should be avoided according to autoconf
dnl philosophy.  for example, AC_CHECK_LIB should be used to look for crypt.
dnl
dnl These are here instead of later because they want to be called before
dnl anything that calls a C compiler.
AC_AIX
AC_MINIX

# 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_YACC
AC_PROG_LN_S
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(\
	errno.h \
	direct.h \
	fcntl.h \
	fnmatch.h \
	io.h \
	limits.h \
	memory.h \
	ndbm.h \
	string.h \
	syslog.h \
	sys/bsdtypes.h \
	sys/file.h \
	sys/param.h \
	sys/resource.h \
	sys/select.h \
	sys/time.h \
	sys/timeb.h \
	unistd.h \
	utime.h\
)
AC_HEADER_STAT
AC_HEADER_TIME

AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL

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

AC_REPLACE_FUNCS(\
	dup2 \
	ftruncate \
	gethostname \
	memmove \
	mkdir \
	rename \
	strerror \
	strstr \
	strtoul\
	valloc \
	waitpid \
)



dnl
dnl Begin GNULIB stuff.
dnl
gl_XSIZE

dnl We always want to use the GNULIB getpass, so define its name to something
dnl that won't conflict with system declarations.
AC_DEFINE([getpass], [cvs_getpass],
  [We want to always use the GNULIB version of getpass which we have in lib,
   so define getpass to something that won't conflict with any existing system
   declarations.])

dnl
dnl End GNULIB stuff.
dnl



AC_CHECK_FUNCS(\
	fchdir \
	fchmod \
	fsync \
	ftime \
	geteuid \
	getgroups \
	getopt \
	getpagesize \
	gettimeofday \
	initgroups \
	login \
	logout \
	mknod \
	mkstemp \
	mktemp \
	putenv \
	readlink \
	regcomp \
	regerror \
	regexec \
	regfree \
	sigaction \
	sigblock \
	sigprocmask \
	sigsetmask \
	sigvec \
	tempnam \
	timezone \
	tzset \
	vprintf \
	wait3 \
)
# we only need one of the following
AC_CHECK_FUNCS([\
	nanosleep \
	usleep \
	select \
], [break])

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

AC_FUNC_FNMATCH
if test "$ac_cv_func_fnmatch_works" = no; then
  AC_LIBOBJ(fnmatch)
  AC_CONFIG_LINKS(lib/fnmatch.h:lib/fnmatch.h.in)
  AC_LIBSOURCE(fnmatch.h.in)
fi

dnl for the buffer routine replacements
AC_FUNC_MMAP

# 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)


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)

includeopt=
AC_SUBST(includeopt)
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.])
    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
      includeopt="${includeopt} -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 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 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


# 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)]), ,
  [if test "$ac_cv_search_connect" != no; then
    enable_client=yes
  fi])
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

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)]))

if test no != "$enable_password_authenticated_client"; then
  if test no != "$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 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)]), ,
  [if test "$ac_cv_search_connect" != no; then
     enable_server=yes
   fi])

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 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 "$enable_encryption" = yes; then
  if test no != "$with_client" || test no != "$with_server"; then
    AC_DEFINE(
      [ENCRYPTION], [1],
      [Define to enable encryption support.])
  else
    AC_MSG_WARN(
      [--enable-encryption is meaningless when neither the CVS client
       nor the CVS server is enabled (--disable-client and --disable-server).])
  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-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 end --enable-*
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/check_cvs, [chmod +x contrib/check_cvs])
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, [chmod +x doc/mkman])
AC_CONFIG_FILES(src/cvsbug, [chmod +x src/cvsbug])
AC_CONFIG_FILES(windows-NT/fix-msvc-mak:windows-NT/fix-msvc-mak-head.pl:windows-NT/fix-msvc-mak.pl,
                [chmod +x windows-NT/fix-msvc-mak])

dnl the bulk files
AC_CONFIG_FILES([Makefile \
	  contrib/Makefile \
	  cvs.spec \
	  diff/Makefile \
	  doc/Makefile \
	  emx/Makefile \
	  lib/Makefile \
	  man/Makefile \
	  os2/Makefile \
	  src/Makefile \
	  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@gnu.org>.

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


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