home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Spezial / SPEZIAL2_97.zip / SPEZIAL2_97.iso / ANWEND / EDITOR / NVI179B / NVI179B.ZIP / build / configure.in < prev    next >
Text File  |  1996-10-23  |  23KB  |  726 lines

  1. dnl    @(#)configure.in    8.134 (Berkeley) 10/15/96
  2.  
  3. dnl Process this file with autoconf to produce a configure script.
  4. AC_INIT(../common/main.c)
  5. AC_CONFIG_HEADER(config.h)
  6.  
  7. dnl Configure setup.
  8. AC_PROG_INSTALL()
  9. AC_CANONICAL_HOST
  10. AC_ARG_PROGRAM()
  11.  
  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)
  15. AC_ARG_ENABLE(debug,
  16.     [  --enable-debug          Build a debugging version.],
  17.     [vi_cv_debug="yes"], [vi_cv_debug="no"])
  18. if test "$vi_cv_debug" = yes; then
  19.     AC_DEFINE(DEBUG)
  20.     OPTFLAG=${OPTFLAG-"-g"}
  21.     no_op_OPTFLAG=${no_op_OPTFLAG-"-g"}
  22. fi
  23. AC_MSG_RESULT($vi_cv_debug)
  24.  
  25. dnl This is where we handle stuff that autoconf can't handle.
  26. dnl XXX
  27. dnl Don't override anything if it's already set from the environment.
  28.  
  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.
  33. AC_SUBST(CPPFLAGS)
  34. case "$host_os" in
  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"};;
  46. lynxos*)   AC_PROG_CC()
  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
  52.         AC_MSG_RESULT(yes)
  53.        else
  54.         AC_MSG_RESULT(no)
  55.         echo "Fatal error: Nvi requires gcc 2.x to build on LynxOS."
  56.         echo "See build/README.LynxOS for more information."
  57.         exit 1
  58.        fi;;
  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-""};;
  65. esac
  66.  
  67. dnl The default compiler is cc.
  68. AC_SUBST(CC)
  69. CC=${CC-cc}
  70.  
  71. dnl The default OPTFLAG is -O
  72. AC_SUBST(OPTFLAG)
  73. OPTFLAG=${OPTFLAG-"-O"}
  74.  
  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"}
  79.  
  80. dnl Libraries.
  81. case "$host_os" in
  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"}
  92.        RLIBS=yes;;
  93. wgs*)       LIBS=${LIBS-"-lnsl"};;
  94. esac
  95.  
  96. dnl A/UX has a broken getopt(3), strpbrk(3).
  97. case "$host_os" in
  98. aux*)       LIBOBJS="getopt.o strpbrk.o $LIBOBJS";;
  99. esac
  100.  
  101. dnl Ultrix has a broken POSIX.1 VDISABLE value.
  102. case "$host_os" in
  103. ultrix*)   AC_DEFINE(HAVE_BROKEN_VDISABLE);;
  104. esac
  105.  
  106. dnl The user may have additional CPP information.
  107. CPPFLAGS="$ADDCPPFLAGS $CPPFLAGS"
  108.  
  109. dnl The user may have additional load line information.
  110. LDFLAGS="$ADDLDFLAGS $LDFLAGS"
  111.  
  112. dnl The user may have additional library information.
  113. LIBS="$ADDLIBS $LIBS"
  114.  
  115. dnl Check to see if it's going to work.
  116. AM_SANITY_CHECK_CC
  117.  
  118. dnl Checks for programs.
  119. PATH="$PATH:/usr/bin:/usr/sbin:/sbin:/etc:/usr/etc:/usr/lib:/usr/ucblib:"
  120.  
  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."
  125.     exit 1
  126. fi
  127.  
  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."
  133. fi
  134.  
  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)
  138.  
  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
  153.             break;
  154.         fi
  155.     done
  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
  160.                 break;
  161.             fi
  162.         done
  163.  
  164.     fi])
  165. if test "$vi_cv_path_preserve" = no; then
  166.     echo "Fatal error: no writeable preserve directory found."
  167.     exit 1
  168. fi
  169. AC_MSG_RESULT($vi_cv_path_preserve)
  170.  
  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)
  178.  
  179. dnl Checks for libraries.
  180. dnl Find the X libraries and includes.
  181. AC_PATH_X
  182. AC_SUBST(XINCS)
  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"
  187.         else
  188.             XLIBS="-L$x_libraries $XLIBS"
  189.         fi
  190.     fi
  191.     XLIBS="$XLIBS -lX11"
  192.     if test "X$x_includes" != "X"; then
  193.         XINCS="-I$x_includes"
  194.     fi
  195. fi
  196.  
  197. dnl If the user wants a Perl interpreter in nvi, load it.
  198. AC_SUBST(shrpenv)
  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."
  208.         exit 1
  209.     fi
  210.     $vi_cv_path_perl -e 'require 5.002' || {
  211.         echo "Fatal error: perl5 must be version 5.002 or later."
  212.         exit 1
  213.     }
  214.     $vi_cv_path_perl -e 'close(STDERR);require 5.003_01' &&
  215.         AC_DEFINE(HAVE_PERL_5_003_01)
  216.  
  217.     eval `$vi_cv_path_perl -V:shrpenv`
  218.     if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
  219.         shrpenv=""
  220.     fi
  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"
  226.     fi
  227.     perllibs=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
  228.             -e 'ldopts'`
  229.     if test "X$perllibs" != "X"; then
  230.         LIBS="$perllibs $LIBS"
  231.     fi
  232.     perlldflags=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \
  233.             -e 'ccdlflags'`
  234.     if test "X$perlldflags" != "X"; then
  235.         LDFLAGS="$perlldflags $LDFLAGS"
  236.     fi
  237.     LIBOBJS="perl.o perlsfio.o $LIBOBJS"
  238.     AC_DEFINE(HAVE_PERL_INTERP)
  239. fi
  240.  
  241. dnl If the user wants a Tk/Tcl front-end for nvi, build it.
  242. AC_SUBST(tknvi)
  243. AC_SUBST(TKLIBS)
  244. AC_MSG_CHECKING(if --enable-tknvi option specified)
  245. AC_ARG_ENABLE(tknvi,
  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
  250.     tknvi=tknvi
  251.     TKLIBS="-ltk -ltcl -lm $XLIBS $LIBS"
  252. fi
  253.  
  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)
  264. fi
  265.  
  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."
  273.         exit 1
  274.     fi
  275. fi
  276.  
  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"
  280. fi
  281.  
  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])
  290. fi
  291. if test "$vi_cv_termlib" != no; then
  292.     LIBS="$vi_cv_termlib $LIBS"
  293. fi
  294. AC_SUBST(cobjs)
  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
  301. "bundled curses")
  302.     CPPFLAGS="-I\$(srcdir)/curses $CPPFLAGS"
  303.     cobjs="\$(COBJS)";;
  304. "other curses")
  305.     LIBS="-lcurses $LIBS";;
  306. esac
  307.  
  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)
  315. fi
  316. AC_MSG_RESULT($vi_cv_include_sys_mman)
  317.  
  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)
  324. fi
  325. AC_MSG_RESULT($vi_cv_include_sys_select)
  326.  
  327. dnl Checks for typedefs, structures, and compiler characteristics.
  328. AC_CHECK_TYPE(ssize_t, int)
  329. AC_C_BIGENDIAN
  330. AC_C_CONST
  331. AC_STRUCT_ST_BLKSIZE
  332. AC_TYPE_MODE_T
  333. AC_TYPE_OFF_T
  334. AC_TYPE_PID_T
  335. AC_TYPE_SIZE_T
  336. AC_STRUCT_TM
  337.  
  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)
  345.  
  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])
  350.  
  351. AC_FUNC_MMAP
  352. AC_FUNC_VFORK
  353.  
  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"
  357. fi
  358.  
  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"
  362. fi
  363.  
  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.
  367. dnl XXX
  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
  372.     vi_cv_lock=none
  373.     case "$host_os" in
  374.     dgux*);;
  375.     irix*);;
  376.     *)
  377.         AC_TRY_LINK([#include <fcntl.h>], [flock(0, 0);],
  378.             [vi_cv_lock=flock]);;
  379.     esac
  380.     if test "$vi_cv_lock" = none; then
  381.         AC_TRY_LINK([#include <fcntl.h>], [fcntl(0, F_SETLK, 0);],
  382.             [vi_cv_lock=fcntl])
  383.     fi])
  384.  
  385. if test "$vi_cv_lock" = flock; then
  386.     AC_DEFINE(HAVE_LOCK_FLOCK)
  387. fi
  388. if test "$vi_cv_lock" = fcntl; then
  389.     AC_DEFINE(HAVE_LOCK_FCNTL)
  390. fi
  391. AC_MSG_RESULT($vi_cv_lock)
  392.  
  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)
  402. fi
  403. if test "$vi_cv_ftruncate" = chsize; then
  404.     AC_DEFINE(HAVE_FTRUNCATE_CHSIZE)
  405. fi
  406. if test "$vi_cv_ftruncate" = no; then
  407.     echo
  408.     echo "Fatal error: no file truncation system call."
  409.     exit 1
  410. fi
  411. AC_MSG_RESULT($vi_cv_ftruncate)
  412.  
  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)
  421. fi
  422. AC_MSG_RESULT($vi_cv_have_curses_tigetstr)
  423.  
  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)
  432. else
  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)
  441.     fi
  442.     AC_MSG_RESULT($vi_cv_have_curses_addnstr)
  443.  
  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)
  452.     fi
  453.     AC_MSG_RESULT($vi_cv_have_curses_beep)
  454.  
  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)
  463.     fi
  464.     AC_MSG_RESULT($vi_cv_have_curses_flash)
  465.  
  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)
  474.     fi
  475.     AC_MSG_RESULT($vi_cv_have_curses_idlok)
  476.  
  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)
  485.     fi
  486.     AC_MSG_RESULT($vi_cv_have_curses_keypad)
  487.  
  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)
  496.     fi
  497.     AC_MSG_RESULT($vi_cv_have_curses_newterm)
  498.  
  499.     if test "$vi_cv_have_curses_newterm" = no; then
  500.         AC_DEFINE(HAVE_BSD_CURSES)
  501.     fi
  502. fi
  503.  
  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)
  514. fi
  515. AC_MSG_RESULT($vi_cv_have_curses_setupterm)
  516.  
  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)
  526. fi
  527. AC_MSG_RESULT($vi_cv_gettimeofday)
  528.  
  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)
  536. fi
  537. AC_MSG_RESULT($vi_cv_sys5_pty)
  538.  
  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)
  546. fi
  547. AC_MSG_RESULT($vi_cv_revoke)
  548.  
  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)
  558. fi
  559. AC_MSG_RESULT($vi_cv_sprintf_count)
  560.  
  561. dnl We compile in nvi's DB routines unless the user specifies otherwise.
  562. AC_MSG_CHECKING(if --disable-db option specified)
  563. AC_ARG_ENABLE(db,
  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
  568. "bundled DB")
  569.     CPPFLAGS="-I\$(srcdir)/db/include $CPPFLAGS"
  570.     LIBOBJS="\$(DBOBJS) $LIBOBJS";;
  571. "other DB")
  572.     ;;
  573. esac
  574.  
  575. dnl We compile in nvi's RE routines unless the user specifies otherwise.
  576. AC_MSG_CHECKING(if --disable-re option specified)
  577. AC_ARG_ENABLE(re,
  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
  582. "bundled RE")
  583.     CPPFLAGS="-I\$(srcdir)/regex $CPPFLAGS"
  584.     LIBOBJS="\$(REOBJS) $LIBOBJS";;
  585. "other RE")
  586.     ;;
  587. esac
  588.  
  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;"
  598. fi
  599.  
  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;"
  608. fi
  609.  
  610. AC_SUBST(u_int_decl)
  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;"
  618. fi
  619.  
  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;"
  628. fi
  629.  
  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;,
  635.     [vi_cv_uint8=yes],
  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
  640.     echo
  641.     echo "Fatal error: no unsigned, 8-bit integral type."
  642.     exit 1
  643. fi
  644. if test "$vi_cv_uint8" != yes; then
  645.     u_int8_decl="typedef $vi_cv_uint8 u_int8_t;"
  646. fi
  647.  
  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;,
  652.     [vi_cv_uint16=yes],
  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
  659.     echo
  660.     echo "Fatal error: no unsigned, 16-bit integral type."
  661.     exit 1
  662. fi
  663. if test "$vi_cv_uint16" != yes; then
  664.     u_int16_decl="typedef $vi_cv_uint16 u_int16_t;"
  665. fi
  666.  
  667. AC_SUBST(int16_decl)
  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;,
  671.     [vi_cv_int16=yes],
  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
  678.     echo
  679.     echo "Fatal error: no signed, 16-bit integral type."
  680.     exit 1
  681. fi
  682. if test "$vi_cv_int16" != yes; then
  683.     int16_decl="typedef $vi_cv_int16 int16_t;"
  684. fi
  685.  
  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;,
  690.     [vi_cv_uint32=yes],
  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
  697.     echo
  698.     echo "Fatal error: no unsigned, 32-bit integral type."
  699.     exit 1
  700. fi
  701. if test "$vi_cv_uint32" != yes; then
  702.     u_int32_decl="typedef $vi_cv_uint32 u_int32_t;"
  703. fi
  704.  
  705. AC_SUBST(int32_decl)
  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;,
  709.     [vi_cv_int32=yes],
  710. AC_TRY_RUN([main(){exit(sizeof(int) != 4);}],
  711.     [vi_cv_int32="int"],
  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
  716.     echo
  717.     echo "Fatal error: no signed, 32-bit integral type."
  718.     exit 1
  719. fi
  720. if test "$vi_cv_int32" != yes; then
  721.     int32_decl="typedef $vi_cv_int32 int32_t;"
  722. fi
  723.  
  724. AC_OUTPUT(Makefile port.h:port.h.in
  725.     pathnames.h:pathnames.h.in recover:recover.in)
  726.