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)
217 LIBOBJS="wcwidth.o $LIBOBJS"
219 AC_MSG_RESULT($vi_cv_widechar)
221 dnl If the user wants a Gtk IPC front-end for nvi, build it.
226 AC_MSG_CHECKING(if --enable-gtk option specified)
228 [ --enable-gtk Build a Gtk front-end for vi.],
229 [vi_cv_gtk="yes"], [vi_cv_gtk="no"])
230 AC_MSG_RESULT($vi_cv_gtk)
231 if test "$vi_cv_gtk" = "yes"; then
235 GTKINCS="$GTK_CFLAGS"
236 GTKLIBS="$GTK_LIBS $LIBS"
238 AM_PATH_GDK_PIXBUF(0.4.0, pixbuf=yes, pixbuf=no)
239 if test "$pixbuf" != "no"; then
240 LIBS="-lutil $GDK_PIXBUF_LIBS $GTKLIBS"
241 AC_CHECK_LIB(nvizvt, zvt_get_ptys,
242 [vi_cv_zvt="yes"], [vi_cv_zvt="no"])
243 if test "$vi_cv_zvt" = "yes"; then
244 GTKLIBS="-lnvizvt $LIBS"
249 AC_PATH_PROG(vi_cv_pango_config, pango-config, no)
250 if test "$vi_cv_pango_config" != "no"; then
251 PANGOLIBS=`$vi_cv_pango_config --libs pangox`
252 GTKLIBS="$PANGOLIBS $GTKLIBS"
253 AC_DEFINE(HAVE_PANGO)
255 # AC_PATH_PROG(vi_cv_gnome_config, gnome-config, no)
256 # if test "$vi_cv_gnome_config" != "no"; then
257 # ZVTLIBS=`$vi_cv_gnome_config zvt --libs`
258 # GTKLIBS="$ZVTLIBS $GTKLIBS"
262 dnl If the user wants a Motif IPC front-end for nvi, build it.
265 AC_MSG_CHECKING(if --enable-motif option specified)
267 [ --enable-motif Build a Motif front-end for vi.],
268 [vi_cv_motif="yes"], [vi_cv_motif="no"])
269 AC_MSG_RESULT($vi_cv_motif)
270 if test "$vi_cv_motif" = "yes"; then
275 dnl BSDI's Motif libraries aren't shared.
282 dnl The Xinside Motif distribution requires -lSM, -lICE and -lXext.
283 dnl -lXext is generally available, the others aren't.
286 dnl Color icons require -lXpm, which may or may not be available,
287 dnl depending on the version of X11.
289 MOTIFLIBS="-lXm -lXt"
290 AC_CHECK_LIB(SM, main,
291 [vi_cv_smlib="yes"], [vi_cv_smlib="no"], "$XLIBS")
292 if test "$vi_cv_smlib" = "yes"; then
293 MOTIFLIBS="$MOTIFLIBS -lSM"
295 AC_CHECK_LIB(ICE, main,
296 [vi_cv_icelib="yes"], [vi_cv_icelib="no"], "$XLIBS")
297 if test "$vi_cv_icelib" = "yes"; then
298 MOTIFLIBS="$MOTIFLIBS -lICE"
300 AC_CHECK_LIB(Xext, main,
301 [vi_cv_xextlib="yes"], [vi_cv_xextlib="no"], "$XLIBS")
302 if test "$vi_cv_xextlib" = "yes"; then
303 MOTIFLIBS="$MOTIFLIBS -lXext"
305 AC_CHECK_LIB(Xpm, main,
306 [vi_cv_xpmlib="yes"], [vi_cv_xpmlib="no"], "$XLIBS")
307 if test "$vi_cv_xpmlib" = "yes"; then
308 MOTIFLIBS="$MOTIFLIBS -lXpm"
310 MOTIFLIBS="$MOTIFLIBS $XLIBS -lm $LIBS"
314 dnl Check for threads
315 AC_MSG_CHECKING(if --enable-threads option specified)
316 AC_ARG_ENABLE(threads,
317 [ --enable-threads Turn on thread support.],
318 [vi_cv_threads="yes"], [vi_cv_threads="no"])
319 AC_MSG_RESULT($vi_cv_threads)
320 if test "$vi_cv_threads" = "yes"; then
321 LIBS="$LIBS -pthread"
322 AC_CACHE_VAL(vi_cv_have_pthreads, [dnl
323 AC_TRY_LINK([#include <pthread.h>],
325 [vi_cv_have_pthreads=yes],
326 [vi_cv_have_pthreads=no])])
327 if test "$vi_cv_have_pthreads" = "no"; then
328 AC_MSG_ERROR(No threading library found)
330 IPCOBJS="pthread.o $IPCOBJS"
331 AC_DEFINE(HAVE_PTHREAD)
333 IPCOBJS="nothread.o $IPCOBJS"
336 dnl If the user wants a Perl interpreter in nvi, load it.
338 AC_SUBST(perlldflags)
340 AC_SUBST(vi_cv_perllib)
342 AC_MSG_CHECKING(if --enable-perlinterp option specified)
343 AC_ARG_ENABLE(perlinterp,
344 [ --enable-perlinterp Include a Perl interpreter in vi.],
345 [vi_cv_perlinterp="yes"], [vi_cv_perlinterp="no"])
346 AC_MSG_RESULT($vi_cv_perlinterp)
347 if test "$vi_cv_perlinterp" = "yes"; then
348 if test "$vi_cv_path_perl" = no; then
349 AC_MSG_ERROR([No perl5 utility found.])
351 $vi_cv_path_perl -e 'require 5.004' || {
352 AC_MSG_ERROR([perl5 must be version 5.004 or later.])
354 if test "$vi_cv_threads" = "yes"; then
355 useithreads=`$vi_cv_path_perl -MConfig -e 'print $Config{useithreads}'`
356 if test "X$useithreads" != "Xdefine"; then
357 AC_MSG_ERROR([vi threading only compatible with perl's ithreads.])
361 eval `$vi_cv_path_perl -V:shrpenv`
362 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlib}'`
363 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
364 -e 'ccflags;perl_inc'`
365 if test "X$perlcppflags" != "X"; then
366 CPPFLAGS="$perlcppflags $CPPFLAGS"
368 perllibs=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
370 perlldflags=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
372 LTLIBOBJS="perl.lo perlxsi.lo perlsfio.lo $LTLIBOBJS"
373 AC_DEFINE(HAVE_PERL_INTERP)
376 dnl If the user wants a Tk/Tcl interpreter in nvi, load it. Make sure that
377 dnl we can find a Tk/Tcl library.
378 AC_MSG_CHECKING(if --enable-tclinterp option specified)
379 AC_ARG_ENABLE(tclinterp,
380 [ --enable-tclinterp Include a Tk/Tcl interpreter in vi.],
381 [vi_cv_tclinterp="yes"], [vi_cv_tclinterp="no"])
382 AC_MSG_RESULT($vi_cv_tclinterp)
383 if test "$vi_cv_tclinterp" = "yes"; then
384 LIBOBJS="tcl.o $LIBOBJS"
385 LIBS="-ltk -ltcl -lm $XLIBS $LIBS"
386 AC_DEFINE(HAVE_TCL_INTERP)
388 AC_CHECK_LIB(tcl, main,
389 [vi_cv_tkfatal="no"], [vi_cv_tkfatal="yes"], -ltk -lm)
390 if test "$vi_cv_tkfatal" = "yes"; then
391 AC_MSG_WARN([No Tk/Tcl library found;])
392 AC_MSG_ERROR([ see the section ADDING LIBRARIES AND INCLUDE FILES in the README file.])
396 dnl Check for the termcap/termlib library. Compile in nvi's curses routines
397 dnl unless the user specifies otherwise. These two checks must occur in the
398 dnl current order, and -lcurses must be loaded before -ltermcap/-ltermlib.
399 AC_CHECK_LIB(termlib, tgetent,
400 [vi_cv_termlib=-ltermlib], [vi_cv_termlib=no])
401 if test "$vi_cv_termlib" = no; then
402 AC_CHECK_LIB(termcap, tgetent,
403 [vi_cv_termlib=-ltermcap], [vi_cv_termlib=no])
405 if test "$vi_cv_termlib" != no; then
406 LIBS="$vi_cv_termlib $LIBS"
413 dnl AC_ARG_WITH(slang,
414 dnl [ --with-slang[=DIR] Use S-Lang instead of curses. ],
416 dnl if test "$withval" != yes; then
417 dnl LDFLAGS="-L${withval}/lib $LDFLAGS"
418 dnl CPPFLAGS="-I${withval}/include $CPPFLAGS"
420 dnl AC_DEFINE(USE_SLANG_CURSES)
421 dnl AC_CHECK_LIB(slang, SLtt_get_terminfo,
422 dnl [CURSLIBS="$CURSLIBS -lslang -lm"],
423 dnl [AC_MSG_ERROR(unable to compile. check config.log)], -lm)
430 [ --with-curses=DIR Path to curses installation. ])
431 if test "x$with_curses" != "x"; then
432 LDFLAGS="-L$with_curses/lib $LDFLAGS"
433 CPPFLAGS="-I$with_curses/include $CPPFLAGS"
434 if test -f "$with_curses/include/ncurses.h"; then
435 AC_CHECK_HEADERS(ncurses.h)
441 AC_CHECK_LIB($CURSLIB, initscr,
442 [vi_cv_cursesfatal="no"], [vi_cv_cursesfatal="yes"])
443 if test "$vi_cv_cursesfatal" = "yes"; then
444 AC_MSG_ERROR([Need curses.])
446 CURSLIBS="-l$CURSLIB"
449 dnl Checks for header files.
450 AC_MSG_CHECKING(for sys/mman.h)
451 AC_CACHE_VAL(vi_cv_include_sys_mman, [dnl
452 AC_TRY_CPP([#include <sys/mman.h>],
453 [vi_cv_include_sys_mman=yes], [vi_cv_include_sys_mman=no])])
454 if test "$vi_cv_include_sys_mman" = yes; then
455 AC_DEFINE(HAVE_SYS_MMAN_H)
457 AC_MSG_RESULT($vi_cv_include_sys_mman)
459 AC_MSG_CHECKING(for sys/select.h)
460 AC_CACHE_VAL(vi_cv_include_sys_select, [dnl
461 AC_TRY_CPP([#include <sys/select.h>],
462 [vi_cv_include_sys_select=yes], [vi_cv_include_sys_select=no])])
463 if test "$vi_cv_include_sys_select" = yes; then
464 AC_DEFINE(HAVE_SYS_SELECT_H)
466 AC_MSG_RESULT($vi_cv_include_sys_select)
468 dnl Checks for typedefs, structures, and compiler characteristics.
469 AC_CHECK_TYPE(ssize_t, int)
479 dnl Checks for library functions.
480 AC_CHECK_FUNCS(bsearch gethostname memchr memset)
481 AC_REPLACE_FUNCS(bsearch gethostname memchr memset)
482 AC_CHECK_FUNCS(mkstemp mmap strdup strpbrk)
483 AC_REPLACE_FUNCS(mkstemp mmap strdup strpbrk)
484 AC_CHECK_FUNCS(vsnprintf)
485 AC_REPLACE_FUNCS(vsnprintf)
487 AC_CHECK_FUNCS(select)
488 AC_CHECK_FUNCS(setenv, [need_env=no], [need_env=yes])
489 AC_CHECK_FUNCS(strsep, [need_strsep=no], [need_strsep=yes])
490 AC_CHECK_FUNCS(unsetenv,, [need_env=yes])
495 dnl If we needed setenv or unsetenv, add in the clib/env.c replacement file.
496 if test "$need_env" = yes; then
497 LIBOBJS="env.o $LIBOBJS"
500 dnl If we need strsep, add it and define it so we get a prototype.
501 if test "$need_strsep" = yes; then
502 LIBOBJS="strsep.o $LIBOBJS"
505 dnl XXX not sure whether this is a good idea
506 LTLIBOBJS="`echo $LIBOBJS | sed 's/\.o/.lo/g'` $LTLIBOBJS"
508 dnl Check for fcntl/flock
509 dnl Use flock preferentially, since it has cleaner semantics and won't
510 dnl hang up the editor.
512 dnl Ultrix has a broken fcntl, but a working flock.
513 dnl IRIX and DGUX have a broken flock, but working fcntl.
514 AC_MSG_CHECKING(for fcntl/flock)
515 AC_CACHE_VAL(vi_cv_lock, [dnl
521 AC_TRY_LINK([#include <fcntl.h>], [flock(0, 0);],
522 [vi_cv_lock=flock]);;
524 if test "$vi_cv_lock" = none; then
525 AC_TRY_LINK([#include <fcntl.h>], [fcntl(0, F_SETLK, 0);],
529 if test "$vi_cv_lock" = flock; then
530 AC_DEFINE(HAVE_LOCK_FLOCK)
532 if test "$vi_cv_lock" = fcntl; then
533 AC_DEFINE(HAVE_LOCK_FCNTL)
535 AC_MSG_RESULT($vi_cv_lock)
537 dnl Check for ftruncate/chsize
538 AC_MSG_CHECKING(for ftruncate/chsize)
539 AC_CACHE_VAL(vi_cv_ftruncate, [dnl
540 AC_TRY_LINK([#include <unistd.h>], [ftruncate(0, 0);],
541 [vi_cv_ftruncate=ftruncate],
542 AC_TRY_LINK([#include <unistd.h>], [chsize(0, 0);],
543 [vi_cv_ftruncate=chsize], [vi_cv_ftruncate=no]))])
544 if test "$vi_cv_ftruncate" = ftruncate; then
545 AC_DEFINE(HAVE_FTRUNCATE_FTRUNCATE)
547 if test "$vi_cv_ftruncate" = chsize; then
548 AC_DEFINE(HAVE_FTRUNCATE_CHSIZE)
550 if test "$vi_cv_ftruncate" = no; then
551 AC_MSG_ERROR([No file truncation system call.])
553 AC_MSG_RESULT($vi_cv_ftruncate)
556 LIBS="$CURSLIBS $LIBS"
557 dnl Check for the tigetstr/tigetnum functions.
558 AC_MSG_CHECKING(for tigetstr/tigetnum)
559 AC_CACHE_VAL(vi_cv_have_curses_tigetstr, [dnl
560 AC_TRY_LINK([#include <$CURSLIB.h>], [tigetstr(0);],
561 [vi_cv_have_curses_tigetstr=yes],
562 [vi_cv_have_curses_tigetstr=no])])
563 if test "$vi_cv_have_curses_tigetstr" = yes; then
564 AC_DEFINE(HAVE_CURSES_TIGETSTR)
566 AC_MSG_RESULT($vi_cv_have_curses_tigetstr)
568 dnl Check for potentially missing curses functions in system or user-specified
569 dnl libraries. We also have to guess at whether the specified library is a
570 dnl BSD or System V style curses. Use the newterm function, all System V
571 dnl curses implementations have it, none, as far as I know, of the BSD ones do.
572 if test "$vi_cv_curses" = "bundled curses"; then
573 AC_DEFINE(HAVE_BSD_CURSES)
574 AC_DEFINE(HAVE_CURSES_WADDNSTR)
575 AC_DEFINE(HAVE_CURSES_IDLOK)
577 dnl Check for the waddnstr function.
578 AC_MSG_CHECKING(for waddnstr)
579 AC_CACHE_VAL(vi_cv_have_curses_waddnstr, [dnl
580 AC_TRY_LINK([#include <$CURSLIB.h>], [waddnstr(stdscr, 0, 0);],
581 [vi_cv_have_curses_waddnstr=yes],
582 [vi_cv_have_curses_waddnstr=no])])
583 if test "$vi_cv_have_curses_waddnstr" = yes; then
584 AC_DEFINE(HAVE_CURSES_WADDNSTR)
586 AC_MSG_RESULT($vi_cv_have_curses_waddnstr)
588 dnl Check for the beep function.
589 AC_MSG_CHECKING(for beep)
590 AC_CACHE_VAL(vi_cv_have_curses_beep, [dnl
591 AC_TRY_LINK([#include <$CURSLIB.h>], [beep();],
592 [vi_cv_have_curses_beep=yes],
593 [vi_cv_have_curses_beep=no])])
594 if test "$vi_cv_have_curses_beep" = yes; then
595 AC_DEFINE(HAVE_CURSES_BEEP)
597 AC_MSG_RESULT($vi_cv_have_curses_beep)
599 dnl Check for the flash function.
600 AC_MSG_CHECKING(for flash)
601 AC_CACHE_VAL(vi_cv_have_curses_flash, [dnl
602 AC_TRY_LINK([#include <$CURSLIB.h>], [flash();],
603 [vi_cv_have_curses_flash=yes],
604 [vi_cv_have_curses_flash=no])])
605 if test "$vi_cv_have_curses_flash" = yes; then
606 AC_DEFINE(HAVE_CURSES_FLASH)
608 AC_MSG_RESULT($vi_cv_have_curses_flash)
610 dnl Check for the idlok function.
611 AC_MSG_CHECKING(for idlok)
612 AC_CACHE_VAL(vi_cv_have_curses_idlok, [dnl
613 AC_TRY_LINK([#include <$CURSLIB.h>], [idlok(0, 0);],
614 [vi_cv_have_curses_idlok=yes],
615 [vi_cv_have_curses_idlok=no])])
616 if test "$vi_cv_have_curses_idlok" = yes; then
617 AC_DEFINE(HAVE_CURSES_IDLOK)
619 AC_MSG_RESULT($vi_cv_have_curses_idlok)
621 dnl Check for the keypad function.
622 AC_MSG_CHECKING(for keypad)
623 AC_CACHE_VAL(vi_cv_have_curses_keypad, [dnl
624 AC_TRY_LINK([#include <$CURSLIB.h>], [keypad(0, 0);],
625 [vi_cv_have_curses_keypad=yes],
626 [vi_cv_have_curses_keypad=no])])
627 if test "$vi_cv_have_curses_keypad" = yes; then
628 AC_DEFINE(HAVE_CURSES_KEYPAD)
630 AC_MSG_RESULT($vi_cv_have_curses_keypad)
632 dnl Check for the newterm function.
633 AC_MSG_CHECKING(for newterm)
634 AC_CACHE_VAL(vi_cv_have_curses_newterm, [dnl
635 AC_TRY_LINK([#include <$CURSLIB.h>], [newterm(0, 0, 0);],
636 [vi_cv_have_curses_newterm=yes],
637 [vi_cv_have_curses_newterm=no])])
638 if test "$vi_cv_have_curses_newterm" = yes; then
639 AC_DEFINE(HAVE_CURSES_NEWTERM)
641 AC_MSG_RESULT($vi_cv_have_curses_newterm)
643 if test "$vi_cv_have_curses_newterm" = no; then
644 AC_DEFINE(HAVE_BSD_CURSES)
648 dnl Check for the setupterm function. We make this check regardless of
649 dnl using the system library, because it may be part of the underlying
650 dnl termcap/termlib support, and we want to use the local one.
651 AC_MSG_CHECKING(for setupterm)
652 AC_CACHE_VAL(vi_cv_have_curses_setupterm, [dnl
653 AC_TRY_LINK([#include <$CURSLIB.h>], [setupterm(0, 0, 0);],
654 [vi_cv_have_curses_setupterm=yes],
655 [vi_cv_have_curses_setupterm=no])])
656 if test "$vi_cv_have_curses_setupterm" = yes; then
657 AC_DEFINE(HAVE_CURSES_SETUPTERM)
659 AC_MSG_RESULT($vi_cv_have_curses_setupterm)
662 dnl Some moron decided to drop off an argument from the gettimeofday call,
663 dnl without changing the name.
664 AC_MSG_CHECKING(for broken gettimeofday system call)
665 AC_CACHE_VAL(vi_cv_gettimeofday, [dnl
666 AC_TRY_LINK([#include <sys/types.h>
667 #include <sys/time.h>], [gettimeofday(0, 0);],
668 [vi_cv_gettimeofday=okay], [vi_cv_gettimeofday=broken])])
669 if test "$vi_cv_gettimeofday" = broken; then
670 AC_DEFINE(HAVE_BROKEN_GETTIMEOFDAY)
672 AC_MSG_RESULT($vi_cv_gettimeofday)
674 dnl Check for which version of openpty to use, System V or Berkeley.
675 AC_MSG_CHECKING(for System V pty calls)
676 AC_CACHE_VAL(vi_cv_sys5_pty, [dnl
677 AC_TRY_LINK(, [grantpt(0);],
678 [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])])
679 if test "$vi_cv_sys5_pty" = yes; then
680 AC_DEFINE(HAVE_SYS5_PTY)
682 AC_MSG_RESULT($vi_cv_sys5_pty)
684 dnl Check for the revoke system call.
685 AC_MSG_CHECKING(for revoke system call)
686 AC_CACHE_VAL(vi_cv_revoke, [dnl
687 AC_TRY_LINK(, [revoke("a");],
688 [vi_cv_revoke=yes], [vi_cv_revoke=no])])
689 if test "$vi_cv_revoke" = yes; then
690 AC_DEFINE(HAVE_REVOKE)
692 AC_MSG_RESULT($vi_cv_revoke)
694 dnl Some versions of sprintf return a pointer to the first argument instead
695 dnl of a character count. We assume that the return value of snprintf and
696 dnl vsprintf etc. will be the same as sprintf, and check the easy one.
697 AC_MSG_CHECKING(for int type sprintf return value)
698 AC_CACHE_VAL(vi_cv_sprintf_count, [dnl
699 AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}],
700 [vi_cv_sprintf_count=yes], [vi_cv_sprintf_count=no])])
701 if test "$vi_cv_sprintf_count" = no; then
702 AC_DEFINE(SPRINTF_RET_CHARPNT)
704 AC_MSG_RESULT($vi_cv_sprintf_count)
707 dnl Check for the standard shorthand types.
708 AC_SUBST(u_char_decl)
709 AC_CACHE_CHECK([for u_char], vi_cv_uchar, [dnl
710 AC_TRY_COMPILE([#include <sys/types.h>], u_char foo;,
711 [vi_cv_uchar=yes], [vi_cv_uchar=no])])
712 if test "$vi_cv_uchar" = no; then
713 u_char_decl="typedef unsigned char u_char;"
716 AC_SUBST(u_short_decl)
717 AC_CACHE_CHECK([for u_short], vi_cv_ushort, [dnl
718 AC_TRY_COMPILE([#include <sys/types.h>], u_short foo;,
719 [vi_cv_ushort=yes], [vi_cv_ushort=no])])
720 if test "$vi_cv_ushort" = no; then
721 u_short_decl="typedef unsigned short u_short;"
725 AC_CACHE_CHECK([for u_int], vi_cv_uint, [dnl
726 AC_TRY_COMPILE([#include <sys/types.h>], u_int foo;,
727 [vi_cv_uint=yes], [vi_cv_uint=no])])
728 if test "$vi_cv_uint" = no; then
729 u_int_decl="typedef unsigned int u_int;"
732 AC_SUBST(u_long_decl)
733 AC_CACHE_CHECK([for u_long], vi_cv_ulong, [dnl
734 AC_TRY_COMPILE([#include <sys/types.h>], u_long foo;,
735 [vi_cv_ulong=yes], [vi_cv_ulong=no])])
736 if test "$vi_cv_ulong" = no; then
737 u_long_decl="typedef unsigned long u_long;"
740 dnl DB/Vi use specific integer sizes.
741 AC_SUBST(u_int8_decl)
742 AC_CACHE_CHECK([for u_int8_t], vi_cv_uint8, [dnl
743 AC_TRY_COMPILE([#include <sys/types.h>], u_int8_t foo;,
745 AC_TRY_RUN([main(){exit(sizeof(unsigned char) != 1);}],
746 [vi_cv_uint8="unsigned char"], [vi_cv_uint8=no]))])
747 if test "$vi_cv_uint8" = no; then
748 AC_MSG_ERROR(No unsigned 8-bit integral type.)
750 if test "$vi_cv_uint8" != yes; then
751 u_int8_decl="typedef $vi_cv_uint8 u_int8_t;"
754 AC_SUBST(u_int16_decl)
755 AC_CACHE_CHECK([for u_int16_t], vi_cv_uint16, [dnl
756 AC_TRY_COMPILE([#include <sys/types.h>], u_int16_t foo;,
758 AC_TRY_RUN([main(){exit(sizeof(unsigned short) != 2);}],
759 [vi_cv_uint16="unsigned short"],
760 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 2);}],
761 [vi_cv_uint16="unsigned int"], [vi_cv_uint16=no])))])
762 if test "$vi_cv_uint16" = no; then
763 AC_MSG_ERROR([No unsigned 16-bit integral type.])
765 if test "$vi_cv_uint16" != yes; then
766 u_int16_decl="typedef $vi_cv_uint16 u_int16_t;"
770 AC_CACHE_CHECK([for int16_t], vi_cv_int16, [dnl
771 AC_TRY_COMPILE([#include <sys/types.h>], int16_t foo;,
773 AC_TRY_RUN([main(){exit(sizeof(short) != 2);}],
774 [vi_cv_int16="short"],
775 AC_TRY_RUN([main(){exit(sizeof(int) != 2);}],
776 [vi_cv_int16="int"], [vi_cv_int16=no])))])
777 if test "$vi_cv_int16" = no; then
778 AC_MSG_ERROR([No signed 16-bit integral type.])
780 if test "$vi_cv_int16" != yes; then
781 int16_decl="typedef $vi_cv_int16 int16_t;"
784 AC_SUBST(u_int32_decl)
785 AC_CACHE_CHECK([for u_int32_t], vi_cv_uint32, [dnl
786 AC_TRY_COMPILE([#include <sys/types.h>], u_int32_t foo;,
788 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}],
789 [vi_cv_uint32="unsigned int"],
790 AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}],
791 [vi_cv_uint32="unsigned long"], [vi_cv_uint32=no])))])
792 if test "$vi_cv_uint32" = no; then
793 AC_MSG_ERROR([No unsigned 32-bit integral type.])
795 if test "$vi_cv_uint32" != yes; then
796 u_int32_decl="typedef $vi_cv_uint32 u_int32_t;"
800 AC_CACHE_CHECK([for int32_t], vi_cv_int32, [dnl
801 AC_TRY_COMPILE([#include <sys/types.h>], int32_t foo;,
803 AC_TRY_RUN([main(){exit(sizeof(int) != 4);}],
805 AC_TRY_RUN([main(){exit(sizeof(long) != 4);}],
806 [vi_cv_int32="long"], [vi_cv_int32=no])))])
807 if test "$vi_cv_int32" = no; then
808 AC_MSG_ERROR([No signed 32-bit integral type.])
810 if test "$vi_cv_int32" != yes; then
811 int32_decl="typedef $vi_cv_int32 int32_t;"
814 AC_CACHE_CHECK([return type of fprintf], vi_cv_type_fprintf,
815 [AC_TRY_COMPILE([#include <stdio.h>
817 ],[int i;], vi_cv_type_fprintf=int, vi_cv_type_fprintf=void)])
819 AC_SUBST(NEED_FPRINTF_PROTO)
820 AC_CACHE_CHECK([fprintf prototype needed], vi_cv_proto_fprintf,
821 [AC_TRY_COMPILE([ #include <stdio.h>
822 typedef int (*funcPtr)();
823 ],[funcPtr ptr = (funcPtr) fprintf;],
824 vi_cv_proto_fprintf=no,
825 [vi_cv_proto_fprintf=yes, AC_DEFINE(NEED_FPRINTF_PROTO)])])
830 [ --with-db3=db3prefix Path to db3 installation. ])
831 if test "$with_db3" = "no"; then
832 AC_MSG_ERROR([Need DB 3.])
835 saveLDFLAGS="$LDFLAGS"
836 if test "x$with_db3" != "x"; then
837 LDFLAGS="-L$with_db3/lib $LDFLAGS"
838 CFLAGS="-I$with_db3/include $CFLAGS"
841 AC_CHECK_LIB(db, db_create,
842 [vi_cv_dbfatal="no"], [vi_cv_dbfatal="yes"])
843 if test "$vi_cv_dbfatal" = "yes"; then
844 AC_MSG_ERROR([Need DB 3.])
847 LDFLAGS="$saveLDFLAGS"
850 AC_MSG_CHECKING(if --enable-dynamic-loading option specified)
851 AC_ARG_ENABLE(dynamic-loading,
852 [ --enable-dynamic-loading Load DB 3 dynamically.],
853 [vi_cv_dl="yes"], [vi_cv_dl="no"])
854 AC_MSG_RESULT($vi_cv_dl)
855 if test "$vi_cv_dl" = yes; then
856 AC_CHECK_LIB(dl, dlopen,
857 [vi_cv_dlfatal="no"], [vi_cv_dlfatal="yes"])
858 if test "$vi_cv_dlfatal" = "yes"; then
859 AC_MSG_ERROR([Need dl to support dynamic loading.])
863 PATH="$with_db3/lib:/usr/lib:/lib"
864 AC_PATH_PROG(vi_cv_path_db3, libdb-3.so, no)
865 if test "$vi_cv_path_db3" = no; then
866 AC_MSG_ERROR([Path of libdb-3.so not found.])
870 AC_DEFINE(USE_DYNAMIC_LOADING)
871 LTLIBOBJS="dldb.lo $LTLIBOBJS"
872 dl_src=../common/dldb.c
876 LDFLAGS="-L$with_db3/lib $LDFLAGS"
880 dnl We compile in nvi's RE routines unless the user specifies otherwise.
881 AC_MSG_CHECKING(if --disable-re option specified)
883 [ --disable-re DON'T use the nvi-provided RE routines.],
884 [vi_cv_re_lib="other RE"], [vi_cv_re_lib="bundled RE"])
885 AC_MSG_RESULT($vi_cv_re_lib)
886 case "$vi_cv_re_lib" in
888 CPPFLAGS="-I\$(visrcdir)/regex $CPPFLAGS"
889 LTLIBOBJS="\$(REOBJS) $LTLIBOBJS";;
894 AC_OUTPUT(Makefile port.h:port.h.in
895 pathnames.h:pathnames.h.in recover:recover.in)