distrib: run libtoolize
[nvi.git] / dist / configure.in
blobba290506d2e70ce06c8ef3c8fbdb77b9ffe93bf5
1 dnl     $Id: configure.in,v 8.192 2003/02/17 20:09:07 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=$enableval], [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 AC_DEFUN([VI_CV_REPLACE_FUNCS],
233 [AC_FOREACH([AC_Func], [$1], [])dnl
234 AC_CHECK_FUNCS([$1], , [_AC_LIBOBJ($ac_func)])
237 dnl Check if the user wants widechar support.
238 AC_MSG_CHECKING(if --enable-widechar option specified)
239 AC_ARG_ENABLE(widechar,
240         [  --enable-widechar       Build a wide char aware vi.],
241         [vi_cv_widechar=$enableval], [vi_cv_widechar="no"])
242 if test "$vi_cv_widechar" = "yes"; then
243         AC_DEFINE(USE_WIDECHAR)
245 AC_MSG_RESULT($vi_cv_widechar)
247 dnl Check whether we can use iconv
248 AC_CHECK_HEADER(langinfo.h, [
249         AC_CHECK_HEADER(iconv.h, [
250                 AC_DEFINE(USE_ICONV)
251                 VI_CV_REPLACE_FUNCS(iswblank)
252         ])
255 dnl If the user wants a Gtk IPC front-end for nvi, build it.
256 AC_SUBST(vi_programs)
257 AC_SUBST(vi_ipc)
258 AC_SUBST(GTKLIBS)
259 AC_SUBST(GTKINCS)
260 AC_MSG_CHECKING(if --enable-gtk option specified)
261 AC_ARG_ENABLE(gtk,
262         [  --enable-gtk            Build a Gtk front-end for vi.],
263         [vi_cv_gtk=$enableval], [vi_cv_gtk="no"])
264 AC_MSG_RESULT($vi_cv_gtk)
265 if test "$vi_cv_gtk" = "yes"; then
266         #
267         # Find pkg-config
268         #
269         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
270         if test x$PKG_CONFIG = xno ; then
271             if test "$vi_cv_widechar" = "yes"; then
272                 AC_MSG_ERROR(
273 [*** pkg-config not found. See http://pkgconfig.sourceforge.net])
274             fi
276         else
277             if ! $PKG_CONFIG --atleast-pkgconfig-version 0.5 ; then
278                 if test "$vi_cv_widechar" = "yes"; then
279                     AC_MSG_ERROR(
280 [*** pkg-config too old; version 0.5 or better required.])
281                 fi
282                 PKG_CONFIG=no
283             fi
285         fi
286         if test x$PKG_CONFIG = xno ; then
287             PKG_CONFIG=/bin/false
288         fi
290         vi_programs="$vi_programs vi-gtk"
291         vi_ipc=vi-ipc
292         AC_MSG_CHECKING(for gtk+)
293         if $PKG_CONFIG gtk+-2.0 ; then
294               GTKINCS=`$PKG_CONFIG --cflags gtk+-2.0`
295               GTKLIBS=`$PKG_CONFIG --libs gtk+-2.0`
297               AC_MSG_RESULT(ok)
298               AC_DEFINE(HAVE_PANGO)
299         else
300             if test "$vi_cv_widechar" = "yes"; then
301                 AC_MSG_ERROR([
302 *** gtk+-2.0 is required. The latest version of gtk
303 *** is always available from ftp://ftp.gtk.org/.
304                 ])
305             else
306                 AM_PATH_GTK(1.2.0)
307                 GTKINCS="$GTK_CFLAGS"
308                 GTKLIBS="$GTK_LIBS $LIBS"
309             fi
310         fi
312         SAVELIBS="$LIBS"
313         LIBS="-lutil $GTKLIBS"
314         AC_CHECK_LIB(nvizvt, zvt_get_ptys,
315                 [vi_cv_zvt="yes"], [vi_cv_zvt="no"])
316         if test "$vi_cv_zvt" = "yes"; then
317                 GTKLIBS="-lnvizvt $LIBS"
318                 AC_DEFINE(HAVE_ZVT)
319         fi
320         LIBS="$SAVELIBS"
321 #       AC_PATH_PROG(vi_cv_gnome_config, gnome-config, no)
322 #       if test "$vi_cv_gnome_config" != "no"; then
323 #               ZVTLIBS=`$vi_cv_gnome_config zvt --libs`
324 #               GTKLIBS="$ZVTLIBS $GTKLIBS"
325 #       fi
328 dnl If the user wants a Motif IPC front-end for nvi, build it.
329 AC_SUBST(MOTIFLIBS)
330 AC_MSG_CHECKING(if --enable-motif option specified)
331 AC_ARG_ENABLE(motif,
332         [  --enable-motif          Build a Motif front-end for vi.],
333         [vi_cv_motif=$enableval], [vi_cv_motif="no"])
334 AC_MSG_RESULT($vi_cv_motif)
335 if test "$vi_cv_motif" = "yes"; then
336         vi_programs="$vi_programs vi-motif"
337         vi_ipc=vi-ipc
339         dnl XXX
340         dnl BSDI's Motif libraries aren't shared.
342         case "$host_os" in
343         bsdi*)  CC=cc;;
344         esac
346         dnl XXX
347         dnl The Xinside Motif distribution requires -lSM, -lICE and -lXext.
348         dnl -lXext is generally available, the others aren't.
349         dnl
350         dnl XXX
351         dnl Color icons require -lXpm, which may or may not be available,
352         dnl depending on the version of X11.
354         MOTIFLIBS="-lXm -lXt"
355         AC_CHECK_LIB(SM, main,
356             [vi_cv_smlib="yes"], [vi_cv_smlib="no"], "$XLIBS")
357         if test "$vi_cv_smlib" = "yes"; then
358                 MOTIFLIBS="$MOTIFLIBS -lSM"
359         fi
360         AC_CHECK_LIB(ICE, main,
361             [vi_cv_icelib="yes"], [vi_cv_icelib="no"], "$XLIBS")
362         if test "$vi_cv_icelib" = "yes"; then
363                 MOTIFLIBS="$MOTIFLIBS -lICE"
364         fi
365         AC_CHECK_LIB(Xext, main,
366             [vi_cv_xextlib="yes"], [vi_cv_xextlib="no"], "$XLIBS")
367         if test "$vi_cv_xextlib" = "yes"; then
368                 MOTIFLIBS="$MOTIFLIBS -lXext"
369         fi
370         AC_CHECK_LIB(Xpm, main,
371             [vi_cv_xpmlib="yes"], [vi_cv_xpmlib="no"], "$XLIBS")
372         if test "$vi_cv_xpmlib" = "yes"; then
373                 MOTIFLIBS="$MOTIFLIBS -lXpm"
374         fi
375         MOTIFLIBS="$MOTIFLIBS $XLIBS -lm $LIBS"
378 AC_SUBST(IPCOBJS)
379 dnl Check for threads
380 AC_MSG_CHECKING(if --enable-threads option specified)
381 AC_ARG_ENABLE(threads,
382         [  --enable-threads        Turn on thread support.],
383         [vi_cv_threads=$enableval], [vi_cv_threads="no"])
384 AC_MSG_RESULT($vi_cv_threads)
385 if test "$vi_cv_threads" = "yes"; then
386         LIBS="$LIBS -lpthread"
387         AC_CACHE_VAL(vi_cv_have_pthreads, [dnl
388         AC_TRY_LINK([#include <pthread.h>],
389                 [pthread_self()],
390                 [vi_cv_have_pthreads=yes],
391                 [vi_cv_have_pthreads=no])])
392         if test "$vi_cv_have_pthreads" = "no"; then
393                 AC_MSG_ERROR(No threading library found)
394         fi
395         IPCOBJS="pthread.o $IPCOBJS"
396         AC_DEFINE(HAVE_PTHREAD)
397 else
398         IPCOBJS="nothread.o $IPCOBJS"
401 dnl If the user wants a Perl interpreter in nvi, load it.
402 AC_SUBST(shrpenv)
403 AC_SUBST(perlldflags)
404 AC_SUBST(perllibs)
405 AC_SUBST(vi_cv_perllib)
406 AC_MSG_CHECKING(if --enable-perlinterp option specified)
407 AC_ARG_ENABLE(perlinterp,
408         [  --enable-perlinterp     Include a Perl interpreter in vi.],
409         [vi_cv_perlinterp=$enableval], [vi_cv_perlinterp="no"])
410 AC_MSG_RESULT($vi_cv_perlinterp)
411 if test "$vi_cv_perlinterp" = "yes"; then
412         if test "$vi_cv_path_perl" = no; then
413                 AC_MSG_ERROR([No perl5 utility found.])
414         fi
415         $vi_cv_path_perl -e 'require 5.004' || {
416                 AC_MSG_ERROR([perl5 must be version 5.004 or later.])
417         }
418         if test "$vi_cv_threads" = "yes"; then
419                 useithreads=`$vi_cv_path_perl -MConfig -e 'print $Config{useithreads}'`
420                 if test "X$useithreads" != "Xdefine"; then
421                         AC_MSG_ERROR([vi threading only compatible with perl's ithreads.])
422                 fi
423         fi
425         eval `$vi_cv_path_perl -V:shrpenv`
426         vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlib}'`
427         perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
428                 -e 'ccflags;perl_inc'`
429         if test "X$perlcppflags" != "X"; then
430                 CPPFLAGS="$perlcppflags $CPPFLAGS"
431         fi
432         perllibs=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
433                 -e 'ldopts'`
434         perlldflags=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
435                 -e 'ccdlflags'`
436         LIBOBJS="perl.o perlxsi.o perlsfio.o $LIBOBJS"
437         AC_DEFINE(HAVE_PERL_INTERP)
438         AC_CACHE_CHECK([whether we need to use perl's setenv], 
439                 vi_cv_perl_setenv, [
440                 AC_TRY_RUN([
441 #include <EXTERN.h>
442 #include <perl.h>
443 #include <XSUB.h>
444 int main(){
445 #if defined(USE_ENVIRON_ARRAY) && !defined(PERL_USE_SAFE_PUTENV)
446 exit(0);
447 #else
448 exit(1);
449 #endif
451                 ], [vi_cv_perl_setenv=yes], [vi_cv_perl_setenv=no])])
452         if test "$vi_cv_perl_setenv" = yes; then
453                 AC_DEFINE(USE_PERL_SETENV)
454         fi
457 dnl If the user wants a Tk/Tcl interpreter in nvi, load it.  Make sure that
458 dnl we can find a Tk/Tcl library.
459 AC_MSG_CHECKING(if --enable-tclinterp option specified)
460 AC_ARG_ENABLE(tclinterp,
461         [  --enable-tclinterp      Include a Tk/Tcl interpreter in vi.],
462         [vi_cv_tclinterp=$enableval], [vi_cv_tclinterp="no"])
463 AC_MSG_RESULT($vi_cv_tclinterp)
464 if test "$vi_cv_tclinterp" = "yes"; then
465         AC_MSG_CHECKING([for tclConfig.sh])
466         AC_CACHE_VAL(vi_cv_tclconfig, [
467                 vi_cv_tclconfig=`$srcdir/findconfig`])
468         AC_MSG_RESULT($vi_cv_tclconfig)
469         if test "x$vi_cv_tclconfig" = x; then
470                 AC_MSG_ERROR([No Tcl library found;])
471         fi
472         . $vi_cv_tclconfig
473         LIBOBJS="tcl.o $LIBOBJS"
474         LIBS="$TCL_LIB_SPEC $TCL_LIBS $LIBS"
475         AC_DEFINE(HAVE_TCL_INTERP)
478 dnl check for curses
479 AC_SUBST(CURSLIBS)
480 AC_SUBST(CURSCPPFLAGS)
481 AC_SUBST(CURSLDFLAGS)
482 AC_SUBST(HAVE_NCURSESW)
484 dnl AC_ARG_WITH(slang,
485 dnl     [  --with-slang[=DIR]     Use S-Lang instead of curses. ],
486 dnl     [
487 dnl     if test "$withval" != yes; then
488 dnl             LDFLAGS="-L${withval}/lib $LDFLAGS"
489 dnl             CPPFLAGS="-I${withval}/include $CPPFLAGS"
490 dnl     fi
491 dnl     AC_DEFINE(USE_SLANG_CURSES)
492 dnl         AC_CHECK_LIB(slang, SLtt_get_terminfo,
493 dnl                 [CURSLIBS="$CURSLIBS -lslang -lm"],
494 dnl                 [AC_MSG_ERROR(unable to compile.  check config.log)], -lm)
495 dnl 
496 dnl     vi_cv_curses=slcurses
497 dnl     ],
498 dnl     [
499         SAVELIBS="$LIBS"
500         SAVELDFLAGS="$LDFLAGS"
501         SAVECPPFLAGS="$CPPFLAGS"
502         AC_ARG_WITH(curses,
503                 [  --with-curses=DIR       Path to curses installation. ])
504         if test "x$with_curses" != "x"; then
505                 CURSLDFLAGS="`echo $with_curses/lib | sed "$LRscript"` $CURSLDFLAGS"
506                 CURSCPPFLAGS="-I$with_curses/include $CURSCPPFLAGS"
507         fi;
508         LDFLAGS="$CURSLDFLAGS $LDFLAGS"
509         CPPFLAGS="$CURSCPPFLAGS $CPPFLAGS"
511         if test "$vi_cv_widechar" = "yes"; then
512             for vi_cv_curses in ncurses ncursesw curses; do
513                 AC_CHECK_LIB($vi_cv_curses, waddnwstr,[break])
514                 vi_cv_curses=unknown
515             done
516         else 
517             for vi_cv_curses in ncurses ncursesw curses; do
518                 AC_CHECK_LIB($vi_cv_curses, initscr, [break])
519                 vi_cv_curses=unknown
520             done
521         fi
523         if test "$vi_cv_curses" != "unknown"; then
524             CURSHEADER=curses.h
525             if test "$vi_cv_curses" = "ncurses"; then
526                 AC_CHECK_HEADERS(ncurses.h, [CURSHEADER=ncurses.h])
527             fi
528             if test "$vi_cv_curses" = "ncursesw"; then
529                 AC_CHECK_HEADERS(ncursesw/ncurses.h, 
530                         [CURSHEADER=ncursesw/ncurses.h])
531             fi
532             vi_programs="vi $vi_programs"
533             CURSLIBS="-l$vi_cv_curses"
534         else
535             AC_MSG_WARN([*** No suitable curses library found.])
536             if test "$vi_programs"X = X; then
537                 AC_MSG_ERROR([No executable to build.])
538             fi
539         fi
541 dnl Check for the termcap/termlib library.  These two checks must occur in the
542 dnl current order, and -lcurses must be loaded before -ltermcap/-ltermlib.
543 dnl On Solaris curses==termlib, but different versions of curses
544 dnl can be used. Avoid loading termlib is curses has tgetent.
545 AC_CHECK_LIB($vi_cv_curses, tgetent,
546         [vi_cv_curses_tgetent=yes], [vi_cv_curses_tgetent=no])
547 if test "$vi_cv_curses_tgetent" = no; then
548         AC_CHECK_LIB(termlib, tgetent,
549                 [vi_cv_termlib=-ltermlib], [vi_cv_termlib=no])
550         if test "$vi_cv_termlib" = no; then
551                 AC_CHECK_LIB(termcap, tgetent,
552                         [vi_cv_termlib=-ltermcap], [vi_cv_termlib=no])
553         fi
555 if test "$vi_cv_termlib" != no; then
556         CURSLIBS="$CURSLIBS $vi_cv_termlib"
559         LIBS="$SAVELIBS"
560         LDFLAGS="$SAVELDFLAGS"
561         CPPFLAGS="$SAVECPPFLAGS"
562 dnl     ])
564 dnl Checks for header files.
565 AC_MSG_CHECKING(for sys/mman.h)
566 AC_CACHE_VAL(vi_cv_include_sys_mman, [dnl
567 AC_TRY_CPP([#include <sys/mman.h>],
568         [vi_cv_include_sys_mman=yes], [vi_cv_include_sys_mman=no])])
569 if test "$vi_cv_include_sys_mman" = yes; then
570         AC_DEFINE(HAVE_SYS_MMAN_H)
572 AC_MSG_RESULT($vi_cv_include_sys_mman)
574 AC_MSG_CHECKING(for sys/select.h)
575 AC_CACHE_VAL(vi_cv_include_sys_select, [dnl
576 AC_TRY_CPP([#include <sys/select.h>],
577         [vi_cv_include_sys_select=yes], [vi_cv_include_sys_select=no])])
578 if test "$vi_cv_include_sys_select" = yes; then
579         AC_DEFINE(HAVE_SYS_SELECT_H)
581 AC_MSG_RESULT($vi_cv_include_sys_select)
583 dnl Checks for typedefs, structures, and compiler characteristics.
584 AC_CHECK_TYPE(ssize_t, int)
585 AC_C_BIGENDIAN
586 AC_C_CONST
587 AC_STRUCT_ST_BLKSIZE
588 AC_TYPE_MODE_T
589 AC_TYPE_OFF_T
590 AC_TYPE_PID_T
591 AC_TYPE_SIZE_T
592 AC_STRUCT_TM
594 dnl Checks for library functions.
595 VI_CV_REPLACE_FUNCS(bsearch gethostname memchr memset)
596 VI_CV_REPLACE_FUNCS(mkstemp mmap strdup strpbrk)
597 VI_CV_REPLACE_FUNCS(snprintf vsnprintf)
599 AC_CHECK_FUNCS(select)
600 AC_CHECK_FUNCS(setenv, [need_env=no], [need_env=yes])
601 AC_CHECK_FUNCS(strsep, [need_strsep=no], [need_strsep=yes])
602 AC_CHECK_FUNCS(unsetenv,, [need_env=yes])
604 AC_FUNC_MMAP
605 AC_FUNC_VFORK
607 dnl If we needed setenv or unsetenv, add in the clib/env.c replacement file.
608 if test "$need_env" = yes; then
609         LIBOBJS="env.o $LIBOBJS"
612 dnl If we need strsep, add it and define it so we get a prototype.
613 if test "$need_strsep" = yes; then
614         LIBOBJS="strsep.o $LIBOBJS"
617 dnl Check for fcntl/flock
618 dnl Use flock preferentially, since it has cleaner semantics and won't
619 dnl hang up the editor.
620 dnl XXX
621 dnl Ultrix has a broken fcntl, but a working flock.
622 dnl IRIX and DGUX have a broken flock, but working fcntl.
623 AC_MSG_CHECKING(for fcntl/flock)
624 AC_CACHE_VAL(vi_cv_lock, [dnl
625         vi_cv_lock=none
626         case "$host_os" in
627         dgux*);;
628         irix*);;
629         *)
630                 AC_TRY_LINK([#include <fcntl.h>], [flock(0, 0);],
631                     [vi_cv_lock=flock]);;
632         esac
633         if test "$vi_cv_lock" = none; then
634                 AC_TRY_LINK([#include <fcntl.h>], [fcntl(0, F_SETLK, 0);],
635                     [vi_cv_lock=fcntl])
636         fi])
638 if test "$vi_cv_lock" = flock; then
639         AC_DEFINE(HAVE_LOCK_FLOCK)
641 if test "$vi_cv_lock" = fcntl; then
642         AC_DEFINE(HAVE_LOCK_FCNTL)
644 AC_MSG_RESULT($vi_cv_lock)
646 dnl Check for ftruncate/chsize
647 AC_MSG_CHECKING(for ftruncate/chsize)
648 AC_CACHE_VAL(vi_cv_ftruncate, [dnl
649 AC_TRY_LINK([#include <unistd.h>], [ftruncate(0, 0);],
650         [vi_cv_ftruncate=ftruncate],
651 AC_TRY_LINK([#include <unistd.h>], [chsize(0, 0);],
652         [vi_cv_ftruncate=chsize], [vi_cv_ftruncate=no]))])
653 if test "$vi_cv_ftruncate" = ftruncate; then
654         AC_DEFINE(HAVE_FTRUNCATE_FTRUNCATE)
656 if test "$vi_cv_ftruncate" = chsize; then
657         AC_DEFINE(HAVE_FTRUNCATE_CHSIZE)
659 if test "$vi_cv_ftruncate" = no; then
660         AC_MSG_ERROR([No file truncation system call.])
662 AC_MSG_RESULT($vi_cv_ftruncate)
664 CSAVELIBS="$LIBS"
665 CSAVELDFLAGS="$LDFLAGS"
666 CSAVECPPFLAGS="$CPPFLAGS"
667 LIBS="$CURSLIBS $LIBS"
668 LDFLAGS="$CURSLDFLAGS $LDFLAGS"
669 CPPFLAGS="$CURSCPPFLAGS $CPPFLAGS"
670 dnl Check for the tigetstr/tigetnum functions.
671 AC_MSG_CHECKING(for tigetstr/tigetnum)
672 AC_CACHE_VAL(vi_cv_have_curses_tigetstr, [dnl
673 AC_TRY_LINK([#include <$CURSHEADER>], [tigetstr(0);],
674         [vi_cv_have_curses_tigetstr=yes],
675         [vi_cv_have_curses_tigetstr=no])])
676 if test "$vi_cv_have_curses_tigetstr" = yes; then
677         AC_DEFINE(HAVE_CURSES_TIGETSTR)
679 AC_MSG_RESULT($vi_cv_have_curses_tigetstr)
681 dnl Check for potentially missing curses functions in system or user-specified
682 dnl libraries.  We also have to guess at whether the specified library is a
683 dnl BSD or System V style curses.  Use the newterm function, all System V
684 dnl curses implementations have it, none, as far as I know, of the BSD ones do.
685 if test "$vi_cv_curses" = "bundled curses"; then
686         AC_DEFINE(HAVE_BSD_CURSES)
687         AC_DEFINE(HAVE_CURSES_WADDNSTR)
688         AC_DEFINE(HAVE_CURSES_IDLOK)
689 else
690         dnl Check for the waddnstr function.
691         AC_MSG_CHECKING(for waddnstr)
692         AC_CACHE_VAL(vi_cv_have_curses_waddnstr, [dnl
693         AC_TRY_LINK([#include <$CURSHEADER>], [waddnstr(stdscr, 0, 0);],
694                 [vi_cv_have_curses_waddnstr=yes],
695                 [vi_cv_have_curses_waddnstr=no])])
696         if test "$vi_cv_have_curses_waddnstr" = yes; then
697                 AC_DEFINE(HAVE_CURSES_WADDNSTR)
698         fi
699         AC_MSG_RESULT($vi_cv_have_curses_waddnstr)
701         dnl Check for the beep function.
702         AC_MSG_CHECKING(for beep)
703         AC_CACHE_VAL(vi_cv_have_curses_beep, [dnl
704         AC_TRY_LINK([#include <$CURSHEADER>], [beep();],
705                 [vi_cv_have_curses_beep=yes],
706                 [vi_cv_have_curses_beep=no])])
707         if test "$vi_cv_have_curses_beep" = yes; then
708                 AC_DEFINE(HAVE_CURSES_BEEP)
709         fi
710         AC_MSG_RESULT($vi_cv_have_curses_beep)
712         dnl Check for the flash function.
713         AC_MSG_CHECKING(for flash)
714         AC_CACHE_VAL(vi_cv_have_curses_flash, [dnl
715         AC_TRY_LINK([#include <$CURSHEADER>], [flash();],
716                 [vi_cv_have_curses_flash=yes],
717                 [vi_cv_have_curses_flash=no])])
718         if test "$vi_cv_have_curses_flash" = yes; then
719                 AC_DEFINE(HAVE_CURSES_FLASH)
720         fi
721         AC_MSG_RESULT($vi_cv_have_curses_flash)
723         dnl Check for the idlok function.
724         AC_MSG_CHECKING(for idlok)
725         AC_CACHE_VAL(vi_cv_have_curses_idlok, [dnl
726         AC_TRY_LINK([#include <$CURSHEADER>], [idlok(0, 0);],
727                 [vi_cv_have_curses_idlok=yes],
728                 [vi_cv_have_curses_idlok=no])])
729         if test "$vi_cv_have_curses_idlok" = yes; then
730                 AC_DEFINE(HAVE_CURSES_IDLOK)
731         fi
732         AC_MSG_RESULT($vi_cv_have_curses_idlok)
734         dnl Check for the keypad function.
735         AC_MSG_CHECKING(for keypad)
736         AC_CACHE_VAL(vi_cv_have_curses_keypad, [dnl
737         AC_TRY_LINK([#include <$CURSHEADER>], [keypad(0, 0);],
738                 [vi_cv_have_curses_keypad=yes],
739                 [vi_cv_have_curses_keypad=no])])
740         if test "$vi_cv_have_curses_keypad" = yes; then
741                 AC_DEFINE(HAVE_CURSES_KEYPAD)
742         fi
743         AC_MSG_RESULT($vi_cv_have_curses_keypad)
745         dnl Check for the newterm function.
746         AC_MSG_CHECKING(for newterm)
747         AC_CACHE_VAL(vi_cv_have_curses_newterm, [dnl
748         AC_TRY_LINK([#include <$CURSHEADER>], [newterm(0, 0, 0);],
749                 [vi_cv_have_curses_newterm=yes],
750                 [vi_cv_have_curses_newterm=no])])
751         if test "$vi_cv_have_curses_newterm" = yes; then
752                 AC_DEFINE(HAVE_CURSES_NEWTERM)
753         fi
754         AC_MSG_RESULT($vi_cv_have_curses_newterm)
756         if test "$vi_cv_have_curses_newterm" = no; then
757                 AC_DEFINE(HAVE_BSD_CURSES)
758         fi
761 dnl Check for the setupterm function.  We make this check regardless of
762 dnl using the system library, because it may be part of the underlying
763 dnl termcap/termlib support, and we want to use the local one.
764 AC_MSG_CHECKING(for setupterm)
765 AC_CACHE_VAL(vi_cv_have_curses_setupterm, [dnl
766 AC_TRY_LINK([#include <$CURSHEADER>], [setupterm(0, 0, 0);],
767         [vi_cv_have_curses_setupterm=yes],
768         [vi_cv_have_curses_setupterm=no])])
769 if test "$vi_cv_have_curses_setupterm" = yes; then
770         AC_DEFINE(HAVE_CURSES_SETUPTERM)
772 AC_MSG_RESULT($vi_cv_have_curses_setupterm)
773 LIBS="$CSAVELIBS"
774 LDFLAGS="$CSAVELDFLAGS"
775 CPPFLAGS="$CSAVECPPFLAGS"
777 dnl Some moron decided to drop off an argument from the gettimeofday call,
778 dnl without changing the name.
779 AC_MSG_CHECKING(for broken gettimeofday system call)
780 AC_CACHE_VAL(vi_cv_gettimeofday, [dnl
781 AC_TRY_LINK([#include <sys/types.h>
782 #include <sys/time.h>], [gettimeofday(0, 0);],
783         [vi_cv_gettimeofday=okay], [vi_cv_gettimeofday=broken])])
784 if test "$vi_cv_gettimeofday" = broken; then
785         AC_DEFINE(HAVE_BROKEN_GETTIMEOFDAY)
787 AC_MSG_RESULT($vi_cv_gettimeofday)
789 dnl Check for which version of openpty to use, System V or Berkeley.
790 AC_MSG_CHECKING(for System V pty calls)
791 AC_CACHE_VAL(vi_cv_sys5_pty, [dnl
792 AC_TRY_LINK(, [grantpt(0);],
793         [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])])
794 if test "$vi_cv_sys5_pty" = yes; then
795         AC_DEFINE(HAVE_SYS5_PTY)
797 AC_MSG_RESULT($vi_cv_sys5_pty)
799 dnl Check for the revoke system call.
800 AC_MSG_CHECKING(for revoke system call)
801 AC_CACHE_VAL(vi_cv_revoke, [dnl
802 AC_TRY_LINK(, [revoke("a");],
803         [vi_cv_revoke=yes], [vi_cv_revoke=no])])
804 if test "$vi_cv_revoke" = yes; then
805         AC_DEFINE(HAVE_REVOKE)
807 AC_MSG_RESULT($vi_cv_revoke)
809 dnl Some versions of sprintf return a pointer to the first argument instead
810 dnl of a character count.  We assume that the return value of snprintf and
811 dnl vsprintf etc. will be the same as sprintf, and check the easy one.
812 AC_MSG_CHECKING(for int type sprintf return value)
813 AC_CACHE_VAL(vi_cv_sprintf_count, [dnl
814 AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}],
815         [vi_cv_sprintf_count=yes], [vi_cv_sprintf_count=no])])
816 if test "$vi_cv_sprintf_count" = no; then
817         AC_DEFINE(SPRINTF_RET_CHARPNT)
819 AC_MSG_RESULT($vi_cv_sprintf_count)
822 dnl Check for the standard shorthand types.
823 AC_SUBST(u_char_decl)
824 AC_CACHE_CHECK([for u_char], vi_cv_uchar, [dnl
825 AC_TRY_COMPILE([#include <sys/types.h>], u_char foo;,
826         [vi_cv_uchar=yes], [vi_cv_uchar=no])])
827 if test "$vi_cv_uchar" = no; then
828         u_char_decl="typedef unsigned char u_char;"
831 AC_SUBST(u_short_decl)
832 AC_CACHE_CHECK([for u_short], vi_cv_ushort, [dnl
833 AC_TRY_COMPILE([#include <sys/types.h>], u_short foo;,
834         [vi_cv_ushort=yes], [vi_cv_ushort=no])])
835 if test "$vi_cv_ushort" = no; then
836         u_short_decl="typedef unsigned short u_short;"
839 AC_SUBST(u_int_decl)
840 AC_CACHE_CHECK([for u_int], vi_cv_uint, [dnl
841 AC_TRY_COMPILE([#include <sys/types.h>], u_int foo;,
842         [vi_cv_uint=yes], [vi_cv_uint=no])])
843 if test "$vi_cv_uint" = no; then
844         u_int_decl="typedef unsigned int u_int;"
847 AC_SUBST(u_long_decl)
848 AC_CACHE_CHECK([for u_long], vi_cv_ulong, [dnl
849 AC_TRY_COMPILE([#include <sys/types.h>], u_long foo;,
850         [vi_cv_ulong=yes], [vi_cv_ulong=no])])
851 if test "$vi_cv_ulong" = no; then
852         u_long_decl="typedef unsigned long u_long;"
855 dnl DB/Vi use specific integer sizes.
856 AC_SUBST(u_int8_decl)
857 AC_CACHE_CHECK([for u_int8_t], vi_cv_uint8, [dnl
858 AC_TRY_COMPILE([#include <sys/types.h>], u_int8_t foo;,
859         [vi_cv_uint8=yes],
860         AC_TRY_RUN([main(){exit(sizeof(unsigned char) != 1);}],
861             [vi_cv_uint8="unsigned char"], [vi_cv_uint8=no]))])
862 if test "$vi_cv_uint8" = no; then
863         AC_MSG_ERROR(No unsigned 8-bit integral type.)
865 if test "$vi_cv_uint8" != yes; then
866         u_int8_decl="typedef $vi_cv_uint8 u_int8_t;"
869 AC_SUBST(u_int16_decl)
870 AC_CACHE_CHECK([for u_int16_t], vi_cv_uint16, [dnl
871 AC_TRY_COMPILE([#include <sys/types.h>], u_int16_t foo;,
872         [vi_cv_uint16=yes],
873 AC_TRY_RUN([main(){exit(sizeof(unsigned short) != 2);}],
874         [vi_cv_uint16="unsigned short"],
875 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 2);}],
876         [vi_cv_uint16="unsigned int"], [vi_cv_uint16=no])))])
877 if test "$vi_cv_uint16" = no; then
878         AC_MSG_ERROR([No unsigned 16-bit integral type.])
880 if test "$vi_cv_uint16" != yes; then
881         u_int16_decl="typedef $vi_cv_uint16 u_int16_t;"
884 AC_SUBST(int16_decl)
885 AC_CACHE_CHECK([for int16_t], vi_cv_int16, [dnl
886 AC_TRY_COMPILE([#include <sys/types.h>], int16_t foo;,
887         [vi_cv_int16=yes],
888 AC_TRY_RUN([main(){exit(sizeof(short) != 2);}],
889         [vi_cv_int16="short"],
890 AC_TRY_RUN([main(){exit(sizeof(int) != 2);}],
891         [vi_cv_int16="int"], [vi_cv_int16=no])))])
892 if test "$vi_cv_int16" = no; then
893         AC_MSG_ERROR([No signed 16-bit integral type.])
895 if test "$vi_cv_int16" != yes; then
896         int16_decl="typedef $vi_cv_int16 int16_t;"
899 AC_SUBST(u_int32_decl)
900 AC_CACHE_CHECK([for u_int32_t], vi_cv_uint32, [dnl
901 AC_TRY_COMPILE([#include <sys/types.h>], u_int32_t foo;,
902         [vi_cv_uint32=yes],
903 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}],
904         [vi_cv_uint32="unsigned int"],
905 AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}],
906         [vi_cv_uint32="unsigned long"], [vi_cv_uint32=no])))])
907 if test "$vi_cv_uint32" = no; then
908         AC_MSG_ERROR([No unsigned 32-bit integral type.])
910 if test "$vi_cv_uint32" != yes; then
911         u_int32_decl="typedef $vi_cv_uint32 u_int32_t;"
914 AC_SUBST(int32_decl)
915 AC_CACHE_CHECK([for int32_t], vi_cv_int32, [dnl
916 AC_TRY_COMPILE([#include <sys/types.h>], int32_t foo;,
917         [vi_cv_int32=yes],
918 AC_TRY_RUN([main(){exit(sizeof(int) != 4);}],
919         [vi_cv_int32="int"],
920 AC_TRY_RUN([main(){exit(sizeof(long) != 4);}],
921         [vi_cv_int32="long"], [vi_cv_int32=no])))])
922 if test "$vi_cv_int32" = no; then
923         AC_MSG_ERROR([No signed 32-bit integral type.])
925 if test "$vi_cv_int32" != yes; then
926         int32_decl="typedef $vi_cv_int32 int32_t;"
929 AC_CACHE_CHECK([return type of fprintf], vi_cv_type_fprintf,
930 [AC_TRY_COMPILE([#include <stdio.h>
931 int fprintf ();
932 ],[int i;], vi_cv_type_fprintf=int, vi_cv_type_fprintf=void)])
934 AC_SUBST(NEED_FPRINTF_PROTO)
935 AC_CACHE_CHECK([fprintf prototype needed], vi_cv_proto_fprintf,
936 [AC_TRY_COMPILE([ #include <stdio.h>
937 typedef int     (*funcPtr)();
938 ],[funcPtr ptr = (funcPtr) fprintf;], 
939 vi_cv_proto_fprintf=no, 
940 [vi_cv_proto_fprintf=yes])])
941 if test "$vi_cv_proto_fprintf" = yes; then
942         AC_DEFINE(NEED_FPRINTF_PROTO)
945 AC_ARG_WITH(db_type,
946         [  --with-db=bundled|system Which db to use. ])
947 case "$with_db_type" in
948 "db1")
949         AC_MSG_WARN([Use of db1 is not officially supported.])
950         AC_DEFINE(USE_DB1)
951         ;;
952 "system")
953         ;;
955         with_db_type="bundled"
956         ;;
957 esac
959 dnl Check for DB 3
960 AC_ARG_WITH(db_prefix,
961         [  --with-db-prefix=PFX    Path to db installation. ])
963 SAVELDFLAGS="$LDFLAGS"
964 if test "x$with_db_prefix" != "x"; then
965         LDFLAGS="-L$with_db_prefix/lib $LDFLAGS"
966         CPPFLAGS="-I$with_db_prefix/include $CPPFLAGS"
968 if test "$with_db_type" != db1; then
969         SAVELIBS="$LIBS"
971         LIBS="$LIBS -ldb"
972         AC_TRY_LINK([#include <db.h>],
973                 [db_create(NULL,NULL,0)],
974                 [vi_cv_dbfatal="no"], [vi_cv_dbfatal="yes"])
975         if test "$vi_cv_dbfatal" = "yes"; then
976                 AC_MSG_ERROR([Need DB 3.])
977         fi
979         LIBS="$SAVELIBS"
981 LDFLAGS="$SAVELDFLAGS"
983 AC_SUBST(dl_src)
984 AC_MSG_CHECKING(if --enable-dynamic-loading option specified)
985 AC_ARG_ENABLE(dynamic-loading,
986         [  --enable-dynamic-loading Load DB 3 dynamically.],
987         [vi_cv_dl=$enableval], [vi_cv_dl="no"])
988 AC_MSG_RESULT($vi_cv_dl)
989 if test "$vi_cv_dl" = yes; then
990         AC_CHECK_LIB(dl, dlopen,
991                 [vi_cv_dlfatal="no"], [vi_cv_dlfatal="yes"])
992         if test "$vi_cv_dlfatal" = "yes"; then
993                 AC_MSG_ERROR([Need dl to support dynamic loading.])
994         fi
995         OLDPATH="$PATH"
997         PATH="$with_db_prefix/lib:/usr/lib:/lib"
998         AC_PATH_PROG(vi_cv_path_db3, libdb-3.so, no)
999         if test "$vi_cv_path_db3" = no; then
1000                 AC_MSG_ERROR([Path of libdb-3.so not found.])
1001         fi
1002         PATH="$OLDPATH"
1004         AC_DEFINE(USE_DYNAMIC_LOADING)
1005         LIBOBJS="dldb.o $LIBOBJS"
1006         dl_src=../common/dldb.c
1007         LIBS="-ldl $LIBS"
1008 else
1009         LIBS="-ldb $LIBS"
1010         if test "X$with_db_prefix" != "X"; then
1011                 LDFLAGS="`echo $with_db_prefix/lib | sed "$LRscript"` $LDFLAGS"
1012         fi
1015 AC_ARG_WITH(db_build,
1016         [  --with-db-build=prefix  Path to db build. ])
1017 if test "x$with_db_build" != "x"; then
1018         vi_cv_dbsrc=`$AWK '/^srcdir/ {gsub("srcdir[[ \t]]*=","");print $1}' \
1019                      $with_db_build/Makefile`
1020         case $with_db_build in
1021         *[[\\/]]);;
1022         *)
1023             with_db_build="$with_db_build/";;
1024         esac
1025         case $vi_cv_dbsrc in
1026         [[\\/]]*);;
1027         *)
1028             vi_cv_dbsrc="$with_db_build$vi_cv_dbsrc";;
1029         esac
1032 vi_cv_db4="no"
1033 if test "x$vi_cv_dbsrc" != "x"; then
1034         AC_MSG_CHECKING(for DB 4)
1035         AC_EGREP_CPP([^4],
1036                 [#include <db.h>
1037 DB_VERSION_MAJOR],
1038                 [vi_cv_db4="yes"], [vi_cv_db4="no"])
1039         AC_MSG_RESULT($vi_cv_db4)
1041 if test "$vi_cv_db4" = "yes"; then
1042         CPPFLAGS="-I$vi_cv_dbsrc/include $CPPFLAGS"
1043         CPPFLAGS="-I$vi_cv_dbsrc/include_auto $CPPFLAGS"
1044         CPPFLAGS="-I$with_db_build $CPPFLAGS"
1045         AC_DEFINE(USE_DB4_LOGGING)
1046         LIBOBJS="log4.o vi_auto.o vi_rec.o $LIBOBJS"
1047 else
1048         LIBOBJS="log.o $LIBOBJS"
1051 dnl We compile in nvi's RE routines unless the user specifies otherwise.
1052 AC_MSG_CHECKING(if --disable-re option specified)
1053 AC_ARG_ENABLE(re,
1054         [  --disable-re            DON'T use the nvi-provided RE routines.],
1055         [if test "$enable_re" = "yes"; then
1056                 vi_cv_re_lib="bundled RE"
1057         else
1058                 vi_cv_re_lib="other RE"
1059         fi],[vi_cv_re_lib="bundled RE"])
1060 AC_MSG_RESULT($vi_cv_re_lib)
1061 case "$vi_cv_re_lib" in
1062 "bundled RE")
1063         CPPFLAGS="-I\$(visrcdir)/regex $CPPFLAGS"
1064         LIBOBJS="regcomp.o regerror.o regexec.o regfree.o $LIBOBJS";;
1065 "other RE")
1066         ;;
1067 esac
1069 AC_OUTPUT(Makefile port.h:port.h.in
1070     pathnames.h:pathnames.h.in recover:recover.in)