1 dnl $Id: configure.in,v 8.146 1997/08/03 13:31:30 bostic Exp $ (Berkeley) $Date: 1997/08/03 13:31:30 $
2 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 AC_MSG_RESULT($vi_cv_debug)
19 if test "$vi_cv_debug" = yes; then
21 OPTFLAG=${OPTFLAG-"-g"}
22 no_op_OPTFLAG=${no_op_OPTFLAG-"-g"}
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-"-O2"};;
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 OPTFLAG is -O
69 OPTFLAG=${OPTFLAG-"-O"}
71 dnl The default compiler is cc (NOT gcc), the default CFLAGS is empty,
72 dnl NOT whatever AC_PROG_CC sets.
78 dnl The SunOS/Solaris compiler can't optimize vi/v_txt.c; the symptom is
79 dnl that the command 35i==<esc> turns into an infinite loop.
80 AC_SUBST(no_op_OPTFLAG)
81 no_op_OPTFLAG=${no_op_OPTFLAG-"$OPTFLAG"}
85 bsdi2.1) LIBS=${LIBS-"-lipc"};;
86 dgux*) LIBS=${LIBS-"-ldgc"};;
87 irix6*) LIBS=${LIBS-"-lbsd"};;
88 irix*) LIBS=${LIBS-"-lc_s -lbsd"};;
89 isc*) LIBS=${LIBS-"-lcposix -linet"};;
90 netbsd1*) LIBS=${LIBS-"-lcrypt"};;
91 ptx*) LIBS=${LIBS-"-lseq -linet -lsocket"};;
92 sco3.2*) LIBS=${LIBS-"-lsocket"};;
93 sinix*) LIBS=${LIBS-"-lelf -lc"};;
94 solaris*) LIBS=${LIBS-"-lsocket -lnsl -ldl"}
96 wgs*) LIBS=${LIBS-"-lnsl"};;
99 dnl A/UX has a broken getopt(3), strpbrk(3).
101 aux*) LIBOBJS="getopt.o strpbrk.o $LIBOBJS";;
104 dnl Ultrix has a broken POSIX.1 VDISABLE value.
106 ultrix*) AC_DEFINE(HAVE_BROKEN_VDISABLE);;
109 dnl If the user wants a tracing version, add the TRACE compile flag.
110 AC_MSG_CHECKING(if --enable-trace option specified)
112 [ --enable-trace Build a tracing version.],
113 [vi_cv_trace="yes"], [vi_cv_trace="no"])
114 if test "$vi_cv_trace" = yes; then
115 CPPFLAGS="-DTRACE $CPPFLAGS"
117 AC_MSG_RESULT($vi_cv_trace)
119 dnl The user may have additional CPP information.
120 CPPFLAGS="$ADDCPPFLAGS $CPPFLAGS"
122 dnl The user may have additional load line information.
123 LDFLAGS="$ADDLDFLAGS $LDFLAGS"
125 dnl The user may have additional library information.
126 LIBS="$ADDLIBS $LIBS"
128 dnl Check to see if it's going to work.
131 dnl Checks for programs.
132 PATH="$PATH:/usr/bin:/usr/sbin:/sbin:/etc:/usr/etc:/usr/lib:/usr/ucblib"
134 dnl Check for the shell path.
135 AC_PATH_PROG(vi_cv_path_shell, sh, no)
136 if test "$vi_cv_path_shell" = no; then
137 echo "Fatal error: the shell utility not found."
141 dnl Check for the sendmail path.
142 AC_PATH_PROG(vi_cv_path_sendmail, sendmail, no)
143 if test "$vi_cv_path_sendmail" = no; then
144 echo "WARNING: The sendmail utility was not found!"
145 echo "WARNING: Users will not be told of saved files."
148 dnl Check for the perl5/perl path.
149 AC_SUBST(vi_cv_path_perl)
150 AC_PATH_PROGS(vi_cv_path_perl, perl5 perl, no)
152 dnl Check for the "preserve" path.
153 dnl Historically, nvi has used /var/tmp/vi.recover. The Linux filesystem
154 dnl standard (FSSTND) uses /var/preserve; we add the vi.recover directory
155 dnl beneath it so that we don't have name collisions with other editors.
156 dnl Other systems have /var/preserve as well, so we test first for an already
157 dnl existing name, and then use the first one that's writeable.
158 AC_SUBST(vi_cv_path_preserve)
159 AC_MSG_CHECKING(for preserve directory)
160 AC_CACHE_VAL(vi_cv_path_preserve, [dnl
161 dirlist="/var/preserve /var/tmp /usr/tmp"
162 vi_cv_path_preserve=no
163 for i in $dirlist; do
164 if test -d $i/vi.recover; then
165 vi_cv_path_preserve=$i/vi.recover
169 if test "$vi_cv_path_preserve" = no; then
170 for i in $dirlist; do
171 if test -d $i -a -w $i; then
172 vi_cv_path_preserve=$i/vi.recover
178 if test "$vi_cv_path_preserve" = no; then
179 echo "Fatal error: no writeable preserve directory found."
182 AC_MSG_RESULT($vi_cv_path_preserve)
184 dnl Check for programs used for installation
185 AC_PATH_PROG(vi_cv_path_ar, ar, missing_ar)
186 AC_PATH_PROG(vi_cv_path_chmod, chmod, missing_chmod)
187 AC_PATH_PROG(vi_cv_path_cp, cp, missing_cp)
188 AC_PATH_PROG(vi_cv_path_ln, ln, missing_ln)
189 AC_PATH_PROG(vi_cv_path_mkdir, mkdir, missing_mkdir)
190 AC_PATH_PROG(vi_cv_path_rm, rm, missing_rm)
191 AC_PATH_PROG(vi_cv_path_ranlib, ranlib, missing_ranlib)
192 AC_PATH_PROG(vi_cv_path_strip, strip, missing_strip)
194 dnl Checks for libraries.
195 dnl Find the X libraries and includes.
198 if test "$no_x" != yes; then
199 if test "X$x_libraries" != "X"; then
200 if test "X$RLIBS" = "Xyes"; then
201 XLIBS="-R$x_libraries -L$x_libraries $XLIBS"
203 XLIBS="-L$x_libraries $XLIBS"
207 if test "X$x_includes" != "X"; then
208 XINCS="-I$x_includes"
212 dnl If the user wants a Motif IPC front-end for nvi, build it.
215 AC_MSG_CHECKING(if --enable-motif option specified)
217 [ --enable-motif Build a Motif front-end for vi.],
218 [vi_cv_motif="yes"], [vi_cv_motif="no"])
219 AC_MSG_RESULT($vi_cv_motif)
220 if test "$vi_cv_motif" = "yes"; then
224 dnl BSDI's Motif libraries aren't shared.
231 dnl The Xinside Motif distribution requires -lSM, -lICE and -lXext.
232 dnl -lXext is generally available, the others aren't.
235 dnl Color icons require -lXpm, which may or may not be available,
236 dnl depending on the version of X11.
238 MOTIFLIBS="-lXm -lXt"
239 AC_CHECK_LIB(SM, main,
240 [vi_cv_smlib="yes"], [vi_cv_smlib="no"], "$XLIBS")
241 if test "$vi_cv_smlib" = "yes"; then
242 MOTIFLIBS="$MOTIFLIBS -lSM"
244 AC_CHECK_LIB(ICE, main,
245 [vi_cv_icelib="yes"], [vi_cv_icelib="no"], "$XLIBS")
246 if test "$vi_cv_icelib" = "yes"; then
247 MOTIFLIBS="$MOTIFLIBS -lICE"
249 AC_CHECK_LIB(Xext, main,
250 [vi_cv_xextlib="yes"], [vi_cv_xextlib="no"], "$XLIBS")
251 if test "$vi_cv_xextlib" = "yes"; then
252 MOTIFLIBS="$MOTIFLIBS -lXext"
254 AC_CHECK_LIB(Xpm, main,
255 [vi_cv_xpmlib="yes"], [vi_cv_xpmlib="no"], "$XLIBS")
256 if test "$vi_cv_xpmlib" = "yes"; then
257 MOTIFLIBS="$MOTIFLIBS -lXpm"
259 MOTIFLIBS="$MOTIFLIBS $XLIBS -lm $LIBS"
262 dnl If the user wants a Perl interpreter in nvi, load it.
264 AC_SUBST(vi_cv_perllib)
265 AC_MSG_CHECKING(if --enable-perlinterp option specified)
266 AC_ARG_ENABLE(perlinterp,
267 [ --enable-perlinterp Include a Perl interpreter in vi.],
268 [vi_cv_perlinterp="yes"], [vi_cv_perlinterp="no"])
269 AC_MSG_RESULT($vi_cv_perlinterp)
270 if test "$vi_cv_perlinterp" = "yes"; then
271 if test "$vi_cv_path_perl" = no; then
272 echo "Fatal error: no perl5 utility found."
275 $vi_cv_path_perl -e 'require 5.002' || {
276 echo "Fatal error: perl5 must be version 5.002 or later."
279 $vi_cv_path_perl -e 'close(STDERR);require 5.003_01' &&
280 AC_DEFINE(HAVE_PERL_5_003_01)
282 eval `$vi_cv_path_perl -V:shrpenv`
283 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
286 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlib}'`
287 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
288 -e 'ccflags;perl_inc'`
289 if test "X$perlcppflags" != "X"; then
290 CPPFLAGS="$perlcppflags $CPPFLAGS"
292 perllibs=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
294 if test "X$perllibs" != "X"; then
295 LIBS="$perllibs $LIBS"
297 perlldflags=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
299 if test "X$perlldflags" != "X"; then
300 LDFLAGS="$perlldflags $LDFLAGS"
302 LIBOBJS="perl.o perlsfio.o $LIBOBJS"
303 AC_DEFINE(HAVE_PERL_INTERP)
306 dnl If the user wants a Tk/Tcl interpreter in nvi, load it. Make sure that
307 dnl we can find a Tk/Tcl library.
308 AC_MSG_CHECKING(if --enable-tclinterp option specified)
309 AC_ARG_ENABLE(tclinterp,
310 [ --enable-tclinterp Include a Tk/Tcl interpreter in vi.],
311 [vi_cv_tclinterp="yes"], [vi_cv_tclinterp="no"])
312 AC_MSG_RESULT($vi_cv_tclinterp)
313 if test "$vi_cv_tclinterp" = "yes"; then
314 LIBOBJS="tcl.o $LIBOBJS"
315 LIBS="-ltk -ltcl -lm $XLIBS $LIBS"
316 AC_DEFINE(HAVE_TCL_INTERP)
318 AC_CHECK_LIB(tcl, main,
319 [vi_cv_tkfatal="no"], [vi_cv_tkfatal="yes"], -ltk -lm)
320 if test "$vi_cv_tkfatal" = "yes"; then
321 echo "Fatal error: no Tk/Tcl library; see the section"
322 echo "ADDING LIBRARIES AND INCLUDE FILES in the README file."
327 dnl Check for the termcap/termlib library. Compile in nvi's curses routines
328 dnl unless the user specifies otherwise. These two checks must occur in the
329 dnl current order, and -lcurses must be loaded before -ltermcap/-ltermlib.
330 AC_CHECK_LIB(termlib, tgetent,
331 [vi_cv_termlib=-ltermlib], [vi_cv_termlib=no])
332 if test "$vi_cv_termlib" = no; then
333 AC_CHECK_LIB(termcap, tgetent,
334 [vi_cv_termlib=-ltermcap], [vi_cv_termlib=no])
336 if test "$vi_cv_termlib" != no; then
337 LIBS="$vi_cv_termlib $LIBS"
340 AC_MSG_CHECKING(if --disable-curses option specified)
341 AC_ARG_ENABLE(curses,
342 [ --disable-curses DON'T use the nvi-provided curses routines.],
343 [vi_cv_curses="other curses"], [vi_cv_curses="bundled curses"])
344 AC_MSG_RESULT($vi_cv_curses)
345 case "$vi_cv_curses" in
347 CPPFLAGS="-I\$(srcdir)/curses $CPPFLAGS"
350 LIBS="-lcurses $LIBS";;
353 dnl Checks for header files.
354 AC_MSG_CHECKING(for sys/mman.h)
355 AC_CACHE_VAL(vi_cv_include_sys_mman, [dnl
356 AC_TRY_CPP([#include <sys/mman.h>],
357 [vi_cv_include_sys_mman=yes], [vi_cv_include_sys_mman=no])])
358 if test "$vi_cv_include_sys_mman" = yes; then
359 AC_DEFINE(HAVE_SYS_MMAN_H)
361 AC_MSG_RESULT($vi_cv_include_sys_mman)
363 AC_MSG_CHECKING(for sys/select.h)
364 AC_CACHE_VAL(vi_cv_include_sys_select, [dnl
365 AC_TRY_CPP([#include <sys/select.h>],
366 [vi_cv_include_sys_select=yes], [vi_cv_include_sys_select=no])])
367 if test "$vi_cv_include_sys_select" = yes; then
368 AC_DEFINE(HAVE_SYS_SELECT_H)
370 AC_MSG_RESULT($vi_cv_include_sys_select)
372 dnl Checks for typedefs, structures, and compiler characteristics.
373 AC_CHECK_TYPE(ssize_t, int)
383 dnl Checks for library functions.
384 AC_CHECK_FUNCS(bsearch gethostname getopt memchr memcpy memmove memset)
385 AC_REPLACE_FUNCS(bsearch gethostname getopt memchr memcpy memmove memset)
386 AC_CHECK_FUNCS(mkstemp mmap snprintf strdup strerror strpbrk strtol)
387 AC_REPLACE_FUNCS(mkstemp mmap snprintf strdup strerror strpbrk strtol)
388 AC_CHECK_FUNCS(strtoul vsnprintf)
389 AC_REPLACE_FUNCS(strtoul vsnprintf)
391 AC_CHECK_FUNCS(select)
392 AC_CHECK_FUNCS(setenv, [need_env=no], [need_env=yes])
393 AC_CHECK_FUNCS(strsep, [need_strsep=no], [need_strsep=yes])
394 AC_CHECK_FUNCS(unsetenv,, [need_env=yes])
399 dnl If we needed setenv or unsetenv, add in the clib/env.c replacement file.
400 if test "$need_env" = yes; then
401 LIBOBJS="env.o $LIBOBJS"
404 dnl If we need strsep, add it and define it so we get a prototype.
405 if test "$need_strsep" = yes; then
406 LIBOBJS="strsep.o $LIBOBJS"
409 dnl Check for fcntl/flock
410 dnl Use flock preferentially, since it has cleaner semantics and won't
411 dnl hang up the editor.
413 dnl Ultrix has a broken fcntl, but a working flock.
414 dnl IRIX and DGUX have a broken flock, but working fcntl.
415 AC_MSG_CHECKING(for fcntl/flock)
416 AC_CACHE_VAL(vi_cv_lock, [dnl
422 AC_TRY_LINK([#include <fcntl.h>], [flock(0, 0);],
423 [vi_cv_lock=flock]);;
425 if test "$vi_cv_lock" = none; then
426 AC_TRY_LINK([#include <fcntl.h>], [fcntl(0, F_SETLK, 0);],
430 if test "$vi_cv_lock" = flock; then
431 AC_DEFINE(HAVE_LOCK_FLOCK)
433 if test "$vi_cv_lock" = fcntl; then
434 AC_DEFINE(HAVE_LOCK_FCNTL)
436 AC_MSG_RESULT($vi_cv_lock)
438 dnl Check for ftruncate/chsize
439 AC_MSG_CHECKING(for ftruncate/chsize)
440 AC_CACHE_VAL(vi_cv_ftruncate, [dnl
441 AC_TRY_LINK([#include <unistd.h>], [ftruncate(0, 0);],
442 [vi_cv_ftruncate=ftruncate],
443 AC_TRY_LINK([#include <unistd.h>], [chsize(0, 0);],
444 [vi_cv_ftruncate=chsize], [vi_cv_ftruncate=no]))])
445 if test "$vi_cv_ftruncate" = ftruncate; then
446 AC_DEFINE(HAVE_FTRUNCATE_FTRUNCATE)
448 if test "$vi_cv_ftruncate" = chsize; then
449 AC_DEFINE(HAVE_FTRUNCATE_CHSIZE)
451 if test "$vi_cv_ftruncate" = no; then
453 echo "Fatal error: no file truncation system call."
456 AC_MSG_RESULT($vi_cv_ftruncate)
458 dnl Check for the tigetstr/tigetnum functions.
459 AC_MSG_CHECKING(for tigetstr/tigetnum)
460 AC_CACHE_VAL(vi_cv_have_curses_tigetstr, [dnl
461 AC_TRY_LINK([#include <curses.h>], [tigetstr(0);],
462 [vi_cv_have_curses_tigetstr=yes],
463 [vi_cv_have_curses_tigetstr=no])])
464 if test "$vi_cv_have_curses_tigetstr" = yes; then
465 AC_DEFINE(HAVE_CURSES_TIGETSTR)
467 AC_MSG_RESULT($vi_cv_have_curses_tigetstr)
469 dnl Check for potentially missing curses functions in system or user-specified
470 dnl libraries. We also have to guess at whether the specified library is a
471 dnl BSD or System V style curses. Use the newterm function, all System V
472 dnl curses implementations have it, none, as far as I know, of the BSD ones do.
473 if test "$vi_cv_curses" = "bundled curses"; then
474 AC_DEFINE(HAVE_BSD_CURSES)
475 AC_DEFINE(HAVE_CURSES_ADDNSTR)
476 AC_DEFINE(HAVE_CURSES_IDLOK)
478 dnl Check for the addnstr function.
479 AC_MSG_CHECKING(for addnstr)
480 AC_CACHE_VAL(vi_cv_have_curses_addnstr, [dnl
481 AC_TRY_LINK([#include <curses.h>], [addnstr(0, 0);],
482 [vi_cv_have_curses_addnstr=yes],
483 [vi_cv_have_curses_addnstr=no])])
484 if test "$vi_cv_have_curses_addnstr" = yes; then
485 AC_DEFINE(HAVE_CURSES_ADDNSTR)
487 AC_MSG_RESULT($vi_cv_have_curses_addnstr)
489 dnl Check for the beep function.
490 AC_MSG_CHECKING(for beep)
491 AC_CACHE_VAL(vi_cv_have_curses_beep, [dnl
492 AC_TRY_LINK([#include <curses.h>], [beep();],
493 [vi_cv_have_curses_beep=yes],
494 [vi_cv_have_curses_beep=no])])
495 if test "$vi_cv_have_curses_beep" = yes; then
496 AC_DEFINE(HAVE_CURSES_BEEP)
498 AC_MSG_RESULT($vi_cv_have_curses_beep)
500 dnl Check for the flash function.
501 AC_MSG_CHECKING(for flash)
502 AC_CACHE_VAL(vi_cv_have_curses_flash, [dnl
503 AC_TRY_LINK([#include <curses.h>], [flash();],
504 [vi_cv_have_curses_flash=yes],
505 [vi_cv_have_curses_flash=no])])
506 if test "$vi_cv_have_curses_flash" = yes; then
507 AC_DEFINE(HAVE_CURSES_FLASH)
509 AC_MSG_RESULT($vi_cv_have_curses_flash)
511 dnl Check for the idlok function.
512 AC_MSG_CHECKING(for idlok)
513 AC_CACHE_VAL(vi_cv_have_curses_idlok, [dnl
514 AC_TRY_LINK([#include <curses.h>], [idlok(0, 0);],
515 [vi_cv_have_curses_idlok=yes],
516 [vi_cv_have_curses_idlok=no])])
517 if test "$vi_cv_have_curses_idlok" = yes; then
518 AC_DEFINE(HAVE_CURSES_IDLOK)
520 AC_MSG_RESULT($vi_cv_have_curses_idlok)
522 dnl Check for the keypad function.
523 AC_MSG_CHECKING(for keypad)
524 AC_CACHE_VAL(vi_cv_have_curses_keypad, [dnl
525 AC_TRY_LINK([#include <curses.h>], [keypad(0, 0);],
526 [vi_cv_have_curses_keypad=yes],
527 [vi_cv_have_curses_keypad=no])])
528 if test "$vi_cv_have_curses_keypad" = yes; then
529 AC_DEFINE(HAVE_CURSES_KEYPAD)
531 AC_MSG_RESULT($vi_cv_have_curses_keypad)
533 dnl Check for the newterm function.
534 AC_MSG_CHECKING(for newterm)
535 AC_CACHE_VAL(vi_cv_have_curses_newterm, [dnl
536 AC_TRY_LINK([#include <curses.h>], [newterm(0, 0, 0);],
537 [vi_cv_have_curses_newterm=yes],
538 [vi_cv_have_curses_newterm=no])])
539 if test "$vi_cv_have_curses_newterm" = yes; then
540 AC_DEFINE(HAVE_CURSES_NEWTERM)
542 AC_MSG_RESULT($vi_cv_have_curses_newterm)
544 if test "$vi_cv_have_curses_newterm" = no; then
545 AC_DEFINE(HAVE_BSD_CURSES)
549 dnl Check for the setupterm function. We make this check regardless of
550 dnl using the system library, because it may be part of the underlying
551 dnl termcap/termlib support, and we want to use the local one.
552 AC_MSG_CHECKING(for setupterm)
553 AC_CACHE_VAL(vi_cv_have_curses_setupterm, [dnl
554 AC_TRY_LINK([#include <curses.h>], [setupterm(0, 0, 0);],
555 [vi_cv_have_curses_setupterm=yes],
556 [vi_cv_have_curses_setupterm=no])])
557 if test "$vi_cv_have_curses_setupterm" = yes; then
558 AC_DEFINE(HAVE_CURSES_SETUPTERM)
560 AC_MSG_RESULT($vi_cv_have_curses_setupterm)
562 dnl Some moron decided to drop off an argument from the gettimeofday call,
563 dnl without changing the name.
564 AC_MSG_CHECKING(for broken gettimeofday system call)
565 AC_CACHE_VAL(vi_cv_gettimeofday, [dnl
566 AC_TRY_LINK([#include <sys/types.h>
567 #include <sys/time.h>], [gettimeofday(0, 0);],
568 [vi_cv_gettimeofday=okay], [vi_cv_gettimeofday=broken])])
569 if test "$vi_cv_gettimeofday" = broken; then
570 AC_DEFINE(HAVE_BROKEN_GETTIMEOFDAY)
572 AC_MSG_RESULT($vi_cv_gettimeofday)
574 dnl Check for which version of openpty to use, System V or Berkeley.
575 AC_MSG_CHECKING(for System V pty calls)
576 AC_CACHE_VAL(vi_cv_sys5_pty, [dnl
577 AC_TRY_LINK(, [grantpt(0);],
578 [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])])
579 if test "$vi_cv_sys5_pty" = yes; then
580 AC_DEFINE(HAVE_SYS5_PTY)
582 AC_MSG_RESULT($vi_cv_sys5_pty)
584 dnl Check for the revoke system call.
585 AC_MSG_CHECKING(for revoke system call)
586 AC_CACHE_VAL(vi_cv_revoke, [dnl
587 AC_TRY_LINK(, [revoke("a");],
588 [vi_cv_revoke=yes], [vi_cv_revoke=no])])
589 if test "$vi_cv_revoke" = yes; then
590 AC_DEFINE(HAVE_REVOKE)
592 AC_MSG_RESULT($vi_cv_revoke)
594 dnl Some versions of sprintf return a pointer to the first argument instead
595 dnl of a character count. We assume that the return value of snprintf and
596 dnl vsprintf etc. will be the same as sprintf, and check the easy one.
597 AC_MSG_CHECKING(for int type sprintf return value)
598 AC_CACHE_VAL(vi_cv_sprintf_count, [dnl
599 AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}],
600 [vi_cv_sprintf_count=yes], [vi_cv_sprintf_count=no])])
601 if test "$vi_cv_sprintf_count" = no; then
602 AC_DEFINE(SPRINTF_RET_CHARPNT)
604 AC_MSG_RESULT($vi_cv_sprintf_count)
606 dnl We compile in nvi's DB routines unless the user specifies otherwise.
607 AC_MSG_CHECKING(if --disable-db option specified)
609 [ --disable-db DON'T use the nvi-provided DB routines.],
610 [vi_cv_db_lib="other DB"], [vi_cv_db_lib="bundled DB"])
611 AC_MSG_RESULT($vi_cv_db_lib)
612 case "$vi_cv_db_lib" in
614 CPPFLAGS="-I\$(srcdir)/db/include $CPPFLAGS"
615 LIBOBJS="\$(DBOBJS) $LIBOBJS";;
620 dnl We compile in nvi's RE routines unless the user specifies otherwise.
621 AC_MSG_CHECKING(if --disable-re option specified)
623 [ --disable-re DON'T use the nvi-provided RE routines.],
624 [vi_cv_re_lib="other RE"], [vi_cv_re_lib="bundled RE"])
625 AC_MSG_RESULT($vi_cv_re_lib)
626 case "$vi_cv_re_lib" in
628 CPPFLAGS="-I\$(srcdir)/regex $CPPFLAGS"
629 LIBOBJS="\$(REOBJS) $LIBOBJS";;
634 dnl Check for the standard shorthand types.
635 AC_SUBST(u_char_decl)
636 AC_MSG_CHECKING(for u_char)
637 AC_CACHE_VAL(vi_cv_uchar, [dnl
638 AC_TRY_COMPILE([#include <sys/types.h>], u_char foo;,
639 [vi_cv_uchar=yes], [vi_cv_uchar=no])])
640 AC_MSG_RESULT($vi_cv_uchar)
641 if test "$vi_cv_uchar" = no; then
642 u_char_decl="typedef unsigned char u_char;"
645 AC_SUBST(u_short_decl)
646 AC_MSG_CHECKING(for u_short)
647 AC_CACHE_VAL(vi_cv_ushort, [dnl
648 AC_TRY_COMPILE([#include <sys/types.h>], u_short foo;,
649 [vi_cv_ushort=yes], [vi_cv_ushort=no])])
650 AC_MSG_RESULT($vi_cv_ushort)
651 if test "$vi_cv_ushort" = no; then
652 u_short_decl="typedef unsigned short u_short;"
656 AC_MSG_CHECKING(for u_int)
657 AC_CACHE_VAL(vi_cv_uint, [dnl
658 AC_TRY_COMPILE([#include <sys/types.h>], u_int foo;,
659 [vi_cv_uint=yes], [vi_cv_uint=no])])
660 AC_MSG_RESULT($vi_cv_uint)
661 if test "$vi_cv_uint" = no; then
662 u_int_decl="typedef unsigned int u_int;"
665 AC_SUBST(u_long_decl)
666 AC_MSG_CHECKING(for u_long)
667 AC_CACHE_VAL(vi_cv_ulong, [dnl
668 AC_TRY_COMPILE([#include <sys/types.h>], u_long foo;,
669 [vi_cv_ulong=yes], [vi_cv_ulong=no])])
670 AC_MSG_RESULT($vi_cv_ulong)
671 if test "$vi_cv_ulong" = no; then
672 u_long_decl="typedef unsigned long u_long;"
675 dnl DB/Vi use specific integer sizes.
676 AC_SUBST(u_int8_decl)
677 AC_MSG_CHECKING(for u_int8_t)
678 AC_CACHE_VAL(vi_cv_uint8, [dnl
679 AC_TRY_COMPILE([#include <sys/types.h>], u_int8_t foo;,
681 AC_TRY_RUN([main(){exit(sizeof(unsigned char) != 1);}],
682 [vi_cv_uint8="unsigned char"], [vi_cv_uint8=no]))])
683 AC_MSG_RESULT($vi_cv_uint8)
684 if test "$vi_cv_uint8" = no; then
686 echo "Fatal error: no unsigned, 8-bit integral type."
689 if test "$vi_cv_uint8" != yes; then
690 u_int8_decl="typedef $vi_cv_uint8 u_int8_t;"
693 AC_SUBST(u_int16_decl)
694 AC_MSG_CHECKING(for u_int16_t)
695 AC_CACHE_VAL(vi_cv_uint16, [dnl
696 AC_TRY_COMPILE([#include <sys/types.h>], u_int16_t foo;,
698 AC_TRY_RUN([main(){exit(sizeof(unsigned short) != 2);}],
699 [vi_cv_uint16="unsigned short"],
700 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 2);}],
701 [vi_cv_uint16="unsigned int"], [vi_cv_uint16=no])))])
702 AC_MSG_RESULT($vi_cv_uint16)
703 if test "$vi_cv_uint16" = no; then
705 echo "Fatal error: no unsigned, 16-bit integral type."
708 if test "$vi_cv_uint16" != yes; then
709 u_int16_decl="typedef $vi_cv_uint16 u_int16_t;"
713 AC_MSG_CHECKING(for int16_t)
714 AC_CACHE_VAL(vi_cv_int16, [dnl
715 AC_TRY_COMPILE([#include <sys/types.h>], int16_t foo;,
717 AC_TRY_RUN([main(){exit(sizeof(short) != 2);}],
718 [vi_cv_int16="short"],
719 AC_TRY_RUN([main(){exit(sizeof(int) != 2);}],
720 [vi_cv_int16="int"], [vi_cv_int16=no])))])
721 AC_MSG_RESULT($vi_cv_int16)
722 if test "$vi_cv_int16" = no; then
724 echo "Fatal error: no signed, 16-bit integral type."
727 if test "$vi_cv_int16" != yes; then
728 int16_decl="typedef $vi_cv_int16 int16_t;"
731 AC_SUBST(u_int32_decl)
732 AC_MSG_CHECKING(for u_int32_t)
733 AC_CACHE_VAL(vi_cv_uint32, [dnl
734 AC_TRY_COMPILE([#include <sys/types.h>], u_int32_t foo;,
736 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}],
737 [vi_cv_uint32="unsigned int"],
738 AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}],
739 [vi_cv_uint32="unsigned long"], [vi_cv_uint32=no])))])
740 AC_MSG_RESULT($vi_cv_uint32)
741 if test "$vi_cv_uint32" = no; then
743 echo "Fatal error: no unsigned, 32-bit integral type."
746 if test "$vi_cv_uint32" != yes; then
747 u_int32_decl="typedef $vi_cv_uint32 u_int32_t;"
751 AC_MSG_CHECKING(for int32_t)
752 AC_CACHE_VAL(vi_cv_int32, [dnl
753 AC_TRY_COMPILE([#include <sys/types.h>], int32_t foo;,
755 AC_TRY_RUN([main(){exit(sizeof(int) != 4);}],
757 AC_TRY_RUN([main(){exit(sizeof(long) != 4);}],
758 [vi_cv_int32="long"], [vi_cv_int32=no])))])
759 AC_MSG_RESULT($vi_cv_int32)
760 if test "$vi_cv_int32" = no; then
762 echo "Fatal error: no signed, 32-bit integral type."
765 if test "$vi_cv_int32" != yes; then
766 int32_decl="typedef $vi_cv_int32 int32_t;"
769 AC_OUTPUT(Makefile port.h:port.h.in
770 pathnames.h:pathnames.h.in recover:recover.in)