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