1dnl configure.in for cvs
2AC_INIT([Concurrent Versions System (CVS)],[1.11.22.1],
3        [bug-cvs@nongnu.org],[cvs])
4AC_CONFIG_SRCDIR(src/cvs.h)
5AM_INIT_AUTOMAKE([gnu 1.7.9 dist-bzip2 no-define])
6AC_PREREQ(2.60)
7
8AC_PREFIX_PROGRAM(cvs)
9AM_CONFIG_HEADER(config.h)
10AM_MAINTAINER_MODE
11
12AC_PROG_CC
13AM_PROG_CC_C_O
14
15dnl FIXME the next three calls should be avoided according to autoconf
16dnl philosophy.  for example, AC_CHECK_LIB should be used to look for crypt.
17dnl
18dnl These are here instead of later because they want to be called before
19dnl anything that calls a C compiler.
20AC_AIX
21AC_MINIX
22
23# Find the posix library needed on INTERACTIVE UNIX (ISC)
24dnl
25dnl From the Autoconf 2.53 manual (AC_ISC_POSIX):
26dnl
27dnl  For INTERACTIVE UNIX (ISC), add `-lcposix' to output variable
28dnl  `LIBS' if necessary for POSIX facilities.  Call this after
29dnl  `AC_PROG_CC' and before any other macros that use POSIX
30dnl  interfaces.  INTERACTIVE UNIX is no longer sold, and Sun says that
31dnl  they will drop support for it on 2006-07-23, so this macro is
32dnl  becoming obsolescent.
33dnl
34AC_SEARCH_LIBS([strerror], [cposix])
35
36dnl
37dnl Autoconf stopped setting $ISC sometime before 2.53
38dnl
39dnl If this is still important, someone should come up with a generic test
40dnl for whether _SYSV3 needs to be defined.  Removed code below:
41dnl
42dnl if test "$ISC" = yes; then
43dnl CFLAGS="$CFLAGS -D_SYSV3"
44dnl # And I don't like this...  In theory it should be found later if server is
45dnl # enabled, but maybe something on INTERACTIVE UNIX (ISC) we didn't ask to
46dnl # link with crypt tries?  Anyhow, the autoconf manual says we can delete
47dnl # this ISC stuff on or after 2006-07-23 when Sun discontinues support and
48dnl # ISC becomes obsolescent, but I suppose that is probably a matter of
49dnl # opinion.
50dnl #
51dnl # N.B.  The reason for doing this is that some moron decided to put a stub
52dnl # for crypt in libc that always returns NULL.  Without this here, the later
53dnl # check will find the stub instead of the real thing, resulting in a server
54dnl # that can't process crypted passwords correctly.
55dnl
56dnl # again, if we have to try and reenable this for ISC, someone should come
57dnl # up with a generic test that figures out whether crypt is good or not -
58dnl # Is it always returning NULL?
59dnl LIBS="-lcrypt $LIBS"
60dnl fi
61dnl
62dnl FIXME - This has been broken for at least a few months anyhow, so I'm
63dnl removing the crypt lib define above, but the correct fix would be to
64dnl provide a CRYPT_WORKS macro or the like that gets called sometime after
65dnl the AC_SEARCH_LIBS call that normally finds crypt, and if crypt doesn't
66dnl work, the macro should be retried with LIBS="-lcrypt $LIBS" forced.
67dnl
68
69AC_PROG_RANLIB
70AC_PROG_YACC
71AC_PROG_LN_S
72AC_EXEEXT
73
74AC_PATH_PROG(PERL, perl, no)
75AC_PATH_PROG(CSH, csh, no)
76# for contrib/rcs2log.sh & src/cvsbug.in.
77AC_PATH_PROG(MKTEMP, mktemp, mktemp)
78if test x"$MKTEMP" = xmktemp; then
79	MKTEMP_SH_FUNCTION=$srcdir/mktemp.sh
80else
81	MKTEMP_SH_FUNCTION=/dev/null
82fi
83AC_SUBST_FILE(MKTEMP_SH_FUNCTION)
84# for src/cvsbug.in
85AC_PATH_PROG(SENDMAIL, sendmail, no, [$PATH:/usr/sbin:/usr/lib])
86# For diff/util.c
87AC_PATH_PROG(PR, pr, no)
88if test x"$PR" != xno; then
89	AC_DEFINE_UNQUOTED([PR_PROGRAM], ["$PR"], [Path to the pr utility])
90fi
91
92dnl FIXME This is truly gross.
93missing_dir=`cd $ac_aux_dir && pwd`
94dnl FIXME I pulled this default list from sanity.sh.  Perhaps these lists
95dnl can be stored in one location?
96dnl
97dnl Yeah, put the value in a variable add it to the substitution list
98dnl then have configure create sanity.sh from sanity.sh.in...
99glocs="$PATH:/usr/local/bin:/usr/contrib/bin:/usr/gnu/bin:/local/bin:/local/gnu/bin:/gnu/bin"
100AC_PATH_PROGS(ROFF, groff roff, $missing_dir/missing roff, $glocs)
101AC_PATH_PROG(PS2PDF, ps2pdf, $missing_dir/missing ps2pdf)
102AC_PATH_PROG(TEXI2DVI, texi2dvi, $missing_dir/missing texi2dvi)
103
104AC_SYS_INTERPRETER
105if test X"$ac_cv_sys_interpreter" != X"yes" ; then
106  # silly trick to avoid problems in AC macros...
107  ac_msg='perl scripts using #! may not be invoked properly'
108  AC_MSG_WARN($ac_msg)
109fi
110
111# BSD's logo is a devil for a reason, hey?
112AC_CACHE_CHECK(for BSD VPATH bug in make, ccvs_cv_bsd_make_vpath_bug,
113[if test ! -d ac_test_dir ; then
114	AC_TRY_COMMAND([mkdir ac_test_dir])
115fi
116cat >conftestmake <<EOF
117VPATH = ac_test_dir
118ac_test_target: ac_test_dep
119	echo BSD VPATH bug present >&2
120ac_test_dep: ac_test_dep_dep
121EOF
122touch ac_test_dir/ac_test_dep_dep
123touch ac_test_dir/ac_test_dep
124touch ac_test_target
125# Don't know why, but the following test doesn't work under FreeBSD 4.2
126# without this sleep command
127sleep 1
128if AC_TRY_COMMAND([make -f conftestmake 2>&1 >/dev/null |grep ^BSD\ VPATH\ bug\ present\$ >/dev/null]) ; then
129	ccvs_cv_bsd_make_vpath_bug=yes
130else
131	ccvs_cv_bsd_make_vpath_bug=no
132fi
133AC_TRY_COMMAND([rm -rf ac_test_dir ac_test_target conftestmake])])
134# We also don't need to worry about the bug when $srcdir = $builddir
135AM_CONDITIONAL(MAKE_TARGETS_IN_VPATH, \
136		test $ccvs_cv_bsd_make_vpath_bug = no \
137		|| test $srcdir = .)
138
139AC_HEADER_DIRENT
140AC_HEADER_STDC
141AC_HEADER_SYS_WAIT
142AC_CHECK_HEADERS(\
143	errno.h \
144	direct.h \
145	fcntl.h \
146	fnmatch.h \
147	io.h \
148	limits.h \
149	memory.h \
150	ndbm.h \
151	string.h \
152	syslog.h \
153	sys/bsdtypes.h \
154	sys/file.h \
155	sys/param.h \
156	sys/resource.h \
157	sys/select.h \
158	sys/time.h \
159	sys/timeb.h \
160	unistd.h \
161	utime.h\
162)
163AC_HEADER_STAT
164AC_HEADER_TIME
165
166AC_C_CONST
167AC_TYPE_UID_T
168AC_TYPE_MODE_T
169AC_TYPE_PID_T
170AC_TYPE_SIZE_T
171AC_TYPE_SIGNAL
172
173AC_CHECK_MEMBERS([struct stat.st_blksize])
174AC_CHECK_MEMBERS([struct stat.st_rdev])
175
176AC_REPLACE_FUNCS(\
177	dup2 \
178	ftruncate \
179	gethostname \
180	memmove \
181	mkdir \
182	rename \
183	strerror \
184	strstr \
185	strtoul\
186	valloc \
187	waitpid \
188)
189
190
191
192dnl
193dnl Begin GNULIB stuff.
194dnl
195gl_XSIZE
196
197dnl We always want to use the GNULIB getpass, so define its name to something
198dnl that won't conflict with system declarations.
199AC_DEFINE([getpass], [cvs_getpass],
200  [We want to always use the GNULIB version of getpass which we have in lib,
201   so define getpass to something that won't conflict with any existing system
202   declarations.])
203
204dnl
205dnl End GNULIB stuff.
206dnl
207
208
209
210AC_CHECK_FUNCS(\
211	fchdir \
212	fchmod \
213	fsync \
214	ftime \
215	geteuid \
216	getgroups \
217	getopt \
218	getpagesize \
219	gettimeofday \
220	initgroups \
221	login \
222	logout \
223	mknod \
224	mkstemp \
225	mktemp \
226	putenv \
227	readlink \
228	regcomp \
229	regerror \
230	regexec \
231	regfree \
232	sigaction \
233	sigblock \
234	sigprocmask \
235	sigsetmask \
236	sigvec \
237	tempnam \
238	timezone \
239	tzset \
240	vprintf \
241	wait3 \
242)
243# we only need one of the following
244AC_CHECK_FUNCS([\
245	nanosleep \
246	usleep \
247	select \
248], [break])
249
250dnl
251dnl The CVS coding standard (as specified in HACKING) is that if it exists
252dnl in SunOS4 and ANSI, we use it.  CVS itself, of course, therefore doesn't
253dnl need HAVE_* defines for such functions, but diff wants them.
254dnl
255AC_DEFINE(HAVE_STRCHR, 1,
256[Define if you have strchr (always for CVS).])
257AC_DEFINE(HAVE_MEMCHR, 1,
258[Define if you have memchr (always for CVS).])
259
260dnl
261dnl Force lib/regex.c to use malloc instead of messing around with alloca
262dnl and define the old re_comp routines that we use.
263dnl
264AC_DEFINE(REGEX_MALLOC, 1,
265[Define to force lib/regex.c to use malloc instead of alloca.])
266AC_DEFINE(_REGEX_RE_COMP, 1,
267[Define to force lib/regex.c to define re_comp et al.])
268dnl
269dnl AC_FUNC_FORK([]) is rather baroque.  It seems to be rather more picky
270dnl than, say, the Single Unix Specification (version 2), which simplifies
271dnl a lot of cases by saying that the child process can't set any variables
272dnl (thus avoiding problems with register allocation) or call any functions
273dnl (thus avoiding problems with whether file descriptors are shared).
274dnl It would be nice if we could just write to the Single Unix Specification.
275dnl I think the only way to do redirection this way is by doing it in the
276dnl parent, and then undoing it afterwards (analogous to windows-NT/run.c).
277dnl That would appear to have a race condition if the user hits ^C (or
278dnl some other signal) at the wrong time, as main_cleanup will try to use
279dnl stdout/stderr.  So maybe we are stuck with AC_FUNC_FORK([]).
280dnl
281AC_FUNC_FORK([])
282AC_FUNC_CLOSEDIR_VOID
283
284dnl
285dnl Check for shadow password support.
286dnl
287dnl We used to try to determine whether shadow passwords were actually in
288dnl use or not, but the code has been changed to work right reguardless,
289dnl so we can go back to a simple check.
290AC_SEARCH_LIBS(getspnam, sec gen, AC_DEFINE(HAVE_GETSPNAM, 1,
291[Define if you have the getspnam function.]))
292
293AC_FUNC_UTIME_NULL
294AC_SYS_LONG_FILE_NAMES
295
296AC_FUNC_FNMATCH
297if test "$ac_cv_func_fnmatch_works" = no; then
298  AC_LIBOBJ(fnmatch)
299  AC_CONFIG_LINKS(lib/fnmatch.h:lib/fnmatch.h.in)
300  AC_LIBSOURCE(fnmatch.h.in)
301fi
302
303# Try to find connect and gethostbyname.
304AC_CHECK_LIB(nsl, main)
305AC_SEARCH_LIBS(connect, xnet socket inet,
306  AC_DEFINE(HAVE_CONNECT, 1,
307[Define if you have the connect function.]))
308dnl no need to search nsl for gethostbyname here since we should have
309dnl just added libnsl above if we found it.
310AC_SEARCH_LIBS(gethostbyname, netinet)
311
312
313dnl
314dnl begin --with-*
315dnl
316
317dnl
318dnl set $(KRB4) from --with-krb4=value -- WITH_KRB4
319dnl
320dnl If you change this, keep in mind that some systems have a bogus
321dnl libkrb in the system libraries, so --with-krb4=value needs to
322dnl override the system -lkrb.
323dnl
324KRB4=/usr/kerberos
325define(WITH_KRB4,[
326AC_ARG_WITH(
327  [krb4],
328  AC_HELP_STRING(
329    [--with-krb4],
330    [Kerberos 4 directory (default /usr/kerberos)]),
331  [KRB4=$with_krb4],
332)dnl
333AC_MSG_CHECKING([for KRB4 in $KRB4])
334AC_MSG_RESULT([])
335AC_SUBST(KRB4)])dnl
336WITH_KRB4
337
338krb_h=
339AC_MSG_CHECKING([for krb.h])
340if test "$cross_compiling" != yes && test -r $KRB4/include/krb.h; then
341   hold_cflags=$CFLAGS
342   CFLAGS="$CFLAGS -I$KRB4/include"
343   AC_TRY_LINK([#include <krb.h>],[int i;],
344          [krb_h=yes krb_incdir=$KRB4/include],
345          [CFLAGS=$hold_cflags
346           AC_TRY_LINK([#include <krb.h>],[int i;],
347             [krb_h=yes krb_incdir=])])
348   CFLAGS=$hold_cflags
349else
350   AC_TRY_LINK([#include <krb.h>],[int i;],
351             [krb_h=yes krb_incdir=])
352fi
353if test -z "$krb_h"; then
354  AC_TRY_LINK([#include <krb.h>],[int i;],
355    [krb_h=yes krb_incdir=],
356    [if test "$cross_compiling" != yes && test -r $KRB4/include/kerberosIV/krb.h; then
357       hold_cflags=$CFLAGS
358       CFLAGS="$CFLAGS -I$KRB4/include/kerberosIV"
359       AC_TRY_LINK([#include <krb.h>],[int i;],
360	 [krb_h=yes krb_incdir=$KRB4/include/kerberosIV])
361       CFLAGS=$hold_cflags
362     fi])
363fi
364AC_MSG_RESULT($krb_h)
365
366includeopt=
367AC_SUBST(includeopt)
368if test -n "$krb_h"; then
369  krb_lib=
370  if test "$cross_compiling" != yes && test -r $KRB4/lib/libkrb.a; then
371       hold_ldflags=$LDFLAGS
372       LDFLAGS="-L${KRB4}/lib $LDFLAGS"
373       AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=${KRB4}/lib],
374           [LDFLAGS=$hold_ldflags
375            # Using open here instead of printf so we don't
376            # get confused by the cached value for printf from above.
377            AC_CHECK_LIB(krb,open,[krb_lib=yes krb_libdir=])])
378       LDFLAGS=$hold_ldflags
379  else
380       AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=])
381       AC_CHECK_FUNC(krb_recvauth,[krb_lib=yes krb_libdir=])
382  fi
383  if test -n "$krb_lib"; then
384    AC_DEFINE([HAVE_KERBEROS], 1,
385	      [Define if you have MIT Kerberos version 4 available.])
386    test -n "${krb_libdir}" && LIBS="${LIBS} -L${krb_libdir}"
387    # Put -L${krb_libdir} in LDFLAGS temporarily so that it appears before
388    # -ldes in the command line.  Don't do it permanently so that we honor
389    # the user's setting for LDFLAGS
390    hold_ldflags=$LDFLAGS
391    test -n "${krb_libdir}" && LDFLAGS="$LDFLAGS -L${krb_libdir}"
392    AC_CHECK_LIB(des,printf,[LIBS="${LIBS} -ldes"])
393    AC_CHECK_LIB(krb,krb_recvauth)
394    AC_CHECK_LIB(krb4,krb_recvauth)
395    LDFLAGS=$hold_ldflags
396    if test -n "$krb_incdir"; then
397      includeopt="${includeopt} -I$krb_incdir"
398    fi
399  fi
400fi
401AC_CHECK_FUNCS(krb_get_err_text)
402
403
404dnl
405dnl WITH_GSSAPI is external
406dnl
407dnl TODO - I tried to put these in alphabetical order, but ACX_WITH_GSSAPI
408dnl fails unless called after the KRB4 stuff.  I don't know why.
409dnl
410ACX_WITH_GSSAPI
411
412
413dnl
414dnl begin --with-editor
415dnl
416dnl Set the default editor to use for log messages
417dnl
418
419AC_ARG_VAR(
420  [EDITOR],
421  [The text editor CVS will use by default for log messages.])
422
423# Let the confiscator request a specific editor
424AC_ARG_WITH(
425  [editor],
426  AC_HELP_STRING(
427    [--with-editor],
428    [The default text editor CVS should use for log messages
429     (default autoselects)]), ,
430  [with_editor=yes])
431
432# If --with-editor was supplied with an argument, let it override $EDITOR from
433# the user's environment.  We need to unset EDITOR here because AC_CHECK_PROGS
434# will let the value of EDITOR ride when it is set rather than searching.  We
435# ignore the --without-editor case since it will be caught below.
436if test -n "$EDITOR" && test yes != $with_editor; then
437  AS_UNSET([EDITOR])
438fi
439
440# Set the default when --with-editor wasn't supplied or when it was supplied
441# without an argument.
442if test yes = $with_editor; then
443  with_editor="vim vi emacs nano pico edit"
444fi
445
446if echo $with_editor |grep ^/ >/dev/null; then
447  # If $with_editor is an absolute path, issue a warning if the executable
448  # doesn't exist or isn't usable, but then trust the user and use it
449  # regardless
450  EDITOR=$with_editor
451  AC_MSG_CHECKING([for an editor])
452  AC_MSG_RESULT([$EDITOR])
453  if ! test -f $with_editor \
454      || ! test -x $with_editor; then
455    # warn the user that they may encounter problems
456    AC_MSG_WARN([\`$with_editor' is not a path to an executable file])
457  fi
458elif test no != "${with_editor}"; then
459  # Search for an editor
460  AC_CHECK_PROGS([EDITOR], [$with_editor], [no])
461    if test no = "${EDITOR}"; then
462      AC_MSG_ERROR([
463    Failed to find a text file editor.  CVS cannot be compiled
464    without a default log message editor.  Searched for
465    \`$with_editor'.  Try \`configure --with-editor'.])
466    fi
467else
468  AC_MSG_ERROR([
469    CVS cannot be compiled without a default log message editor.
470    Try \`configure --with-editor'.])
471fi
472
473dnl FIXME - Using --without-editor will probably break a compile at
474dnl the moment, but maybe it is reasonable for someone to want to
475dnl compile a CVS executable that refuses to run if no $EDITOR,
476dnl $CVS_EDITOR, or -e option is specified?  Making a preliminary
477dnl design decision in this direction, subject to discussion.
478dnl
479dnl Still don't know if the above would be useful, but we shouldn't
480dnl be able to get here any longer without $EDITOR defined due to the
481dnl error checking above.
482AC_DEFINE_UNQUOTED(
483  [EDITOR_DFLT], ["$EDITOR"],
484  [The default editor to use, if one does not specify the "-e" option
485   to cvs, or does not have an EDITOR environment variable.  If this
486   is not set to an absolute path to an executable, use the shell to
487   find where the editor actually is.  This allows sites with
488   /usr/bin/vi or /usr/ucb/vi to work equally well (assuming that their
489   PATH is reasonable).])
490
491dnl
492dnl done finding an editor
493dnl
494dnl end --with-editor
495dnl
496
497dnl
498dnl begin --with-ssh
499dnl
500
501# What remote shell transport should the :extssh: client cvs default to using?
502AC_ARG_WITH(
503  [ssh],
504  AC_HELP_STRING(
505    [--with-ssh],
506    [The default remote shell CVS will use for :extssh: transport
507     (default autodetects)]), ,
508  [with_ssh="ssh lshc ssh2"])
509
510if test no = "$with_ssh"; then
511  AC_MSG_WARN([Failed to find usable remote shell. Using 'ssh'.])
512  with_ssh=ssh
513elif test yes = "$with_ssh"; then
514  # Make --with-ssh mean the same thing as --with-ssh=ssh
515  with_ssh=ssh
516fi
517
518if echo $with_ssh |grep ^/ >/dev/null; then
519  # If $with_ssh is an absolute path, issue a warning if the executable
520  # doesn't exist or isn't usable, but then trust the user and use it
521  # regardless
522  with_default_ssh=$with_ssh
523  AC_MSG_CHECKING([for a remote shell])
524  if ! test -f $with_ssh \
525      || ! test -x $with_ssh; then
526    # warn the user that they may encounter problems
527    AC_MSG_WARN([$with_ssh is not a path to an executable file])
528  fi
529else
530  # Search for a remote shell
531  AC_CHECK_PROGS([with_default_ssh], [$with_ssh], "ssh")
532fi
533
534AC_DEFINE_UNQUOTED(
535  [SSH_DFLT], ["$with_default_ssh"],
536  [The default remote shell to use, if one does not specify the
537   CVS_SSH environment variable.])
538dnl done with finding a default CVS_SSH value
539dnl
540dnl end --with-ssh
541dnl
542
543
544dnl
545dnl begin --with-rsh
546dnl
547dnl Many sites no longer desire the use of "rsh" as the default
548dnl remote shell program. They typically favor "ssh" as the default
549
550# What remote shell transport should our client cvs default to using?
551AC_ARG_WITH(
552  [rsh],
553  AC_HELP_STRING(
554    [--with-rsh],
555    [The default remote shell CVS will use for :ext: transport
556     (default autodetects)]), ,
557  dnl `remsh' is only useful on HP-UX, where `rsh' is the `restricted shell'
558  dnl and `remsh' is the remote shell, but look for it first since it
559  dnl probably won't exist on any platform where it shouldn't be preferred
560  dnl to `rsh'.
561  [with_rsh="remsh rsh ssh lshc ssh2"])
562
563if test no = "$with_rsh"; then
564  AC_MSG_WARN([Failed to find usable remote shell. Using 'rsh'.])
565  with_rsh=rsh
566elif test yes = "$with_rsh"; then
567  # Make --with-rsh mean the same thing as --with-rsh=rsh
568  with_rsh=rsh
569fi
570
571if echo $with_rsh |grep ^/ >/dev/null; then
572  # If $with_rsh is an absolute path, issue a warning if the executable
573  # doesn't exist or isn't usable, but then trust the user and use it
574  # regardless
575  with_default_rsh=$with_rsh
576  AC_MSG_CHECKING([for a remote shell])
577  if ! test -f $with_rsh \
578      || ! test -x $with_rsh; then
579    # warn the user that they may encounter problems
580    AC_MSG_WARN([$with_rsh is not a path to an executable file])
581  fi
582else
583  # Search for a remote shell
584  AC_CHECK_PROGS([with_default_rsh], [$with_rsh], "rsh")
585fi
586
587AC_DEFINE_UNQUOTED(
588  [RSH_DFLT], ["$with_default_rsh"],
589  [The default remote shell to use, if one does not specify the
590   CVS_RSH environment variable.])
591dnl done with finding a default CVS_RSH value
592dnl
593dnl end --with-rsh
594dnl
595
596
597dnl
598dnl Find a temporary directory
599dnl
600AC_ARG_WITH(
601  [tmpdir],
602  AC_HELP_STRING(
603    [--with-tmpdir],
604    [The temporary directory CVS should use as a default
605     (default autoselects)]))
606
607AC_MSG_CHECKING([for temporary directory])
608if test -z "$with_tmpdir" || test yes = "$with_tmpdir"; then
609  for with_tmpdir in /tmp /var/tmp no; do
610    if test -d "$with_tmpdir" && test -x "$with_tmpdir" \
611        && test -w "$with_tmpdir" && test -r "$with_tmpdir"; then
612      break
613    fi
614  done
615  if test no = "$with_tmpdir"; then
616    AC_MSG_WARN([Failed to find usable temporary directory.  Using '/tmp'.])
617    with_tmpdir=/tmp
618  fi
619  AC_MSG_RESULT([$with_tmpdir])
620elif ! echo "$with_tmpdir" |grep '^[[\\/]]'; then
621  AC_MSG_RESULT([$with_tmpdir])
622  AC_MSG_ERROR([--with-tmpdir requires an absolute path.])
623elif ! test -d "$with_tmpdir" || ! test -x "$with_tmpdir" \
624        || ! test -w "$with_tmpdir" || ! test -r "$with_tmpdir"; then
625  AC_MSG_RESULT([$with_tmpdir])
626  AC_MSG_WARN(
627    [User supplied temporary directory ('$with_tmpdir') does not
628     exist or lacks sufficient permissions for read/write.])
629fi
630
631AC_DEFINE_UNQUOTED(
632  [TMPDIR_DFLT], ["$with_tmpdir"],
633  [Directory used for storing temporary files, if not overridden by
634   environment variables or the -T global option.  There should be little
635   need to change this (-T is a better mechanism if you need to use a
636   different directory for temporary files).])
637
638dnl
639dnl done finding tmpdir
640dnl
641
642
643dnl
644dnl Get default umask
645dnl
646
647AC_ARG_WITH(
648  [umask],
649  AC_HELP_STRING(
650    [--with-umask],
651    [Set the umask CVS will use by default in the repository (default 002)]))
652
653if test -z "$with_umask" || test yes = "$with_umask"; then
654  with_umask=002
655elif test no = "$with_umask"; then
656  with_umask=000
657fi
658
659AC_DEFINE_UNQUOTED(
660  [UMASK_DFLT], [$with_umask],
661  [The default umask to use when creating or otherwise setting file or
662   directory permissions in the repository.  Must be a value in the
663   range of 0 through 0777.  For example, a value of 002 allows group
664   rwx access and world rx access; a value of 007 allows group rwx
665   access but no world access.  This value is overridden by the value
666   of the CVSUMASK environment variable, which is interpreted as an
667   octal number.])
668
669dnl
670dnl Done setting default umask
671dnl
672
673dnl
674dnl Set CVS Administrator Group
675dnl
676AC_ARG_WITH(
677  [cvs-admin-group],
678  AC_HELP_STRING(
679    [--with-cvs-admin-group=GROUP],
680    [The CVS admin command is restricted to the members of this group.
681     If this group does not exist, all users are allowed to run CVS admin.
682     To disable the CVS admin command for all users, create an empty group
683     by specifying the --with-cvs-admin-group= option.  To disable access
684     control for CVS admin, run configure with the --without-cvs-admin-group
685     option. (default 'cvsadmin')]), ,
686  [with_cvs_admin_group=cvsadmin])
687
688if test yes = "$with_cvs_admin_group"; then
689  with_cvs_admin_group=cvsadmin
690fi
691if test no != "$with_cvs_admin_group"; then
692  dnl FIXME We should warn if the group doesn't exist
693  AC_DEFINE_UNQUOTED(
694    [CVS_ADMIN_GROUP], ["$with_cvs_admin_group"],
695    [The CVS admin command is restricted to the members of the group
696     CVS_ADMIN_GROUP.  If this group does not exist, all users are
697     allowed to run CVS admin.  To disable the CVS admin command for
698     all users, create an empty CVS_ADMIN_GROUP by running configure
699     with the --with-cvs-admin-group= option.  To disable access control
700     for CVS admin, run configure with the --without-cvs-admin-group
701     option in order to comment out the define below.])
702fi
703
704dnl
705dnl Done setting CVS Administrator Group
706dnl
707
708dnl
709dnl end --with-*
710dnl
711
712
713dnl
714dnl Set the NDBM library to use.
715dnl
716dnl XXX - FIXME - FIXME - FIXME - XXX
717dnl
718dnl This is very bad.  It should really autodetect an appropriate NDBM library
719dnl and, if it doesn't find one, decide to use MY_NDBM.  I'm am defining
720dnl this here since this is no worse than it worked when it was in options.h
721dnl and I am cleaning out options.h so that the Windows version of CVS will
722dnl compile properly for the next release.
723dnl
724dnl That's why this option is in the --with-* section rather than the
725dnl --enable-* section.
726dnl
727dnl XXX - FIXME - FIXME - FIXME - XXX
728dnl
729AC_ARG_ENABLE(
730  [cvs-ndbm],
731  AC_HELP_STRING(
732    [--enable-cvs-ndbm],
733    [Use the NDBM library distributed with CVS rather than attempting to use
734     a system NDBM library.  Disabling this may not work.  (default)]), ,
735  [enable_cvs_ndbm=yes])
736if test no != "$enable_cvs_ndbm"; then
737  AC_DEFINE(
738    [MY_NDBM], [1],
739    [By default, CVS stores its modules and other such items in flat
740     text files (MY_NDBM enables this).  Turning off MY_NDBM causes CVS
741     to look for a system-supplied ndbm database library and use it
742     instead.  That may speed things up, but the default setting
743     generally works fine too.])
744fi
745
746dnl
747dnl Done selecting NDBM library.
748dnl
749
750
751dnl
752dnl begin --enables
753dnl
754
755
756dnl Allow mmap for the buffer routine replacements to be disabled in
757dnl case of problems.
758
759AC_ARG_ENABLE(
760  [mmap],
761  AC_HELP_STRING(
762    [--disable-mmap],
763    [Don't mmap RCS files]))
764
765if test no != "$enable_mmap"; then
766  AC_FUNC_MMAP
767fi
768
769# Check for options requesting client and server feature. If none are
770# given and we have connect(), we want the full client & server arrangement.
771AC_ARG_ENABLE(
772  [client],
773  AC_HELP_STRING(
774    [--enable-client],
775    [Include code for running as a remote client (default)]), ,
776  [if test "$ac_cv_search_connect" != no; then
777    enable_client=yes
778  fi])
779if test no != "$enable_client"; then
780  AC_DEFINE(
781    [CLIENT_SUPPORT], [1],
782    [Define if you want CVS to be able to be a remote repository client.])
783fi
784
785AC_ARG_ENABLE(
786  [password-authenticated-client],
787  AC_HELP_STRING(
788    [--enable-password-authenticated-client],
789    [Enable pserver as a remote access method in the CVS client
790     (default)]))
791
792if test no != "$enable_password_authenticated_client"; then
793  if test no != "$enable_client"; then
794    AC_DEFINE(
795      [AUTH_CLIENT_SUPPORT], [1],
796      [Enable AUTH_CLIENT_SUPPORT to enable pserver as a remote access
797       method in the CVS client (default)])
798  else
799    AC_MSG_WARN(
800      [--enable-password-authenticated-client is meaningless with
801       the CVS client disabled (--disable-client)])
802  fi
803fi
804
805
806dnl
807dnl Give the confiscator control over whether the server code is compiled
808dnl
809AC_ARG_ENABLE(
810  [server],
811  AC_HELP_STRING(
812    [--enable-server],
813    [Include code for running as a server (default)]), ,
814  [if test "$ac_cv_search_connect" != no; then
815     enable_server=yes
816   fi])
817
818if test no != "$enable_server"; then
819  AC_DEFINE(
820    [SERVER_SUPPORT], [1],
821    [Define if you want CVS to be able to serve repositories to remote
822     clients.])
823
824  dnl
825  dnl The auth server needs to be able to check passwords against passwd
826  dnl file entries, so we only #define AUTH_SERVER_SUPPORT if we can
827  dnl find the crypt function. 
828  dnl
829  AC_SEARCH_LIBS(
830    [crypt], [crypt],
831    [AC_DEFINE(
832       [HAVE_CRYPT], [1],
833       [Define if you have the crypt function.])
834     AC_DEFINE(
835       [AUTH_SERVER_SUPPORT], [1],
836       [Define if you want to use the password authenticated server.])dnl
837  ])dnl AC_SEARCH_LIBS
838
839  dnl
840  dnl Allow the configurer to enable server flowcontrol.  Read the help
841  dnl strings below for a full explanation.
842  dnl
843  AC_ARG_ENABLE(
844    [server-flow-control],
845    AC_HELP_STRING(
846      [--enable-server-flow-control],
847      [If you are working with a large remote repository and a 'cvs
848       checkout' is swamping your network and memory, define these to
849       enable flow control.  You may optionally pass a low water mark
850       in bytes and a high water mark in bytes, separated by commas.
851       (default is enabled 1M,2M)]),
852    [if test yes = $enable_server_flow_control; then
853       enable_server_flow_control=1M,2M
854     fi],
855    [enable_server_flow_control=1M,2M])
856  if test no != $enable_server_flow_control; then
857    ccvs_lwm=`expr "$enable_server_flow_control" : '\(.*\),'`
858    ccvs_hwm=`expr "$enable_server_flow_control" : '.*,\(.*\)'`
859    ccvs_lwm_E=`expr "$ccvs_lwm" : '[[0-9]][[0-9]]*\(.*\)'`
860    ccvs_lwm=`expr "$ccvs_lwm" : '\([[0-9]][[0-9]]*\)'`
861    test "" != "$ccvs_lwm" || ccvs_lwm_E="?"
862    case $ccvs_lwm_E in
863        G) ccvs_lwm="$ccvs_lwm * 1024 * 1024 * 1024";;
864        M) ccvs_lwm="$ccvs_lwm * 1024 * 1024";;
865        k) ccvs_lwm="$ccvs_lwm * 1024";;
866        b | '') ;;
867        *) AC_MSG_ERROR([Can't parse argument to --enable-server-flow-control
868                        ('$enable_server_flow_control') as <lwm>,<hwm>])
869      esac
870    ccvs_hwm_E=`expr "$ccvs_hwm" : '[[0-9]][[0-9]]*\(.*\)'`
871    ccvs_hwm=`expr "$ccvs_hwm" : '\([[0-9]][[0-9]]*\).*'`
872    test "" != "$ccvs_hwm" || ccvs_hwm_E="?"
873    case $ccvs_hwm_E in
874        G) ccvs_hwm="$ccvs_hwm * 1024 * 1024 * 1024";;
875        M) ccvs_hwm="$ccvs_hwm * 1024 * 1024";;
876        k) ccvs_hwm="$ccvs_hwm * 1024";;
877        b | '') ccvs_hwm="$ccvs_hwm";;
878        *) AC_MSG_ERROR([Can't parse argument to --enable-server-flow-control
879                        ('$enable_server_flow_control') as <lwm>,<hwm>])
880      esac
881
882    AC_DEFINE(
883      [SERVER_FLOWCONTROL], [1],
884      [If you are working with a large remote repository and a 'cvs
885       checkout' is swamping your network and memory, define these to
886       enable flow control.  You will end up with even less probability of
887       a consistent checkout (see Concurrency in cvs.texinfo), but CVS
888       doesn't try to guarantee that anyway.  The master server process
889       will monitor how far it is getting behind, if it reaches the high
890       water mark, it will signal the child process to stop generating
891       data when convenient (ie: no locks are held, currently at the
892       beginning of a new directory).  Once the buffer has drained
893       sufficiently to reach the low water mark, it will be signalled to
894       start again.])
895    AC_DEFINE_UNQUOTED(
896      [SERVER_LO_WATER], [($ccvs_lwm)],
897      [The low water mark in bytes for server flow control.  Required if
898       SERVER_FLOWCONTROL is defined, and useless otherwise.])
899    AC_DEFINE_UNQUOTED(
900      [SERVER_HI_WATER], [($ccvs_hwm)],
901      [The high water mark in bytes for server flow control.  Required if
902       SERVER_FLOWCONTROL is defined, and useless otherwise.])
903  fi # enable_server_flow_control
904fi # enable_server
905
906
907dnl
908dnl begin --enable-case-sensitivity
909dnl
910
911AC_ARG_ENABLE(
912  [case-sensitivity],
913  AC_HELP_STRING(
914    [--enable-case-sensitivity],
915    [Force CVS to expect a case sensitive file system.  Enabling this on a case
916     insensitive system should have little effect on the server or client
917     operation, though client users may ocassionally be suprised that the CVS
918     server appears to be case sensitive.  Disabling this for a case sensitive
919     server disables server support for case insensitive clients, which can
920     confuse all users of case insensitive clients contacting the server.
921     Disabling this for a case sensitive client will cause the client to ask
922     servers to behave case insensitively, which could cause confusion for
923     users, but also probably no real harm.  (default autoselects based on the
924     case sensitivity of the file system containing the current working
925     directory)]),
926    [case "$enable_case_sensitivity" in
927       yes | no | auto) ;;
928       *)
929          AC_MSG_ERROR([Unrecognized argument to --enable-case-sensitivity: \`$enable_case_sensitivity'.  Acceptable values are \`yes', \`no', and \`auto'.])
930          ;;
931     esac],
932  [enable_case_sensitivity=auto])
933
934acx_forced=' (forced)'
935AC_MSG_CHECKING([for a case sensitive file system])
936if test $enable_case_sensitivity = auto; then
937  dnl
938  dnl Check for a case insensitive filesystem, like Mac OS X and Windows have.
939  dnl
940  AC_CACHE_VAL([acx_cv_case_sensitive],
941  [ rm -f ac_TEST_filenames_CASE_sensitive
942    echo foo >ac_test_filenames_case_sensitive
943    if test -f ac_TEST_filenames_CASE_sensitive; then
944      acx_cv_case_sensitive=no
945    else
946      acx_cv_case_sensitive=yes
947    fi
948    rm ac_test_filenames_case_sensitive
949  ])
950  enable_case_sensitivity=$acx_cv_case_sensitive
951  acx_forced=
952fi
953AC_MSG_RESULT([$enable_case_sensitivity$acx_forced])
954if test $enable_case_sensitivity = no; then
955  AC_DEFINE([FILENAMES_CASE_INSENSITIVE], [1],
956            [Define if this executable will be running on case insensitive
957             file systems.  In the client case, this means that it will request
958             that the server pretend to be case insensitive if it isn't
959             already.])
960  dnl Compile fncase.c (containing fncase() & fncmp()) to handle file name
961  dnl comparisons on case insensitive filesystems.
962  AC_LIBOBJ(fncase)
963fi
964
965dnl
966dnl end --enable-case-sensitivity
967dnl
968
969
970dnl
971dnl begin --enable-encryption
972dnl
973
974dnl
975dnl Use --enable-encryption to turn on encryption support, but ignore this
976dnl option unless either client or server is enabled.
977dnl
978AC_ARG_ENABLE(
979  [encryption],
980  AC_HELP_STRING(
981    [--enable-encryption],
982    [Enable encryption support (disabled by default)]), ,
983  [enable_encryption=no])
984if test "$enable_encryption" = yes; then
985  if test no != "$with_client" || test no != "$with_server"; then
986    AC_DEFINE(
987      [ENCRYPTION], [1],
988      [Define to enable encryption support.])
989  else
990    AC_MSG_WARN(
991      [--enable-encryption is meaningless when neither the CVS client
992       nor the CVS server is enabled (--disable-client and --disable-server).])
993  fi
994fi
995
996dnl
997dnl end --enable-encryption
998dnl
999
1000
1001dnl
1002dnl begin --enable-force-editor
1003dnl
1004
1005AC_ARG_ENABLE(
1006  [force-editor],
1007  AC_HELP_STRING(
1008    [--enable-force-editor],
1009    [When committing or importing files, you must enter a log message.
1010     Normally, you can do this either via the -m flag on the command
1011     line, the -F flag on the command line, or an editor will be started
1012     for you.  If you like to use logging templates (the rcsinfo file
1013     within the $CVSROOT/CVSROOT directory), you might want to force
1014     people to use the editor even if they specify a message with -m or
1015     -F.  --enable-force-editor will cause the -m or -F message to be
1016     appended to the temp file when the editor is started. (disabled
1017     by default)]), ,
1018  [enable_force_editor=no])
1019
1020if test yes = "$enable_force_editor"; then
1021  AC_DEFINE(
1022    [FORCE_USE_EDITOR], [1],
1023    [When committing or importing files, you must enter a log message.
1024    Normally, you can do this either via the -m flag on the command
1025    line, the -F flag on the command line, or an editor will be started
1026    for you.  If you like to use logging templates (the rcsinfo file
1027    within the $CVSROOT/CVSROOT directory), you might want to force
1028    people to use the editor even if they specify a message with -m or
1029    -F.  Enabling FORCE_USE_EDITOR will cause the -m or -F message to be
1030    appended to the temp file when the editor is started.])
1031fi
1032
1033dnl
1034dnl end --enable-force-editor
1035dnl
1036
1037
1038dnl
1039dnl begin --enable-rootcommit
1040dnl
1041
1042dnl
1043dnl I don't like this here, but I don't really like options.h, either.
1044dnl Besides, this is causing some problems currently when compiling under
1045dnl Windows and moving it here should avoid the issue (the wrong options.h
1046dnl is being used).
1047dnl
1048dnl I don't like making this a runtime option either.  I think I just don't
1049dnl like making it easy to get to, but putting it here goes along with the
1050dnl Autoconf ideal.
1051dnl
1052AC_ARG_ENABLE(
1053  [rootcommit],
1054  AC_HELP_STRING(
1055    [--enable-rootcommit],
1056    [Allow the root user to commit files (disabled by default)]), ,
1057  [enable_rootcommit=no])
1058if test "$enable_rootcommit" = no; then
1059  AC_DEFINE(
1060    [CVS_BADROOT], [1],
1061    [When committing a permanent change, CVS and RCS make a log entry of
1062     who committed the change.  If you are committing the change logged
1063     in as "root" (not under "su" or other root-priv giving program),
1064     CVS/RCS cannot determine who is actually making the change.
1065
1066     As such, by default, CVS prohibits changes committed by users
1067     logged in as "root".  You can disable checking by passing the
1068     "--enable-rootcommit" option to configure or by commenting out the
1069     lines below.])
1070fi
1071
1072dnl
1073dnl end --enable-rootcommit
1074dnl
1075
1076
1077
1078dnl
1079dnl end --enable-*
1080dnl
1081
1082
1083
1084dnl For the moment we will assume that all systems which have
1085dnl the unixyness to run configure are unixy enough to do the
1086dnl PreservePermissions stuff.  I have this sinking feeling that
1087dnl things won't be that simple, before long.
1088dnl AC_DEFINE(PRESERVE_PERMISSIONS_SUPPORT, 1,
1089dnl [Define if this system supports chown(), link(), and friends.])
1090
1091dnl On cygwin32, we configure like a Unix system, but we need some support
1092dnl libraries.  We do this at the end so that the new libraries are added at
1093dnl the end of LIBS.
1094dnl
1095dnl FIXME: We should be trying to meet the autoconf ideal of checking for
1096dnl the properties of the system rather than the name of the os here.  In other
1097dnl words, we should check the case sensitivty of the system and then for
1098dnl the support functions we are using and which library we find them in.
1099AC_CACHE_CHECK(for cygwin32, ccvs_cv_sys_cygwin32,
1100[AC_TRY_COMPILE([], [return __CYGWIN32__;],
1101ccvs_cv_sys_cygwin32=yes, ccvs_cv_sys_cygwin32=no)])
1102if test $ccvs_cv_sys_cygwin32 = yes; then
1103  LIBS="$LIBS -ladvapi32"
1104
1105  dnl On Windows you can only change file times if you can write to
1106  dnl the file.  cygwin32 should really handle this for us, but as of
1107  dnl January 1998 it doesn't.
1108  AC_DEFINE(UTIME_EXPECTS_WRITABLE, 1,
1109[Define if utime requires write access to the file (true on Windows,
1110but not Unix).])
1111
1112  dnl On Windows we must use setmode to change between binary and text
1113  dnl mode.  This probably doesn't really require two macro definitions
1114  AC_DEFINE(USE_SETMODE_STDOUT, 1,
1115[Define if setmode is required when writing binary data to stdout.])
1116  AC_DEFINE(HAVE_SETMODE, 1,
1117[Define if the diff library should use setmode for binary files.])
1118fi
1119
1120dnl associate the setting of the execute bit with the individual scripts
1121AC_CONFIG_FILES(contrib/check_cvs, [chmod +x contrib/check_cvs])
1122AC_CONFIG_FILES(contrib/clmerge, [chmod +x contrib/clmerge])
1123AC_CONFIG_FILES(contrib/cln_hist, [chmod +x contrib/cln_hist])
1124AC_CONFIG_FILES(contrib/commit_prep, [chmod +x contrib/commit_prep])
1125AC_CONFIG_FILES(contrib/cvs_acls, [chmod +x contrib/cvs_acls])
1126AC_CONFIG_FILES(contrib/log, [chmod +x contrib/log])
1127AC_CONFIG_FILES(contrib/log_accum, [chmod +x contrib/log_accum])
1128AC_CONFIG_FILES(contrib/mfpipe, [chmod +x contrib/mfpipe])
1129AC_CONFIG_FILES(contrib/pvcs2rcs, [chmod +x contrib/pvcs2rcs])
1130AC_CONFIG_FILES(contrib/rcs2log:contrib/rcs2log.sh, [chmod +x contrib/rcs2log])
1131AC_CONFIG_FILES(contrib/rcslock, [chmod +x contrib/rcslock])
1132AC_CONFIG_FILES(contrib/sccs2rcs, [chmod +x contrib/sccs2rcs])
1133AC_CONFIG_FILES(doc/mkman:doc/mkman.pl, [chmod +x doc/mkman])
1134AC_CONFIG_FILES(src/cvsbug, [chmod +x src/cvsbug])
1135AC_CONFIG_FILES(windows-NT/fix-msvc-mak:windows-NT/fix-msvc-mak-head.pl:windows-NT/fix-msvc-mak.pl,
1136                [chmod +x windows-NT/fix-msvc-mak])
1137
1138dnl the bulk files
1139AC_CONFIG_FILES([Makefile \
1140	  contrib/Makefile \
1141	  cvs.spec \
1142	  diff/Makefile \
1143	  doc/Makefile \
1144	  emx/Makefile \
1145	  lib/Makefile \
1146	  man/Makefile \
1147	  os2/Makefile \
1148	  src/Makefile \
1149	  tools/Makefile \
1150	  vms/Makefile \
1151	  windows-NT/Makefile \
1152	  windows-NT/SCC/Makefile \
1153	  zlib/Makefile])
1154
1155dnl and we're done
1156AC_OUTPUT
1157
1158
1159
1160# Report the state of this version of CVS if this is from dev.
1161m4_bmatch(m4_defn([AC_PACKAGE_VERSION]),  [[0-9]*\.[0-9]*\.[0-9]*\.[0-9]],
1162[    cat <<EOF
1163
1164You are about to use an unreleased version of CVS.  Be sure to
1165read the relevant mailing lists, most importantly <info-cvs@nongnu.org>.
1166
1167Below you will find information on the status of this version of CVS.
1168
1169
1170EOF
1171    sed -n '/^\* Status/,$p' $srcdir/BUGS
1172])
1173