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 sys/file.h \ 82 sys/param.h sys/select.h sys/time.h sys/timeb.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 mknod \ 109 mkstemp \ 110 mktemp \ 111 putenv \ 112 readlink \ 113 sigaction \ 114 sigblock \ 115 sigprocmask \ 116 sigsetmask \ 117 sigvec \ 118 tempnam \ 119 timezone \ 120 tzset \ 121 vprintf \ 122 wait3 \ 123) 124# we only need one of the following 125AC_CHECK_FUNCS([\ 126 nanosleep \ 127 usleep \ 128 select \ 129], [break]) 130 131dnl 132dnl The CVS coding standard (as specified in HACKING) is that if it exists 133dnl in SunOS4 and ANSI, we use it. CVS itself, of course, therefore doesn't 134dnl need HAVE_* defines for such functions, but diff wants them. 135dnl 136AC_DEFINE(HAVE_STRCHR) 137AC_DEFINE(HAVE_MEMCHR) 138 139dnl 140dnl Force lib/regex.c to use malloc instead of messing around with alloca 141dnl and define the old re_comp routines that we use. 142dnl 143AC_DEFINE(REGEX_MALLOC) 144AC_DEFINE(_REGEX_RE_COMP) 145dnl 146dnl AC_FUNC_VFORK is rather baroque. It seems to be rather more picky 147dnl than, say, the Single Unix Specification (version 2), which simplifies 148dnl a lot of cases by saying that the child process can't set any variables 149dnl (thus avoiding problems with register allocation) or call any functions 150dnl (thus avoiding problems with whether file descriptors are shared). 151dnl It would be nice if we could just write to the Single Unix Specification. 152dnl I think the only way to do redirection this way is by doing it in the 153dnl parent, and then undoing it afterwards (analogous to windows-NT/run.c). 154dnl That would appear to have a race condition if the user hits ^C (or 155dnl some other signal) at the wrong time, as main_cleanup will try to use 156dnl stdout/stderr. So maybe we are stuck with AC_FUNC_VFORK. 157dnl 158AC_FUNC_VFORK 159AC_FUNC_CLOSEDIR_VOID 160 161dnl 162dnl Check for shadow password support. 163dnl 164dnl We used to try to determine whether shadow passwords were actually in 165dnl use or not, but the code has been changed to work right reguardless, 166dnl so we can go back to a simple check. 167AC_SEARCH_LIBS(getspnam, sec gen, AC_DEFINE(HAVE_GETSPNAM)) 168 169dnl 170dnl Check for a system libz. 171dnl 172AC_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) 173AC_SUBST(ZLIB) 174AC_SUBST(ZLIBSUBDIRS) 175AC_SUBST(ZLIB_INCLUDES) 176AC_SUBST(ZLIB_DEPEND) 177 178dnl We always use CVS's regular expression matcher. 179dnl This is because: 180dnl (1) If memory serves, the syntax of the regular expressions 181dnl handled by re_exec is not consistent from system to system, which 182dnl is a Bad Thing because CVS passes this syntax out to the user. 183dnl We might have better luck with the POSIX interface, if we really 184dnl want to look for a system-supplied matcher. 185dnl (2) It is necessary to make _sure_ that we get a regex.h and regex.c 186dnl that match each other. In particular, rx and the CVS/emacs 187dnl regex.c have a different "struct re_pattern_buffer" and so using 188dnl the system regex.h and our regex.c, or vice versa, will tend to 189dnl cause a core dump. 190dnl (3) Just as a random data point, CVS uses re_exec (a BSD interface); 191dnl libdiff uses re_compile_pattern (a GNU interface, I think). Diff 192dnl should probably be fixed to have the caller (CVS) supply the regexp 193dnl matching. 194dnl 195dnl AC_CHECK_FUNC(re_exec, :, LIBOBJS="$LIBOBJS regex.o") 196AC_FUNC_UTIME_NULL 197AC_SYS_LONG_FILE_NAMES 198 199AC_FUNC_FNMATCH 200if test "$ac_cv_func_fnmatch_works" = no; then 201 LIBOBJS="$LIBOBJS fnmatch.o" 202fi 203 204# Try to find connect and gethostbyname. 205AC_CHECK_LIB(nsl, main, 206 AC_SEARCH_LIBS(connect, xnet socket inet, AC_DEFINE(HAVE_CONNECT),, -lnsl), 207 AC_SEARCH_LIBS(connect, xnet socket inet, AC_DEFINE(HAVE_CONNECT))) 208AC_SEARCH_LIBS(gethostbyname, netinet nsl) 209 210dnl 211dnl set $(KRB4) from --with-krb4=value -- WITH_KRB4 212dnl 213dnl If you change this, keep in mind that some systems have a bogus 214dnl libkrb in the system libraries, so --with-krb4=value needs to 215dnl override the system -lkrb. 216dnl 217KRB4=/usr/kerberos 218define(WITH_KRB4,[ 219AC_ARG_WITH([krb4], 220 [ --with-krb4=value set default \$(KRB4) from value], 221 [KRB4=$withval], 222)dnl 223echo "default place for krb4 is $KRB4" 224AC_SUBST(KRB4)])dnl 225WITH_KRB4 226 227krb_h= 228AC_MSG_CHECKING([for krb.h]) 229if test "$cross_compiling" != yes && test -r $KRB4/include/krb.h; then 230 hold_cflags=$CFLAGS 231 CFLAGS="$CFLAGS -I$KRB4/include" 232 AC_TRY_LINK([#include <krb.h>],[int i;], 233 [krb_h=yes krb_incdir=$KRB4/include], 234 [CFLAGS=$hold_cflags 235 AC_TRY_LINK([#include <krb.h>],[int i;], 236 [krb_h=yes krb_incdir=])]) 237 CFLAGS=$hold_cflags 238else 239 AC_TRY_LINK([#include <krb.h>],[int i;], 240 [krb_h=yes krb_incdir=]) 241fi 242if test -z "$krb_h"; then 243 AC_TRY_LINK([#include <krb.h>],[int i;], 244 [krb_h=yes krb_incdir=], 245 [if test "$cross_compiling" != yes && test -r $KRB4/include/kerberosIV/krb.h; then 246 hold_cflags=$CFLAGS 247 CFLAGS="$CFLAGS -I$KRB4/include/kerberosIV" 248 AC_TRY_LINK([#include <krb.h>],[int i;], 249 [krb_h=yes krb_incdir=$KRB4/include/kerberosIV]) 250 CFLAGS=$hold_cflags 251 fi]) 252fi 253AC_MSG_RESULT($krb_h) 254 255includeopt= 256AC_SUBST(includeopt) 257if test -n "$krb_h"; then 258 krb_lib= 259 if test "$cross_compiling" != yes && test -r $KRB4/lib/libkrb.a; then 260 hold_ldflags=$LDFLAGS 261 LDFLAGS="-L${KRB4}/lib $LDFLAGS" 262 AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=${KRB4}/lib], 263 [LDFLAGS=$hold_ldflags 264 # Using open here instead of printf so we don't 265 # get confused by the cached value for printf from above. 266 AC_CHECK_LIB(krb,open,[krb_lib=yes krb_libdir=])]) 267 LDFLAGS=$hold_ldflags 268 else 269 AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=]) 270 fi 271fi 272 273dnl 274dnl Use --with-gssapi=DIR to enable GSSAPI support. 275dnl 276GSSAPI=/usr/cygnus/kerbnet 277define(WITH_GSSAPI,[ 278AC_ARG_WITH([gssapi], 279 [ --with-gssapi=value GSSAPI directory], 280 [GSSAPI=$withval], 281)dnl 282echo "default place for GSSAPI is $GSSAPI" 283AC_SUBST(GSSAPI)])dnl 284WITH_GSSAPI 285 286hold_cppflags=$CPPFLAGS 287CPPFLAGS="$CPPFLAGS -I$GSSAPI/include/kerberosV " 288AC_CHECK_HEADERS(krb5.h gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h) 289CPPFLAGS=$hold_cppflags 290 291if test "$ac_cv_header_krb5_h" = "yes" && 292 (test "$ac_cv_header_gssapi_h" = "yes" || 293 test "$ac_cv_header_gssapi_gssapi_h" = "yes"); then 294 AC_DEFINE(HAVE_GSSAPI) 295 includeopt="${includeopt} -I$GSSAPI/include/kerberosV" 296 # FIXME: This is ugly, but these things don't seem to be standardized. 297 if test "$ac_cv_header_gssapi_h" = "yes"; then 298 LIBS="$LIBS -L$GSSAPI/lib -lgssapi -lkrb5 -lcrypto" 299 else 300 LIBS="$LIBS -L$GSSAPI/lib -lgssapi_krb5 -lkrb5 -lcrypto -lcom_err" 301 fi 302 save_CPPFLAGS=$CPPFLAGS 303 CPPFLAGS="-I$GSSAPI/include/kerberosV $CPPFLAGS" 304 if test "$ac_cv_header_gssapi_h" = "yes"; then 305 AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE)) 306 else 307 AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi/gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE)) 308 fi 309 CPPFLAGS=$save_CPPFLAGS 310 # This is necessary on Irix 5.3, in order to link against libkrb5 -- 311 # there, an_to_ln.o refers to things defined only in -lgen. 312 AC_CHECK_LIB(gen, compile) 313fi 314 315if test -n "$krb_h"; then 316 if test -n "$krb_lib"; then 317 AC_DEFINE(HAVE_KERBEROS) 318 test -n "${krb_libdir}" && LIBS="${LIBS} -L${krb_libdir}" 319 LIBS="${LIBS} -lkrb" 320 # Put -L${krb_libdir} in LDFLAGS temporarily so that it appears before 321 # -ldes in the command line. Don't do it permanently so that we honor 322 # the user's setting for LDFLAGS 323 hold_ldflags=$LDFLAGS 324 test -n "${krb_libdir}" && LDFLAGS="$LDFLAGS -L${krb_libdir}" 325 AC_CHECK_LIB(des,printf,[LIBS="${LIBS} -ldes"]) 326 LDFLAGS=$hold_ldflags 327 if test -n "$krb_incdir"; then 328 includeopt="${includeopt} -I$krb_incdir" 329 fi 330 fi 331fi 332AC_CHECK_FUNCS(krb_get_err_text) 333 334dnl 335dnl Use --with-encryption to turn on encryption support 336dnl 337AC_ARG_ENABLE(encryption, 338 [ --enable-encryption enable encryption support], 339 [case "${enableval}" in 340 yes) encryption=true ;; 341 no) encryption=false ;; 342 *) AC_MSG_ERROR(bad value ${enableval} for encryption option) ;; 343 esac], 344 [encryption=false]) 345if test "$encryption" = "true"; then 346 AC_DEFINE(ENCRYPTION) 347fi 348 349AC_CHECK_FUNC(gethostname, :, LIBOBJS="$LIBOBJS hostname.o") 350 351# Check for options requesting client and server feature. If none are 352# given and we have connect(), we want the full client & server arrangement. 353AC_ARG_ENABLE(client, 354[ --enable-client include code for running as a remote client (default) 355 --disable-client don't include remote client code], 356[if test "$enable_client" = yes; then 357 AC_DEFINE(CLIENT_SUPPORT) 358fi], 359[if test "$ac_cv_search_connect" != no; then 360 AC_DEFINE(CLIENT_SUPPORT) 361fi]) 362AC_ARG_ENABLE(server, 363[ --enable-server include code for running as a server (default) 364 --disable-server don't include server code], 365[if test "$enable_server" = yes; then 366 AC_DEFINE(SERVER_SUPPORT) 367fi], 368[if test "$ac_cv_search_connect" != no; then 369 AC_DEFINE(SERVER_SUPPORT) 370 enable_server=yes 371fi]) 372 373### The auth server needs to be able to check passwords against passwd 374### file entries, so we only #define AUTH_SERVER_SUPPORT if we can 375### find the crypt function. 376### 377### We used to test for crypt in libc first, and only add -lcrypt if 378### we couldn't find it, but that interacts badly with the cache 379### variables, the 'unset' command isn't portable, and I'm not sure 380### there's any harm in just testing for -lcrypt first. 381### 382### XXX OpenBSD has crypt in libc, but don't carry libcrypt. However 383### XXX it used to have libcrypt which means old systems that hasn't 384### XXX explicitly removed libcrypt will establish dependencies on the 385### XXX obsolete library. 386 387if test "$enable_server" = yes; then 388AC_CHECK_FUNCS(crypt) 389if test "$ac_cv_func_crypt" = no; then 390AC_CHECK_LIB(crypt, crypt) 391AC_CHECK_FUNCS(crypt) 392fi 393 394if test "$ac_cv_func_crypt" = yes; then 395 AC_DEFINE(AUTH_SERVER_SUPPORT) 396fi 397fi # enable_server 398 399dnl For the moment we will assume that all systems which have 400dnl the unixyness to run configure are unixy enough to do the 401dnl PreservePermissions stuff. I have this sinking feeling that 402dnl things won't be that simple, before long. 403dnl AC_DEFINE(PRESERVE_PERMISSIONS_SUPPORT) 404 405dnl On cygwin32, we configure like a Unix system, but we use the 406dnl Windows support code in lib/fncase.c to handle the case 407dnl insensitive file system. We also need some support libraries. We 408dnl do this at the end so that the new libraries are added at the end 409dnl of LIBS. 410AC_CACHE_CHECK(for cygwin32, ccvs_cv_sys_cygwin32, 411[AC_TRY_COMPILE([], [return __CYGWIN32__;], 412ccvs_cv_sys_cygwin32=yes, ccvs_cv_sys_cygwin32=no)]) 413if test $ccvs_cv_sys_cygwin32 = yes; then 414 LIBOBJS="$LIBOBJS fncase.o" 415 LIBS="$LIBS -ladvapi32" 416 417 dnl On Windows you can only change file times if you can write to 418 dnl the file. cygwin32 should really handle this for us, but as of 419 dnl January 1998 it doesn't. 420 AC_DEFINE(UTIME_EXPECTS_WRITABLE) 421 422 dnl On Windows we must use setmode to change between binary and text 423 dnl mode. 424 AC_DEFINE(USE_SETMODE_STDOUT) 425 AC_DEFINE(HAVE_SETMODE) 426fi 427 428test -f src/options.h && ( 429 AC_MSG_WARN(saving ./src/options.h in ./src/options.h-SAVED) 430 AC_MSG_WARN(You may wish to check that local options have not been lost.) 431 AC_MSG_WARN(Do not re-run ./configure or ./config.status until you have....) 432 cp ./src/options.h ./src/options.h-SAVED 433) 434 435AC_OUTPUT([Makefile \ 436 contrib/Makefile \ 437 contrib/clmerge \ 438 contrib/cln_hist \ 439 contrib/commit_prep \ 440 contrib/cvs_acls \ 441 contrib/log \ 442 contrib/log_accum \ 443 contrib/mfpipe \ 444 contrib/rcslock \ 445 contrib/sccs2rcs \ 446 diff/Makefile \ 447 doc/Makefile \ 448 emx/Makefile \ 449 lib/Makefile \ 450 man/Makefile \ 451 os2/Makefile \ 452 src/Makefile \ 453 src/cvsbug \ 454 tools/Makefile \ 455 vms/Makefile \ 456 windows-NT/Makefile \ 457 windows-NT/SCC/Makefile \ 458 zlib/Makefile], 459 [chmod -f +x \ 460 contrib/clmerge \ 461 contrib/cln_hist \ 462 contrib/commit_prep \ 463 contrib/cvs_acls \ 464 contrib/log \ 465 contrib/log_accum \ 466 contrib/mfpipe \ 467 contrib/rcslock \ 468 contrib/sccs2rcs \ 469 src/cvsbug]) 470