1dnl configure.in for cvs
2
3AC_COPYRIGHT(
4[Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
5              1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
6              Free Software Foundation, Inc.
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2, or (at your option)
11any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16GNU General Public License for more details.])
17
18AC_INIT([Concurrent Versions System (CVS)],[1.12.13],
19	[bug-cvs@nongnu.org],[cvs])
20AC_CONFIG_SRCDIR(src/cvs.h)
21AC_CONFIG_AUX_DIR(build-aux)
22AM_INIT_AUTOMAKE([gnu 1.9.2 dist-bzip2 no-define])
23AC_PREREQ(2.59)
24dnl AM_GNU_GETTEXT_VERSION(0.14.6)
25
26AC_PREFIX_PROGRAM(cvs)
27AM_CONFIG_HEADER(config.h)
28AM_MAINTAINER_MODE
29
30gl_USE_SYSTEM_EXTENSIONS
31
32dnl This needs to be called to enable certain system extensions before calling
33dnl a C compiler.
34gl_EARLY
35
36AC_PROG_CC
37AM_PROG_CC_C_O
38
39# Find the posix library needed on INTERACTIVE UNIX (ISC)
40dnl
41dnl From the Autoconf 2.53 manual (AC_ISC_POSIX):
42dnl
43dnl  For INTERACTIVE UNIX (ISC), add `-lcposix' to output variable
44dnl  `LIBS' if necessary for POSIX facilities.  Call this after
45dnl  `AC_PROG_CC' and before any other macros that use POSIX
46dnl  interfaces.  INTERACTIVE UNIX is no longer sold, and Sun says that
47dnl  they will drop support for it on 2006-07-23, so this macro is
48dnl  becoming obsolescent.
49dnl
50AC_SEARCH_LIBS([strerror], [cposix])
51
52dnl
53dnl Autoconf stopped setting $ISC sometime before 2.53
54dnl
55dnl If this is still important, someone should come up with a generic test
56dnl for whether _SYSV3 needs to be defined.  Removed code below:
57dnl
58dnl if test "$ISC" = yes; then
59dnl CFLAGS="$CFLAGS -D_SYSV3"
60dnl # And I don't like this...  In theory it should be found later if server is
61dnl # enabled, but maybe something on INTERACTIVE UNIX (ISC) we didn't ask to
62dnl # link with crypt tries?  Anyhow, the autoconf manual says we can delete
63dnl # this ISC stuff on or after 2006-07-23 when Sun discontinues support and
64dnl # ISC becomes obsolescent, but I suppose that is probably a matter of
65dnl # opinion.
66dnl #
67dnl # N.B.  The reason for doing this is that some moron decided to put a stub
68dnl # for crypt in libc that always returns NULL.  Without this here, the later
69dnl # check will find the stub instead of the real thing, resulting in a server
70dnl # that can't process crypted passwords correctly.
71dnl
72dnl # again, if we have to try and reenable this for ISC, someone should come
73dnl # up with a generic test that figures out whether crypt is good or not -
74dnl # Is it always returning NULL?
75dnl LIBS="-lcrypt $LIBS"
76dnl fi
77dnl
78dnl FIXME - This has been broken for at least a few months anyhow, so I'm
79dnl removing the crypt lib define above, but the correct fix would be to
80dnl provide a CRYPT_WORKS macro or the like that gets called sometime after
81dnl the AC_SEARCH_LIBS call that normally finds crypt, and if crypt doesn't
82dnl work, the macro should be retried with LIBS="-lcrypt $LIBS" forced.
83dnl
84
85AC_PROG_RANLIB
86AC_PROG_LN_S
87AC_SYS_LARGEFILE
88AC_EXEEXT
89
90AC_PATH_PROG(PERL, perl, no)
91AC_PATH_PROG(CSH, csh, no)
92# for contrib/rcs2log.sh & src/cvsbug.in.
93AC_PATH_PROG(MKTEMP, mktemp, mktemp)
94if test x"$MKTEMP" = xmktemp; then
95	MKTEMP_SH_FUNCTION=$srcdir/mktemp.sh
96else
97	MKTEMP_SH_FUNCTION=/dev/null
98fi
99AC_SUBST_FILE(MKTEMP_SH_FUNCTION)
100# for src/cvsbug.in
101AC_PATH_PROG(SENDMAIL, sendmail, no, [$PATH:/usr/sbin:/usr/lib])
102# For diff/util.c
103AC_PATH_PROG(PR, pr, no)
104if test x"$PR" != xno; then
105	AC_DEFINE_UNQUOTED([PR_PROGRAM], ["$PR"], [Path to the pr utility])
106fi
107
108dnl FIXME This is truly gross.
109missing_dir=`cd $ac_aux_dir && pwd`
110dnl FIXME I pulled this default list from sanity.sh.  Perhaps these lists
111dnl can be stored in one location?
112dnl
113dnl Yeah, put the value in a variable add it to the substitution list
114dnl then have configure create sanity.sh from sanity.sh.in...
115glocs="$PATH:/usr/local/bin:/usr/contrib/bin:/usr/gnu/bin:/local/bin:/local/gnu/bin:/gnu/bin"
116AC_PATH_PROGS(ROFF, groff roff, $missing_dir/missing roff, $glocs)
117AC_PATH_PROG(PS2PDF, ps2pdf, $missing_dir/missing ps2pdf)
118AC_PATH_PROG(TEXI2DVI, texi2dvi, $missing_dir/missing texi2dvi)
119
120AC_SYS_INTERPRETER
121if test X"$ac_cv_sys_interpreter" != X"yes" ; then
122  # silly trick to avoid problems in AC macros...
123  ac_msg='perl scripts using #! may not be invoked properly'
124  AC_MSG_WARN($ac_msg)
125fi
126
127# BSD's logo is a devil for a reason, hey?
128AC_CACHE_CHECK(for BSD VPATH bug in make, ccvs_cv_bsd_make_vpath_bug,
129[if test ! -d ac_test_dir ; then
130	AC_TRY_COMMAND([mkdir ac_test_dir])
131fi
132cat >conftestmake <<EOF
133VPATH = ac_test_dir
134ac_test_target: ac_test_dep
135	echo BSD VPATH bug present >&2
136ac_test_dep: ac_test_dep_dep
137EOF
138touch ac_test_dir/ac_test_dep_dep
139touch ac_test_dir/ac_test_dep
140touch ac_test_target
141# Don't know why, but the following test doesn't work under FreeBSD 4.2
142# without this sleep command
143sleep 1
144if AC_TRY_COMMAND([make -f conftestmake 2>&1 >/dev/null |grep ^BSD\ VPATH\ bug\ present\$ >/dev/null]) ; then
145	ccvs_cv_bsd_make_vpath_bug=yes
146else
147	ccvs_cv_bsd_make_vpath_bug=no
148fi
149AC_TRY_COMMAND([rm -rf ac_test_dir ac_test_target conftestmake])])
150# We also don't need to worry about the bug when $srcdir = $builddir
151AM_CONDITIONAL(MAKE_TARGETS_IN_VPATH, \
152		test $ccvs_cv_bsd_make_vpath_bug = no \
153		|| test $srcdir = .)
154
155AC_HEADER_DIRENT
156AC_HEADER_STDC
157AC_HEADER_SYS_WAIT
158AC_CHECK_HEADERS(\
159	direct.h \
160	fcntl.h \
161	io.h \
162	memory.h \
163	ndbm.h \
164	stdint.h \
165	syslog.h \
166	sys/bsdtypes.h \
167	sys/file.h \
168	sys/param.h \
169	sys/resource.h \
170	sys/select.h \
171	unistd.h \
172	utime.h \
173	zlib.h \
174)
175AC_HEADER_STAT
176
177AC_C_CONST
178AC_TYPE_UID_T
179AC_TYPE_MODE_T
180AC_TYPE_PID_T
181AC_TYPE_SIGNAL
182
183AC_CHECK_MEMBERS([struct stat.st_blksize])
184AC_CHECK_MEMBERS([struct stat.st_rdev])
185
186AC_FUNC_FSEEKO
187if test $ac_cv_func_fseeko = no; then
188    AC_LIBOBJ(fseeko)
189    AC_LIBOBJ(ftello)
190fi
191
192# Replace functions with versions in lib/ when they can't be found.
193AC_REPLACE_FUNCS(\
194	waitpid \
195)
196
197AC_CACHE_CHECK([for getopt optreset variable], db_cv_optreset, [
198AC_TRY_LINK([#include <unistd.h>], extern int optreset; optreset = 1;,
199    [db_cv_optreset=yes], [db_cv_optreset=no])])
200if test "$db_cv_optreset" = "yes"; then
201	AC_DEFINE(HAVE_GETOPT_OPTRESET)
202	AH_TEMPLATE(HAVE_GETOPT_OPTRESET,
203	    [Define to 1 if getopt supports the optreset variable.])
204fi
205
206#
207# Special hack for a SunOS 5.7 (aka Solaris 7) select() problem.
208#
209ccvs_FUNC_SELECT
210
211#
212# Begin GNULIB stuff.
213#
214
215# Look for functions from GNULIB and replace with versions in lib/ when
216# necessary.
217dnl This calls most of the GNULIB macros we need via the
218dnl autogenerated m4/gnulib.m4.
219gl_INIT
220dnl For one reason or another, the autogenerated m4/gnulib.m4 wants
221dnl AM_GNU_GETTEXT([external]) called directly from here.
222dnl AM_GNU_GETTEXT([external])
223dnl AM_GNU_GETTEXT_VERSION dnl work around for autoconf-2.57 bug.
224# The error module still poses merge problems.
225AC_FUNC_STRERROR_R
226dnl The following macros can be called by other GNULIB macros but are also
227dnl used by the UNIQUE_*_TYPE stuff below.  I don't want to rely on the GNULIB
228dnl macros which call these to continue to do so, so use AC_REQUIRE, which can
229dnl only be called from within another macro, to only call them only once.
230AC_DEFUN([CCVS_CALL_GNULIB_MACROS_ONCE],
231[AC_REQUIRE([gt_TYPE_LONGDOUBLE])
232AC_REQUIRE([gt_TYPE_WCHAR_T])
233AC_REQUIRE([gt_TYPE_WINT_T])
234AC_REQUIRE([gl_AC_TYPE_INTMAX_T])
235AC_REQUIRE([gl_FUNC_MMAP_ANON])
236AC_REQUIRE([gl_AC_TYPE_LONG_LONG])])
237CCVS_CALL_GNULIB_MACROS_ONCE()
238dnl Until I persuade the GNULIB folks to integrate this module.
239gl_GLOB
240
241#
242# End GNULIB stuff.
243#
244
245
246
247# Check for function existance.
248AC_CHECK_FUNCS(\
249	fchdir \
250	fchmod \
251	fsync \
252	ftime \
253	geteuid \
254	getgroups \
255	getpagesize \
256	gettimeofday \
257	initgroups \
258	login \
259	logout \
260	mknod \
261	regcomp \
262	regerror \
263	regexec \
264	regfree \
265	sigaction \
266	sigblock \
267	sigprocmask \
268	sigsetmask \
269	sigvec \
270	timezone \
271	tzset \
272	vprintf \
273	wait3 \
274)
275
276dnl
277dnl Find the sizes of various types and set a variable for some if they
278dnl are "unique", meaning it does not share a size with a lower precedence
279dnl type.
280dnl
281dnl also, I snagged this cross_compiling line from openldap's autoconf,
282dnl because I can't figure out how to stop autoconf from giving cross compiler
283dnl related warnings each time the AC_CHECK_SIZEOF function is run
284dnl
285if test $cross_compiling = yes ; then
286	AC_DEFINE(CROSS_COMPILING, 1, [define if cross compiling])
287else
288	AC_CHECK_SIZEOF(char)
289	AC_CACHE_CHECK(for uniquely sized char,
290		ccvs_cv_unique_int_type_char,
291		[if set |grep ^ccvs_cv_unique_int_type_ \
292			|grep "($ac_cv_sizeof_char)" >/dev/null ; then
293			ccvs_cv_unique_int_type_char=no
294		else
295			ccvs_cv_unique_int_type_char=yes\($ac_cv_sizeof_char\)
296		fi])
297	if test $ccvs_cv_unique_int_type_char != no ; then
298		AC_DEFINE( UNIQUE_INT_TYPE_CHAR, 1,
299                           [Define if char is the first integer type
300		            detected with its size.])
301	fi
302	AC_CHECK_SIZEOF(short)
303	AC_CACHE_CHECK(for uniquely sized short,
304		ccvs_cv_unique_int_type_short,
305		[if set |grep ^ccvs_cv_unique_int_type_ \
306			|grep "($ac_cv_sizeof_short)" >/dev/null ; then
307			ccvs_cv_unique_int_type_short=no
308		else
309			ccvs_cv_unique_int_type_short=yes\($ac_cv_sizeof_short\)
310		fi])
311	if test $ccvs_cv_unique_int_type_short != no ; then
312		AC_DEFINE( UNIQUE_INT_TYPE_SHORT, 1,
313                           [Define if short is the first integer type
314		            detected with its size.])
315	fi
316	AC_CHECK_SIZEOF(int)
317	AC_CACHE_CHECK(for uniquely sized int,
318		ccvs_cv_unique_int_type_int,
319		[if set |grep ^ccvs_cv_unique_int_type_ \
320			|grep "($ac_cv_sizeof_int)" >/dev/null ; then
321			ccvs_cv_unique_int_type_int=no
322		else
323			ccvs_cv_unique_int_type_int=yes\($ac_cv_sizeof_int\)
324		fi])
325	if test $ccvs_cv_unique_int_type_int != no ; then
326		AC_DEFINE( UNIQUE_INT_TYPE_INT, 1,
327                           [Define if int is the first integer type
328		            detected with its size.])
329	fi
330	AC_CHECK_SIZEOF(long)
331	AC_CACHE_CHECK(for uniquely sized long,
332		ccvs_cv_unique_int_type_long,
333		[if set |grep ^ccvs_cv_unique_int_type_ \
334			|grep "($ac_cv_sizeof_long)" >/dev/null ; then
335			ccvs_cv_unique_int_type_long=no
336		else
337			ccvs_cv_unique_int_type_long=yes\($ac_cv_sizeof_long\)
338		fi])
339	if test $ccvs_cv_unique_int_type_long != no ; then
340		AC_DEFINE(UNIQUE_INT_TYPE_LONG, 1,
341                          [Define if long int is the first integer type
342		           detected with its size.])
343	fi
344	if test $ac_cv_type_long_long != no; then
345		AC_CHECK_SIZEOF(long long)
346		AC_CACHE_CHECK(for uniquely sized long long,
347			ccvs_cv_unique_int_type_long_long,
348			[if set |grep ^ccvs_cv_unique_int_type_ \
349				|grep "($ac_cv_sizeof_long_long)" >/dev/null ; then
350				ccvs_cv_unique_int_type_long_long=no
351			else
352				ccvs_cv_unique_int_type_long_long=yes\($ac_cv_sizeof_long_long\)
353			fi])
354		if test $ccvs_cv_unique_int_type_long_long != no ; then
355			AC_DEFINE(UNIQUE_INT_TYPE_LONG_LONG, 1,
356				  [Define if long long is the first integer type
357				   detected with its size.])
358		fi
359	fi
360	AC_CHECK_SIZEOF(size_t)
361	AC_CACHE_CHECK(for uniquely sized size_t,
362		ccvs_cv_unique_int_type_size_t,
363		[if set |grep ^ccvs_cv_unique_int_type_ \
364			|grep "($ac_cv_sizeof_size_t)" >/dev/null ; then
365			ccvs_cv_unique_int_type_size_t=no
366		else
367			ccvs_cv_unique_int_type_size_t=yes\($ac_cv_sizeof_size_t\)
368		fi])
369	if test $ccvs_cv_unique_int_type_size_t != no ; then
370		AC_DEFINE(UNIQUE_INT_TYPE_SIZE_T, 1,
371                          [Define if size_t is the first integer type
372		           detected with its size.])
373	fi
374	AC_CHECK_SIZEOF(ptrdiff_t)
375	AC_CACHE_CHECK(for uniquely sized ptrdiff_t,
376		ccvs_cv_unique_int_type_ptrdiff_t,
377		[if set |grep ^ccvs_cv_unique_int_type_ \
378			|grep "($ac_cv_sizeof_ptrdiff_t)" >/dev/null ; then
379			ccvs_cv_unique_int_type_ptrdiff_t=no
380		else
381			ccvs_cv_unique_int_type_ptrdiff_t=yes\($ac_cv_sizeof_ptrdiff_t\)
382		fi])
383	if test $ccvs_cv_unique_int_type_ptrdiff_t != no ; then
384		AC_DEFINE(UNIQUE_INT_TYPE_PTRDIFF_T, 1,
385                          [Define if ptrdiff_t is the first integer type
386		           detected with its size.])
387	fi
388	if test $gt_cv_c_wint_t != no; then
389		AC_CHECK_SIZEOF(wint_t, [], [[#include <stdio.h>
390#include <wchar.h>
391]])
392		AC_CACHE_CHECK(for uniquely sized wint_t,
393			ccvs_cv_unique_int_type_wint_t,
394			[if set |grep ^ccvs_cv_unique_int_type_ \
395				|grep "($ac_cv_sizeof_wint_t)" >/dev/null ; then
396				ccvs_cv_unique_int_type_wint_t=no
397			else
398				ccvs_cv_unique_int_type_wint_t=yes\($ac_cv_sizeof_wint_t\)
399			fi])
400		if test $ccvs_cv_unique_int_type_wint_t != no ; then
401			AC_DEFINE( UNIQUE_INT_TYPE_WINT_T, 1,
402				   [Define if wint_t is the first integer type
403				    detected with its size.])
404		fi
405	fi
406	if test $gt_cv_c_intmax_t != no; then
407		AC_CHECK_SIZEOF(intmax_t, [], [[#include <stdio.h>
408#ifdef HAVE_INTTYPES_H
409#include <inttypes.h>
410#else
411#ifdef HAVE_STDINT_H
412#include <stdint.h>
413#endif
414#endif
415]])
416		AC_CACHE_CHECK(for uniquely sized intmax_t,
417			ccvs_cv_unique_int_type_intmax_t,
418			[if set |grep ^ccvs_cv_unique_int_type_ \
419				|grep "($ac_cv_sizeof_intmax_t)" >/dev/null ; then
420				ccvs_cv_unique_int_type_intmax_t=no
421			else
422				ccvs_cv_unique_int_type_intmax_t=yes\($ac_cv_sizeof_intmax_t\)
423			fi])
424		if test $ccvs_cv_unique_int_type_intmax_t != no ; then
425			AC_DEFINE( UNIQUE_INT_TYPE_INTMAX_T, 1,
426                        	   [Define if intmax_t is the first integer type
427			            detected with its size.])
428		fi
429	fi
430
431	dnl
432	dnl and the same for floats...
433	dnl
434	AC_CHECK_SIZEOF(float)
435	AC_CACHE_CHECK(for uniquely sized float,
436		ccvs_cv_unique_float_type_float,
437		[if set |grep ^ccvs_cv_unique_float_type_ \
438			|grep "($ac_cv_sizeof_float)" >/dev/null ; then
439			ccvs_cv_unique_float_type_float=no
440		else
441			ccvs_cv_unique_float_type_float=yes\($ac_cv_sizeof_float\)
442		fi])
443	if test $ccvs_cv_unique_float_type_float != no ; then
444		AC_DEFINE( UNIQUE_FLOAT_TYPE_FLOAT, 1,
445                           [Define if float is the first floating point type
446		            detected with its size.])
447	fi
448	AC_CHECK_SIZEOF(double)
449	AC_CACHE_CHECK(for uniquely sized double,
450		ccvs_cv_unique_float_type_double,
451		[if set |grep ^ccvs_cv_unique_float_type_ \
452			|grep "($ac_cv_sizeof_double)" >/dev/null ; then
453			ccvs_cv_unique_float_type_double=no
454		else
455			ccvs_cv_unique_float_type_double=yes\($ac_cv_sizeof_double\)
456		fi])
457	if test $ccvs_cv_unique_float_type_double != no ; then
458		AC_DEFINE( UNIQUE_FLOAT_TYPE_DOUBLE, 1,
459                           [Define if double is the first floating point type
460		            detected with its size.])
461	fi
462	if test $gt_cv_c_long_double != no; then
463		AC_CHECK_SIZEOF(long double)
464		AC_CACHE_CHECK(for uniquely sized long double,
465			ccvs_cv_unique_float_type_long_double,
466			[if set |grep ^ccvs_cv_unique_float_type_ \
467				|grep "($ac_cv_sizeof_long_double)" >/dev/null ; then
468				ccvs_cv_unique_float_type_long_double=no
469			else
470				ccvs_cv_unique_float_type_long_double=yes\($ac_cv_sizeof_long_double\)
471			fi])
472		if test $ccvs_cv_unique_float_type_long_double != no ; then
473			AC_DEFINE(UNIQUE_FLOAT_TYPE_LONG_DOUBLE, 1,
474				  [Define if long double is the first floating point
475				   type detected with its size.])
476		fi
477	fi
478fi
479
480dnl
481dnl The CVS coding standard (as specified in HACKING) is that if it exists
482dnl in SunOS4 and ANSI, we use it.  CVS itself, of course, therefore doesn't
483dnl need HAVE_* defines for such functions, but diff wants them.
484dnl
485AC_DEFINE(HAVE_STRCHR, 1,
486[Define if you have strchr (always for CVS).])
487AC_DEFINE(HAVE_MEMCHR, 1,
488[Define if you have memchr (always for CVS).])
489
490dnl
491dnl Force lib/regex.c to use malloc instead of messing around with alloca
492dnl and define the old re_comp routines that we use.
493dnl
494AC_DEFINE(REGEX_MALLOC, 1,
495[Define to force lib/regex.c to use malloc instead of alloca.])
496AC_DEFINE(_REGEX_RE_COMP, 1,
497[Define to force lib/regex.c to define re_comp et al.])
498dnl
499dnl AC_FUNC_FORK([]) is rather baroque.  It seems to be rather more picky
500dnl than, say, the Single Unix Specification (version 2), which simplifies
501dnl a lot of cases by saying that the child process can't set any variables
502dnl (thus avoiding problems with register allocation) or call any functions
503dnl (thus avoiding problems with whether file descriptors are shared).
504dnl It would be nice if we could just write to the Single Unix Specification.
505dnl I think the only way to do redirection this way is by doing it in the
506dnl parent, and then undoing it afterwards (analogous to windows-NT/run.c).
507dnl That would appear to have a race condition if the user hits ^C (or
508dnl some other signal) at the wrong time, as main_cleanup will try to use
509dnl stdout/stderr.  So maybe we are stuck with AC_FUNC_FORK([]).
510dnl
511AC_FUNC_FORK([])
512AC_FUNC_CLOSEDIR_VOID
513
514dnl
515dnl Check for shadow password support.
516dnl
517dnl We used to try to determine whether shadow passwords were actually in
518dnl use or not, but the code has been changed to work right reguardless,
519dnl so we can go back to a simple check.
520AC_SEARCH_LIBS(getspnam, sec gen, AC_DEFINE(HAVE_GETSPNAM, 1,
521[Define if you have the getspnam function.]))
522
523AC_FUNC_UTIME_NULL
524AC_SYS_LONG_FILE_NAMES
525
526dnl for debugging code
527CVS_FUNC_PRINTF_PTR
528
529# Try to find connect and gethostbyname.
530AC_CHECK_LIB(nsl, main)
531AC_SEARCH_LIBS(connect, xnet socket inet,
532  AC_DEFINE(HAVE_CONNECT, 1,
533[Define if you have the connect function.]))
534dnl no need to search nsl for gethostbyname here since we should have
535dnl just added libnsl above if we found it.
536AC_SEARCH_LIBS(gethostbyname, netinet)
537
538AC_SUBST(cvs_client_objects)
539
540
541dnl
542dnl begin --with-*
543dnl
544
545dnl
546dnl set $(KRB4) from --with-krb4=value -- WITH_KRB4
547dnl
548dnl If you change this, keep in mind that some systems have a bogus
549dnl libkrb in the system libraries, so --with-krb4=value needs to
550dnl override the system -lkrb.
551dnl
552KRB4=/usr/kerberos
553define(WITH_KRB4,[
554AC_ARG_WITH(
555  [krb4],
556  AC_HELP_STRING(
557    [--with-krb4],
558    [Kerberos 4 directory (default /usr/kerberos)]),
559  [KRB4=$with_krb4],
560)dnl
561AC_MSG_CHECKING([for KRB4 in $KRB4])
562AC_MSG_RESULT([])
563AC_SUBST(KRB4)])dnl
564WITH_KRB4
565
566krb_h=
567AC_MSG_CHECKING([for krb.h])
568if test "$cross_compiling" != yes && test -r $KRB4/include/krb.h; then
569   hold_cflags=$CFLAGS
570   CFLAGS="$CFLAGS -I$KRB4/include"
571   AC_TRY_LINK([#include <krb.h>],[int i;],
572          [krb_h=yes krb_incdir=$KRB4/include],
573          [CFLAGS=$hold_cflags
574           AC_TRY_LINK([#include <krb.h>],[int i;],
575             [krb_h=yes krb_incdir=])])
576   CFLAGS=$hold_cflags
577else
578   AC_TRY_LINK([#include <krb.h>],[int i;],
579             [krb_h=yes krb_incdir=])
580fi
581if test -z "$krb_h"; then
582  AC_TRY_LINK([#include <krb.h>],[int i;],
583    [krb_h=yes krb_incdir=],
584    [if test "$cross_compiling" != yes && test -r $KRB4/include/kerberosIV/krb.h; then
585       hold_cflags=$CFLAGS
586       CFLAGS="$CFLAGS -I$KRB4/include/kerberosIV"
587       AC_TRY_LINK([#include <krb.h>],[int i;],
588	 [krb_h=yes krb_incdir=$KRB4/include/kerberosIV])
589       CFLAGS=$hold_cflags
590     fi])
591fi
592AC_MSG_RESULT($krb_h)
593
594if test -n "$krb_h"; then
595  krb_lib=
596  if test "$cross_compiling" != yes && test -r $KRB4/lib/libkrb.a; then
597       hold_ldflags=$LDFLAGS
598       LDFLAGS="-L${KRB4}/lib $LDFLAGS"
599       AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=${KRB4}/lib],
600           [LDFLAGS=$hold_ldflags
601            # Using open here instead of printf so we don't
602            # get confused by the cached value for printf from above.
603            AC_CHECK_LIB(krb,open,[krb_lib=yes krb_libdir=])])
604       LDFLAGS=$hold_ldflags
605  else
606       AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=])
607       AC_CHECK_FUNC(krb_recvauth,[krb_lib=yes krb_libdir=])
608  fi
609  if test -n "$krb_lib"; then
610    AC_DEFINE([HAVE_KERBEROS], 1,
611	      [Define if you have MIT Kerberos version 4 available.])
612    cvs_client_objects="$cvs_client_objects kerberos4-client.o"
613    test -n "${krb_libdir}" && LIBS="${LIBS} -L${krb_libdir}"
614    # Put -L${krb_libdir} in LDFLAGS temporarily so that it appears before
615    # -ldes in the command line.  Don't do it permanently so that we honor
616    # the user's setting for LDFLAGS
617    hold_ldflags=$LDFLAGS
618    test -n "${krb_libdir}" && LDFLAGS="$LDFLAGS -L${krb_libdir}"
619    AC_CHECK_LIB(des,printf,[LIBS="${LIBS} -ldes"])
620    AC_CHECK_LIB(krb,krb_recvauth)
621    AC_CHECK_LIB(krb4,krb_recvauth)
622    LDFLAGS=$hold_ldflags
623    if test -n "$krb_incdir"; then
624      CPPFLAGS="$CPPFLAGS -I$krb_incdir"
625    fi
626  fi
627fi
628AC_CHECK_FUNCS(krb_get_err_text)
629
630
631dnl
632dnl WITH_GSSAPI is external
633dnl
634dnl TODO - I tried to put these in alphabetical order, but ACX_WITH_GSSAPI
635dnl fails unless called after the KRB4 stuff.  I don't know why.
636dnl
637ACX_WITH_GSSAPI
638
639dnl
640dnl WITH_EXTERNAL_ZLIB is external
641dnl
642dnl ACX_WITH_EXTERNAL_ZLIB
643
644dnl
645dnl begin --with-rsh
646dnl
647dnl Many sites no longer desire the use of "rsh" as the default
648dnl remote shell program. They typically favor "ssh" as the default
649
650# What remote shell transport should our client cvs default to using?
651AC_ARG_WITH(
652  [rsh],
653  AC_HELP_STRING(
654    [--with-rsh],
655    [The default remote shell CVS will use for :ext: transport
656     (default ssh)]), ,
657  [with_rsh="ssh rsh"])
658
659if test no = "$with_rsh"; then
660  AC_MSG_WARN([Failed to find usable remote shell. Using 'rsh'.])
661  with_rsh=rsh
662elif test yes = "$with_rsh"; then
663  # Make --with-rsh mean the same thing as --with-rsh=rsh
664  with_rsh=rsh
665fi
666
667if echo $with_rsh |grep ^/ >/dev/null; then
668  # If $with_rsh is an absolute path, issue a warning if the executable
669  # doesn't exist or isn't usable, but then trust the user and use it
670  # regardless
671  with_default_rsh=$with_rsh
672  AC_MSG_CHECKING([for a remote shell])
673  if ! test -f $with_rsh \
674      || ! test -x $with_rsh; then
675    # warn the user that they may encounter problems
676    AC_MSG_WARN([$with_rsh is not a path to an executable file])
677  fi
678else
679  # Search for a remote shell
680  AC_CHECK_PROGS([with_default_rsh], [$with_rsh], "rsh")
681fi
682
683AC_DEFINE_UNQUOTED(
684  [RSH_DFLT], ["$with_default_rsh"],
685  [The default remote shell to use, if one does not specify the
686   CVS_RSH environment variable.])
687RSH_DFLT=$with_default_rsh
688AC_SUBST(RSH_DFLT)
689dnl done with finding a default CVS_RSH value
690dnl
691dnl end --with-rsh
692dnl
693
694dnl
695dnl begin --with-editor
696dnl
697dnl Set the default editor to use for log messages
698dnl
699
700AC_ARG_VAR(
701  [EDITOR],
702  [The text editor CVS will use by default for log messages.])
703
704# Let the confiscator request a specific editor
705AC_ARG_WITH(
706  [editor],
707  AC_HELP_STRING(
708    [--with-editor],
709    [The default text editor CVS should use for log messages
710     (default autoselects)]), ,
711  [with_editor=yes])
712
713# If --with-editor was supplied with an argument, let it override $EDITOR from
714# the user's environment.  We need to unset EDITOR here because AC_CHECK_PROGS
715# will let the value of EDITOR ride when it is set rather than searching.  We
716# ignore the --without-editor case since it will be caught below.
717if test -n "$EDITOR" && test yes != $with_editor; then
718  AS_UNSET([EDITOR])
719fi
720
721# Set the default when --with-editor wasn't supplied or when it was supplied
722# without an argument.
723if test yes = $with_editor; then
724  with_editor="vim vi emacs nano pico edit"
725fi
726
727if echo $with_editor |grep ^/ >/dev/null; then
728  # If $with_editor is an absolute path, issue a warning if the executable
729  # doesn't exist or isn't usable, but then trust the user and use it
730  # regardless
731  EDITOR=$with_editor
732  AC_MSG_CHECKING([for an editor])
733  AC_MSG_RESULT([$EDITOR])
734  if ! test -f $with_editor \
735      || ! test -x $with_editor; then
736    # warn the user that they may encounter problems
737    AC_MSG_WARN([\`$with_editor' is not a path to an executable file])
738  fi
739elif test no != "${with_editor}"; then
740  # Search for an editor
741  AC_CHECK_PROGS([EDITOR], [$with_editor], [no])
742    if test no = "${EDITOR}"; then
743      AC_MSG_ERROR([
744    Failed to find a text file editor.  CVS cannot be compiled
745    without a default log message editor.  Searched for
746    \`$with_editor'.  Try \`configure --with-editor'.])
747    fi
748else
749  AC_MSG_ERROR([
750    CVS cannot be compiled without a default log message editor.
751    Try \`configure --with-editor'.])
752fi
753
754dnl FIXME - Using --without-editor will probably break a compile at
755dnl the moment, but maybe it is reasonable for someone to want to
756dnl compile a CVS executable that refuses to run if no $EDITOR,
757dnl $CVS_EDITOR, or -e option is specified?  Making a preliminary
758dnl design decision in this direction, subject to discussion.
759dnl
760dnl Still don't know if the above would be useful, but we shouldn't
761dnl be able to get here any longer without $EDITOR defined due to the
762dnl error checking above.
763AC_DEFINE_UNQUOTED(
764  [EDITOR_DFLT], ["$EDITOR"],
765  [The default editor to use, if one does not specify the "-e" option
766   to cvs, or does not have an EDITOR environment variable.  If this
767   is not set to an absolute path to an executable, use the shell to
768   find where the editor actually is.  This allows sites with
769   /usr/bin/vi or /usr/ucb/vi to work equally well (assuming that their
770   PATH is reasonable).])
771
772dnl
773dnl done finding an editor
774dnl
775dnl end --with-editor
776dnl
777
778
779
780dnl
781dnl --with-hardcoded-pam-service-name
782dnl
783AC_ARG_WITH(
784  [hardcoded-pam-service-name],
785  AC_HELP_STRING(
786    [--with-hardcoded-pam-service-name],
787    [Use this to hard code a service name for PAM CVS authentication.  The
788     special name, `program_name', will cause CVS to use whatever name it
789     was invoked as as the service name.  (defaults to `cvs')]),,
790    [with_hardcoded_pam_service_name=cvs])
791
792if test "x$with_hardcoded_pam_service_name" = xno ||
793   test "x$with_hardcoded_pam_service_name" = xprogram_name; then
794  AC_DEFINE([PAM_SERVICE_NAME], [program_name],
795    [Define to set a service name for PAM.  This must be defined.  Define to
796     `program_name', without the quotes, to use whatever name CVS was invoked
797      as.  Otherwise, define to a double-quoted literal string, such as
798      `"cvs"'.])
799else
800  if test x"$with_hardcoded_pam_service_name" = xyes; then
801    with_hardcoded_pam_service_name=cvs
802  fi
803  AC_DEFINE_UNQUOTED([PAM_SERVICE_NAME], ["$with_hardcoded_pam_service_name"])
804fi
805
806
807
808dnl
809dnl Find a temporary directory
810dnl
811AC_ARG_WITH(
812  [tmpdir],
813  AC_HELP_STRING(
814    [--with-tmpdir],
815    [The temporary directory CVS should use as a default
816     (default autoselects)]))
817
818AC_MSG_CHECKING([for temporary directory])
819if test -z "$with_tmpdir" || test yes = "$with_tmpdir"; then
820  for with_tmpdir in /tmp /var/tmp no; do
821    if test -d "$with_tmpdir" && test -x "$with_tmpdir" \
822        && test -w "$with_tmpdir" && test -r "$with_tmpdir"; then
823      break
824    fi
825  done
826  if test no = "$with_tmpdir"; then
827    AC_MSG_WARN([Failed to find usable temporary directory.  Using '/tmp'.])
828    with_tmpdir=/tmp
829  fi
830  AC_MSG_RESULT([$with_tmpdir])
831elif ! echo "$with_tmpdir" |grep '^[[\\/]]'; then
832  AC_MSG_RESULT([$with_tmpdir])
833  AC_MSG_ERROR([--with-tmpdir requires an absolute path.])
834elif ! test -d "$with_tmpdir" || ! test -x "$with_tmpdir" \
835        || ! test -w "$with_tmpdir" || ! test -r "$with_tmpdir"; then
836  AC_MSG_RESULT([$with_tmpdir])
837  AC_MSG_WARN(
838    [User supplied temporary directory ('$with_tmpdir') does not
839     exist or lacks sufficient permissions for read/write.])
840fi
841
842AC_DEFINE_UNQUOTED(
843  [TMPDIR_DFLT], ["$with_tmpdir"],
844  [Directory used for storing temporary files, if not overridden by
845   environment variables or the -T global option.  There should be little
846   need to change this (-T is a better mechanism if you need to use a
847   different directory for temporary files).])
848
849dnl
850dnl done finding tmpdir
851dnl
852
853
854dnl
855dnl Get default umask
856dnl
857
858AC_ARG_WITH(
859  [umask],
860  AC_HELP_STRING(
861    [--with-umask],
862    [Set the umask CVS will use by default in the repository (default 002)]))
863
864if test -z "$with_umask" || test yes = "$with_umask"; then
865  with_umask=002
866elif test no = "$with_umask"; then
867  with_umask=000
868fi
869
870AC_DEFINE_UNQUOTED(
871  [UMASK_DFLT], [$with_umask],
872  [The default umask to use when creating or otherwise setting file or
873   directory permissions in the repository.  Must be a value in the
874   range of 0 through 0777.  For example, a value of 002 allows group
875   rwx access and world rx access; a value of 007 allows group rwx
876   access but no world access.  This value is overridden by the value
877   of the CVSUMASK environment variable, which is interpreted as an
878   octal number.])
879
880dnl
881dnl Done setting default umask
882dnl
883
884dnl
885dnl Set CVS Administrator Group
886dnl
887AC_ARG_WITH(
888  [cvs-admin-group],
889  AC_HELP_STRING(
890    [--with-cvs-admin-group=GROUP],
891    [The CVS admin command is restricted to the members of this group.
892     If this group does not exist, all users are allowed to run CVS admin.
893     To disable the CVS admin command for all users, create an empty group
894     by specifying the --with-cvs-admin-group= option.  To disable access
895     control for CVS admin, run configure with the --without-cvs-admin-group
896     option. (default 'cvsadmin')]), ,
897  [with_cvs_admin_group=cvsadmin])
898
899if test yes = "$with_cvs_admin_group"; then
900  with_cvs_admin_group=cvsadmin
901fi
902if test no != "$with_cvs_admin_group"; then
903  dnl FIXME We should warn if the group doesn't exist
904  AC_DEFINE_UNQUOTED(
905    [CVS_ADMIN_GROUP], ["$with_cvs_admin_group"],
906    [The CVS admin command is restricted to the members of the group
907     CVS_ADMIN_GROUP.  If this group does not exist, all users are
908     allowed to run CVS admin.  To disable the CVS admin command for
909     all users, create an empty CVS_ADMIN_GROUP by running configure
910     with the --with-cvs-admin-group= option.  To disable access control
911     for CVS admin, run configure with the --without-cvs-admin-group
912     option in order to comment out the define below.])
913fi
914
915dnl
916dnl Done setting CVS Administrator Group
917dnl
918
919dnl
920dnl Set the NDBM library to use.
921dnl
922dnl XXX - FIXME - FIXME - FIXME - XXX
923dnl
924dnl This is very bad.  It should really autodetect an appropriate NDBM library
925dnl and, if it doesn't find one, decide to use MY_NDBM.  I'm am defining
926dnl this here since this is no worse than it worked when it was in options.h
927dnl and I am cleaning out options.h so that the Windows version of CVS will
928dnl compile properly for the next release.
929dnl
930dnl That's why this option is in the --with-* section rather than the
931dnl --enable-* section.
932dnl
933dnl XXX - FIXME - FIXME - FIXME - XXX
934dnl
935AC_ARG_ENABLE(
936  [cvs-ndbm],
937  AC_HELP_STRING(
938    [--enable-cvs-ndbm],
939    [Use the NDBM library distributed with CVS rather than attempting to use
940     a system NDBM library.  Disabling this may not work.  (default)]), ,
941  [enable_cvs_ndbm=yes])
942if test no != "$enable_cvs_ndbm"; then
943  AC_DEFINE(
944    [MY_NDBM], [1],
945    [By default, CVS stores its modules and other such items in flat
946     text files (MY_NDBM enables this).  Turning off MY_NDBM causes CVS
947     to look for a system-supplied ndbm database library and use it
948     instead.  That may speed things up, but the default setting
949     generally works fine too.])
950fi
951
952dnl
953dnl Done selecting NDBM library.
954dnl
955
956
957
958dnl
959dnl end --with-*
960dnl
961
962
963dnl
964dnl begin --enables
965dnl
966
967
968dnl
969dnl begin --enable-client
970dnl
971
972# Check for options requesting client and server feature. If none are
973# given and we have connect(), we want the full client & server arrangement.
974AC_ARG_ENABLE(
975  [client],
976  AC_HELP_STRING(
977    [--enable-client],
978    [Include code for running as a remote client (default)]), ,
979  [enable_client=$ac_cv_search_connect])
980if test no != "$enable_client"; then
981  AC_DEFINE(
982    [CLIENT_SUPPORT], [1],
983    [Define if you want CVS to be able to be a remote repository client.])
984fi
985
986dnl
987dnl end --enable-client
988dnl
989
990
991dnl
992dnl begin --enable-password-authenticated-client
993dnl
994AC_ARG_ENABLE(
995  [password-authenticated-client],
996  AC_HELP_STRING(
997    [--enable-password-authenticated-client],
998    [Enable pserver as a remote access method in the CVS client
999     (default)]), ,
1000  [enable_password_authenticated_client=$enable_client])
1001
1002if test xno != "x$enable_password_authenticated_client"; then
1003  if test xno != "x$enable_client"; then
1004    AC_DEFINE(
1005      [AUTH_CLIENT_SUPPORT], [1],
1006      [Enable AUTH_CLIENT_SUPPORT to enable pserver as a remote access
1007       method in the CVS client (default)])
1008  else
1009    AC_MSG_WARN(
1010      [--enable-password-authenticated-client is meaningless with
1011       the CVS client disabled (--disable-client)])
1012  fi
1013fi
1014
1015dnl
1016dnl begin --enable-password-authenticated-client
1017dnl
1018
1019
1020dnl
1021dnl begin --enable-server
1022dnl
1023
1024dnl
1025dnl Give the confiscator control over whether the server code is compiled
1026dnl
1027AC_ARG_ENABLE(
1028  [server],
1029  AC_HELP_STRING(
1030    [--enable-server],
1031    [Include code for running as a server (default)]), ,
1032  [enable_server=$ac_cv_search_connect])
1033
1034if test no != "$enable_server"; then
1035  AC_DEFINE(
1036    [SERVER_SUPPORT], [1],
1037    [Define if you want CVS to be able to serve repositories to remote
1038     clients.])
1039
1040  dnl
1041  dnl The auth server needs to be able to check passwords against passwd
1042  dnl file entries, so we only #define AUTH_SERVER_SUPPORT if we can
1043  dnl find the crypt function. 
1044  dnl
1045  AC_SEARCH_LIBS(
1046    [crypt], [crypt],
1047    [AC_DEFINE(
1048       [HAVE_CRYPT], [1],
1049       [Define if you have the crypt function.])
1050     AC_DEFINE(
1051       [AUTH_SERVER_SUPPORT], [1],
1052       [Define if you want to use the password authenticated server.])dnl
1053  ])dnl AC_SEARCH_LIBS
1054
1055  dnl
1056  dnl Allow the configurer to enable server flowcontrol.  Read the help
1057  dnl strings below for a full explanation.
1058  dnl
1059  AC_ARG_ENABLE(
1060    [server-flow-control],
1061    AC_HELP_STRING(
1062      [--enable-server-flow-control],
1063      [If you are working with a large remote repository and a 'cvs
1064       checkout' is swamping your network and memory, define these to
1065       enable flow control.  You may optionally pass a low water mark
1066       in bytes and a high water mark in bytes, separated by commas.
1067       (default is enabled 1M,2M)]),
1068    [if test yes = $enable_server_flow_control; then
1069       enable_server_flow_control=1M,2M
1070     fi],
1071    [enable_server_flow_control=1M,2M])
1072  if test no != $enable_server_flow_control; then
1073    ccvs_lwm=`expr "$enable_server_flow_control" : '\(.*\),'`
1074    ccvs_hwm=`expr "$enable_server_flow_control" : '.*,\(.*\)'`
1075    ccvs_lwm_E=`expr "$ccvs_lwm" : '[[0-9]][[0-9]]*\(.*\)'`
1076    ccvs_lwm=`expr "$ccvs_lwm" : '\([[0-9]][[0-9]]*\)'`
1077    test "" != "$ccvs_lwm" || ccvs_lwm_E="?"
1078    case $ccvs_lwm_E in
1079        G) ccvs_lwm="$ccvs_lwm * 1024 * 1024 * 1024";;
1080        M) ccvs_lwm="$ccvs_lwm * 1024 * 1024";;
1081        k) ccvs_lwm="$ccvs_lwm * 1024";;
1082        b | '') ;;
1083        *) AC_MSG_ERROR([Can't parse argument to --enable-server-flow-control
1084                        ('$enable_server_flow_control') as <lwm>,<hwm>])
1085      esac
1086    ccvs_hwm_E=`expr "$ccvs_hwm" : '[[0-9]][[0-9]]*\(.*\)'`
1087    ccvs_hwm=`expr "$ccvs_hwm" : '\([[0-9]][[0-9]]*\).*'`
1088    test "" != "$ccvs_hwm" || ccvs_hwm_E="?"
1089    case $ccvs_hwm_E in
1090        G) ccvs_hwm="$ccvs_hwm * 1024 * 1024 * 1024";;
1091        M) ccvs_hwm="$ccvs_hwm * 1024 * 1024";;
1092        k) ccvs_hwm="$ccvs_hwm * 1024";;
1093        b | '') ccvs_hwm="$ccvs_hwm";;
1094        *) AC_MSG_ERROR([Can't parse argument to --enable-server-flow-control
1095                        ('$enable_server_flow_control') as <lwm>,<hwm>])
1096      esac
1097
1098    AC_DEFINE(
1099      [SERVER_FLOWCONTROL], [1],
1100      [If you are working with a large remote repository and a 'cvs
1101       checkout' is swamping your network and memory, define these to
1102       enable flow control.  You will end up with even less probability of
1103       a consistent checkout (see Concurrency in cvs.texinfo), but CVS
1104       doesn't try to guarantee that anyway.  The master server process
1105       will monitor how far it is getting behind, if it reaches the high
1106       water mark, it will signal the child process to stop generating
1107       data when convenient (ie: no locks are held, currently at the
1108       beginning of a new directory).  Once the buffer has drained
1109       sufficiently to reach the low water mark, it will be signalled to
1110       start again.])
1111    AC_DEFINE_UNQUOTED(
1112      [SERVER_LO_WATER], [($ccvs_lwm)],
1113      [The low water mark in bytes for server flow control.  Required if
1114       SERVER_FLOWCONTROL is defined, and useless otherwise.])
1115    AC_DEFINE_UNQUOTED(
1116      [SERVER_HI_WATER], [($ccvs_hwm)],
1117      [The high water mark in bytes for server flow control.  Required if
1118       SERVER_FLOWCONTROL is defined, and useless otherwise.])
1119  fi # enable_server_flow_control
1120fi # enable_server
1121
1122dnl
1123dnl end --enable-server
1124dnl
1125
1126
1127dnl
1128dnl begin --enable-proxy
1129dnl
1130
1131dnl
1132dnl Give the confiscator control over whether the proxy server code is compiled
1133dnl
1134AC_ARG_ENABLE(
1135  [proxy],
1136  AC_HELP_STRING(
1137    [--enable-proxy],
1138    [Include code for running as a transparent proxy server.  Disabling this
1139     may produce a slight performance gain on some systems, at the expense of
1140     write proxy support. (default)]), ,
1141  [if test xno != "x$enable_client" && test xno != "x$enable_server"; then
1142     enable_proxy=yes
1143   else
1144     enable_proxy=no
1145   fi])
1146
1147if test no != "$enable_proxy"; then
1148  if test xno = "x$enable_client" || test xno = "x$enable_server"; then
1149    AC_MSG_WARN(
1150      [--enable-proxy is meaningless when either the CVS client or the
1151       CVS server is disabled (--disable-client and --disable-server).])
1152  else
1153    AC_DEFINE(
1154      [PROXY_SUPPORT], [1],
1155      [Define if you want CVS to be able to serve as a transparent proxy for
1156       write operations.  Disabling this may produce a slight performance gain
1157       on some systems, at the expense of write proxy support.])
1158  fi
1159fi
1160dnl
1161dnl end --enable-proxy
1162dnl
1163
1164
1165dnl
1166dnl begin --enable-pam
1167dnl
1168
1169dnl
1170dnl Check if PAM authentication is enabled
1171dnl
1172AC_ARG_ENABLE(
1173  [pam],
1174  AC_HELP_STRING(
1175    [--enable-pam],
1176    [Use to enable system authentication with PAM instead of using the 
1177    simple getpwnam interface.  This allows authentication (in theory) 
1178    with any PAM module, e.g. on systems with shadow passwords or via LDAP]), ,
1179  [enable_pam=no]
1180  )
1181
1182if test yes = $enable_pam; then
1183  ac_pam_header_available=
1184
1185  AC_CHECK_HEADER([security/pam_appl.h], [
1186    AC_DEFINE([HAVE_SECURITY_PAM_APPL_H], 1, [Define to 1 if security/pam_appl.h is available])
1187    ac_pam_header_available=1])
1188
1189  if test -z "$ac_pam_header_available"; then
1190  AC_CHECK_HEADER([pam/pam_appl.h], [
1191    AC_DEFINE([HAVE_PAM_PAM_APPL_H], 1, [Define to 1 if pam/pam_appl.h is available])
1192    ac_pam_header_available=1])
1193  fi
1194
1195  if test -z "$ac_pam_header_available"; then
1196    AC_MSG_ERROR([Could not find PAM headers])
1197  else
1198    AC_DEFINE(HAVE_PAM, 1, 
1199    [Define to enable system authentication with PAM instead of using the 
1200    simple getpwnam interface.  This allows authentication (in theory) 
1201    with any PAM module, e.g. on systems with shadow passwords or via LDAP])
1202    AC_CHECK_LIB(pam, pam_start, [LIBS="${LIBS} -lpam"],
1203      AC_MSG_ERROR([Could not find PAM libraries but the headers exist.
1204      Give the --disable-pam option to compile without PAM support (or fix
1205      your broken configuration)])
1206    )
1207  fi
1208fi
1209
1210dnl
1211dnl end --enable-pam
1212dnl
1213
1214
1215dnl
1216dnl begin --enable-case-sensitivity
1217dnl
1218
1219AC_ARG_ENABLE(
1220  [case-sensitivity],
1221  AC_HELP_STRING(
1222    [--enable-case-sensitivity],
1223    [Force CVS to expect a case sensitive file system.  Enabling this on a case
1224     insensitive system should have little effect on the server or client
1225     operation, though client users may ocassionally be suprised that the CVS
1226     server appears to be case sensitive.  Disabling this for a case sensitive
1227     server disables server support for case insensitive clients, which can
1228     confuse all users of case insensitive clients contacting the server.
1229     Disabling this for a case sensitive client will cause the client to ask
1230     servers to behave case insensitively, which could cause confusion for
1231     users, but also probably no real harm.  (default autoselects based on the
1232     case sensitivity of the file system containing the current working
1233     directory)]),
1234    [case "$enable_case_sensitivity" in
1235       yes | no | auto) ;;
1236       *)
1237          AC_MSG_ERROR([Unrecognized argument to --enable-case-sensitivity: \`$enable_case_sensitivity'.  Acceptable values are \`yes', \`no', and \`auto'.])
1238          ;;
1239     esac],
1240  [enable_case_sensitivity=auto])
1241
1242acx_forced=' (forced)'
1243AC_MSG_CHECKING([for a case sensitive file system])
1244if test $enable_case_sensitivity = auto; then
1245  dnl
1246  dnl Check for a case insensitive filesystem, like Mac OS X and Windows have.
1247  dnl
1248  AC_CACHE_VAL([acx_cv_case_sensitive],
1249  [ rm -f ac_TEST_filenames_CASE_sensitive
1250    echo foo >ac_test_filenames_case_sensitive
1251    if test -f ac_TEST_filenames_CASE_sensitive; then
1252      acx_cv_case_sensitive=no
1253    else
1254      acx_cv_case_sensitive=yes
1255    fi
1256    rm ac_test_filenames_case_sensitive
1257  ])
1258  enable_case_sensitivity=$acx_cv_case_sensitive
1259  acx_forced=
1260fi
1261AC_MSG_RESULT([$enable_case_sensitivity$acx_forced])
1262if test $enable_case_sensitivity = no; then
1263  AC_DEFINE([FILENAMES_CASE_INSENSITIVE], [1],
1264            [Define if this executable will be running on case insensitive
1265             file systems.  In the client case, this means that it will request
1266             that the server pretend to be case insensitive if it isn't
1267             already.])
1268  dnl Compile fncase.c (containing fncase() & fncmp()) to handle file name
1269  dnl comparisons on case insensitive filesystems.
1270  AC_LIBOBJ(fncase)
1271fi
1272
1273dnl
1274dnl end --enable-case-sensitivity
1275dnl
1276
1277
1278dnl
1279dnl begin --enable-encryption
1280dnl
1281
1282dnl
1283dnl Use --enable-encryption to turn on encryption support, but ignore this
1284dnl option unless either client or server is enabled.
1285dnl
1286AC_ARG_ENABLE(
1287  [encryption],
1288  AC_HELP_STRING(
1289    [--enable-encryption],
1290    [Enable encryption support (disabled by default)]), ,
1291  [enable_encryption=no])
1292if test "x$enable_encryption" = xyes; then
1293  if test xno = "x$with_client" && test xno = "x$with_server"; then
1294    AC_MSG_WARN(
1295      [--enable-encryption is meaningless when neither the CVS client
1296       nor the CVS server is enabled (--disable-client and --disable-server).])
1297  else
1298    AC_DEFINE(
1299      [ENCRYPTION], [1],
1300      [Define to enable encryption support.])
1301  fi
1302fi
1303
1304dnl
1305dnl end --enable-encryption
1306dnl
1307
1308
1309dnl
1310dnl begin --enable-force-editor
1311dnl
1312
1313AC_ARG_ENABLE(
1314  [force-editor],
1315  AC_HELP_STRING(
1316    [--enable-force-editor],
1317    [When committing or importing files, you must enter a log message.
1318     Normally, you can do this either via the -m flag on the command
1319     line, the -F flag on the command line, or an editor will be started
1320     for you.  If you like to use logging templates (the rcsinfo file
1321     within the $CVSROOT/CVSROOT directory), you might want to force
1322     people to use the editor even if they specify a message with -m or
1323     -F.  --enable-force-editor will cause the -m or -F message to be
1324     appended to the temp file when the editor is started. (disabled
1325     by default)]), ,
1326  [enable_force_editor=no])
1327
1328if test yes = "$enable_force_editor"; then
1329  AC_DEFINE(
1330    [FORCE_USE_EDITOR], [1],
1331    [When committing or importing files, you must enter a log message.
1332    Normally, you can do this either via the -m flag on the command
1333    line, the -F flag on the command line, or an editor will be started
1334    for you.  If you like to use logging templates (the rcsinfo file
1335    within the $CVSROOT/CVSROOT directory), you might want to force
1336    people to use the editor even if they specify a message with -m or
1337    -F.  Enabling FORCE_USE_EDITOR will cause the -m or -F message to be
1338    appended to the temp file when the editor is started.])
1339fi
1340
1341dnl
1342dnl end --enable-force-editor
1343dnl
1344
1345
1346dnl
1347dnl begin --enable-lock-compatibility
1348dnl
1349
1350# Check for options requesting client and server feature. If none are
1351# given and we have connect(), we want the full client & server arrangement.
1352AC_ARG_ENABLE(
1353  [lock-compatibility],
1354  AC_HELP_STRING(
1355    [--enable-lock-compatibility],
1356    [Include locking code which prevents versions of CVS earlier than 1.12.4
1357     directly accessing the same repositiory as this executable from ignoring
1358     this executable's promotable read locks.  If only CVS versions 1.12.4 and
1359     later will be accessing your repository directly (as a server or locally),
1360     you can safely disable this option in return for fewer disk accesses and a
1361     small speed increase.  Disabling this option when versions of CVS earlier
1362     than 1,12,4 _will_ be accessing your repository, however, is *VERY* *VERY*
1363     *VERY* dangerous and could result in data loss.  (enabled by default)]),,
1364  [enable_lock_compatibility=yes])
1365
1366if test x$enable_lock_compatibility = xyes; then
1367  AC_DEFINE([LOCK_COMPATIBILITY], [1],
1368    [Define to include locking code which prevents versions of CVS earlier than
1369     1.12.4 directly accessing the same repositiory as this executable from
1370     ignoring this executable's promotable read locks.  If only CVS versions
1371     1.12.4 and later will be accessing your repository directly (as a server
1372     or locally), you can safely disable this option in return for fewer disk
1373     accesses and a small speed increase.  Disabling this option when versions
1374     of CVS earlier than 1,12,4 _will_ be accessing your repository, however,
1375     is *VERY* *VERY* *VERY* dangerous and could result in data loss.
1376
1377     As such, by default, CVS is compiled with this code enabled.  If you are
1378     sure you would like this code disabled, you can disable it by passing the
1379     "--disable-lock-compatibility" option to configure or by commenting out
1380     the lines below.])
1381fi
1382
1383dnl
1384dnl end --enable-lock-compatibility
1385dnl
1386
1387
1388dnl
1389dnl begin --enable-rootcommit
1390dnl
1391
1392dnl
1393dnl I don't like this here, but I don't really like options.h, either.
1394dnl Besides, this is causing some problems currently when compiling under
1395dnl Windows and moving it here should avoid the issue (the wrong options.h
1396dnl is being used).
1397dnl
1398dnl I don't like making this a runtime option either.  I think I just don't
1399dnl like making it easy to get to, but putting it here goes along with the
1400dnl Autoconf ideal.
1401dnl
1402AC_ARG_ENABLE(
1403  [rootcommit],
1404  AC_HELP_STRING(
1405    [--enable-rootcommit],
1406    [Allow the root user to commit files (disabled by default)]), ,
1407  [enable_rootcommit=no])
1408if test "$enable_rootcommit" = no; then
1409  AC_DEFINE(
1410    [CVS_BADROOT], [1],
1411    [When committing a permanent change, CVS and RCS make a log entry of
1412     who committed the change.  If you are committing the change logged
1413     in as "root" (not under "su" or other root-priv giving program),
1414     CVS/RCS cannot determine who is actually making the change.
1415
1416     As such, by default, CVS prohibits changes committed by users
1417     logged in as "root".  You can disable checking by passing the
1418     "--enable-rootcommit" option to configure or by commenting out the
1419     lines below.])
1420fi
1421
1422dnl
1423dnl end --enable-rootcommit
1424dnl
1425
1426dnl
1427dnl begin --enable-old-info-support
1428dnl
1429AC_ARG_ENABLE(
1430  [old-info-support],
1431  AC_HELP_STRING(
1432    [--enable-old-info-format-support],
1433    [Enable support for the pre 1.12.1 *info scripting hook format strings.
1434     Disable this option for a smaller executable once your scripting
1435     hooks have been updated to use the new *info format strings (default).]), ,
1436  [enable_old_info_format_support=yes])
1437if test "$enable_old_info_format_support" = yes; then
1438  AC_DEFINE(
1439    [SUPPORT_OLD_INFO_FMT_STRINGS], [1],
1440    [Enable support for the pre 1.12.1 *info scripting hook format strings.
1441     Disable this option for a smaller executable once your scripting
1442     hooks have been updated to use the new *info format strings by passing
1443     "--disable-old-info-format-support" option to configure or by commenting
1444     out the line below.])
1445fi
1446
1447dnl
1448dnl end --enable-old-info-support
1449dnl
1450
1451
1452dnl
1453dnl begin --enable-config-override
1454dnl
1455
1456AC_ARG_ENABLE(
1457  [config-override],
1458  AC_HELP_STRING(
1459    [--enable-config-override],
1460    [Set to a comma-seperated list of paths to directories (designated by
1461     trailing `/') and files, specifies the path prefixes (for directories) and
1462     paths to files the CVS server commands will allow configuration to be read
1463     from.  Specify `--enable-config-override=no' to disable config file
1464     overrides completely and `--enable-config-override=/' or simply
1465     `--enable-config-override' to allow all paths.  (Defaults to
1466     `SYSCONFDIR/cvs.conf,SYSCONFDIR/cvs/')]),,
1467  [# $sysconfdir may still contain variable references.  By default, this will
1468   # be to $prefix, and $prefix won't be set to its default value until later.
1469   # Compromise without setting $prefix for the rest of the file.
1470   cvs_save_prefix=$prefix
1471   if test "X$prefix" = XNONE; then
1472     prefix=$ac_prefix_default
1473   fi
1474   eval enable_config_override=`echo $sysconfdir/cvs.conf,$sysconfdir/cvs/`
1475   prefix=$cvs_save_prefix])
1476
1477if test x"$enable_config_override" = xyes; then
1478  enable_config_override=/
1479fi
1480
1481if test x"$enable_config_override" = xno; then :; else
1482  save_IFS=$IFS
1483  IFS=,
1484  arrayinit=""
1485  for path in $enable_config_override; do
1486    IFS=$save_IFS
1487    case "$path" in
1488      [[\\/$]]* | ?:[[\\/]]* )
1489	arrayinit="$arrayinit\"$path\", "
1490	;;
1491      *)  AC_MSG_ERROR(
1492          [expected comma separated list of absolute directory
1493           names for --enable-config-override, or \`no', not:
1494           \`$enable_config_override'
1495           (\`$path' invalid.)]);;
1496    esac
1497  done
1498  arrayinit="${arrayinit}NULL"
1499
1500  AC_DEFINE_UNQUOTED(ALLOW_CONFIG_OVERRIDE, [$arrayinit],
1501    [Define this to a NULL terminated list of allowed path prefixes (for
1502     directories) and paths to files the CVS server will allow configuration to
1503     be read from when specified from the command line.])
1504fi
1505
1506dnl
1507dnl end --enable-config-override
1508dnl
1509
1510
1511
1512dnl
1513dnl end --enables
1514dnl
1515
1516
1517
1518dnl For the moment we will assume that all systems which have
1519dnl the unixyness to run configure are unixy enough to do the
1520dnl PreservePermissions stuff.  I have this sinking feeling that
1521dnl things won't be that simple, before long.
1522dnl AC_DEFINE(PRESERVE_PERMISSIONS_SUPPORT, 1,
1523dnl [Define if this system supports chown(), link(), and friends.])
1524
1525dnl On cygwin32, we configure like a Unix system, but we need some support
1526dnl libraries.  We do this at the end so that the new libraries are added at
1527dnl the end of LIBS.
1528dnl
1529dnl FIXME: We should be trying to meet the autoconf ideal of checking for
1530dnl the properties of the system rather than the name of the os here.  In other
1531dnl words, we should check the case sensitivty of the system and then for
1532dnl the support functions we are using and which library we find them in.
1533AC_CACHE_CHECK(for cygwin32, ccvs_cv_sys_cygwin32,
1534[AC_TRY_COMPILE([], [return __CYGWIN32__;],
1535ccvs_cv_sys_cygwin32=yes, ccvs_cv_sys_cygwin32=no)])
1536if test $ccvs_cv_sys_cygwin32 = yes; then
1537  LIBS="$LIBS -ladvapi32"
1538
1539  dnl On Windows you can only change file times if you can write to
1540  dnl the file.  cygwin32 should really handle this for us, but as of
1541  dnl January 1998 it doesn't.
1542  AC_DEFINE(UTIME_EXPECTS_WRITABLE, 1,
1543[Define if utime requires write access to the file (true on Windows,
1544but not Unix).])
1545
1546  dnl On Windows we must use setmode to change between binary and text
1547  dnl mode.  This probably doesn't really require two macro definitions
1548  AC_DEFINE(USE_SETMODE_STDOUT, 1,
1549[Define if setmode is required when writing binary data to stdout.])
1550  AC_DEFINE(HAVE_SETMODE, 1,
1551[Define if the diff library should use setmode for binary files.])
1552fi
1553
1554dnl associate the setting of the execute bit with the individual scripts
1555AC_CONFIG_FILES(contrib/validate_repo, [chmod +x contrib/validate_repo])
1556AC_CONFIG_FILES(contrib/clmerge, [chmod +x contrib/clmerge])
1557AC_CONFIG_FILES(contrib/cln_hist, [chmod +x contrib/cln_hist])
1558AC_CONFIG_FILES(contrib/commit_prep, [chmod +x contrib/commit_prep])
1559AC_CONFIG_FILES(contrib/cvs_acls, [chmod +x contrib/cvs_acls])
1560AC_CONFIG_FILES(contrib/log, [chmod +x contrib/log])
1561AC_CONFIG_FILES(contrib/log_accum, [chmod +x contrib/log_accum])
1562AC_CONFIG_FILES(contrib/mfpipe, [chmod +x contrib/mfpipe])
1563AC_CONFIG_FILES(contrib/pvcs2rcs, [chmod +x contrib/pvcs2rcs])
1564AC_CONFIG_FILES(contrib/rcs2log:contrib/rcs2log.sh, [chmod +x contrib/rcs2log])
1565AC_CONFIG_FILES(contrib/rcslock, [chmod +x contrib/rcslock])
1566AC_CONFIG_FILES(contrib/sccs2rcs, [chmod +x contrib/sccs2rcs])
1567AC_CONFIG_FILES(doc/mkman:doc/mkman.pl, [chmod +x doc/mkman])
1568AC_CONFIG_FILES(src/cvsbug, [chmod +x src/cvsbug])
1569
1570dnl the bulk files
1571AC_CONFIG_FILES([Makefile \
1572	  contrib/Makefile \
1573	  contrib/pam/Makefile \
1574	  cvs.spec \
1575	  diff/Makefile \
1576	  doc/Makefile \
1577	  doc/i18n/Makefile \
1578	  doc/i18n/pt_BR/Makefile \
1579	  lib/Makefile \
1580	  maint-aux/Makefile \
1581	  man/Makefile \
1582	  src/Makefile \
1583	  src/sanity.config.sh])
1584
1585dnl AC_EXTRA_CONFIG_FILES([\
1586dnl 	  emx/Makefile \
1587dnl 	  os2/Makefile \
1588dnl 	  tools/Makefile \
1589dnl 	  vms/Makefile \
1590dnl 	  windows-NT/Makefile \
1591dnl 	  windows-NT/SCC/Makefile \
1592dnl 	  zlib/Makefile])
1593
1594dnl and we're done
1595AC_OUTPUT
1596
1597
1598
1599# Report the state of this version of CVS if this is from dev.
1600m4_bmatch(m4_defn([AC_PACKAGE_VERSION]),  [[0-9]*\.[0-9]*\.[0-9]*\.[0-9]],
1601[    cat <<EOF
1602
1603You are about to use an unreleased version of CVS.  Be sure to
1604read the relevant mailing lists, most importantly <info-cvs@nongnu.org>.
1605
1606Below you will find information on the status of this version of CVS.
1607
1608
1609EOF
1610    sed -n '/^\* Status/,$p' $srcdir/BUGS
1611])
1612