xref: /openbsd/gnu/usr.bin/cvs/configure.in (revision 90c45c29)
1dnl configure.in for cvs
2AC_INIT(src/cvs.h)
3AM_INIT_AUTOMAKE(cvs, 1.11.1p1)
4AC_PREREQ(2.13)
5AC_PREFIX_PROGRAM(cvs)
6AM_CONFIG_HEADER(config.h src/options.h)
7
8AC_PROG_AWK
9AC_PROG_CC
10AC_PROG_INSTALL
11AC_PROG_MAKE_SET
12# Automake's more advanced version of AC_PROG_RANLIB
13AC_PROG_RANLIB
14AC_PROG_YACC
15AC_PROG_LN_S
16
17AC_PATH_PROG(PERL, perl, no)
18AC_PATH_PROG(CSH, csh, no)
19AC_PATH_PROG(PR, pr, no)
20# For diff/util.c
21if test x"$PR" != xno; then
22	AC_DEFINE_UNQUOTED([PR_PROGRAM], ["$PR"], [Path to the pr utility])
23fi
24
25dnl FIXME This is truly gross.
26missing_dir=`cd $ac_aux_dir && pwd`
27dnl FIXME I pulled this default list from sanity.sh.  Perhaps these lists
28dnl can be stored in one location?
29glocs="$PATH:/usr/local/bin:/usr/contrib/bin:/usr/gnu/bin:/local/bin:/local/gnu/bin:/gnu/bin"
30AC_PATH_PROGS(ROFF, groff roff, $missing_dir/missing roff, $glocs)
31AC_PATH_PROG(PS2PDF, ps2pdf, $missing_dir/missing ps2pdf)
32AC_PATH_PROG(TEXI2DVI, texi2dvi, $missing_dir/missing texi2dvi)
33
34AC_SYS_INTERPRETER
35if test X"$ac_cv_sys_interpreter" != X"yes" ; then
36  # silly trick to avoid problems in AC macros...
37  ac_msg='perl scripts using #! may not be invoked properly'
38  AC_MSG_WARN($ac_msg)
39fi
40
41# BSD's logo is a devil for a reason, hey?
42AC_CACHE_CHECK(for BSD VPATH bug in make, ccvs_cv_bsd_make_vpath_bug,
43[if test ! -d ac_test_dir ; then
44	AC_TRY_COMMAND([mkdir ac_test_dir])
45fi
46cat >conftestmake <<EOF
47VPATH = ac_test_dir
48ac_test_target: ac_test_dep
49	echo BSD VPATH bug present >&2
50ac_test_dep: ac_test_dep_dep
51EOF
52touch ac_test_dir/ac_test_dep_dep
53touch ac_test_dir/ac_test_dep
54touch ac_test_target
55# Don't know why, but the following test doesn't work under FreeBSD 4.2
56# without this sleep command
57sleep 1
58if AC_TRY_COMMAND([make -f conftestmake 2>&1 >/dev/null |grep ^BSD\ VPATH\ bug\ present\$ >/dev/null]) ; then
59	ccvs_cv_bsd_make_vpath_bug=yes
60else
61	ccvs_cv_bsd_make_vpath_bug=no
62fi
63AC_TRY_COMMAND([rm -rf ac_test_dir ac_test_target conftestmake])])
64# We also don't need to worry about the bug when $srcdir = $builddir
65AM_CONDITIONAL(MAKE_TARGETS_IN_VPATH, \
66		test $ccvs_cv_bsd_make_vpath_bug = no \
67		|| test $srcdir = .)
68
69AC_AIX
70AC_MINIX
71AC_ISC_POSIX
72if test "$ISC" = yes; then
73CFLAGS="$CFLAGS -D_SYSV3"
74LIBS="-lcrypt $LIBS"
75fi
76
77AC_HEADER_DIRENT
78AC_HEADER_STDC
79AC_HEADER_SYS_WAIT
80AC_CHECK_HEADERS(errno.h unistd.h string.h memory.h utime.h fcntl.h ndbm.h \
81		 limits.h stdint.h sys/file.h \
82                 sys/param.h sys/select.h sys/time.h \
83                 io.h direct.h sys/bsdtypes.h sys/resource.h syslog.h)
84AC_HEADER_STAT
85AC_HEADER_TIME
86
87AC_C_CONST
88AC_TYPE_UID_T
89AC_TYPE_MODE_T
90AC_TYPE_PID_T
91AC_TYPE_SIZE_T
92AC_TYPE_SIGNAL
93
94AC_STRUCT_ST_BLKSIZE
95AC_STRUCT_ST_RDEV
96AC_REPLACE_FUNCS(mkdir rename strstr dup2 strerror valloc waitpid memmove strtoul)
97AC_CHECK_FUNCS(\
98	fchdir \
99	fchmod \
100	fsync \
101	ftime \
102	ftruncate \
103	getgroups \
104	getpagesize \
105	getpassphrase \
106	gettimeofday \
107	initgroups \
108	mkstemp \
109	mktemp \
110	putenv \
111	readlink \
112	sigaction \
113	sigblock \
114	sigprocmask \
115	sigsetmask \
116	sigvec \
117	tempnam \
118	timezone \
119	tzset \
120	vprintf \
121	wait3 \
122)
123# we only need one of the following
124AC_CHECK_FUNCS([\
125	nanosleep \
126	usleep \
127	select \
128], [break])
129
130dnl
131dnl The CVS coding standard (as specified in HACKING) is that if it exists
132dnl in SunOS4 and ANSI, we use it.  CVS itself, of course, therefore doesn't
133dnl need HAVE_* defines for such functions, but diff wants them.
134dnl
135AC_DEFINE(HAVE_STRCHR)
136AC_DEFINE(HAVE_MEMCHR)
137
138dnl
139dnl Force lib/regex.c to use malloc instead of messing around with alloca
140dnl and define the old re_comp routines that we use.
141dnl
142AC_DEFINE(REGEX_MALLOC)
143AC_DEFINE(_REGEX_RE_COMP)
144dnl
145dnl AC_FUNC_VFORK is rather baroque.  It seems to be rather more picky
146dnl than, say, the Single Unix Specification (version 2), which simplifies
147dnl a lot of cases by saying that the child process can't set any variables
148dnl (thus avoiding problems with register allocation) or call any functions
149dnl (thus avoiding problems with whether file descriptors are shared).
150dnl It would be nice if we could just write to the Single Unix Specification.
151dnl I think the only way to do redirection this way is by doing it in the
152dnl parent, and then undoing it afterwards (analogous to windows-NT/run.c).
153dnl That would appear to have a race condition if the user hits ^C (or
154dnl some other signal) at the wrong time, as main_cleanup will try to use
155dnl stdout/stderr.  So maybe we are stuck with AC_FUNC_VFORK.
156dnl
157AC_FUNC_VFORK
158AC_FUNC_CLOSEDIR_VOID
159
160dnl
161dnl Check for shadow password support.
162dnl
163dnl We used to try to determine whether shadow passwords were actually in
164dnl use or not, but the code has been changed to work right reguardless,
165dnl so we can go back to a simple check.
166AC_SEARCH_LIBS(getspnam, sec gen, AC_DEFINE(HAVE_GETSPNAM))
167
168dnl
169dnl Check for a system libz.
170dnl
171AC_CHECK_LIB(z, zlibVersion, ZLIB=-lz ZLIB_DEPEND=/usr/lib/libz.a, ZLIBSUBDIRS=zlib ZLIB=$srcdir/zlib/libz.a ZLIB_DEPEND=$srcdir/zlib/libz.a ZLIB_INCLUDES=-I$srcdir/zlib)
172AC_SUBST(ZLIB)
173AC_SUBST(ZLIBSUBDIRS)
174AC_SUBST(ZLIB_INCLUDES)
175AC_SUBST(ZLIB_DEPEND)
176
177dnl We always use CVS's regular expression matcher.
178dnl This is because:
179dnl (1) If memory serves, the syntax of the regular expressions
180dnl handled by re_exec is not consistent from system to system, which
181dnl is a Bad Thing because CVS passes this syntax out to the user.
182dnl We might have better luck with the POSIX interface, if we really
183dnl want to look for a system-supplied matcher.
184dnl (2) It is necessary to make _sure_ that we get a regex.h and regex.c
185dnl that match each other.  In particular, rx and the CVS/emacs
186dnl regex.c have a different "struct re_pattern_buffer" and so using
187dnl the system regex.h and our regex.c, or vice versa, will tend to
188dnl cause a core dump.
189dnl (3) Just as a random data point, CVS uses re_exec (a BSD interface);
190dnl libdiff uses re_compile_pattern (a GNU interface, I think).  Diff
191dnl should probably be fixed to have the caller (CVS) supply the regexp
192dnl matching.
193dnl
194dnl AC_CHECK_FUNC(re_exec, :, LIBOBJS="$LIBOBJS regex.o")
195AC_FUNC_UTIME_NULL
196AC_SYS_LONG_FILE_NAMES
197
198AC_FUNC_FNMATCH
199if test "$ac_cv_func_fnmatch_works" = no; then
200  LIBOBJS="$LIBOBJS fnmatch.o"
201fi
202
203# Try to find connect and gethostbyname.
204AC_CHECK_LIB(nsl, main,
205  AC_SEARCH_LIBS(connect, xnet socket inet, AC_DEFINE(HAVE_CONNECT),, -lnsl),
206  AC_SEARCH_LIBS(connect, xnet socket inet, AC_DEFINE(HAVE_CONNECT)))
207AC_SEARCH_LIBS(gethostbyname, netinet nsl)
208
209dnl
210dnl set $(KRB4) from --with-krb4=value -- WITH_KRB4
211dnl
212dnl If you change this, keep in mind that some systems have a bogus
213dnl libkrb in the system libraries, so --with-krb4=value needs to
214dnl override the system -lkrb.
215dnl
216KRB4=/usr/kerberos
217define(WITH_KRB4,[
218AC_ARG_WITH([krb4],
219  [  --with-krb4=value       set default \$(KRB4) from value],
220  [KRB4=$withval],
221)dnl
222echo "default place for krb4 is $KRB4"
223AC_SUBST(KRB4)])dnl
224WITH_KRB4
225
226krb_h=
227AC_MSG_CHECKING([for krb.h])
228if test "$cross_compiling" != yes && test -r $KRB4/include/krb.h; then
229   hold_cflags=$CFLAGS
230   CFLAGS="$CFLAGS -I$KRB4/include"
231   AC_TRY_LINK([#include <krb.h>],[int i;],
232          [krb_h=yes krb_incdir=$KRB4/include],
233          [CFLAGS=$hold_cflags
234           AC_TRY_LINK([#include <krb.h>],[int i;],
235             [krb_h=yes krb_incdir=])])
236   CFLAGS=$hold_cflags
237else
238   AC_TRY_LINK([#include <krb.h>],[int i;],
239             [krb_h=yes krb_incdir=])
240fi
241if test -z "$krb_h"; then
242  AC_TRY_LINK([#include <krb.h>],[int i;],
243    [krb_h=yes krb_incdir=],
244    [if test "$cross_compiling" != yes && test -r $KRB4/include/kerberosIV/krb.h; then
245       hold_cflags=$CFLAGS
246       CFLAGS="$CFLAGS -I$KRB4/include/kerberosIV"
247       AC_TRY_LINK([#include <krb.h>],[int i;],
248	 [krb_h=yes krb_incdir=$KRB4/include/kerberosIV])
249       CFLAGS=$hold_cflags
250     fi])
251fi
252AC_MSG_RESULT($krb_h)
253
254includeopt=
255AC_SUBST(includeopt)
256if test -n "$krb_h"; then
257  krb_lib=
258  if test "$cross_compiling" != yes && test -r $KRB4/lib/libkrb.a; then
259       hold_ldflags=$LDFLAGS
260       LDFLAGS="-L${KRB4}/lib $LDFLAGS"
261       AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=${KRB4}/lib],
262           [LDFLAGS=$hold_ldflags
263            # Using open here instead of printf so we don't
264            # get confused by the cached value for printf from above.
265            AC_CHECK_LIB(krb,open,[krb_lib=yes krb_libdir=])])
266       LDFLAGS=$hold_ldflags
267  else
268       AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=])
269  fi
270fi
271
272dnl
273dnl Use --with-gssapi=DIR to enable GSSAPI support.
274dnl
275GSSAPI=/usr/cygnus/kerbnet
276define(WITH_GSSAPI,[
277AC_ARG_WITH([gssapi],
278  [  --with-gssapi=value     GSSAPI directory],
279  [GSSAPI=$withval],
280)dnl
281echo "default place for GSSAPI is $GSSAPI"
282AC_SUBST(GSSAPI)])dnl
283WITH_GSSAPI
284
285hold_cppflags=$CPPFLAGS
286CPPFLAGS="$CPPFLAGS -I$GSSAPI/include/kerberosV "
287AC_CHECK_HEADERS(krb5.h gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h)
288CPPFLAGS=$hold_cppflags
289
290if test "$ac_cv_header_krb5_h" = "yes" &&
291   (test "$ac_cv_header_gssapi_h" = "yes" ||
292    test "$ac_cv_header_gssapi_gssapi_h" = "yes"); then
293  AC_DEFINE(HAVE_GSSAPI)
294  includeopt="${includeopt} -I$GSSAPI/include/kerberosV"
295  # FIXME: This is ugly, but these things don't seem to be standardized.
296  if test "$ac_cv_header_gssapi_h" = "yes"; then
297    LIBS="$LIBS -L$GSSAPI/lib -lgssapi -lkrb5 -lcrypto"
298  else
299    LIBS="$LIBS -L$GSSAPI/lib -lgssapi_krb5 -lkrb5 -lcrypto -lcom_err"
300  fi
301  save_CPPFLAGS=$CPPFLAGS
302  CPPFLAGS="-I$GSSAPI/include/kerberosV $CPPFLAGS"
303  if test "$ac_cv_header_gssapi_h" = "yes"; then
304    AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE))
305  else
306    AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi/gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE))
307  fi
308  CPPFLAGS=$save_CPPFLAGS
309  # This is necessary on Irix 5.3, in order to link against libkrb5 --
310  # there, an_to_ln.o refers to things defined only in -lgen.
311  AC_CHECK_LIB(gen, compile)
312fi
313
314if test -n "$krb_h"; then
315  if test -n "$krb_lib"; then
316    AC_DEFINE(HAVE_KERBEROS)
317    test -n "${krb_libdir}" && LIBS="${LIBS} -L${krb_libdir}"
318    LIBS="${LIBS} -lkrb"
319    # Put -L${krb_libdir} in LDFLAGS temporarily so that it appears before
320    # -ldes in the command line.  Don't do it permanently so that we honor
321    # the user's setting for LDFLAGS
322    hold_ldflags=$LDFLAGS
323    test -n "${krb_libdir}" && LDFLAGS="$LDFLAGS -L${krb_libdir}"
324    AC_CHECK_LIB(des,printf,[LIBS="${LIBS} -ldes"])
325    LDFLAGS=$hold_ldflags
326    if test -n "$krb_incdir"; then
327      includeopt="${includeopt} -I$krb_incdir"
328    fi
329  fi
330fi
331AC_CHECK_FUNCS(krb_get_err_text)
332
333dnl
334dnl Use --with-encryption to turn on encryption support
335dnl
336AC_ARG_ENABLE(encryption,
337  [  --enable-encryption     enable encryption support],
338  [case "${enableval}" in
339    yes) encryption=true ;;
340    no) encryption=false ;;
341    *) AC_MSG_ERROR(bad value ${enableval} for encryption option) ;;
342   esac],
343  [encryption=false])
344if test "$encryption" = "true"; then
345  AC_DEFINE(ENCRYPTION)
346fi
347
348AC_CHECK_FUNC(gethostname, :, LIBOBJS="$LIBOBJS hostname.o")
349
350# Check for options requesting client and server feature. If none are
351# given and we have connect(), we want the full client & server arrangement.
352AC_ARG_ENABLE(client,
353[  --enable-client         include code for running as a remote client (default)
354  --disable-client        don't include remote client code],
355[if test "$enable_client" = yes; then
356  AC_DEFINE(CLIENT_SUPPORT)
357fi],
358[if test "$ac_cv_search_connect" != no; then
359  AC_DEFINE(CLIENT_SUPPORT)
360fi])
361AC_ARG_ENABLE(server,
362[  --enable-server         include code for running as a server (default)
363  --disable-server        don't include server code],
364[if test "$enable_server" = yes; then
365  AC_DEFINE(SERVER_SUPPORT)
366fi],
367[if test "$ac_cv_search_connect" != no; then
368  AC_DEFINE(SERVER_SUPPORT)
369  enable_server=yes
370fi])
371
372dnl For the moment we will assume that all systems which have
373dnl the unixyness to run configure are unixy enough to do the
374dnl PreservePermissions stuff.  I have this sinking feeling that
375dnl things won't be that simple, before long.
376dnl AC_DEFINE(PRESERVE_PERMISSIONS_SUPPORT)
377
378dnl On cygwin32, we configure like a Unix system, but we use the
379dnl Windows support code in lib/fncase.c to handle the case
380dnl insensitive file system.  We also need some support libraries.  We
381dnl do this at the end so that the new libraries are added at the end
382dnl of LIBS.
383AC_CACHE_CHECK(for cygwin32, ccvs_cv_sys_cygwin32,
384[AC_TRY_COMPILE([], [return __CYGWIN32__;],
385ccvs_cv_sys_cygwin32=yes, ccvs_cv_sys_cygwin32=no)])
386if test $ccvs_cv_sys_cygwin32 = yes; then
387  LIBOBJS="$LIBOBJS fncase.o"
388  LIBS="$LIBS -ladvapi32"
389
390  dnl On Windows you can only change file times if you can write to
391  dnl the file.  cygwin32 should really handle this for us, but as of
392  dnl January 1998 it doesn't.
393  AC_DEFINE(UTIME_EXPECTS_WRITABLE)
394
395  dnl On Windows we must use setmode to change between binary and text
396  dnl mode.
397  AC_DEFINE(USE_SETMODE_STDOUT)
398  AC_DEFINE(HAVE_SETMODE)
399fi
400
401test -f src/options.h && (
402  AC_MSG_WARN(saving ./src/options.h in ./src/options.h-SAVED)
403  AC_MSG_WARN(You may wish to check that local options have not been lost.)
404  AC_MSG_WARN(Do not re-run ./configure or ./config.status until you have....)
405  cp ./src/options.h ./src/options.h-SAVED
406)
407
408AC_OUTPUT([Makefile \
409	  contrib/Makefile \
410	  contrib/clmerge \
411	  contrib/cln_hist \
412	  contrib/commit_prep \
413	  contrib/cvs_acls \
414	  contrib/log \
415	  contrib/log_accum \
416	  contrib/mfpipe \
417	  contrib/rcslock \
418	  contrib/sccs2rcs \
419	  diff/Makefile \
420	  doc/Makefile \
421	  emx/Makefile \
422	  lib/Makefile \
423	  man/Makefile \
424	  os2/Makefile \
425	  src/Makefile \
426	  src/cvsbug \
427	  tools/Makefile \
428	  vms/Makefile \
429	  windows-NT/Makefile \
430	  windows-NT/SCC/Makefile],
431	  [chmod -f +x \
432	  contrib/clmerge \
433	  contrib/cln_hist \
434	  contrib/commit_prep \
435	  contrib/cvs_acls \
436	  contrib/log \
437	  contrib/log_accum \
438	  contrib/mfpipe \
439	  contrib/rcslock \
440	  contrib/sccs2rcs \
441	  src/cvsbug])
442