]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/cvs/configure.in
This commit was generated by cvs2svn to compensate for changes in r53024,
[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.  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)
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                  limits.h sys/file.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)
56 AC_HEADER_SYS_WAIT
57 AC_HEADER_STAT
58 AC_HEADER_TIME
59 AC_HEADER_DIRENT
60 AC_TYPE_SIGNAL
61 AC_TYPE_UID_T
62 AC_TYPE_MODE_T
63 AC_TYPE_SIZE_T
64 AC_TYPE_PID_T
65 AC_STRUCT_ST_BLKSIZE
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)
68
69 dnl
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.
73 dnl
74 AC_DEFINE(HAVE_STRCHR)
75 AC_DEFINE(HAVE_MEMCHR)
76
77 dnl
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.
89 dnl
90 AC_FUNC_VFORK
91 AC_FUNC_CLOSEDIR_VOID
92
93 dnl
94 dnl Check for shadow password support.
95 dnl
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)
101
102 dnl We always use CVS's regular expression matcher.
103 dnl This is because:
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
117 dnl matching.
118 dnl
119 dnl AC_CHECK_FUNC(re_exec, :, LIBOBJS="$LIBOBJS regex.o")
120 AC_FUNC_UTIME_NULL
121 AC_SYS_LONG_FILE_NAMES
122
123 AC_MSG_CHECKING([for working fnmatch function])
124 AC_CACHE_VAL(ccvs_cv_sys_working_fnmatch,
125 [AC_TRY_RUN([
126 #include <fnmatch.h>
127 int
128 main ()
129 {
130   exit ((fnmatch ("a", "a", FNM_PATHNAME) == 0
131          && fnmatch ("a", "b", FNM_PATHNAME) == FNM_NOMATCH)
132         ? 0 : 1);
133 }],
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"
139 fi
140 AC_MSG_RESULT($ccvs_cv_sys_working_fnmatch)
141
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
146 # it.
147 AC_CHECK_FUNC(connect, :, 
148 [case "$LIBS" in
149 *-lnsl*) ;;
150 *) AC_CHECK_LIB(nsl_s, printf) ;;
151 esac
152 case "$LIBS" in
153 *-lnsl*) ;;
154 *) AC_CHECK_LIB(nsl, printf) ;;
155 esac
156 case "$LIBS" in
157 *-lsocket*) ;;
158 *) AC_CHECK_LIB(socket, connect) ;;
159 esac
160 case "$LIBS" in
161 *-linet*) ;;
162 *) AC_CHECK_LIB(inet, connect) ;;
163 esac
164 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
165 dnl has been cached.
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)
169 fi])
170
171 dnl
172 dnl set $(KRB4) from --with-krb4=value -- WITH_KRB4
173 dnl
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.
177 dnl
178 KRB4=/usr/kerberos
179 define(WITH_KRB4,[
180 AC_ARG_WITH([krb4],
181   [  --with-krb4=value       set default \$(KRB4) from value],
182   [KRB4=$withval],
183 )dnl
184 echo "default place for krb4 is $KRB4"
185 AC_SUBST(KRB4)])dnl
186 WITH_KRB4
187
188 krb_h=
189 AC_MSG_CHECKING([for krb.h])
190 if test "$cross_compiling" != yes && test -r $KRB4/include/krb.h; then
191    hold_cflags=$CFLAGS
192    CFLAGS="$CFLAGS -I$KRB4/include"
193    AC_TRY_LINK([#include <krb.h>],[int i;],
194           [krb_h=yes krb_incdir=$KRB4/include],
195           [CFLAGS=$hold_cflags
196            AC_TRY_LINK([#include <krb.h>],[int i;],
197              [krb_h=yes krb_incdir=])])
198    CFLAGS=$hold_cflags
199 else
200    AC_TRY_LINK([#include <krb.h>],[int i;],
201              [krb_h=yes krb_incdir=])
202 fi
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
207        hold_cflags=$CFLAGS
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])
211        CFLAGS=$hold_cflags
212      fi])
213 fi
214 AC_MSG_RESULT($krb_h)
215
216 includeopt=
217 AC_SUBST(includeopt)
218 if test -n "$krb_h"; then
219   krb_lib=
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
229   else
230        AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=])
231   fi
232   if test -n "$krb_lib"; then
233     AC_DEFINE(HAVE_KERBEROS)
234     test -n "${krb_libdir}" && LIBS="${LIBS} -L${krb_libdir}"
235     LIBS="${LIBS} -lkrb"
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"
245     fi
246   fi
247 fi
248 AC_CHECK_FUNCS(krb_get_err_text)
249
250 dnl
251 dnl Use --with-gssapi=DIR to enable GSSAPI support.
252 dnl
253 GSSAPI=/usr/cygnus/kerbnet
254 define(WITH_GSSAPI,[
255 AC_ARG_WITH([gssapi],
256   [  --with-gssapi=value     GSSAPI directory],
257   [GSSAPI=$withval],
258 )dnl
259 echo "default place for GSSAPI is $GSSAPI"
260 AC_SUBST(GSSAPI)])dnl
261 WITH_GSSAPI
262
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
267
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"
274   else
275     LIBS="$LIBS -L$GSSAPI/lib -lgssapi_krb5 -lkrb5 -lcrypto -lcom_err"
276   fi
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))
281   else
282     AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi/gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE))
283   fi
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)
288 fi
289
290 dnl
291 dnl Use --with-encryption to turn on encryption support
292 dnl
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) ;;
299    esac],
300   [encryption=false])
301 if test "$encryption" = "true"; then
302   AC_DEFINE(ENCRYPTION)
303 fi
304
305 AC_CHECK_FUNC(gethostname, :, LIBOBJS="$LIBOBJS hostname.o")
306
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)
314 fi],
315 [if test "$ac_cv_func_connect" = yes; then
316   AC_DEFINE(CLIENT_SUPPORT)
317 fi])
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)
323 fi],
324 [if test "$ac_cv_func_connect" = yes; then
325   AC_DEFINE(SERVER_SUPPORT)
326   enable_server=yes
327 fi])
328
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. 
332 ###
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.
337
338 if test "$enable_server" = yes; then
339 AC_CHECK_LIB(crypt, crypt)
340 AC_CHECK_FUNCS(crypt)
341
342 if test "$ac_cv_func_crypt" = yes; then
343   AC_DEFINE(AUTH_SERVER_SUPPORT)
344 fi
345 fi # enable_server
346
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)
352
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
357 dnl of LIBS.
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"
364
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)
369
370   dnl On Windows we must use setmode to change between binary and text
371   dnl mode.
372   AC_DEFINE(USE_SETMODE_STDOUT)
373   AC_DEFINE(HAVE_SETMODE)
374 fi
375
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
381 )
382
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 \
388           stamp-h)