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 If the user wants a Gtk IPC front-end for nvi, build it.
214 AC_MSG_CHECKING(if --enable-gtk option specified)
216 [ --enable-gtk Build a Gtk front-end for vi.],
217 [vi_cv_gtk="yes"], [vi_cv_gtk="no"])
218 AC_MSG_RESULT($vi_cv_gtk)
219 if test "$vi_cv_gtk" = "yes"; then
222 GTKINCS="$GTK_CFLAGS"
223 GTKLIBS="$GTK_LIBS $LIBS"
224 AC_PATH_PROG(vi_cv_gnome_config, gnome-config, no)
225 if test "$vi_cv_gnome_config" != "no"; then
226 ZVTLIBS=`$vi_cv_gnome_config zvt --libs`
227 GTKLIBS="$ZVTLIBS $GTKLIBS"
231 dnl If the user wants a Motif IPC front-end for nvi, build it.
234 AC_MSG_CHECKING(if --enable-motif option specified)
236 [ --enable-motif Build a Motif front-end for vi.],
237 [vi_cv_motif="yes"], [vi_cv_motif="no"])
238 AC_MSG_RESULT($vi_cv_motif)
239 if test "$vi_cv_motif" = "yes"; then
243 dnl BSDI's Motif libraries aren't shared.
250 dnl The Xinside Motif distribution requires -lSM, -lICE and -lXext.
251 dnl -lXext is generally available, the others aren't.
254 dnl Color icons require -lXpm, which may or may not be available,
255 dnl depending on the version of X11.
257 MOTIFLIBS="-lXm -lXt"
258 AC_CHECK_LIB(SM, main,
259 [vi_cv_smlib="yes"], [vi_cv_smlib="no"], "$XLIBS")
260 if test "$vi_cv_smlib" = "yes"; then
261 MOTIFLIBS="$MOTIFLIBS -lSM"
263 AC_CHECK_LIB(ICE, main,
264 [vi_cv_icelib="yes"], [vi_cv_icelib="no"], "$XLIBS")
265 if test "$vi_cv_icelib" = "yes"; then
266 MOTIFLIBS="$MOTIFLIBS -lICE"
268 AC_CHECK_LIB(Xext, main,
269 [vi_cv_xextlib="yes"], [vi_cv_xextlib="no"], "$XLIBS")
270 if test "$vi_cv_xextlib" = "yes"; then
271 MOTIFLIBS="$MOTIFLIBS -lXext"
273 AC_CHECK_LIB(Xpm, main,
274 [vi_cv_xpmlib="yes"], [vi_cv_xpmlib="no"], "$XLIBS")
275 if test "$vi_cv_xpmlib" = "yes"; then
276 MOTIFLIBS="$MOTIFLIBS -lXpm"
278 MOTIFLIBS="$MOTIFLIBS $XLIBS -lm $LIBS"
282 dnl Check for threads
283 AC_MSG_CHECKING(if --enable-threads option specified)
284 AC_ARG_ENABLE(threads,
285 [ --enable-threads Turn on thread support.],
286 [vi_cv_threads="yes"], [vi_cv_threads="no"])
287 AC_MSG_RESULT($vi_cv_threads)
288 if test "$vi_cv_threads" = "yes"; then
289 LIBS="$LIBS -pthread"
290 AC_CACHE_VAL(vi_cv_have_pthreads, [dnl
291 AC_TRY_LINK([#include <pthread.h>],
293 [vi_cv_have_pthreads=yes],
294 [vi_cv_have_pthreads=no])])
295 if test "$vi_cv_have_pthreads" = "no"; then
296 AC_MSG_ERROR(No threading library found)
298 IPCOBJS="pthread.o $IPCOBJS"
299 AC_DEFINE(HAVE_PTHREAD)
301 IPCOBJS="nothread.o $IPCOBJS"
304 dnl If the user wants a Perl interpreter in nvi, load it.
306 AC_SUBST(perlldflags)
308 AC_SUBST(vi_cv_perllib)
310 AC_MSG_CHECKING(if --enable-perlinterp option specified)
311 AC_ARG_ENABLE(perlinterp,
312 [ --enable-perlinterp Include a Perl interpreter in vi.],
313 [vi_cv_perlinterp="yes"], [vi_cv_perlinterp="no"])
314 AC_MSG_RESULT($vi_cv_perlinterp)
315 if test "$vi_cv_perlinterp" = "yes"; then
316 if test "$vi_cv_path_perl" = no; then
317 AC_MSG_ERROR([No perl5 utility found.])
319 $vi_cv_path_perl -e 'require 5.004' || {
320 AC_MSG_ERROR([perl5 must be version 5.004 or later.])
322 if test "$vi_cv_threads" = "yes"; then
323 useithreads=`$vi_cv_path_perl -MConfig -e 'print $Config{useithreads}'`
324 if test "X$useithreads" != "Xdefine"; then
325 AC_MSG_ERROR([vi threading only compatible with perl's ithreads.])
329 eval `$vi_cv_path_perl -V:shrpenv`
330 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlib}'`
331 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
332 -e 'ccflags;perl_inc'`
333 if test "X$perlcppflags" != "X"; then
334 CPPFLAGS="$perlcppflags $CPPFLAGS"
336 perllibs=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
338 perlldflags=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
340 LTLIBOBJS="perl.lo perlxsi.lo perlsfio.lo $LTLIBOBJS"
341 AC_DEFINE(HAVE_PERL_INTERP)
344 dnl If the user wants a Tk/Tcl interpreter in nvi, load it. Make sure that
345 dnl we can find a Tk/Tcl library.
346 AC_MSG_CHECKING(if --enable-tclinterp option specified)
347 AC_ARG_ENABLE(tclinterp,
348 [ --enable-tclinterp Include a Tk/Tcl interpreter in vi.],
349 [vi_cv_tclinterp="yes"], [vi_cv_tclinterp="no"])
350 AC_MSG_RESULT($vi_cv_tclinterp)
351 if test "$vi_cv_tclinterp" = "yes"; then
352 LIBOBJS="tcl.o $LIBOBJS"
353 LIBS="-ltk -ltcl -lm $XLIBS $LIBS"
354 AC_DEFINE(HAVE_TCL_INTERP)
356 AC_CHECK_LIB(tcl, main,
357 [vi_cv_tkfatal="no"], [vi_cv_tkfatal="yes"], -ltk -lm)
358 if test "$vi_cv_tkfatal" = "yes"; then
359 AC_MSG_WARN([No Tk/Tcl library found;])
360 AC_MSG_ERROR([ see the section ADDING LIBRARIES AND INCLUDE FILES in the README file.])
364 dnl Check for the termcap/termlib library. Compile in nvi's curses routines
365 dnl unless the user specifies otherwise. These two checks must occur in the
366 dnl current order, and -lcurses must be loaded before -ltermcap/-ltermlib.
367 AC_CHECK_LIB(termlib, tgetent,
368 [vi_cv_termlib=-ltermlib], [vi_cv_termlib=no])
369 if test "$vi_cv_termlib" = no; then
370 AC_CHECK_LIB(termcap, tgetent,
371 [vi_cv_termlib=-ltermcap], [vi_cv_termlib=no])
373 if test "$vi_cv_termlib" != no; then
374 LIBS="$vi_cv_termlib $LIBS"
378 # XXX actually check for curses !
379 LIBS="-lcurses $LIBS"
381 dnl Checks for header files.
382 AC_MSG_CHECKING(for sys/mman.h)
383 AC_CACHE_VAL(vi_cv_include_sys_mman, [dnl
384 AC_TRY_CPP([#include <sys/mman.h>],
385 [vi_cv_include_sys_mman=yes], [vi_cv_include_sys_mman=no])])
386 if test "$vi_cv_include_sys_mman" = yes; then
387 AC_DEFINE(HAVE_SYS_MMAN_H)
389 AC_MSG_RESULT($vi_cv_include_sys_mman)
391 AC_MSG_CHECKING(for sys/select.h)
392 AC_CACHE_VAL(vi_cv_include_sys_select, [dnl
393 AC_TRY_CPP([#include <sys/select.h>],
394 [vi_cv_include_sys_select=yes], [vi_cv_include_sys_select=no])])
395 if test "$vi_cv_include_sys_select" = yes; then
396 AC_DEFINE(HAVE_SYS_SELECT_H)
398 AC_MSG_RESULT($vi_cv_include_sys_select)
400 dnl Checks for typedefs, structures, and compiler characteristics.
401 AC_CHECK_TYPE(ssize_t, int)
411 dnl Checks for library functions.
412 AC_CHECK_FUNCS(bsearch gethostname getopt memchr memcpy memmove memset)
413 AC_REPLACE_FUNCS(bsearch gethostname getopt memchr memcpy memmove memset)
414 AC_CHECK_FUNCS(mkstemp mmap snprintf strdup strerror strpbrk strtol)
415 AC_REPLACE_FUNCS(mkstemp mmap snprintf strdup strerror strpbrk strtol)
416 AC_CHECK_FUNCS(strtoul vsnprintf)
417 AC_REPLACE_FUNCS(strtoul vsnprintf)
419 AC_CHECK_FUNCS(select)
420 AC_CHECK_FUNCS(setenv, [need_env=no], [need_env=yes])
421 AC_CHECK_FUNCS(strsep, [need_strsep=no], [need_strsep=yes])
422 AC_CHECK_FUNCS(unsetenv,, [need_env=yes])
427 dnl If we needed setenv or unsetenv, add in the clib/env.c replacement file.
428 if test "$need_env" = yes; then
429 LIBOBJS="env.o $LIBOBJS"
432 dnl If we need strsep, add it and define it so we get a prototype.
433 if test "$need_strsep" = yes; then
434 LIBOBJS="strsep.o $LIBOBJS"
437 dnl XXX not sure whether this is a good idea
438 LTLIBOBJS="`echo $LIBOBJS | sed 's/\.o/.lo/g'` $LTLIBOBJS"
440 dnl Check for fcntl/flock
441 dnl Use flock preferentially, since it has cleaner semantics and won't
442 dnl hang up the editor.
444 dnl Ultrix has a broken fcntl, but a working flock.
445 dnl IRIX and DGUX have a broken flock, but working fcntl.
446 AC_MSG_CHECKING(for fcntl/flock)
447 AC_CACHE_VAL(vi_cv_lock, [dnl
453 AC_TRY_LINK([#include <fcntl.h>], [flock(0, 0);],
454 [vi_cv_lock=flock]);;
456 if test "$vi_cv_lock" = none; then
457 AC_TRY_LINK([#include <fcntl.h>], [fcntl(0, F_SETLK, 0);],
461 if test "$vi_cv_lock" = flock; then
462 AC_DEFINE(HAVE_LOCK_FLOCK)
464 if test "$vi_cv_lock" = fcntl; then
465 AC_DEFINE(HAVE_LOCK_FCNTL)
467 AC_MSG_RESULT($vi_cv_lock)
469 dnl Check for ftruncate/chsize
470 AC_MSG_CHECKING(for ftruncate/chsize)
471 AC_CACHE_VAL(vi_cv_ftruncate, [dnl
472 AC_TRY_LINK([#include <unistd.h>], [ftruncate(0, 0);],
473 [vi_cv_ftruncate=ftruncate],
474 AC_TRY_LINK([#include <unistd.h>], [chsize(0, 0);],
475 [vi_cv_ftruncate=chsize], [vi_cv_ftruncate=no]))])
476 if test "$vi_cv_ftruncate" = ftruncate; then
477 AC_DEFINE(HAVE_FTRUNCATE_FTRUNCATE)
479 if test "$vi_cv_ftruncate" = chsize; then
480 AC_DEFINE(HAVE_FTRUNCATE_CHSIZE)
482 if test "$vi_cv_ftruncate" = no; then
483 AC_MSG_ERROR([No file truncation system call.])
485 AC_MSG_RESULT($vi_cv_ftruncate)
487 dnl Check for the tigetstr/tigetnum functions.
488 AC_MSG_CHECKING(for tigetstr/tigetnum)
489 AC_CACHE_VAL(vi_cv_have_curses_tigetstr, [dnl
490 AC_TRY_LINK([#include <curses.h>], [tigetstr(0);],
491 [vi_cv_have_curses_tigetstr=yes],
492 [vi_cv_have_curses_tigetstr=no])])
493 if test "$vi_cv_have_curses_tigetstr" = yes; then
494 AC_DEFINE(HAVE_CURSES_TIGETSTR)
496 AC_MSG_RESULT($vi_cv_have_curses_tigetstr)
498 dnl Check for potentially missing curses functions in system or user-specified
499 dnl libraries. We also have to guess at whether the specified library is a
500 dnl BSD or System V style curses. Use the newterm function, all System V
501 dnl curses implementations have it, none, as far as I know, of the BSD ones do.
502 if test "$vi_cv_curses" = "bundled curses"; then
503 AC_DEFINE(HAVE_BSD_CURSES)
504 AC_DEFINE(HAVE_CURSES_WADDNSTR)
505 AC_DEFINE(HAVE_CURSES_IDLOK)
507 dnl Check for the waddnstr function.
508 AC_MSG_CHECKING(for waddnstr)
509 AC_CACHE_VAL(vi_cv_have_curses_waddnstr, [dnl
510 AC_TRY_LINK([#include <curses.h>], [waddnstr(stdscr, 0, 0);],
511 [vi_cv_have_curses_waddnstr=yes],
512 [vi_cv_have_curses_waddnstr=no])])
513 if test "$vi_cv_have_curses_waddnstr" = yes; then
514 AC_DEFINE(HAVE_CURSES_WADDNSTR)
516 AC_MSG_RESULT($vi_cv_have_curses_waddnstr)
518 dnl Check for the beep function.
519 AC_MSG_CHECKING(for beep)
520 AC_CACHE_VAL(vi_cv_have_curses_beep, [dnl
521 AC_TRY_LINK([#include <curses.h>], [beep();],
522 [vi_cv_have_curses_beep=yes],
523 [vi_cv_have_curses_beep=no])])
524 if test "$vi_cv_have_curses_beep" = yes; then
525 AC_DEFINE(HAVE_CURSES_BEEP)
527 AC_MSG_RESULT($vi_cv_have_curses_beep)
529 dnl Check for the flash function.
530 AC_MSG_CHECKING(for flash)
531 AC_CACHE_VAL(vi_cv_have_curses_flash, [dnl
532 AC_TRY_LINK([#include <curses.h>], [flash();],
533 [vi_cv_have_curses_flash=yes],
534 [vi_cv_have_curses_flash=no])])
535 if test "$vi_cv_have_curses_flash" = yes; then
536 AC_DEFINE(HAVE_CURSES_FLASH)
538 AC_MSG_RESULT($vi_cv_have_curses_flash)
540 dnl Check for the idlok function.
541 AC_MSG_CHECKING(for idlok)
542 AC_CACHE_VAL(vi_cv_have_curses_idlok, [dnl
543 AC_TRY_LINK([#include <curses.h>], [idlok(0, 0);],
544 [vi_cv_have_curses_idlok=yes],
545 [vi_cv_have_curses_idlok=no])])
546 if test "$vi_cv_have_curses_idlok" = yes; then
547 AC_DEFINE(HAVE_CURSES_IDLOK)
549 AC_MSG_RESULT($vi_cv_have_curses_idlok)
551 dnl Check for the keypad function.
552 AC_MSG_CHECKING(for keypad)
553 AC_CACHE_VAL(vi_cv_have_curses_keypad, [dnl
554 AC_TRY_LINK([#include <curses.h>], [keypad(0, 0);],
555 [vi_cv_have_curses_keypad=yes],
556 [vi_cv_have_curses_keypad=no])])
557 if test "$vi_cv_have_curses_keypad" = yes; then
558 AC_DEFINE(HAVE_CURSES_KEYPAD)
560 AC_MSG_RESULT($vi_cv_have_curses_keypad)
562 dnl Check for the newterm function.
563 AC_MSG_CHECKING(for newterm)
564 AC_CACHE_VAL(vi_cv_have_curses_newterm, [dnl
565 AC_TRY_LINK([#include <curses.h>], [newterm(0, 0, 0);],
566 [vi_cv_have_curses_newterm=yes],
567 [vi_cv_have_curses_newterm=no])])
568 if test "$vi_cv_have_curses_newterm" = yes; then
569 AC_DEFINE(HAVE_CURSES_NEWTERM)
571 AC_MSG_RESULT($vi_cv_have_curses_newterm)
573 if test "$vi_cv_have_curses_newterm" = no; then
574 AC_DEFINE(HAVE_BSD_CURSES)
578 dnl Check for the setupterm function. We make this check regardless of
579 dnl using the system library, because it may be part of the underlying
580 dnl termcap/termlib support, and we want to use the local one.
581 AC_MSG_CHECKING(for setupterm)
582 AC_CACHE_VAL(vi_cv_have_curses_setupterm, [dnl
583 AC_TRY_LINK([#include <curses.h>], [setupterm(0, 0, 0);],
584 [vi_cv_have_curses_setupterm=yes],
585 [vi_cv_have_curses_setupterm=no])])
586 if test "$vi_cv_have_curses_setupterm" = yes; then
587 AC_DEFINE(HAVE_CURSES_SETUPTERM)
589 AC_MSG_RESULT($vi_cv_have_curses_setupterm)
591 dnl Some moron decided to drop off an argument from the gettimeofday call,
592 dnl without changing the name.
593 AC_MSG_CHECKING(for broken gettimeofday system call)
594 AC_CACHE_VAL(vi_cv_gettimeofday, [dnl
595 AC_TRY_LINK([#include <sys/types.h>
596 #include <sys/time.h>], [gettimeofday(0, 0);],
597 [vi_cv_gettimeofday=okay], [vi_cv_gettimeofday=broken])])
598 if test "$vi_cv_gettimeofday" = broken; then
599 AC_DEFINE(HAVE_BROKEN_GETTIMEOFDAY)
601 AC_MSG_RESULT($vi_cv_gettimeofday)
603 dnl Check for which version of openpty to use, System V or Berkeley.
604 AC_MSG_CHECKING(for System V pty calls)
605 AC_CACHE_VAL(vi_cv_sys5_pty, [dnl
606 AC_TRY_LINK(, [grantpt(0);],
607 [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])])
608 if test "$vi_cv_sys5_pty" = yes; then
609 AC_DEFINE(HAVE_SYS5_PTY)
611 AC_MSG_RESULT($vi_cv_sys5_pty)
613 dnl Check for the revoke system call.
614 AC_MSG_CHECKING(for revoke system call)
615 AC_CACHE_VAL(vi_cv_revoke, [dnl
616 AC_TRY_LINK(, [revoke("a");],
617 [vi_cv_revoke=yes], [vi_cv_revoke=no])])
618 if test "$vi_cv_revoke" = yes; then
619 AC_DEFINE(HAVE_REVOKE)
621 AC_MSG_RESULT($vi_cv_revoke)
623 dnl Some versions of sprintf return a pointer to the first argument instead
624 dnl of a character count. We assume that the return value of snprintf and
625 dnl vsprintf etc. will be the same as sprintf, and check the easy one.
626 AC_MSG_CHECKING(for int type sprintf return value)
627 AC_CACHE_VAL(vi_cv_sprintf_count, [dnl
628 AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}],
629 [vi_cv_sprintf_count=yes], [vi_cv_sprintf_count=no])])
630 if test "$vi_cv_sprintf_count" = no; then
631 AC_DEFINE(SPRINTF_RET_CHARPNT)
633 AC_MSG_RESULT($vi_cv_sprintf_count)
636 dnl Check for the standard shorthand types.
637 AC_SUBST(u_char_decl)
638 AC_CACHE_CHECK([for u_char], vi_cv_uchar, [dnl
639 AC_TRY_COMPILE([#include <sys/types.h>], u_char foo;,
640 [vi_cv_uchar=yes], [vi_cv_uchar=no])])
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_CACHE_CHECK([for u_short], vi_cv_ushort, [dnl
647 AC_TRY_COMPILE([#include <sys/types.h>], u_short foo;,
648 [vi_cv_ushort=yes], [vi_cv_ushort=no])])
649 if test "$vi_cv_ushort" = no; then
650 u_short_decl="typedef unsigned short u_short;"
654 AC_CACHE_CHECK([for u_int], vi_cv_uint, [dnl
655 AC_TRY_COMPILE([#include <sys/types.h>], u_int foo;,
656 [vi_cv_uint=yes], [vi_cv_uint=no])])
657 if test "$vi_cv_uint" = no; then
658 u_int_decl="typedef unsigned int u_int;"
661 AC_SUBST(u_long_decl)
662 AC_CACHE_CHECK([for u_long], vi_cv_ulong, [dnl
663 AC_TRY_COMPILE([#include <sys/types.h>], u_long foo;,
664 [vi_cv_ulong=yes], [vi_cv_ulong=no])])
665 if test "$vi_cv_ulong" = no; then
666 u_long_decl="typedef unsigned long u_long;"
669 dnl DB/Vi use specific integer sizes.
670 AC_SUBST(u_int8_decl)
671 AC_CACHE_CHECK([for u_int8_t], vi_cv_uint8, [dnl
672 AC_TRY_COMPILE([#include <sys/types.h>], u_int8_t foo;,
674 AC_TRY_RUN([main(){exit(sizeof(unsigned char) != 1);}],
675 [vi_cv_uint8="unsigned char"], [vi_cv_uint8=no]))])
676 if test "$vi_cv_uint8" = no; then
677 AC_MSG_ERROR(No unsigned 8-bit integral type.)
679 if test "$vi_cv_uint8" != yes; then
680 u_int8_decl="typedef $vi_cv_uint8 u_int8_t;"
683 AC_SUBST(u_int16_decl)
684 AC_CACHE_CHECK([for u_int16_t], vi_cv_uint16, [dnl
685 AC_TRY_COMPILE([#include <sys/types.h>], u_int16_t foo;,
687 AC_TRY_RUN([main(){exit(sizeof(unsigned short) != 2);}],
688 [vi_cv_uint16="unsigned short"],
689 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 2);}],
690 [vi_cv_uint16="unsigned int"], [vi_cv_uint16=no])))])
691 if test "$vi_cv_uint16" = no; then
692 AC_MSG_ERROR([No unsigned 16-bit integral type.])
694 if test "$vi_cv_uint16" != yes; then
695 u_int16_decl="typedef $vi_cv_uint16 u_int16_t;"
699 AC_CACHE_CHECK([for int16_t], 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 if test "$vi_cv_int16" = no; then
707 AC_MSG_ERROR([No signed 16-bit integral type.])
709 if test "$vi_cv_int16" != yes; then
710 int16_decl="typedef $vi_cv_int16 int16_t;"
713 AC_SUBST(u_int32_decl)
714 AC_CACHE_CHECK([for u_int32_t], vi_cv_uint32, [dnl
715 AC_TRY_COMPILE([#include <sys/types.h>], u_int32_t foo;,
717 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}],
718 [vi_cv_uint32="unsigned int"],
719 AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}],
720 [vi_cv_uint32="unsigned long"], [vi_cv_uint32=no])))])
721 if test "$vi_cv_uint32" = no; then
722 AC_MSG_ERROR([No unsigned 32-bit integral type.])
724 if test "$vi_cv_uint32" != yes; then
725 u_int32_decl="typedef $vi_cv_uint32 u_int32_t;"
729 AC_CACHE_CHECK([for int32_t], vi_cv_int32, [dnl
730 AC_TRY_COMPILE([#include <sys/types.h>], int32_t foo;,
732 AC_TRY_RUN([main(){exit(sizeof(int) != 4);}],
734 AC_TRY_RUN([main(){exit(sizeof(long) != 4);}],
735 [vi_cv_int32="long"], [vi_cv_int32=no])))])
736 if test "$vi_cv_int32" = no; then
737 AC_MSG_ERROR([No signed 32-bit integral type.])
739 if test "$vi_cv_int32" != yes; then
740 int32_decl="typedef $vi_cv_int32 int32_t;"
743 AC_CACHE_CHECK([return type of fprintf], vi_cv_type_fprintf,
744 [AC_TRY_COMPILE([#include <stdio.h>
746 ],[int i;], vi_cv_type_fprintf=int, vi_cv_type_fprintf=void)])
748 AC_SUBST(NEED_FPRINTF_PROTO)
749 AC_CACHE_CHECK([fprintf prototype needed], vi_cv_proto_fprintf,
750 [AC_TRY_COMPILE([ #include <stdio.h>
751 typedef int (*funcPtr)();
752 ],[funcPtr ptr = (funcPtr) fprintf;],
753 vi_cv_proto_fprintf=no,
754 [vi_cv_proto_fprintf=yes, AC_DEFINE(NEED_FPRINTF_PROTO)])])
759 [ --with-db3=db3prefix Path to db3 installation. ])
760 if test "$with_db3" = "no"; then
761 AC_MSG_ERROR([Need DB 3.])
764 saveLDFLAGS="$LDFLAGS"
765 if test "x$with_db3" != "x"; then
766 LDFLAGS="-L$with_db3/lib $LDFLAGS"
767 CFLAGS="-I$with_db3/include $CFLAGS"
770 AC_CHECK_LIB(db, db_create,
771 [vi_cv_dbfatal="no"], [vi_cv_dbfatal="yes"])
772 if test "$vi_cv_dbfatal" = "yes"; then
773 AC_MSG_ERROR([Need DB 3.])
776 LDFLAGS="$saveLDFLAGS"
779 AC_MSG_CHECKING(if --enable-dynamic-loading option specified)
780 AC_ARG_ENABLE(dynamic-loading,
781 [ --enable-dynamic-loading Load DB 3 dynamically.],
782 [vi_cv_dl="yes"], [vi_cv_dl="no"])
783 AC_MSG_RESULT($vi_cv_dl)
784 if test "$vi_cv_dl" = yes; then
785 AC_CHECK_LIB(dl, dlopen,
786 [vi_cv_dlfatal="no"], [vi_cv_dlfatal="yes"])
787 if test "$vi_cv_dlfatal" = "yes"; then
788 AC_MSG_ERROR([Need dl to support dynamic loading.])
792 PATH="$with_db3/lib:/usr/lib:/lib"
793 AC_PATH_PROG(vi_cv_path_db3, libdb-3.so, no)
794 if test "$vi_cv_path_db3" = no; then
795 AC_MSG_ERROR([Path of libdb-3.so not found.])
799 AC_DEFINE(USE_DYNAMIC_LOADING)
800 LTLIBOBJS="dldb.lo $LTLIBOBJS"
801 dl_src=../common/dldb.c
805 LDFLAGS="-L$with_db3/lib $LDFLAGS"
809 dnl We compile in nvi's RE routines unless the user specifies otherwise.
810 AC_MSG_CHECKING(if --disable-re option specified)
812 [ --disable-re DON'T use the nvi-provided RE routines.],
813 [vi_cv_re_lib="other RE"], [vi_cv_re_lib="bundled RE"])
814 AC_MSG_RESULT($vi_cv_re_lib)
815 case "$vi_cv_re_lib" in
817 CPPFLAGS="-I\$(visrcdir)/regex $CPPFLAGS"
818 LTLIBOBJS="\$(REOBJS) $LTLIBOBJS";;
823 AC_OUTPUT(Makefile port.h:port.h.in
824 pathnames.h:pathnames.h.in recover:recover.in)