1 dnl $Id: configure.in,v 8.138 1996/12/04 19:07:35 bostic Exp $ (Berkeley) $Date: 1996/12/04 19:07:35 $
3 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT(../common/main.c)
5 AC_CONFIG_HEADER(config.h)
12 dnl If the user wants a debugging environment, set OPTFLAG now. (Some
13 dnl compilers won't mix optimizing and debug flags.)
14 AC_MSG_CHECKING(if --enable-debug option specified)
16 [ --enable-debug Build a debugging version.],
17 [vi_cv_debug="yes"], [vi_cv_debug="no"])
18 if test "$vi_cv_debug" = yes; then
20 OPTFLAG=${OPTFLAG-"-g"}
21 no_op_OPTFLAG=${no_op_OPTFLAG-"-g"}
23 AC_MSG_RESULT($vi_cv_debug)
25 dnl This is where we handle stuff that autoconf can't handle.
27 dnl Don't override anything if it's already set from the environment.
29 dnl Compiler, preprocessor and load flags.
30 dnl AUX: -ZP disables _BSD_SOURCE et al, but enables POSIX at link time.
31 dnl LynxOS: We check for gcc 2.x or better, the gcc 1 that was shipped with
32 dnl LynxOS historically wasn't good enough.
35 aix3.2.5) OPTFLAG=${OPTFLAG-"-O"};;
36 aix4.1*) CFLAGS=${CFLAGS-"-qstrict"}
37 OPTFLAG=${OPTFLAG-"-O3"};;
38 aux*) CPPFLAGS=${CPPFLAGS-"-ZP -D_BSD_SOURCE -D_SYSV_SOURCE -D_AUX_SOURCE"}
39 LDFLAGS=${LDFLAGS-"-ZP"}
40 OPTFLAG=${OPTFLAG-"-O"};;
41 bsd4.4) OPTFLAG=${OPTFLAG-"-O2"};;
42 bsdi*) CC=${CC-"shlicc"}
43 OPTFLAG=${OPTFLAG-"-O2"};;
44 irix6*) OPTFLAG=${OPTFLAG-"-O2"};;
45 irix*) OPTFLAG=${OPTFLAG-"-O2"};;
47 AC_MSG_CHECKING([for GNU C (gcc) version 2.x])
48 ac_cv_gcc_vers=`${CC-cc} -v 2>&1 | \
49 grep "gcc version " | sed 's/.*version //'`
50 ac_cv_gcc_major=`echo "$ac_cv_gcc_vers" | sed 's/\..*//'`
51 if test "$ac_cv_gcc_major" = "2" ; then
55 echo "Fatal error: Nvi requires gcc 2.x to build on LynxOS."
56 echo "See build/README.LynxOS for more information."
59 nextstep3) CPPFLAGS=${CPPFLAGS-"-w -pipe -posix"}
60 LDFLAGS=${LDFLAGS-"-posix"}
61 OPTFLAG=${OPTFLAG-"-O9"};;
62 osf*) CFLAGS=${CFLAGS-"-Olimit 1000"};;
63 solaris*) no_op_OPTFLAG=${no_op_OPTFLAG-""};;
64 sunos*) no_op_OPTFLAG=${no_op_OPTFLAG-""};;
67 dnl The default compiler is cc.
71 dnl The default OPTFLAG is -O
73 OPTFLAG=${OPTFLAG-"-O"}
75 dnl The SunOS/Solaris compiler can't optimize vi/v_txt.c; the symptom is
76 dnl that the command 35i==<esc> turns into an infinite loop.
77 AC_SUBST(no_op_OPTFLAG)
78 no_op_OPTFLAG=${no_op_OPTFLAG-"$OPTFLAG"}
82 bsdi2.1) LIBS=${LIBS-"-lipc"};;
83 dgux*) LIBS=${LIBS-"-ldgc"};;
84 irix6*) LIBS=${LIBS-"-lbsd"};;
85 irix*) LIBS=${LIBS-"-lc_s -lbsd"};;
86 isc*) LIBS=${LIBS-"-lcposix -linet"};;
87 netbsd1*) LIBS=${LIBS-"-lcrypt"};;
88 ptx*) LIBS=${LIBS-"-lseq -linet -lsocket"};;
89 sco3.2*) LIBS=${LIBS-"-lsocket"};;
90 sinix*) LIBS=${LIBS-"-lelf -lc"};;
91 solaris*) LIBS=${LIBS-"-lsocket -lnsl -ldl"}
93 wgs*) LIBS=${LIBS-"-lnsl"};;
96 dnl A/UX has a broken getopt(3), strpbrk(3).
98 aux*) LIBOBJS="getopt.o strpbrk.o $LIBOBJS";;
101 dnl Ultrix has a broken POSIX.1 VDISABLE value.
103 ultrix*) AC_DEFINE(HAVE_BROKEN_VDISABLE);;
106 dnl The user may have additional CPP information.
107 CPPFLAGS="$ADDCPPFLAGS $CPPFLAGS"
109 dnl The user may have additional load line information.
110 LDFLAGS="$ADDLDFLAGS $LDFLAGS"
112 dnl The user may have additional library information.
113 LIBS="$ADDLIBS $LIBS"
115 dnl Check to see if it's going to work.
118 dnl Checks for programs.
119 PATH="$PATH:/usr/bin:/usr/sbin:/sbin:/etc:/usr/etc:/usr/lib:/usr/ucblib:"
121 dnl Check for the shell path.
122 AC_PATH_PROG(vi_cv_path_shell, sh, no)
123 if test "$vi_cv_path_shell" = no; then
124 echo "Fatal error: the shell utility not found."
128 dnl Check for the sendmail path.
129 AC_PATH_PROG(vi_cv_path_sendmail, sendmail, no)
130 if test "$vi_cv_path_sendmail" = no; then
131 echo "WARNING: The sendmail utility was not found!"
132 echo "WARNING: Users will not be told of saved files."
135 dnl Check for the perl5/perl path.
136 AC_SUBST(vi_cv_path_perl)
137 AC_PATH_PROGS(vi_cv_path_perl, perl5 perl, no)
139 dnl Check for the "preserve" path.
140 dnl Historically, nvi has used /var/tmp/vi.recover. The Linux filesystem
141 dnl standard (FSSTND) uses /var/preserve; we add the vi.recover directory
142 dnl beneath it so that we don't have name collisions with other editors.
143 dnl Other systems have /var/preserve as well, so we test first for an already
144 dnl existing name, and then use the first one that's writeable.
145 AC_SUBST(vi_cv_path_preserve)
146 AC_MSG_CHECKING(for preserve directory)
147 AC_CACHE_VAL(vi_cv_path_preserve, [dnl
148 dirlist="/var/preserve /var/tmp /usr/tmp"
149 vi_cv_path_preserve=no
150 for i in $dirlist; do
151 if test -d $i/vi.recover; then
152 vi_cv_path_preserve=$i/vi.recover
156 if test "$vi_cv_path_preserve" = no; then
157 for i in $dirlist; do
158 if test -d $i -a -w $i; then
159 vi_cv_path_preserve=$i/vi.recover
165 if test "$vi_cv_path_preserve" = no; then
166 echo "Fatal error: no writeable preserve directory found."
169 AC_MSG_RESULT($vi_cv_path_preserve)
171 dnl Check for programs used for installation
172 AC_PATH_PROG(vi_cv_path_chmod, chmod, missing_chmod)
173 AC_PATH_PROG(vi_cv_path_cp, cp, missing_cp)
174 AC_PATH_PROG(vi_cv_path_ln, ln, missing_ln)
175 AC_PATH_PROG(vi_cv_path_mkdir, mkdir, missing_mkdir)
176 AC_PATH_PROG(vi_cv_path_rm, rm, missing_rm)
177 AC_PATH_PROG(vi_cv_path_strip, strip, missing_strip)
179 dnl Checks for libraries.
180 dnl Find the X libraries and includes.
183 if test "$no_x" != yes; then
184 if test "X$x_libraries" != "X"; then
185 if test "X$RLIBS" = "Xyes"; then
186 XLIBS="-R$x_libraries -L$x_libraries $XLIBS"
188 XLIBS="-L$x_libraries $XLIBS"
192 if test "X$x_includes" != "X"; then
193 XINCS="-I$x_includes"
197 dnl If the user wants a curses IPC front-end for nvi, build it.
199 AC_MSG_CHECKING(if --enable-ipc option specified)
201 [ --enable-ipc Build a curses IPC front-end for vi.],
202 [vi_cv_ipc="yes"], [vi_cv_ipc="no"])
203 AC_MSG_RESULT($vi_cv_ipc)
204 if test "$vi_cv_ipc" = "yes"; then
205 nvi_curses=nvi_curses
208 dnl If the user wants a Motif IPC front-end for nvi, build it.
211 AC_MSG_CHECKING(if --enable-motif option specified)
213 [ --enable-motif Build a Motif front-end for vi.],
214 [vi_cv_motif="yes"], [vi_cv_motif="no"])
215 AC_MSG_RESULT($vi_cv_motif)
216 if test "$vi_cv_motif" = "yes"; then
220 dnl BSDI's Motif libraries aren't shared.
222 dnl The Xinside Motif distribution requires -lSM, -lICE and -lXext.
223 dnl -lXext is generally available, the others aren't.
226 MOTIFLIBS="-lXm -lXt -lSM -lICE -lXext $XLIBS $LIBS";;
227 *) MOTIFLIBS="-lXm -lXt"
228 AC_CHECK_LIB(SM, main,
229 [vi_cv_smlib="yes"], [vi_cv_smlib="no"], -lSM)
230 if test "$vi_cv_smlib" = "yes"; then
231 MOTIFLIBS="$MOTIFLIBS -lSM"
233 AC_CHECK_LIB(ICE, main,
234 [vi_cv_icelib="yes"], [vi_cv_icelib="no"], -lICE)
235 if test "$vi_cv_icelib" = "yes"; then
236 MOTIFLIBS="$MOTIFLIBS -lICE"
238 AC_CHECK_LIB(Xext, main,
239 [vi_cv_xextlib="yes"], [vi_cv_xextlib="no"], -lXext)
240 if test "$vi_cv_xextlib" = "yes"; then
241 MOTIFLIBS="$MOTIFLIBS -lXext"
243 MOTIFLIBS="$MOTIFLIBS $XLIBS $LIBS";;
247 dnl If the user wants a Perl interpreter in nvi, load it.
249 AC_SUBST(vi_cv_perllib)
250 AC_MSG_CHECKING(if --enable-perlinterp option specified)
251 AC_ARG_ENABLE(perlinterp,
252 [ --enable-perlinterp Include a Perl interpreter in vi.],
253 [vi_cv_perlinterp="yes"], [vi_cv_perlinterp="no"])
254 AC_MSG_RESULT($vi_cv_perlinterp)
255 if test "$vi_cv_perlinterp" = "yes"; then
256 if test "$vi_cv_path_perl" = no; then
257 echo "Fatal error: no perl5 utility found."
260 $vi_cv_path_perl -e 'require 5.002' || {
261 echo "Fatal error: perl5 must be version 5.002 or later."
264 $vi_cv_path_perl -e 'close(STDERR);require 5.003_01' &&
265 AC_DEFINE(HAVE_PERL_5_003_01)
267 eval `$vi_cv_path_perl -V:shrpenv`
268 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
271 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlib}'`
272 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
273 -e 'ccflags;perl_inc'`
274 if test "X$perlcppflags" != "X"; then
275 CPPFLAGS="$perlcppflags $CPPFLAGS"
277 perllibs=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
279 if test "X$perllibs" != "X"; then
280 LIBS="$perllibs $LIBS"
282 perlldflags=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
284 if test "X$perlldflags" != "X"; then
285 LDFLAGS="$perlldflags $LDFLAGS"
287 LIBOBJS="perl.o perlsfio.o $LIBOBJS"
288 AC_DEFINE(HAVE_PERL_INTERP)
291 dnl If the user wants a Tk/Tcl interpreter in nvi, load it. Make sure that
292 dnl we can find a Tk/Tcl library.
293 AC_MSG_CHECKING(if --enable-tclinterp option specified)
294 AC_ARG_ENABLE(tclinterp,
295 [ --enable-tclinterp Include a Tk/Tcl interpreter in vi.],
296 [vi_cv_tclinterp="yes"], [vi_cv_tclinterp="no"])
297 AC_MSG_RESULT($vi_cv_tclinterp)
298 if test "$vi_cv_tclinterp" = "yes"; then
299 LIBOBJS="tcl.o $LIBOBJS"
300 LIBS="-ltk -ltcl -lm $XLIBS $LIBS"
301 AC_DEFINE(HAVE_TCL_INTERP)
303 AC_CHECK_LIB(tcl, main,
304 [vi_cv_tkfatal="no"], [vi_cv_tkfatal="yes"], -ltk -lm)
305 if test "$vi_cv_tkfatal" = "yes"; then
306 echo "Fatal error: no Tk/Tcl library; see the section"
307 echo "ADDING LIBRARIES AND INCLUDE FILES in the README file."
312 dnl Check for the termcap/termlib library. Compile in nvi's curses routines
313 dnl unless the user specifies otherwise. These two checks must occur in the
314 dnl current order, and -lcurses must be loaded before -ltermcap/-ltermlib.
315 AC_CHECK_LIB(termlib, tgetent,
316 [vi_cv_termlib=-ltermlib], [vi_cv_termlib=no])
317 if test "$vi_cv_termlib" = no; then
318 AC_CHECK_LIB(termcap, tgetent,
319 [vi_cv_termlib=-ltermcap], [vi_cv_termlib=no])
321 if test "$vi_cv_termlib" != no; then
322 LIBS="$vi_cv_termlib $LIBS"
325 AC_MSG_CHECKING(if --disable-curses option specified)
326 AC_ARG_ENABLE(curses,
327 [ --disable-curses DON'T use the nvi-provided curses routines.],
328 [vi_cv_curses="other curses"], [vi_cv_curses="bundled curses"])
329 AC_MSG_RESULT($vi_cv_curses)
330 case "$vi_cv_curses" in
332 CPPFLAGS="-I\$(srcdir)/curses $CPPFLAGS"
335 LIBS="-lcurses $LIBS";;
338 dnl Checks for header files.
339 AC_MSG_CHECKING(for sys/mman.h)
340 AC_CACHE_VAL(vi_cv_include_sys_mman, [dnl
341 AC_TRY_CPP([#include <sys/mman.h>],
342 [vi_cv_include_sys_mman=yes], [vi_cv_include_sys_mman=no])])
343 if test "$vi_cv_include_sys_mman" = yes; then
344 AC_DEFINE(HAVE_SYS_MMAN_H)
346 AC_MSG_RESULT($vi_cv_include_sys_mman)
348 AC_MSG_CHECKING(for sys/select.h)
349 AC_CACHE_VAL(vi_cv_include_sys_select, [dnl
350 AC_TRY_CPP([#include <sys/select.h>],
351 [vi_cv_include_sys_select=yes], [vi_cv_include_sys_select=no])])
352 if test "$vi_cv_include_sys_select" = yes; then
353 AC_DEFINE(HAVE_SYS_SELECT_H)
355 AC_MSG_RESULT($vi_cv_include_sys_select)
357 dnl Checks for typedefs, structures, and compiler characteristics.
358 AC_CHECK_TYPE(ssize_t, int)
368 dnl Checks for library functions.
369 AC_CHECK_FUNCS(bsearch gethostname getopt memchr memcpy memmove memset)
370 AC_REPLACE_FUNCS(bsearch gethostname getopt memchr memcpy memmove memset)
371 AC_CHECK_FUNCS(mkstemp mmap snprintf strdup strerror strpbrk strtol)
372 AC_REPLACE_FUNCS(mkstemp mmap snprintf strdup strerror strpbrk strtol)
373 AC_CHECK_FUNCS(strtoul vsnprintf)
374 AC_REPLACE_FUNCS(strtoul vsnprintf)
376 AC_CHECK_FUNCS(select)
377 AC_CHECK_FUNCS(setenv, [need_env=no], [need_env=yes])
378 AC_CHECK_FUNCS(strsep, [need_strsep=no], [need_strsep=yes])
379 AC_CHECK_FUNCS(unsetenv,, [need_env=yes])
384 dnl If we needed setenv or unsetenv, add in the clib/env.c replacement file.
385 if test "$need_env" = yes; then
386 LIBOBJS="env.o $LIBOBJS"
389 dnl If we need strsep, add it and define it so we get a prototype.
390 if test "$need_strsep" = yes; then
391 LIBOBJS="strsep.o $LIBOBJS"
394 dnl Check for fcntl/flock
395 dnl Use flock preferentially, since it has cleaner semantics and won't
396 dnl hang up the editor.
398 dnl Ultrix has a broken fcntl, but a working flock.
399 dnl IRIX and DGUX have a broken flock, but working fcntl.
400 AC_MSG_CHECKING(for fcntl/flock)
401 AC_CACHE_VAL(vi_cv_lock, [dnl
407 AC_TRY_LINK([#include <fcntl.h>], [flock(0, 0);],
408 [vi_cv_lock=flock]);;
410 if test "$vi_cv_lock" = none; then
411 AC_TRY_LINK([#include <fcntl.h>], [fcntl(0, F_SETLK, 0);],
415 if test "$vi_cv_lock" = flock; then
416 AC_DEFINE(HAVE_LOCK_FLOCK)
418 if test "$vi_cv_lock" = fcntl; then
419 AC_DEFINE(HAVE_LOCK_FCNTL)
421 AC_MSG_RESULT($vi_cv_lock)
423 dnl Check for ftruncate/chsize
424 AC_MSG_CHECKING(for ftruncate/chsize)
425 AC_CACHE_VAL(vi_cv_ftruncate, [dnl
426 AC_TRY_LINK([#include <unistd.h>], [ftruncate(0, 0);],
427 [vi_cv_ftruncate=ftruncate],
428 AC_TRY_LINK([#include <unistd.h>], [chsize(0, 0);],
429 [vi_cv_ftruncate=chsize], [vi_cv_ftruncate=no]))])
430 if test "$vi_cv_ftruncate" = ftruncate; then
431 AC_DEFINE(HAVE_FTRUNCATE_FTRUNCATE)
433 if test "$vi_cv_ftruncate" = chsize; then
434 AC_DEFINE(HAVE_FTRUNCATE_CHSIZE)
436 if test "$vi_cv_ftruncate" = no; then
438 echo "Fatal error: no file truncation system call."
441 AC_MSG_RESULT($vi_cv_ftruncate)
443 dnl Check for the tigetstr/tigetnum functions.
444 AC_MSG_CHECKING(for tigetstr/tigetnum)
445 AC_CACHE_VAL(vi_cv_have_curses_tigetstr, [dnl
446 AC_TRY_LINK([#include <curses.h>], [tigetstr(0);],
447 [vi_cv_have_curses_tigetstr=yes],
448 [vi_cv_have_curses_tigetstr=no])])
449 if test "$vi_cv_have_curses_tigetstr" = yes; then
450 AC_DEFINE(HAVE_CURSES_TIGETSTR)
452 AC_MSG_RESULT($vi_cv_have_curses_tigetstr)
454 dnl Check for potentially missing curses functions in system or user-specified
455 dnl libraries. We also have to guess at whether the specified library is a
456 dnl BSD or System V style curses. Use the newterm function, all System V
457 dnl curses implementations have it, none, as far as I know, of the BSD ones do.
458 if test "$vi_cv_curses" = "bundled curses"; then
459 AC_DEFINE(HAVE_BSD_CURSES)
460 AC_DEFINE(HAVE_CURSES_ADDNSTR)
461 AC_DEFINE(HAVE_CURSES_IDLOK)
463 dnl Check for the addnstr function.
464 AC_MSG_CHECKING(for addnstr)
465 AC_CACHE_VAL(vi_cv_have_curses_addnstr, [dnl
466 AC_TRY_LINK([#include <curses.h>], [addnstr(0, 0);],
467 [vi_cv_have_curses_addnstr=yes],
468 [vi_cv_have_curses_addnstr=no])])
469 if test "$vi_cv_have_curses_addnstr" = yes; then
470 AC_DEFINE(HAVE_CURSES_ADDNSTR)
472 AC_MSG_RESULT($vi_cv_have_curses_addnstr)
474 dnl Check for the beep function.
475 AC_MSG_CHECKING(for beep)
476 AC_CACHE_VAL(vi_cv_have_curses_beep, [dnl
477 AC_TRY_LINK([#include <curses.h>], [beep();],
478 [vi_cv_have_curses_beep=yes],
479 [vi_cv_have_curses_beep=no])])
480 if test "$vi_cv_have_curses_beep" = yes; then
481 AC_DEFINE(HAVE_CURSES_BEEP)
483 AC_MSG_RESULT($vi_cv_have_curses_beep)
485 dnl Check for the flash function.
486 AC_MSG_CHECKING(for flash)
487 AC_CACHE_VAL(vi_cv_have_curses_flash, [dnl
488 AC_TRY_LINK([#include <curses.h>], [flash();],
489 [vi_cv_have_curses_flash=yes],
490 [vi_cv_have_curses_flash=no])])
491 if test "$vi_cv_have_curses_flash" = yes; then
492 AC_DEFINE(HAVE_CURSES_FLASH)
494 AC_MSG_RESULT($vi_cv_have_curses_flash)
496 dnl Check for the idlok function.
497 AC_MSG_CHECKING(for idlok)
498 AC_CACHE_VAL(vi_cv_have_curses_idlok, [dnl
499 AC_TRY_LINK([#include <curses.h>], [idlok(0, 0);],
500 [vi_cv_have_curses_idlok=yes],
501 [vi_cv_have_curses_idlok=no])])
502 if test "$vi_cv_have_curses_idlok" = yes; then
503 AC_DEFINE(HAVE_CURSES_IDLOK)
505 AC_MSG_RESULT($vi_cv_have_curses_idlok)
507 dnl Check for the keypad function.
508 AC_MSG_CHECKING(for keypad)
509 AC_CACHE_VAL(vi_cv_have_curses_keypad, [dnl
510 AC_TRY_LINK([#include <curses.h>], [keypad(0, 0);],
511 [vi_cv_have_curses_keypad=yes],
512 [vi_cv_have_curses_keypad=no])])
513 if test "$vi_cv_have_curses_keypad" = yes; then
514 AC_DEFINE(HAVE_CURSES_KEYPAD)
516 AC_MSG_RESULT($vi_cv_have_curses_keypad)
518 dnl Check for the newterm function.
519 AC_MSG_CHECKING(for newterm)
520 AC_CACHE_VAL(vi_cv_have_curses_newterm, [dnl
521 AC_TRY_LINK([#include <curses.h>], [newterm(0, 0, 0);],
522 [vi_cv_have_curses_newterm=yes],
523 [vi_cv_have_curses_newterm=no])])
524 if test "$vi_cv_have_curses_newterm" = yes; then
525 AC_DEFINE(HAVE_CURSES_NEWTERM)
527 AC_MSG_RESULT($vi_cv_have_curses_newterm)
529 if test "$vi_cv_have_curses_newterm" = no; then
530 AC_DEFINE(HAVE_BSD_CURSES)
534 dnl Check for the setupterm function. We make this check regardless of
535 dnl using the system library, because it may be part of the underlying
536 dnl termcap/termlib support, and we want to use the local one.
537 AC_MSG_CHECKING(for setupterm)
538 AC_CACHE_VAL(vi_cv_have_curses_setupterm, [dnl
539 AC_TRY_LINK([#include <curses.h>], [setupterm(0, 0, 0);],
540 [vi_cv_have_curses_setupterm=yes],
541 [vi_cv_have_curses_setupterm=no])])
542 if test "$vi_cv_have_curses_setupterm" = yes; then
543 AC_DEFINE(HAVE_CURSES_SETUPTERM)
545 AC_MSG_RESULT($vi_cv_have_curses_setupterm)
547 dnl Some moron decided to drop off an argument from the gettimeofday call,
548 dnl without changing the name.
549 AC_MSG_CHECKING(for broken gettimeofday system call)
550 AC_CACHE_VAL(vi_cv_gettimeofday, [dnl
551 AC_TRY_LINK([#include <sys/types.h>
552 #include <sys/time.h>], [gettimeofday(0, 0);],
553 [vi_cv_gettimeofday=okay], [vi_cv_gettimeofday=broken])])
554 if test "$vi_cv_gettimeofday" = broken; then
555 AC_DEFINE(HAVE_BROKEN_GETTIMEOFDAY)
557 AC_MSG_RESULT($vi_cv_gettimeofday)
559 dnl Check for which version of openpty to use, System V or Berkeley.
560 AC_MSG_CHECKING(for System V pty calls)
561 AC_CACHE_VAL(vi_cv_sys5_pty, [dnl
562 AC_TRY_LINK(, [grantpt(0);],
563 [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])])
564 if test "$vi_cv_sys5_pty" = yes; then
565 AC_DEFINE(HAVE_SYS5_PTY)
567 AC_MSG_RESULT($vi_cv_sys5_pty)
569 dnl Check for the revoke system call.
570 AC_MSG_CHECKING(for revoke system call)
571 AC_CACHE_VAL(vi_cv_revoke, [dnl
572 AC_TRY_LINK(, [revoke("a");],
573 [vi_cv_revoke=yes], [vi_cv_revoke=no])])
574 if test "$vi_cv_revoke" = yes; then
575 AC_DEFINE(HAVE_REVOKE)
577 AC_MSG_RESULT($vi_cv_revoke)
579 dnl Some versions of sprintf return a pointer to the first argument instead
580 dnl of a character count. We assume that the return value of snprintf and
581 dnl vsprintf etc. will be the same as sprintf, and check the easy one.
582 AC_MSG_CHECKING(for int type sprintf return value)
583 AC_CACHE_VAL(vi_cv_sprintf_count, [dnl
584 AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}],
585 [vi_cv_sprintf_count=yes], [vi_cv_sprintf_count=no])])
586 if test "$vi_cv_sprintf_count" = no; then
587 AC_DEFINE(SPRINTF_RET_CHARPNT)
589 AC_MSG_RESULT($vi_cv_sprintf_count)
591 dnl We compile in nvi's DB routines unless the user specifies otherwise.
592 AC_MSG_CHECKING(if --disable-db option specified)
594 [ --disable-db DON'T use the nvi-provided DB routines.],
595 [vi_cv_db_lib="other DB"], [vi_cv_db_lib="bundled DB"])
596 AC_MSG_RESULT($vi_cv_db_lib)
597 case "$vi_cv_db_lib" in
599 CPPFLAGS="-I\$(srcdir)/db/include $CPPFLAGS"
600 LIBOBJS="\$(DBOBJS) $LIBOBJS";;
605 dnl We compile in nvi's RE routines unless the user specifies otherwise.
606 AC_MSG_CHECKING(if --disable-re option specified)
608 [ --disable-re DON'T use the nvi-provided RE routines.],
609 [vi_cv_re_lib="other RE"], [vi_cv_re_lib="bundled RE"])
610 AC_MSG_RESULT($vi_cv_re_lib)
611 case "$vi_cv_re_lib" in
613 CPPFLAGS="-I\$(srcdir)/regex $CPPFLAGS"
614 LIBOBJS="\$(REOBJS) $LIBOBJS";;
619 dnl Check for the standard shorthand types.
620 AC_SUBST(u_char_decl)
621 AC_MSG_CHECKING(for u_char)
622 AC_CACHE_VAL(vi_cv_uchar, [dnl
623 AC_TRY_COMPILE([#include <sys/types.h>], u_char foo;,
624 [vi_cv_uchar=yes], [vi_cv_uchar=no])])
625 AC_MSG_RESULT($vi_cv_uchar)
626 if test "$vi_cv_uchar" = no; then
627 u_char_decl="typedef unsigned char u_char;"
630 AC_SUBST(u_short_decl)
631 AC_MSG_CHECKING(for u_short)
632 AC_CACHE_VAL(vi_cv_ushort, [dnl
633 AC_TRY_COMPILE([#include <sys/types.h>], u_short foo;,
634 [vi_cv_ushort=yes], [vi_cv_ushort=no])])
635 AC_MSG_RESULT($vi_cv_ushort)
636 if test "$vi_cv_ushort" = no; then
637 u_short_decl="typedef unsigned short u_short;"
641 AC_MSG_CHECKING(for u_int)
642 AC_CACHE_VAL(vi_cv_uint, [dnl
643 AC_TRY_COMPILE([#include <sys/types.h>], u_int foo;,
644 [vi_cv_uint=yes], [vi_cv_uint=no])])
645 AC_MSG_RESULT($vi_cv_uint)
646 if test "$vi_cv_uint" = no; then
647 u_int_decl="typedef unsigned int u_int;"
650 AC_SUBST(u_long_decl)
651 AC_MSG_CHECKING(for u_long)
652 AC_CACHE_VAL(vi_cv_ulong, [dnl
653 AC_TRY_COMPILE([#include <sys/types.h>], u_long foo;,
654 [vi_cv_ulong=yes], [vi_cv_ulong=no])])
655 AC_MSG_RESULT($vi_cv_ulong)
656 if test "$vi_cv_ulong" = no; then
657 u_long_decl="typedef unsigned long u_long;"
660 dnl DB/Vi use specific integer sizes.
661 AC_SUBST(u_int8_decl)
662 AC_MSG_CHECKING(for u_int8_t)
663 AC_CACHE_VAL(vi_cv_uint8, [dnl
664 AC_TRY_COMPILE([#include <sys/types.h>], u_int8_t foo;,
666 AC_TRY_RUN([main(){exit(sizeof(unsigned char) != 1);}],
667 [vi_cv_uint8="unsigned char"], [vi_cv_uint8=no]))])
668 AC_MSG_RESULT($vi_cv_uint8)
669 if test "$vi_cv_uint8" = no; then
671 echo "Fatal error: no unsigned, 8-bit integral type."
674 if test "$vi_cv_uint8" != yes; then
675 u_int8_decl="typedef $vi_cv_uint8 u_int8_t;"
678 AC_SUBST(u_int16_decl)
679 AC_MSG_CHECKING(for u_int16_t)
680 AC_CACHE_VAL(vi_cv_uint16, [dnl
681 AC_TRY_COMPILE([#include <sys/types.h>], u_int16_t foo;,
683 AC_TRY_RUN([main(){exit(sizeof(unsigned short) != 2);}],
684 [vi_cv_uint16="unsigned short"],
685 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 2);}],
686 [vi_cv_uint16="unsigned int"], [vi_cv_uint16=no])))])
687 AC_MSG_RESULT($vi_cv_uint16)
688 if test "$vi_cv_uint16" = no; then
690 echo "Fatal error: no unsigned, 16-bit integral type."
693 if test "$vi_cv_uint16" != yes; then
694 u_int16_decl="typedef $vi_cv_uint16 u_int16_t;"
698 AC_MSG_CHECKING(for int16_t)
699 AC_CACHE_VAL(vi_cv_int16, [dnl
700 AC_TRY_COMPILE([#include <sys/types.h>], int16_t foo;,
702 AC_TRY_RUN([main(){exit(sizeof(short) != 2);}],
703 [vi_cv_int16="short"],
704 AC_TRY_RUN([main(){exit(sizeof(int) != 2);}],
705 [vi_cv_int16="int"], [vi_cv_int16=no])))])
706 AC_MSG_RESULT($vi_cv_int16)
707 if test "$vi_cv_int16" = no; then
709 echo "Fatal error: no signed, 16-bit integral type."
712 if test "$vi_cv_int16" != yes; then
713 int16_decl="typedef $vi_cv_int16 int16_t;"
716 AC_SUBST(u_int32_decl)
717 AC_MSG_CHECKING(for u_int32_t)
718 AC_CACHE_VAL(vi_cv_uint32, [dnl
719 AC_TRY_COMPILE([#include <sys/types.h>], u_int32_t foo;,
721 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}],
722 [vi_cv_uint32="unsigned int"],
723 AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}],
724 [vi_cv_uint32="unsigned long"], [vi_cv_uint32=no])))])
725 AC_MSG_RESULT($vi_cv_uint32)
726 if test "$vi_cv_uint32" = no; then
728 echo "Fatal error: no unsigned, 32-bit integral type."
731 if test "$vi_cv_uint32" != yes; then
732 u_int32_decl="typedef $vi_cv_uint32 u_int32_t;"
736 AC_MSG_CHECKING(for int32_t)
737 AC_CACHE_VAL(vi_cv_int32, [dnl
738 AC_TRY_COMPILE([#include <sys/types.h>], int32_t foo;,
740 AC_TRY_RUN([main(){exit(sizeof(int) != 4);}],
742 AC_TRY_RUN([main(){exit(sizeof(long) != 4);}],
743 [vi_cv_int32="long"], [vi_cv_int32=no])))])
744 AC_MSG_RESULT($vi_cv_int32)
745 if test "$vi_cv_int32" = no; then
747 echo "Fatal error: no signed, 32-bit integral type."
750 if test "$vi_cv_int32" != yes; then
751 int32_decl="typedef $vi_cv_int32 int32_t;"
754 AC_OUTPUT(Makefile port.h:port.h.in
755 pathnames.h:pathnames.h.in recover:recover.in)