1 dnl @(#)configure.in 8.134 (Berkeley) 10/15/96
3 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT(../common/main.c)
5 AC_CONFIG_HEADER(config.h)
12 dnl If the user wants a debugging environment, set OPTFLAG now. (Some
13 dnl compilers won't mix optimizing and debug flags.)
14 AC_MSG_CHECKING(if --enable-debug option specified)
16 [ --enable-debug Build a debugging version.],
17 [vi_cv_debug="yes"], [vi_cv_debug="no"])
18 if test "$vi_cv_debug" = yes; then
20 OPTFLAG=${OPTFLAG-"-g"}
21 no_op_OPTFLAG=${no_op_OPTFLAG-"-g"}
23 AC_MSG_RESULT($vi_cv_debug)
25 dnl This is where we handle stuff that autoconf can't handle.
27 dnl Don't override anything if it's already set from the environment.
29 dnl Compiler, preprocessor and load flags.
30 dnl AUX: -ZP disables _BSD_SOURCE et al, but enables POSIX at link time.
31 dnl LynxOS: We check for gcc 2.x or better, the gcc 1 that was shipped with
32 dnl LynxOS historically wasn't good enough.
35 aix3.2.5) OPTFLAG=${OPTFLAG-"-O"};;
36 aix4.1*) CFLAGS=${CFLAGS-"-qstrict"}
37 OPTFLAG=${OPTFLAG-"-O3"};;
38 aux*) CPPFLAGS=${CPPFLAGS-"-ZP -D_BSD_SOURCE -D_SYSV_SOURCE -D_AUX_SOURCE"}
39 LDFLAGS=${LDFLAGS-"-ZP"}
40 OPTFLAG=${OPTFLAG-"-O"};;
41 bsd4.4) OPTFLAG=${OPTFLAG-"-O2"};;
42 bsdi*) CC=${CC-"shlicc"}
43 OPTFLAG=${OPTFLAG-"-O2"};;
44 irix6*) OPTFLAG=${OPTFLAG-"-O2"};;
45 irix*) OPTFLAG=${OPTFLAG-"-O2"};;
47 AC_MSG_CHECKING([for GNU C (gcc) version 2.x])
48 ac_cv_gcc_vers=`${CC-cc} -v 2>&1 | \
49 grep "gcc version " | sed 's/.*version //'`
50 ac_cv_gcc_major=`echo "$ac_cv_gcc_vers" | sed 's/\..*//'`
51 if test "$ac_cv_gcc_major" = "2" ; then
55 echo "Fatal error: Nvi requires gcc 2.x to build on LynxOS."
56 echo "See build/README.LynxOS for more information."
59 nextstep3) CPPFLAGS=${CPPFLAGS-"-w -pipe -posix"}
60 LDFLAGS=${LDFLAGS-"-posix"}
61 OPTFLAG=${OPTFLAG-"-O9"};;
62 osf*) CFLAGS=${CFLAGS-"-Olimit 1000"};;
63 solaris*) no_op_OPTFLAG=${no_op_OPTFLAG-""};;
64 sunos*) no_op_OPTFLAG=${no_op_OPTFLAG-""};;
67 dnl The default compiler is cc.
71 dnl The default OPTFLAG is -O
73 OPTFLAG=${OPTFLAG-"-O"}
75 dnl The SunOS/Solaris compiler can't optimize vi/v_txt.c; the symptom is
76 dnl that the command 35i==<esc> turns into an infinite loop.
77 AC_SUBST(no_op_OPTFLAG)
78 no_op_OPTFLAG=${no_op_OPTFLAG-"$OPTFLAG"}
82 bsdi2.1) LIBS=${LIBS-"-lipc"};;
83 dgux*) LIBS=${LIBS-"-ldgc"};;
84 irix6*) LIBS=${LIBS-"-lbsd"};;
85 irix*) LIBS=${LIBS-"-lc_s -lbsd"};;
86 isc*) LIBS=${LIBS-"-lcposix -linet"};;
87 netbsd1*) LIBS=${LIBS-"-lcrypt"};;
88 ptx*) LIBS=${LIBS-"-lseq -linet -lsocket"};;
89 sco3.2*) LIBS=${LIBS-"-lsocket"};;
90 sinix*) LIBS=${LIBS-"-lelf -lc"};;
91 solaris*) LIBS=${LIBS-"-lsocket -lnsl -ldl"}
93 wgs*) LIBS=${LIBS-"-lnsl"};;
96 dnl A/UX has a broken getopt(3), strpbrk(3).
98 aux*) LIBOBJS="getopt.o strpbrk.o $LIBOBJS";;
101 dnl Ultrix has a broken POSIX.1 VDISABLE value.
103 ultrix*) AC_DEFINE(HAVE_BROKEN_VDISABLE);;
106 dnl The user may have additional CPP information.
107 CPPFLAGS="$ADDCPPFLAGS $CPPFLAGS"
109 dnl The user may have additional load line information.
110 LDFLAGS="$ADDLDFLAGS $LDFLAGS"
112 dnl The user may have additional library information.
113 LIBS="$ADDLIBS $LIBS"
115 dnl Check to see if it's going to work.
118 dnl Checks for programs.
119 PATH="$PATH:/usr/bin:/usr/sbin:/sbin:/etc:/usr/etc:/usr/lib:/usr/ucblib:"
121 dnl Check for the shell path.
122 AC_PATH_PROG(vi_cv_path_shell, sh, no)
123 if test "$vi_cv_path_shell" = no; then
124 echo "Fatal error: the shell utility not found."
128 dnl Check for the sendmail path.
129 AC_PATH_PROG(vi_cv_path_sendmail, sendmail, no)
130 if test "$vi_cv_path_sendmail" = no; then
131 echo "WARNING: The sendmail utility was not found!"
132 echo "WARNING: Users will not be told of saved files."
135 dnl Check for the perl5/perl path.
136 AC_SUBST(vi_cv_path_perl)
137 AC_PATH_PROGS(vi_cv_path_perl, perl5 perl, no)
139 dnl Check for the "preserve" path.
140 dnl Historically, nvi has used /var/tmp/vi.recover. The Linux filesystem
141 dnl standard (FSSTND) uses /var/preserve; we add the vi.recover directory
142 dnl beneath it so that we don't have name collisions with other editors.
143 dnl Other systems have /var/preserve as well, so we test first for an already
144 dnl existing name, and then use the first one that's writeable.
145 AC_SUBST(vi_cv_path_preserve)
146 AC_MSG_CHECKING(for preserve directory)
147 AC_CACHE_VAL(vi_cv_path_preserve, [dnl
148 dirlist="/var/preserve /var/tmp /usr/tmp"
149 vi_cv_path_preserve=no
150 for i in $dirlist; do
151 if test -d $i/vi.recover; then
152 vi_cv_path_preserve=$i/vi.recover
156 if test "$vi_cv_path_preserve" = no; then
157 for i in $dirlist; do
158 if test -d $i -a -w $i; then
159 vi_cv_path_preserve=$i/vi.recover
165 if test "$vi_cv_path_preserve" = no; then
166 echo "Fatal error: no writeable preserve directory found."
169 AC_MSG_RESULT($vi_cv_path_preserve)
171 dnl Check for programs used for installation
172 AC_PATH_PROG(vi_cv_path_chmod, chmod, missing_chmod)
173 AC_PATH_PROG(vi_cv_path_cp, cp, missing_cp)
174 AC_PATH_PROG(vi_cv_path_ln, ln, missing_ln)
175 AC_PATH_PROG(vi_cv_path_mkdir, mkdir, missing_mkdir)
176 AC_PATH_PROG(vi_cv_path_rm, rm, missing_rm)
177 AC_PATH_PROG(vi_cv_path_strip, strip, missing_strip)
179 dnl Checks for libraries.
180 dnl Find the X libraries and includes.
183 if test "$no_x" != yes; then
184 if test "X$x_libraries" != "X"; then
185 if test "X$RLIBS" = "Xyes"; then
186 XLIBS="-R$x_libraries -L$x_libraries $XLIBS"
188 XLIBS="-L$x_libraries $XLIBS"
192 if test "X$x_includes" != "X"; then
193 XINCS="-I$x_includes"
197 dnl If the user wants a Perl interpreter in nvi, load it.
199 AC_SUBST(vi_cv_perllib)
200 AC_MSG_CHECKING(if --enable-perlinterp option specified)
201 AC_ARG_ENABLE(perlinterp,
202 [ --enable-perlinterp Include a Perl interpreter in vi.],
203 [vi_cv_perlinterp="yes"], [vi_cv_perlinterp="no"])
204 AC_MSG_RESULT($vi_cv_perlinterp)
205 if test "$vi_cv_perlinterp" = "yes"; then
206 if test "$vi_cv_path_perl" = no; then
207 echo "Fatal error: no perl5 utility found."
210 $vi_cv_path_perl -e 'require 5.002' || {
211 echo "Fatal error: perl5 must be version 5.002 or later."
214 $vi_cv_path_perl -e 'close(STDERR);require 5.003_01' &&
215 AC_DEFINE(HAVE_PERL_5_003_01)
217 eval `$vi_cv_path_perl -V:shrpenv`
218 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
221 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlib}'`
222 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
223 -e 'ccflags;perl_inc'`
224 if test "X$perlcppflags" != "X"; then
225 CPPFLAGS="$perlcppflags $CPPFLAGS"
227 perllibs=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
229 if test "X$perllibs" != "X"; then
230 LIBS="$perllibs $LIBS"
232 perlldflags=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
234 if test "X$perlldflags" != "X"; then
235 LDFLAGS="$perlldflags $LDFLAGS"
237 LIBOBJS="perl.o perlsfio.o $LIBOBJS"
238 AC_DEFINE(HAVE_PERL_INTERP)
241 dnl If the user wants a Tk/Tcl front-end for nvi, build it.
244 AC_MSG_CHECKING(if --enable-tknvi option specified)
246 [ --enable-tknvi Build a Tk/Tcl front-end for vi.],
247 [vi_cv_tknvi="yes"], [vi_cv_tknvi="no"])
248 AC_MSG_RESULT($vi_cv_tknvi)
249 if test "$vi_cv_tknvi" = "yes"; then
251 TKLIBS="-ltk -ltcl -lm $XLIBS $LIBS"
254 dnl If the user wants a Tk/Tcl interpreter in nvi, load it.
255 AC_MSG_CHECKING(if --enable-tclinterp option specified)
256 AC_ARG_ENABLE(tclinterp,
257 [ --enable-tclinterp Include a Tk/Tcl interpreter in vi.],
258 [vi_cv_tclinterp="yes"], [vi_cv_tclinterp="no"])
259 AC_MSG_RESULT($vi_cv_tclinterp)
260 if test "$vi_cv_tclinterp" = "yes"; then
261 LIBOBJS="tcl.o $LIBOBJS"
262 LIBS="-ltk -ltcl -lm $XLIBS $LIBS"
263 AC_DEFINE(HAVE_TCL_INTERP)
266 dnl Make sure that we can find a Tk/Tcl library.
267 if test "$vi_cv_tknvi" = "yes" || test "$vi_cv_tclinterp" = "yes"; then
268 AC_CHECK_LIB(tcl, main,
269 [vi_cv_tkfatal="no"], [vi_cv_tkfatal="yes"], -ltk -lm)
270 if test "$vi_cv_tkfatal" = "yes"; then
271 echo "Fatal error: no Tk/Tcl library; see the section"
272 echo "ADDING LIBRARIES AND INCLUDE FILES in the README file."
277 dnl Both Tcl/Tk and Perl interpreters need the vi api code.
278 if test "$vi_cv_tclinterp" = yes || test "$vi_cv_perlinterp" = yes; then
279 LIBOBJS="api.o $LIBOBJS"
282 dnl Check for the termcap/termlib library. Compile in nvi's curses routines
283 dnl unless the user specifies otherwise. These two checks must occur in the
284 dnl current order, and -lcurses must be loaded before -ltermcap/-ltermlib.
285 AC_CHECK_LIB(termlib, tgetent,
286 [vi_cv_termlib=-ltermlib], [vi_cv_termlib=no])
287 if test "$vi_cv_termlib" = no; then
288 AC_CHECK_LIB(termcap, tgetent,
289 [vi_cv_termlib=-ltermcap], [vi_cv_termlib=no])
291 if test "$vi_cv_termlib" != no; then
292 LIBS="$vi_cv_termlib $LIBS"
295 AC_MSG_CHECKING(if --disable-curses option specified)
296 AC_ARG_ENABLE(curses,
297 [ --disable-curses DON'T use the nvi-provided curses routines.],
298 [vi_cv_curses="other curses"], [vi_cv_curses="bundled curses"])
299 AC_MSG_RESULT($vi_cv_curses)
300 case "$vi_cv_curses" in
302 CPPFLAGS="-I\$(srcdir)/curses $CPPFLAGS"
305 LIBS="-lcurses $LIBS";;
308 dnl Checks for header files.
309 AC_MSG_CHECKING(for sys/mman.h)
310 AC_CACHE_VAL(vi_cv_include_sys_mman, [dnl
311 AC_TRY_CPP([#include <sys/mman.h>],
312 [vi_cv_include_sys_mman=yes], [vi_cv_include_sys_mman=no])])
313 if test "$vi_cv_include_sys_mman" = yes; then
314 AC_DEFINE(HAVE_SYS_MMAN_H)
316 AC_MSG_RESULT($vi_cv_include_sys_mman)
318 AC_MSG_CHECKING(for sys/select.h)
319 AC_CACHE_VAL(vi_cv_include_sys_select, [dnl
320 AC_TRY_CPP([#include <sys/select.h>],
321 [vi_cv_include_sys_select=yes], [vi_cv_include_sys_select=no])])
322 if test "$vi_cv_include_sys_select" = yes; then
323 AC_DEFINE(HAVE_SYS_SELECT_H)
325 AC_MSG_RESULT($vi_cv_include_sys_select)
327 dnl Checks for typedefs, structures, and compiler characteristics.
328 AC_CHECK_TYPE(ssize_t, int)
338 dnl Checks for library functions.
339 AC_CHECK_FUNCS(bsearch gethostname getopt memchr memcpy memmove memset)
340 AC_REPLACE_FUNCS(bsearch gethostname getopt memchr memcpy memmove memset)
341 AC_CHECK_FUNCS(mkstemp mmap snprintf strdup strerror strpbrk strtol)
342 AC_REPLACE_FUNCS(mkstemp mmap snprintf strdup strerror strpbrk strtol)
343 AC_CHECK_FUNCS(strtoul vsnprintf)
344 AC_REPLACE_FUNCS(strtoul vsnprintf)
346 AC_CHECK_FUNCS(select)
347 AC_CHECK_FUNCS(setenv, [need_env=no], [need_env=yes])
348 AC_CHECK_FUNCS(strsep, [need_strsep=no], [need_strsep=yes])
349 AC_CHECK_FUNCS(unsetenv,, [need_env=yes])
354 dnl If we needed setenv or unsetenv, add in the clib/env.c replacement file.
355 if test "$need_env" = yes; then
356 LIBOBJS="env.o $LIBOBJS"
359 dnl If we need strsep, add it and define it so we get a prototype.
360 if test "$need_strsep" = yes; then
361 LIBOBJS="strsep.o $LIBOBJS"
364 dnl Check for fcntl/flock
365 dnl Use flock preferentially, since it has cleaner semantics and won't
366 dnl hang up the editor.
368 dnl Ultrix has a broken fcntl, but a working flock.
369 dnl IRIX and DGUX have a broken flock, but working fcntl.
370 AC_MSG_CHECKING(for fcntl/flock)
371 AC_CACHE_VAL(vi_cv_lock, [dnl
377 AC_TRY_LINK([#include <fcntl.h>], [flock(0, 0);],
378 [vi_cv_lock=flock]);;
380 if test "$vi_cv_lock" = none; then
381 AC_TRY_LINK([#include <fcntl.h>], [fcntl(0, F_SETLK, 0);],
385 if test "$vi_cv_lock" = flock; then
386 AC_DEFINE(HAVE_LOCK_FLOCK)
388 if test "$vi_cv_lock" = fcntl; then
389 AC_DEFINE(HAVE_LOCK_FCNTL)
391 AC_MSG_RESULT($vi_cv_lock)
393 dnl Check for ftruncate/chsize
394 AC_MSG_CHECKING(for ftruncate/chsize)
395 AC_CACHE_VAL(vi_cv_ftruncate, [dnl
396 AC_TRY_LINK([#include <unistd.h>], [ftruncate(0, 0);],
397 [vi_cv_ftruncate=ftruncate],
398 AC_TRY_LINK([#include <unistd.h>], [chsize(0, 0);],
399 [vi_cv_ftruncate=chsize], [vi_cv_ftruncate=no]))])
400 if test "$vi_cv_ftruncate" = ftruncate; then
401 AC_DEFINE(HAVE_FTRUNCATE_FTRUNCATE)
403 if test "$vi_cv_ftruncate" = chsize; then
404 AC_DEFINE(HAVE_FTRUNCATE_CHSIZE)
406 if test "$vi_cv_ftruncate" = no; then
408 echo "Fatal error: no file truncation system call."
411 AC_MSG_RESULT($vi_cv_ftruncate)
413 dnl Check for the tigetstr/tigetnum functions.
414 AC_MSG_CHECKING(for tigetstr/tigetnum)
415 AC_CACHE_VAL(vi_cv_have_curses_tigetstr, [dnl
416 AC_TRY_LINK([#include <curses.h>], [tigetstr(0);],
417 [vi_cv_have_curses_tigetstr=yes],
418 [vi_cv_have_curses_tigetstr=no])])
419 if test "$vi_cv_have_curses_tigetstr" = yes; then
420 AC_DEFINE(HAVE_CURSES_TIGETSTR)
422 AC_MSG_RESULT($vi_cv_have_curses_tigetstr)
424 dnl Check for potentially missing curses functions in system or user-specified
425 dnl libraries. We also have to guess at whether the specified library is a
426 dnl BSD or System V style curses. Use the newterm function, all System V
427 dnl curses implementations have it, none, as far as I know, of the BSD ones do.
428 if test "$vi_cv_curses" = "bundled curses"; then
429 AC_DEFINE(HAVE_BSD_CURSES)
430 AC_DEFINE(HAVE_CURSES_ADDNSTR)
431 AC_DEFINE(HAVE_CURSES_IDLOK)
433 dnl Check for the addnstr function.
434 AC_MSG_CHECKING(for addnstr)
435 AC_CACHE_VAL(vi_cv_have_curses_addnstr, [dnl
436 AC_TRY_LINK([#include <curses.h>], [addnstr(0, 0);],
437 [vi_cv_have_curses_addnstr=yes],
438 [vi_cv_have_curses_addnstr=no])])
439 if test "$vi_cv_have_curses_addnstr" = yes; then
440 AC_DEFINE(HAVE_CURSES_ADDNSTR)
442 AC_MSG_RESULT($vi_cv_have_curses_addnstr)
444 dnl Check for the beep function.
445 AC_MSG_CHECKING(for beep)
446 AC_CACHE_VAL(vi_cv_have_curses_beep, [dnl
447 AC_TRY_LINK([#include <curses.h>], [beep();],
448 [vi_cv_have_curses_beep=yes],
449 [vi_cv_have_curses_beep=no])])
450 if test "$vi_cv_have_curses_beep" = yes; then
451 AC_DEFINE(HAVE_CURSES_BEEP)
453 AC_MSG_RESULT($vi_cv_have_curses_beep)
455 dnl Check for the flash function.
456 AC_MSG_CHECKING(for flash)
457 AC_CACHE_VAL(vi_cv_have_curses_flash, [dnl
458 AC_TRY_LINK([#include <curses.h>], [flash();],
459 [vi_cv_have_curses_flash=yes],
460 [vi_cv_have_curses_flash=no])])
461 if test "$vi_cv_have_curses_flash" = yes; then
462 AC_DEFINE(HAVE_CURSES_FLASH)
464 AC_MSG_RESULT($vi_cv_have_curses_flash)
466 dnl Check for the idlok function.
467 AC_MSG_CHECKING(for idlok)
468 AC_CACHE_VAL(vi_cv_have_curses_idlok, [dnl
469 AC_TRY_LINK([#include <curses.h>], [idlok(0, 0);],
470 [vi_cv_have_curses_idlok=yes],
471 [vi_cv_have_curses_idlok=no])])
472 if test "$vi_cv_have_curses_idlok" = yes; then
473 AC_DEFINE(HAVE_CURSES_IDLOK)
475 AC_MSG_RESULT($vi_cv_have_curses_idlok)
477 dnl Check for the keypad function.
478 AC_MSG_CHECKING(for keypad)
479 AC_CACHE_VAL(vi_cv_have_curses_keypad, [dnl
480 AC_TRY_LINK([#include <curses.h>], [keypad(0, 0);],
481 [vi_cv_have_curses_keypad=yes],
482 [vi_cv_have_curses_keypad=no])])
483 if test "$vi_cv_have_curses_keypad" = yes; then
484 AC_DEFINE(HAVE_CURSES_KEYPAD)
486 AC_MSG_RESULT($vi_cv_have_curses_keypad)
488 dnl Check for the newterm function.
489 AC_MSG_CHECKING(for newterm)
490 AC_CACHE_VAL(vi_cv_have_curses_newterm, [dnl
491 AC_TRY_LINK([#include <curses.h>], [newterm(0, 0, 0);],
492 [vi_cv_have_curses_newterm=yes],
493 [vi_cv_have_curses_newterm=no])])
494 if test "$vi_cv_have_curses_newterm" = yes; then
495 AC_DEFINE(HAVE_CURSES_NEWTERM)
497 AC_MSG_RESULT($vi_cv_have_curses_newterm)
499 if test "$vi_cv_have_curses_newterm" = no; then
500 AC_DEFINE(HAVE_BSD_CURSES)
504 dnl Check for the setupterm function. We make this check regardless of
505 dnl using the system library, because it may be part of the underlying
506 dnl termcap/termlib support, and we want to use the local one.
507 AC_MSG_CHECKING(for setupterm)
508 AC_CACHE_VAL(vi_cv_have_curses_setupterm, [dnl
509 AC_TRY_LINK([#include <curses.h>], [setupterm(0, 0, 0);],
510 [vi_cv_have_curses_setupterm=yes],
511 [vi_cv_have_curses_setupterm=no])])
512 if test "$vi_cv_have_curses_setupterm" = yes; then
513 AC_DEFINE(HAVE_CURSES_SETUPTERM)
515 AC_MSG_RESULT($vi_cv_have_curses_setupterm)
517 dnl Some moron decided to drop off an argument from the gettimeofday call,
518 dnl without changing the name.
519 AC_MSG_CHECKING(for broken gettimeofday system call)
520 AC_CACHE_VAL(vi_cv_gettimeofday, [dnl
521 AC_TRY_LINK([#include <sys/types.h>
522 #include <sys/time.h>], [gettimeofday(0, 0);],
523 [vi_cv_gettimeofday=okay], [vi_cv_gettimeofday=broken])])
524 if test "$vi_cv_gettimeofday" = broken; then
525 AC_DEFINE(HAVE_BROKEN_GETTIMEOFDAY)
527 AC_MSG_RESULT($vi_cv_gettimeofday)
529 dnl Check for which version of openpty to use, System V or Berkeley.
530 AC_MSG_CHECKING(for System V pty calls)
531 AC_CACHE_VAL(vi_cv_sys5_pty, [dnl
532 AC_TRY_LINK(, [grantpt(0);],
533 [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])])
534 if test "$vi_cv_sys5_pty" = yes; then
535 AC_DEFINE(HAVE_SYS5_PTY)
537 AC_MSG_RESULT($vi_cv_sys5_pty)
539 dnl Check for the revoke system call.
540 AC_MSG_CHECKING(for revoke system call)
541 AC_CACHE_VAL(vi_cv_revoke, [dnl
542 AC_TRY_LINK(, [revoke("a");],
543 [vi_cv_revoke=yes], [vi_cv_revoke=no])])
544 if test "$vi_cv_revoke" = yes; then
545 AC_DEFINE(HAVE_REVOKE)
547 AC_MSG_RESULT($vi_cv_revoke)
549 dnl Some versions of sprintf return a pointer to the first argument instead
550 dnl of a character count. We assume that the return value of snprintf and
551 dnl vsprintf etc. will be the same as sprintf, and check the easy one.
552 AC_MSG_CHECKING(for int type sprintf return value)
553 AC_CACHE_VAL(vi_cv_sprintf_count, [dnl
554 AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}],
555 [vi_cv_sprintf_count=yes], [vi_cv_sprintf_count=no])])
556 if test "$vi_cv_sprintf_count" = no; then
557 AC_DEFINE(SPRINTF_RET_CHARPNT)
559 AC_MSG_RESULT($vi_cv_sprintf_count)
561 dnl We compile in nvi's DB routines unless the user specifies otherwise.
562 AC_MSG_CHECKING(if --disable-db option specified)
564 [ --disable-db DON'T use the nvi-provided DB routines.],
565 [vi_cv_db_lib="other DB"], [vi_cv_db_lib="bundled DB"])
566 AC_MSG_RESULT($vi_cv_db_lib)
567 case "$vi_cv_db_lib" in
569 CPPFLAGS="-I\$(srcdir)/db/include $CPPFLAGS"
570 LIBOBJS="\$(DBOBJS) $LIBOBJS";;
575 dnl We compile in nvi's RE routines unless the user specifies otherwise.
576 AC_MSG_CHECKING(if --disable-re option specified)
578 [ --disable-re DON'T use the nvi-provided RE routines.],
579 [vi_cv_re_lib="other RE"], [vi_cv_re_lib="bundled RE"])
580 AC_MSG_RESULT($vi_cv_re_lib)
581 case "$vi_cv_re_lib" in
583 CPPFLAGS="-I\$(srcdir)/regex $CPPFLAGS"
584 LIBOBJS="\$(REOBJS) $LIBOBJS";;
589 dnl Check for the standard shorthand types.
590 AC_SUBST(u_char_decl)
591 AC_MSG_CHECKING(for u_char)
592 AC_CACHE_VAL(vi_cv_uchar, [dnl
593 AC_TRY_COMPILE([#include <sys/types.h>], u_char foo;,
594 [vi_cv_uchar=yes], [vi_cv_uchar=no])])
595 AC_MSG_RESULT($vi_cv_uchar)
596 if test "$vi_cv_uchar" = no; then
597 u_char_decl="typedef unsigned char u_char;"
600 AC_SUBST(u_short_decl)
601 AC_MSG_CHECKING(for u_short)
602 AC_CACHE_VAL(vi_cv_ushort, [dnl
603 AC_TRY_COMPILE([#include <sys/types.h>], u_short foo;,
604 [vi_cv_ushort=yes], [vi_cv_ushort=no])])
605 AC_MSG_RESULT($vi_cv_ushort)
606 if test "$vi_cv_ushort" = no; then
607 u_short_decl="typedef unsigned short u_short;"
611 AC_MSG_CHECKING(for u_int)
612 AC_CACHE_VAL(vi_cv_uint, [dnl
613 AC_TRY_COMPILE([#include <sys/types.h>], u_int foo;,
614 [vi_cv_uint=yes], [vi_cv_uint=no])])
615 AC_MSG_RESULT($vi_cv_uint)
616 if test "$vi_cv_uint" = no; then
617 u_int_decl="typedef unsigned int u_int;"
620 AC_SUBST(u_long_decl)
621 AC_MSG_CHECKING(for u_long)
622 AC_CACHE_VAL(vi_cv_ulong, [dnl
623 AC_TRY_COMPILE([#include <sys/types.h>], u_long foo;,
624 [vi_cv_ulong=yes], [vi_cv_ulong=no])])
625 AC_MSG_RESULT($vi_cv_ulong)
626 if test "$vi_cv_ulong" = no; then
627 u_long_decl="typedef unsigned long u_long;"
630 dnl DB/Vi use specific integer sizes.
631 AC_SUBST(u_int8_decl)
632 AC_MSG_CHECKING(for u_int8_t)
633 AC_CACHE_VAL(vi_cv_uint8, [dnl
634 AC_TRY_COMPILE([#include <sys/types.h>], u_int8_t foo;,
636 AC_TRY_RUN([main(){exit(sizeof(unsigned char) != 1);}],
637 [vi_cv_uint8="unsigned char"], [vi_cv_uint8=no]))])
638 AC_MSG_RESULT($vi_cv_uint8)
639 if test "$vi_cv_uint8" = no; then
641 echo "Fatal error: no unsigned, 8-bit integral type."
644 if test "$vi_cv_uint8" != yes; then
645 u_int8_decl="typedef $vi_cv_uint8 u_int8_t;"
648 AC_SUBST(u_int16_decl)
649 AC_MSG_CHECKING(for u_int16_t)
650 AC_CACHE_VAL(vi_cv_uint16, [dnl
651 AC_TRY_COMPILE([#include <sys/types.h>], u_int16_t foo;,
653 AC_TRY_RUN([main(){exit(sizeof(unsigned short) != 2);}],
654 [vi_cv_uint16="unsigned short"],
655 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 2);}],
656 [vi_cv_uint16="unsigned int"], [vi_cv_uint16=no])))])
657 AC_MSG_RESULT($vi_cv_uint16)
658 if test "$vi_cv_uint16" = no; then
660 echo "Fatal error: no unsigned, 16-bit integral type."
663 if test "$vi_cv_uint16" != yes; then
664 u_int16_decl="typedef $vi_cv_uint16 u_int16_t;"
668 AC_MSG_CHECKING(for int16_t)
669 AC_CACHE_VAL(vi_cv_int16, [dnl
670 AC_TRY_COMPILE([#include <sys/types.h>], int16_t foo;,
672 AC_TRY_RUN([main(){exit(sizeof(short) != 2);}],
673 [vi_cv_int16="short"],
674 AC_TRY_RUN([main(){exit(sizeof(int) != 2);}],
675 [vi_cv_int16="int"], [vi_cv_int16=no])))])
676 AC_MSG_RESULT($vi_cv_int16)
677 if test "$vi_cv_int16" = no; then
679 echo "Fatal error: no signed, 16-bit integral type."
682 if test "$vi_cv_int16" != yes; then
683 int16_decl="typedef $vi_cv_int16 int16_t;"
686 AC_SUBST(u_int32_decl)
687 AC_MSG_CHECKING(for u_int32_t)
688 AC_CACHE_VAL(vi_cv_uint32, [dnl
689 AC_TRY_COMPILE([#include <sys/types.h>], u_int32_t foo;,
691 AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}],
692 [vi_cv_uint32="unsigned int"],
693 AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}],
694 [vi_cv_uint32="unsigned long"], [vi_cv_uint32=no])))])
695 AC_MSG_RESULT($vi_cv_uint32)
696 if test "$vi_cv_uint32" = no; then
698 echo "Fatal error: no unsigned, 32-bit integral type."
701 if test "$vi_cv_uint32" != yes; then
702 u_int32_decl="typedef $vi_cv_uint32 u_int32_t;"
706 AC_MSG_CHECKING(for int32_t)
707 AC_CACHE_VAL(vi_cv_int32, [dnl
708 AC_TRY_COMPILE([#include <sys/types.h>], int32_t foo;,
710 AC_TRY_RUN([main(){exit(sizeof(int) != 4);}],
712 AC_TRY_RUN([main(){exit(sizeof(long) != 4);}],
713 [vi_cv_int32="long"], [vi_cv_int32=no])))])
714 AC_MSG_RESULT($vi_cv_int32)
715 if test "$vi_cv_int32" = no; then
717 echo "Fatal error: no signed, 32-bit integral type."
720 if test "$vi_cv_int32" != yes; then
721 int32_decl="typedef $vi_cv_int32 int32_t;"
724 AC_OUTPUT(Makefile port.h:port.h.in
725 pathnames.h:pathnames.h.in recover:recover.in)