]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/cvs/configure.in
Import cvs-1.9.10
[FreeBSD/FreeBSD.git] / contrib / cvs / configure.in
1 dnl configure.in for cvs
2 AC_INIT(src/cvs.h)
3 dnl
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.
8 dnl
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.  I'm not sure exactly what version of autoconf
14 dnl introduced --bindir but I know 2.10 has it.
15 AC_CONFIG_HEADER(config.h src/options.h)
16
17 AC_PROG_CC
18
19 AC_AIX
20 AC_MINIX
21 AC_ISC_POSIX
22 if test "$ISC" = yes; then
23 CFLAGS="$CFLAGS -D_SYSV3"
24 LIBS="-lcrypt $LIBS"
25 fi
26
27 AC_PREFIX_PROGRAM(cvs)
28
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.
32 AC_C_CROSS
33
34 AC_C_CONST
35
36 AC_PROG_INSTALL
37 AC_PROG_RANLIB
38 AC_PROG_YACC
39 AC_PROG_MAKE_SET
40
41 AC_PATH_PROG(perl_path, perl, no)
42 AC_PATH_PROG(csh_path, csh, no)
43
44 AC_SYS_INTERPRETER
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'
48   AC_MSG_WARN($ac_msg)
49 fi
50
51 AC_HEADER_STDC
52 AC_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)
55 AC_HEADER_SYS_WAIT
56 AC_HEADER_STAT
57 AC_HEADER_TIME
58 AC_HEADER_DIRENT
59 AC_TYPE_SIGNAL
60 AC_TYPE_UID_T
61 AC_TYPE_MODE_T
62 AC_TYPE_SIZE_T
63 AC_TYPE_PID_T
64 AC_REPLACE_FUNCS(getwd mkdir rename strdup strstr dup2 strerror valloc waitpid vasprintf strtoul)
65 AC_CHECK_FUNCS(fchmod fsync ftime mktemp putenv vfork vprintf ftruncate timezone getpagesize initgroups fchdir sigaction sigprocmask sigvec sigsetmask sigblock tempnam tzset readlink wait3)
66
67 dnl
68 dnl Look for shadow password files before we go ahead and set getspnam.
69 dnl On some systems (Linux), the C library has getspnam but shadow
70 dnl passwords might not be in use.
71 dnl
72 dnl We used to check for the existence of the /etc/security directory
73 dnl here, but that's incorrect, since it's possible to have PAM installed
74 dnl without using shadow passwords.
75 dnl
76 AC_MSG_CHECKING([for evidence of shadow passwords])
77 if 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)
82 else
83   found="no"
84 fi
85 AC_MSG_RESULT([$found])
86
87 AC_CHECK_FUNC(re_exec, :, LIBOBJS="$LIBOBJS regex.o")
88 AC_FUNC_UTIME_NULL
89 AC_SYS_LONG_FILE_NAMES
90
91 AC_MSG_CHECKING([for working fnmatch function])
92 AC_CACHE_VAL(ccvs_cv_sys_working_fnmatch,
93 [AC_TRY_RUN([
94 #include <fnmatch.h>
95 int
96 main ()
97 {
98   exit ((fnmatch ("a", "a", FNM_PATHNAME) == 0
99          && fnmatch ("a", "b", FNM_PATHNAME) == FNM_NOMATCH)
100         ? 0 : 1);
101 }],
102 ccvs_cv_sys_working_fnmatch=yes,
103 ccvs_cv_sys_working_fnmatch=no,
104 ccvs_cv_sys_working_fnmatch=no)])
105 if test $ccvs_cv_sys_working_fnmatch = no; then
106   LIBOBJS="$LIBOBJS fnmatch.o"
107 fi
108 AC_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.
115 AC_CHECK_FUNC(connect, :, 
116 [case "$LIBS" in
117 *-lnsl*) ;;
118 *) AC_CHECK_LIB(nsl_s, printf) ;;
119 esac
120 case "$LIBS" in
121 *-lnsl*) ;;
122 *) AC_CHECK_LIB(nsl, printf) ;;
123 esac
124 case "$LIBS" in
125 *-lsocket*) ;;
126 *) AC_CHECK_LIB(socket, connect) ;;
127 esac
128 case "$LIBS" in
129 *-linet*) ;;
130 *) AC_CHECK_LIB(inet, connect) ;;
131 esac
132 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
133 dnl has been cached.
134 if 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)
137 fi])
138
139 dnl
140 dnl set $(KRB4) from --with-krb4=value -- WITH_KRB4
141 dnl
142 KRB4=/usr/kerberos
143 define(WITH_KRB4,[
144 AC_ARG_WITH([krb4],
145   [  --with-krb4=value       set default \$(KRB4) from value],
146   [KRB4=$withval],
147 )dnl
148 echo "default place for krb4 is $KRB4"
149 AC_SUBST(KRB4)])dnl
150 WITH_KRB4
151
152 krb_h=
153 AC_MSG_CHECKING([for krb.h])
154 AC_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])
163 if 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])
173 fi
174 AC_MSG_RESULT($krb_h)
175
176 if 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
198 fi
199 AC_CHECK_FUNCS(krb_get_err_text)
200
201 dnl
202 dnl Use --with-encryption to turn on encryption support
203 dnl
204 AC_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])
212 if test "$encryption" = "true"; then
213   AC_DEFINE(ENCRYPTION)
214 fi
215
216 AC_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.
220 AC_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)
225 fi],
226 [if test "$ac_cv_func_connect" = yes; then
227   AC_DEFINE(CLIENT_SUPPORT)
228 fi])
229 AC_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)
234 fi],
235 [if test "$ac_cv_func_connect" = yes; then
236   AC_DEFINE(SERVER_SUPPORT)
237   enable_server=yes
238 fi])
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
249 if test "$enable_server" = yes; then
250 AC_CHECK_LIB(crypt, crypt)
251 AC_CHECK_FUNCS(crypt)
252
253 if test "$ac_cv_func_crypt" = yes; then
254   AC_DEFINE(AUTH_SERVER_SUPPORT)
255 fi
256 fi # enable_server
257
258 test -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
265 AC_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 emx/Makefile macintosh/Makefile vms/Makefile \
270           stamp-h)