Oops. Last change to mem.h was bogus.
[nvi.git] / dist / configure.in
blobb33edc12173d61fd71ff38c6da37f13d82dc1434
1 dnl     $Id: configure.in,v 8.188 2002/01/05 23:13:38 skimo Exp $
2 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT(../common/main.c)
5 AM_INIT_AUTOMAKE(vi, 1.81.5)
6 AM_CONFIG_HEADER(config.h)
8 dnl Configure setup.
9 AC_PROG_INSTALL()
10 AC_CANONICAL_HOST
11 dnl part of AM_INIT_AUTOMAKE ?
12 dnl AC_ARG_PROGRAM()
14 AC_PROG_LIBTOOL
16 dnl If the user wants a debugging environment, set OPTFLAG now, some
17 dnl compilers won't mix optimizing and debug flags.)
18 AC_MSG_CHECKING(if --enable-debug option specified)
19 AC_ARG_ENABLE(debug,
20         [  --enable-debug          Build a debugging version.],
21         [vi_cv_debug="yes"], [vi_cv_debug="no"])
22 AC_MSG_RESULT($vi_cv_debug)
23 if test "$vi_cv_debug" = yes; then
24         AC_DEFINE(DEBUG)
25         OPTFLAG=${OPTFLAG-"-g"}
26         no_op_OPTFLAG=${no_op_OPTFLAG-"-g"}
29 dnl This is where we handle stuff that autoconf can't handle.
30 dnl XXX
31 dnl Don't override anything if it's already set from the environment.
33 dnl Compiler, preprocessor and load flags.
34 dnl AUX:        -ZP disables _BSD_SOURCE et al, but enables POSIX at link time.
35 dnl LynxOS:     We check for gcc 2.x or better, the gcc 1 that was shipped with
36 dnl             LynxOS historically wasn't good enough.
37 AC_SUBST(CPPFLAGS)
38 case "$host_os" in
39 aix3.2.5)  OPTFLAG=${OPTFLAG-"-O"};;
40 aix4.1*)   CFLAGS=${CFLAGS-"-qstrict"}
41            OPTFLAG=${OPTFLAG-"-O3"};;
42 aux*)      CPPFLAGS=${CPPFLAGS-"-ZP -D_BSD_SOURCE -D_SYSV_SOURCE -D_AUX_SOURCE"}
43            LDFLAGS=${LDFLAGS-"-ZP"}
44            OPTFLAG=${OPTFLAG-"-O"};;
45 bsd4.4)    OPTFLAG=${OPTFLAG-"-O2"};;
46 bsdi*)     CC=${CC-"shlicc"}
47            OPTFLAG=${OPTFLAG-"-O2"};;
48 irix6*)    OPTFLAG=${OPTFLAG-"-O2"};;
49 irix*)     OPTFLAG=${OPTFLAG-"-O2"};;
50 lynxos*)   AC_PROG_CC()
51            AC_MSG_CHECKING([for GNU C (gcc) version 2.x])
52            ac_cv_gcc_vers=`${CC-cc} -v 2>&1 | \
53                 grep "gcc version " | sed 's/.*version //'`
54            ac_cv_gcc_major=`echo "$ac_cv_gcc_vers" | sed 's/\..*//'`
55            if test "$ac_cv_gcc_major" = "2" ; then
56                 AC_MSG_RESULT(yes)
57            else
58                 AC_MSG_RESULT(no)
59                 AC_MSG_WARN([Nvi requires gcc 2.x to build on LynxOS.])
60                 AC_MSG_ERROR([See build/README.LynxOS for more information.])
61            fi;;
62 nextstep3) CPPFLAGS=${CPPFLAGS-"-w -pipe -posix"}
63            LDFLAGS=${LDFLAGS-"-posix"}
64            OPTFLAG=${OPTFLAG-"-O2"};;
65 osf*)      CFLAGS=${CFLAGS-"-Olimit 1000"};;
66 solaris*)  no_op_OPTFLAG=${no_op_OPTFLAG-""};;
67 sunos*)    no_op_OPTFLAG=${no_op_OPTFLAG-""};;
68 esac
70 dnl The default OPTFLAG is -O
71 AC_SUBST(OPTFLAG)
72 OPTFLAG=${OPTFLAG-"-O"}
74 dnl The default compiler is cc (NOT gcc), the default CFLAGS is empty,
75 dnl NOT whatever AC_PROG_CC sets.
76 AC_SUBST(CC)
77 CC=${CC-cc}
78 CFLAGS=${CFLAGS-""}
79 AC_PROG_CC
81 if test "$GCC" = yes; then
82         AC_DEFINE(HAVE_GCC)
85 dnl The SunOS/Solaris compiler can't optimize vi/v_txt.c; the symptom is
86 dnl that the command 35i==<esc> turns into an infinite loop.
87 AC_SUBST(no_op_OPTFLAG)
88 no_op_OPTFLAG=${no_op_OPTFLAG-"$OPTFLAG"}
90 dnl Libraries.
91 case "$host_os" in
92 bsdi2.1)   LIBS=${LIBS-"-lipc"};;
93 dgux*)     LIBS=${LIBS-"-ldgc"};;
94 irix6*)    LIBS=${LIBS-"-lbsd"};;
95 irix*)     LIBS=${LIBS-"-lc_s -lbsd"};;
96 isc*)      LIBS=${LIBS-"-lcposix -linet"};;
97 netbsd1*)  LIBS=${LIBS-"-lcrypt"};;
98 ptx*)      LIBS=${LIBS-"-lseq -linet -lsocket"};;
99 sco3.2*)   LIBS=${LIBS-"-lsocket"};;
100 sinix*)    LIBS=${LIBS-"-lelf -lc"};;
101 solaris*)  LIBS=${LIBS-"-lsocket -lnsl -ldl"};;
102 wgs*)      LIBS=${LIBS-"-lnsl"};;
103 esac
105 dnl A/UX has a broken getopt(3), strpbrk(3).
106 case "$host_os" in
107 aux*)      LIBOBJS="getopt.o strpbrk.o $LIBOBJS";;
108 esac
110 dnl Ultrix has a broken POSIX.1 VDISABLE value.
111 case "$host_os" in
112 ultrix*)   AC_DEFINE(HAVE_BROKEN_VDISABLE);;
113 esac
115 AC_MSG_CHECKING(whether recording of pathnames of libraries is enabled)
116 AC_ARG_ENABLE(runpath,
117         [  --disable-runpath       Don't record path of libraries in binary.],
118         [vi_cv_runpath="$enableval"], [vi_cv_runpath="yes"])
119 AC_MSG_RESULT($vi_cv_runpath)
121 if test "X$vi_cv_runpath" = "Xyes"; then
122         LRscript='s/^\(.*\)/-R\1 -L\1 /'
123 else
124         LRscript='s/^\(.*\)/-L\1 /'
127 dnl If the user wants a tracing version, add the TRACE compile flag.
128 AC_MSG_CHECKING(if --enable-trace option specified)
129 AC_ARG_ENABLE(trace,
130         [  --enable-trace          Build a tracing version.],
131         [vi_cv_trace="yes"], [vi_cv_trace="no"])
132 if test "$vi_cv_trace" = yes; then
133         CPPFLAGS="-DTRACE $CPPFLAGS"
135 AC_MSG_RESULT($vi_cv_trace)
137 dnl The user may have additional CPP information.
138 CPPFLAGS="$ADDCPPFLAGS $CPPFLAGS"
140 dnl The user may have additional load line information.
141 LDFLAGS="$ADDLDFLAGS $LDFLAGS"
143 dnl The user may have additional library information.
144 LIBS="$ADDLIBS $LIBS"
146 dnl Checks for programs.
147 PATH="$PATH:/usr/bin:/usr/sbin:/sbin:/etc:/usr/etc:/usr/lib:/usr/ucblib"
149 dnl Check for the shell path.
150 AC_PATH_PROG(vi_cv_path_shell, sh, no)
151 if test "$vi_cv_path_shell" = no; then
152         AC_MSG_ERROR([No shell utility found.])
155 dnl Check for the sendmail path.
156 AC_PATH_PROG(vi_cv_path_sendmail, sendmail, no)
157 if test "$vi_cv_path_sendmail" = no; then
158         AC_MSG_WARN([No sendmail utility found;])
159         AC_MSG_WARN([    users will not be told of saved files.])
162 dnl Check for the perl5/perl path.
163 AC_SUBST(vi_cv_path_perl)
164 AC_PATH_PROGS(vi_cv_path_perl, perl5 perl, no)
166 dnl Check for the "preserve" path.
167 dnl Historically, nvi has used /var/tmp/vi.recover.  The Linux filesystem
168 dnl standard (FSSTND) uses /var/preserve; we add the vi.recover directory
169 dnl beneath it so that we don't have name collisions with other editors.
170 dnl Other systems have /var/preserve as well, so we test first for an already
171 dnl existing name, and then use the first one that's writeable.
172 AC_SUBST(vi_cv_path_preserve)
173 AC_MSG_CHECKING(for preserve directory)
174 AC_CACHE_VAL(vi_cv_path_preserve, [dnl
175         dirlist="/var/preserve /var/tmp /usr/tmp"
176         vi_cv_path_preserve=no
177         for i in $dirlist; do
178                 if test -d $i/vi.recover; then
179                         vi_cv_path_preserve=$i/vi.recover
180                         break;
181                 fi
182         done
183         if test "$vi_cv_path_preserve" = no; then
184                 for i in $dirlist; do
185                         if test -d $i -a -w $i; then
186                                 vi_cv_path_preserve=$i/vi.recover
187                                 break;
188                         fi
189                 done
191         fi])
192 if test "$vi_cv_path_preserve" = no; then
193         AC_MSG_ERROR([No writeable preserve directory found.])
195 AC_MSG_RESULT($vi_cv_path_preserve)
196 AC_PATH_PROG(vi_cv_path_fuser, fuser, no)
197 AC_PATH_PROG(vi_cv_path_lsof, lsof, no)
198 AC_SUBST(INUSE)
199 INUSE=""
200 if test "$vi_cv_path_lsof" != no; then
201         INUSE='test `lsof -t $i`'
203 if test "$vi_cv_path_fuser" != no; then
204         INUSE='fuser -s $i'
207 dnl Check for programs used for installation
208 AC_PROG_AWK
209 AC_PATH_PROG(vi_cv_path_ar, ar, missing_ar)
210 AC_PATH_PROG(vi_cv_path_chmod, chmod, missing_chmod)
211 AC_PATH_PROG(vi_cv_path_cp, cp, missing_cp)
212 AC_PATH_PROG(vi_cv_path_ln, ln, missing_ln)
213 AC_PATH_PROG(vi_cv_path_mkdir, mkdir, missing_mkdir)
214 AC_PATH_PROG(vi_cv_path_rm, rm, missing_rm)
215 AC_PATH_PROG(vi_cv_path_ranlib, ranlib, missing_ranlib)
216 AC_PATH_PROG(vi_cv_path_strip, strip, missing_strip)
218 dnl Checks for libraries.
219 dnl Find the X libraries and includes.
220 AC_PATH_X
221 AC_SUBST(XINCS)
222 if test "$no_x" != yes; then
223         if test "X$x_libraries" != "X"; then
224                 XLIBS="`echo $x_libraries | sed "$LRscript"` $XLIBS"
225         fi
226         XLIBS="$XLIBS -lX11"
227         if test "X$x_includes" != "X"; then
228                 XINCS="-I$x_includes"
229         fi
232 dnl Check if the user wants widechar support.
233 AC_MSG_CHECKING(if --enable-widechar option specified)
234 AC_ARG_ENABLE(widechar,
235         [  --enable-widechar       Build a wide char aware vi.],
236         [vi_cv_widechar="yes"], [vi_cv_widechar="no"])
237 if test "$vi_cv_widechar" = "yes"; then
238         AC_DEFINE(USE_WIDECHAR)
240 AC_MSG_RESULT($vi_cv_widechar)
242 dnl Check whether we can use iconv
243 AC_CHECK_HEADER(langinfo.h, [
244         AC_CHECK_HEADER(iconv.h, [
245                 AC_DEFINE(USE_ICONV)
246                 AC_REPLACE_FUNCS(iswblank)
247         ])
250 dnl If the user wants a Gtk IPC front-end for nvi, build it.
251 AC_SUBST(vi_programs)
252 AC_SUBST(vi_ipc)
253 AC_SUBST(GTKLIBS)
254 AC_SUBST(GTKINCS)
255 AC_MSG_CHECKING(if --enable-gtk option specified)
256 AC_ARG_ENABLE(gtk,
257         [  --enable-gtk            Build a Gtk front-end for vi.],
258         [vi_cv_gtk="yes"], [vi_cv_gtk="no"])
259 AC_MSG_RESULT($vi_cv_gtk)
260 if test "$vi_cv_gtk" = "yes"; then
261         #
262         # Find pkg-config
263         #
264         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
265         if test x$PKG_CONFIG = xno ; then
266             if test "$vi_cv_widechar" = "yes"; then
267                 AC_MSG_ERROR(
268 [*** pkg-config not found. See http://pkgconfig.sourceforge.net])
269             fi
271         else
272             if ! $PKG_CONFIG --atleast-pkgconfig-version 0.5 ; then
273                 if test "$vi_cv_widechar" = "yes"; then
274                     AC_MSG_ERROR(
275 [*** pkg-config too old; version 0.5 or better required.])
276                 fi
277                 PKG_CONFIG=no
278             fi
280         fi
281         if test x$PKG_CONFIG = xno ; then
282             PKG_CONFIG=/bin/false
283         fi
285         vi_programs="$vi_programs vi-gtk"
286         vi_ipc=vi-ipc
287         AC_MSG_CHECKING(for gtk+)
288         if $PKG_CONFIG gtk+-2.0 ; then
289               GTKINCS=`$PKG_CONFIG --cflags gtk+-2.0`
290               GTKLIBS=`$PKG_CONFIG --libs gtk+-2.0`
292               AC_MSG_RESULT(ok)
293               AC_DEFINE(HAVE_PANGO)
294         else
295             if test "$vi_cv_widechar" = "yes"; then
296                 AC_MSG_ERROR([
297 *** gtk+-2.0 is required. The latest version of gtk
298 *** is always available from ftp://ftp.gtk.org/.
299                 ])
300             else
301                 AM_PATH_GTK(1.2.0)
302                 GTKINCS="$GTK_CFLAGS"
303                 GTKLIBS="$GTK_LIBS $LIBS"
304             fi
305         fi
307         SAVELIBS="$LIBS"
308         LIBS="-lutil $GTKLIBS"
309         AC_CHECK_LIB(nvizvt, zvt_get_ptys,
310                 [vi_cv_zvt="yes"], [vi_cv_zvt="no"])
311         if test "$vi_cv_zvt" = "yes"; then
312                 GTKLIBS="-lnvizvt $LIBS"
313                 AC_DEFINE(HAVE_ZVT)
314         fi
315         LIBS="$SAVELIBS"
316 #       AC_PATH_PROG(vi_cv_gnome_config, gnome-config, no)
317 #       if test "$vi_cv_gnome_config" != "no"; then
318 #               ZVTLIBS=`$vi_cv_gnome_config zvt --libs`
319 #               GTKLIBS="$ZVTLIBS $GTKLIBS"
320 #       fi
323 dnl If the user wants a Motif IPC front-end for nvi, build it.
324 AC_SUBST(MOTIFLIBS)
325 AC_MSG_CHECKING(if --enable-motif option specified)
326 AC_ARG_ENABLE(motif,
327         [  --enable-motif          Build a Motif front-end for vi.],
328         [vi_cv_motif="yes"], [vi_cv_motif="no"])
329 AC_MSG_RESULT($vi_cv_motif)
330 if test "$vi_cv_motif" = "yes"; then
331         vi_programs="$vi_programs vi-motif"
332         vi_ipc=vi-ipc
334         dnl XXX
335         dnl BSDI's Motif libraries aren't shared.
337         case "$host_os" in
338         bsdi*)  CC=cc;;
339         esac
341         dnl XXX
342         dnl The Xinside Motif distribution requires -lSM, -lICE and -lXext.
343         dnl -lXext is generally available, the others aren't.
344         dnl
345         dnl XXX
346         dnl Color icons require -lXpm, which may or may not be available,
347         dnl depending on the version of X11.
349         MOTIFLIBS="-lXm -lXt"
350         AC_CHECK_LIB(SM, main,
351             [vi_cv_smlib="yes"], [vi_cv_smlib="no"], "$XLIBS")
352         if test "$vi_cv_smlib" = "yes"; then
353                 MOTIFLIBS="$MOTIFLIBS -lSM"
354         fi
355         AC_CHECK_LIB(ICE, main,
356             [vi_cv_icelib="yes"], [vi_cv_icelib="no"], "$XLIBS")
357         if test "$vi_cv_icelib" = "yes"; then
358                 MOTIFLIBS="$MOTIFLIBS -lICE"
359         fi
360         AC_CHECK_LIB(Xext, main,
361             [vi_cv_xextlib="yes"], [vi_cv_xextlib="no"], "$XLIBS")
362         if test "$vi_cv_xextlib" = "yes"; then
363                 MOTIFLIBS="$MOTIFLIBS -lXext"
364         fi
365         AC_CHECK_LIB(Xpm, main,
366             [vi_cv_xpmlib="yes"], [vi_cv_xpmlib="no"], "$XLIBS")
367         if test "$vi_cv_xpmlib" = "yes"; then
368                 MOTIFLIBS="$MOTIFLIBS -lXpm"
369         fi
370         MOTIFLIBS="$MOTIFLIBS $XLIBS -lm $LIBS"
373 AC_SUBST(IPCOBJS)
374 dnl Check for threads
375 AC_MSG_CHECKING(if --enable-threads option specified)
376 AC_ARG_ENABLE(threads,
377         [  --enable-threads        Turn on thread support.],
378         [vi_cv_threads="yes"], [vi_cv_threads="no"])
379 AC_MSG_RESULT($vi_cv_threads)
380 if test "$vi_cv_threads" = "yes"; then
381         LIBS="$LIBS -lpthread"
382         AC_CACHE_VAL(vi_cv_have_pthreads, [dnl
383         AC_TRY_LINK([#include <pthread.h>],
384                 [pthread_self()],
385                 [vi_cv_have_pthreads=yes],
386                 [vi_cv_have_pthreads=no])])
387         if test "$vi_cv_have_pthreads" = "no"; then
388                 AC_MSG_ERROR(No threading library found)
389         fi
390         IPCOBJS="pthread.o $IPCOBJS"
391         AC_DEFINE(HAVE_PTHREAD)
392 else
393         IPCOBJS="nothread.o $IPCOBJS"
396 dnl If the user wants a Perl interpreter in nvi, load it.
397 AC_SUBST(shrpenv)
398 AC_SUBST(perlldflags)
399 AC_SUBST(perllibs)
400 AC_SUBST(vi_cv_perllib)
401 AC_SUBST(LTLIBOBJS)
402 AC_MSG_CHECKING(if --enable-perlinterp option specified)
403 AC_ARG_ENABLE(perlinterp,
404         [  --enable-perlinterp     Include a Perl interpreter in vi.],
405         [vi_cv_perlinterp="yes"], [vi_cv_perlinterp="no"])
406 AC_MSG_RESULT($vi_cv_perlinterp)
407 if test "$vi_cv_perlinterp" = "yes"; then
408         if test "$vi_cv_path_perl" = no; then
409                 AC_MSG_ERROR([No perl5 utility found.])
410         fi
411         $vi_cv_path_perl -e 'require 5.004' || {
412                 AC_MSG_ERROR([perl5 must be version 5.004 or later.])
413         }
414         if test "$vi_cv_threads" = "yes"; then
415                 useithreads=`$vi_cv_path_perl -MConfig -e 'print $Config{useithreads}'`
416                 if test "X$useithreads" != "Xdefine"; then
417                         AC_MSG_ERROR([vi threading only compatible with perl's ithreads.])
418                 fi
419         fi
421         eval `$vi_cv_path_perl -V:shrpenv`
422         vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlib}'`
423         perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
424                 -e 'ccflags;perl_inc'`
425         if test "X$perlcppflags" != "X"; then
426                 CPPFLAGS="$perlcppflags $CPPFLAGS"
427         fi
428         perllibs=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
429                 -e 'ldopts'`
430         perlldflags=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
431                 -e 'ccdlflags'`
432         LTLIBOBJS="perl.lo perlxsi.lo perlsfio.lo $LTLIBOBJS"
433         AC_DEFINE(HAVE_PERL_INTERP)
434         AC_CACHE_CHECK([whether we need to use perl's setenv], 
435                 vi_cv_perl_setenv, [
436                 AC_TRY_RUN([
437 #include <EXTERN.h>
438 #include <perl.h>
439 #include <XSUB.h>
440 int main(){
441 #if defined(USE_ENVIRON_ARRAY) && !defined(PERL_USE_SAFE_PUTENV)
442 exit(0);
443 #else
444 exit(1);
445 #endif
447                 ], [vi_cv_perl_setenv=yes], [vi_cv_perl_setenv=no])])
448         if test "$vi_cv_perl_setenv" = yes; then
449                 AC_DEFINE(USE_PERL_SETENV)
450         fi
453 dnl If the user wants a Tk/Tcl interpreter in nvi, load it.  Make sure that
454 dnl we can find a Tk/Tcl library.
455 AC_MSG_CHECKING(if --enable-tclinterp option specified)
456 AC_ARG_ENABLE(tclinterp,
457         [  --enable-tclinterp      Include a Tk/Tcl interpreter in vi.],
458         [vi_cv_tclinterp="yes"], [vi_cv_tclinterp="no"])
459 AC_MSG_RESULT($vi_cv_tclinterp)
460 if test "$vi_cv_tclinterp" = "yes"; then
461         AC_MSG_CHECKING([for tclConfig.sh])
462         AC_CACHE_VAL(vi_cv_tclconfig, [
463                 vi_cv_tclconfig=`$srcdir/findconfig`])
464         AC_MSG_RESULT($vi_cv_tclconfig)
465         if test "x$vi_cv_tclconfig" = x; then
466                 AC_MSG_ERROR([No Tcl library found;])
467         fi
468         . $vi_cv_tclconfig
469         LTLIBOBJS="tcl.lo $LTLIBOBJS"
470         LIBS="$TCL_LIB_SPEC $TCL_LIBS $LIBS"
471         AC_DEFINE(HAVE_TCL_INTERP)
474 dnl check for curses
475 AC_SUBST(CURSLIBS)
476 AC_SUBST(CURSCPPFLAGS)
477 AC_SUBST(CURSLDFLAGS)
478 AC_SUBST(HAVE_NCURSESW)
480 dnl AC_ARG_WITH(slang,
481 dnl     [  --with-slang[=DIR]     Use S-Lang instead of curses. ],
482 dnl     [
483 dnl     if test "$withval" != yes; then
484 dnl             LDFLAGS="-L${withval}/lib $LDFLAGS"
485 dnl             CPPFLAGS="-I${withval}/include $CPPFLAGS"
486 dnl     fi
487 dnl     AC_DEFINE(USE_SLANG_CURSES)
488 dnl         AC_CHECK_LIB(slang, SLtt_get_terminfo,
489 dnl                 [CURSLIBS="$CURSLIBS -lslang -lm"],
490 dnl                 [AC_MSG_ERROR(unable to compile.  check config.log)], -lm)
491 dnl 
492 dnl     vi_cv_curses=slcurses
493 dnl     ],
494 dnl     [
495         SAVELIBS="$LIBS"
496         SAVELDFLAGS="$LDFLAGS"
497         SAVECPPFLAGS="$CPPFLAGS"
498         AC_ARG_WITH(curses,
499                 [  --with-curses=DIR       Path to curses installation. ])
500         if test "x$with_curses" != "x"; then
501                 CURSLDFLAGS="`echo $with_curses/lib | sed "$LRscript"` $CURSLDFLAGS"
502                 CURSCPPFLAGS="-I$with_curses/include $CURSCPPFLAGS"
503         fi;
504         LDFLAGS="$CURSLDFLAGS $LDFLAGS"
505         CPPFLAGS="$CURSCPPFLAGS $CPPFLAGS"
507         if test "$vi_cv_widechar" = "yes"; then
508             for vi_cv_curses in ncurses ncursesw curses; do
509                 AC_CHECK_LIB($vi_cv_curses, waddnwstr,[break])
510                 vi_cv_curses=unknown
511             done
512         else 
513             for vi_cv_curses in ncurses ncursesw curses; do
514                 AC_CHECK_LIB($vi_cv_curses, initscr, [break])
515                 vi_cv_curses=unknown
516             done
517         fi
519         if test "$vi_cv_curses" != "unknown"; then
520             CURSHEADER=curses.h
521             if test "$vi_cv_curses" = "ncurses"; then
522                 AC_CHECK_HEADERS(ncurses.h, [CURSHEADER=ncurses.h])
523             fi
524             if test "$vi_cv_curses" = "ncursesw"; then
525                 AC_CHECK_HEADERS(ncursesw/ncurses.h, 
526                         [CURSHEADER=ncursesw/ncurses.h])
527             fi
528             vi_programs="vi $vi_programs"
529             CURSLIBS="-l$vi_cv_curses"
530         else
531             AC_MSG_WARN([*** No suitable curses library found.])
532             if test "$vi_programs"X = X; then
533                 AC_MSG_ERROR([No executable to build.])
534             fi
535         fi
537 dnl Check for the termcap/termlib library.  These two checks must occur in the
538 dnl current order, and -lcurses must be loaded before -ltermcap/-ltermlib.
539 dnl On Solaris curses==termlib, but different versions of curses
540 dnl can be used. Avoid loading termlib is curses has tgetent.
541 AC_CHECK_LIB($vi_cv_curses, tgetent,
542         [vi_cv_curses_tgetent=yes], [vi_cv_curses_tgetent=no])
543 if test "$vi_cv_curses_tgetent" = no; then
544         AC_CHECK_LIB(termlib, tgetent,
545                 [vi_cv_termlib=-ltermlib], [vi_cv_termlib=no])
546         if test "$vi_cv_termlib" = no; then
547                 AC_CHECK_LIB(termcap, tgetent,
548                         [vi_cv_termlib=-ltermcap], [vi_cv_termlib=no])
549         fi
551 if test "$vi_cv_termlib" != no; then
552         CURSLIBS="$CURSLIBS $vi_cv_termlib"
555         LIBS="$SAVELIBS"
556         LDFLAGS="$SAVELDFLAGS"
557         CPPFLAGS="$SAVECPPFLAGS"
558 dnl     ])
560 dnl Checks for header files.
561 AC_MSG_CHECKING(for sys/mman.h)
562 AC_CACHE_VAL(vi_cv_include_sys_mman, [dnl
563 AC_TRY_CPP([#include <sys/mman.h>],
564         [vi_cv_include_sys_mman=yes], [vi_cv_include_sys_mman=no])])
565 if test "$vi_cv_include_sys_mman" = yes; then
566         AC_DEFINE(HAVE_SYS_MMAN_H)
568 AC_MSG_RESULT($vi_cv_include_sys_mman)
570 AC_MSG_CHECKING(for sys/select.h)
571 AC_CACHE_VAL(vi_cv_include_sys_select, [dnl
572 AC_TRY_CPP([#include <sys/select.h>],
573         [vi_cv_include_sys_select=yes], [vi_cv_include_sys_select=no])])
574 if test "$vi_cv_include_sys_select" = yes; then
575         AC_DEFINE(HAVE_SYS_SELECT_H)
577 AC_MSG_RESULT($vi_cv_include_sys_select)
579 dnl Checks for typedefs, structures, and compiler characteristics.
580 AC_CHECK_TYPE(ssize_t, int)
581 AC_C_BIGENDIAN
582 AC_C_CONST
583 AC_STRUCT_ST_BLKSIZE
584 AC_TYPE_MODE_T
585 AC_TYPE_OFF_T
586 AC_TYPE_PID_T
587 AC_TYPE_SIZE_T
588 AC_STRUCT_TM
590 dnl Checks for library functions.
591   AC_CHECK_FUNCS(bsearch gethostname memchr memset)
592 AC_REPLACE_FUNCS(bsearch gethostname memchr memset)
593   AC_CHECK_FUNCS(mkstemp mmap strdup strpbrk)
594 AC_REPLACE_FUNCS(mkstemp mmap strdup strpbrk)
595   AC_CHECK_FUNCS(snprintf vsnprintf)
596 AC_REPLACE_FUNCS(snprintf vsnprintf)
598 AC_CHECK_FUNCS(select)
599 AC_CHECK_FUNCS(setenv, [need_env=no], [need_env=yes])
600 AC_CHECK_FUNCS(strsep, [need_strsep=no], [need_strsep=yes])
601 AC_CHECK_FUNCS(unsetenv,, [need_env=yes])
603 AC_FUNC_MMAP
604 AC_FUNC_VFORK
606 dnl If we needed setenv or unsetenv, add in the clib/env.c replacement file.
607 if test "$need_env" = yes; then
608         LIBOBJS="env.o $LIBOBJS"
611 dnl If we need strsep, add it and define it so we get a prototype.
612 if test "$need_strsep" = yes; then
613         LIBOBJS="strsep.o $LIBOBJS"
616 dnl XXX not sure whether this is a good idea
617 LTLIBOBJS="`echo $LIBOBJS | sed 's/\.o/.lo/g'` $LTLIBOBJS"
619 dnl Check for fcntl/flock
620 dnl Use flock preferentially, since it has cleaner semantics and won't
621 dnl hang up the editor.
622 dnl XXX
623 dnl Ultrix has a broken fcntl, but a working flock.
624 dnl IRIX and DGUX have a broken flock, but working fcntl.
625 AC_MSG_CHECKING(for fcntl/flock)
626 AC_CACHE_VAL(vi_cv_lock, [dnl
627         vi_cv_lock=none
628         case "$host_os" in
629         dgux*);;
630         irix*);;
631         *)
632                 AC_TRY_LINK([#include <fcntl.h>], [flock(0, 0);],
633                     [vi_cv_lock=flock]);;
634         esac
635         if test "$vi_cv_lock" = none; then
636                 AC_TRY_LINK([#include <fcntl.h>], [fcntl(0, F_SETLK, 0);],
637                     [vi_cv_lock=fcntl])
638         fi])
640 if test "$vi_cv_lock" = flock; then
641         AC_DEFINE(HAVE_LOCK_FLOCK)
643 if test "$vi_cv_lock" = fcntl; then
644         AC_DEFINE(HAVE_LOCK_FCNTL)
646 AC_MSG_RESULT($vi_cv_lock)
648 dnl Check for ftruncate/chsize
649 AC_MSG_CHECKING(for ftruncate/chsize)
650 AC_CACHE_VAL(vi_cv_ftruncate, [dnl
651 AC_TRY_LINK([#include <unistd.h>], [ftruncate(0, 0);],
652         [vi_cv_ftruncate=ftruncate],
653 AC_TRY_LINK([#include <unistd.h>], [chsize(0, 0);],
654         [vi_cv_ftruncate=chsize], [vi_cv_ftruncate=no]))])
655 if test "$vi_cv_ftruncate" = ftruncate; then
656         AC_DEFINE(HAVE_FTRUNCATE_FTRUNCATE)
658 if test "$vi_cv_ftruncate" = chsize; then
659         AC_DEFINE(HAVE_FTRUNCATE_CHSIZE)
661 if test "$vi_cv_ftruncate" = no; then
662         AC_MSG_ERROR([No file truncation system call.])
664 AC_MSG_RESULT($vi_cv_ftruncate)
666 CSAVELIBS="$LIBS"
667 CSAVELDFLAGS="$LDFLAGS"
668 CSAVECPPFLAGS="$CPPFLAGS"
669 LIBS="$CURSLIBS $LIBS"
670 LDFLAGS="$CURSLDFLAGS $LDFLAGS"
671 CPPFLAGS="$CURSCPPFLAGS $CPPFLAGS"
672 dnl Check for the tigetstr/tigetnum functions.
673 AC_MSG_CHECKING(for tigetstr/tigetnum)
674 AC_CACHE_VAL(vi_cv_have_curses_tigetstr, [dnl
675 AC_TRY_LINK([#include <$CURSHEADER>], [tigetstr(0);],
676         [vi_cv_have_curses_tigetstr=yes],
677         [vi_cv_have_curses_tigetstr=no])])
678 if test "$vi_cv_have_curses_tigetstr" = yes; then
679         AC_DEFINE(HAVE_CURSES_TIGETSTR)
681 AC_MSG_RESULT($vi_cv_have_curses_tigetstr)
683 dnl Check for potentially missing curses functions in system or user-specified
684 dnl libraries.  We also have to guess at whether the specified library is a
685 dnl BSD or System V style curses.  Use the newterm function, all System V
686 dnl curses implementations have it, none, as far as I know, of the BSD ones do.
687 if test "$vi_cv_curses" = "bundled curses"; then
688         AC_DEFINE(HAVE_BSD_CURSES)
689         AC_DEFINE(HAVE_CURSES_WADDNSTR)
690         AC_DEFINE(HAVE_CURSES_IDLOK)
691 else
692         dnl Check for the waddnstr function.
693         AC_MSG_CHECKING(for waddnstr)
694         AC_CACHE_VAL(vi_cv_have_curses_waddnstr, [dnl
695         AC_TRY_LINK([#include <$CURSHEADER>], [waddnstr(stdscr, 0, 0);],
696                 [vi_cv_have_curses_waddnstr=yes],
697                 [vi_cv_have_curses_waddnstr=no])])
698         if test "$vi_cv_have_curses_waddnstr" = yes; then
699                 AC_DEFINE(HAVE_CURSES_WADDNSTR)
700         fi
701         AC_MSG_RESULT($vi_cv_have_curses_waddnstr)
703         dnl Check for the beep function.
704         AC_MSG_CHECKING(for beep)
705         AC_CACHE_VAL(vi_cv_have_curses_beep, [dnl
706         AC_TRY_LINK([#include <$CURSHEADER>], [beep();],
707                 [vi_cv_have_curses_beep=yes],
708                 [vi_cv_have_curses_beep=no])])
709         if test "$vi_cv_have_curses_beep" = yes; then
710                 AC_DEFINE(HAVE_CURSES_BEEP)
711         fi
712         AC_MSG_RESULT($vi_cv_have_curses_beep)
714         dnl Check for the flash function.
715         AC_MSG_CHECKING(for flash)
716         AC_CACHE_VAL(vi_cv_have_curses_flash, [dnl
717         AC_TRY_LINK([#include <$CURSHEADER>], [flash();],
718                 [vi_cv_have_curses_flash=yes],
719                 [vi_cv_have_curses_flash=no])])
720         if test "$vi_cv_have_curses_flash" = yes; then
721                 AC_DEFINE(HAVE_CURSES_FLASH)
722         fi
723         AC_MSG_RESULT($vi_cv_have_curses_flash)
725         dnl Check for the idlok function.
726         AC_MSG_CHECKING(for idlok)
727         AC_CACHE_VAL(vi_cv_have_curses_idlok, [dnl
728         AC_TRY_LINK([#include <$CURSHEADER>], [idlok(0, 0);],
729                 [vi_cv_have_curses_idlok=yes],
730                 [vi_cv_have_curses_idlok=no])])
731         if test "$vi_cv_have_curses_idlok" = yes; then
732                 AC_DEFINE(HAVE_CURSES_IDLOK)
733         fi
734         AC_MSG_RESULT($vi_cv_have_curses_idlok)
736         dnl Check for the keypad function.
737         AC_MSG_CHECKING(for keypad)
738         AC_CACHE_VAL(vi_cv_have_curses_keypad, [dnl
739         AC_TRY_LINK([#include <$CURSHEADER>], [keypad(0, 0);],
740                 [vi_cv_have_curses_keypad=yes],
741                 [vi_cv_have_curses_keypad=no])])
742         if test "$vi_cv_have_curses_keypad" = yes; then
743                 AC_DEFINE(HAVE_CURSES_KEYPAD)
744         fi
745         AC_MSG_RESULT($vi_cv_have_curses_keypad)
747         dnl Check for the newterm function.
748         AC_MSG_CHECKING(for newterm)
749         AC_CACHE_VAL(vi_cv_have_curses_newterm, [dnl
750         AC_TRY_LINK([#include <$CURSHEADER>], [newterm(0, 0, 0);],
751                 [vi_cv_have_curses_newterm=yes],
752                 [vi_cv_have_curses_newterm=no])])
753         if test "$vi_cv_have_curses_newterm" = yes; then
754                 AC_DEFINE(HAVE_CURSES_NEWTERM)
755         fi
756         AC_MSG_RESULT($vi_cv_have_curses_newterm)
758         if test "$vi_cv_have_curses_newterm" = no; then
759                 AC_DEFINE(HAVE_BSD_CURSES)
760         fi
763 dnl Check for the setupterm function.  We make this check regardless of
764 dnl using the system library, because it may be part of the underlying
765 dnl termcap/termlib support, and we want to use the local one.
766 AC_MSG_CHECKING(for setupterm)
767 AC_CACHE_VAL(vi_cv_have_curses_setupterm, [dnl
768 AC_TRY_LINK([#include <$CURSHEADER>], [setupterm(0, 0, 0);],
769         [vi_cv_have_curses_setupterm=yes],
770         [vi_cv_have_curses_setupterm=no])])
771 if test "$vi_cv_have_curses_setupterm" = yes; then
772         AC_DEFINE(HAVE_CURSES_SETUPTERM)
774 AC_MSG_RESULT($vi_cv_have_curses_setupterm)
775 LIBS="$CSAVELIBS"
776 LDFLAGS="$CSAVELDFLAGS"
777 CPPFLAGS="$CSAVECPPFLAGS"
779 dnl Some moron decided to drop off an argument from the gettimeofday call,
780 dnl without changing the name.
781 AC_MSG_CHECKING(for broken gettimeofday system call)
782 AC_CACHE_VAL(vi_cv_gettimeofday, [dnl
783 AC_TRY_LINK([#include <sys/types.h>
784 #include <sys/time.h>], [gettimeofday(0, 0);],
785         [vi_cv_gettimeofday=okay], [vi_cv_gettimeofday=broken])])
786 if test "$vi_cv_gettimeofday" = broken; then
787         AC_DEFINE(HAVE_BROKEN_GETTIMEOFDAY)
789 AC_MSG_RESULT($vi_cv_gettimeofday)
791 dnl Check for which version of openpty to use, System V or Berkeley.
792 AC_MSG_CHECKING(for System V pty calls)
793 AC_CACHE_VAL(vi_cv_sys5_pty, [dnl
794 AC_TRY_LINK(, [grantpt(0);],
795         [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])])
796 if test "$vi_cv_sys5_pty" = yes; then
797         AC_DEFINE(HAVE_SYS5_PTY)
799 AC_MSG_RESULT($vi_cv_sys5_pty)
801 dnl Check for the revoke system call.
802 AC_MSG_CHECKING(for revoke system call)
803 AC_CACHE_VAL(vi_cv_revoke, [dnl
804 AC_TRY_LINK(, [revoke("a");],
805         [vi_cv_revoke=yes], [vi_cv_revoke=no])])
806 if test "$vi_cv_revoke" = yes; then
807         AC_DEFINE(HAVE_REVOKE)
809 AC_MSG_RESULT($vi_cv_revoke)
811 dnl Some versions of sprintf return a pointer to the first argument instead
812 dnl of a character count.  We assume that the return value of snprintf and
813 dnl vsprintf etc. will be the same as sprintf, and check the easy one.
814 AC_MSG_CHECKING(for int type sprintf return value)
815 AC_CACHE_VAL(vi_cv_sprintf_count, [dnl
816 AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}],
817         [vi_cv_sprintf_count=yes], [vi_cv_sprintf_count=no])])
818 if test "$vi_cv_sprintf_count" = no; then
819         AC_DEFINE(SPRINTF_RET_CHARPNT)
821 AC_MSG_RESULT($vi_cv_sprintf_count)
824 dnl Check for the standard shorthand types.
825 AC_SUBST(u_char_decl)
826 AC_CACHE_CHECK([for u_char], vi_cv_uchar, [dnl
827 AC_TRY_COMPILE([#include <sys/types.h>], u_char foo;,
828         [vi_cv_uchar=yes], [vi_cv_uchar=no])])
829 if test "$vi_cv_uchar" = no; then
830         u_char_decl="typedef unsigned char u_char;"
833 AC_SUBST(u_short_decl)
834 AC_CACHE_CHECK([for u_short], vi_cv_ushort, [dnl
835 AC_TRY_COMPILE([#include <sys/types.h>], u_short foo;,
836         [vi_cv_ushort=yes], [vi_cv_ushort=no])])
837 if test "$vi_cv_ushort" = no; then
838         u_short_decl="typedef unsigned short u_short;"
841 AC_SUBST(u_int_decl)
842 AC_CACHE_CHECK([for u_int], vi_cv_uint, [dnl
843 AC_TRY_COMPILE([#include <sys/types.h>], u_int foo;,
844         [vi_cv_uint=yes], [vi_cv_uint=no])])
845 if test "$vi_cv_uint" = no; then
846         u_int_decl="typedef unsigned int u_int;"
849 AC_SUBST(u_long_decl)
850 AC_CACHE_CHECK([for u_long], vi_cv_ulong, [dnl
851 AC_TRY_COMPILE([#include <sys/types.h>], u_long foo;,
852         [vi_cv_ulong=yes], [vi_cv_ulong=no])])
853 if test "$vi_cv_ulong" = no; then
854         u_long_decl="typedef unsigned long u_long;"
857 dnl DB/Vi use specific integer sizes.
858 AC_SUBST(u_int8_decl)
859 AC_CACHE_CHECK([for u_int8_t], vi_cv_uint8, [dnl
860 AC_TRY_COMPILE([#include <sys/types.h>], u_int8_t foo;,
861         [vi_cv_uint8=yes],
862         AC_TRY_RUN([main(){exit(sizeof(unsigned char) != 1);}],
863             [vi_cv_uint8="unsigned char"], [vi_cv_uint8=no]))])
864 if test "$vi_cv_uint8" = no; then
865         AC_MSG_ERROR(No unsigned 8-bit integral type.)
867 if test "$vi_cv_uint8" != yes; then
868         u_int8_decl="typedef $vi_cv_uint8 u_int8_t;"
871 AC_SUBST(u_int16_decl)
872 AC_CACHE_CHECK([for u_int16_t], vi_cv_uint16, [dnl
873 AC_TRY_COMPILE([#include <sys/types.h>], u_int16_t foo;,
874         [vi_cv_uint16=yes],
875 AC_TRY_RUN([main(){exit(sizeof(unsigned short) != 2);}],
876         [vi_cv_uint16="unsigned short"],
877 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 2);}],
878         [vi_cv_uint16="unsigned int"], [vi_cv_uint16=no])))])
879 if test "$vi_cv_uint16" = no; then
880         AC_MSG_ERROR([No unsigned 16-bit integral type.])
882 if test "$vi_cv_uint16" != yes; then
883         u_int16_decl="typedef $vi_cv_uint16 u_int16_t;"
886 AC_SUBST(int16_decl)
887 AC_CACHE_CHECK([for int16_t], vi_cv_int16, [dnl
888 AC_TRY_COMPILE([#include <sys/types.h>], int16_t foo;,
889         [vi_cv_int16=yes],
890 AC_TRY_RUN([main(){exit(sizeof(short) != 2);}],
891         [vi_cv_int16="short"],
892 AC_TRY_RUN([main(){exit(sizeof(int) != 2);}],
893         [vi_cv_int16="int"], [vi_cv_int16=no])))])
894 if test "$vi_cv_int16" = no; then
895         AC_MSG_ERROR([No signed 16-bit integral type.])
897 if test "$vi_cv_int16" != yes; then
898         int16_decl="typedef $vi_cv_int16 int16_t;"
901 AC_SUBST(u_int32_decl)
902 AC_CACHE_CHECK([for u_int32_t], vi_cv_uint32, [dnl
903 AC_TRY_COMPILE([#include <sys/types.h>], u_int32_t foo;,
904         [vi_cv_uint32=yes],
905 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}],
906         [vi_cv_uint32="unsigned int"],
907 AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}],
908         [vi_cv_uint32="unsigned long"], [vi_cv_uint32=no])))])
909 if test "$vi_cv_uint32" = no; then
910         AC_MSG_ERROR([No unsigned 32-bit integral type.])
912 if test "$vi_cv_uint32" != yes; then
913         u_int32_decl="typedef $vi_cv_uint32 u_int32_t;"
916 AC_SUBST(int32_decl)
917 AC_CACHE_CHECK([for int32_t], vi_cv_int32, [dnl
918 AC_TRY_COMPILE([#include <sys/types.h>], int32_t foo;,
919         [vi_cv_int32=yes],
920 AC_TRY_RUN([main(){exit(sizeof(int) != 4);}],
921         [vi_cv_int32="int"],
922 AC_TRY_RUN([main(){exit(sizeof(long) != 4);}],
923         [vi_cv_int32="long"], [vi_cv_int32=no])))])
924 if test "$vi_cv_int32" = no; then
925         AC_MSG_ERROR([No signed 32-bit integral type.])
927 if test "$vi_cv_int32" != yes; then
928         int32_decl="typedef $vi_cv_int32 int32_t;"
931 AC_CACHE_CHECK([return type of fprintf], vi_cv_type_fprintf,
932 [AC_TRY_COMPILE([#include <stdio.h>
933 int fprintf ();
934 ],[int i;], vi_cv_type_fprintf=int, vi_cv_type_fprintf=void)])
936 AC_SUBST(NEED_FPRINTF_PROTO)
937 AC_CACHE_CHECK([fprintf prototype needed], vi_cv_proto_fprintf,
938 [AC_TRY_COMPILE([ #include <stdio.h>
939 typedef int     (*funcPtr)();
940 ],[funcPtr ptr = (funcPtr) fprintf;], 
941 vi_cv_proto_fprintf=no, 
942 [vi_cv_proto_fprintf=yes])])
943 if test "$vi_cv_proto_fprintf" = yes; then
944         AC_DEFINE(NEED_FPRINTF_PROTO)
948 dnl Check for DB 3
949 AC_ARG_WITH(db3,
950         [  --with-db3=db3prefix    Path to db3 installation. ])
951 if test "$with_db3" = "no"; then
952         AC_MSG_ERROR([Need DB 3.])
955 saveLDFLAGS="$LDFLAGS"
956 if test "x$with_db3" != "x"; then
957         LDFLAGS="-L$with_db3/lib $LDFLAGS"
958         CPPFLAGS="-I$with_db3/include $CPPFLAGS"
961 LIBS="$LIBS -ldb"
962 AC_TRY_LINK([#include <db.h>],
963         [db_create(NULL,NULL,0)],
964         [vi_cv_dbfatal="no"], [vi_cv_dbfatal="yes"])
965 if test "$vi_cv_dbfatal" = "yes"; then
966         AC_MSG_ERROR([Need DB 3.])
969 LDFLAGS="$saveLDFLAGS"
971 AC_SUBST(dl_src)
972 AC_MSG_CHECKING(if --enable-dynamic-loading option specified)
973 AC_ARG_ENABLE(dynamic-loading,
974         [  --enable-dynamic-loading Load DB 3 dynamically.],
975         [vi_cv_dl="yes"], [vi_cv_dl="no"])
976 AC_MSG_RESULT($vi_cv_dl)
977 if test "$vi_cv_dl" = yes; then
978         AC_CHECK_LIB(dl, dlopen,
979                 [vi_cv_dlfatal="no"], [vi_cv_dlfatal="yes"])
980         if test "$vi_cv_dlfatal" = "yes"; then
981                 AC_MSG_ERROR([Need dl to support dynamic loading.])
982         fi
983         OLDPATH="$PATH"
985         PATH="$with_db3/lib:/usr/lib:/lib"
986         AC_PATH_PROG(vi_cv_path_db3, libdb-3.so, no)
987         if test "$vi_cv_path_db3" = no; then
988                 AC_MSG_ERROR([Path of libdb-3.so not found.])
989         fi
990         PATH="$OLDPATH"
992         AC_DEFINE(USE_DYNAMIC_LOADING)
993         LTLIBOBJS="dldb.lo $LTLIBOBJS"
994         dl_src=../common/dldb.c
995         LIBS="-ldl $LIBS"
996 else
997         LIBS="-ldb $LIBS"
998         if test "X$with_db3" != "X"; then
999                 LDFLAGS="`echo $with_db3/lib | sed "$LRscript"` $LDFLAGS"
1000         fi
1003 AC_ARG_WITH(db_build,
1004         [  --with-db-build=prefix    Path to db build. ])
1005 if test "x$with_db_build" != "x"; then
1006         vi_cv_dbsrc=`$AWK '/^srcdir/ {gsub("srcdir[[ \t]]*=","");print $1}' \
1007                      $with_db_build/Makefile`
1008         case $with_db_build in
1009         *[[\\/]]);;
1010         *)
1011             with_db_build="$with_db_build/";;
1012         esac
1013         case $vi_cv_dbsrc in
1014         [[\\/]]*);;
1015         *)
1016             vi_cv_dbsrc="$with_db_build$vi_cv_dbsrc";;
1017         esac
1020 if test "x$vi_cv_dbsrc" != "x"; then
1021         AC_MSG_CHECKING(for DB 4)
1022         AC_EGREP_CPP([^4],
1023                 [#include <db.h>
1024 DB_VERSION_MAJOR],
1025                 [vi_cv_db4="yes"], [vi_cv_db4="no"])
1026         AC_MSG_RESULT($vi_cv_db4)
1027         if test "$vi_cv_db4" = "yes"; then
1028                 CPPFLAGS="-I$vi_cv_dbsrc/include $CPPFLAGS"
1029                 CPPFLAGS="-I$vi_cv_dbsrc/include_auto $CPPFLAGS"
1030                 CPPFLAGS="-I$with_db_build $CPPFLAGS"
1031                 AC_DEFINE(USE_DB4_LOGGING)
1032                 LTLIBOBJS="vi_auto.lo vi_rec.lo $LTLIBOBJS"
1033         fi
1036 dnl We compile in nvi's RE routines unless the user specifies otherwise.
1037 AC_MSG_CHECKING(if --disable-re option specified)
1038 AC_ARG_ENABLE(re,
1039         [  --disable-re            DON'T use the nvi-provided RE routines.],
1040         [vi_cv_re_lib="other RE"], [vi_cv_re_lib="bundled RE"])
1041 AC_MSG_RESULT($vi_cv_re_lib)
1042 case "$vi_cv_re_lib" in
1043 "bundled RE")
1044         CPPFLAGS="-I\$(visrcdir)/regex $CPPFLAGS"
1045         LTLIBOBJS="\$(REOBJS) $LTLIBOBJS";;
1046 "other RE")
1047         ;;
1048 esac
1050 AC_OUTPUT(Makefile port.h:port.h.in
1051     pathnames.h:pathnames.h.in recover:recover.in)