don't use LTLIBOBJS
[nvi.git] / dist / configure.in
blob627f5b842e8faf5afb766f0c339f4c9d3ba19392
1 dnl     $Id: configure.in,v 8.191 2003/02/17 20:06:36 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_MSG_CHECKING(if --enable-perlinterp option specified)
402 AC_ARG_ENABLE(perlinterp,
403         [  --enable-perlinterp     Include a Perl interpreter in vi.],
404         [vi_cv_perlinterp="yes"], [vi_cv_perlinterp="no"])
405 AC_MSG_RESULT($vi_cv_perlinterp)
406 if test "$vi_cv_perlinterp" = "yes"; then
407         if test "$vi_cv_path_perl" = no; then
408                 AC_MSG_ERROR([No perl5 utility found.])
409         fi
410         $vi_cv_path_perl -e 'require 5.004' || {
411                 AC_MSG_ERROR([perl5 must be version 5.004 or later.])
412         }
413         if test "$vi_cv_threads" = "yes"; then
414                 useithreads=`$vi_cv_path_perl -MConfig -e 'print $Config{useithreads}'`
415                 if test "X$useithreads" != "Xdefine"; then
416                         AC_MSG_ERROR([vi threading only compatible with perl's ithreads.])
417                 fi
418         fi
420         eval `$vi_cv_path_perl -V:shrpenv`
421         vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlib}'`
422         perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
423                 -e 'ccflags;perl_inc'`
424         if test "X$perlcppflags" != "X"; then
425                 CPPFLAGS="$perlcppflags $CPPFLAGS"
426         fi
427         perllibs=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
428                 -e 'ldopts'`
429         perlldflags=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
430                 -e 'ccdlflags'`
431         LIBOBJS="perl.o perlxsi.o perlsfio.o $LIBOBJS"
432         AC_DEFINE(HAVE_PERL_INTERP)
433         AC_CACHE_CHECK([whether we need to use perl's setenv], 
434                 vi_cv_perl_setenv, [
435                 AC_TRY_RUN([
436 #include <EXTERN.h>
437 #include <perl.h>
438 #include <XSUB.h>
439 int main(){
440 #if defined(USE_ENVIRON_ARRAY) && !defined(PERL_USE_SAFE_PUTENV)
441 exit(0);
442 #else
443 exit(1);
444 #endif
446                 ], [vi_cv_perl_setenv=yes], [vi_cv_perl_setenv=no])])
447         if test "$vi_cv_perl_setenv" = yes; then
448                 AC_DEFINE(USE_PERL_SETENV)
449         fi
452 dnl If the user wants a Tk/Tcl interpreter in nvi, load it.  Make sure that
453 dnl we can find a Tk/Tcl library.
454 AC_MSG_CHECKING(if --enable-tclinterp option specified)
455 AC_ARG_ENABLE(tclinterp,
456         [  --enable-tclinterp      Include a Tk/Tcl interpreter in vi.],
457         [vi_cv_tclinterp="yes"], [vi_cv_tclinterp="no"])
458 AC_MSG_RESULT($vi_cv_tclinterp)
459 if test "$vi_cv_tclinterp" = "yes"; then
460         AC_MSG_CHECKING([for tclConfig.sh])
461         AC_CACHE_VAL(vi_cv_tclconfig, [
462                 vi_cv_tclconfig=`$srcdir/findconfig`])
463         AC_MSG_RESULT($vi_cv_tclconfig)
464         if test "x$vi_cv_tclconfig" = x; then
465                 AC_MSG_ERROR([No Tcl library found;])
466         fi
467         . $vi_cv_tclconfig
468         LIBOBJS="tcl.o $LIBOBJS"
469         LIBS="$TCL_LIB_SPEC $TCL_LIBS $LIBS"
470         AC_DEFINE(HAVE_TCL_INTERP)
473 dnl check for curses
474 AC_SUBST(CURSLIBS)
475 AC_SUBST(CURSCPPFLAGS)
476 AC_SUBST(CURSLDFLAGS)
477 AC_SUBST(HAVE_NCURSESW)
479 dnl AC_ARG_WITH(slang,
480 dnl     [  --with-slang[=DIR]     Use S-Lang instead of curses. ],
481 dnl     [
482 dnl     if test "$withval" != yes; then
483 dnl             LDFLAGS="-L${withval}/lib $LDFLAGS"
484 dnl             CPPFLAGS="-I${withval}/include $CPPFLAGS"
485 dnl     fi
486 dnl     AC_DEFINE(USE_SLANG_CURSES)
487 dnl         AC_CHECK_LIB(slang, SLtt_get_terminfo,
488 dnl                 [CURSLIBS="$CURSLIBS -lslang -lm"],
489 dnl                 [AC_MSG_ERROR(unable to compile.  check config.log)], -lm)
490 dnl 
491 dnl     vi_cv_curses=slcurses
492 dnl     ],
493 dnl     [
494         SAVELIBS="$LIBS"
495         SAVELDFLAGS="$LDFLAGS"
496         SAVECPPFLAGS="$CPPFLAGS"
497         AC_ARG_WITH(curses,
498                 [  --with-curses=DIR       Path to curses installation. ])
499         if test "x$with_curses" != "x"; then
500                 CURSLDFLAGS="`echo $with_curses/lib | sed "$LRscript"` $CURSLDFLAGS"
501                 CURSCPPFLAGS="-I$with_curses/include $CURSCPPFLAGS"
502         fi;
503         LDFLAGS="$CURSLDFLAGS $LDFLAGS"
504         CPPFLAGS="$CURSCPPFLAGS $CPPFLAGS"
506         if test "$vi_cv_widechar" = "yes"; then
507             for vi_cv_curses in ncurses ncursesw curses; do
508                 AC_CHECK_LIB($vi_cv_curses, waddnwstr,[break])
509                 vi_cv_curses=unknown
510             done
511         else 
512             for vi_cv_curses in ncurses ncursesw curses; do
513                 AC_CHECK_LIB($vi_cv_curses, initscr, [break])
514                 vi_cv_curses=unknown
515             done
516         fi
518         if test "$vi_cv_curses" != "unknown"; then
519             CURSHEADER=curses.h
520             if test "$vi_cv_curses" = "ncurses"; then
521                 AC_CHECK_HEADERS(ncurses.h, [CURSHEADER=ncurses.h])
522             fi
523             if test "$vi_cv_curses" = "ncursesw"; then
524                 AC_CHECK_HEADERS(ncursesw/ncurses.h, 
525                         [CURSHEADER=ncursesw/ncurses.h])
526             fi
527             vi_programs="vi $vi_programs"
528             CURSLIBS="-l$vi_cv_curses"
529         else
530             AC_MSG_WARN([*** No suitable curses library found.])
531             if test "$vi_programs"X = X; then
532                 AC_MSG_ERROR([No executable to build.])
533             fi
534         fi
536 dnl Check for the termcap/termlib library.  These two checks must occur in the
537 dnl current order, and -lcurses must be loaded before -ltermcap/-ltermlib.
538 dnl On Solaris curses==termlib, but different versions of curses
539 dnl can be used. Avoid loading termlib is curses has tgetent.
540 AC_CHECK_LIB($vi_cv_curses, tgetent,
541         [vi_cv_curses_tgetent=yes], [vi_cv_curses_tgetent=no])
542 if test "$vi_cv_curses_tgetent" = no; then
543         AC_CHECK_LIB(termlib, tgetent,
544                 [vi_cv_termlib=-ltermlib], [vi_cv_termlib=no])
545         if test "$vi_cv_termlib" = no; then
546                 AC_CHECK_LIB(termcap, tgetent,
547                         [vi_cv_termlib=-ltermcap], [vi_cv_termlib=no])
548         fi
550 if test "$vi_cv_termlib" != no; then
551         CURSLIBS="$CURSLIBS $vi_cv_termlib"
554         LIBS="$SAVELIBS"
555         LDFLAGS="$SAVELDFLAGS"
556         CPPFLAGS="$SAVECPPFLAGS"
557 dnl     ])
559 dnl Checks for header files.
560 AC_MSG_CHECKING(for sys/mman.h)
561 AC_CACHE_VAL(vi_cv_include_sys_mman, [dnl
562 AC_TRY_CPP([#include <sys/mman.h>],
563         [vi_cv_include_sys_mman=yes], [vi_cv_include_sys_mman=no])])
564 if test "$vi_cv_include_sys_mman" = yes; then
565         AC_DEFINE(HAVE_SYS_MMAN_H)
567 AC_MSG_RESULT($vi_cv_include_sys_mman)
569 AC_MSG_CHECKING(for sys/select.h)
570 AC_CACHE_VAL(vi_cv_include_sys_select, [dnl
571 AC_TRY_CPP([#include <sys/select.h>],
572         [vi_cv_include_sys_select=yes], [vi_cv_include_sys_select=no])])
573 if test "$vi_cv_include_sys_select" = yes; then
574         AC_DEFINE(HAVE_SYS_SELECT_H)
576 AC_MSG_RESULT($vi_cv_include_sys_select)
578 dnl Checks for typedefs, structures, and compiler characteristics.
579 AC_CHECK_TYPE(ssize_t, int)
580 AC_C_BIGENDIAN
581 AC_C_CONST
582 AC_STRUCT_ST_BLKSIZE
583 AC_TYPE_MODE_T
584 AC_TYPE_OFF_T
585 AC_TYPE_PID_T
586 AC_TYPE_SIZE_T
587 AC_STRUCT_TM
589 dnl Checks for library functions.
590   AC_CHECK_FUNCS(bsearch gethostname memchr memset)
591 AC_REPLACE_FUNCS(bsearch gethostname memchr memset)
592   AC_CHECK_FUNCS(mkstemp mmap strdup strpbrk)
593 AC_REPLACE_FUNCS(mkstemp mmap strdup strpbrk)
594   AC_CHECK_FUNCS(snprintf vsnprintf)
595 AC_REPLACE_FUNCS(snprintf vsnprintf)
597 AC_CHECK_FUNCS(select)
598 AC_CHECK_FUNCS(setenv, [need_env=no], [need_env=yes])
599 AC_CHECK_FUNCS(strsep, [need_strsep=no], [need_strsep=yes])
600 AC_CHECK_FUNCS(unsetenv,, [need_env=yes])
602 AC_FUNC_MMAP
603 AC_FUNC_VFORK
605 dnl If we needed setenv or unsetenv, add in the clib/env.c replacement file.
606 if test "$need_env" = yes; then
607         LIBOBJS="env.o $LIBOBJS"
610 dnl If we need strsep, add it and define it so we get a prototype.
611 if test "$need_strsep" = yes; then
612         LIBOBJS="strsep.o $LIBOBJS"
615 dnl Check for fcntl/flock
616 dnl Use flock preferentially, since it has cleaner semantics and won't
617 dnl hang up the editor.
618 dnl XXX
619 dnl Ultrix has a broken fcntl, but a working flock.
620 dnl IRIX and DGUX have a broken flock, but working fcntl.
621 AC_MSG_CHECKING(for fcntl/flock)
622 AC_CACHE_VAL(vi_cv_lock, [dnl
623         vi_cv_lock=none
624         case "$host_os" in
625         dgux*);;
626         irix*);;
627         *)
628                 AC_TRY_LINK([#include <fcntl.h>], [flock(0, 0);],
629                     [vi_cv_lock=flock]);;
630         esac
631         if test "$vi_cv_lock" = none; then
632                 AC_TRY_LINK([#include <fcntl.h>], [fcntl(0, F_SETLK, 0);],
633                     [vi_cv_lock=fcntl])
634         fi])
636 if test "$vi_cv_lock" = flock; then
637         AC_DEFINE(HAVE_LOCK_FLOCK)
639 if test "$vi_cv_lock" = fcntl; then
640         AC_DEFINE(HAVE_LOCK_FCNTL)
642 AC_MSG_RESULT($vi_cv_lock)
644 dnl Check for ftruncate/chsize
645 AC_MSG_CHECKING(for ftruncate/chsize)
646 AC_CACHE_VAL(vi_cv_ftruncate, [dnl
647 AC_TRY_LINK([#include <unistd.h>], [ftruncate(0, 0);],
648         [vi_cv_ftruncate=ftruncate],
649 AC_TRY_LINK([#include <unistd.h>], [chsize(0, 0);],
650         [vi_cv_ftruncate=chsize], [vi_cv_ftruncate=no]))])
651 if test "$vi_cv_ftruncate" = ftruncate; then
652         AC_DEFINE(HAVE_FTRUNCATE_FTRUNCATE)
654 if test "$vi_cv_ftruncate" = chsize; then
655         AC_DEFINE(HAVE_FTRUNCATE_CHSIZE)
657 if test "$vi_cv_ftruncate" = no; then
658         AC_MSG_ERROR([No file truncation system call.])
660 AC_MSG_RESULT($vi_cv_ftruncate)
662 CSAVELIBS="$LIBS"
663 CSAVELDFLAGS="$LDFLAGS"
664 CSAVECPPFLAGS="$CPPFLAGS"
665 LIBS="$CURSLIBS $LIBS"
666 LDFLAGS="$CURSLDFLAGS $LDFLAGS"
667 CPPFLAGS="$CURSCPPFLAGS $CPPFLAGS"
668 dnl Check for the tigetstr/tigetnum functions.
669 AC_MSG_CHECKING(for tigetstr/tigetnum)
670 AC_CACHE_VAL(vi_cv_have_curses_tigetstr, [dnl
671 AC_TRY_LINK([#include <$CURSHEADER>], [tigetstr(0);],
672         [vi_cv_have_curses_tigetstr=yes],
673         [vi_cv_have_curses_tigetstr=no])])
674 if test "$vi_cv_have_curses_tigetstr" = yes; then
675         AC_DEFINE(HAVE_CURSES_TIGETSTR)
677 AC_MSG_RESULT($vi_cv_have_curses_tigetstr)
679 dnl Check for potentially missing curses functions in system or user-specified
680 dnl libraries.  We also have to guess at whether the specified library is a
681 dnl BSD or System V style curses.  Use the newterm function, all System V
682 dnl curses implementations have it, none, as far as I know, of the BSD ones do.
683 if test "$vi_cv_curses" = "bundled curses"; then
684         AC_DEFINE(HAVE_BSD_CURSES)
685         AC_DEFINE(HAVE_CURSES_WADDNSTR)
686         AC_DEFINE(HAVE_CURSES_IDLOK)
687 else
688         dnl Check for the waddnstr function.
689         AC_MSG_CHECKING(for waddnstr)
690         AC_CACHE_VAL(vi_cv_have_curses_waddnstr, [dnl
691         AC_TRY_LINK([#include <$CURSHEADER>], [waddnstr(stdscr, 0, 0);],
692                 [vi_cv_have_curses_waddnstr=yes],
693                 [vi_cv_have_curses_waddnstr=no])])
694         if test "$vi_cv_have_curses_waddnstr" = yes; then
695                 AC_DEFINE(HAVE_CURSES_WADDNSTR)
696         fi
697         AC_MSG_RESULT($vi_cv_have_curses_waddnstr)
699         dnl Check for the beep function.
700         AC_MSG_CHECKING(for beep)
701         AC_CACHE_VAL(vi_cv_have_curses_beep, [dnl
702         AC_TRY_LINK([#include <$CURSHEADER>], [beep();],
703                 [vi_cv_have_curses_beep=yes],
704                 [vi_cv_have_curses_beep=no])])
705         if test "$vi_cv_have_curses_beep" = yes; then
706                 AC_DEFINE(HAVE_CURSES_BEEP)
707         fi
708         AC_MSG_RESULT($vi_cv_have_curses_beep)
710         dnl Check for the flash function.
711         AC_MSG_CHECKING(for flash)
712         AC_CACHE_VAL(vi_cv_have_curses_flash, [dnl
713         AC_TRY_LINK([#include <$CURSHEADER>], [flash();],
714                 [vi_cv_have_curses_flash=yes],
715                 [vi_cv_have_curses_flash=no])])
716         if test "$vi_cv_have_curses_flash" = yes; then
717                 AC_DEFINE(HAVE_CURSES_FLASH)
718         fi
719         AC_MSG_RESULT($vi_cv_have_curses_flash)
721         dnl Check for the idlok function.
722         AC_MSG_CHECKING(for idlok)
723         AC_CACHE_VAL(vi_cv_have_curses_idlok, [dnl
724         AC_TRY_LINK([#include <$CURSHEADER>], [idlok(0, 0);],
725                 [vi_cv_have_curses_idlok=yes],
726                 [vi_cv_have_curses_idlok=no])])
727         if test "$vi_cv_have_curses_idlok" = yes; then
728                 AC_DEFINE(HAVE_CURSES_IDLOK)
729         fi
730         AC_MSG_RESULT($vi_cv_have_curses_idlok)
732         dnl Check for the keypad function.
733         AC_MSG_CHECKING(for keypad)
734         AC_CACHE_VAL(vi_cv_have_curses_keypad, [dnl
735         AC_TRY_LINK([#include <$CURSHEADER>], [keypad(0, 0);],
736                 [vi_cv_have_curses_keypad=yes],
737                 [vi_cv_have_curses_keypad=no])])
738         if test "$vi_cv_have_curses_keypad" = yes; then
739                 AC_DEFINE(HAVE_CURSES_KEYPAD)
740         fi
741         AC_MSG_RESULT($vi_cv_have_curses_keypad)
743         dnl Check for the newterm function.
744         AC_MSG_CHECKING(for newterm)
745         AC_CACHE_VAL(vi_cv_have_curses_newterm, [dnl
746         AC_TRY_LINK([#include <$CURSHEADER>], [newterm(0, 0, 0);],
747                 [vi_cv_have_curses_newterm=yes],
748                 [vi_cv_have_curses_newterm=no])])
749         if test "$vi_cv_have_curses_newterm" = yes; then
750                 AC_DEFINE(HAVE_CURSES_NEWTERM)
751         fi
752         AC_MSG_RESULT($vi_cv_have_curses_newterm)
754         if test "$vi_cv_have_curses_newterm" = no; then
755                 AC_DEFINE(HAVE_BSD_CURSES)
756         fi
759 dnl Check for the setupterm function.  We make this check regardless of
760 dnl using the system library, because it may be part of the underlying
761 dnl termcap/termlib support, and we want to use the local one.
762 AC_MSG_CHECKING(for setupterm)
763 AC_CACHE_VAL(vi_cv_have_curses_setupterm, [dnl
764 AC_TRY_LINK([#include <$CURSHEADER>], [setupterm(0, 0, 0);],
765         [vi_cv_have_curses_setupterm=yes],
766         [vi_cv_have_curses_setupterm=no])])
767 if test "$vi_cv_have_curses_setupterm" = yes; then
768         AC_DEFINE(HAVE_CURSES_SETUPTERM)
770 AC_MSG_RESULT($vi_cv_have_curses_setupterm)
771 LIBS="$CSAVELIBS"
772 LDFLAGS="$CSAVELDFLAGS"
773 CPPFLAGS="$CSAVECPPFLAGS"
775 dnl Some moron decided to drop off an argument from the gettimeofday call,
776 dnl without changing the name.
777 AC_MSG_CHECKING(for broken gettimeofday system call)
778 AC_CACHE_VAL(vi_cv_gettimeofday, [dnl
779 AC_TRY_LINK([#include <sys/types.h>
780 #include <sys/time.h>], [gettimeofday(0, 0);],
781         [vi_cv_gettimeofday=okay], [vi_cv_gettimeofday=broken])])
782 if test "$vi_cv_gettimeofday" = broken; then
783         AC_DEFINE(HAVE_BROKEN_GETTIMEOFDAY)
785 AC_MSG_RESULT($vi_cv_gettimeofday)
787 dnl Check for which version of openpty to use, System V or Berkeley.
788 AC_MSG_CHECKING(for System V pty calls)
789 AC_CACHE_VAL(vi_cv_sys5_pty, [dnl
790 AC_TRY_LINK(, [grantpt(0);],
791         [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])])
792 if test "$vi_cv_sys5_pty" = yes; then
793         AC_DEFINE(HAVE_SYS5_PTY)
795 AC_MSG_RESULT($vi_cv_sys5_pty)
797 dnl Check for the revoke system call.
798 AC_MSG_CHECKING(for revoke system call)
799 AC_CACHE_VAL(vi_cv_revoke, [dnl
800 AC_TRY_LINK(, [revoke("a");],
801         [vi_cv_revoke=yes], [vi_cv_revoke=no])])
802 if test "$vi_cv_revoke" = yes; then
803         AC_DEFINE(HAVE_REVOKE)
805 AC_MSG_RESULT($vi_cv_revoke)
807 dnl Some versions of sprintf return a pointer to the first argument instead
808 dnl of a character count.  We assume that the return value of snprintf and
809 dnl vsprintf etc. will be the same as sprintf, and check the easy one.
810 AC_MSG_CHECKING(for int type sprintf return value)
811 AC_CACHE_VAL(vi_cv_sprintf_count, [dnl
812 AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}],
813         [vi_cv_sprintf_count=yes], [vi_cv_sprintf_count=no])])
814 if test "$vi_cv_sprintf_count" = no; then
815         AC_DEFINE(SPRINTF_RET_CHARPNT)
817 AC_MSG_RESULT($vi_cv_sprintf_count)
820 dnl Check for the standard shorthand types.
821 AC_SUBST(u_char_decl)
822 AC_CACHE_CHECK([for u_char], vi_cv_uchar, [dnl
823 AC_TRY_COMPILE([#include <sys/types.h>], u_char foo;,
824         [vi_cv_uchar=yes], [vi_cv_uchar=no])])
825 if test "$vi_cv_uchar" = no; then
826         u_char_decl="typedef unsigned char u_char;"
829 AC_SUBST(u_short_decl)
830 AC_CACHE_CHECK([for u_short], vi_cv_ushort, [dnl
831 AC_TRY_COMPILE([#include <sys/types.h>], u_short foo;,
832         [vi_cv_ushort=yes], [vi_cv_ushort=no])])
833 if test "$vi_cv_ushort" = no; then
834         u_short_decl="typedef unsigned short u_short;"
837 AC_SUBST(u_int_decl)
838 AC_CACHE_CHECK([for u_int], vi_cv_uint, [dnl
839 AC_TRY_COMPILE([#include <sys/types.h>], u_int foo;,
840         [vi_cv_uint=yes], [vi_cv_uint=no])])
841 if test "$vi_cv_uint" = no; then
842         u_int_decl="typedef unsigned int u_int;"
845 AC_SUBST(u_long_decl)
846 AC_CACHE_CHECK([for u_long], vi_cv_ulong, [dnl
847 AC_TRY_COMPILE([#include <sys/types.h>], u_long foo;,
848         [vi_cv_ulong=yes], [vi_cv_ulong=no])])
849 if test "$vi_cv_ulong" = no; then
850         u_long_decl="typedef unsigned long u_long;"
853 dnl DB/Vi use specific integer sizes.
854 AC_SUBST(u_int8_decl)
855 AC_CACHE_CHECK([for u_int8_t], vi_cv_uint8, [dnl
856 AC_TRY_COMPILE([#include <sys/types.h>], u_int8_t foo;,
857         [vi_cv_uint8=yes],
858         AC_TRY_RUN([main(){exit(sizeof(unsigned char) != 1);}],
859             [vi_cv_uint8="unsigned char"], [vi_cv_uint8=no]))])
860 if test "$vi_cv_uint8" = no; then
861         AC_MSG_ERROR(No unsigned 8-bit integral type.)
863 if test "$vi_cv_uint8" != yes; then
864         u_int8_decl="typedef $vi_cv_uint8 u_int8_t;"
867 AC_SUBST(u_int16_decl)
868 AC_CACHE_CHECK([for u_int16_t], vi_cv_uint16, [dnl
869 AC_TRY_COMPILE([#include <sys/types.h>], u_int16_t foo;,
870         [vi_cv_uint16=yes],
871 AC_TRY_RUN([main(){exit(sizeof(unsigned short) != 2);}],
872         [vi_cv_uint16="unsigned short"],
873 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 2);}],
874         [vi_cv_uint16="unsigned int"], [vi_cv_uint16=no])))])
875 if test "$vi_cv_uint16" = no; then
876         AC_MSG_ERROR([No unsigned 16-bit integral type.])
878 if test "$vi_cv_uint16" != yes; then
879         u_int16_decl="typedef $vi_cv_uint16 u_int16_t;"
882 AC_SUBST(int16_decl)
883 AC_CACHE_CHECK([for int16_t], vi_cv_int16, [dnl
884 AC_TRY_COMPILE([#include <sys/types.h>], int16_t foo;,
885         [vi_cv_int16=yes],
886 AC_TRY_RUN([main(){exit(sizeof(short) != 2);}],
887         [vi_cv_int16="short"],
888 AC_TRY_RUN([main(){exit(sizeof(int) != 2);}],
889         [vi_cv_int16="int"], [vi_cv_int16=no])))])
890 if test "$vi_cv_int16" = no; then
891         AC_MSG_ERROR([No signed 16-bit integral type.])
893 if test "$vi_cv_int16" != yes; then
894         int16_decl="typedef $vi_cv_int16 int16_t;"
897 AC_SUBST(u_int32_decl)
898 AC_CACHE_CHECK([for u_int32_t], vi_cv_uint32, [dnl
899 AC_TRY_COMPILE([#include <sys/types.h>], u_int32_t foo;,
900         [vi_cv_uint32=yes],
901 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}],
902         [vi_cv_uint32="unsigned int"],
903 AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}],
904         [vi_cv_uint32="unsigned long"], [vi_cv_uint32=no])))])
905 if test "$vi_cv_uint32" = no; then
906         AC_MSG_ERROR([No unsigned 32-bit integral type.])
908 if test "$vi_cv_uint32" != yes; then
909         u_int32_decl="typedef $vi_cv_uint32 u_int32_t;"
912 AC_SUBST(int32_decl)
913 AC_CACHE_CHECK([for int32_t], vi_cv_int32, [dnl
914 AC_TRY_COMPILE([#include <sys/types.h>], int32_t foo;,
915         [vi_cv_int32=yes],
916 AC_TRY_RUN([main(){exit(sizeof(int) != 4);}],
917         [vi_cv_int32="int"],
918 AC_TRY_RUN([main(){exit(sizeof(long) != 4);}],
919         [vi_cv_int32="long"], [vi_cv_int32=no])))])
920 if test "$vi_cv_int32" = no; then
921         AC_MSG_ERROR([No signed 32-bit integral type.])
923 if test "$vi_cv_int32" != yes; then
924         int32_decl="typedef $vi_cv_int32 int32_t;"
927 AC_CACHE_CHECK([return type of fprintf], vi_cv_type_fprintf,
928 [AC_TRY_COMPILE([#include <stdio.h>
929 int fprintf ();
930 ],[int i;], vi_cv_type_fprintf=int, vi_cv_type_fprintf=void)])
932 AC_SUBST(NEED_FPRINTF_PROTO)
933 AC_CACHE_CHECK([fprintf prototype needed], vi_cv_proto_fprintf,
934 [AC_TRY_COMPILE([ #include <stdio.h>
935 typedef int     (*funcPtr)();
936 ],[funcPtr ptr = (funcPtr) fprintf;], 
937 vi_cv_proto_fprintf=no, 
938 [vi_cv_proto_fprintf=yes])])
939 if test "$vi_cv_proto_fprintf" = yes; then
940         AC_DEFINE(NEED_FPRINTF_PROTO)
943 AC_ARG_WITH(db_type,
944         [  --with-db=bundled|system Which db to use. ])
945 case "$with_db_type" in
946 "db1")
947         AC_MSG_WARN([Use of db1 is not officially supported.])
948         AC_DEFINE(USE_DB1)
949         ;;
950 "system")
951         ;;
953         with_db_type="bundled"
954         ;;
955 esac
957 dnl Check for DB 3
958 AC_ARG_WITH(db_prefix,
959         [  --with-db-prefix=PFX    Path to db installation. ])
961 SAVELDFLAGS="$LDFLAGS"
962 if test "x$with_db_prefix" != "x"; then
963         LDFLAGS="-L$with_db_prefix/lib $LDFLAGS"
964         CPPFLAGS="-I$with_db_prefix/include $CPPFLAGS"
966 if test "$with_db_type" != db1; then
967         SAVELIBS="$LIBS"
969         LIBS="$LIBS -ldb"
970         AC_TRY_LINK([#include <db.h>],
971                 [db_create(NULL,NULL,0)],
972                 [vi_cv_dbfatal="no"], [vi_cv_dbfatal="yes"])
973         if test "$vi_cv_dbfatal" = "yes"; then
974                 AC_MSG_ERROR([Need DB 3.])
975         fi
977         LIBS="$SAVELIBS"
979 LDFLAGS="$SAVELDFLAGS"
981 AC_SUBST(dl_src)
982 AC_MSG_CHECKING(if --enable-dynamic-loading option specified)
983 AC_ARG_ENABLE(dynamic-loading,
984         [  --enable-dynamic-loading Load DB 3 dynamically.],
985         [vi_cv_dl="yes"], [vi_cv_dl="no"])
986 AC_MSG_RESULT($vi_cv_dl)
987 if test "$vi_cv_dl" = yes; then
988         AC_CHECK_LIB(dl, dlopen,
989                 [vi_cv_dlfatal="no"], [vi_cv_dlfatal="yes"])
990         if test "$vi_cv_dlfatal" = "yes"; then
991                 AC_MSG_ERROR([Need dl to support dynamic loading.])
992         fi
993         OLDPATH="$PATH"
995         PATH="$with_db_prefix/lib:/usr/lib:/lib"
996         AC_PATH_PROG(vi_cv_path_db3, libdb-3.so, no)
997         if test "$vi_cv_path_db3" = no; then
998                 AC_MSG_ERROR([Path of libdb-3.so not found.])
999         fi
1000         PATH="$OLDPATH"
1002         AC_DEFINE(USE_DYNAMIC_LOADING)
1003         LIBOBJS="dldb.o $LIBOBJS"
1004         dl_src=../common/dldb.c
1005         LIBS="-ldl $LIBS"
1006 else
1007         LIBS="-ldb $LIBS"
1008         if test "X$with_db_prefix" != "X"; then
1009                 LDFLAGS="`echo $with_db_prefix/lib | sed "$LRscript"` $LDFLAGS"
1010         fi
1013 AC_ARG_WITH(db_build,
1014         [  --with-db-build=prefix  Path to db build. ])
1015 if test "x$with_db_build" != "x"; then
1016         vi_cv_dbsrc=`$AWK '/^srcdir/ {gsub("srcdir[[ \t]]*=","");print $1}' \
1017                      $with_db_build/Makefile`
1018         case $with_db_build in
1019         *[[\\/]]);;
1020         *)
1021             with_db_build="$with_db_build/";;
1022         esac
1023         case $vi_cv_dbsrc in
1024         [[\\/]]*);;
1025         *)
1026             vi_cv_dbsrc="$with_db_build$vi_cv_dbsrc";;
1027         esac
1030 vi_cv_db4="no"
1031 if test "x$vi_cv_dbsrc" != "x"; then
1032         AC_MSG_CHECKING(for DB 4)
1033         AC_EGREP_CPP([^4],
1034                 [#include <db.h>
1035 DB_VERSION_MAJOR],
1036                 [vi_cv_db4="yes"], [vi_cv_db4="no"])
1037         AC_MSG_RESULT($vi_cv_db4)
1039 if test "$vi_cv_db4" = "yes"; then
1040         CPPFLAGS="-I$vi_cv_dbsrc/include $CPPFLAGS"
1041         CPPFLAGS="-I$vi_cv_dbsrc/include_auto $CPPFLAGS"
1042         CPPFLAGS="-I$with_db_build $CPPFLAGS"
1043         AC_DEFINE(USE_DB4_LOGGING)
1044         LIBOBJS="log4.o vi_auto.o vi_rec.o $LIBOBJS"
1045 else
1046         LIBOBJS="log.o $LIBOBJS"
1049 dnl We compile in nvi's RE routines unless the user specifies otherwise.
1050 AC_MSG_CHECKING(if --disable-re option specified)
1051 AC_ARG_ENABLE(re,
1052         [  --disable-re            DON'T use the nvi-provided RE routines.],
1053         [vi_cv_re_lib="other RE"], [vi_cv_re_lib="bundled RE"])
1054 AC_MSG_RESULT($vi_cv_re_lib)
1055 case "$vi_cv_re_lib" in
1056 "bundled RE")
1057         CPPFLAGS="-I\$(visrcdir)/regex $CPPFLAGS"
1058         LIBOBJS="regcomp.o regerror.o regexec.o regfree.o $LIBOBJS";;
1059 "other RE")
1060         ;;
1061 esac
1063 AC_OUTPUT(Makefile port.h:port.h.in
1064     pathnames.h:pathnames.h.in recover:recover.in)