configure.in revision 25839
1dnl configure.in for cvs 2AC_INIT(src/cvs.h) 3dnl 4AC_PREREQ(2.4)dnl Required Autoconf version. 5dnl Do not use autoconf 2.12; it produces a configure script which produces 6dnl a "internal 2K buffer" error on HPUX when run with /bin/sh. 7dnl autoconf 2.10 seems like a good choice. 8dnl 9dnl It is possible that we should just change the above required version 10dnl to 2.10; it seems like everyone is using 2.10 anyway, and there is 11dnl at least some sentiment that we should be using a version which has 12dnl --bindir (and correspondingly, using @bindir@ and friends in our 13dnl Makefile.in files. I'm not sure exactly what version of autoconf 14dnl introduced --bindir but I know 2.10 has it. 15AC_CONFIG_HEADER(config.h src/options.h) 16 17AC_PROG_CC 18 19AC_AIX 20AC_MINIX 21AC_ISC_POSIX 22if test "$ISC" = yes; then 23CFLAGS="$CFLAGS -D_SYSV3" 24LIBS="-lcrypt $LIBS" 25fi 26 27AC_PREFIX_PROGRAM(cvs) 28 29dnl FIXME: AC_C_CROSS is considered obsolete by autoconf 2.12, and is 30dnl pretty ugly to start with. But it isn't obvious to me how we should 31dnl be handling the uses of cross_compiling below. 32AC_C_CROSS 33 34AC_C_CONST 35 36AC_PROG_INSTALL 37AC_PROG_RANLIB 38AC_PROG_YACC 39AC_PROG_MAKE_SET 40 41AC_PATH_PROG(perl_path, perl, no) 42AC_PATH_PROG(csh_path, csh, no) 43 44AC_SYS_INTERPRETER 45if 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' 48 AC_MSG_WARN($ac_msg) 49fi 50 51AC_HEADER_STDC 52AC_CHECK_HEADERS(errno.h unistd.h string.h memory.h utime.h fcntl.h ndbm.h \ 53 sys/param.h sys/select.h sys/time.h sys/timeb.h \ 54 io.h direct.h sys/bsdtypes.h sys/resource.h) 55AC_HEADER_SYS_WAIT 56AC_HEADER_STAT 57AC_HEADER_TIME 58AC_HEADER_DIRENT 59AC_TYPE_SIGNAL 60AC_TYPE_UID_T 61AC_TYPE_MODE_T 62AC_TYPE_SIZE_T 63AC_TYPE_PID_T 64AC_REPLACE_FUNCS(getwd mkdir rename strdup strstr dup2 strerror valloc waitpid vasprintf strtoul) 65AC_CHECK_FUNCS(fchmod fsync ftime mkfifo mktemp putenv vfork vprintf ftruncate timezone getpagesize initgroups fchdir sigaction sigprocmask sigvec sigsetmask sigblock tempnam tzset readlink wait3) 66 67dnl 68dnl Look for shadow password files before we go ahead and set getspnam. 69dnl On some systems (Linux), the C library has getspnam but shadow 70dnl passwords might not be in use. 71dnl 72dnl We used to check for the existence of the /etc/security directory 73dnl here, but that's incorrect, since it's possible to have PAM installed 74dnl without using shadow passwords. 75dnl 76AC_MSG_CHECKING([for evidence of shadow passwords]) 77if test -f /etc/shadow \ 78 || test -f /etc/security/passwd.adjunct ; then 79 found="yes" 80 AC_CHECK_LIB(sec, getspnam) 81 AC_CHECK_FUNCS(getspnam) 82else 83 found="no" 84fi 85AC_MSG_RESULT([$found]) 86 87AC_CHECK_FUNC(re_exec, :, LIBOBJS="$LIBOBJS regex.o") 88AC_FUNC_UTIME_NULL 89AC_SYS_LONG_FILE_NAMES 90 91AC_MSG_CHECKING([for working fnmatch function]) 92AC_CACHE_VAL(ccvs_cv_sys_working_fnmatch, 93[AC_TRY_RUN([ 94#include <fnmatch.h> 95int 96main () 97{ 98 exit ((fnmatch ("a", "a", FNM_PATHNAME) == 0 99 && fnmatch ("a", "b", FNM_PATHNAME) == FNM_NOMATCH) 100 ? 0 : 1); 101}], 102ccvs_cv_sys_working_fnmatch=yes, 103ccvs_cv_sys_working_fnmatch=no, 104ccvs_cv_sys_working_fnmatch=no)]) 105if test $ccvs_cv_sys_working_fnmatch = no; then 106 LIBOBJS="$LIBOBJS fnmatch.o" 107fi 108AC_MSG_RESULT($ccvs_cv_sys_working_fnmatch) 109 110# If we can't find connect, try looking in -lsocket, -lnsl, and -linet. 111# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has 112# libsocket.so which has a bad implementation of gethostbyname (it 113# only looks in /etc/hosts), so we only look for -lsocket if we need 114# it. 115AC_CHECK_FUNC(connect, :, 116[case "$LIBS" in 117*-lnsl*) ;; 118*) AC_CHECK_LIB(nsl_s, printf) ;; 119esac 120case "$LIBS" in 121*-lnsl*) ;; 122*) AC_CHECK_LIB(nsl, printf) ;; 123esac 124case "$LIBS" in 125*-lsocket*) ;; 126*) AC_CHECK_LIB(socket, connect) ;; 127esac 128case "$LIBS" in 129*-linet*) ;; 130*) AC_CHECK_LIB(inet, connect) ;; 131esac 132dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value 133dnl has been cached. 134if test "$ac_cv_lib_socket_connect" = "yes" || test "$ac_cv_lib_inet_connect" = "yes"; then 135 ac_cv_func_connect=yes 136 AC_DEFINE(HAVE_CONNECT) 137fi]) 138 139dnl 140dnl set $(KRB4) from --with-krb4=value -- WITH_KRB4 141dnl 142KRB4=/usr/kerberos 143define(WITH_KRB4,[ 144AC_ARG_WITH([krb4], 145 [ --with-krb4=value set default \$(KRB4) from value], 146 [KRB4=$withval], 147)dnl 148echo "default place for krb4 is $KRB4" 149AC_SUBST(KRB4)])dnl 150WITH_KRB4 151 152krb_h= 153AC_MSG_CHECKING([for krb.h]) 154AC_TRY_LINK([#include <krb.h>],[int i;], 155 [krb_h=yes krb_incdir=], 156 [if test "$cross_compiling" != yes && test -r $KRB4/include/krb.h; then 157 hold_cflags=$CFLAGS 158 CFLAGS="$CFLAGS -I$KRB4/include" 159 AC_TRY_LINK([#include <krb.h>],[int i;], 160 [krb_h=yes krb_incdir=$KRB4/include]) 161 CFLAGS=$hold_cflags 162 fi]) 163if test -z "$krb_h"; then 164 AC_TRY_LINK([#include <krb.h>],[int i;], 165 [krb_h=yes krb_incdir=], 166 [if test "$cross_compiling" != yes && test -r $KRB4/include/kerberosIV/krb.h; then 167 hold_cflags=$CFLAGS 168 CFLAGS="$CFLAGS -I$KRB4/include/kerberosIV" 169 AC_TRY_LINK([#include <krb.h>],[int i;], 170 [krb_h=yes krb_incdir=$KRB4/include/kerberosIV]) 171 CFLAGS=$hold_cflags 172 fi]) 173fi 174AC_MSG_RESULT($krb_h) 175 176if test -n "$krb_h"; then 177 krb_lib= 178 AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=], 179 [if test "$cross_compiling" != yes && test -r $KRB4/lib/libkrb.a; then 180 krb_lib=yes krb_libdir=$KRB4/lib 181 fi]) 182 if test -n "$krb_lib"; then 183 AC_DEFINE(HAVE_KERBEROS) 184 test -n "${krb_libdir}" && LIBS="${LIBS} -L${krb_libdir}" 185 LIBS="${LIBS} -lkrb" 186 # Put -L${krb_libdir} in LDFLAGS temporarily so that it appears before 187 # -ldes in the command line. Don't do it permanently so that we honor 188 # the user's setting for LDFLAGS 189 hold_ldflags=$LDFLAGS 190 test -n "${krb_libdir}" && LDFLAGS="$LDFLAGS -L${krb_libdir}" 191 AC_CHECK_LIB(des,printf,[LIBS="${LIBS} -ldes"]) 192 LDFLAGS=$hold_ldflags 193 if test -n "$krb_incdir"; then 194 includeopt="${includeopt} -I$krb_incdir" 195 AC_SUBST(includeopt) 196 fi 197 fi 198fi 199AC_CHECK_FUNCS(krb_get_err_text) 200 201dnl 202dnl Use --with-encryption to turn on encryption support 203dnl 204AC_ARG_ENABLE(encryption, 205 [ --enable-encryption enable encryption support], 206 [case "${enableval}" in 207 yes) encryption=true ;; 208 no) encryption=false ;; 209 *) AC_MSG_ERROR(bad value ${enableval} for encryption option) ;; 210 esac], 211 [encryption=false]) 212if test "$encryption" = "true"; then 213 AC_DEFINE(ENCRYPTION) 214fi 215 216AC_CHECK_FUNC(gethostname, :, LIBOBJS="$LIBOBJS hostname.o") 217 218# Check for options requesting client and server feature. If none are 219# given and we have connect(), we want the full client & server arrangement. 220AC_ARG_ENABLE(client, 221[ --enable-client include code for running as a remote client (default) 222 --disable-client don't include remote client code], 223[if test "$enable_client" = yes; then 224 AC_DEFINE(CLIENT_SUPPORT) 225fi], 226[if test "$ac_cv_func_connect" = yes; then 227 AC_DEFINE(CLIENT_SUPPORT) 228fi]) 229AC_ARG_ENABLE(server, 230[ --enable-server include code for running as a server (default) 231 --disable-server don't include server code], 232[if test "$enable_server" = yes; then 233 AC_DEFINE(SERVER_SUPPORT) 234fi], 235[if test "$ac_cv_func_connect" = yes; then 236 AC_DEFINE(SERVER_SUPPORT) 237 enable_server=yes 238fi]) 239 240### The auth server needs to be able to check passwords against passwd 241### file entries, so we only #define AUTH_SERVER_SUPPORT if we can 242### find the crypt function. 243### 244### We used to test for crypt in libc first, and only add -lcrypt if 245### we couldn't find it, but that interacts badly with the cache 246### variables, the 'unset' command isn't portable, and I'm not sure 247### there's any harm in just testing for -lcrypt first. 248 249if test "$enable_server" = yes; then 250AC_CHECK_LIB(crypt, crypt) 251AC_CHECK_FUNCS(crypt) 252 253if test "$ac_cv_func_crypt" = yes; then 254 AC_DEFINE(AUTH_SERVER_SUPPORT) 255fi 256fi # enable_server 257 258test -f src/options.h && ( 259 AC_MSG_WARN(saving ./src/options.h in ./src/options.h-SAVED) 260 AC_MSG_WARN(You may wish to check that local options have not been lost.) 261 AC_MSG_WARN(Do not re-run ./configure or ./config.status until you have....) 262 cp ./src/options.h ./src/options.h-SAVED 263) 264 265AC_OUTPUT(Makefile lib/Makefile src/Makefile zlib/Makefile doc/Makefile \ 266 man/Makefile tools/Makefile tools/pcl-cvs/Makefile \ 267 contrib/Makefile contrib/elib/Makefile \ 268 windows-NT/Makefile windows-NT/SCC/Makefile \ 269 os2/Makefile macintosh/Makefile vms/Makefile \ 270 stamp-h) 271