1dnl @(#)configure.in 8.134 (Berkeley) 10/15/96 2 3dnl Process this file with autoconf to produce a configure script. 4AC_INIT(../common/main.c) 5AC_CONFIG_HEADER(config.h) 6 7dnl Configure setup. 8AC_PROG_INSTALL() 9AC_CANONICAL_HOST 10AC_ARG_PROGRAM() 11 12dnl If the user wants a debugging environment, set OPTFLAG now. (Some 13dnl compilers won't mix optimizing and debug flags.) 14AC_MSG_CHECKING(if --enable-debug option specified) 15AC_ARG_ENABLE(debug, 16 [ --enable-debug Build a debugging version.], 17 [vi_cv_debug="yes"], [vi_cv_debug="no"]) 18if test "$vi_cv_debug" = yes; then 19 AC_DEFINE(DEBUG) 20 OPTFLAG=${OPTFLAG-"-g"} 21 no_op_OPTFLAG=${no_op_OPTFLAG-"-g"} 22fi 23AC_MSG_RESULT($vi_cv_debug) 24 25dnl This is where we handle stuff that autoconf can't handle. 26dnl XXX 27dnl Don't override anything if it's already set from the environment. 28 29dnl Compiler, preprocessor and load flags. 30dnl AUX: -ZP disables _BSD_SOURCE et al, but enables POSIX at link time. 31dnl LynxOS: We check for gcc 2.x or better, the gcc 1 that was shipped with 32dnl LynxOS historically wasn't good enough. 33AC_SUBST(CPPFLAGS) 34case "$host_os" in 35aix3.2.5) OPTFLAG=${OPTFLAG-"-O"};; 36aix4.1*) CFLAGS=${CFLAGS-"-qstrict"} 37 OPTFLAG=${OPTFLAG-"-O3"};; 38aux*) CPPFLAGS=${CPPFLAGS-"-ZP -D_BSD_SOURCE -D_SYSV_SOURCE -D_AUX_SOURCE"} 39 LDFLAGS=${LDFLAGS-"-ZP"} 40 OPTFLAG=${OPTFLAG-"-O"};; 41bsd4.4) OPTFLAG=${OPTFLAG-"-O2"};; 42bsdi*) CC=${CC-"shlicc"} 43 OPTFLAG=${OPTFLAG-"-O2"};; 44irix6*) OPTFLAG=${OPTFLAG-"-O2"};; 45irix*) OPTFLAG=${OPTFLAG-"-O2"};; 46lynxos*) 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;; 59nextstep3) CPPFLAGS=${CPPFLAGS-"-w -pipe -posix"} 60 LDFLAGS=${LDFLAGS-"-posix"} 61 OPTFLAG=${OPTFLAG-"-O9"};; 62osf*) CFLAGS=${CFLAGS-"-Olimit 1000"};; 63solaris*) no_op_OPTFLAG=${no_op_OPTFLAG-""};; 64sunos*) no_op_OPTFLAG=${no_op_OPTFLAG-""};; 65esac 66 67dnl The default compiler is cc. 68AC_SUBST(CC) 69CC=${CC-cc} 70 71dnl The default OPTFLAG is -O 72AC_SUBST(OPTFLAG) 73OPTFLAG=${OPTFLAG-"-O"} 74 75dnl The SunOS/Solaris compiler can't optimize vi/v_txt.c; the symptom is 76dnl that the command 35i==<esc> turns into an infinite loop. 77AC_SUBST(no_op_OPTFLAG) 78no_op_OPTFLAG=${no_op_OPTFLAG-"$OPTFLAG"} 79 80dnl Libraries. 81case "$host_os" in 82bsdi2.1) LIBS=${LIBS-"-lipc"};; 83dgux*) LIBS=${LIBS-"-ldgc"};; 84irix6*) LIBS=${LIBS-"-lbsd"};; 85irix*) LIBS=${LIBS-"-lc_s -lbsd"};; 86isc*) LIBS=${LIBS-"-lcposix -linet"};; 87netbsd1*) LIBS=${LIBS-"-lcrypt"};; 88ptx*) LIBS=${LIBS-"-lseq -linet -lsocket"};; 89sco3.2*) LIBS=${LIBS-"-lsocket"};; 90sinix*) LIBS=${LIBS-"-lelf -lc"};; 91solaris*) LIBS=${LIBS-"-lsocket -lnsl -ldl"} 92 RLIBS=yes;; 93wgs*) LIBS=${LIBS-"-lnsl"};; 94esac 95 96dnl A/UX has a broken getopt(3), strpbrk(3). 97case "$host_os" in 98aux*) LIBOBJS="getopt.o strpbrk.o $LIBOBJS";; 99esac 100 101dnl Ultrix has a broken POSIX.1 VDISABLE value. 102case "$host_os" in 103ultrix*) AC_DEFINE(HAVE_BROKEN_VDISABLE);; 104esac 105 106dnl The user may have additional CPP information. 107CPPFLAGS="$ADDCPPFLAGS $CPPFLAGS" 108 109dnl The user may have additional load line information. 110LDFLAGS="$ADDLDFLAGS $LDFLAGS" 111 112dnl The user may have additional library information. 113LIBS="$ADDLIBS $LIBS" 114 115dnl Check to see if it's going to work. 116AM_SANITY_CHECK_CC 117 118dnl Checks for programs. 119PATH="$PATH:/usr/bin:/usr/sbin:/sbin:/etc:/usr/etc:/usr/lib:/usr/ucblib:" 120 121dnl Check for the shell path. 122AC_PATH_PROG(vi_cv_path_shell, sh, no) 123if test "$vi_cv_path_shell" = no; then 124 echo "Fatal error: the shell utility not found." 125 exit 1 126fi 127 128dnl Check for the sendmail path. 129AC_PATH_PROG(vi_cv_path_sendmail, sendmail, no) 130if 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." 133fi 134 135dnl Check for the perl5/perl path. 136AC_SUBST(vi_cv_path_perl) 137AC_PATH_PROGS(vi_cv_path_perl, perl5 perl, no) 138 139dnl Check for the "preserve" path. 140dnl Historically, nvi has used /var/tmp/vi.recover. The Linux filesystem 141dnl standard (FSSTND) uses /var/preserve; we add the vi.recover directory 142dnl beneath it so that we don't have name collisions with other editors. 143dnl Other systems have /var/preserve as well, so we test first for an already 144dnl existing name, and then use the first one that's writeable. 145AC_SUBST(vi_cv_path_preserve) 146AC_MSG_CHECKING(for preserve directory) 147AC_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]) 165if test "$vi_cv_path_preserve" = no; then 166 echo "Fatal error: no writeable preserve directory found." 167 exit 1 168fi 169AC_MSG_RESULT($vi_cv_path_preserve) 170 171dnl Check for programs used for installation 172AC_PATH_PROG(vi_cv_path_chmod, chmod, missing_chmod) 173AC_PATH_PROG(vi_cv_path_cp, cp, missing_cp) 174AC_PATH_PROG(vi_cv_path_ln, ln, missing_ln) 175AC_PATH_PROG(vi_cv_path_mkdir, mkdir, missing_mkdir) 176AC_PATH_PROG(vi_cv_path_rm, rm, missing_rm) 177AC_PATH_PROG(vi_cv_path_strip, strip, missing_strip) 178 179dnl Checks for libraries. 180dnl Find the X libraries and includes. 181AC_PATH_X 182AC_SUBST(XINCS) 183if 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 195fi 196 197dnl If the user wants a Perl interpreter in nvi, load it. 198AC_SUBST(shrpenv) 199AC_SUBST(vi_cv_perllib) 200AC_MSG_CHECKING(if --enable-perlinterp option specified) 201AC_ARG_ENABLE(perlinterp, 202 [ --enable-perlinterp Include a Perl interpreter in vi.], 203 [vi_cv_perlinterp="yes"], [vi_cv_perlinterp="no"]) 204AC_MSG_RESULT($vi_cv_perlinterp) 205if 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) 239fi 240 241dnl If the user wants a Tk/Tcl front-end for nvi, build it. 242AC_SUBST(tknvi) 243AC_SUBST(TKLIBS) 244AC_MSG_CHECKING(if --enable-tknvi option specified) 245AC_ARG_ENABLE(tknvi, 246 [ --enable-tknvi Build a Tk/Tcl front-end for vi.], 247 [vi_cv_tknvi="yes"], [vi_cv_tknvi="no"]) 248AC_MSG_RESULT($vi_cv_tknvi) 249if test "$vi_cv_tknvi" = "yes"; then 250 tknvi=tknvi 251 TKLIBS="-ltk -ltcl -lm $XLIBS $LIBS" 252fi 253 254dnl If the user wants a Tk/Tcl interpreter in nvi, load it. 255AC_MSG_CHECKING(if --enable-tclinterp option specified) 256AC_ARG_ENABLE(tclinterp, 257 [ --enable-tclinterp Include a Tk/Tcl interpreter in vi.], 258 [vi_cv_tclinterp="yes"], [vi_cv_tclinterp="no"]) 259AC_MSG_RESULT($vi_cv_tclinterp) 260if test "$vi_cv_tclinterp" = "yes"; then 261 LIBOBJS="tcl.o $LIBOBJS" 262 LIBS="-ltk -ltcl -lm $XLIBS $LIBS" 263 AC_DEFINE(HAVE_TCL_INTERP) 264fi 265 266dnl Make sure that we can find a Tk/Tcl library. 267if 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 275fi 276 277dnl Both Tcl/Tk and Perl interpreters need the vi api code. 278if test "$vi_cv_tclinterp" = yes || test "$vi_cv_perlinterp" = yes; then 279 LIBOBJS="api.o $LIBOBJS" 280fi 281 282dnl Check for the termcap/termlib library. Compile in nvi's curses routines 283dnl unless the user specifies otherwise. These two checks must occur in the 284dnl current order, and -lcurses must be loaded before -ltermcap/-ltermlib. 285AC_CHECK_LIB(termlib, tgetent, 286 [vi_cv_termlib=-ltermlib], [vi_cv_termlib=no]) 287if test "$vi_cv_termlib" = no; then 288 AC_CHECK_LIB(termcap, tgetent, 289 [vi_cv_termlib=-ltermcap], [vi_cv_termlib=no]) 290fi 291if test "$vi_cv_termlib" != no; then 292 LIBS="$vi_cv_termlib $LIBS" 293fi 294AC_SUBST(cobjs) 295AC_MSG_CHECKING(if --disable-curses option specified) 296AC_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"]) 299AC_MSG_RESULT($vi_cv_curses) 300case "$vi_cv_curses" in 301"bundled curses") 302 CPPFLAGS="-I\$(srcdir)/curses $CPPFLAGS" 303 cobjs="\$(COBJS)";; 304"other curses") 305 LIBS="-lcurses $LIBS";; 306esac 307 308dnl Checks for header files. 309AC_MSG_CHECKING(for sys/mman.h) 310AC_CACHE_VAL(vi_cv_include_sys_mman, [dnl 311AC_TRY_CPP([#include <sys/mman.h>], 312 [vi_cv_include_sys_mman=yes], [vi_cv_include_sys_mman=no])]) 313if test "$vi_cv_include_sys_mman" = yes; then 314 AC_DEFINE(HAVE_SYS_MMAN_H) 315fi 316AC_MSG_RESULT($vi_cv_include_sys_mman) 317 318AC_MSG_CHECKING(for sys/select.h) 319AC_CACHE_VAL(vi_cv_include_sys_select, [dnl 320AC_TRY_CPP([#include <sys/select.h>], 321 [vi_cv_include_sys_select=yes], [vi_cv_include_sys_select=no])]) 322if test "$vi_cv_include_sys_select" = yes; then 323 AC_DEFINE(HAVE_SYS_SELECT_H) 324fi 325AC_MSG_RESULT($vi_cv_include_sys_select) 326 327dnl Checks for typedefs, structures, and compiler characteristics. 328AC_CHECK_TYPE(ssize_t, int) 329AC_C_BIGENDIAN 330AC_C_CONST 331AC_STRUCT_ST_BLKSIZE 332AC_TYPE_MODE_T 333AC_TYPE_OFF_T 334AC_TYPE_PID_T 335AC_TYPE_SIZE_T 336AC_STRUCT_TM 337 338dnl Checks for library functions. 339 AC_CHECK_FUNCS(bsearch gethostname getopt memchr memcpy memmove memset) 340AC_REPLACE_FUNCS(bsearch gethostname getopt memchr memcpy memmove memset) 341 AC_CHECK_FUNCS(mkstemp mmap snprintf strdup strerror strpbrk strtol) 342AC_REPLACE_FUNCS(mkstemp mmap snprintf strdup strerror strpbrk strtol) 343 AC_CHECK_FUNCS(strtoul vsnprintf) 344AC_REPLACE_FUNCS(strtoul vsnprintf) 345 346AC_CHECK_FUNCS(select) 347AC_CHECK_FUNCS(setenv, [need_env=no], [need_env=yes]) 348AC_CHECK_FUNCS(strsep, [need_strsep=no], [need_strsep=yes]) 349AC_CHECK_FUNCS(unsetenv,, [need_env=yes]) 350 351AC_FUNC_MMAP 352AC_FUNC_VFORK 353 354dnl If we needed setenv or unsetenv, add in the clib/env.c replacement file. 355if test "$need_env" = yes; then 356 LIBOBJS="env.o $LIBOBJS" 357fi 358 359dnl If we need strsep, add it and define it so we get a prototype. 360if test "$need_strsep" = yes; then 361 LIBOBJS="strsep.o $LIBOBJS" 362fi 363 364dnl Check for fcntl/flock 365dnl Use flock preferentially, since it has cleaner semantics and won't 366dnl hang up the editor. 367dnl XXX 368dnl Ultrix has a broken fcntl, but a working flock. 369dnl IRIX and DGUX have a broken flock, but working fcntl. 370AC_MSG_CHECKING(for fcntl/flock) 371AC_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 385if test "$vi_cv_lock" = flock; then 386 AC_DEFINE(HAVE_LOCK_FLOCK) 387fi 388if test "$vi_cv_lock" = fcntl; then 389 AC_DEFINE(HAVE_LOCK_FCNTL) 390fi 391AC_MSG_RESULT($vi_cv_lock) 392 393dnl Check for ftruncate/chsize 394AC_MSG_CHECKING(for ftruncate/chsize) 395AC_CACHE_VAL(vi_cv_ftruncate, [dnl 396AC_TRY_LINK([#include <unistd.h>], [ftruncate(0, 0);], 397 [vi_cv_ftruncate=ftruncate], 398AC_TRY_LINK([#include <unistd.h>], [chsize(0, 0);], 399 [vi_cv_ftruncate=chsize], [vi_cv_ftruncate=no]))]) 400if test "$vi_cv_ftruncate" = ftruncate; then 401 AC_DEFINE(HAVE_FTRUNCATE_FTRUNCATE) 402fi 403if test "$vi_cv_ftruncate" = chsize; then 404 AC_DEFINE(HAVE_FTRUNCATE_CHSIZE) 405fi 406if test "$vi_cv_ftruncate" = no; then 407 echo 408 echo "Fatal error: no file truncation system call." 409 exit 1 410fi 411AC_MSG_RESULT($vi_cv_ftruncate) 412 413dnl Check for the tigetstr/tigetnum functions. 414AC_MSG_CHECKING(for tigetstr/tigetnum) 415AC_CACHE_VAL(vi_cv_have_curses_tigetstr, [dnl 416AC_TRY_LINK([#include <curses.h>], [tigetstr(0);], 417 [vi_cv_have_curses_tigetstr=yes], 418 [vi_cv_have_curses_tigetstr=no])]) 419if test "$vi_cv_have_curses_tigetstr" = yes; then 420 AC_DEFINE(HAVE_CURSES_TIGETSTR) 421fi 422AC_MSG_RESULT($vi_cv_have_curses_tigetstr) 423 424dnl Check for potentially missing curses functions in system or user-specified 425dnl libraries. We also have to guess at whether the specified library is a 426dnl BSD or System V style curses. Use the newterm function, all System V 427dnl curses implementations have it, none, as far as I know, of the BSD ones do. 428if 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) 432else 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 502fi 503 504dnl Check for the setupterm function. We make this check regardless of 505dnl using the system library, because it may be part of the underlying 506dnl termcap/termlib support, and we want to use the local one. 507AC_MSG_CHECKING(for setupterm) 508AC_CACHE_VAL(vi_cv_have_curses_setupterm, [dnl 509AC_TRY_LINK([#include <curses.h>], [setupterm(0, 0, 0);], 510 [vi_cv_have_curses_setupterm=yes], 511 [vi_cv_have_curses_setupterm=no])]) 512if test "$vi_cv_have_curses_setupterm" = yes; then 513 AC_DEFINE(HAVE_CURSES_SETUPTERM) 514fi 515AC_MSG_RESULT($vi_cv_have_curses_setupterm) 516 517dnl Some moron decided to drop off an argument from the gettimeofday call, 518dnl without changing the name. 519AC_MSG_CHECKING(for broken gettimeofday system call) 520AC_CACHE_VAL(vi_cv_gettimeofday, [dnl 521AC_TRY_LINK([#include <sys/types.h> 522#include <sys/time.h>], [gettimeofday(0, 0);], 523 [vi_cv_gettimeofday=okay], [vi_cv_gettimeofday=broken])]) 524if test "$vi_cv_gettimeofday" = broken; then 525 AC_DEFINE(HAVE_BROKEN_GETTIMEOFDAY) 526fi 527AC_MSG_RESULT($vi_cv_gettimeofday) 528 529dnl Check for which version of openpty to use, System V or Berkeley. 530AC_MSG_CHECKING(for System V pty calls) 531AC_CACHE_VAL(vi_cv_sys5_pty, [dnl 532AC_TRY_LINK(, [grantpt(0);], 533 [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])]) 534if test "$vi_cv_sys5_pty" = yes; then 535 AC_DEFINE(HAVE_SYS5_PTY) 536fi 537AC_MSG_RESULT($vi_cv_sys5_pty) 538 539dnl Check for the revoke system call. 540AC_MSG_CHECKING(for revoke system call) 541AC_CACHE_VAL(vi_cv_revoke, [dnl 542AC_TRY_LINK(, [revoke("a");], 543 [vi_cv_revoke=yes], [vi_cv_revoke=no])]) 544if test "$vi_cv_revoke" = yes; then 545 AC_DEFINE(HAVE_REVOKE) 546fi 547AC_MSG_RESULT($vi_cv_revoke) 548 549dnl Some versions of sprintf return a pointer to the first argument instead 550dnl of a character count. We assume that the return value of snprintf and 551dnl vsprintf etc. will be the same as sprintf, and check the easy one. 552AC_MSG_CHECKING(for int type sprintf return value) 553AC_CACHE_VAL(vi_cv_sprintf_count, [dnl 554AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}], 555 [vi_cv_sprintf_count=yes], [vi_cv_sprintf_count=no])]) 556if test "$vi_cv_sprintf_count" = no; then 557 AC_DEFINE(SPRINTF_RET_CHARPNT) 558fi 559AC_MSG_RESULT($vi_cv_sprintf_count) 560 561dnl We compile in nvi's DB routines unless the user specifies otherwise. 562AC_MSG_CHECKING(if --disable-db option specified) 563AC_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"]) 566AC_MSG_RESULT($vi_cv_db_lib) 567case "$vi_cv_db_lib" in 568"bundled DB") 569 CPPFLAGS="-I\$(srcdir)/db/include $CPPFLAGS" 570 LIBOBJS="\$(DBOBJS) $LIBOBJS";; 571"other DB") 572 ;; 573esac 574 575dnl We compile in nvi's RE routines unless the user specifies otherwise. 576AC_MSG_CHECKING(if --disable-re option specified) 577AC_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"]) 580AC_MSG_RESULT($vi_cv_re_lib) 581case "$vi_cv_re_lib" in 582"bundled RE") 583 CPPFLAGS="-I\$(srcdir)/regex $CPPFLAGS" 584 LIBOBJS="\$(REOBJS) $LIBOBJS";; 585"other RE") 586 ;; 587esac 588 589dnl Check for the standard shorthand types. 590AC_SUBST(u_char_decl) 591AC_MSG_CHECKING(for u_char) 592AC_CACHE_VAL(vi_cv_uchar, [dnl 593AC_TRY_COMPILE([#include <sys/types.h>], u_char foo;, 594 [vi_cv_uchar=yes], [vi_cv_uchar=no])]) 595AC_MSG_RESULT($vi_cv_uchar) 596if test "$vi_cv_uchar" = no; then 597 u_char_decl="typedef unsigned char u_char;" 598fi 599 600AC_SUBST(u_short_decl) 601AC_MSG_CHECKING(for u_short) 602AC_CACHE_VAL(vi_cv_ushort, [dnl 603AC_TRY_COMPILE([#include <sys/types.h>], u_short foo;, 604 [vi_cv_ushort=yes], [vi_cv_ushort=no])]) 605AC_MSG_RESULT($vi_cv_ushort) 606if test "$vi_cv_ushort" = no; then 607 u_short_decl="typedef unsigned short u_short;" 608fi 609 610AC_SUBST(u_int_decl) 611AC_MSG_CHECKING(for u_int) 612AC_CACHE_VAL(vi_cv_uint, [dnl 613AC_TRY_COMPILE([#include <sys/types.h>], u_int foo;, 614 [vi_cv_uint=yes], [vi_cv_uint=no])]) 615AC_MSG_RESULT($vi_cv_uint) 616if test "$vi_cv_uint" = no; then 617 u_int_decl="typedef unsigned int u_int;" 618fi 619 620AC_SUBST(u_long_decl) 621AC_MSG_CHECKING(for u_long) 622AC_CACHE_VAL(vi_cv_ulong, [dnl 623AC_TRY_COMPILE([#include <sys/types.h>], u_long foo;, 624 [vi_cv_ulong=yes], [vi_cv_ulong=no])]) 625AC_MSG_RESULT($vi_cv_ulong) 626if test "$vi_cv_ulong" = no; then 627 u_long_decl="typedef unsigned long u_long;" 628fi 629 630dnl DB/Vi use specific integer sizes. 631AC_SUBST(u_int8_decl) 632AC_MSG_CHECKING(for u_int8_t) 633AC_CACHE_VAL(vi_cv_uint8, [dnl 634AC_TRY_COMPILE([#include <sys/types.h>], u_int8_t foo;, 635 [vi_cv_uint8=yes], 636AC_TRY_RUN([main(){exit(sizeof(unsigned char) != 1);}], 637 [vi_cv_uint8="unsigned char"], [vi_cv_uint8=no]))]) 638AC_MSG_RESULT($vi_cv_uint8) 639if test "$vi_cv_uint8" = no; then 640 echo 641 echo "Fatal error: no unsigned, 8-bit integral type." 642 exit 1 643fi 644if test "$vi_cv_uint8" != yes; then 645 u_int8_decl="typedef $vi_cv_uint8 u_int8_t;" 646fi 647 648AC_SUBST(u_int16_decl) 649AC_MSG_CHECKING(for u_int16_t) 650AC_CACHE_VAL(vi_cv_uint16, [dnl 651AC_TRY_COMPILE([#include <sys/types.h>], u_int16_t foo;, 652 [vi_cv_uint16=yes], 653AC_TRY_RUN([main(){exit(sizeof(unsigned short) != 2);}], 654 [vi_cv_uint16="unsigned short"], 655AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 2);}], 656 [vi_cv_uint16="unsigned int"], [vi_cv_uint16=no])))]) 657AC_MSG_RESULT($vi_cv_uint16) 658if test "$vi_cv_uint16" = no; then 659 echo 660 echo "Fatal error: no unsigned, 16-bit integral type." 661 exit 1 662fi 663if test "$vi_cv_uint16" != yes; then 664 u_int16_decl="typedef $vi_cv_uint16 u_int16_t;" 665fi 666 667AC_SUBST(int16_decl) 668AC_MSG_CHECKING(for int16_t) 669AC_CACHE_VAL(vi_cv_int16, [dnl 670AC_TRY_COMPILE([#include <sys/types.h>], int16_t foo;, 671 [vi_cv_int16=yes], 672AC_TRY_RUN([main(){exit(sizeof(short) != 2);}], 673 [vi_cv_int16="short"], 674AC_TRY_RUN([main(){exit(sizeof(int) != 2);}], 675 [vi_cv_int16="int"], [vi_cv_int16=no])))]) 676AC_MSG_RESULT($vi_cv_int16) 677if test "$vi_cv_int16" = no; then 678 echo 679 echo "Fatal error: no signed, 16-bit integral type." 680 exit 1 681fi 682if test "$vi_cv_int16" != yes; then 683 int16_decl="typedef $vi_cv_int16 int16_t;" 684fi 685 686AC_SUBST(u_int32_decl) 687AC_MSG_CHECKING(for u_int32_t) 688AC_CACHE_VAL(vi_cv_uint32, [dnl 689AC_TRY_COMPILE([#include <sys/types.h>], u_int32_t foo;, 690 [vi_cv_uint32=yes], 691AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}], 692 [vi_cv_uint32="unsigned int"], 693AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}], 694 [vi_cv_uint32="unsigned long"], [vi_cv_uint32=no])))]) 695AC_MSG_RESULT($vi_cv_uint32) 696if test "$vi_cv_uint32" = no; then 697 echo 698 echo "Fatal error: no unsigned, 32-bit integral type." 699 exit 1 700fi 701if test "$vi_cv_uint32" != yes; then 702 u_int32_decl="typedef $vi_cv_uint32 u_int32_t;" 703fi 704 705AC_SUBST(int32_decl) 706AC_MSG_CHECKING(for int32_t) 707AC_CACHE_VAL(vi_cv_int32, [dnl 708AC_TRY_COMPILE([#include <sys/types.h>], int32_t foo;, 709 [vi_cv_int32=yes], 710AC_TRY_RUN([main(){exit(sizeof(int) != 4);}], 711 [vi_cv_int32="int"], 712AC_TRY_RUN([main(){exit(sizeof(long) != 4);}], 713 [vi_cv_int32="long"], [vi_cv_int32=no])))]) 714AC_MSG_RESULT($vi_cv_int32) 715if test "$vi_cv_int32" = no; then 716 echo 717 echo "Fatal error: no signed, 32-bit integral type." 718 exit 1 719fi 720if test "$vi_cv_int32" != yes; then 721 int32_decl="typedef $vi_cv_int32 int32_t;" 722fi 723 724AC_OUTPUT(Makefile port.h:port.h.in 725 pathnames.h:pathnames.h.in recover:recover.in) 726