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