1 dnl @(#)configure.in 8.148 (Berkeley) 8/3/97
2 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT(../common/main.c)
5 AM_INIT_AUTOMAKE(vi, 1.80)
6 AM_CONFIG_HEADER(config.h)
15 dnl If the user wants a debugging environment, set OPTFLAG now, some
16 dnl compilers won't mix optimizing and debug flags.)
17 AC_MSG_CHECKING(if --enable-debug option specified)
19 [ --enable-debug Build a debugging version.],
20 [vi_cv_debug="yes"], [vi_cv_debug="no"])
21 AC_MSG_RESULT($vi_cv_debug)
22 if test "$vi_cv_debug" = yes; then
24 OPTFLAG=${OPTFLAG-"-g"}
25 no_op_OPTFLAG=${no_op_OPTFLAG-"-g"}
28 dnl This is where we handle stuff that autoconf can't handle.
30 dnl Don't override anything if it's already set from the environment.
32 dnl Compiler, preprocessor and load flags.
33 dnl AUX: -ZP disables _BSD_SOURCE et al, but enables POSIX at link time.
34 dnl LynxOS: We check for gcc 2.x or better, the gcc 1 that was shipped with
35 dnl LynxOS historically wasn't good enough.
38 aix3.2.5) OPTFLAG=${OPTFLAG-"-O"};;
39 aix4.1*) CFLAGS=${CFLAGS-"-qstrict"}
40 OPTFLAG=${OPTFLAG-"-O3"};;
41 aux*) CPPFLAGS=${CPPFLAGS-"-ZP -D_BSD_SOURCE -D_SYSV_SOURCE -D_AUX_SOURCE"}
42 LDFLAGS=${LDFLAGS-"-ZP"}
43 OPTFLAG=${OPTFLAG-"-O"};;
44 bsd4.4) OPTFLAG=${OPTFLAG-"-O2"};;
45 bsdi*) CC=${CC-"shlicc"}
46 OPTFLAG=${OPTFLAG-"-O2"};;
47 irix6*) OPTFLAG=${OPTFLAG-"-O2"};;
48 irix*) OPTFLAG=${OPTFLAG-"-O2"};;
50 AC_MSG_CHECKING([for GNU C (gcc) version 2.x])
51 ac_cv_gcc_vers=`${CC-cc} -v 2>&1 | \
52 grep "gcc version " | sed 's/.*version //'`
53 ac_cv_gcc_major=`echo "$ac_cv_gcc_vers" | sed 's/\..*//'`
54 if test "$ac_cv_gcc_major" = "2" ; then
58 AC_MSG_WARN([Nvi requires gcc 2.x to build on LynxOS.])
59 AC_MSG_ERROR([See build/README.LynxOS for more information.])
61 nextstep3) CPPFLAGS=${CPPFLAGS-"-w -pipe -posix"}
62 LDFLAGS=${LDFLAGS-"-posix"}
63 OPTFLAG=${OPTFLAG-"-O2"};;
64 osf*) CFLAGS=${CFLAGS-"-Olimit 1000"};;
65 solaris*) no_op_OPTFLAG=${no_op_OPTFLAG-""};;
66 sunos*) no_op_OPTFLAG=${no_op_OPTFLAG-""};;
69 dnl The default OPTFLAG is -O
71 OPTFLAG=${OPTFLAG-"-O"}
73 dnl The default compiler is cc (NOT gcc), the default CFLAGS is empty,
74 dnl NOT whatever AC_PROG_CC sets.
80 dnl The SunOS/Solaris compiler can't optimize vi/v_txt.c; the symptom is
81 dnl that the command 35i==<esc> turns into an infinite loop.
82 AC_SUBST(no_op_OPTFLAG)
83 no_op_OPTFLAG=${no_op_OPTFLAG-"$OPTFLAG"}
87 bsdi2.1) LIBS=${LIBS-"-lipc"};;
88 dgux*) LIBS=${LIBS-"-ldgc"};;
89 irix6*) LIBS=${LIBS-"-lbsd"};;
90 irix*) LIBS=${LIBS-"-lc_s -lbsd"};;
91 isc*) LIBS=${LIBS-"-lcposix -linet"};;
92 netbsd1*) LIBS=${LIBS-"-lcrypt"};;
93 ptx*) LIBS=${LIBS-"-lseq -linet -lsocket"};;
94 sco3.2*) LIBS=${LIBS-"-lsocket"};;
95 sinix*) LIBS=${LIBS-"-lelf -lc"};;
96 solaris*) LIBS=${LIBS-"-lsocket -lnsl -ldl"}
98 wgs*) LIBS=${LIBS-"-lnsl"};;
101 dnl A/UX has a broken getopt(3), strpbrk(3).
103 aux*) LIBOBJS="getopt.o strpbrk.o $LIBOBJS";;
106 dnl Ultrix has a broken POSIX.1 VDISABLE value.
108 ultrix*) AC_DEFINE(HAVE_BROKEN_VDISABLE);;
111 dnl If the user wants a tracing version, add the TRACE compile flag.
112 AC_MSG_CHECKING(if --enable-trace option specified)
114 [ --enable-trace Build a tracing version.],
115 [vi_cv_trace="yes"], [vi_cv_trace="no"])
116 if test "$vi_cv_trace" = yes; then
117 CPPFLAGS="-DTRACE $CPPFLAGS"
119 AC_MSG_RESULT($vi_cv_trace)
121 dnl The user may have additional CPP information.
122 CPPFLAGS="$ADDCPPFLAGS $CPPFLAGS"
124 dnl The user may have additional load line information.
125 LDFLAGS="$ADDLDFLAGS $LDFLAGS"
127 dnl The user may have additional library information.
128 LIBS="$ADDLIBS $LIBS"
130 dnl Checks for programs.
131 PATH="$PATH:/usr/bin:/usr/sbin:/sbin:/etc:/usr/etc:/usr/lib:/usr/ucblib"
133 dnl Check for the shell path.
134 AC_PATH_PROG(vi_cv_path_shell, sh, no)
135 if test "$vi_cv_path_shell" = no; then
136 AC_MSG_ERROR([No shell utility found.])
139 dnl Check for the sendmail path.
140 AC_PATH_PROG(vi_cv_path_sendmail, sendmail, no)
141 if test "$vi_cv_path_sendmail" = no; then
142 AC_MSG_WARN([No sendmail utility found;])
143 AC_MSG_WARN([ users will not be told of saved files.])
146 dnl Check for the perl5/perl path.
147 AC_SUBST(vi_cv_path_perl)
148 AC_PATH_PROGS(vi_cv_path_perl, perl5 perl, no)
150 dnl Check for the "preserve" path.
151 dnl Historically, nvi has used /var/tmp/vi.recover. The Linux filesystem
152 dnl standard (FSSTND) uses /var/preserve; we add the vi.recover directory
153 dnl beneath it so that we don't have name collisions with other editors.
154 dnl Other systems have /var/preserve as well, so we test first for an already
155 dnl existing name, and then use the first one that's writeable.
156 AC_SUBST(vi_cv_path_preserve)
157 AC_MSG_CHECKING(for preserve directory)
158 AC_CACHE_VAL(vi_cv_path_preserve, [dnl
159 dirlist="/var/preserve /var/tmp /usr/tmp"
160 vi_cv_path_preserve=no
161 for i in $dirlist; do
162 if test -d $i/vi.recover; then
163 vi_cv_path_preserve=$i/vi.recover
167 if test "$vi_cv_path_preserve" = no; then
168 for i in $dirlist; do
169 if test -d $i -a -w $i; then
170 vi_cv_path_preserve=$i/vi.recover
176 if test "$vi_cv_path_preserve" = no; then
177 AC_MSG_ERROR([No writeable preserve directory found.])
179 AC_MSG_RESULT($vi_cv_path_preserve)
181 dnl Check for programs used for installation
183 AC_PATH_PROG(vi_cv_path_ar, ar, missing_ar)
184 AC_PATH_PROG(vi_cv_path_chmod, chmod, missing_chmod)
185 AC_PATH_PROG(vi_cv_path_cp, cp, missing_cp)
186 AC_PATH_PROG(vi_cv_path_ln, ln, missing_ln)
187 AC_PATH_PROG(vi_cv_path_mkdir, mkdir, missing_mkdir)
188 AC_PATH_PROG(vi_cv_path_rm, rm, missing_rm)
189 AC_PATH_PROG(vi_cv_path_ranlib, ranlib, missing_ranlib)
190 AC_PATH_PROG(vi_cv_path_strip, strip, missing_strip)
192 dnl Checks for libraries.
193 dnl Find the X libraries and includes.
196 if test "$no_x" != yes; then
197 if test "X$x_libraries" != "X"; then
198 if test "X$RLIBS" = "Xyes"; then
199 XLIBS="-R$x_libraries -L$x_libraries $XLIBS"
201 XLIBS="-L$x_libraries $XLIBS"
205 if test "X$x_includes" != "X"; then
206 XINCS="-I$x_includes"
210 dnl Check if the user wants widechar support.
211 AC_MSG_CHECKING(if --enable-widechar option specified)
212 AC_ARG_ENABLE(widechar,
213 [ --enable-widechar Build a wide char aware vi.],
214 [vi_cv_widechar="yes"], [vi_cv_widechar="no"])
215 if test "$vi_cv_widechar" = "yes"; then
216 AC_DEFINE(USE_WIDECHAR)
219 dnl If the user wants a Gtk IPC front-end for nvi, build it.
224 AC_MSG_CHECKING(if --enable-gtk option specified)
226 [ --enable-gtk Build a Gtk front-end for vi.],
227 [vi_cv_gtk="yes"], [vi_cv_gtk="no"])
228 AC_MSG_RESULT($vi_cv_gtk)
229 if test "$vi_cv_gtk" = "yes"; then
233 GTKINCS="$GTK_CFLAGS"
234 GTKLIBS="$GTK_LIBS $LIBS"
236 AM_PATH_GDK_PIXBUF(0.4.0, , AC_MSG_ERROR([You must have gdk-pixbuf installed.]))
237 LIBS="-lutil $GDK_PIXBUF_LIBS $GTKLIBS"
238 AC_CHECK_LIB(nvizvt, zvt_get_ptys,
239 [vi_cv_zvt="yes"], [vi_cv_zvt="no"])
240 if test "$vi_cv_zvt" = "yes"; then
241 GTKLIBS="-lnvizvt $LIBS"
245 # AC_PATH_PROG(vi_cv_gnome_config, gnome-config, no)
246 # if test "$vi_cv_gnome_config" != "no"; then
247 # ZVTLIBS=`$vi_cv_gnome_config zvt --libs`
248 # GTKLIBS="$ZVTLIBS $GTKLIBS"
252 dnl If the user wants a Motif IPC front-end for nvi, build it.
255 AC_MSG_CHECKING(if --enable-motif option specified)
257 [ --enable-motif Build a Motif front-end for vi.],
258 [vi_cv_motif="yes"], [vi_cv_motif="no"])
259 AC_MSG_RESULT($vi_cv_motif)
260 if test "$vi_cv_motif" = "yes"; then
265 dnl BSDI's Motif libraries aren't shared.
272 dnl The Xinside Motif distribution requires -lSM, -lICE and -lXext.
273 dnl -lXext is generally available, the others aren't.
276 dnl Color icons require -lXpm, which may or may not be available,
277 dnl depending on the version of X11.
279 MOTIFLIBS="-lXm -lXt"
280 AC_CHECK_LIB(SM, main,
281 [vi_cv_smlib="yes"], [vi_cv_smlib="no"], "$XLIBS")
282 if test "$vi_cv_smlib" = "yes"; then
283 MOTIFLIBS="$MOTIFLIBS -lSM"
285 AC_CHECK_LIB(ICE, main,
286 [vi_cv_icelib="yes"], [vi_cv_icelib="no"], "$XLIBS")
287 if test "$vi_cv_icelib" = "yes"; then
288 MOTIFLIBS="$MOTIFLIBS -lICE"
290 AC_CHECK_LIB(Xext, main,
291 [vi_cv_xextlib="yes"], [vi_cv_xextlib="no"], "$XLIBS")
292 if test "$vi_cv_xextlib" = "yes"; then
293 MOTIFLIBS="$MOTIFLIBS -lXext"
295 AC_CHECK_LIB(Xpm, main,
296 [vi_cv_xpmlib="yes"], [vi_cv_xpmlib="no"], "$XLIBS")
297 if test "$vi_cv_xpmlib" = "yes"; then
298 MOTIFLIBS="$MOTIFLIBS -lXpm"
300 MOTIFLIBS="$MOTIFLIBS $XLIBS -lm $LIBS"
304 dnl Check for threads
305 AC_MSG_CHECKING(if --enable-threads option specified)
306 AC_ARG_ENABLE(threads,
307 [ --enable-threads Turn on thread support.],
308 [vi_cv_threads="yes"], [vi_cv_threads="no"])
309 AC_MSG_RESULT($vi_cv_threads)
310 if test "$vi_cv_threads" = "yes"; then
311 LIBS="$LIBS -pthread"
312 AC_CACHE_VAL(vi_cv_have_pthreads, [dnl
313 AC_TRY_LINK([#include <pthread.h>],
315 [vi_cv_have_pthreads=yes],
316 [vi_cv_have_pthreads=no])])
317 if test "$vi_cv_have_pthreads" = "no"; then
318 AC_MSG_ERROR(No threading library found)
320 IPCOBJS="pthread.o $IPCOBJS"
321 AC_DEFINE(HAVE_PTHREAD)
323 IPCOBJS="nothread.o $IPCOBJS"
326 dnl If the user wants a Perl interpreter in nvi, load it.
328 AC_SUBST(perlldflags)
330 AC_SUBST(vi_cv_perllib)
332 AC_MSG_CHECKING(if --enable-perlinterp option specified)
333 AC_ARG_ENABLE(perlinterp,
334 [ --enable-perlinterp Include a Perl interpreter in vi.],
335 [vi_cv_perlinterp="yes"], [vi_cv_perlinterp="no"])
336 AC_MSG_RESULT($vi_cv_perlinterp)
337 if test "$vi_cv_perlinterp" = "yes"; then
338 if test "$vi_cv_path_perl" = no; then
339 AC_MSG_ERROR([No perl5 utility found.])
341 $vi_cv_path_perl -e 'require 5.004' || {
342 AC_MSG_ERROR([perl5 must be version 5.004 or later.])
344 if test "$vi_cv_threads" = "yes"; then
345 useithreads=`$vi_cv_path_perl -MConfig -e 'print $Config{useithreads}'`
346 if test "X$useithreads" != "Xdefine"; then
347 AC_MSG_ERROR([vi threading only compatible with perl's ithreads.])
351 eval `$vi_cv_path_perl -V:shrpenv`
352 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlib}'`
353 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
354 -e 'ccflags;perl_inc'`
355 if test "X$perlcppflags" != "X"; then
356 CPPFLAGS="$perlcppflags $CPPFLAGS"
358 perllibs=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
360 perlldflags=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
362 LTLIBOBJS="perl.lo perlxsi.lo perlsfio.lo $LTLIBOBJS"
363 AC_DEFINE(HAVE_PERL_INTERP)
366 dnl If the user wants a Tk/Tcl interpreter in nvi, load it. Make sure that
367 dnl we can find a Tk/Tcl library.
368 AC_MSG_CHECKING(if --enable-tclinterp option specified)
369 AC_ARG_ENABLE(tclinterp,
370 [ --enable-tclinterp Include a Tk/Tcl interpreter in vi.],
371 [vi_cv_tclinterp="yes"], [vi_cv_tclinterp="no"])
372 AC_MSG_RESULT($vi_cv_tclinterp)
373 if test "$vi_cv_tclinterp" = "yes"; then
374 LIBOBJS="tcl.o $LIBOBJS"
375 LIBS="-ltk -ltcl -lm $XLIBS $LIBS"
376 AC_DEFINE(HAVE_TCL_INTERP)
378 AC_CHECK_LIB(tcl, main,
379 [vi_cv_tkfatal="no"], [vi_cv_tkfatal="yes"], -ltk -lm)
380 if test "$vi_cv_tkfatal" = "yes"; then
381 AC_MSG_WARN([No Tk/Tcl library found;])
382 AC_MSG_ERROR([ see the section ADDING LIBRARIES AND INCLUDE FILES in the README file.])
386 dnl Check for the termcap/termlib library. Compile in nvi's curses routines
387 dnl unless the user specifies otherwise. These two checks must occur in the
388 dnl current order, and -lcurses must be loaded before -ltermcap/-ltermlib.
389 AC_CHECK_LIB(termlib, tgetent,
390 [vi_cv_termlib=-ltermlib], [vi_cv_termlib=no])
391 if test "$vi_cv_termlib" = no; then
392 AC_CHECK_LIB(termcap, tgetent,
393 [vi_cv_termlib=-ltermcap], [vi_cv_termlib=no])
395 if test "$vi_cv_termlib" != no; then
396 LIBS="$vi_cv_termlib $LIBS"
400 # XXX actually check for curses !
403 [ --with-curses=DIR Path to curses installation. ])
404 if test "x$with_curses" != "x"; then
405 LDFLAGS="-L$with_curses/lib $LDFLAGS"
406 CFLAGS="-I$with_curses/include $CFLAGS"
407 if test -f "$with_curses/include/ncurses.h"; then
408 AC_CHECK_HEADERS(ncurses.h)
414 AC_CHECK_LIB($CURSLIB, initscr,
415 [vi_cv_cursesfatal="no"], [vi_cv_cursesfatal="yes"])
416 if test "$vi_cv_cursesfatal" = "yes"; then
417 AC_MSG_ERROR([Need curses.])
420 LIBS="-l$CURSLIB $LIBS"
422 dnl Checks for header files.
423 AC_MSG_CHECKING(for sys/mman.h)
424 AC_CACHE_VAL(vi_cv_include_sys_mman, [dnl
425 AC_TRY_CPP([#include <sys/mman.h>],
426 [vi_cv_include_sys_mman=yes], [vi_cv_include_sys_mman=no])])
427 if test "$vi_cv_include_sys_mman" = yes; then
428 AC_DEFINE(HAVE_SYS_MMAN_H)
430 AC_MSG_RESULT($vi_cv_include_sys_mman)
432 AC_MSG_CHECKING(for sys/select.h)
433 AC_CACHE_VAL(vi_cv_include_sys_select, [dnl
434 AC_TRY_CPP([#include <sys/select.h>],
435 [vi_cv_include_sys_select=yes], [vi_cv_include_sys_select=no])])
436 if test "$vi_cv_include_sys_select" = yes; then
437 AC_DEFINE(HAVE_SYS_SELECT_H)
439 AC_MSG_RESULT($vi_cv_include_sys_select)
441 dnl Checks for typedefs, structures, and compiler characteristics.
442 AC_CHECK_TYPE(ssize_t, int)
452 dnl Checks for library functions.
453 AC_CHECK_FUNCS(bsearch gethostname memchr memset)
454 AC_REPLACE_FUNCS(bsearch gethostname memchr memset)
455 AC_CHECK_FUNCS(mkstemp mmap strdup strpbrk)
456 AC_REPLACE_FUNCS(mkstemp mmap strdup strpbrk)
457 AC_CHECK_FUNCS(vsnprintf)
458 AC_REPLACE_FUNCS(vsnprintf)
460 AC_CHECK_FUNCS(select)
461 AC_CHECK_FUNCS(setenv, [need_env=no], [need_env=yes])
462 AC_CHECK_FUNCS(strsep, [need_strsep=no], [need_strsep=yes])
463 AC_CHECK_FUNCS(unsetenv,, [need_env=yes])
468 dnl If we needed setenv or unsetenv, add in the clib/env.c replacement file.
469 if test "$need_env" = yes; then
470 LIBOBJS="env.o $LIBOBJS"
473 dnl If we need strsep, add it and define it so we get a prototype.
474 if test "$need_strsep" = yes; then
475 LIBOBJS="strsep.o $LIBOBJS"
478 dnl XXX not sure whether this is a good idea
479 LTLIBOBJS="`echo $LIBOBJS | sed 's/\.o/.lo/g'` $LTLIBOBJS"
481 dnl Check for fcntl/flock
482 dnl Use flock preferentially, since it has cleaner semantics and won't
483 dnl hang up the editor.
485 dnl Ultrix has a broken fcntl, but a working flock.
486 dnl IRIX and DGUX have a broken flock, but working fcntl.
487 AC_MSG_CHECKING(for fcntl/flock)
488 AC_CACHE_VAL(vi_cv_lock, [dnl
494 AC_TRY_LINK([#include <fcntl.h>], [flock(0, 0);],
495 [vi_cv_lock=flock]);;
497 if test "$vi_cv_lock" = none; then
498 AC_TRY_LINK([#include <fcntl.h>], [fcntl(0, F_SETLK, 0);],
502 if test "$vi_cv_lock" = flock; then
503 AC_DEFINE(HAVE_LOCK_FLOCK)
505 if test "$vi_cv_lock" = fcntl; then
506 AC_DEFINE(HAVE_LOCK_FCNTL)
508 AC_MSG_RESULT($vi_cv_lock)
510 dnl Check for ftruncate/chsize
511 AC_MSG_CHECKING(for ftruncate/chsize)
512 AC_CACHE_VAL(vi_cv_ftruncate, [dnl
513 AC_TRY_LINK([#include <unistd.h>], [ftruncate(0, 0);],
514 [vi_cv_ftruncate=ftruncate],
515 AC_TRY_LINK([#include <unistd.h>], [chsize(0, 0);],
516 [vi_cv_ftruncate=chsize], [vi_cv_ftruncate=no]))])
517 if test "$vi_cv_ftruncate" = ftruncate; then
518 AC_DEFINE(HAVE_FTRUNCATE_FTRUNCATE)
520 if test "$vi_cv_ftruncate" = chsize; then
521 AC_DEFINE(HAVE_FTRUNCATE_CHSIZE)
523 if test "$vi_cv_ftruncate" = no; then
524 AC_MSG_ERROR([No file truncation system call.])
526 AC_MSG_RESULT($vi_cv_ftruncate)
528 dnl Check for the tigetstr/tigetnum functions.
529 AC_MSG_CHECKING(for tigetstr/tigetnum)
530 AC_CACHE_VAL(vi_cv_have_curses_tigetstr, [dnl
531 AC_TRY_LINK([#include <$CURSLIB.h>], [tigetstr(0);],
532 [vi_cv_have_curses_tigetstr=yes],
533 [vi_cv_have_curses_tigetstr=no])])
534 if test "$vi_cv_have_curses_tigetstr" = yes; then
535 AC_DEFINE(HAVE_CURSES_TIGETSTR)
537 AC_MSG_RESULT($vi_cv_have_curses_tigetstr)
539 dnl Check for potentially missing curses functions in system or user-specified
540 dnl libraries. We also have to guess at whether the specified library is a
541 dnl BSD or System V style curses. Use the newterm function, all System V
542 dnl curses implementations have it, none, as far as I know, of the BSD ones do.
543 if test "$vi_cv_curses" = "bundled curses"; then
544 AC_DEFINE(HAVE_BSD_CURSES)
545 AC_DEFINE(HAVE_CURSES_WADDNSTR)
546 AC_DEFINE(HAVE_CURSES_IDLOK)
548 dnl Check for the waddnstr function.
549 AC_MSG_CHECKING(for waddnstr)
550 AC_CACHE_VAL(vi_cv_have_curses_waddnstr, [dnl
551 AC_TRY_LINK([#include <$CURSLIB.h>], [waddnstr(stdscr, 0, 0);],
552 [vi_cv_have_curses_waddnstr=yes],
553 [vi_cv_have_curses_waddnstr=no])])
554 if test "$vi_cv_have_curses_waddnstr" = yes; then
555 AC_DEFINE(HAVE_CURSES_WADDNSTR)
557 AC_MSG_RESULT($vi_cv_have_curses_waddnstr)
559 dnl Check for the beep function.
560 AC_MSG_CHECKING(for beep)
561 AC_CACHE_VAL(vi_cv_have_curses_beep, [dnl
562 AC_TRY_LINK([#include <$CURSLIB.h>], [beep();],
563 [vi_cv_have_curses_beep=yes],
564 [vi_cv_have_curses_beep=no])])
565 if test "$vi_cv_have_curses_beep" = yes; then
566 AC_DEFINE(HAVE_CURSES_BEEP)
568 AC_MSG_RESULT($vi_cv_have_curses_beep)
570 dnl Check for the flash function.
571 AC_MSG_CHECKING(for flash)
572 AC_CACHE_VAL(vi_cv_have_curses_flash, [dnl
573 AC_TRY_LINK([#include <$CURSLIB.h>], [flash();],
574 [vi_cv_have_curses_flash=yes],
575 [vi_cv_have_curses_flash=no])])
576 if test "$vi_cv_have_curses_flash" = yes; then
577 AC_DEFINE(HAVE_CURSES_FLASH)
579 AC_MSG_RESULT($vi_cv_have_curses_flash)
581 dnl Check for the idlok function.
582 AC_MSG_CHECKING(for idlok)
583 AC_CACHE_VAL(vi_cv_have_curses_idlok, [dnl
584 AC_TRY_LINK([#include <$CURSLIB.h>], [idlok(0, 0);],
585 [vi_cv_have_curses_idlok=yes],
586 [vi_cv_have_curses_idlok=no])])
587 if test "$vi_cv_have_curses_idlok" = yes; then
588 AC_DEFINE(HAVE_CURSES_IDLOK)
590 AC_MSG_RESULT($vi_cv_have_curses_idlok)
592 dnl Check for the keypad function.
593 AC_MSG_CHECKING(for keypad)
594 AC_CACHE_VAL(vi_cv_have_curses_keypad, [dnl
595 AC_TRY_LINK([#include <$CURSLIB.h>], [keypad(0, 0);],
596 [vi_cv_have_curses_keypad=yes],
597 [vi_cv_have_curses_keypad=no])])
598 if test "$vi_cv_have_curses_keypad" = yes; then
599 AC_DEFINE(HAVE_CURSES_KEYPAD)
601 AC_MSG_RESULT($vi_cv_have_curses_keypad)
603 dnl Check for the newterm function.
604 AC_MSG_CHECKING(for newterm)
605 AC_CACHE_VAL(vi_cv_have_curses_newterm, [dnl
606 AC_TRY_LINK([#include <$CURSLIB.h>], [newterm(0, 0, 0);],
607 [vi_cv_have_curses_newterm=yes],
608 [vi_cv_have_curses_newterm=no])])
609 if test "$vi_cv_have_curses_newterm" = yes; then
610 AC_DEFINE(HAVE_CURSES_NEWTERM)
612 AC_MSG_RESULT($vi_cv_have_curses_newterm)
614 if test "$vi_cv_have_curses_newterm" = no; then
615 AC_DEFINE(HAVE_BSD_CURSES)
619 dnl Check for the setupterm function. We make this check regardless of
620 dnl using the system library, because it may be part of the underlying
621 dnl termcap/termlib support, and we want to use the local one.
622 AC_MSG_CHECKING(for setupterm)
623 AC_CACHE_VAL(vi_cv_have_curses_setupterm, [dnl
624 AC_TRY_LINK([#include <$CURSLIB.h>], [setupterm(0, 0, 0);],
625 [vi_cv_have_curses_setupterm=yes],
626 [vi_cv_have_curses_setupterm=no])])
627 if test "$vi_cv_have_curses_setupterm" = yes; then
628 AC_DEFINE(HAVE_CURSES_SETUPTERM)
630 AC_MSG_RESULT($vi_cv_have_curses_setupterm)
632 dnl Some moron decided to drop off an argument from the gettimeofday call,
633 dnl without changing the name.
634 AC_MSG_CHECKING(for broken gettimeofday system call)
635 AC_CACHE_VAL(vi_cv_gettimeofday, [dnl
636 AC_TRY_LINK([#include <sys/types.h>
637 #include <sys/time.h>], [gettimeofday(0, 0);],
638 [vi_cv_gettimeofday=okay], [vi_cv_gettimeofday=broken])])
639 if test "$vi_cv_gettimeofday" = broken; then
640 AC_DEFINE(HAVE_BROKEN_GETTIMEOFDAY)
642 AC_MSG_RESULT($vi_cv_gettimeofday)
644 dnl Check for which version of openpty to use, System V or Berkeley.
645 AC_MSG_CHECKING(for System V pty calls)
646 AC_CACHE_VAL(vi_cv_sys5_pty, [dnl
647 AC_TRY_LINK(, [grantpt(0);],
648 [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])])
649 if test "$vi_cv_sys5_pty" = yes; then
650 AC_DEFINE(HAVE_SYS5_PTY)
652 AC_MSG_RESULT($vi_cv_sys5_pty)
654 dnl Check for the revoke system call.
655 AC_MSG_CHECKING(for revoke system call)
656 AC_CACHE_VAL(vi_cv_revoke, [dnl
657 AC_TRY_LINK(, [revoke("a");],
658 [vi_cv_revoke=yes], [vi_cv_revoke=no])])
659 if test "$vi_cv_revoke" = yes; then
660 AC_DEFINE(HAVE_REVOKE)
662 AC_MSG_RESULT($vi_cv_revoke)
664 dnl Some versions of sprintf return a pointer to the first argument instead
665 dnl of a character count. We assume that the return value of snprintf and
666 dnl vsprintf etc. will be the same as sprintf, and check the easy one.
667 AC_MSG_CHECKING(for int type sprintf return value)
668 AC_CACHE_VAL(vi_cv_sprintf_count, [dnl
669 AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}],
670 [vi_cv_sprintf_count=yes], [vi_cv_sprintf_count=no])])
671 if test "$vi_cv_sprintf_count" = no; then
672 AC_DEFINE(SPRINTF_RET_CHARPNT)
674 AC_MSG_RESULT($vi_cv_sprintf_count)
677 dnl Check for the standard shorthand types.
678 AC_SUBST(u_char_decl)
679 AC_CACHE_CHECK([for u_char], vi_cv_uchar, [dnl
680 AC_TRY_COMPILE([#include <sys/types.h>], u_char foo;,
681 [vi_cv_uchar=yes], [vi_cv_uchar=no])])
682 if test "$vi_cv_uchar" = no; then
683 u_char_decl="typedef unsigned char u_char;"
686 AC_SUBST(u_short_decl)
687 AC_CACHE_CHECK([for u_short], vi_cv_ushort, [dnl
688 AC_TRY_COMPILE([#include <sys/types.h>], u_short foo;,
689 [vi_cv_ushort=yes], [vi_cv_ushort=no])])
690 if test "$vi_cv_ushort" = no; then
691 u_short_decl="typedef unsigned short u_short;"
695 AC_CACHE_CHECK([for u_int], vi_cv_uint, [dnl
696 AC_TRY_COMPILE([#include <sys/types.h>], u_int foo;,
697 [vi_cv_uint=yes], [vi_cv_uint=no])])
698 if test "$vi_cv_uint" = no; then
699 u_int_decl="typedef unsigned int u_int;"
702 AC_SUBST(u_long_decl)
703 AC_CACHE_CHECK([for u_long], vi_cv_ulong, [dnl
704 AC_TRY_COMPILE([#include <sys/types.h>], u_long foo;,
705 [vi_cv_ulong=yes], [vi_cv_ulong=no])])
706 if test "$vi_cv_ulong" = no; then
707 u_long_decl="typedef unsigned long u_long;"
710 dnl DB/Vi use specific integer sizes.
711 AC_SUBST(u_int8_decl)
712 AC_CACHE_CHECK([for u_int8_t], vi_cv_uint8, [dnl
713 AC_TRY_COMPILE([#include <sys/types.h>], u_int8_t foo;,
715 AC_TRY_RUN([main(){exit(sizeof(unsigned char) != 1);}],
716 [vi_cv_uint8="unsigned char"], [vi_cv_uint8=no]))])
717 if test "$vi_cv_uint8" = no; then
718 AC_MSG_ERROR(No unsigned 8-bit integral type.)
720 if test "$vi_cv_uint8" != yes; then
721 u_int8_decl="typedef $vi_cv_uint8 u_int8_t;"
724 AC_SUBST(u_int16_decl)
725 AC_CACHE_CHECK([for u_int16_t], vi_cv_uint16, [dnl
726 AC_TRY_COMPILE([#include <sys/types.h>], u_int16_t foo;,
728 AC_TRY_RUN([main(){exit(sizeof(unsigned short) != 2);}],
729 [vi_cv_uint16="unsigned short"],
730 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 2);}],
731 [vi_cv_uint16="unsigned int"], [vi_cv_uint16=no])))])
732 if test "$vi_cv_uint16" = no; then
733 AC_MSG_ERROR([No unsigned 16-bit integral type.])
735 if test "$vi_cv_uint16" != yes; then
736 u_int16_decl="typedef $vi_cv_uint16 u_int16_t;"
740 AC_CACHE_CHECK([for int16_t], vi_cv_int16, [dnl
741 AC_TRY_COMPILE([#include <sys/types.h>], int16_t foo;,
743 AC_TRY_RUN([main(){exit(sizeof(short) != 2);}],
744 [vi_cv_int16="short"],
745 AC_TRY_RUN([main(){exit(sizeof(int) != 2);}],
746 [vi_cv_int16="int"], [vi_cv_int16=no])))])
747 if test "$vi_cv_int16" = no; then
748 AC_MSG_ERROR([No signed 16-bit integral type.])
750 if test "$vi_cv_int16" != yes; then
751 int16_decl="typedef $vi_cv_int16 int16_t;"
754 AC_SUBST(u_int32_decl)
755 AC_CACHE_CHECK([for u_int32_t], vi_cv_uint32, [dnl
756 AC_TRY_COMPILE([#include <sys/types.h>], u_int32_t foo;,
758 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}],
759 [vi_cv_uint32="unsigned int"],
760 AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}],
761 [vi_cv_uint32="unsigned long"], [vi_cv_uint32=no])))])
762 if test "$vi_cv_uint32" = no; then
763 AC_MSG_ERROR([No unsigned 32-bit integral type.])
765 if test "$vi_cv_uint32" != yes; then
766 u_int32_decl="typedef $vi_cv_uint32 u_int32_t;"
770 AC_CACHE_CHECK([for int32_t], vi_cv_int32, [dnl
771 AC_TRY_COMPILE([#include <sys/types.h>], int32_t foo;,
773 AC_TRY_RUN([main(){exit(sizeof(int) != 4);}],
775 AC_TRY_RUN([main(){exit(sizeof(long) != 4);}],
776 [vi_cv_int32="long"], [vi_cv_int32=no])))])
777 if test "$vi_cv_int32" = no; then
778 AC_MSG_ERROR([No signed 32-bit integral type.])
780 if test "$vi_cv_int32" != yes; then
781 int32_decl="typedef $vi_cv_int32 int32_t;"
784 AC_CACHE_CHECK([return type of fprintf], vi_cv_type_fprintf,
785 [AC_TRY_COMPILE([#include <stdio.h>
787 ],[int i;], vi_cv_type_fprintf=int, vi_cv_type_fprintf=void)])
789 AC_SUBST(NEED_FPRINTF_PROTO)
790 AC_CACHE_CHECK([fprintf prototype needed], vi_cv_proto_fprintf,
791 [AC_TRY_COMPILE([ #include <stdio.h>
792 typedef int (*funcPtr)();
793 ],[funcPtr ptr = (funcPtr) fprintf;],
794 vi_cv_proto_fprintf=no,
795 [vi_cv_proto_fprintf=yes, AC_DEFINE(NEED_FPRINTF_PROTO)])])
800 [ --with-db3=db3prefix Path to db3 installation. ])
801 if test "$with_db3" = "no"; then
802 AC_MSG_ERROR([Need DB 3.])
805 saveLDFLAGS="$LDFLAGS"
806 if test "x$with_db3" != "x"; then
807 LDFLAGS="-L$with_db3/lib $LDFLAGS"
808 CFLAGS="-I$with_db3/include $CFLAGS"
811 AC_CHECK_LIB(db, db_create,
812 [vi_cv_dbfatal="no"], [vi_cv_dbfatal="yes"])
813 if test "$vi_cv_dbfatal" = "yes"; then
814 AC_MSG_ERROR([Need DB 3.])
817 LDFLAGS="$saveLDFLAGS"
820 AC_MSG_CHECKING(if --enable-dynamic-loading option specified)
821 AC_ARG_ENABLE(dynamic-loading,
822 [ --enable-dynamic-loading Load DB 3 dynamically.],
823 [vi_cv_dl="yes"], [vi_cv_dl="no"])
824 AC_MSG_RESULT($vi_cv_dl)
825 if test "$vi_cv_dl" = yes; then
826 AC_CHECK_LIB(dl, dlopen,
827 [vi_cv_dlfatal="no"], [vi_cv_dlfatal="yes"])
828 if test "$vi_cv_dlfatal" = "yes"; then
829 AC_MSG_ERROR([Need dl to support dynamic loading.])
833 PATH="$with_db3/lib:/usr/lib:/lib"
834 AC_PATH_PROG(vi_cv_path_db3, libdb-3.so, no)
835 if test "$vi_cv_path_db3" = no; then
836 AC_MSG_ERROR([Path of libdb-3.so not found.])
840 AC_DEFINE(USE_DYNAMIC_LOADING)
841 LTLIBOBJS="dldb.lo $LTLIBOBJS"
842 dl_src=../common/dldb.c
846 LDFLAGS="-L$with_db3/lib $LDFLAGS"
850 dnl We compile in nvi's RE routines unless the user specifies otherwise.
851 AC_MSG_CHECKING(if --disable-re option specified)
853 [ --disable-re DON'T use the nvi-provided RE routines.],
854 [vi_cv_re_lib="other RE"], [vi_cv_re_lib="bundled RE"])
855 AC_MSG_RESULT($vi_cv_re_lib)
856 case "$vi_cv_re_lib" in
858 CPPFLAGS="-I\$(visrcdir)/regex $CPPFLAGS"
859 LTLIBOBJS="\$(REOBJS) $LTLIBOBJS";;
864 AC_OUTPUT(Makefile port.h:port.h.in
865 pathnames.h:pathnames.h.in recover:recover.in)