1 dnl configure.in for cvs
4 AC_PREREQ(2.4)dnl Required Autoconf version.
5 dnl Do not use autoconf 2.12; it produces a configure script which produces
6 dnl a "internal 2K buffer" error on HPUX when run with /bin/sh.
7 dnl autoconf 2.10 seems like a good choice.
9 dnl It is possible that we should just change the above required version
10 dnl to 2.10; it seems like everyone is using 2.10 anyway, and there is
11 dnl at least some sentiment that we should be using a version which has
12 dnl --bindir (and correspondingly, using @bindir@ and friends in our
13 dnl Makefile.in files. Rumor has it that autoconf 2.7
14 dnl introduced --bindir but the point is that 2.10 has it.
15 AC_CONFIG_HEADER(config.h src/options.h)
22 if test "$ISC" = yes; then
23 CFLAGS="$CFLAGS -D_SYSV3"
27 AC_PREFIX_PROGRAM(cvs)
29 dnl FIXME: AC_C_CROSS is considered obsolete by autoconf 2.12, and is
30 dnl pretty ugly to start with. But it isn't obvious to me how we should
31 dnl be handling the uses of cross_compiling below.
41 AC_PATH_PROG(perl_path, perl, no)
42 AC_PATH_PROG(csh_path, csh, no)
45 if test X"$ac_cv_sys_interpreter" != X"yes" ; then
46 # silly trick to avoid problems in AC macros...
47 ac_msg='perl scripts using #! may not be invoked properly'
52 AC_CHECK_HEADERS(errno.h unistd.h string.h memory.h utime.h fcntl.h ndbm.h \
54 sys/param.h sys/select.h sys/time.h sys/timeb.h \
55 io.h direct.h sys/bsdtypes.h sys/resource.h)
66 AC_REPLACE_FUNCS(mkdir rename strstr dup2 strerror valloc waitpid memmove vasprintf strtoul)
67 AC_CHECK_FUNCS(fchmod fsync ftime mktemp putenv vprintf ftruncate timezone getpagesize initgroups fchdir sigaction sigprocmask sigvec sigsetmask sigblock tempnam tzset readlink wait3)
70 dnl The CVS coding standard (as specified in HACKING) is that if it exists
71 dnl in SunOS4 and ANSI, we use it. CVS itself, of course, therefore doesn't
72 dnl need HAVE_* defines for such functions, but diff wants them.
74 AC_DEFINE(HAVE_STRCHR)
75 AC_DEFINE(HAVE_MEMCHR)
78 dnl AC_FUNC_VFORK is rather baroque. It seems to be rather more picky
79 dnl than, say, the Single Unix Specification (version 2), which simplifies
80 dnl a lot of cases by saying that the child process can't set any variables
81 dnl (thus avoiding problems with register allocation) or call any functions
82 dnl (thus avoiding problems with whether file descriptors are shared).
83 dnl It would be nice if we could just write to the Single Unix Specification.
84 dnl I think the only way to do redirection this way is by doing it in the
85 dnl parent, and then undoing it afterwards (analogous to windows-NT/run.c).
86 dnl That would appear to have a race condition if the user hits ^C (or
87 dnl some other signal) at the wrong time, as main_cleanup will try to use
88 dnl stdout/stderr. So maybe we are stuck with AC_FUNC_VFORK.
94 dnl Check for shadow password support.
96 dnl We used to try to determine whether shadow passwords were actually in
97 dnl use or not, but the code has been changed to work right reguardless,
98 dnl so we can go back to a simple check.
99 AC_CHECK_LIB(sec, getspnam)
100 AC_CHECK_FUNCS(getspnam)
102 dnl We always use CVS's regular expression matcher.
104 dnl (1) If memory serves, the syntax of the regular expressions
105 dnl handled by re_exec is not consistent from system to system, which
106 dnl is a Bad Thing because CVS passes this syntax out to the user.
107 dnl We might have better luck with the POSIX interface, if we really
108 dnl want to look for a system-supplied matcher.
109 dnl (2) It is necessary to make _sure_ that we get a regex.h and regex.c
110 dnl that match each other. In particular, rx and the CVS/emacs
111 dnl regex.c have a different "struct re_pattern_buffer" and so using
112 dnl the system regex.h and our regex.c, or vice versa, will tend to
113 dnl cause a core dump.
114 dnl (3) Just as a random data point, CVS uses re_exec (a BSD interface);
115 dnl libdiff uses re_compile_pattern (a GNU interface, I think). Diff
116 dnl should probably be fixed to have the caller (CVS) supply the regexp
119 dnl AC_CHECK_FUNC(re_exec, :, LIBOBJS="$LIBOBJS regex.o")
121 AC_SYS_LONG_FILE_NAMES
123 AC_MSG_CHECKING([for working fnmatch function])
124 AC_CACHE_VAL(ccvs_cv_sys_working_fnmatch,
130 exit ((fnmatch ("a", "a", FNM_PATHNAME) == 0
131 && fnmatch ("a", "b", FNM_PATHNAME) == FNM_NOMATCH)
134 ccvs_cv_sys_working_fnmatch=yes,
135 ccvs_cv_sys_working_fnmatch=no,
136 ccvs_cv_sys_working_fnmatch=no)])
137 if test $ccvs_cv_sys_working_fnmatch = no; then
138 LIBOBJS="$LIBOBJS fnmatch.o"
140 AC_MSG_RESULT($ccvs_cv_sys_working_fnmatch)
142 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
143 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
144 # libsocket.so which has a bad implementation of gethostbyname (it
145 # only looks in /etc/hosts), so we only look for -lsocket if we need
147 AC_CHECK_FUNC(connect, :,
150 *) AC_CHECK_LIB(nsl_s, printf) ;;
154 *) AC_CHECK_LIB(nsl, printf) ;;
158 *) AC_CHECK_LIB(socket, connect) ;;
162 *) AC_CHECK_LIB(inet, connect) ;;
164 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
166 if test "$ac_cv_lib_socket_connect" = "yes" || test "$ac_cv_lib_inet_connect" = "yes"; then
167 ac_cv_func_connect=yes
168 AC_DEFINE(HAVE_CONNECT)
172 dnl set $(KRB4) from --with-krb4=value -- WITH_KRB4
174 dnl If you change this, keep in mind that some systems have a bogus
175 dnl libkrb in the system libraries, so --with-krb4=value needs to
176 dnl override the system -lkrb.
181 [ --with-krb4=value set default \$(KRB4) from value],
184 echo "default place for krb4 is $KRB4"
189 AC_MSG_CHECKING([for krb.h])
190 if test "$cross_compiling" != yes && test -r $KRB4/include/krb.h; then
192 CFLAGS="$CFLAGS -I$KRB4/include"
193 AC_TRY_LINK([#include <krb.h>],[int i;],
194 [krb_h=yes krb_incdir=$KRB4/include],
196 AC_TRY_LINK([#include <krb.h>],[int i;],
197 [krb_h=yes krb_incdir=])])
200 AC_TRY_LINK([#include <krb.h>],[int i;],
201 [krb_h=yes krb_incdir=])
203 if test -z "$krb_h"; then
204 AC_TRY_LINK([#include <krb.h>],[int i;],
205 [krb_h=yes krb_incdir=],
206 [if test "$cross_compiling" != yes && test -r $KRB4/include/kerberosIV/krb.h; then
208 CFLAGS="$CFLAGS -I$KRB4/include/kerberosIV"
209 AC_TRY_LINK([#include <krb.h>],[int i;],
210 [krb_h=yes krb_incdir=$KRB4/include/kerberosIV])
214 AC_MSG_RESULT($krb_h)
218 if test -n "$krb_h"; then
220 if test "$cross_compiling" != yes && test -r $KRB4/lib/libkrb.a; then
221 hold_ldflags=$LDFLAGS
222 LDFLAGS="-L${KRB4}/lib $LDFLAGS"
223 AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=${KRB4}/lib],
224 [LDFLAGS=$hold_ldflags
225 # Using open here instead of printf so we don't
226 # get confused by the cached value for printf from above.
227 AC_CHECK_LIB(krb,open,[krb_lib=yes krb_libdir=])])
228 LDFLAGS=$hold_ldflags
230 AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=])
232 if test -n "$krb_lib"; then
233 AC_DEFINE(HAVE_KERBEROS)
234 test -n "${krb_libdir}" && LIBS="${LIBS} -L${krb_libdir}"
236 # Put -L${krb_libdir} in LDFLAGS temporarily so that it appears before
237 # -ldes in the command line. Don't do it permanently so that we honor
238 # the user's setting for LDFLAGS
239 hold_ldflags=$LDFLAGS
240 test -n "${krb_libdir}" && LDFLAGS="$LDFLAGS -L${krb_libdir}"
241 AC_CHECK_LIB(des,printf,[LIBS="${LIBS} -ldes"])
242 LDFLAGS=$hold_ldflags
243 if test -n "$krb_incdir"; then
244 includeopt="${includeopt} -I$krb_incdir"
248 AC_CHECK_FUNCS(krb_get_err_text)
251 dnl Use --with-gssapi=DIR to enable GSSAPI support.
253 GSSAPI=/usr/cygnus/kerbnet
255 AC_ARG_WITH([gssapi],
256 [ --with-gssapi=value GSSAPI directory],
259 echo "default place for GSSAPI is $GSSAPI"
260 AC_SUBST(GSSAPI)])dnl
263 hold_cppflags=$CPPFLAGS
264 CPPFLAGS="$CPPFLAGS -I$GSSAPI/include "
265 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h)
266 CPPFLAGS=$hold_cppflags
268 if test "$ac_cv_header_gssapi_h" = "yes" || test "$ac_cv_header_gssapi_gssapi_h" = "yes"; then
269 AC_DEFINE(HAVE_GSSAPI)
270 includeopt="${includeopt} -I$GSSAPI/include"
271 # FIXME: This is ugly, but these things don't seem to be standardized.
272 if test "$ac_cv_header_gssapi_h" = "yes"; then
273 LIBS="$LIBS -L$GSSAPI/lib -lgssapi -lkrb5 -lasn1 -ldes -lroken"
275 LIBS="$LIBS -L$GSSAPI/lib -lgssapi_krb5 -lkrb5 -lcrypto -lcom_err"
277 save_CPPFLAGS=$CPPFLAGS
278 CPPFLAGS="-I$GSSAPI/include $CPPFLAGS"
279 if test "$ac_cv_header_gssapi_h" = "yes"; then
280 AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE))
282 AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi/gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE))
284 CPPFLAGS=$save_CPPFLAGS
285 # This is necessary on Irix 5.3, in order to link against libkrb5 --
286 # there, an_to_ln.o refers to things defined only in -lgen.
287 AC_CHECK_LIB(gen, compile)
291 dnl Use --with-encryption to turn on encryption support
293 AC_ARG_ENABLE(encryption,
294 [ --enable-encryption enable encryption support],
295 [case "${enableval}" in
296 yes) encryption=true ;;
297 no) encryption=false ;;
298 *) AC_MSG_ERROR(bad value ${enableval} for encryption option) ;;
301 if test "$encryption" = "true"; then
302 AC_DEFINE(ENCRYPTION)
305 AC_CHECK_FUNC(gethostname, :, LIBOBJS="$LIBOBJS hostname.o")
307 # Check for options requesting client and server feature. If none are
308 # given and we have connect(), we want the full client & server arrangement.
309 AC_ARG_ENABLE(client,
310 [ --enable-client include code for running as a remote client (default)
311 --disable-client don't include remote client code],
312 [if test "$enable_client" = yes; then
313 AC_DEFINE(CLIENT_SUPPORT)
315 [if test "$ac_cv_func_connect" = yes; then
316 AC_DEFINE(CLIENT_SUPPORT)
318 AC_ARG_ENABLE(server,
319 [ --enable-server include code for running as a server (default)
320 --disable-server don't include server code],
321 [if test "$enable_server" = yes; then
322 AC_DEFINE(SERVER_SUPPORT)
324 [if test "$ac_cv_func_connect" = yes; then
325 AC_DEFINE(SERVER_SUPPORT)
329 ### The auth server needs to be able to check passwords against passwd
330 ### file entries, so we only #define AUTH_SERVER_SUPPORT if we can
331 ### find the crypt function.
333 ### We used to test for crypt in libc first, and only add -lcrypt if
334 ### we couldn't find it, but that interacts badly with the cache
335 ### variables, the 'unset' command isn't portable, and I'm not sure
336 ### there's any harm in just testing for -lcrypt first.
338 if test "$enable_server" = yes; then
339 AC_CHECK_LIB(crypt, crypt)
340 AC_CHECK_FUNCS(crypt)
342 if test "$ac_cv_func_crypt" = yes; then
343 AC_DEFINE(AUTH_SERVER_SUPPORT)
347 dnl For the moment we will assume that all systems which have
348 dnl the unixyness to run configure are unixy enough to do the
349 dnl PreservePermissions stuff. I have this sinking feeling that
350 dnl things won't be that simple, before long.
351 AC_DEFINE(PRESERVE_PERMISSIONS_SUPPORT)
353 dnl On cygwin32, we configure like a Unix system, but we use the
354 dnl Windows support code in lib/fncase.c to handle the case
355 dnl insensitive file system. We also need some support libraries. We
356 dnl do this at the end so that the new libraries are added at the end
358 AC_CACHE_CHECK(for cygwin32, ccvs_cv_sys_cygwin32,
359 [AC_TRY_COMPILE([], [return __CYGWIN32__;],
360 ccvs_cv_sys_cygwin32=yes, ccvs_cv_sys_cygwin32=no)])
361 if test $ccvs_cv_sys_cygwin32 = yes; then
362 LIBOBJS="$LIBOBJS fncase.o"
363 LIBS="$LIBS -ladvapi32"
365 dnl On Windows you can only change file times if you can write to
366 dnl the file. cygwin32 should really handle this for us, but as of
367 dnl January 1998 it doesn't.
368 AC_DEFINE(UTIME_EXPECTS_WRITABLE)
370 dnl On Windows we must use setmode to change between binary and text
372 AC_DEFINE(USE_SETMODE_STDOUT)
373 AC_DEFINE(HAVE_SETMODE)
376 test -f src/options.h && (
377 AC_MSG_WARN(saving ./src/options.h in ./src/options.h-SAVED)
378 AC_MSG_WARN(You may wish to check that local options have not been lost.)
379 AC_MSG_WARN(Do not re-run ./configure or ./config.status until you have....)
380 cp ./src/options.h ./src/options.h-SAVED
383 AC_OUTPUT(Makefile lib/Makefile src/Makefile zlib/Makefile diff/Makefile doc/Makefile \
384 man/Makefile tools/Makefile tools/pcl-cvs/Makefile \
385 contrib/Makefile contrib/elib/Makefile \
386 windows-NT/Makefile windows-NT/SCC/Makefile \
387 os2/Makefile emx/Makefile macintosh/Makefile vms/Makefile \