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